From b4109be58431bcd915d032d97c24a9119947da9c Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Fri, 28 Sep 2018 09:01:38 -0700 Subject: [PATCH 001/661] Confirm that generic API method name is not needed after call creation --- test/cpp/end2end/generic_end2end_test.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 88a1227ca2e..0bdaf83618a 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -123,8 +123,16 @@ class GenericEnd2endTest : public ::testing::Test { cli_ctx.set_deadline(deadline); } + // Rather than using the original kMethodName, make a short-lived + // copy to also confirm that we don't refer to this object beyond + // the initial call preparation + const grpc::string* method_name = new grpc::string(kMethodName); + std::unique_ptr call = - generic_stub_->PrepareCall(&cli_ctx, kMethodName, &cli_cq_); + generic_stub_->PrepareCall(&cli_ctx, *method_name, &cli_cq_); + + delete method_name; // Make sure that this is not needed after invocation + call->StartCall(tag(1)); client_ok(1); std::unique_ptr send_buffer = From 1c766d5c6d2ddec146f3140eeefff7557ecd8228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20Sojma?= Date: Tue, 6 Nov 2018 15:03:15 +0100 Subject: [PATCH 002/661] ability to set "no_proxy" with use of "no_grpc_proxy" environment variable --- src/core/ext/filters/client_channel/http_proxy.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/ext/filters/client_channel/http_proxy.cc b/src/core/ext/filters/client_channel/http_proxy.cc index 8951a2920c4..3f05b23ffaf 100644 --- a/src/core/ext/filters/client_channel/http_proxy.cc +++ b/src/core/ext/filters/client_channel/http_proxy.cc @@ -122,7 +122,10 @@ static bool proxy_mapper_map_name(grpc_proxy_mapper* mapper, server_uri); goto no_use_proxy; } - no_proxy_str = gpr_getenv("no_proxy"); + no_proxy_str = gpr_getenv("no_grpc_proxy"); + if (no_proxy_str == nullptr) { + no_proxy_str = gpr_getenv("no_proxy"); + } if (no_proxy_str != nullptr) { static const char* NO_PROXY_SEPARATOR = ","; bool use_proxy = true; From c2ddef218fb066fd217432ac3703720d4671cdf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20Sojma?= Date: Tue, 6 Nov 2018 15:16:56 +0100 Subject: [PATCH 003/661] ability to set proxy with use of "grpc_proxy" environment variable --- src/core/ext/filters/client_channel/http_proxy.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/ext/filters/client_channel/http_proxy.cc b/src/core/ext/filters/client_channel/http_proxy.cc index 3f05b23ffaf..94ef2c55ec8 100644 --- a/src/core/ext/filters/client_channel/http_proxy.cc +++ b/src/core/ext/filters/client_channel/http_proxy.cc @@ -47,10 +47,12 @@ static char* get_http_proxy_server(char** user_cred) { char* proxy_name = nullptr; char** authority_strs = nullptr; size_t authority_nstrs; - /* Prefer using 'https_proxy'. Fallback on 'http_proxy' if it is not set. The + /* Prefer using 'grpc_proxy'. Fallback on 'http_proxy' if it is not set. + * Also prefer using 'https_proxy' with fallback on 'http_proxy'. The * fallback behavior can be removed if there's a demand for it. */ - char* uri_str = gpr_getenv("https_proxy"); + char* uri_str = gpr_getenv("grpc_proxy"); + if (uri_str == nullptr) uri_str = gpr_getenv("https_proxy"); if (uri_str == nullptr) uri_str = gpr_getenv("http_proxy"); if (uri_str == nullptr) return nullptr; grpc_uri* uri = grpc_uri_parse(uri_str, false /* suppress_errors */); @@ -122,6 +124,7 @@ static bool proxy_mapper_map_name(grpc_proxy_mapper* mapper, server_uri); goto no_use_proxy; } + /* Prefer using 'no_grpc_proxy'. Fallback on 'no_proxy' if it is not set. */ no_proxy_str = gpr_getenv("no_grpc_proxy"); if (no_proxy_str == nullptr) { no_proxy_str = gpr_getenv("no_proxy"); From 43279fc50ba83296fb43234aeab67910e68e7fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20Sojma?= Date: Tue, 6 Nov 2018 15:24:40 +0100 Subject: [PATCH 004/661] coding style update --- src/core/ext/filters/client_channel/http_proxy.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/ext/filters/client_channel/http_proxy.cc b/src/core/ext/filters/client_channel/http_proxy.cc index 94ef2c55ec8..26c8b439e75 100644 --- a/src/core/ext/filters/client_channel/http_proxy.cc +++ b/src/core/ext/filters/client_channel/http_proxy.cc @@ -126,9 +126,7 @@ static bool proxy_mapper_map_name(grpc_proxy_mapper* mapper, } /* Prefer using 'no_grpc_proxy'. Fallback on 'no_proxy' if it is not set. */ no_proxy_str = gpr_getenv("no_grpc_proxy"); - if (no_proxy_str == nullptr) { - no_proxy_str = gpr_getenv("no_proxy"); - } + if (no_proxy_str == nullptr) no_proxy_str = gpr_getenv("no_proxy"); if (no_proxy_str != nullptr) { static const char* NO_PROXY_SEPARATOR = ","; bool use_proxy = true; From 3c77a3887a06a8eb79ead685450e3b4127d345a0 Mon Sep 17 00:00:00 2001 From: zhoulin xie Date: Sun, 24 Feb 2019 15:16:49 +0800 Subject: [PATCH 005/661] Fix some misspells in doc Signed-off-by: zhoulin xie --- doc/interop-test-descriptions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/interop-test-descriptions.md b/doc/interop-test-descriptions.md index 208af424298..141b5ccc293 100755 --- a/doc/interop-test-descriptions.md +++ b/doc/interop-test-descriptions.md @@ -1135,7 +1135,7 @@ responses, it closes with OK. ### Echo Status [Echo Status]: #echo-status When the client sends a response_status in the request payload, the server closes -the stream with the status code and messsage contained within said response_status. +the stream with the status code and message contained within said response_status. The server will not process any further messages on the stream sent by the client. This can be used by clients to verify correct handling of different status codes and associated status messages end-to-end. @@ -1152,7 +1152,7 @@ key and the corresponding value back to the client as trailing metadata. [Observe ResponseParameters.interval_us]: #observe-responseparametersinterval_us In StreamingOutputCall and FullDuplexCall, server delays sending a -StreamingOutputCallResponse by the ResponseParameters's `interval_us` for that +StreamingOutputCallResponse by the ResponseParameters' `interval_us` for that particular response, relative to the last response sent. That is, `interval_us` acts like a sleep *before* sending the response and accumulates from one response to the next. From 4778d42cb5f59f9a5a9dc8cf725146165dad65f9 Mon Sep 17 00:00:00 2001 From: Kim Bao Long Date: Mon, 25 Feb 2019 13:51:18 +0700 Subject: [PATCH 006/661] Replacing 'HTTP' by 'HTTPS' for securing links Currently, when we access **github.com** with **HTTP**, it is redirected to **HTTPS** automatically. So this commit aims to replace **http://github.com** by **https://github.com** for security. Co-Authored-By: Nguyen Phuong An Signed-off-by: Kim Bao Long --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b3a4c1f17d1..b9d564ade8a 100644 --- a/README.md +++ b/README.md @@ -77,8 +77,8 @@ Libraries in different languages may be in various states of development. We are | Language | Source repo | |-------------------------|------------------------------------------------------| -| Java | [grpc-java](http://github.com/grpc/grpc-java) | -| Go | [grpc-go](http://github.com/grpc/grpc-go) | +| Java | [grpc-java](https://github.com/grpc/grpc-java) | +| Go | [grpc-go](https://github.com/grpc/grpc-go) | | NodeJS | [grpc-node](https://github.com/grpc/grpc-node) | | WebJS | [grpc-web](https://github.com/grpc/grpc-web) | | Dart | [grpc-dart](https://github.com/grpc/grpc-dart) | From 3fe631d1b6ffa7ab9f46d120ef27298e4ede3d9c Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Tue, 5 Mar 2019 13:57:41 -0800 Subject: [PATCH 007/661] Update doc about using clang-5.0 --- BUILDING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILDING.md b/BUILDING.md index 615b371db6e..2d757f58dca 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -12,7 +12,7 @@ gRPC C++ - Building from source If you plan to build from source and run tests, install the following as well: ```sh $ [sudo] apt-get install libgflags-dev libgtest-dev - $ [sudo] apt-get install clang libc++-dev + $ [sudo] apt-get install clang-5.0 libc++-dev ``` ## MacOS From 2afe1ab04b135835bca247289e6f95585bf36f9a Mon Sep 17 00:00:00 2001 From: Dionna Glaze Date: Mon, 10 Dec 2018 14:41:20 -0800 Subject: [PATCH 008/661] Add Asylo platform support. This patch enables the open source portable enclave framework [Asylo](https://github.com/google/asylo) to use gRPC within its toolchain. The Asylo EKEP handshaker does its own end-to-end testing by reusing gRPC's own end2end testing targets. To do so, it requires those targets to be visible. Signed-off-by: Dionna Amalie Glaze --- include/grpc/impl/codegen/port_platform.h | 20 ++++++++++++++++++++ test/core/end2end/generate_tests.bzl | 1 + 2 files changed, 21 insertions(+) diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index d7294d59d41..69193fc45ad 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -186,6 +186,26 @@ #else /* musl libc */ #define GPR_MUSL_LIBC_COMPAT 1 #endif +#elif defined(__ASYLO__) +#define GPR_ARCH_64 1 +#define GPR_CPU_POSIX 1 +#define GPR_GCC_TLS 1 +#define GPR_PLATFORM_STRING "asylo" +#define GPR_GCC_SYNC 1 +#define GPR_POSIX_SYNC 1 +#define GPR_POSIX_STRING 1 +#define GPR_POSIX_LOG 1 +#define GPR_POSIX_TIME 1 +#define GPR_POSIX_ENV 1 +#define GPR_ASYLO 1 +#define GRPC_POSIX_SOCKET 1 +#define GRPC_POSIX_SOCKETADDR +#define GRPC_POSIX_SOCKETUTILS 1 +#define GRPC_TIMER_USE_GENERIC 1 +#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 +#define GRPC_POSIX_WAKEUP_FD 1 +#define GRPC_ARES 0 +#define GPR_NO_AUTODETECT_PLATFORM 1 #elif defined(__APPLE__) #include #include diff --git a/test/core/end2end/generate_tests.bzl b/test/core/end2end/generate_tests.bzl index 85faca16364..453c973fbc2 100755 --- a/test/core/end2end/generate_tests.bzl +++ b/test/core/end2end/generate_tests.bzl @@ -380,6 +380,7 @@ def grpc_end2end_tests(): "end2end_tests.h", ], language = "C++", + visibility = ["//visibility:public"], deps = [ ":cq_verifier", ":ssl_test_data", From a0aa16a0787e0f20515bb49fc708ea9e4ee7871b Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Fri, 17 May 2019 15:58:10 +1200 Subject: [PATCH 009/661] Remove System.Interactive.Async dependency --- src/csharp/Grpc.Core.Api/Grpc.Core.Api.csproj | 4 -- .../Grpc.Core.Api/IAsyncStreamReader.cs | 22 +++++--- src/csharp/Grpc.Core/Grpc.Core.csproj | 6 +-- .../Grpc.Core/Utils/AsyncStreamExtensions.cs | 53 +++++++++++++++++++ .../ReflectionClientServerTest.cs | 3 +- 5 files changed, 72 insertions(+), 16 deletions(-) diff --git a/src/csharp/Grpc.Core.Api/Grpc.Core.Api.csproj b/src/csharp/Grpc.Core.Api/Grpc.Core.Api.csproj index 8a32bc757df..7d9a236284d 100755 --- a/src/csharp/Grpc.Core.Api/Grpc.Core.Api.csproj +++ b/src/csharp/Grpc.Core.Api/Grpc.Core.Api.csproj @@ -25,10 +25,6 @@ - - - - diff --git a/src/csharp/Grpc.Core.Api/IAsyncStreamReader.cs b/src/csharp/Grpc.Core.Api/IAsyncStreamReader.cs index 3751d549e39..7ad4f2687b8 100644 --- a/src/csharp/Grpc.Core.Api/IAsyncStreamReader.cs +++ b/src/csharp/Grpc.Core.Api/IAsyncStreamReader.cs @@ -1,4 +1,4 @@ -#region Copyright notice and license +#region Copyright notice and license // Copyright 2015 gRPC authors. // @@ -16,10 +16,7 @@ #endregion -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Threading; using System.Threading.Tasks; namespace Grpc.Core @@ -50,7 +47,20 @@ namespace Grpc.Core /// /// /// The message type. - public interface IAsyncStreamReader : IAsyncEnumerator + public interface IAsyncStreamReader { + /// + /// Gets the current element in the iteration. + /// + T Current { get; } + + /// + /// Advances the reader to the next element in the sequence, returning the result asynchronously. + /// + /// Cancellation token that can be used to cancel the operation. + /// + /// Task containing the result of the operation: true if the reader was successfully advanced + /// to the next element; false if the reader has passed the end of the sequence. + Task MoveNext(CancellationToken cancellationToken); } } diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj index afd60e73a21..78392e9df58 100755 --- a/src/csharp/Grpc.Core/Grpc.Core.csproj +++ b/src/csharp/Grpc.Core/Grpc.Core.csproj @@ -1,4 +1,4 @@ - + @@ -98,10 +98,6 @@ - - - - diff --git a/src/csharp/Grpc.Core/Utils/AsyncStreamExtensions.cs b/src/csharp/Grpc.Core/Utils/AsyncStreamExtensions.cs index fce53c70074..6ca72a1139b 100644 --- a/src/csharp/Grpc.Core/Utils/AsyncStreamExtensions.cs +++ b/src/csharp/Grpc.Core/Utils/AsyncStreamExtensions.cs @@ -18,6 +18,7 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; namespace Grpc.Core.Utils @@ -27,12 +28,41 @@ namespace Grpc.Core.Utils /// public static class AsyncStreamExtensions { + /// + /// Advances the stream reader to the next element in the sequence, returning the result asynchronously. + /// + /// The message type. + /// The stream reader. + /// + /// Task containing the result of the operation: true if the reader was successfully advanced + /// to the next element; false if the reader has passed the end of the sequence. + /// + public static Task MoveNext(this IAsyncStreamReader streamReader) + where T : class + { + if (streamReader == null) + { + throw new ArgumentNullException(nameof(streamReader)); + } + + return streamReader.MoveNext(CancellationToken.None); + } + /// /// Reads the entire stream and executes an async action for each element. /// public static async Task ForEachAsync(this IAsyncStreamReader streamReader, Func asyncAction) where T : class { + if (streamReader == null) + { + throw new ArgumentNullException(nameof(streamReader)); + } + if (asyncAction == null) + { + throw new ArgumentNullException(nameof(asyncAction)); + } + while (await streamReader.MoveNext().ConfigureAwait(false)) { await asyncAction(streamReader.Current).ConfigureAwait(false); @@ -45,6 +75,11 @@ namespace Grpc.Core.Utils public static async Task> ToListAsync(this IAsyncStreamReader streamReader) where T : class { + if (streamReader == null) + { + throw new ArgumentNullException(nameof(streamReader)); + } + var result = new List(); while (await streamReader.MoveNext().ConfigureAwait(false)) { @@ -60,6 +95,15 @@ namespace Grpc.Core.Utils public static async Task WriteAllAsync(this IClientStreamWriter streamWriter, IEnumerable elements, bool complete = true) where T : class { + if (streamWriter == null) + { + throw new ArgumentNullException(nameof(streamWriter)); + } + if (elements == null) + { + throw new ArgumentNullException(nameof(elements)); + } + foreach (var element in elements) { await streamWriter.WriteAsync(element).ConfigureAwait(false); @@ -76,6 +120,15 @@ namespace Grpc.Core.Utils public static async Task WriteAllAsync(this IServerStreamWriter streamWriter, IEnumerable elements) where T : class { + if (streamWriter == null) + { + throw new ArgumentNullException(nameof(streamWriter)); + } + if (elements == null) + { + throw new ArgumentNullException(nameof(elements)); + } + foreach (var element in elements) { await streamWriter.WriteAsync(element).ConfigureAwait(false); diff --git a/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs b/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs index 76f8cfadcfd..9ef9680f71c 100644 --- a/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs +++ b/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs @@ -1,4 +1,4 @@ -#region Copyright notice and license +#region Copyright notice and license // Copyright 2015 gRPC authors. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,6 +21,7 @@ using System.Text; using System.Threading.Tasks; using Grpc.Core; +using Grpc.Core.Utils; using Grpc.Reflection; using Grpc.Reflection.V1Alpha; using NUnit.Framework; From 47660b784b3b6a15e12a2718a7df758cb70f6dc5 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Fri, 17 May 2019 16:21:08 +1200 Subject: [PATCH 010/661] Add missing namespace --- src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs index fd221613c04..d343271ffbe 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs @@ -23,6 +23,7 @@ using System.Runtime.InteropServices; using System.Threading.Tasks; using Grpc.Core.Internal; +using Grpc.Core.Utils; using NUnit.Framework; namespace Grpc.Core.Internal.Tests From 44bc1cdaeb282f1ed80f2e905598a880b5fd340c Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Mon, 20 May 2019 21:26:03 +1200 Subject: [PATCH 011/661] PR feedback --- .../AsyncStreamReaderExtensions.cs | 50 +++++++++++++++++ .../Internal/AsyncCallServerTest.cs | 1 - .../Grpc.Core/Utils/AsyncStreamExtensions.cs | 53 ------------------- .../ReflectionClientServerTest.cs | 1 - 4 files changed, 50 insertions(+), 55 deletions(-) create mode 100644 src/csharp/Grpc.Core.Api/AsyncStreamReaderExtensions.cs diff --git a/src/csharp/Grpc.Core.Api/AsyncStreamReaderExtensions.cs b/src/csharp/Grpc.Core.Api/AsyncStreamReaderExtensions.cs new file mode 100644 index 00000000000..a1f895723ed --- /dev/null +++ b/src/csharp/Grpc.Core.Api/AsyncStreamReaderExtensions.cs @@ -0,0 +1,50 @@ +#region Copyright notice and license + +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Grpc.Core +{ + /// + /// Extension methods for . + /// + public static class AsyncStreamReaderExtensions + { + /// + /// Advances the stream reader to the next element in the sequence, returning the result asynchronously. + /// + /// The message type. + /// The stream reader. + /// + /// Task containing the result of the operation: true if the reader was successfully advanced + /// to the next element; false if the reader has passed the end of the sequence. + /// + public static Task MoveNext(this IAsyncStreamReader streamReader) + where T : class + { + if (streamReader == null) + { + throw new ArgumentNullException(nameof(streamReader)); + } + + return streamReader.MoveNext(CancellationToken.None); + } + } +} diff --git a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs index d343271ffbe..fd221613c04 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallServerTest.cs @@ -23,7 +23,6 @@ using System.Runtime.InteropServices; using System.Threading.Tasks; using Grpc.Core.Internal; -using Grpc.Core.Utils; using NUnit.Framework; namespace Grpc.Core.Internal.Tests diff --git a/src/csharp/Grpc.Core/Utils/AsyncStreamExtensions.cs b/src/csharp/Grpc.Core/Utils/AsyncStreamExtensions.cs index 6ca72a1139b..fce53c70074 100644 --- a/src/csharp/Grpc.Core/Utils/AsyncStreamExtensions.cs +++ b/src/csharp/Grpc.Core/Utils/AsyncStreamExtensions.cs @@ -18,7 +18,6 @@ using System; using System.Collections.Generic; -using System.Threading; using System.Threading.Tasks; namespace Grpc.Core.Utils @@ -28,41 +27,12 @@ namespace Grpc.Core.Utils /// public static class AsyncStreamExtensions { - /// - /// Advances the stream reader to the next element in the sequence, returning the result asynchronously. - /// - /// The message type. - /// The stream reader. - /// - /// Task containing the result of the operation: true if the reader was successfully advanced - /// to the next element; false if the reader has passed the end of the sequence. - /// - public static Task MoveNext(this IAsyncStreamReader streamReader) - where T : class - { - if (streamReader == null) - { - throw new ArgumentNullException(nameof(streamReader)); - } - - return streamReader.MoveNext(CancellationToken.None); - } - /// /// Reads the entire stream and executes an async action for each element. /// public static async Task ForEachAsync(this IAsyncStreamReader streamReader, Func asyncAction) where T : class { - if (streamReader == null) - { - throw new ArgumentNullException(nameof(streamReader)); - } - if (asyncAction == null) - { - throw new ArgumentNullException(nameof(asyncAction)); - } - while (await streamReader.MoveNext().ConfigureAwait(false)) { await asyncAction(streamReader.Current).ConfigureAwait(false); @@ -75,11 +45,6 @@ namespace Grpc.Core.Utils public static async Task> ToListAsync(this IAsyncStreamReader streamReader) where T : class { - if (streamReader == null) - { - throw new ArgumentNullException(nameof(streamReader)); - } - var result = new List(); while (await streamReader.MoveNext().ConfigureAwait(false)) { @@ -95,15 +60,6 @@ namespace Grpc.Core.Utils public static async Task WriteAllAsync(this IClientStreamWriter streamWriter, IEnumerable elements, bool complete = true) where T : class { - if (streamWriter == null) - { - throw new ArgumentNullException(nameof(streamWriter)); - } - if (elements == null) - { - throw new ArgumentNullException(nameof(elements)); - } - foreach (var element in elements) { await streamWriter.WriteAsync(element).ConfigureAwait(false); @@ -120,15 +76,6 @@ namespace Grpc.Core.Utils public static async Task WriteAllAsync(this IServerStreamWriter streamWriter, IEnumerable elements) where T : class { - if (streamWriter == null) - { - throw new ArgumentNullException(nameof(streamWriter)); - } - if (elements == null) - { - throw new ArgumentNullException(nameof(elements)); - } - foreach (var element in elements) { await streamWriter.WriteAsync(element).ConfigureAwait(false); diff --git a/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs b/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs index 9ef9680f71c..b77f245667c 100644 --- a/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs +++ b/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs @@ -21,7 +21,6 @@ using System.Text; using System.Threading.Tasks; using Grpc.Core; -using Grpc.Core.Utils; using Grpc.Reflection; using Grpc.Reflection.V1Alpha; using NUnit.Framework; From 477ebef532b0163d87ba8c068c84d2adb67a3477 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 28 May 2019 14:18:15 -0700 Subject: [PATCH 012/661] Remove CreateChannel() method from LB helper API. --- .../filters/client_channel/client_channel.cc | 5 -- .../client_channel/client_channel_factory.h | 4 -- .../ext/filters/client_channel/lb_policy.h | 6 --- .../client_channel/lb_policy/grpclb/grpclb.cc | 18 ++----- .../lb_policy/grpclb/grpclb_channel.cc | 15 +++++- .../lb_policy/grpclb/grpclb_channel.h | 11 ++++- .../lb_policy/grpclb/grpclb_channel_secure.cc | 48 ++++++++++++------- .../client_channel/lb_policy/xds/xds.cc | 31 ++---------- .../lb_policy/xds/xds_channel.cc | 14 +++++- .../lb_policy/xds/xds_channel.h | 10 +++- .../lb_policy/xds/xds_channel_secure.cc | 41 +++++++++++----- .../client_channel/resolving_lb_policy.cc | 7 --- .../chttp2/client/insecure/channel_create.cc | 43 +++++++++-------- .../client/secure/secure_channel_create.cc | 45 +++++++++-------- test/core/util/test_lb_policies.cc | 5 -- test/cpp/microbenchmarks/bm_call_create.cc | 4 -- 16 files changed, 156 insertions(+), 151 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index c0586d459b2..acbf1238113 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -960,11 +960,6 @@ class ChannelData::ClientChannelControlHelper return subchannel; } - grpc_channel* CreateChannel(const char* target, - const grpc_channel_args& args) override { - return chand_->client_channel_factory_->CreateChannel(target, &args); - } - void UpdateState( grpc_connectivity_state state, UniquePtr picker) override { diff --git a/src/core/ext/filters/client_channel/client_channel_factory.h b/src/core/ext/filters/client_channel/client_channel_factory.h index 21f78a833df..42bc7cb505f 100644 --- a/src/core/ext/filters/client_channel/client_channel_factory.h +++ b/src/core/ext/filters/client_channel/client_channel_factory.h @@ -36,10 +36,6 @@ class ClientChannelFactory { virtual Subchannel* CreateSubchannel(const grpc_channel_args* args) GRPC_ABSTRACT; - // Creates a channel for the specified target with the specified args. - virtual grpc_channel* CreateChannel( - const char* target, const grpc_channel_args* args) GRPC_ABSTRACT; - // Returns a channel arg containing the specified factory. static grpc_arg CreateChannelArg(ClientChannelFactory* factory); diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h index 2ac7df63b7d..237b5930d4a 100644 --- a/src/core/ext/filters/client_channel/lb_policy.h +++ b/src/core/ext/filters/client_channel/lb_policy.h @@ -191,12 +191,6 @@ class LoadBalancingPolicy : public InternallyRefCounted { virtual Subchannel* CreateSubchannel(const grpc_channel_args& args) GRPC_ABSTRACT; - /// Creates a channel with the specified target and channel args. - /// This can be used in cases where the LB policy needs to create a - /// channel for its own use (e.g., to talk to an external load balancer). - virtual grpc_channel* CreateChannel( - const char* target, const grpc_channel_args& args) GRPC_ABSTRACT; - /// Sets the connectivity state and returns a new picker to be used /// by the client channel. virtual void UpdateState(grpc_connectivity_state state, diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index ed6e8de3f21..26c9fdfc9c1 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -294,8 +294,6 @@ class GrpcLb : public LoadBalancingPolicy { : parent_(std::move(parent)) {} Subchannel* CreateSubchannel(const grpc_channel_args& args) override; - grpc_channel* CreateChannel(const char* target, - const grpc_channel_args& args) override; void UpdateState(grpc_connectivity_state state, UniquePtr picker) override; void RequestReresolution() override; @@ -625,15 +623,6 @@ Subchannel* GrpcLb::Helper::CreateSubchannel(const grpc_channel_args& args) { return parent_->channel_control_helper()->CreateSubchannel(args); } -grpc_channel* GrpcLb::Helper::CreateChannel(const char* target, - const grpc_channel_args& args) { - if (parent_->shutting_down_ || - (!CalledByPendingChild() && !CalledByCurrentChild())) { - return nullptr; - } - return parent_->channel_control_helper()->CreateChannel(target, args); -} - void GrpcLb::Helper::UpdateState(grpc_connectivity_state state, UniquePtr picker) { if (parent_->shutting_down_) return; @@ -1232,7 +1221,7 @@ grpc_channel_args* BuildBalancerChannelArgs( // the LB channel. GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR, // The LB channel should use the authority indicated by the target - // authority table (see \a grpc_lb_policy_grpclb_modify_lb_channel_args), + // authority table (see \a ModifyGrpclbBalancerChannelArgs), // as opposed to the authority from the parent channel. GRPC_ARG_DEFAULT_AUTHORITY, // Just as for \a GRPC_ARG_DEFAULT_AUTHORITY, the LB channel should be @@ -1259,7 +1248,7 @@ grpc_channel_args* BuildBalancerChannelArgs( args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), args_to_add, GPR_ARRAY_SIZE(args_to_add)); // Make any necessary modifications for security. - return grpc_lb_policy_grpclb_modify_lb_channel_args(addresses, new_args); + return ModifyGrpclbBalancerChannelArgs(addresses, new_args); } // @@ -1464,8 +1453,7 @@ void GrpcLb::ProcessAddressesAndChannelArgsLocked( if (lb_channel_ == nullptr) { char* uri_str; gpr_asprintf(&uri_str, "fake:///%s", server_name_); - lb_channel_ = - channel_control_helper()->CreateChannel(uri_str, *lb_channel_args); + lb_channel_ = CreateGrpclbBalancerChannel(uri_str, *lb_channel_args); GPR_ASSERT(lb_channel_ != nullptr); grpc_core::channelz::ChannelNode* channel_node = grpc_channel_get_channelz_node(lb_channel_); diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc index b713e26713f..c7237632c0a 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc @@ -18,9 +18,20 @@ #include +#include + #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h" -grpc_channel_args* grpc_lb_policy_grpclb_modify_lb_channel_args( - const grpc_core::ServerAddressList& addresses, grpc_channel_args* args) { +namespace grpc_core { + +grpc_channel_args* ModifyGrpclbBalancerChannelArgs( + const ServerAddressList& addresses, grpc_channel_args* args) { return args; } + +grpc_channel* CreateGrpclbBalancerChannel(const char* target_uri, + const grpc_channel_args& args) { + return grpc_insecure_channel_create(target_uri, &args, nullptr); +} + +} // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h index c78ba36cf1d..1458233022f 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h @@ -25,14 +25,21 @@ #include "src/core/ext/filters/client_channel/server_address.h" +namespace grpc_core { + /// Makes any necessary modifications to \a args for use in the grpclb /// balancer channel. /// /// Takes ownership of \a args. /// /// Caller takes ownership of the returned args. -grpc_channel_args* grpc_lb_policy_grpclb_modify_lb_channel_args( - const grpc_core::ServerAddressList& addresses, grpc_channel_args* args); +grpc_channel_args* ModifyGrpclbBalancerChannelArgs( + const ServerAddressList& addresses, grpc_channel_args* args); + +grpc_channel* CreateGrpclbBalancerChannel(const char* target_uri, + const grpc_channel_args& args); + +} // namespace grpc_core #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CHANNEL_H \ */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc index 892cdeb27b7..376209fa7e2 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc @@ -22,6 +22,7 @@ #include +#include #include #include @@ -35,6 +36,7 @@ #include "src/core/lib/slice/slice_internal.h" namespace grpc_core { + namespace { int BalancerNameCmp(const grpc_core::UniquePtr& a, @@ -65,37 +67,49 @@ RefCountedPtr CreateTargetAuthorityTable( } } // namespace -} // namespace grpc_core -grpc_channel_args* grpc_lb_policy_grpclb_modify_lb_channel_args( - const grpc_core::ServerAddressList& addresses, grpc_channel_args* args) { - const char* args_to_remove[1]; - size_t num_args_to_remove = 0; - grpc_arg args_to_add[2]; - size_t num_args_to_add = 0; +grpc_channel_args* ModifyGrpclbBalancerChannelArgs( + const ServerAddressList& addresses, grpc_channel_args* args) { + InlinedVector args_to_remove; + InlinedVector args_to_add; // Add arg for targets info table. - grpc_core::RefCountedPtr - target_authority_table = grpc_core::CreateTargetAuthorityTable(addresses); - args_to_add[num_args_to_add++] = - grpc_core::CreateTargetAuthorityTableChannelArg( - target_authority_table.get()); + RefCountedPtr target_authority_table = + CreateTargetAuthorityTable(addresses); + args_to_add.emplace_back( + CreateTargetAuthorityTableChannelArg(target_authority_table.get())); // Substitute the channel credentials with a version without call // credentials: the load balancer is not necessarily trusted to handle // bearer token credentials. grpc_channel_credentials* channel_credentials = grpc_channel_credentials_find_in_args(args); - grpc_core::RefCountedPtr creds_sans_call_creds; + RefCountedPtr creds_sans_call_creds; if (channel_credentials != nullptr) { creds_sans_call_creds = channel_credentials->duplicate_without_call_credentials(); GPR_ASSERT(creds_sans_call_creds != nullptr); - args_to_remove[num_args_to_remove++] = GRPC_ARG_CHANNEL_CREDENTIALS; - args_to_add[num_args_to_add++] = - grpc_channel_credentials_to_arg(creds_sans_call_creds.get()); + args_to_remove.emplace_back(GRPC_ARG_CHANNEL_CREDENTIALS); + args_to_add.emplace_back( + grpc_channel_credentials_to_arg(creds_sans_call_creds.get())); } grpc_channel_args* result = grpc_channel_args_copy_and_add_and_remove( - args, args_to_remove, num_args_to_remove, args_to_add, num_args_to_add); + args, args_to_remove.data(), args_to_remove.size(), args_to_add.data(), + args_to_add.size()); // Clean up. grpc_channel_args_destroy(args); return result; } + +grpc_channel* CreateGrpclbBalancerChannel(const char* target_uri, + const grpc_channel_args& args) { + grpc_channel_credentials* creds = + grpc_channel_credentials_find_in_args(&args); + const char* arg_to_remove = GRPC_ARG_CHANNEL_CREDENTIALS; + grpc_channel_args* new_args = + grpc_channel_args_copy_and_remove(&args, &arg_to_remove, 1); + grpc_channel* channel = + grpc_secure_channel_create(creds, target_uri, new_args, nullptr); + grpc_channel_args_destroy(new_args); + return channel; +} + +} // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 819bad6c00d..08ecec5c8ba 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -338,8 +338,6 @@ class XdsLb : public LoadBalancingPolicy { : parent_(std::move(parent)) {} Subchannel* CreateSubchannel(const grpc_channel_args& args) override; - grpc_channel* CreateChannel(const char* target, - const grpc_channel_args& args) override; void UpdateState(grpc_connectivity_state state, UniquePtr picker) override; void RequestReresolution() override; @@ -378,8 +376,6 @@ class XdsLb : public LoadBalancingPolicy { : entry_(std::move(entry)) {} Subchannel* CreateSubchannel(const grpc_channel_args& args) override; - grpc_channel* CreateChannel(const char* target, - const grpc_channel_args& args) override; void UpdateState(grpc_connectivity_state state, UniquePtr picker) override; void RequestReresolution() override; @@ -592,15 +588,6 @@ Subchannel* XdsLb::FallbackHelper::CreateSubchannel( return parent_->channel_control_helper()->CreateSubchannel(args); } -grpc_channel* XdsLb::FallbackHelper::CreateChannel( - const char* target, const grpc_channel_args& args) { - if (parent_->shutting_down_ || - (!CalledByPendingFallback() && !CalledByCurrentFallback())) { - return nullptr; - } - return parent_->channel_control_helper()->CreateChannel(target, args); -} - void XdsLb::FallbackHelper::UpdateState(grpc_connectivity_state state, UniquePtr picker) { if (parent_->shutting_down_) return; @@ -722,7 +709,7 @@ ServerAddressList ProcessServerlist(const xds_grpclb_serverlist* serverlist) { XdsLb::BalancerChannelState::BalancerChannelState( const char* balancer_name, const grpc_channel_args& args, - grpc_core::RefCountedPtr parent_xdslb_policy) + RefCountedPtr parent_xdslb_policy) : InternallyRefCounted(&grpc_lb_xds_trace), xdslb_policy_(std::move(parent_xdslb_policy)), lb_call_backoff_( @@ -735,8 +722,7 @@ XdsLb::BalancerChannelState::BalancerChannelState( GRPC_CLOSURE_INIT(&on_connectivity_changed_, &XdsLb::BalancerChannelState::OnConnectivityChangedLocked, this, grpc_combiner_scheduler(xdslb_policy_->combiner())); - channel_ = xdslb_policy_->channel_control_helper()->CreateChannel( - balancer_name, args); + channel_ = CreateXdsBalancerChannel(balancer_name, args); GPR_ASSERT(channel_ != nullptr); StartCallLocked(); } @@ -1325,7 +1311,7 @@ grpc_channel_args* BuildBalancerChannelArgs(const grpc_channel_args* args) { // factory will re-add this arg with the right value. GRPC_ARG_SERVER_URI, // The LB channel should use the authority indicated by the target - // authority table (see \a grpc_lb_policy_xds_modify_lb_channel_args), + // authority table (see \a ModifyXdsBalancerChannelArgs), // as opposed to the authority from the parent channel. GRPC_ARG_DEFAULT_AUTHORITY, // Just as for \a GRPC_ARG_DEFAULT_AUTHORITY, the LB channel should be @@ -1348,7 +1334,7 @@ grpc_channel_args* BuildBalancerChannelArgs(const grpc_channel_args* args) { args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), args_to_add, GPR_ARRAY_SIZE(args_to_add)); // Make any necessary modifications for security. - return grpc_lb_policy_xds_modify_lb_channel_args(new_args); + return ModifyXdsBalancerChannelArgs(new_args); } // @@ -2010,15 +1996,6 @@ Subchannel* XdsLb::LocalityMap::LocalityEntry::Helper::CreateSubchannel( return entry_->parent_->channel_control_helper()->CreateSubchannel(args); } -grpc_channel* XdsLb::LocalityMap::LocalityEntry::Helper::CreateChannel( - const char* target, const grpc_channel_args& args) { - if (entry_->parent_->shutting_down_ || - (!CalledByPendingChild() && !CalledByCurrentChild())) { - return nullptr; - } - return entry_->parent_->channel_control_helper()->CreateChannel(target, args); -} - void XdsLb::LocalityMap::LocalityEntry::Helper::UpdateState( grpc_connectivity_state state, UniquePtr picker) { if (entry_->parent_->shutting_down_) return; diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc index 0aa145a24e5..386517d6427 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc @@ -18,9 +18,19 @@ #include +#include + #include "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h" -grpc_channel_args* grpc_lb_policy_xds_modify_lb_channel_args( - grpc_channel_args* args) { +namespace grpc_core { + +grpc_channel_args* ModifyXdsBalancerChannelArgs(grpc_channel_args* args) { return args; } + +grpc_channel* CreateXdsBalancerChannel(const char* target_uri, + const grpc_channel_args& args) { + return grpc_insecure_channel_create(target_uri, &args, nullptr); +} + +} // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h b/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h index f713b7f563d..516bac1df25 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h @@ -23,14 +23,20 @@ #include +namespace grpc_core { + /// Makes any necessary modifications to \a args for use in the xds /// balancer channel. /// /// Takes ownership of \a args. /// /// Caller takes ownership of the returned args. -grpc_channel_args* grpc_lb_policy_xds_modify_lb_channel_args( - grpc_channel_args* args); +grpc_channel_args* ModifyXdsBalancerChannelArgs(grpc_channel_args* args); + +grpc_channel* CreateXdsBalancerChannel(const char* target_uri, + const grpc_channel_args& args); + +} // namespace grpc_core #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_XDS_XDS_CHANNEL_H \ */ diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc index 7f8c232d6d0..ad5e7cbbc2e 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc @@ -20,9 +20,11 @@ #include "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h" +#include + +#include #include #include -#include #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/filters/client_channel/server_address.h" @@ -33,29 +35,44 @@ #include "src/core/lib/security/transport/target_authority_table.h" #include "src/core/lib/slice/slice_internal.h" -grpc_channel_args* grpc_lb_policy_xds_modify_lb_channel_args( - grpc_channel_args* args) { - const char* args_to_remove[1]; - size_t num_args_to_remove = 0; - grpc_arg args_to_add[2]; - size_t num_args_to_add = 0; +namespace grpc_core { + +grpc_channel_args* ModifyXdsBalancerChannelArgs(grpc_channel_args* args) { + InlinedVector args_to_remove; + InlinedVector args_to_add; // Substitute the channel credentials with a version without call // credentials: the load balancer is not necessarily trusted to handle // bearer token credentials. grpc_channel_credentials* channel_credentials = grpc_channel_credentials_find_in_args(args); - grpc_core::RefCountedPtr creds_sans_call_creds; + RefCountedPtr creds_sans_call_creds; if (channel_credentials != nullptr) { creds_sans_call_creds = channel_credentials->duplicate_without_call_credentials(); GPR_ASSERT(creds_sans_call_creds != nullptr); - args_to_remove[num_args_to_remove++] = GRPC_ARG_CHANNEL_CREDENTIALS; - args_to_add[num_args_to_add++] = - grpc_channel_credentials_to_arg(creds_sans_call_creds.get()); + args_to_remove.emplace_back(GRPC_ARG_CHANNEL_CREDENTIALS); + args_to_add.emplace_back( + grpc_channel_credentials_to_arg(creds_sans_call_creds.get())); } grpc_channel_args* result = grpc_channel_args_copy_and_add_and_remove( - args, args_to_remove, num_args_to_remove, args_to_add, num_args_to_add); + args, args_to_remove.data(), args_to_remove.size(), args_to_add.data(), + args_to_add.size()); // Clean up. grpc_channel_args_destroy(args); return result; } + +grpc_channel* CreateXdsBalancerChannel(const char* target_uri, + const grpc_channel_args& args) { + grpc_channel_credentials* creds = + grpc_channel_credentials_find_in_args(&args); + const char* arg_to_remove = GRPC_ARG_CHANNEL_CREDENTIALS; + grpc_channel_args* new_args = + grpc_channel_args_copy_and_remove(&args, &arg_to_remove, 1); + grpc_channel* channel = + grpc_secure_channel_create(creds, target_uri, new_args, nullptr); + grpc_channel_args_destroy(new_args); + return channel; +} + +} // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/resolving_lb_policy.cc b/src/core/ext/filters/client_channel/resolving_lb_policy.cc index 4e383f65dd1..6f3cfe813e8 100644 --- a/src/core/ext/filters/client_channel/resolving_lb_policy.cc +++ b/src/core/ext/filters/client_channel/resolving_lb_policy.cc @@ -112,13 +112,6 @@ class ResolvingLoadBalancingPolicy::ResolvingControlHelper return parent_->channel_control_helper()->CreateSubchannel(args); } - grpc_channel* CreateChannel(const char* target, - const grpc_channel_args& args) override { - if (parent_->resolver_ == nullptr) return nullptr; // Shutting down. - if (!CalledByCurrentChild() && !CalledByPendingChild()) return nullptr; - return parent_->channel_control_helper()->CreateChannel(target, args); - } - void UpdateState(grpc_connectivity_state state, UniquePtr picker) override { if (parent_->resolver_ == nullptr) return; // Shutting down. diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc index 0d61abd2a01..cbd522d6e50 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc @@ -46,27 +46,30 @@ class Chttp2InsecureClientChannelFactory : public ClientChannelFactory { grpc_channel_args_destroy(new_args); return s; } +}; - grpc_channel* CreateChannel(const char* target, - const grpc_channel_args* args) override { - if (target == nullptr) { - gpr_log(GPR_ERROR, "cannot create channel with NULL target name"); - return nullptr; - } - // Add channel arg containing the server URI. - UniquePtr canonical_target = - ResolverRegistry::AddDefaultPrefixIfNeeded(target); - grpc_arg arg = grpc_channel_arg_string_create( - const_cast(GRPC_ARG_SERVER_URI), canonical_target.get()); - const char* to_remove[] = {GRPC_ARG_SERVER_URI}; - grpc_channel_args* new_args = - grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1); - grpc_channel* channel = - grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr); - grpc_channel_args_destroy(new_args); - return channel; +namespace { + +grpc_channel* CreateChannel(const char* target, const grpc_channel_args* args) { + if (target == nullptr) { + gpr_log(GPR_ERROR, "cannot create channel with NULL target name"); + return nullptr; } -}; + // Add channel arg containing the server URI. + UniquePtr canonical_target = + ResolverRegistry::AddDefaultPrefixIfNeeded(target); + grpc_arg arg = grpc_channel_arg_string_create( + const_cast(GRPC_ARG_SERVER_URI), canonical_target.get()); + const char* to_remove[] = {GRPC_ARG_SERVER_URI}; + grpc_channel_args* new_args = + grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1); + grpc_channel* channel = + grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr); + grpc_channel_args_destroy(new_args); + return channel; +} + +} // namespace } // namespace grpc_core @@ -98,7 +101,7 @@ grpc_channel* grpc_insecure_channel_create(const char* target, grpc_arg arg = grpc_core::ClientChannelFactory::CreateChannelArg(g_factory); grpc_channel_args* new_args = grpc_channel_args_copy_and_add(args, &arg, 1); // Create channel. - grpc_channel* channel = g_factory->CreateChannel(target, new_args); + grpc_channel* channel = grpc_core::CreateChannel(target, new_args); // Clean up. grpc_channel_args_destroy(new_args); return channel != nullptr ? channel diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc index bc38ff25c79..b18d742ed12 100644 --- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc @@ -58,26 +58,6 @@ class Chttp2SecureClientChannelFactory : public ClientChannelFactory { return s; } - grpc_channel* CreateChannel(const char* target, - const grpc_channel_args* args) override { - if (target == nullptr) { - gpr_log(GPR_ERROR, "cannot create channel with NULL target name"); - return nullptr; - } - // Add channel arg containing the server URI. - UniquePtr canonical_target = - ResolverRegistry::AddDefaultPrefixIfNeeded(target); - grpc_arg arg = grpc_channel_arg_string_create( - const_cast(GRPC_ARG_SERVER_URI), canonical_target.get()); - const char* to_remove[] = {GRPC_ARG_SERVER_URI}; - grpc_channel_args* new_args = - grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1); - grpc_channel* channel = - grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr); - grpc_channel_args_destroy(new_args); - return channel; - } - private: static grpc_channel_args* GetSecureNamingChannelArgs( const grpc_channel_args* args) { @@ -170,6 +150,29 @@ class Chttp2SecureClientChannelFactory : public ClientChannelFactory { } }; +namespace { + +grpc_channel* CreateChannel(const char* target, const grpc_channel_args* args) { + if (target == nullptr) { + gpr_log(GPR_ERROR, "cannot create channel with NULL target name"); + return nullptr; + } + // Add channel arg containing the server URI. + UniquePtr canonical_target = + ResolverRegistry::AddDefaultPrefixIfNeeded(target); + grpc_arg arg = grpc_channel_arg_string_create( + const_cast(GRPC_ARG_SERVER_URI), canonical_target.get()); + const char* to_remove[] = {GRPC_ARG_SERVER_URI}; + grpc_channel_args* new_args = + grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1); + grpc_channel* channel = + grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr); + grpc_channel_args_destroy(new_args); + return channel; +} + +} // namespace + } // namespace grpc_core namespace { @@ -209,7 +212,7 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds, args, args_to_add, GPR_ARRAY_SIZE(args_to_add)); new_args = creds->update_arguments(new_args); // Create channel. - channel = g_factory->CreateChannel(target, new_args); + channel = grpc_core::CreateChannel(target, new_args); // Clean up. grpc_channel_args_destroy(new_args); } diff --git a/test/core/util/test_lb_policies.cc b/test/core/util/test_lb_policies.cc index b871f04bc9e..684e7495d36 100644 --- a/test/core/util/test_lb_policies.cc +++ b/test/core/util/test_lb_policies.cc @@ -145,11 +145,6 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy return parent_->channel_control_helper()->CreateSubchannel(args); } - grpc_channel* CreateChannel(const char* target, - const grpc_channel_args& args) override { - return parent_->channel_control_helper()->CreateChannel(target, args); - } - void UpdateState(grpc_connectivity_state state, UniquePtr picker) override { parent_->channel_control_helper()->UpdateState( diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 3bd1464b2aa..e687c644516 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -322,10 +322,6 @@ class FakeClientChannelFactory : public grpc_core::ClientChannelFactory { const grpc_channel_args* args) override { return nullptr; } - grpc_channel* CreateChannel(const char* target, - const grpc_channel_args* args) override { - return nullptr; - } }; static grpc_arg StringArg(const char* key, const char* value) { From 5ce3f688800cf6dfe8ba7be14dd824b8c399aa6d Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 29 May 2019 12:52:05 -0700 Subject: [PATCH 013/661] fix handling of insecure channels in grpclb and xds --- .../client_channel/lb_policy/grpclb/grpclb_channel_secure.cc | 4 ++++ .../client_channel/lb_policy/xds/xds_channel_secure.cc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc index 376209fa7e2..5bc4f5157ad 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc @@ -103,6 +103,10 @@ grpc_channel* CreateGrpclbBalancerChannel(const char* target_uri, const grpc_channel_args& args) { grpc_channel_credentials* creds = grpc_channel_credentials_find_in_args(&args); + if (creds == nullptr) { + // Build with security but parent channel is insecure. + return grpc_insecure_channel_create(target_uri, &args, nullptr); + } const char* arg_to_remove = GRPC_ARG_CHANNEL_CREDENTIALS; grpc_channel_args* new_args = grpc_channel_args_copy_and_remove(&args, &arg_to_remove, 1); diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc index ad5e7cbbc2e..720d5a01d9d 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc @@ -66,6 +66,10 @@ grpc_channel* CreateXdsBalancerChannel(const char* target_uri, const grpc_channel_args& args) { grpc_channel_credentials* creds = grpc_channel_credentials_find_in_args(&args); + if (creds == nullptr) { + // Build with security but parent channel is insecure. + return grpc_insecure_channel_create(target_uri, &args, nullptr); + } const char* arg_to_remove = GRPC_ARG_CHANNEL_CREDENTIALS; grpc_channel_args* new_args = grpc_channel_args_copy_and_remove(&args, &arg_to_remove, 1); From 94e7edad99a0087fd12587b2e8967489ad2db5fa Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 11 Jun 2019 15:07:12 -0700 Subject: [PATCH 014/661] Add Delegating Channel --- BUILD | 1 + BUILD.gn | 1 + CMakeLists.txt | 46 ++++++++ Makefile | 53 ++++++++++ build.yaml | 13 +++ gRPC-C++.podspec | 1 + .../grpcpp/impl/codegen/channel_interface.h | 2 + .../grpcpp/impl/codegen/delegating_channel.h | 87 +++++++++++++++ test/cpp/end2end/BUILD | 18 ++++ test/cpp/end2end/delegating_channel_test.cc | 100 ++++++++++++++++++ tools/doxygen/Doxyfile.c++ | 1 + tools/doxygen/Doxyfile.c++.internal | 1 + .../generated/sources_and_headers.json | 20 ++++ tools/run_tests/generated/tests.json | 24 +++++ 14 files changed, 368 insertions(+) create mode 100644 include/grpcpp/impl/codegen/delegating_channel.h create mode 100644 test/cpp/end2end/delegating_channel_test.cc diff --git a/BUILD b/BUILD index e0827d46cb1..e11c6ed1f49 100644 --- a/BUILD +++ b/BUILD @@ -2172,6 +2172,7 @@ grpc_cc_library( "include/grpcpp/impl/codegen/config.h", "include/grpcpp/impl/codegen/core_codegen_interface.h", "include/grpcpp/impl/codegen/create_auth_context.h", + "include/grpcpp/impl/codegen/delegating_channel.h", "include/grpcpp/impl/codegen/grpc_library.h", "include/grpcpp/impl/codegen/intercepted_channel.h", "include/grpcpp/impl/codegen/interceptor.h", diff --git a/BUILD.gn b/BUILD.gn index 258cdc9f873..9761a0683d5 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1065,6 +1065,7 @@ config("grpc_config") { "include/grpcpp/impl/codegen/core_codegen.h", "include/grpcpp/impl/codegen/core_codegen_interface.h", "include/grpcpp/impl/codegen/create_auth_context.h", + "include/grpcpp/impl/codegen/delegating_channel.h", "include/grpcpp/impl/codegen/grpc_library.h", "include/grpcpp/impl/codegen/intercepted_channel.h", "include/grpcpp/impl/codegen/interceptor.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index e9d2168b8de..6e57ce8e08a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -630,6 +630,7 @@ add_dependencies(buildtests_cxx cxx_byte_buffer_test) add_dependencies(buildtests_cxx cxx_slice_test) add_dependencies(buildtests_cxx cxx_string_ref_test) add_dependencies(buildtests_cxx cxx_time_test) +add_dependencies(buildtests_cxx delegating_channel_test) add_dependencies(buildtests_cxx end2end_test) add_dependencies(buildtests_cxx error_details_test) add_dependencies(buildtests_cxx exception_test) @@ -3321,6 +3322,7 @@ foreach(_hdr include/grpcpp/impl/codegen/config.h include/grpcpp/impl/codegen/core_codegen_interface.h include/grpcpp/impl/codegen/create_auth_context.h + include/grpcpp/impl/codegen/delegating_channel.h include/grpcpp/impl/codegen/grpc_library.h include/grpcpp/impl/codegen/intercepted_channel.h include/grpcpp/impl/codegen/interceptor.h @@ -3940,6 +3942,7 @@ foreach(_hdr include/grpcpp/impl/codegen/config.h include/grpcpp/impl/codegen/core_codegen_interface.h include/grpcpp/impl/codegen/create_auth_context.h + include/grpcpp/impl/codegen/delegating_channel.h include/grpcpp/impl/codegen/grpc_library.h include/grpcpp/impl/codegen/intercepted_channel.h include/grpcpp/impl/codegen/interceptor.h @@ -4375,6 +4378,7 @@ foreach(_hdr include/grpcpp/impl/codegen/config.h include/grpcpp/impl/codegen/core_codegen_interface.h include/grpcpp/impl/codegen/create_auth_context.h + include/grpcpp/impl/codegen/delegating_channel.h include/grpcpp/impl/codegen/grpc_library.h include/grpcpp/impl/codegen/intercepted_channel.h include/grpcpp/impl/codegen/interceptor.h @@ -4574,6 +4578,7 @@ foreach(_hdr include/grpcpp/impl/codegen/config.h include/grpcpp/impl/codegen/core_codegen_interface.h include/grpcpp/impl/codegen/create_auth_context.h + include/grpcpp/impl/codegen/delegating_channel.h include/grpcpp/impl/codegen/grpc_library.h include/grpcpp/impl/codegen/intercepted_channel.h include/grpcpp/impl/codegen/interceptor.h @@ -4933,6 +4938,7 @@ foreach(_hdr include/grpcpp/impl/codegen/config.h include/grpcpp/impl/codegen/core_codegen_interface.h include/grpcpp/impl/codegen/create_auth_context.h + include/grpcpp/impl/codegen/delegating_channel.h include/grpcpp/impl/codegen/grpc_library.h include/grpcpp/impl/codegen/intercepted_channel.h include/grpcpp/impl/codegen/interceptor.h @@ -13456,6 +13462,46 @@ target_link_libraries(cxx_time_test ) +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_executable(delegating_channel_test + test/cpp/end2end/delegating_channel_test.cc + third_party/googletest/googletest/src/gtest-all.cc + third_party/googletest/googlemock/src/gmock-all.cc +) + + +target_include_directories(delegating_channel_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} + PRIVATE ${_gRPC_CARES_INCLUDE_DIR} + PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest + PRIVATE third_party/googletest/googlemock/include + PRIVATE third_party/googletest/googlemock + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(delegating_channel_test + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc++_test_util + grpc_test_util + grpc++ + grpc + gpr + ${_gRPC_GFLAGS_LIBRARIES} +) + + endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) diff --git a/Makefile b/Makefile index e56c5ec4e47..c652b17da9a 100644 --- a/Makefile +++ b/Makefile @@ -1203,6 +1203,7 @@ cxx_byte_buffer_test: $(BINDIR)/$(CONFIG)/cxx_byte_buffer_test cxx_slice_test: $(BINDIR)/$(CONFIG)/cxx_slice_test cxx_string_ref_test: $(BINDIR)/$(CONFIG)/cxx_string_ref_test cxx_time_test: $(BINDIR)/$(CONFIG)/cxx_time_test +delegating_channel_test: $(BINDIR)/$(CONFIG)/delegating_channel_test end2end_test: $(BINDIR)/$(CONFIG)/end2end_test error_details_test: $(BINDIR)/$(CONFIG)/error_details_test exception_test: $(BINDIR)/$(CONFIG)/exception_test @@ -1685,6 +1686,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/cxx_slice_test \ $(BINDIR)/$(CONFIG)/cxx_string_ref_test \ $(BINDIR)/$(CONFIG)/cxx_time_test \ + $(BINDIR)/$(CONFIG)/delegating_channel_test \ $(BINDIR)/$(CONFIG)/end2end_test \ $(BINDIR)/$(CONFIG)/error_details_test \ $(BINDIR)/$(CONFIG)/exception_test \ @@ -1835,6 +1837,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/cxx_slice_test \ $(BINDIR)/$(CONFIG)/cxx_string_ref_test \ $(BINDIR)/$(CONFIG)/cxx_time_test \ + $(BINDIR)/$(CONFIG)/delegating_channel_test \ $(BINDIR)/$(CONFIG)/end2end_test \ $(BINDIR)/$(CONFIG)/error_details_test \ $(BINDIR)/$(CONFIG)/exception_test \ @@ -2330,6 +2333,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/cxx_string_ref_test || ( echo test cxx_string_ref_test failed ; exit 1 ) $(E) "[RUN] Testing cxx_time_test" $(Q) $(BINDIR)/$(CONFIG)/cxx_time_test || ( echo test cxx_time_test failed ; exit 1 ) + $(E) "[RUN] Testing delegating_channel_test" + $(Q) $(BINDIR)/$(CONFIG)/delegating_channel_test || ( echo test delegating_channel_test failed ; exit 1 ) $(E) "[RUN] Testing end2end_test" $(Q) $(BINDIR)/$(CONFIG)/end2end_test || ( echo test end2end_test failed ; exit 1 ) $(E) "[RUN] Testing error_details_test" @@ -5678,6 +5683,7 @@ PUBLIC_HEADERS_CXX += \ include/grpcpp/impl/codegen/config.h \ include/grpcpp/impl/codegen/core_codegen_interface.h \ include/grpcpp/impl/codegen/create_auth_context.h \ + include/grpcpp/impl/codegen/delegating_channel.h \ include/grpcpp/impl/codegen/grpc_library.h \ include/grpcpp/impl/codegen/intercepted_channel.h \ include/grpcpp/impl/codegen/interceptor.h \ @@ -6305,6 +6311,7 @@ PUBLIC_HEADERS_CXX += \ include/grpcpp/impl/codegen/config.h \ include/grpcpp/impl/codegen/core_codegen_interface.h \ include/grpcpp/impl/codegen/create_auth_context.h \ + include/grpcpp/impl/codegen/delegating_channel.h \ include/grpcpp/impl/codegen/grpc_library.h \ include/grpcpp/impl/codegen/intercepted_channel.h \ include/grpcpp/impl/codegen/interceptor.h \ @@ -6712,6 +6719,7 @@ PUBLIC_HEADERS_CXX += \ include/grpcpp/impl/codegen/config.h \ include/grpcpp/impl/codegen/core_codegen_interface.h \ include/grpcpp/impl/codegen/create_auth_context.h \ + include/grpcpp/impl/codegen/delegating_channel.h \ include/grpcpp/impl/codegen/grpc_library.h \ include/grpcpp/impl/codegen/intercepted_channel.h \ include/grpcpp/impl/codegen/interceptor.h \ @@ -6882,6 +6890,7 @@ PUBLIC_HEADERS_CXX += \ include/grpcpp/impl/codegen/config.h \ include/grpcpp/impl/codegen/core_codegen_interface.h \ include/grpcpp/impl/codegen/create_auth_context.h \ + include/grpcpp/impl/codegen/delegating_channel.h \ include/grpcpp/impl/codegen/grpc_library.h \ include/grpcpp/impl/codegen/intercepted_channel.h \ include/grpcpp/impl/codegen/interceptor.h \ @@ -7247,6 +7256,7 @@ PUBLIC_HEADERS_CXX += \ include/grpcpp/impl/codegen/config.h \ include/grpcpp/impl/codegen/core_codegen_interface.h \ include/grpcpp/impl/codegen/create_auth_context.h \ + include/grpcpp/impl/codegen/delegating_channel.h \ include/grpcpp/impl/codegen/grpc_library.h \ include/grpcpp/impl/codegen/intercepted_channel.h \ include/grpcpp/impl/codegen/interceptor.h \ @@ -16420,6 +16430,49 @@ endif endif +DELEGATING_CHANNEL_TEST_SRC = \ + test/cpp/end2end/delegating_channel_test.cc \ + +DELEGATING_CHANNEL_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(DELEGATING_CHANNEL_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/delegating_channel_test: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+. + +$(BINDIR)/$(CONFIG)/delegating_channel_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/delegating_channel_test: $(PROTOBUF_DEP) $(DELEGATING_CHANNEL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(DELEGATING_CHANNEL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/delegating_channel_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/cpp/end2end/delegating_channel_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_delegating_channel_test: $(DELEGATING_CHANNEL_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(DELEGATING_CHANNEL_TEST_OBJS:.o=.dep) +endif +endif + + END2END_TEST_SRC = \ test/cpp/end2end/end2end_test.cc \ test/cpp/end2end/interceptors_util.cc \ diff --git a/build.yaml b/build.yaml index 5c085f18787..38406ede17e 100644 --- a/build.yaml +++ b/build.yaml @@ -1268,6 +1268,7 @@ filegroups: - include/grpcpp/impl/codegen/config.h - include/grpcpp/impl/codegen/core_codegen_interface.h - include/grpcpp/impl/codegen/create_auth_context.h + - include/grpcpp/impl/codegen/delegating_channel.h - include/grpcpp/impl/codegen/grpc_library.h - include/grpcpp/impl/codegen/intercepted_channel.h - include/grpcpp/impl/codegen/interceptor.h @@ -4758,6 +4759,18 @@ targets: - grpc - gpr uses_polling: false +- name: delegating_channel_test + gtest: true + build: test + language: c++ + src: + - test/cpp/end2end/delegating_channel_test.cc + deps: + - grpc++_test_util + - grpc_test_util + - grpc++ + - grpc + - gpr - name: end2end_test gtest: true cpu_cost: 0.5 diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 3b463cf7b90..5bce50dd2cd 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -169,6 +169,7 @@ Pod::Spec.new do |s| 'include/grpcpp/impl/codegen/config.h', 'include/grpcpp/impl/codegen/core_codegen_interface.h', 'include/grpcpp/impl/codegen/create_auth_context.h', + 'include/grpcpp/impl/codegen/delegating_channel.h', 'include/grpcpp/impl/codegen/grpc_library.h', 'include/grpcpp/impl/codegen/intercepted_channel.h', 'include/grpcpp/impl/codegen/interceptor.h', diff --git a/include/grpcpp/impl/codegen/channel_interface.h b/include/grpcpp/impl/codegen/channel_interface.h index 9df233b5500..5c977312dd6 100644 --- a/include/grpcpp/impl/codegen/channel_interface.h +++ b/include/grpcpp/impl/codegen/channel_interface.h @@ -62,6 +62,7 @@ class ClientCallbackReaderFactory; template class ClientCallbackWriterFactory; class ClientCallbackUnaryFactory; +class DelegatingChannel; class InterceptedChannel; } // namespace internal @@ -127,6 +128,7 @@ class ChannelInterface { template friend class ::grpc::internal::CallbackUnaryCallImpl; friend class ::grpc::internal::RpcMethod; + friend class ::grpc::internal::DelegatingChannel; friend class ::grpc::internal::InterceptedChannel; virtual internal::Call CreateCall(const internal::RpcMethod& method, ClientContext* context, diff --git a/include/grpcpp/impl/codegen/delegating_channel.h b/include/grpcpp/impl/codegen/delegating_channel.h new file mode 100644 index 00000000000..0853ad3b5de --- /dev/null +++ b/include/grpcpp/impl/codegen/delegating_channel.h @@ -0,0 +1,87 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H +#define GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H + +namespace grpc { +namespace internal { + +class DelegatingChannel : public ::grpc::ChannelInterface { + public: + virtual ~DelegatingChannel() {} + + DelegatingChannel(std::shared_ptr<::grpc::ChannelInterface> delegate_channel) + : delegate_channel_(delegate_channel) {} + + grpc_connectivity_state GetState(bool try_to_connect) override { + delegate_channel()->GetState(try_to_connect); + } + + std::shared_ptr<::grpc::ChannelInterface> delegate_channel() { + return delegate_channel_; + } + + private: + internal::Call CreateCall(const internal::RpcMethod& method, + ClientContext* context, + ::grpc_impl::CompletionQueue* cq) override { + return delegate_channel()->CreateCall(method, context, cq); + } + + void PerformOpsOnCall(internal::CallOpSetInterface* ops, + internal::Call* call) override { + delegate_channel()->PerformOpsOnCall(ops, call); + } + + void* RegisterMethod(const char* method) override { + return delegate_channel()->RegisterMethod(method); + } + + void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, + gpr_timespec deadline, + ::grpc_impl::CompletionQueue* cq, + void* tag) override { + delegate_channel()->NotifyOnStateChangeImpl(last_observed, deadline, cq, + tag); + } + + bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, + gpr_timespec deadline) override { + return delegate_channel()->WaitForStateChangeImpl(last_observed, deadline); + } + + internal::Call CreateCallInternal(const internal::RpcMethod& method, + ClientContext* context, + ::grpc_impl::CompletionQueue* cq, + size_t interceptor_pos) override { + return delegate_channel()->CreateCallInternal(method, context, cq, + interceptor_pos); + } + + ::grpc_impl::CompletionQueue* CallbackCQ() override { + return delegate_channel()->CallbackCQ(); + } + + std::shared_ptr<::grpc::ChannelInterface> delegate_channel_; +}; + +} // namespace internal +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H \ No newline at end of file diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index d229cc33034..cc407190c6a 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -165,6 +165,24 @@ grpc_cc_test( ], ) +grpc_cc_test( + name = "delegating_channel_test", + srcs = ["delegating_channel_test.cc"], + external_deps = [ + "gtest", + ], + deps = [ + ":test_service_impl", + "//:gpr", + "//:grpc", + "//:grpc++", + "//src/proto/grpc/testing:echo_messages_proto", + "//src/proto/grpc/testing:echo_proto", + "//test/core/util:grpc_test_util", + "//test/cpp/util:test_util", + ], +) + grpc_cc_test( name = "client_interceptors_end2end_test", srcs = ["client_interceptors_end2end_test.cc"], diff --git a/test/cpp/end2end/delegating_channel_test.cc b/test/cpp/end2end/delegating_channel_test.cc new file mode 100644 index 00000000000..22e261d535e --- /dev/null +++ b/test/cpp/end2end/delegating_channel_test.cc @@ -0,0 +1,100 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "src/proto/grpc/testing/echo.grpc.pb.h" +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" +#include "test/cpp/end2end/test_service_impl.h" +#include "test/cpp/util/byte_buffer_proto_helper.h" +#include "test/cpp/util/string_ref_helper.h" + +#include + +namespace grpc { +namespace testing { +namespace { + +class TestChannel : public internal::DelegatingChannel { + public: + TestChannel(std::shared_ptr delegate_channel) + : internal::DelegatingChannel(delegate_channel) {} + // Always returns GRPC_CHANNEL_READY + grpc_connectivity_state GetState(bool try_to_connect) override { + return GRPC_CHANNEL_READY; + } +}; + +class DelegatingChannelTest : public ::testing::Test { + protected: + DelegatingChannelTest() { + int port = grpc_pick_unused_port_or_die(); + ServerBuilder builder; + server_address_ = "localhost:" + std::to_string(port); + builder.AddListeningPort(server_address_, InsecureServerCredentials()); + builder.RegisterService(&service_); + server_ = builder.BuildAndStart(); + } + + ~DelegatingChannelTest() { server_->Shutdown(); } + + std::string server_address_; + TestServiceImpl service_; + std::unique_ptr server_; +}; + +TEST_F(DelegatingChannelTest, SimpleTest) { + auto channel = CreateChannel(server_address_, InsecureChannelCredentials()); + std::shared_ptr test_channel = + std::make_shared(channel); + // gRPC channel should be in idle state at this point but our test channel + // will return ready. + EXPECT_EQ(channel->GetState(false), GRPC_CHANNEL_IDLE); + EXPECT_EQ(test_channel->GetState(false), GRPC_CHANNEL_READY); + auto stub = grpc::testing::EchoTestService::NewStub(test_channel); + ClientContext ctx; + EchoRequest req; + req.set_message("Hello"); + EchoResponse resp; + Status s = stub->Echo(&ctx, req, &resp); + EXPECT_EQ(s.ok(), true); + EXPECT_EQ(resp.message(), "Hello"); +} + +} // namespace +} // namespace testing +} // namespace grpc + +int main(int argc, char** argv) { + grpc::testing::TestEnvironment env(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 913d7be993b..bbd5f11c697 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -966,6 +966,7 @@ include/grpcpp/impl/codegen/config_protobuf.h \ include/grpcpp/impl/codegen/core_codegen.h \ include/grpcpp/impl/codegen/core_codegen_interface.h \ include/grpcpp/impl/codegen/create_auth_context.h \ +include/grpcpp/impl/codegen/delegating_channel.h \ include/grpcpp/impl/codegen/grpc_library.h \ include/grpcpp/impl/codegen/intercepted_channel.h \ include/grpcpp/impl/codegen/interceptor.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 8b664d8ac01..77776770ce0 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -968,6 +968,7 @@ include/grpcpp/impl/codegen/core_codegen.h \ include/grpcpp/impl/codegen/core_codegen.h \ include/grpcpp/impl/codegen/core_codegen_interface.h \ include/grpcpp/impl/codegen/create_auth_context.h \ +include/grpcpp/impl/codegen/delegating_channel.h \ include/grpcpp/impl/codegen/grpc_library.h \ include/grpcpp/impl/codegen/intercepted_channel.h \ include/grpcpp/impl/codegen/interceptor.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index a479a00509a..32bb35ae1d0 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -3617,6 +3617,24 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "gpr", + "grpc", + "grpc++", + "grpc++_test_util", + "grpc_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "delegating_channel_test", + "src": [ + "test/cpp/end2end/delegating_channel_test.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", @@ -10138,6 +10156,7 @@ "include/grpcpp/impl/codegen/config.h", "include/grpcpp/impl/codegen/core_codegen_interface.h", "include/grpcpp/impl/codegen/create_auth_context.h", + "include/grpcpp/impl/codegen/delegating_channel.h", "include/grpcpp/impl/codegen/grpc_library.h", "include/grpcpp/impl/codegen/intercepted_channel.h", "include/grpcpp/impl/codegen/interceptor.h", @@ -10216,6 +10235,7 @@ "include/grpcpp/impl/codegen/config.h", "include/grpcpp/impl/codegen/core_codegen_interface.h", "include/grpcpp/impl/codegen/create_auth_context.h", + "include/grpcpp/impl/codegen/delegating_channel.h", "include/grpcpp/impl/codegen/grpc_library.h", "include/grpcpp/impl/codegen/intercepted_channel.h", "include/grpcpp/impl/codegen/interceptor.h", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 473e2e26c3a..c5531517257 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4423,6 +4423,30 @@ ], "uses_polling": false }, + { + "args": [], + "benchmark": false, + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": true, + "language": "c++", + "name": "delegating_channel_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "uses_polling": true + }, { "args": [], "benchmark": false, From 90f1c32b85e6e49a68ce5310a8455f1a9f04226e Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 13 Jun 2019 12:29:48 -0700 Subject: [PATCH 015/661] Sanity checks and return value --- include/grpcpp/impl/codegen/delegating_channel.h | 4 ++-- test/cpp/end2end/delegating_channel_test.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/grpcpp/impl/codegen/delegating_channel.h b/include/grpcpp/impl/codegen/delegating_channel.h index 0853ad3b5de..adc20b3751d 100644 --- a/include/grpcpp/impl/codegen/delegating_channel.h +++ b/include/grpcpp/impl/codegen/delegating_channel.h @@ -30,7 +30,7 @@ class DelegatingChannel : public ::grpc::ChannelInterface { : delegate_channel_(delegate_channel) {} grpc_connectivity_state GetState(bool try_to_connect) override { - delegate_channel()->GetState(try_to_connect); + return delegate_channel()->GetState(try_to_connect); } std::shared_ptr<::grpc::ChannelInterface> delegate_channel() { @@ -84,4 +84,4 @@ class DelegatingChannel : public ::grpc::ChannelInterface { } // namespace internal } // namespace grpc -#endif // GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H \ No newline at end of file +#endif // GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H diff --git a/test/cpp/end2end/delegating_channel_test.cc b/test/cpp/end2end/delegating_channel_test.cc index 22e261d535e..764a3eade88 100644 --- a/test/cpp/end2end/delegating_channel_test.cc +++ b/test/cpp/end2end/delegating_channel_test.cc @@ -46,7 +46,7 @@ namespace { class TestChannel : public internal::DelegatingChannel { public: TestChannel(std::shared_ptr delegate_channel) - : internal::DelegatingChannel(delegate_channel) {} + : internal::DelegatingChannel(std::move(delegate_channel)) {} // Always returns GRPC_CHANNEL_READY grpc_connectivity_state GetState(bool try_to_connect) override { return GRPC_CHANNEL_READY; From 219c3b38aa9d108c3c1126f4bed93c60a341b5c3 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 13 Jun 2019 16:55:37 -0700 Subject: [PATCH 016/661] Clang-tidy --- test/cpp/end2end/delegating_channel_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cpp/end2end/delegating_channel_test.cc b/test/cpp/end2end/delegating_channel_test.cc index 764a3eade88..553ec94f1dc 100644 --- a/test/cpp/end2end/delegating_channel_test.cc +++ b/test/cpp/end2end/delegating_channel_test.cc @@ -45,8 +45,8 @@ namespace { class TestChannel : public internal::DelegatingChannel { public: - TestChannel(std::shared_ptr delegate_channel) - : internal::DelegatingChannel(std::move(delegate_channel)) {} + TestChannel(const std::shared_ptr& delegate_channel) + : internal::DelegatingChannel(delegate_channel) {} // Always returns GRPC_CHANNEL_READY grpc_connectivity_state GetState(bool try_to_connect) override { return GRPC_CHANNEL_READY; From 0273879aed4ef61f87cf65d537cfdfdc11db40b7 Mon Sep 17 00:00:00 2001 From: Hope Casey-Allen Date: Fri, 14 Jun 2019 10:43:09 -0700 Subject: [PATCH 017/661] Fix typo --- src/proto/grpc/channelz/channelz.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/proto/grpc/channelz/channelz.proto b/src/proto/grpc/channelz/channelz.proto index 20de23f7fa3..f0ebda07213 100644 --- a/src/proto/grpc/channelz/channelz.proto +++ b/src/proto/grpc/channelz/channelz.proto @@ -35,7 +35,7 @@ option java_outer_classname = "ChannelzProto"; // Channel is a logical grouping of channels, subchannels, and sockets. message Channel { - // The identifier for this channel. This should bet set. + // The identifier for this channel. This should be set. ChannelRef ref = 1; // Data specific to this channel. ChannelData data = 2; From 036cdc661647f7c24c95b1c53a1a684b3537fa50 Mon Sep 17 00:00:00 2001 From: Loo Rong Jie Date: Sat, 15 Jun 2019 22:19:03 +0800 Subject: [PATCH 018/661] Properly detect C++ exception for MSVC Inspired from protobuf https://github.com/protocolbuffers/protobuf/blob/77f03d932a35e8aa0a98c0c728ad3f5aacfe30ce/src/google/protobuf/stubs/common.h#L50 --- include/grpc/impl/codegen/port_platform.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index d7294d59d41..591385eb705 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -618,10 +618,14 @@ typedef unsigned __int64 uint64_t; /* GRPC_ALLOW_EXCEPTIONS should be 0 or 1 if exceptions are allowed or not */ #ifndef GRPC_ALLOW_EXCEPTIONS -/* If not already set, set to 1 on Windows (style guide standard) but to - * 0 on non-Windows platforms unless the compiler defines __EXCEPTIONS */ #ifdef GPR_WINDOWS +#if defined(_MSC_VER) && defined(_CPPUNWIND) #define GRPC_ALLOW_EXCEPTIONS 1 +#elif defined(__EXCEPTIONS) +#define GRPC_ALLOW_EXCEPTIONS 1 +#else +#define GRPC_ALLOW_EXCEPTIONS 0 +#endif #else /* GPR_WINDOWS */ #ifdef __EXCEPTIONS #define GRPC_ALLOW_EXCEPTIONS 1 From 32944fdeb2ad7d4a480d347f5b08c07a7f7797f3 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 24 Jun 2019 13:56:56 -0700 Subject: [PATCH 019/661] Lay out bones of example --- examples/python/cancellation/BUILD.bazel | 64 ++++++++++ examples/python/cancellation/README.md | 0 examples/python/cancellation/client.py | 41 ++++++ examples/python/cancellation/hash_name.proto | 32 +++++ examples/python/cancellation/server.py | 117 ++++++++++++++++++ .../test/_cancellation_example_test.py | 0 6 files changed, 254 insertions(+) create mode 100644 examples/python/cancellation/BUILD.bazel create mode 100644 examples/python/cancellation/README.md create mode 100644 examples/python/cancellation/client.py create mode 100644 examples/python/cancellation/hash_name.proto create mode 100644 examples/python/cancellation/server.py create mode 100644 examples/python/cancellation/test/_cancellation_example_test.py diff --git a/examples/python/cancellation/BUILD.bazel b/examples/python/cancellation/BUILD.bazel new file mode 100644 index 00000000000..30bede22f22 --- /dev/null +++ b/examples/python/cancellation/BUILD.bazel @@ -0,0 +1,64 @@ +# gRPC Bazel BUILD file. +# +# Copyright 2019 The gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("@grpc_python_dependencies//:requirements.bzl", "requirement") +load("//bazel:python_rules.bzl", "py_proto_library") + +proto_library( + name = "hash_name_proto", + srcs = ["hash_name.proto"] +) + +py_proto_library( + name = "hash_name_proto_pb2", + deps = [":hash_name_proto"], + well_known_protos = False, +) + +py_binary( + name = "client", + testonly = 1, + srcs = ["client.py"], + deps = [ + "//src/python/grpcio/grpc:grpcio", + ":hash_name_proto_pb2", + ], + srcs_version = "PY2AND3", +) + +py_binary( + name = "server", + testonly = 1, + srcs = ["server.py"], + deps = [ + "//src/python/grpcio/grpc:grpcio", + ":hash_name_proto_pb2" + ] + select({ + "//conditions:default": [requirement("futures")], + "//:python3": [], + }), + srcs_version = "PY2AND3", +) + +py_test( + name = "test/_cancellation_example_test", + srcs = ["test/_cancellation_example_test.py"], + data = [ + ":client", + ":server" + ], + size = "small", +) diff --git a/examples/python/cancellation/README.md b/examples/python/cancellation/README.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py new file mode 100644 index 00000000000..b76ad0eabb5 --- /dev/null +++ b/examples/python/cancellation/client.py @@ -0,0 +1,41 @@ +# Copyright the 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""An example of cancelling requests in gRPC.""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +from concurrent import futures +import logging +import time + +import grpc + +from examples.python.cancellation import hash_name_pb2 +from examples.python.cancellation import hash_name_pb2_grpc + +_LOGGER = logging.getLogger(__name__) + +def main(): + # TODO(rbellevi): Fix the connaissance of target. + with grpc.insecure_channel('localhost:50051') as channel: + stub = hash_name_pb2_grpc.HashFinderStub(channel) + response = stub.Find(hash_name_pb2.HashNameRequest(desired_name="doctor", + maximum_hamming_distance=0)) + print(response) + +if __name__ == "__main__": + logging.basicConfig() + main() diff --git a/examples/python/cancellation/hash_name.proto b/examples/python/cancellation/hash_name.proto new file mode 100644 index 00000000000..b56d0f27a1e --- /dev/null +++ b/examples/python/cancellation/hash_name.proto @@ -0,0 +1,32 @@ +// Copyright 2019 the gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package hash_name; + +message HashNameRequest { + string desired_name = 1; + int32 maximum_hamming_distance = 2; +} + +message HashNameResponse { + string secret = 1; + string hashed_name = 2; + int32 hamming_distance = 3; +} + +service HashFinder { + rpc Find (HashNameRequest) returns (HashNameResponse) {} +} diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py new file mode 100644 index 00000000000..6aa3be4d3f2 --- /dev/null +++ b/examples/python/cancellation/server.py @@ -0,0 +1,117 @@ +# Copyright the 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""An example of cancelling requests in gRPC.""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +from concurrent import futures +from collections import deque +import base64 +import logging +import hashlib +import struct +import time + +import grpc + +from examples.python.cancellation import hash_name_pb2 +from examples.python.cancellation import hash_name_pb2_grpc + + +_LOGGER = logging.getLogger(__name__) +_SERVER_HOST = 'localhost' +_ONE_DAY_IN_SECONDS = 60 * 60 * 24 + + +def _get_hamming_distance(a, b): + """Calculates hamming distance between strings of equal length.""" + assert len(a) == len(b), "'{}', '{}'".format(a, b) + distance = 0 + for char_a, char_b in zip(a, b): + if char_a.lower() != char_b.lower(): + distance += 1 + return distance + + +def _get_substring_hamming_distance(candidate, target): + """Calculates the minimum hamming distance between between the target + and any substring of the candidate. + + Args: + candidate: The string whose substrings will be tested. + target: The target string. + + Returns: + The minimum Hamming distance between candidate and target. + """ + assert len(target) <= len(candidate) + assert len(candidate) != 0 + min_distance = None + for i in range(len(candidate) - len(target) + 1): + distance = _get_hamming_distance(candidate[i:i+len(target)], target) + if min_distance is None or distance < min_distance: + min_distance = distance + return min_distance + + +def _get_hash(secret): + hasher = hashlib.sha256() + hasher.update(secret) + return base64.b64encode(hasher.digest()) + + +class HashFinder(hash_name_pb2_grpc.HashFinderServicer): + + # TODO(rbellevi): Make this use less memory. + def Find(self, request, context): + to_check = deque((i,) for i in range(256)) + count = 0 + while True: + if count % 1000 == 0: + logging.info("Checked {} hashes.".format(count)) + current = to_check.popleft() + for i in range(256): + to_check.append(current + (i,)) + secret = b''.join(struct.pack('B', i) for i in current) + hash = _get_hash(secret) + distance = _get_substring_hamming_distance(hash, request.desired_name) + if distance <= request.maximum_hamming_distance: + return hash_name_pb2.HashNameResponse(secret=base64.b64encode(secret), + hashed_name=hash, + hamming_distance=distance) + count += 1 + + + +def main(): + port = 50051 + server = grpc.server(futures.ThreadPoolExecutor()) + hash_name_pb2_grpc.add_HashFinderServicer_to_server( + HashFinder(), server) + address = '{}:{}'.format(_SERVER_HOST, port) + server.add_insecure_port(address) + server.start() + print("Server listening at '{}'".format(address)) + try: + while True: + time.sleep(_ONE_DAY_IN_SECONDS) + except KeyboardInterrupt: + server.stop(None) + pass + +if __name__ == "__main__": + logging.basicConfig() + main() diff --git a/examples/python/cancellation/test/_cancellation_example_test.py b/examples/python/cancellation/test/_cancellation_example_test.py new file mode 100644 index 00000000000..e69de29bb2d From 335e655a7865f347efa92ed747363723c70dd299 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 24 Jun 2019 15:51:16 -0700 Subject: [PATCH 020/661] Free up server thread upon cancellation --- examples/python/cancellation/README.md | 9 +++ examples/python/cancellation/client.py | 27 +++++++- examples/python/cancellation/server.py | 91 +++++++++++++++++++------- 3 files changed, 99 insertions(+), 28 deletions(-) diff --git a/examples/python/cancellation/README.md b/examples/python/cancellation/README.md index e69de29bb2d..af0c8592625 100644 --- a/examples/python/cancellation/README.md +++ b/examples/python/cancellation/README.md @@ -0,0 +1,9 @@ +### Cancelling RPCs + +RPCs may be cancelled by both the client and the server. + +#### Cancellation on the Client Side + + + +#### Cancellation on the Server Side diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index b76ad0eabb5..599a774fefe 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -18,6 +18,7 @@ from __future__ import division from __future__ import print_function from concurrent import futures +import datetime import logging import time @@ -28,13 +29,33 @@ from examples.python.cancellation import hash_name_pb2_grpc _LOGGER = logging.getLogger(__name__) +# Interface: +# Cancel after we have n matches or we have an exact match. + + +# Test whether cancelling cancels a long-running unary RPC (I doubt it). +# Start the server with a single thread. +# Start a request and cancel it soon after. +# Start another request. If it succesfully cancelled, this will block forever. +# Add a bunch of logging so we know what's happening. + def main(): # TODO(rbellevi): Fix the connaissance of target. with grpc.insecure_channel('localhost:50051') as channel: stub = hash_name_pb2_grpc.HashFinderStub(channel) - response = stub.Find(hash_name_pb2.HashNameRequest(desired_name="doctor", - maximum_hamming_distance=0)) - print(response) + while True: + print("Sending request") + future = stub.Find.future(hash_name_pb2.HashNameRequest(desired_name="doctor", + maximum_hamming_distance=0)) + # TODO(rbellevi): Do not leave in a cancellation based on timeout. + # That's best handled by, well.. timeout. + try: + result = future.result(timeout=2.0) + print("Got response: \n{}".format(response)) + except grpc.FutureTimeoutError: + print("Cancelling request") + future.cancel() + if __name__ == "__main__": logging.basicConfig() diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 6aa3be4d3f2..badf5698b4a 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -19,11 +19,13 @@ from __future__ import print_function from concurrent import futures from collections import deque +import argparse import base64 import logging import hashlib import struct import time +import threading import grpc @@ -31,10 +33,14 @@ from examples.python.cancellation import hash_name_pb2 from examples.python.cancellation import hash_name_pb2_grpc +_BYTE_MAX = 255 + _LOGGER = logging.getLogger(__name__) _SERVER_HOST = 'localhost' _ONE_DAY_IN_SECONDS = 60 * 60 * 24 +_DESCRIPTION = "A server for finding hashes similar to names." + def _get_hamming_distance(a, b): """Calculates hamming distance between strings of equal length.""" @@ -68,37 +74,61 @@ def _get_substring_hamming_distance(candidate, target): def _get_hash(secret): - hasher = hashlib.sha256() + hasher = hashlib.sha1() hasher.update(secret) return base64.b64encode(hasher.digest()) -class HashFinder(hash_name_pb2_grpc.HashFinderServicer): - - # TODO(rbellevi): Make this use less memory. - def Find(self, request, context): - to_check = deque((i,) for i in range(256)) - count = 0 - while True: - if count % 1000 == 0: - logging.info("Checked {} hashes.".format(count)) - current = to_check.popleft() - for i in range(256): - to_check.append(current + (i,)) - secret = b''.join(struct.pack('B', i) for i in current) - hash = _get_hash(secret) - distance = _get_substring_hamming_distance(hash, request.desired_name) - if distance <= request.maximum_hamming_distance: - return hash_name_pb2.HashNameResponse(secret=base64.b64encode(secret), - hashed_name=hash, - hamming_distance=distance) - count += 1 +def _find_secret_of_length(target, maximum_distance, length, stop_event): + digits = [0] * length + while True: + if stop_event.is_set(): + return hash_name_pb2.HashNameResponse() + secret = b''.join(struct.pack('B', i) for i in digits) + hash = _get_hash(secret) + distance = _get_substring_hamming_distance(hash, target) + if distance <= maximum_distance: + return hash_name_pb2.HashNameResponse(secret=base64.b64encode(secret), + hashed_name=hash, + hamming_distance=distance) + digits[-1] += 1 + i = length - 1 + while digits[i] == _BYTE_MAX + 1: + digits[i] = 0 + i -= 1 + if i == -1: + return None + else: + digits[i] += 1 + + +def _find_secret(target, maximum_distance, stop_event): + length = 1 + while True: + print("Checking strings of length {}.".format(length)) + match = _find_secret_of_length(target, maximum_distance, length, stop_event) + if match is not None: + return match + if stop_event.is_set(): + return hash_name_pb2.HashNameResponse() + length += 1 +class HashFinder(hash_name_pb2_grpc.HashFinderServicer): -def main(): - port = 50051 - server = grpc.server(futures.ThreadPoolExecutor()) + def Find(self, request, context): + stop_event = threading.Event() + def on_rpc_done(): + stop_event.set() + context.add_callback(on_rpc_done) + print("Received request:\n{}".format(request)) + result = _find_secret(request.desired_name, request.maximum_hamming_distance, stop_event) + print("Returning result:\n{}".format(result)) + return result + + +def _run_server(port): + server = grpc.server(futures.ThreadPoolExecutor(max_workers=1)) hash_name_pb2_grpc.add_HashFinderServicer_to_server( HashFinder(), server) address = '{}:{}'.format(_SERVER_HOST, port) @@ -110,7 +140,18 @@ def main(): time.sleep(_ONE_DAY_IN_SECONDS) except KeyboardInterrupt: server.stop(None) - pass + + +def main(): + parser = argparse.ArgumentParser(description=_DESCRIPTION) + parser.add_argument( + '--port', + type=int, + default=50051, + nargs='?', + help='The port on which the server will listen.') + args = parser.parse_args() + _run_server(args.port) if __name__ == "__main__": logging.basicConfig() From 7dccc07c2ac7e54cd44ed1e81cdd2b6daf944f62 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 24 Jun 2019 16:02:34 -0700 Subject: [PATCH 021/661] Start writing README --- examples/python/cancellation/README.md | 31 +++++++++++++++++++++++++- examples/python/cancellation/client.py | 6 ----- examples/python/cancellation/server.py | 2 -- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/examples/python/cancellation/README.md b/examples/python/cancellation/README.md index af0c8592625..8d3e4767b9c 100644 --- a/examples/python/cancellation/README.md +++ b/examples/python/cancellation/README.md @@ -4,6 +4,35 @@ RPCs may be cancelled by both the client and the server. #### Cancellation on the Client Side - +A client may cancel an RPC for several reasons. Perhaps the data it requested +has been made irrelevant. Perhaps you, as the client, want to be a good citizen +of the server and are conserving compute resources. #### Cancellation on the Server Side + +A server is reponsible for cancellation in two ways. It must respond in some way +when a client initiates a cancellation, otherwise long-running computations +could continue indefinitely. + +It may also decide to cancel the RPC for its own reasons. In our example, the +server can be configured to cancel an RPC after a certain number of hashes has +been computed in order to conserve compute resources. + +##### Responding to Cancellations from a Servicer Thread + +It's important to remember that a gRPC Python server is backed by a thread pool +with a fixed size. When an RPC is cancelled, the library does *not* terminate +your servicer thread. It is your responsibility as the application author to +ensure that your servicer thread terminates soon after the RPC has been +cancelled. + +In this example, we use the `ServicerContext.add_callback` method to set a +`threading.Event` object when the RPC is terminated. We pass this `Event` object +down through our hashing algorithm and ensure to check that the RPC is still +ongoing before each iteration. + + +##### Initiating a Cancellation from a Servicer + +Initiating a cancellation from the server side is simpler. Just call +`ServicerContext.cancel()`. diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index 599a774fefe..93673ad8cc9 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -33,12 +33,6 @@ _LOGGER = logging.getLogger(__name__) # Cancel after we have n matches or we have an exact match. -# Test whether cancelling cancels a long-running unary RPC (I doubt it). -# Start the server with a single thread. -# Start a request and cancel it soon after. -# Start another request. If it succesfully cancelled, this will block forever. -# Add a bunch of logging so we know what's happening. - def main(): # TODO(rbellevi): Fix the connaissance of target. with grpc.insecure_channel('localhost:50051') as channel: diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index badf5698b4a..6af36809348 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -121,9 +121,7 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): def on_rpc_done(): stop_event.set() context.add_callback(on_rpc_done) - print("Received request:\n{}".format(request)) result = _find_secret(request.desired_name, request.maximum_hamming_distance, stop_event) - print("Returning result:\n{}".format(result)) return result From b31431aea3e0caac3b3741d077e7b4bd692f05c9 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 24 Jun 2019 16:49:35 -0700 Subject: [PATCH 022/661] Switch over to a generator --- examples/python/cancellation/client.py | 6 +- examples/python/cancellation/hash_name.proto | 4 +- examples/python/cancellation/server.py | 61 +++++++++++++++----- 3 files changed, 54 insertions(+), 17 deletions(-) diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index 93673ad8cc9..bd5296a544f 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -40,12 +40,12 @@ def main(): while True: print("Sending request") future = stub.Find.future(hash_name_pb2.HashNameRequest(desired_name="doctor", - maximum_hamming_distance=0)) + ideal_hamming_distance=1)) # TODO(rbellevi): Do not leave in a cancellation based on timeout. # That's best handled by, well.. timeout. try: - result = future.result(timeout=2.0) - print("Got response: \n{}".format(response)) + result = future.result(timeout=20.0) + print("Got response: \n{}".format(result)) except grpc.FutureTimeoutError: print("Cancelling request") future.cancel() diff --git a/examples/python/cancellation/hash_name.proto b/examples/python/cancellation/hash_name.proto index b56d0f27a1e..e0a5c8357be 100644 --- a/examples/python/cancellation/hash_name.proto +++ b/examples/python/cancellation/hash_name.proto @@ -18,7 +18,8 @@ package hash_name; message HashNameRequest { string desired_name = 1; - int32 maximum_hamming_distance = 2; + int32 ideal_hamming_distance = 2; + int32 interesting_hamming_distance = 3; } message HashNameResponse { @@ -29,4 +30,5 @@ message HashNameResponse { service HashFinder { rpc Find (HashNameRequest) returns (HashNameResponse) {} + rpc FindRange (HashNameRequest) returns (stream HashNameResponse) {} } diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 6af36809348..334a3770247 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -79,25 +79,39 @@ def _get_hash(secret): return base64.b64encode(hasher.digest()) -def _find_secret_of_length(target, maximum_distance, length, stop_event): +def _find_secret_of_length(target, ideal_distance, length, stop_event, interesting_hamming_distance=None): digits = [0] * length while True: if stop_event.is_set(): - return hash_name_pb2.HashNameResponse() + # Yield a sentinel and stop the generator if the RPC has been + # cancelled. + yield None + raise StopIteration() secret = b''.join(struct.pack('B', i) for i in digits) hash = _get_hash(secret) distance = _get_substring_hamming_distance(hash, target) - if distance <= maximum_distance: - return hash_name_pb2.HashNameResponse(secret=base64.b64encode(secret), + if interesting_hamming_distance is not None and distance <= interesting_hamming_distance: + # Surface interesting candidates, but don't stop. + yield hash_name_pb2.HashNameResponse(secret=base64.b64encode(secret), + hashed_name=hash, + hamming_distance=distance) + elif distance <= ideal_distance: + # Yield the ideal candidate followed by a sentinel to signal the end + # of the stream. + yield hash_name_pb2.HashNameResponse(secret=base64.b64encode(secret), hashed_name=hash, hamming_distance=distance) + yield None + raise StopIteration() digits[-1] += 1 i = length - 1 while digits[i] == _BYTE_MAX + 1: digits[i] = 0 i -= 1 if i == -1: - return None + # Terminate the generator since we've run out of strings of + # `length` bytes. + raise StopIteration() else: digits[i] += 1 @@ -106,11 +120,15 @@ def _find_secret(target, maximum_distance, stop_event): length = 1 while True: print("Checking strings of length {}.".format(length)) - match = _find_secret_of_length(target, maximum_distance, length, stop_event) - if match is not None: - return match - if stop_event.is_set(): - return hash_name_pb2.HashNameResponse() + for candidate in _find_secret_of_length(target, maximum_distance, length, stop_event): + if candidate is not None: + yield candidate + else: + raise StopIteration() + if stop_event.is_set(): + # Terminate the generator if the RPC has been cancelled. + raise StopIteration() + print("Incrementing length") length += 1 @@ -121,12 +139,28 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): def on_rpc_done(): stop_event.set() context.add_callback(on_rpc_done) - result = _find_secret(request.desired_name, request.maximum_hamming_distance, stop_event) - return result + candidates = list(_find_secret(request.desired_name, request.ideal_hamming_distance, stop_event)) + if not candidates: + return hash_name_pb2.HashNameResponse() + return candidates[-1] + + + def FindRange(self, request, context): + stop_event = threading.Event() + def on_rpc_done(): + stop_event.set() + context.add_callback(on_rpc_done) + secret_generator = _find_secret(request.desired_name, + request.ideal_hamming_distance, + stop_event, + interesting_hamming_distance=request.interesting_hamming_distance) + for candidate in secret_generator: + yield candidate def _run_server(port): - server = grpc.server(futures.ThreadPoolExecutor(max_workers=1)) + server = grpc.server(futures.ThreadPoolExecutor(max_workers=1), + maximum_concurrent_rpcs=1) hash_name_pb2_grpc.add_HashFinderServicer_to_server( HashFinder(), server) address = '{}:{}'.format(_SERVER_HOST, port) @@ -151,6 +185,7 @@ def main(): args = parser.parse_args() _run_server(args.port) + if __name__ == "__main__": logging.basicConfig() main() From 244279cb3651999a52e8b33f365e2d81819ce77b Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 09:07:46 -0700 Subject: [PATCH 023/661] Add client CLI --- examples/python/cancellation/client.py | 43 +++++++++++++++++++++----- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index bd5296a544f..63891d05842 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -18,6 +18,7 @@ from __future__ import division from __future__ import print_function from concurrent import futures +import argparse import datetime import logging import time @@ -27,20 +28,20 @@ import grpc from examples.python.cancellation import hash_name_pb2 from examples.python.cancellation import hash_name_pb2_grpc +_DESCRIPTION = "A client for finding hashes similar to names." _LOGGER = logging.getLogger(__name__) # Interface: -# Cancel after we have n matches or we have an exact match. +# Cancel on ctrl+c or an ideal candidate. - -def main(): - # TODO(rbellevi): Fix the connaissance of target. - with grpc.insecure_channel('localhost:50051') as channel: +def run_unary_client(server_target, name, ideal_distance): + # TODO(rbellevi): Cancel on ctrl+c + with grpc.insecure_channel(server_target) as channel: stub = hash_name_pb2_grpc.HashFinderStub(channel) while True: print("Sending request") - future = stub.Find.future(hash_name_pb2.HashNameRequest(desired_name="doctor", - ideal_hamming_distance=1)) + future = stub.Find.future(hash_name_pb2.HashNameRequest(desired_name=name, + ideal_hamming_distance=ideal_distance)) # TODO(rbellevi): Do not leave in a cancellation based on timeout. # That's best handled by, well.. timeout. try: @@ -51,6 +52,34 @@ def main(): future.cancel() +def run_streaming_client(target, name, ideal_distance, interesting_distance): + pass + + +def main(): + parser = argparse.ArgumentParser(description=_DESCRIPTION) + parser.add_argument("name", type=str, help='The desired name.') + parser.add_argument("--ideal-distance", default=0, nargs='?', + type=int, help="The desired Hamming distance.") + parser.add_argument( + '--server', + default='localhost:50051', + type=str, + nargs='?', + help='The host-port pair at which to reach the server.') + parser.add_argument( + '--show-inferior', + default=None, + type=int, + nargs='?', + help='Also show candidates with a Hamming distance less than this value.') + + args = parser.parse_args() + if args.show_inferior is not None: + run_streaming_client(args.server, args.name, args.ideal_distance, args.interesting_distance) + else: + run_unary_client(args.server, args.name, args.ideal_distance) + if __name__ == "__main__": logging.basicConfig() main() From b6a5e94f71917046ae3b0c29825ec986e11876ca Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 09:36:49 -0700 Subject: [PATCH 024/661] Respond to ctrl+c on client side --- examples/python/cancellation/client.py | 27 ++++++++++++++------------ examples/python/cancellation/server.py | 2 ++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index 63891d05842..f86a32af175 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -22,6 +22,7 @@ import argparse import datetime import logging import time +import signal import grpc @@ -31,25 +32,27 @@ from examples.python.cancellation import hash_name_pb2_grpc _DESCRIPTION = "A client for finding hashes similar to names." _LOGGER = logging.getLogger(__name__) -# Interface: -# Cancel on ctrl+c or an ideal candidate. +_TIMEOUT_SECONDS = 0.05 def run_unary_client(server_target, name, ideal_distance): - # TODO(rbellevi): Cancel on ctrl+c with grpc.insecure_channel(server_target) as channel: stub = hash_name_pb2_grpc.HashFinderStub(channel) + print("Sending request") + future = stub.Find.future(hash_name_pb2.HashNameRequest(desired_name=name, + ideal_hamming_distance=ideal_distance)) + def cancel_request(unused_signum, unused_frame): + print("Cancelling request.") + future.cancel() + signal.signal(signal.SIGINT, cancel_request) while True: - print("Sending request") - future = stub.Find.future(hash_name_pb2.HashNameRequest(desired_name=name, - ideal_hamming_distance=ideal_distance)) - # TODO(rbellevi): Do not leave in a cancellation based on timeout. - # That's best handled by, well.. timeout. try: - result = future.result(timeout=20.0) - print("Got response: \n{}".format(result)) + result = future.result(timeout=_TIMEOUT_SECONDS) except grpc.FutureTimeoutError: - print("Cancelling request") - future.cancel() + continue + except grpc.FutureCancelledError: + break + print("Got response: \n{}".format(result)) + break def run_streaming_client(target, name, ideal_distance, interesting_distance): diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 334a3770247..575c2fc8e74 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -137,9 +137,11 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): def Find(self, request, context): stop_event = threading.Event() def on_rpc_done(): + print("Attempting to regain servicer thread.") stop_event.set() context.add_callback(on_rpc_done) candidates = list(_find_secret(request.desired_name, request.ideal_hamming_distance, stop_event)) + print("Servicer thread returning.") if not candidates: return hash_name_pb2.HashNameResponse() return candidates[-1] From c9e83db6bcaf08024f8e00184990a1e72cfe2b82 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 10:34:48 -0700 Subject: [PATCH 025/661] Implement streaming on the client side --- examples/python/cancellation/README.md | 28 +++++++++++++++ examples/python/cancellation/client.py | 50 ++++++++++++++++++++++++-- examples/python/cancellation/server.py | 8 +++-- 3 files changed, 81 insertions(+), 5 deletions(-) diff --git a/examples/python/cancellation/README.md b/examples/python/cancellation/README.md index 8d3e4767b9c..64ffa3cf1c7 100644 --- a/examples/python/cancellation/README.md +++ b/examples/python/cancellation/README.md @@ -8,6 +8,34 @@ A client may cancel an RPC for several reasons. Perhaps the data it requested has been made irrelevant. Perhaps you, as the client, want to be a good citizen of the server and are conserving compute resources. +##### Cancelling a Client-Side Unary RPC + +The default RPC methods on a stub will simply return the result of an RPC. + +```python +>>> stub = hash_name_pb2_grpc.HashFinderStub(channel) +>>> stub.Find(hash_name_pb2.HashNameRequest(desired_name=name)) + +``` + +But you may use the `future()` method to receive an instance of `grpc.Future`. +This interface allows you to wait on a response with a timeout, add a callback +to be executed when the RPC completes, or to cancel the RPC before it has +completed. + +In the example, we use this interface to cancel our in-progress RPC when the +user interrupts the process with ctrl-c. + +```python +stub = hash_name_pb2_grpc.HashFinderStub(channel) +future = stub.Find.future(hash_name_pb2.HashNameRequest(desired_name=name)) +def cancel_request(unused_signum, unused_frame): + future.cancel() +signal.signal(signal.SIGINT, cancel_request) +``` + +##### Cancelling a Client-Side Streaming RPC + #### Cancellation on the Server Side A server is reponsible for cancellation in two ways. It must respond in some way diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index f86a32af175..f57867a9ae6 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -23,6 +23,14 @@ import datetime import logging import time import signal +import threading + +try: + from queue import Queue + from queue import Empty as QueueEmpty +except ImportError: + from Queue import Queue + from Queue import Empty as QueueEmpty import grpc @@ -34,6 +42,8 @@ _LOGGER = logging.getLogger(__name__) _TIMEOUT_SECONDS = 0.05 +# TODO(rbellevi): Actually use the logger. + def run_unary_client(server_target, name, ideal_distance): with grpc.insecure_channel(server_target) as channel: stub = hash_name_pb2_grpc.HashFinderStub(channel) @@ -55,9 +65,43 @@ def run_unary_client(server_target, name, ideal_distance): break -def run_streaming_client(target, name, ideal_distance, interesting_distance): - pass +def run_streaming_client(server_target, name, ideal_distance, interesting_distance): + with grpc.insecure_channel(server_target) as channel: + stub = hash_name_pb2_grpc.HashFinderStub(channel) + print("Initiating RPC") + result_generator = stub.FindRange(hash_name_pb2.HashNameRequest(desired_name=name, + ideal_hamming_distance=ideal_distance, + interesting_hamming_distance=interesting_distance)) + def cancel_request(unused_signum, unused_frame): + print("Cancelling request.") + result_generator.cancel() + signal.signal(signal.SIGINT, cancel_request) + result_queue = Queue() + + def iterate_responses(result_generator, result_queue): + try: + for result in result_generator: + print("Result: {}".format(result)) + result_queue.put(result) + except grpc.RpcError as rpc_error: + if rpc_error.code() != grpc.StatusCode.CANCELLED: + result_queue.put(None) + raise rpc_error + # Enqueue a sentinel to signal the end of the stream. + result_queue.put(None) + print("RPC complete") + response_thread = threading.Thread(target=iterate_responses, args=(result_generator, result_queue)) + response_thread.daemon = True + response_thread.start() + while result_generator.running(): + try: + result = result_queue.get(timeout=_TIMEOUT_SECONDS) + except QueueEmpty: + continue + if result is None: + break + print("Got result: {}".format(result)) def main(): parser = argparse.ArgumentParser(description=_DESCRIPTION) @@ -79,7 +123,7 @@ def main(): args = parser.parse_args() if args.show_inferior is not None: - run_streaming_client(args.server, args.name, args.ideal_distance, args.interesting_distance) + run_streaming_client(args.server, args.name, args.ideal_distance, args.show_inferior) else: run_unary_client(args.server, args.name, args.ideal_distance) diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 575c2fc8e74..12dbc5653ff 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -32,6 +32,8 @@ import grpc from examples.python.cancellation import hash_name_pb2 from examples.python.cancellation import hash_name_pb2_grpc +# TODO(rbellevi): Actually use the logger. +# TODO(rbellevi): Enforce per-user quotas with cancellation _BYTE_MAX = 255 @@ -116,11 +118,11 @@ def _find_secret_of_length(target, ideal_distance, length, stop_event, interesti digits[i] += 1 -def _find_secret(target, maximum_distance, stop_event): +def _find_secret(target, maximum_distance, stop_event, interesting_hamming_distance=None): length = 1 while True: print("Checking strings of length {}.".format(length)) - for candidate in _find_secret_of_length(target, maximum_distance, length, stop_event): + for candidate in _find_secret_of_length(target, maximum_distance, length, stop_event, interesting_hamming_distance=interesting_hamming_distance): if candidate is not None: yield candidate else: @@ -150,6 +152,7 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): def FindRange(self, request, context): stop_event = threading.Event() def on_rpc_done(): + print("Attempting to regain servicer thread.") stop_event.set() context.add_callback(on_rpc_done) secret_generator = _find_secret(request.desired_name, @@ -158,6 +161,7 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): interesting_hamming_distance=request.interesting_hamming_distance) for candidate in secret_generator: yield candidate + print("Regained servicer thread.") def _run_server(port): From 4ee154dd53c7ce6ad8bb2e7831af40abac4f545d Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 10:50:04 -0700 Subject: [PATCH 026/661] Elaborate on unary cancellation --- examples/python/cancellation/README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/examples/python/cancellation/README.md b/examples/python/cancellation/README.md index 64ffa3cf1c7..08aea49e2c9 100644 --- a/examples/python/cancellation/README.md +++ b/examples/python/cancellation/README.md @@ -34,6 +34,29 @@ def cancel_request(unused_signum, unused_frame): signal.signal(signal.SIGINT, cancel_request) ``` +It's also important that you not block indefinitely on the RPC. Otherwise, the +signal handler will never have a chance to run. + +```python +while True: + try: + result = future.result(timeout=_TIMEOUT_SECONDS) + except grpc.FutureTimeoutError: + continue + except grpc.FutureCancelledError: + break + print("Got response: \n{}".format(result)) + break +``` + +Here, we repeatedly block on a result for up to `_TIMEOUT_SECONDS`. Doing so +gives us a chance for the signal handlers to run. In the case that out timeout +was reached, we simply continue on in the loop. In the case that the RPC was +cancelled (by our user's ctrl+c), we break out of the loop cleanly. Finally, if +we received the result of the RPC, we print it out for the user and exit the +loop. + + ##### Cancelling a Client-Side Streaming RPC #### Cancellation on the Server Side From 82aa4068c79ebb3ba37341199b078c9b6f910f8c Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 11:02:10 -0700 Subject: [PATCH 027/661] Elaborate on cancelling streaming RPCs --- examples/python/cancellation/README.md | 64 ++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/examples/python/cancellation/README.md b/examples/python/cancellation/README.md index 08aea49e2c9..e7f6b42106e 100644 --- a/examples/python/cancellation/README.md +++ b/examples/python/cancellation/README.md @@ -8,7 +8,7 @@ A client may cancel an RPC for several reasons. Perhaps the data it requested has been made irrelevant. Perhaps you, as the client, want to be a good citizen of the server and are conserving compute resources. -##### Cancelling a Client-Side Unary RPC +##### Cancelling a Server-Side Unary RPC from the Client The default RPC methods on a stub will simply return the result of an RPC. @@ -50,14 +50,72 @@ while True: ``` Here, we repeatedly block on a result for up to `_TIMEOUT_SECONDS`. Doing so -gives us a chance for the signal handlers to run. In the case that out timeout +gives the signal handlers a chance to run. In the case that our timeout was reached, we simply continue on in the loop. In the case that the RPC was cancelled (by our user's ctrl+c), we break out of the loop cleanly. Finally, if we received the result of the RPC, we print it out for the user and exit the loop. -##### Cancelling a Client-Side Streaming RPC +##### Cancelling a Server-Side Streaming RPC from the Client + +Cancelling a Server-side streaming RPC is even simpler from the perspective of +the gRPC API. The default stub method is already an instance of `grpc.Future`, +so the methods outlined above still apply. It is also a generator, so we may +iterate over it to yield the results of our RPC. + +```python +stub = hash_name_pb2_grpc.HashFinderStub(channel) +result_generator = stub.FindRange(hash_name_pb2.HashNameRequest(desired_name=name)) +def cancel_request(unused_signum, unused_frame): + result_generator.cancel() +signal.signal(signal.SIGINT, cancel_request) +``` + +However, the streaming case is complicated by the fact that there is no way to +propagate a timeout to Python generators. As a result, simply iterating over the +results of the RPC can block indefinitely and the signal handler may never run. +Instead, we iterate over the generator on another thread and retrieve the +results on the main thread with a synchronized `Queue`. + +```python +result_queue = Queue() +def iterate_responses(result_generator, result_queue): + try: + for result in result_generator: + result_queue.put(result) + except grpc.RpcError as rpc_error: + if rpc_error.code() != grpc.StatusCode.CANCELLED: + result_queue.put(None) + raise rpc_error + result_queue.put(None) + print("RPC complete") +response_thread = threading.Thread(target=iterate_responses, args=(result_generator, result_queue)) +response_thread.daemon = True +response_thread.start() +``` + +While this thread iterating over the results may block indefinitely, we can +structure the code running on our main thread in such a way that signal handlers +are guaranteed to be run at least every `_TIMEOUT_SECONDS` seconds. + +```python +while result_generator.running(): + try: + result = result_queue.get(timeout=_TIMEOUT_SECONDS) + except QueueEmpty: + continue + if result is None: + break + print("Got result: {}".format(result)) +``` + +Similarly to the unary example above, we continue in a loop waiting for results, +taking care to block for intervals of `_TIMEOUT_SECONDS` at the longest. +Finally, we use `None` as a sentinel value to signal the end of the stream. + +Using this scheme, our process responds nicely to `SIGINT`s while also +explicitly cancelling its RPCs. #### Cancellation on the Server Side From cdae8ca6ad87c6fb94c7dc5dec7ba49f282b06aa Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 11:11:03 -0700 Subject: [PATCH 028/661] Add intro about algorithm --- examples/python/cancellation/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/examples/python/cancellation/README.md b/examples/python/cancellation/README.md index e7f6b42106e..c50cc3b34df 100644 --- a/examples/python/cancellation/README.md +++ b/examples/python/cancellation/README.md @@ -2,6 +2,19 @@ RPCs may be cancelled by both the client and the server. +#### The Example + +In the example, we implement a silly algorithm. We search for bytestrings whose +hashes are similar to a given search string. For example, say we're looking for +the string "doctor". Our algorithm may `JrqhZVkTDoctYrUlXDbL6pfYQHU=` or +`RC9/7mlM3ldy4TdoctOc6WzYbO4=`. This is a brute force algorithm, so the server +performing the search must be conscious the resources it allows to each client +and each client must be conscientious of the resources demanded of the server. + +In particular, we ensure that client processes cancel the stream explicitly +before terminating and we ensure the server cancels RPCs that have gone on longer +than a certain number of iterations. + #### Cancellation on the Client Side A client may cancel an RPC for several reasons. Perhaps the data it requested From b9cc2c210f85f6b6a672b3f0be853e26fcfa9ae3 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 11:15:43 -0700 Subject: [PATCH 029/661] Explain how we take care of servicer threads --- examples/python/cancellation/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/python/cancellation/README.md b/examples/python/cancellation/README.md index c50cc3b34df..7329ed834e8 100644 --- a/examples/python/cancellation/README.md +++ b/examples/python/cancellation/README.md @@ -153,6 +153,14 @@ In this example, we use the `ServicerContext.add_callback` method to set a down through our hashing algorithm and ensure to check that the RPC is still ongoing before each iteration. +```python +stop_event = threading.Event() +def on_rpc_done(): + # Regain servicer thread. + stop_event.set() +context.add_callback(on_rpc_done) +secret = _find_secret(stop_event) +``` ##### Initiating a Cancellation from a Servicer From 4c852bf25f30b618e412c0a1e9dfb2f33cc75478 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 12:50:10 -0700 Subject: [PATCH 030/661] Cancel RPCs after a hash limit has been reached --- examples/python/cancellation/README.md | 2 +- examples/python/cancellation/server.py | 61 ++++++++++++++++++++------ 2 files changed, 49 insertions(+), 14 deletions(-) diff --git a/examples/python/cancellation/README.md b/examples/python/cancellation/README.md index 7329ed834e8..b085c9bc016 100644 --- a/examples/python/cancellation/README.md +++ b/examples/python/cancellation/README.md @@ -162,7 +162,7 @@ context.add_callback(on_rpc_done) secret = _find_secret(stop_event) ``` -##### Initiating a Cancellation from a Servicer +##### Initiating a Cancellation on the Server Side Initiating a cancellation from the server side is simpler. Just call `ServicerContext.cancel()`. diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 12dbc5653ff..3eb5f0bd45b 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -81,13 +81,22 @@ def _get_hash(secret): return base64.b64encode(hasher.digest()) -def _find_secret_of_length(target, ideal_distance, length, stop_event, interesting_hamming_distance=None): +class ResourceLimitExceededError(Exception): + """Signifies the request has exceeded configured limits.""" + +# TODO(rbellevi): Docstring all the things. +# TODO(rbellevi): File issue about indefinite blocking for server-side +# streaming. + + +def _find_secret_of_length(target, ideal_distance, length, stop_event, maximum_hashes, interesting_hamming_distance=None): digits = [0] * length + hashes_computed = 0 while True: if stop_event.is_set(): # Yield a sentinel and stop the generator if the RPC has been # cancelled. - yield None + yield None, hashes_computed raise StopIteration() secret = b''.join(struct.pack('B', i) for i in digits) hash = _get_hash(secret) @@ -96,14 +105,14 @@ def _find_secret_of_length(target, ideal_distance, length, stop_event, interesti # Surface interesting candidates, but don't stop. yield hash_name_pb2.HashNameResponse(secret=base64.b64encode(secret), hashed_name=hash, - hamming_distance=distance) + hamming_distance=distance), hashes_computed elif distance <= ideal_distance: # Yield the ideal candidate followed by a sentinel to signal the end # of the stream. yield hash_name_pb2.HashNameResponse(secret=base64.b64encode(secret), hashed_name=hash, - hamming_distance=distance) - yield None + hamming_distance=distance), hashes_computed + yield None, hashes_computed raise StopIteration() digits[-1] += 1 i = length - 1 @@ -116,13 +125,19 @@ def _find_secret_of_length(target, ideal_distance, length, stop_event, interesti raise StopIteration() else: digits[i] += 1 + hashes_computed += 1 + if hashes_computed == maximum_hashes: + raise ResourceLimitExceededError() -def _find_secret(target, maximum_distance, stop_event, interesting_hamming_distance=None): +def _find_secret(target, maximum_distance, stop_event, maximum_hashes, interesting_hamming_distance=None): length = 1 + total_hashes = 0 while True: print("Checking strings of length {}.".format(length)) - for candidate in _find_secret_of_length(target, maximum_distance, length, stop_event, interesting_hamming_distance=interesting_hamming_distance): + last_hashes_computed = 0 + for candidate, hashes_computed in _find_secret_of_length(target, maximum_distance, length, stop_event, maximum_hashes - total_hashes, interesting_hamming_distance=interesting_hamming_distance): + last_hashes_computed = hashes_computed if candidate is not None: yield candidate else: @@ -130,19 +145,28 @@ def _find_secret(target, maximum_distance, stop_event, interesting_hamming_dista if stop_event.is_set(): # Terminate the generator if the RPC has been cancelled. raise StopIteration() + total_hashes += last_hashes_computed print("Incrementing length") length += 1 class HashFinder(hash_name_pb2_grpc.HashFinderServicer): + def __init__(self, maximum_hashes): + super(HashFinder, self).__init__() + self._maximum_hashes = maximum_hashes + def Find(self, request, context): stop_event = threading.Event() def on_rpc_done(): print("Attempting to regain servicer thread.") stop_event.set() context.add_callback(on_rpc_done) - candidates = list(_find_secret(request.desired_name, request.ideal_hamming_distance, stop_event)) + try: + candidates = list(_find_secret(request.desired_name, request.ideal_hamming_distance, stop_event, self._maximum_hashes)) + except ResourceLimitExceededError: + print("Cancelling RPC due to exhausted resources.") + context.cancel() print("Servicer thread returning.") if not candidates: return hash_name_pb2.HashNameResponse() @@ -158,17 +182,22 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): secret_generator = _find_secret(request.desired_name, request.ideal_hamming_distance, stop_event, + self._maximum_hashes, interesting_hamming_distance=request.interesting_hamming_distance) - for candidate in secret_generator: - yield candidate + try: + for candidate in secret_generator: + yield candidate + except ResourceLimitExceededError: + print("Cancelling RPC due to exhausted resources.") + context.cancel print("Regained servicer thread.") -def _run_server(port): +def _run_server(port, maximum_hashes): server = grpc.server(futures.ThreadPoolExecutor(max_workers=1), maximum_concurrent_rpcs=1) hash_name_pb2_grpc.add_HashFinderServicer_to_server( - HashFinder(), server) + HashFinder(maximum_hashes), server) address = '{}:{}'.format(_SERVER_HOST, port) server.add_insecure_port(address) server.start() @@ -188,8 +217,14 @@ def main(): default=50051, nargs='?', help='The port on which the server will listen.') + parser.add_argument( + '--maximum-hashes', + type=int, + default=10000, + nargs='?', + help='The maximum number of hashes to search before cancelling.') args = parser.parse_args() - _run_server(args.port) + _run_server(args.port, args.maximum_hashes) if __name__ == "__main__": From b12299701df6614c1fd5df86d9c46a5bda3d2d66 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 13:00:09 -0700 Subject: [PATCH 031/661] Clean up logging --- examples/python/cancellation/README.md | 15 +++++++++++++++ examples/python/cancellation/client.py | 10 ++-------- examples/python/cancellation/server.py | 19 +++++++------------ 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/examples/python/cancellation/README.md b/examples/python/cancellation/README.md index b085c9bc016..d5f9a844fcc 100644 --- a/examples/python/cancellation/README.md +++ b/examples/python/cancellation/README.md @@ -166,3 +166,18 @@ secret = _find_secret(stop_event) Initiating a cancellation from the server side is simpler. Just call `ServicerContext.cancel()`. + +In our example, we ensure that no single client is monopolizing the server by +cancelling after a configurable number of hashes have been checked. + +```python +try: + for candidate in secret_generator: + yield candidate +except ResourceLimitExceededError: + print("Cancelling RPC due to exhausted resources.") + context.cancel() +``` + +In this type of situation, you may also consider returning a more specific error +using the [`grpcio-status`](https://pypi.org/project/grpcio-status/) package. diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index f57867a9ae6..f97a8c05e50 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -47,11 +47,9 @@ _TIMEOUT_SECONDS = 0.05 def run_unary_client(server_target, name, ideal_distance): with grpc.insecure_channel(server_target) as channel: stub = hash_name_pb2_grpc.HashFinderStub(channel) - print("Sending request") future = stub.Find.future(hash_name_pb2.HashNameRequest(desired_name=name, ideal_hamming_distance=ideal_distance)) def cancel_request(unused_signum, unused_frame): - print("Cancelling request.") future.cancel() signal.signal(signal.SIGINT, cancel_request) while True: @@ -61,19 +59,17 @@ def run_unary_client(server_target, name, ideal_distance): continue except grpc.FutureCancelledError: break - print("Got response: \n{}".format(result)) + print(result) break def run_streaming_client(server_target, name, ideal_distance, interesting_distance): with grpc.insecure_channel(server_target) as channel: stub = hash_name_pb2_grpc.HashFinderStub(channel) - print("Initiating RPC") result_generator = stub.FindRange(hash_name_pb2.HashNameRequest(desired_name=name, ideal_hamming_distance=ideal_distance, interesting_hamming_distance=interesting_distance)) def cancel_request(unused_signum, unused_frame): - print("Cancelling request.") result_generator.cancel() signal.signal(signal.SIGINT, cancel_request) result_queue = Queue() @@ -81,7 +77,6 @@ def run_streaming_client(server_target, name, ideal_distance, interesting_distan def iterate_responses(result_generator, result_queue): try: for result in result_generator: - print("Result: {}".format(result)) result_queue.put(result) except grpc.RpcError as rpc_error: if rpc_error.code() != grpc.StatusCode.CANCELLED: @@ -89,7 +84,6 @@ def run_streaming_client(server_target, name, ideal_distance, interesting_distan raise rpc_error # Enqueue a sentinel to signal the end of the stream. result_queue.put(None) - print("RPC complete") response_thread = threading.Thread(target=iterate_responses, args=(result_generator, result_queue)) response_thread.daemon = True response_thread.start() @@ -101,7 +95,7 @@ def run_streaming_client(server_target, name, ideal_distance, interesting_distan continue if result is None: break - print("Got result: {}".format(result)) + print(result) def main(): parser = argparse.ArgumentParser(description=_DESCRIPTION) diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 3eb5f0bd45b..a2e8e947746 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -32,9 +32,6 @@ import grpc from examples.python.cancellation import hash_name_pb2 from examples.python.cancellation import hash_name_pb2_grpc -# TODO(rbellevi): Actually use the logger. -# TODO(rbellevi): Enforce per-user quotas with cancellation - _BYTE_MAX = 255 _LOGGER = logging.getLogger(__name__) @@ -134,7 +131,6 @@ def _find_secret(target, maximum_distance, stop_event, maximum_hashes, interesti length = 1 total_hashes = 0 while True: - print("Checking strings of length {}.".format(length)) last_hashes_computed = 0 for candidate, hashes_computed in _find_secret_of_length(target, maximum_distance, length, stop_event, maximum_hashes - total_hashes, interesting_hamming_distance=interesting_hamming_distance): last_hashes_computed = hashes_computed @@ -146,7 +142,6 @@ def _find_secret(target, maximum_distance, stop_event, maximum_hashes, interesti # Terminate the generator if the RPC has been cancelled. raise StopIteration() total_hashes += last_hashes_computed - print("Incrementing length") length += 1 @@ -159,15 +154,15 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): def Find(self, request, context): stop_event = threading.Event() def on_rpc_done(): - print("Attempting to regain servicer thread.") + _LOGGER.debug("Attempting to regain servicer thread.") stop_event.set() context.add_callback(on_rpc_done) try: candidates = list(_find_secret(request.desired_name, request.ideal_hamming_distance, stop_event, self._maximum_hashes)) except ResourceLimitExceededError: - print("Cancelling RPC due to exhausted resources.") + _LOGGER.info("Cancelling RPC due to exhausted resources.") context.cancel() - print("Servicer thread returning.") + _LOGGER.debug("Servicer thread returning.") if not candidates: return hash_name_pb2.HashNameResponse() return candidates[-1] @@ -176,7 +171,7 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): def FindRange(self, request, context): stop_event = threading.Event() def on_rpc_done(): - print("Attempting to regain servicer thread.") + _LOGGER.debug("Attempting to regain servicer thread.") stop_event.set() context.add_callback(on_rpc_done) secret_generator = _find_secret(request.desired_name, @@ -188,9 +183,9 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): for candidate in secret_generator: yield candidate except ResourceLimitExceededError: - print("Cancelling RPC due to exhausted resources.") - context.cancel - print("Regained servicer thread.") + _LOGGER.info("Cancelling RPC due to exhausted resources.") + context.cancel() + _LOGGER.debug("Regained servicer thread.") def _run_server(port, maximum_hashes): From 8f1bfdab55f08cebdf60d5847634ba894904e62e Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 13:01:22 -0700 Subject: [PATCH 032/661] Yapf --- examples/python/cancellation/client.py | 41 +++++++++++----- examples/python/cancellation/server.py | 65 ++++++++++++++++++-------- 2 files changed, 75 insertions(+), 31 deletions(-) diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index f97a8c05e50..288f93d057e 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -44,13 +44,17 @@ _TIMEOUT_SECONDS = 0.05 # TODO(rbellevi): Actually use the logger. + def run_unary_client(server_target, name, ideal_distance): with grpc.insecure_channel(server_target) as channel: stub = hash_name_pb2_grpc.HashFinderStub(channel) - future = stub.Find.future(hash_name_pb2.HashNameRequest(desired_name=name, - ideal_hamming_distance=ideal_distance)) + future = stub.Find.future( + hash_name_pb2.HashNameRequest( + desired_name=name, ideal_hamming_distance=ideal_distance)) + def cancel_request(unused_signum, unused_frame): future.cancel() + signal.signal(signal.SIGINT, cancel_request) while True: try: @@ -63,14 +67,19 @@ def run_unary_client(server_target, name, ideal_distance): break -def run_streaming_client(server_target, name, ideal_distance, interesting_distance): +def run_streaming_client(server_target, name, ideal_distance, + interesting_distance): with grpc.insecure_channel(server_target) as channel: stub = hash_name_pb2_grpc.HashFinderStub(channel) - result_generator = stub.FindRange(hash_name_pb2.HashNameRequest(desired_name=name, - ideal_hamming_distance=ideal_distance, - interesting_hamming_distance=interesting_distance)) + result_generator = stub.FindRange( + hash_name_pb2.HashNameRequest( + desired_name=name, + ideal_hamming_distance=ideal_distance, + interesting_hamming_distance=interesting_distance)) + def cancel_request(unused_signum, unused_frame): result_generator.cancel() + signal.signal(signal.SIGINT, cancel_request) result_queue = Queue() @@ -84,7 +93,9 @@ def run_streaming_client(server_target, name, ideal_distance, interesting_distan raise rpc_error # Enqueue a sentinel to signal the end of the stream. result_queue.put(None) - response_thread = threading.Thread(target=iterate_responses, args=(result_generator, result_queue)) + + response_thread = threading.Thread( + target=iterate_responses, args=(result_generator, result_queue)) response_thread.daemon = True response_thread.start() @@ -97,11 +108,16 @@ def run_streaming_client(server_target, name, ideal_distance, interesting_distan break print(result) + def main(): parser = argparse.ArgumentParser(description=_DESCRIPTION) parser.add_argument("name", type=str, help='The desired name.') - parser.add_argument("--ideal-distance", default=0, nargs='?', - type=int, help="The desired Hamming distance.") + parser.add_argument( + "--ideal-distance", + default=0, + nargs='?', + type=int, + help="The desired Hamming distance.") parser.add_argument( '--server', default='localhost:50051', @@ -113,14 +129,17 @@ def main(): default=None, type=int, nargs='?', - help='Also show candidates with a Hamming distance less than this value.') + help='Also show candidates with a Hamming distance less than this value.' + ) args = parser.parse_args() if args.show_inferior is not None: - run_streaming_client(args.server, args.name, args.ideal_distance, args.show_inferior) + run_streaming_client(args.server, args.name, args.ideal_distance, + args.show_inferior) else: run_unary_client(args.server, args.name, args.ideal_distance) + if __name__ == "__main__": logging.basicConfig() main() diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index a2e8e947746..1af07e4a1e4 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -66,7 +66,7 @@ def _get_substring_hamming_distance(candidate, target): assert len(candidate) != 0 min_distance = None for i in range(len(candidate) - len(target) + 1): - distance = _get_hamming_distance(candidate[i:i+len(target)], target) + distance = _get_hamming_distance(candidate[i:i + len(target)], target) if min_distance is None or distance < min_distance: min_distance = distance return min_distance @@ -81,12 +81,18 @@ def _get_hash(secret): class ResourceLimitExceededError(Exception): """Signifies the request has exceeded configured limits.""" + # TODO(rbellevi): Docstring all the things. # TODO(rbellevi): File issue about indefinite blocking for server-side # streaming. -def _find_secret_of_length(target, ideal_distance, length, stop_event, maximum_hashes, interesting_hamming_distance=None): +def _find_secret_of_length(target, + ideal_distance, + length, + stop_event, + maximum_hashes, + interesting_hamming_distance=None): digits = [0] * length hashes_computed = 0 while True: @@ -100,15 +106,17 @@ def _find_secret_of_length(target, ideal_distance, length, stop_event, maximum_h distance = _get_substring_hamming_distance(hash, target) if interesting_hamming_distance is not None and distance <= interesting_hamming_distance: # Surface interesting candidates, but don't stop. - yield hash_name_pb2.HashNameResponse(secret=base64.b64encode(secret), - hashed_name=hash, - hamming_distance=distance), hashes_computed + yield hash_name_pb2.HashNameResponse( + secret=base64.b64encode(secret), + hashed_name=hash, + hamming_distance=distance), hashes_computed elif distance <= ideal_distance: # Yield the ideal candidate followed by a sentinel to signal the end # of the stream. - yield hash_name_pb2.HashNameResponse(secret=base64.b64encode(secret), - hashed_name=hash, - hamming_distance=distance), hashes_computed + yield hash_name_pb2.HashNameResponse( + secret=base64.b64encode(secret), + hashed_name=hash, + hamming_distance=distance), hashes_computed yield None, hashes_computed raise StopIteration() digits[-1] += 1 @@ -127,12 +135,22 @@ def _find_secret_of_length(target, ideal_distance, length, stop_event, maximum_h raise ResourceLimitExceededError() -def _find_secret(target, maximum_distance, stop_event, maximum_hashes, interesting_hamming_distance=None): +def _find_secret(target, + maximum_distance, + stop_event, + maximum_hashes, + interesting_hamming_distance=None): length = 1 total_hashes = 0 while True: last_hashes_computed = 0 - for candidate, hashes_computed in _find_secret_of_length(target, maximum_distance, length, stop_event, maximum_hashes - total_hashes, interesting_hamming_distance=interesting_hamming_distance): + for candidate, hashes_computed in _find_secret_of_length( + target, + maximum_distance, + length, + stop_event, + maximum_hashes - total_hashes, + interesting_hamming_distance=interesting_hamming_distance): last_hashes_computed = hashes_computed if candidate is not None: yield candidate @@ -153,12 +171,17 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): def Find(self, request, context): stop_event = threading.Event() + def on_rpc_done(): _LOGGER.debug("Attempting to regain servicer thread.") stop_event.set() + context.add_callback(on_rpc_done) try: - candidates = list(_find_secret(request.desired_name, request.ideal_hamming_distance, stop_event, self._maximum_hashes)) + candidates = list( + _find_secret(request.desired_name, + request.ideal_hamming_distance, stop_event, + self._maximum_hashes)) except ResourceLimitExceededError: _LOGGER.info("Cancelling RPC due to exhausted resources.") context.cancel() @@ -167,18 +190,20 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): return hash_name_pb2.HashNameResponse() return candidates[-1] - def FindRange(self, request, context): stop_event = threading.Event() + def on_rpc_done(): _LOGGER.debug("Attempting to regain servicer thread.") stop_event.set() + context.add_callback(on_rpc_done) - secret_generator = _find_secret(request.desired_name, - request.ideal_hamming_distance, - stop_event, - self._maximum_hashes, - interesting_hamming_distance=request.interesting_hamming_distance) + secret_generator = _find_secret( + request.desired_name, + request.ideal_hamming_distance, + stop_event, + self._maximum_hashes, + interesting_hamming_distance=request.interesting_hamming_distance) try: for candidate in secret_generator: yield candidate @@ -189,10 +214,10 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): def _run_server(port, maximum_hashes): - server = grpc.server(futures.ThreadPoolExecutor(max_workers=1), - maximum_concurrent_rpcs=1) + server = grpc.server( + futures.ThreadPoolExecutor(max_workers=1), maximum_concurrent_rpcs=1) hash_name_pb2_grpc.add_HashFinderServicer_to_server( - HashFinder(maximum_hashes), server) + HashFinder(maximum_hashes), server) address = '{}:{}'.format(_SERVER_HOST, port) server.add_insecure_port(address) server.start() From dc8dba8afeb527f8118d9aca11ad27a5493f1966 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 13:19:02 -0700 Subject: [PATCH 033/661] Add docstrings --- examples/python/cancellation/client.py | 2 - examples/python/cancellation/server.py | 61 +++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index 288f93d057e..c3bc226be2c 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -42,8 +42,6 @@ _LOGGER = logging.getLogger(__name__) _TIMEOUT_SECONDS = 0.05 -# TODO(rbellevi): Actually use the logger. - def run_unary_client(server_target, name, ideal_distance): with grpc.insecure_channel(server_target) as channel: diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 1af07e4a1e4..44b8ee26139 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -21,6 +21,7 @@ from concurrent import futures from collections import deque import argparse import base64 +import contextlib import logging import hashlib import struct @@ -82,7 +83,6 @@ class ResourceLimitExceededError(Exception): """Signifies the request has exceeded configured limits.""" -# TODO(rbellevi): Docstring all the things. # TODO(rbellevi): File issue about indefinite blocking for server-side # streaming. @@ -93,6 +93,28 @@ def _find_secret_of_length(target, stop_event, maximum_hashes, interesting_hamming_distance=None): + """Find a candidate with the given length. + + Args: + target: The search string. + ideal_distance: The desired Hamming distance. + length: The length of secret string to search for. + stop_event: An event indicating whether the RPC should terminate. + maximum_hashes: The maximum number of hashes to check before stopping. + interesting_hamming_distance: If specified, strings with a Hamming + distance from the target below this value will be yielded. + + Yields: + A stream of tuples of type Tuple[Optional[HashNameResponse], int]. The + element of the tuple, if specified, signifies an ideal or interesting + candidate. If this element is None, it signifies that the stream has + ended because an ideal candidate has been found. The second element is + the number of hashes computed up this point. + + Raises: + ResourceLimitExceededError: If the computation exceeds `maximum_hashes` + iterations. + """ digits = [0] * length hashes_computed = 0 while True: @@ -140,6 +162,29 @@ def _find_secret(target, stop_event, maximum_hashes, interesting_hamming_distance=None): + """Find candidate strings. + + Search through the space of all bytestrings, in order of increasing length, + indefinitely, until a hash with a Hamming distance of `maximum_distance` or + less has been found. + + Args: + target: The search string. + maximum_distance: The desired Hamming distance. + stop_event: An event indicating whether the RPC should terminate. + maximum_hashes: The maximum number of hashes to check before stopping. + interesting_hamming_distance: If specified, strings with a Hamming + distance from the target below this value will be yielded. + + Yields: + Instances of HashNameResponse. The final entry in the stream will be of + `maximum_distance` Hamming distance or less from the target string, + while all others will be of less than `interesting_hamming_distance`. + + Raises: + ResourceLimitExceededError: If the computation exceeds `maximum_hashes` + iterations. + """ length = 1 total_hashes = 0 while True: @@ -213,19 +258,21 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): _LOGGER.debug("Regained servicer thread.") -def _run_server(port, maximum_hashes): +@contextlib.contextmanager +def _running_server(port, maximum_hashes): server = grpc.server( futures.ThreadPoolExecutor(max_workers=1), maximum_concurrent_rpcs=1) hash_name_pb2_grpc.add_HashFinderServicer_to_server( HashFinder(maximum_hashes), server) address = '{}:{}'.format(_SERVER_HOST, port) - server.add_insecure_port(address) + actual_port = server.add_insecure_port(address) server.start() print("Server listening at '{}'".format(address)) try: - while True: - time.sleep(_ONE_DAY_IN_SECONDS) + yield actual_port except KeyboardInterrupt: + pass + finally: server.stop(None) @@ -244,7 +291,9 @@ def main(): nargs='?', help='The maximum number of hashes to search before cancelling.') args = parser.parse_args() - _run_server(args.port, args.maximum_hashes) + with _running_server(args.port, args.maximum_hashes): + while True: + time.sleep(_ONE_DAY_IN_SECONDS) if __name__ == "__main__": From 93d6344ac60ccb5bb6aec5f12be42c0ba581dcfc Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 13:25:54 -0700 Subject: [PATCH 034/661] Add todo --- examples/python/cancellation/client.py | 2 ++ examples/python/cancellation/server.py | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index c3bc226be2c..20b76784622 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -92,6 +92,8 @@ def run_streaming_client(server_target, name, ideal_distance, # Enqueue a sentinel to signal the end of the stream. result_queue.put(None) + # TODO(https://github.com/grpc/grpc/issues/19464): Do everything on the + # main thread. response_thread = threading.Thread( target=iterate_responses, args=(result_generator, result_queue)) response_thread.daemon = True diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 44b8ee26139..a316a7c2c60 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -83,10 +83,6 @@ class ResourceLimitExceededError(Exception): """Signifies the request has exceeded configured limits.""" -# TODO(rbellevi): File issue about indefinite blocking for server-side -# streaming. - - def _find_secret_of_length(target, ideal_distance, length, From 786a3acab0f37ce539f4ed5000f3dc388c35b0a5 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 14:20:07 -0700 Subject: [PATCH 035/661] Add test --- examples/python/cancellation/client.py | 10 ++- examples/python/cancellation/server.py | 1 + .../test/_cancellation_example_test.py | 87 +++++++++++++++++++ 3 files changed, 96 insertions(+), 2 deletions(-) diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index 20b76784622..0621a05d643 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -48,7 +48,8 @@ def run_unary_client(server_target, name, ideal_distance): stub = hash_name_pb2_grpc.HashFinderStub(channel) future = stub.Find.future( hash_name_pb2.HashNameRequest( - desired_name=name, ideal_hamming_distance=ideal_distance)) + desired_name=name, ideal_hamming_distance=ideal_distance), + wait_for_ready=True) def cancel_request(unused_signum, unused_frame): future.cancel() @@ -61,6 +62,10 @@ def run_unary_client(server_target, name, ideal_distance): continue except grpc.FutureCancelledError: break + except grpc.RpcError as rpc_error: + if rpc_error.code() == grpc.StatusCode.CANCELLED: + break + raise rpc_error print(result) break @@ -73,7 +78,8 @@ def run_streaming_client(server_target, name, ideal_distance, hash_name_pb2.HashNameRequest( desired_name=name, ideal_hamming_distance=ideal_distance, - interesting_hamming_distance=interesting_distance)) + interesting_hamming_distance=interesting_distance), + wait_for_ready=True) def cancel_request(unused_signum, unused_frame): result_generator.cancel() diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index a316a7c2c60..98634727aaa 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -218,6 +218,7 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): stop_event.set() context.add_callback(on_rpc_done) + candidates = [] try: candidates = list( _find_secret(request.desired_name, diff --git a/examples/python/cancellation/test/_cancellation_example_test.py b/examples/python/cancellation/test/_cancellation_example_test.py index e69de29bb2d..45b0ccb400a 100644 --- a/examples/python/cancellation/test/_cancellation_example_test.py +++ b/examples/python/cancellation/test/_cancellation_example_test.py @@ -0,0 +1,87 @@ +# Copyright 2019 the gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Test for cancellation example.""" + +import contextlib +import os +import signal +import socket +import subprocess +import unittest + +_BINARY_DIR = os.path.realpath( + os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +_SERVER_PATH = os.path.join(_BINARY_DIR, 'server') +_CLIENT_PATH = os.path.join(_BINARY_DIR, 'client') + + +@contextlib.contextmanager +def _get_port(): + sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) + if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 0: + raise RuntimeError("Failed to set SO_REUSEPORT.") + sock.bind(('', 0)) + try: + yield sock.getsockname()[1] + finally: + sock.close() + + +def _start_client(server_port, + desired_string, + ideal_distance, + interesting_distance=None): + interesting_distance_args = () if interesting_distance is None else ( + '--show-inferior', interesting_distance) + return subprocess.Popen((_CLIENT_PATH, desired_string, '--server', + 'localhost:{}'.format(server_port), + '--ideal-distance', + str(ideal_distance)) + interesting_distance_args) + + +class CancellationExampleTest(unittest.TestCase): + + def test_successful_run(self): + with _get_port() as test_port: + server_process = subprocess.Popen((_SERVER_PATH, '--port', + str(test_port))) + try: + client_process = _start_client(test_port, 'aa', 0) + client_return_code = client_process.wait() + self.assertEqual(0, client_return_code) + self.assertIsNone(server_process.poll()) + finally: + server_process.kill() + server_process.wait() + + def test_graceful_sigint(self): + with _get_port() as test_port: + server_process = subprocess.Popen((_SERVER_PATH, '--port', + str(test_port))) + try: + client_process1 = _start_client(test_port, 'aaaaaaaaaa', 0) + client_process1.send_signal(signal.SIGINT) + client_process1.wait() + client_process2 = _start_client(test_port, 'aaaaaaaaaa', 0) + client_return_code = client_process2.wait() + self.assertEqual(0, client_return_code) + self.assertIsNone(server_process.poll()) + finally: + server_process.kill() + server_process.wait() + + +if __name__ == '__main__': + unittest.main(verbosity=2) From edbddf25ab99c86f70c961d78e4f85a40aebc5a2 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 15:49:31 -0700 Subject: [PATCH 036/661] Typos --- examples/python/cancellation/README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/examples/python/cancellation/README.md b/examples/python/cancellation/README.md index d5f9a844fcc..57ea1a30850 100644 --- a/examples/python/cancellation/README.md +++ b/examples/python/cancellation/README.md @@ -1,18 +1,14 @@ -### Cancelling RPCs - -RPCs may be cancelled by both the client and the server. - #### The Example In the example, we implement a silly algorithm. We search for bytestrings whose hashes are similar to a given search string. For example, say we're looking for -the string "doctor". Our algorithm may `JrqhZVkTDoctYrUlXDbL6pfYQHU=` or +the string "doctor". Our algorithm may return `JrqhZVkTDoctYrUlXDbL6pfYQHU=` or `RC9/7mlM3ldy4TdoctOc6WzYbO4=`. This is a brute force algorithm, so the server -performing the search must be conscious the resources it allows to each client -and each client must be conscientious of the resources demanded of the server. +performing the search must be conscious of the resources it allows to each client +and each client must be conscientious of the resources it demands of the server. In particular, we ensure that client processes cancel the stream explicitly -before terminating and we ensure the server cancels RPCs that have gone on longer +before terminating and we ensure that server processes cancel RPCs that have gone on longer than a certain number of iterations. #### Cancellation on the Client Side From 81f42031c638cec53f72a78d17e3524ced4b9ee9 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 15:58:06 -0700 Subject: [PATCH 037/661] Pylint --- examples/python/cancellation/client.py | 3 --- examples/python/cancellation/server.py | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index 0621a05d643..9223e7c6ff4 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -17,11 +17,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from concurrent import futures import argparse -import datetime import logging -import time import signal import threading diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 98634727aaa..46e7b88ce51 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -18,7 +18,6 @@ from __future__ import division from __future__ import print_function from concurrent import futures -from collections import deque import argparse import base64 import contextlib @@ -64,7 +63,7 @@ def _get_substring_hamming_distance(candidate, target): The minimum Hamming distance between candidate and target. """ assert len(target) <= len(candidate) - assert len(candidate) != 0 + assert candidate min_distance = None for i in range(len(candidate) - len(target) + 1): distance = _get_hamming_distance(candidate[i:i + len(target)], target) @@ -118,25 +117,25 @@ def _find_secret_of_length(target, # Yield a sentinel and stop the generator if the RPC has been # cancelled. yield None, hashes_computed - raise StopIteration() + raise StopIteration() # pylint: disable=stop-iteration-return secret = b''.join(struct.pack('B', i) for i in digits) - hash = _get_hash(secret) - distance = _get_substring_hamming_distance(hash, target) + candidate_hash = _get_hash(secret) + distance = _get_substring_hamming_distance(candidate_hash, target) if interesting_hamming_distance is not None and distance <= interesting_hamming_distance: # Surface interesting candidates, but don't stop. yield hash_name_pb2.HashNameResponse( secret=base64.b64encode(secret), - hashed_name=hash, + hashed_name=candidate_hash, hamming_distance=distance), hashes_computed elif distance <= ideal_distance: # Yield the ideal candidate followed by a sentinel to signal the end # of the stream. yield hash_name_pb2.HashNameResponse( secret=base64.b64encode(secret), - hashed_name=hash, + hashed_name=candidate_hash, hamming_distance=distance), hashes_computed yield None, hashes_computed - raise StopIteration() + raise StopIteration() # pylint: disable=stop-iteration-return digits[-1] += 1 i = length - 1 while digits[i] == _BYTE_MAX + 1: @@ -145,7 +144,7 @@ def _find_secret_of_length(target, if i == -1: # Terminate the generator since we've run out of strings of # `length` bytes. - raise StopIteration() + raise StopIteration() # pylint: disable=stop-iteration-return else: digits[i] += 1 hashes_computed += 1 @@ -196,10 +195,10 @@ def _find_secret(target, if candidate is not None: yield candidate else: - raise StopIteration() + raise StopIteration() # pylint: disable=stop-iteration-return if stop_event.is_set(): # Terminate the generator if the RPC has been cancelled. - raise StopIteration() + raise StopIteration() # pylint: disable=stop-iteration-return total_hashes += last_hashes_computed length += 1 From fed1c629e06f15ed063a44edcb4ce7717bdec569 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 25 Jun 2019 16:07:49 -0700 Subject: [PATCH 038/661] Make compatible with Python 3 --- examples/python/cancellation/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 46e7b88ce51..767337ea3ea 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -75,7 +75,7 @@ def _get_substring_hamming_distance(candidate, target): def _get_hash(secret): hasher = hashlib.sha1() hasher.update(secret) - return base64.b64encode(hasher.digest()) + return base64.b64encode(hasher.digest()).decode('ascii') class ResourceLimitExceededError(Exception): From 2bf4d502c1943abb93e4349d36035fb1d574157c Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 26 Jun 2019 09:06:07 -0700 Subject: [PATCH 039/661] Factor out simpler generator --- examples/python/cancellation/server.py | 41 +++++++++++++++++--------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 767337ea3ea..cb69e249d12 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -82,6 +82,32 @@ class ResourceLimitExceededError(Exception): """Signifies the request has exceeded configured limits.""" +def _bytestrings_of_length(length): + """Generates a stream containing all bytestrings of a given length. + + Args: + length: A non-negative integer length. + + Yields: + All bytestrings of length `length`. + """ + digits = [0] * length + hashes_computed = 0 + while True: + yield b''.join(struct.pack('B', i) for i in digits) + digits[-1] += 1 + i = length - 1 + while digits[i] == _BYTE_MAX + 1: + digits[i] = 0 + i -= 1 + if i == -1: + # Terminate the generator since we've run out of strings of + # `length` bytes. + raise StopIteration() # pylint: disable=stop-iteration-return + else: + digits[i] += 1 + + def _find_secret_of_length(target, ideal_distance, length, @@ -110,15 +136,13 @@ def _find_secret_of_length(target, ResourceLimitExceededError: If the computation exceeds `maximum_hashes` iterations. """ - digits = [0] * length hashes_computed = 0 - while True: + for secret in _bytestrings_of_length(length): if stop_event.is_set(): # Yield a sentinel and stop the generator if the RPC has been # cancelled. yield None, hashes_computed raise StopIteration() # pylint: disable=stop-iteration-return - secret = b''.join(struct.pack('B', i) for i in digits) candidate_hash = _get_hash(secret) distance = _get_substring_hamming_distance(candidate_hash, target) if interesting_hamming_distance is not None and distance <= interesting_hamming_distance: @@ -136,17 +160,6 @@ def _find_secret_of_length(target, hamming_distance=distance), hashes_computed yield None, hashes_computed raise StopIteration() # pylint: disable=stop-iteration-return - digits[-1] += 1 - i = length - 1 - while digits[i] == _BYTE_MAX + 1: - digits[i] = 0 - i -= 1 - if i == -1: - # Terminate the generator since we've run out of strings of - # `length` bytes. - raise StopIteration() # pylint: disable=stop-iteration-return - else: - digits[i] += 1 hashes_computed += 1 if hashes_computed == maximum_hashes: raise ResourceLimitExceededError() From 42b2fe154a4f2320c38206705ba9a7e90739ddab Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 26 Jun 2019 09:21:29 -0700 Subject: [PATCH 040/661] Simplify search implementation --- examples/python/cancellation/server.py | 108 ++++++++----------------- 1 file changed, 33 insertions(+), 75 deletions(-) diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index cb69e249d12..5d72b003dc6 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -86,13 +86,12 @@ def _bytestrings_of_length(length): """Generates a stream containing all bytestrings of a given length. Args: - length: A non-negative integer length. + length: A positive integer length. Yields: All bytestrings of length `length`. """ digits = [0] * length - hashes_computed = 0 while True: yield b''.join(struct.pack('B', i) for i in digits) digits[-1] += 1 @@ -108,40 +107,52 @@ def _bytestrings_of_length(length): digits[i] += 1 -def _find_secret_of_length(target, - ideal_distance, - length, - stop_event, - maximum_hashes, - interesting_hamming_distance=None): - """Find a candidate with the given length. +def _all_bytestrings(): + """Generates a stream containing all possible bytestrings. + + This generator does not terminate. + + Yields: + All bytestrings in ascending order of length. + """ + length = 1 + while True: + for bytestring in _bytestrings_of_length(length): + yield bytestring + length += 1 + + +def _find_secret(target, + ideal_distance, + stop_event, + maximum_hashes, + interesting_hamming_distance=None): + """Find candidate strings. + + Search through the space of all bytestrings, in order of increasing length, + indefinitely, until a hash with a Hamming distance of `maximum_distance` or + less has been found. Args: target: The search string. ideal_distance: The desired Hamming distance. - length: The length of secret string to search for. stop_event: An event indicating whether the RPC should terminate. maximum_hashes: The maximum number of hashes to check before stopping. interesting_hamming_distance: If specified, strings with a Hamming distance from the target below this value will be yielded. Yields: - A stream of tuples of type Tuple[Optional[HashNameResponse], int]. The - element of the tuple, if specified, signifies an ideal or interesting - candidate. If this element is None, it signifies that the stream has - ended because an ideal candidate has been found. The second element is - the number of hashes computed up this point. + Instances of HashNameResponse. The final entry in the stream will be of + `maximum_distance` Hamming distance or less from the target string, + while all others will be of less than `interesting_hamming_distance`. Raises: ResourceLimitExceededError: If the computation exceeds `maximum_hashes` iterations. """ hashes_computed = 0 - for secret in _bytestrings_of_length(length): + for secret in _all_bytestrings(): if stop_event.is_set(): - # Yield a sentinel and stop the generator if the RPC has been - # cancelled. - yield None, hashes_computed raise StopIteration() # pylint: disable=stop-iteration-return candidate_hash = _get_hash(secret) distance = _get_substring_hamming_distance(candidate_hash, target) @@ -150,72 +161,19 @@ def _find_secret_of_length(target, yield hash_name_pb2.HashNameResponse( secret=base64.b64encode(secret), hashed_name=candidate_hash, - hamming_distance=distance), hashes_computed + hamming_distance=distance) elif distance <= ideal_distance: - # Yield the ideal candidate followed by a sentinel to signal the end - # of the stream. + # Yield ideal candidate and end the stream. yield hash_name_pb2.HashNameResponse( secret=base64.b64encode(secret), hashed_name=candidate_hash, - hamming_distance=distance), hashes_computed - yield None, hashes_computed + hamming_distance=distance) raise StopIteration() # pylint: disable=stop-iteration-return hashes_computed += 1 if hashes_computed == maximum_hashes: raise ResourceLimitExceededError() -def _find_secret(target, - maximum_distance, - stop_event, - maximum_hashes, - interesting_hamming_distance=None): - """Find candidate strings. - - Search through the space of all bytestrings, in order of increasing length, - indefinitely, until a hash with a Hamming distance of `maximum_distance` or - less has been found. - - Args: - target: The search string. - maximum_distance: The desired Hamming distance. - stop_event: An event indicating whether the RPC should terminate. - maximum_hashes: The maximum number of hashes to check before stopping. - interesting_hamming_distance: If specified, strings with a Hamming - distance from the target below this value will be yielded. - - Yields: - Instances of HashNameResponse. The final entry in the stream will be of - `maximum_distance` Hamming distance or less from the target string, - while all others will be of less than `interesting_hamming_distance`. - - Raises: - ResourceLimitExceededError: If the computation exceeds `maximum_hashes` - iterations. - """ - length = 1 - total_hashes = 0 - while True: - last_hashes_computed = 0 - for candidate, hashes_computed in _find_secret_of_length( - target, - maximum_distance, - length, - stop_event, - maximum_hashes - total_hashes, - interesting_hamming_distance=interesting_hamming_distance): - last_hashes_computed = hashes_computed - if candidate is not None: - yield candidate - else: - raise StopIteration() # pylint: disable=stop-iteration-return - if stop_event.is_set(): - # Terminate the generator if the RPC has been cancelled. - raise StopIteration() # pylint: disable=stop-iteration-return - total_hashes += last_hashes_computed - length += 1 - - class HashFinder(hash_name_pb2_grpc.HashFinderServicer): def __init__(self, maximum_hashes): From 7fa7f932e3debe33d38ecc25be7ae9f1dbf4fe98 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 26 Jun 2019 09:32:58 -0700 Subject: [PATCH 041/661] Pull search algorithm out into another module --- examples/python/cancellation/BUILD.bazel | 17 ++- examples/python/cancellation/search.py | 158 +++++++++++++++++++++++ examples/python/cancellation/server.py | 151 +--------------------- 3 files changed, 180 insertions(+), 146 deletions(-) create mode 100644 examples/python/cancellation/search.py diff --git a/examples/python/cancellation/BUILD.bazel b/examples/python/cancellation/BUILD.bazel index 30bede22f22..31bba1548fa 100644 --- a/examples/python/cancellation/BUILD.bazel +++ b/examples/python/cancellation/BUILD.bazel @@ -19,12 +19,14 @@ load("//bazel:python_rules.bzl", "py_proto_library") proto_library( name = "hash_name_proto", - srcs = ["hash_name.proto"] + srcs = ["hash_name.proto"], + testonly = 1, ) py_proto_library( name = "hash_name_proto_pb2", deps = [":hash_name_proto"], + testonly = 1, well_known_protos = False, ) @@ -39,13 +41,24 @@ py_binary( srcs_version = "PY2AND3", ) +py_library( + name = "search", + srcs = ["search.py"], + srcs_version = "PY2AND3", + deps = [ + ":hash_name_proto_pb2", + ], + testonly = 1, +) + py_binary( name = "server", testonly = 1, srcs = ["server.py"], deps = [ "//src/python/grpcio/grpc:grpcio", - ":hash_name_proto_pb2" + ":hash_name_proto_pb2", + ":search", ] + select({ "//conditions:default": [requirement("futures")], "//:python3": [], diff --git a/examples/python/cancellation/search.py b/examples/python/cancellation/search.py new file mode 100644 index 00000000000..95e479deffa --- /dev/null +++ b/examples/python/cancellation/search.py @@ -0,0 +1,158 @@ +# Copyright the 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""A search algorithm over the space of all bytestrings.""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import base64 +import hashlib +import logging +import struct + +from examples.python.cancellation import hash_name_pb2 + +_LOGGER = logging.getLogger(__name__) +_BYTE_MAX = 255 + + +def _get_hamming_distance(a, b): + """Calculates hamming distance between strings of equal length.""" + distance = 0 + for char_a, char_b in zip(a, b): + if char_a.lower() != char_b.lower(): + distance += 1 + return distance + + +def _get_substring_hamming_distance(candidate, target): + """Calculates the minimum hamming distance between between the target + and any substring of the candidate. + + Args: + candidate: The string whose substrings will be tested. + target: The target string. + + Returns: + The minimum Hamming distance between candidate and target. + """ + min_distance = None + for i in range(len(candidate) - len(target) + 1): + distance = _get_hamming_distance(candidate[i:i + len(target)], target) + if min_distance is None or distance < min_distance: + min_distance = distance + return min_distance + + +def _get_hash(secret): + hasher = hashlib.sha1() + hasher.update(secret) + return base64.b64encode(hasher.digest()).decode('ascii') + + +class ResourceLimitExceededError(Exception): + """Signifies the request has exceeded configured limits.""" + + +def _bytestrings_of_length(length): + """Generates a stream containing all bytestrings of a given length. + + Args: + length: A positive integer length. + + Yields: + All bytestrings of length `length`. + """ + digits = [0] * length + while True: + yield b''.join(struct.pack('B', i) for i in digits) + digits[-1] += 1 + i = length - 1 + while digits[i] == _BYTE_MAX + 1: + digits[i] = 0 + i -= 1 + if i == -1: + # Terminate the generator since we've run out of strings of + # `length` bytes. + raise StopIteration() # pylint: disable=stop-iteration-return + else: + digits[i] += 1 + + +def _all_bytestrings(): + """Generates a stream containing all possible bytestrings. + + This generator does not terminate. + + Yields: + All bytestrings in ascending order of length. + """ + length = 1 + while True: + for bytestring in _bytestrings_of_length(length): + yield bytestring + length += 1 + + +def search(target, + ideal_distance, + stop_event, + maximum_hashes, + interesting_hamming_distance=None): + """Find candidate strings. + + Search through the space of all bytestrings, in order of increasing length, + indefinitely, until a hash with a Hamming distance of `maximum_distance` or + less has been found. + + Args: + target: The search string. + ideal_distance: The desired Hamming distance. + stop_event: An event indicating whether the RPC should terminate. + maximum_hashes: The maximum number of hashes to check before stopping. + interesting_hamming_distance: If specified, strings with a Hamming + distance from the target below this value will be yielded. + + Yields: + Instances of HashNameResponse. The final entry in the stream will be of + `maximum_distance` Hamming distance or less from the target string, + while all others will be of less than `interesting_hamming_distance`. + + Raises: + ResourceLimitExceededError: If the computation exceeds `maximum_hashes` + iterations. + """ + hashes_computed = 0 + for secret in _all_bytestrings(): + if stop_event.is_set(): + raise StopIteration() # pylint: disable=stop-iteration-return + candidate_hash = _get_hash(secret) + distance = _get_substring_hamming_distance(candidate_hash, target) + if interesting_hamming_distance is not None and distance <= interesting_hamming_distance: + # Surface interesting candidates, but don't stop. + yield hash_name_pb2.HashNameResponse( + secret=base64.b64encode(secret), + hashed_name=candidate_hash, + hamming_distance=distance) + elif distance <= ideal_distance: + # Yield ideal candidate and end the stream. + yield hash_name_pb2.HashNameResponse( + secret=base64.b64encode(secret), + hashed_name=candidate_hash, + hamming_distance=distance) + raise StopIteration() # pylint: disable=stop-iteration-return + hashes_computed += 1 + if hashes_computed == maximum_hashes: + raise ResourceLimitExceededError() diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 5d72b003dc6..2c715565031 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -19,21 +19,17 @@ from __future__ import print_function from concurrent import futures import argparse -import base64 import contextlib import logging -import hashlib -import struct import time import threading import grpc +import search from examples.python.cancellation import hash_name_pb2 from examples.python.cancellation import hash_name_pb2_grpc -_BYTE_MAX = 255 - _LOGGER = logging.getLogger(__name__) _SERVER_HOST = 'localhost' _ONE_DAY_IN_SECONDS = 60 * 60 * 24 @@ -41,139 +37,6 @@ _ONE_DAY_IN_SECONDS = 60 * 60 * 24 _DESCRIPTION = "A server for finding hashes similar to names." -def _get_hamming_distance(a, b): - """Calculates hamming distance between strings of equal length.""" - assert len(a) == len(b), "'{}', '{}'".format(a, b) - distance = 0 - for char_a, char_b in zip(a, b): - if char_a.lower() != char_b.lower(): - distance += 1 - return distance - - -def _get_substring_hamming_distance(candidate, target): - """Calculates the minimum hamming distance between between the target - and any substring of the candidate. - - Args: - candidate: The string whose substrings will be tested. - target: The target string. - - Returns: - The minimum Hamming distance between candidate and target. - """ - assert len(target) <= len(candidate) - assert candidate - min_distance = None - for i in range(len(candidate) - len(target) + 1): - distance = _get_hamming_distance(candidate[i:i + len(target)], target) - if min_distance is None or distance < min_distance: - min_distance = distance - return min_distance - - -def _get_hash(secret): - hasher = hashlib.sha1() - hasher.update(secret) - return base64.b64encode(hasher.digest()).decode('ascii') - - -class ResourceLimitExceededError(Exception): - """Signifies the request has exceeded configured limits.""" - - -def _bytestrings_of_length(length): - """Generates a stream containing all bytestrings of a given length. - - Args: - length: A positive integer length. - - Yields: - All bytestrings of length `length`. - """ - digits = [0] * length - while True: - yield b''.join(struct.pack('B', i) for i in digits) - digits[-1] += 1 - i = length - 1 - while digits[i] == _BYTE_MAX + 1: - digits[i] = 0 - i -= 1 - if i == -1: - # Terminate the generator since we've run out of strings of - # `length` bytes. - raise StopIteration() # pylint: disable=stop-iteration-return - else: - digits[i] += 1 - - -def _all_bytestrings(): - """Generates a stream containing all possible bytestrings. - - This generator does not terminate. - - Yields: - All bytestrings in ascending order of length. - """ - length = 1 - while True: - for bytestring in _bytestrings_of_length(length): - yield bytestring - length += 1 - - -def _find_secret(target, - ideal_distance, - stop_event, - maximum_hashes, - interesting_hamming_distance=None): - """Find candidate strings. - - Search through the space of all bytestrings, in order of increasing length, - indefinitely, until a hash with a Hamming distance of `maximum_distance` or - less has been found. - - Args: - target: The search string. - ideal_distance: The desired Hamming distance. - stop_event: An event indicating whether the RPC should terminate. - maximum_hashes: The maximum number of hashes to check before stopping. - interesting_hamming_distance: If specified, strings with a Hamming - distance from the target below this value will be yielded. - - Yields: - Instances of HashNameResponse. The final entry in the stream will be of - `maximum_distance` Hamming distance or less from the target string, - while all others will be of less than `interesting_hamming_distance`. - - Raises: - ResourceLimitExceededError: If the computation exceeds `maximum_hashes` - iterations. - """ - hashes_computed = 0 - for secret in _all_bytestrings(): - if stop_event.is_set(): - raise StopIteration() # pylint: disable=stop-iteration-return - candidate_hash = _get_hash(secret) - distance = _get_substring_hamming_distance(candidate_hash, target) - if interesting_hamming_distance is not None and distance <= interesting_hamming_distance: - # Surface interesting candidates, but don't stop. - yield hash_name_pb2.HashNameResponse( - secret=base64.b64encode(secret), - hashed_name=candidate_hash, - hamming_distance=distance) - elif distance <= ideal_distance: - # Yield ideal candidate and end the stream. - yield hash_name_pb2.HashNameResponse( - secret=base64.b64encode(secret), - hashed_name=candidate_hash, - hamming_distance=distance) - raise StopIteration() # pylint: disable=stop-iteration-return - hashes_computed += 1 - if hashes_computed == maximum_hashes: - raise ResourceLimitExceededError() - - class HashFinder(hash_name_pb2_grpc.HashFinderServicer): def __init__(self, maximum_hashes): @@ -191,10 +54,10 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): candidates = [] try: candidates = list( - _find_secret(request.desired_name, - request.ideal_hamming_distance, stop_event, - self._maximum_hashes)) - except ResourceLimitExceededError: + search.search(request.desired_name, + request.ideal_hamming_distance, stop_event, + self._maximum_hashes)) + except search.ResourceLimitExceededError: _LOGGER.info("Cancelling RPC due to exhausted resources.") context.cancel() _LOGGER.debug("Servicer thread returning.") @@ -210,7 +73,7 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): stop_event.set() context.add_callback(on_rpc_done) - secret_generator = _find_secret( + secret_generator = search.search( request.desired_name, request.ideal_hamming_distance, stop_event, @@ -219,7 +82,7 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): try: for candidate in secret_generator: yield candidate - except ResourceLimitExceededError: + except search.ResourceLimitExceededError: _LOGGER.info("Cancelling RPC due to exhausted resources.") context.cancel() _LOGGER.debug("Regained servicer thread.") From 4100084c78cec4b5d7b5fe3e1b4b517523b45cb2 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 26 Jun 2019 09:37:33 -0700 Subject: [PATCH 042/661] Use six for compatibility in client --- examples/python/cancellation/BUILD.bazel | 1 + examples/python/cancellation/client.py | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/python/cancellation/BUILD.bazel b/examples/python/cancellation/BUILD.bazel index 31bba1548fa..62bc7b2fa46 100644 --- a/examples/python/cancellation/BUILD.bazel +++ b/examples/python/cancellation/BUILD.bazel @@ -37,6 +37,7 @@ py_binary( deps = [ "//src/python/grpcio/grpc:grpcio", ":hash_name_proto_pb2", + requirement("six"), ], srcs_version = "PY2AND3", ) diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index 9223e7c6ff4..2661efc196f 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -20,14 +20,11 @@ from __future__ import print_function import argparse import logging import signal +import six import threading -try: - from queue import Queue - from queue import Empty as QueueEmpty -except ImportError: - from Queue import Queue - from Queue import Empty as QueueEmpty +from six.moves.queue import Queue +from six.moves.queue import Empty as QueueEmpty import grpc From 7486026eb97671f55a6320012d55222cfe3ffcf0 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 26 Jun 2019 09:42:55 -0700 Subject: [PATCH 043/661] Annotate the proto file --- examples/python/cancellation/hash_name.proto | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/examples/python/cancellation/hash_name.proto b/examples/python/cancellation/hash_name.proto index e0a5c8357be..7b4e47e056f 100644 --- a/examples/python/cancellation/hash_name.proto +++ b/examples/python/cancellation/hash_name.proto @@ -16,19 +16,41 @@ syntax = "proto3"; package hash_name; +// A request for a single secret whose hash is similar to a desired name. message HashNameRequest { + // The string that is desired in the secret's hash. string desired_name = 1; + + // The ideal Hamming distance betwen desired_name and the secret that will + // be searched for. int32 ideal_hamming_distance = 2; + + // A Hamming distance greater than the ideal Hamming distance. Search results + // with a Hamming distance less than this value but greater than the ideal + // distance will be returned back to the client but will not terminate the + // search. int32 interesting_hamming_distance = 3; } message HashNameResponse { + // The search result. string secret = 1; + + // The hash of the search result. A substring of this is of + // ideal_hamming_distance Hamming distance or less from desired_name. string hashed_name = 2; + + // The Hamming distance between hashed_name and desired_name. int32 hamming_distance = 3; } service HashFinder { + + // Search for a single string whose hash is similar to the specified + // desired_name. interesting_hamming_distance is ignored. rpc Find (HashNameRequest) returns (HashNameResponse) {} + + // Search for a string whose hash is similar to the specified desired_name, + // but also stream back less-than-ideal candidates. rpc FindRange (HashNameRequest) returns (stream HashNameResponse) {} } From 25f3439c910e0168b4dbe776b77526eed84f5213 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 26 Jun 2019 09:45:47 -0700 Subject: [PATCH 044/661] Make whole package testonly --- examples/python/cancellation/BUILD.bazel | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/python/cancellation/BUILD.bazel b/examples/python/cancellation/BUILD.bazel index 62bc7b2fa46..81cd3a881b8 100644 --- a/examples/python/cancellation/BUILD.bazel +++ b/examples/python/cancellation/BUILD.bazel @@ -17,22 +17,21 @@ load("@grpc_python_dependencies//:requirements.bzl", "requirement") load("//bazel:python_rules.bzl", "py_proto_library") +package(default_testonly = 1) + proto_library( name = "hash_name_proto", srcs = ["hash_name.proto"], - testonly = 1, ) py_proto_library( name = "hash_name_proto_pb2", deps = [":hash_name_proto"], - testonly = 1, well_known_protos = False, ) py_binary( name = "client", - testonly = 1, srcs = ["client.py"], deps = [ "//src/python/grpcio/grpc:grpcio", @@ -49,12 +48,10 @@ py_library( deps = [ ":hash_name_proto_pb2", ], - testonly = 1, ) py_binary( name = "server", - testonly = 1, srcs = ["server.py"], deps = [ "//src/python/grpcio/grpc:grpcio", From 1db141acccf91be59e46b584a0d1b883bf686ab9 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 26 Jun 2019 09:51:44 -0700 Subject: [PATCH 045/661] Change section title --- examples/python/cancellation/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/python/cancellation/README.md b/examples/python/cancellation/README.md index 57ea1a30850..ed85fbe53cb 100644 --- a/examples/python/cancellation/README.md +++ b/examples/python/cancellation/README.md @@ -1,4 +1,4 @@ -#### The Example +### Cancellation In the example, we implement a silly algorithm. We search for bytestrings whose hashes are similar to a given search string. For example, say we're looking for From 915e97b115cf5d339af2f6a1b5255f61de1b89c3 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 26 Jun 2019 13:16:02 -0700 Subject: [PATCH 046/661] Fix main thread starvation issues --- examples/python/cancellation/README.md | 74 +++---------------- examples/python/cancellation/client.py | 49 ++---------- examples/python/cancellation/server.py | 2 +- .../test/_cancellation_example_test.py | 2 +- 4 files changed, 20 insertions(+), 107 deletions(-) diff --git a/examples/python/cancellation/README.md b/examples/python/cancellation/README.md index ed85fbe53cb..26ef61c329f 100644 --- a/examples/python/cancellation/README.md +++ b/examples/python/cancellation/README.md @@ -40,30 +40,16 @@ stub = hash_name_pb2_grpc.HashFinderStub(channel) future = stub.Find.future(hash_name_pb2.HashNameRequest(desired_name=name)) def cancel_request(unused_signum, unused_frame): future.cancel() + sys.exit(0) signal.signal(signal.SIGINT, cancel_request) -``` - -It's also important that you not block indefinitely on the RPC. Otherwise, the -signal handler will never have a chance to run. -```python -while True: - try: - result = future.result(timeout=_TIMEOUT_SECONDS) - except grpc.FutureTimeoutError: - continue - except grpc.FutureCancelledError: - break - print("Got response: \n{}".format(result)) - break +result = future.result() +print(result) ``` -Here, we repeatedly block on a result for up to `_TIMEOUT_SECONDS`. Doing so -gives the signal handlers a chance to run. In the case that our timeout -was reached, we simply continue on in the loop. In the case that the RPC was -cancelled (by our user's ctrl+c), we break out of the loop cleanly. Finally, if -we received the result of the RPC, we print it out for the user and exit the -loop. +We also call `sys.exit(0)` to terminate the process. If we do not do this, then +`future.result()` with throw an `RpcError`. Alternatively, you may catch this +exception. ##### Cancelling a Server-Side Streaming RPC from the Client @@ -78,53 +64,15 @@ stub = hash_name_pb2_grpc.HashFinderStub(channel) result_generator = stub.FindRange(hash_name_pb2.HashNameRequest(desired_name=name)) def cancel_request(unused_signum, unused_frame): result_generator.cancel() + sys.exit(0) signal.signal(signal.SIGINT, cancel_request) +for result in result_generator: + print(result) ``` -However, the streaming case is complicated by the fact that there is no way to -propagate a timeout to Python generators. As a result, simply iterating over the -results of the RPC can block indefinitely and the signal handler may never run. -Instead, we iterate over the generator on another thread and retrieve the -results on the main thread with a synchronized `Queue`. - -```python -result_queue = Queue() -def iterate_responses(result_generator, result_queue): - try: - for result in result_generator: - result_queue.put(result) - except grpc.RpcError as rpc_error: - if rpc_error.code() != grpc.StatusCode.CANCELLED: - result_queue.put(None) - raise rpc_error - result_queue.put(None) - print("RPC complete") -response_thread = threading.Thread(target=iterate_responses, args=(result_generator, result_queue)) -response_thread.daemon = True -response_thread.start() -``` - -While this thread iterating over the results may block indefinitely, we can -structure the code running on our main thread in such a way that signal handlers -are guaranteed to be run at least every `_TIMEOUT_SECONDS` seconds. - -```python -while result_generator.running(): - try: - result = result_queue.get(timeout=_TIMEOUT_SECONDS) - except QueueEmpty: - continue - if result is None: - break - print("Got result: {}".format(result)) -``` - -Similarly to the unary example above, we continue in a loop waiting for results, -taking care to block for intervals of `_TIMEOUT_SECONDS` at the longest. -Finally, we use `None` as a sentinel value to signal the end of the stream. +We also call `sys.exit(0)` here to terminate the process. Alternatively, you may +catch the `RpcError` raised by the for loop upon cancellation. -Using this scheme, our process responds nicely to `SIGINT`s while also -explicitly cancelling its RPCs. #### Cancellation on the Server Side diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index 2661efc196f..491dffa170b 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -27,6 +27,8 @@ from six.moves.queue import Queue from six.moves.queue import Empty as QueueEmpty import grpc +import os +import sys from examples.python.cancellation import hash_name_pb2 from examples.python.cancellation import hash_name_pb2_grpc @@ -34,8 +36,6 @@ from examples.python.cancellation import hash_name_pb2_grpc _DESCRIPTION = "A client for finding hashes similar to names." _LOGGER = logging.getLogger(__name__) -_TIMEOUT_SECONDS = 0.05 - def run_unary_client(server_target, name, ideal_distance): with grpc.insecure_channel(server_target) as channel: @@ -47,21 +47,11 @@ def run_unary_client(server_target, name, ideal_distance): def cancel_request(unused_signum, unused_frame): future.cancel() + sys.exit(0) signal.signal(signal.SIGINT, cancel_request) - while True: - try: - result = future.result(timeout=_TIMEOUT_SECONDS) - except grpc.FutureTimeoutError: - continue - except grpc.FutureCancelledError: - break - except grpc.RpcError as rpc_error: - if rpc_error.code() == grpc.StatusCode.CANCELLED: - break - raise rpc_error - print(result) - break + result = future.result() + print(result) def run_streaming_client(server_target, name, ideal_distance, @@ -77,35 +67,10 @@ def run_streaming_client(server_target, name, ideal_distance, def cancel_request(unused_signum, unused_frame): result_generator.cancel() + sys.exit(0) signal.signal(signal.SIGINT, cancel_request) - result_queue = Queue() - - def iterate_responses(result_generator, result_queue): - try: - for result in result_generator: - result_queue.put(result) - except grpc.RpcError as rpc_error: - if rpc_error.code() != grpc.StatusCode.CANCELLED: - result_queue.put(None) - raise rpc_error - # Enqueue a sentinel to signal the end of the stream. - result_queue.put(None) - - # TODO(https://github.com/grpc/grpc/issues/19464): Do everything on the - # main thread. - response_thread = threading.Thread( - target=iterate_responses, args=(result_generator, result_queue)) - response_thread.daemon = True - response_thread.start() - - while result_generator.running(): - try: - result = result_queue.get(timeout=_TIMEOUT_SECONDS) - except QueueEmpty: - continue - if result is None: - break + for result in result_generator: print(result) diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 2c715565031..25ce494ee39 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -117,7 +117,7 @@ def main(): parser.add_argument( '--maximum-hashes', type=int, - default=10000, + default=1000000, nargs='?', help='The maximum number of hashes to search before cancelling.') args = parser.parse_args() diff --git a/examples/python/cancellation/test/_cancellation_example_test.py b/examples/python/cancellation/test/_cancellation_example_test.py index 45b0ccb400a..2301cc63c67 100644 --- a/examples/python/cancellation/test/_cancellation_example_test.py +++ b/examples/python/cancellation/test/_cancellation_example_test.py @@ -74,7 +74,7 @@ class CancellationExampleTest(unittest.TestCase): client_process1 = _start_client(test_port, 'aaaaaaaaaa', 0) client_process1.send_signal(signal.SIGINT) client_process1.wait() - client_process2 = _start_client(test_port, 'aaaaaaaaaa', 0) + client_process2 = _start_client(test_port, 'aa', 0) client_return_code = client_process2.wait() self.assertEqual(0, client_return_code) self.assertIsNone(server_process.poll()) From a40dd958be9ae762828a7862b59a7ef63691c7d5 Mon Sep 17 00:00:00 2001 From: Pau Freixes Date: Sat, 29 Jun 2019 16:56:44 +0200 Subject: [PATCH 047/661] Fix watcher connectivity dead lock Call the `grpc_cq_end_op` once the watcher connectivity mutex has been released, otherwise when using a completion queue of callback type a dead lock will occur. --- .../client_channel/channel_connectivity.cc | 18 ++++- test/core/end2end/tests/connectivity.cc | 75 +++++++++++++++++++ 2 files changed, 91 insertions(+), 2 deletions(-) diff --git a/src/core/ext/filters/client_channel/channel_connectivity.cc b/src/core/ext/filters/client_channel/channel_connectivity.cc index 232183d61ff..58170e66f96 100644 --- a/src/core/ext/filters/client_channel/channel_connectivity.cc +++ b/src/core/ext/filters/client_channel/channel_connectivity.cc @@ -111,6 +111,12 @@ static void finished_completion(void* pw, grpc_cq_completion* ignored) { static void partly_done(state_watcher* w, bool due_to_completion, grpc_error* error) { + bool end_op = false; + void* end_op_tag = nullptr; + grpc_error* end_op_error = nullptr; + grpc_completion_queue* end_op_cq = nullptr; + grpc_cq_completion* end_op_completion_storage = nullptr; + if (due_to_completion) { grpc_timer_cancel(&w->alarm); } else { @@ -152,8 +158,11 @@ static void partly_done(state_watcher* w, bool due_to_completion, w->error = error; } w->phase = CALLING_BACK_AND_FINISHED; - grpc_cq_end_op(w->cq, w->tag, w->error, finished_completion, w, - &w->completion_storage); + end_op = true; + end_op_cq = w->cq; + end_op_tag = w->tag; + end_op_error = w->error; + end_op_completion_storage = &w->completion_storage; break; case CALLING_BACK_AND_FINISHED: GPR_UNREACHABLE_CODE(return ); @@ -161,6 +170,11 @@ static void partly_done(state_watcher* w, bool due_to_completion, } gpr_mu_unlock(&w->mu); + if (end_op) { + grpc_cq_end_op(end_op_cq, end_op_tag, end_op_error, finished_completion, w, + end_op_completion_storage); + } + GRPC_ERROR_UNREF(error); } diff --git a/test/core/end2end/tests/connectivity.cc b/test/core/end2end/tests/connectivity.cc index caa4265aa2c..5511e55ccc7 100644 --- a/test/core/end2end/tests/connectivity.cc +++ b/test/core/end2end/tests/connectivity.cc @@ -33,6 +33,16 @@ typedef struct { grpc_completion_queue* cq; } child_events; +struct CallbackContext { + grpc_experimental_completion_queue_functor functor; + gpr_event finished; + explicit CallbackContext(void (*cb)( + grpc_experimental_completion_queue_functor* functor, int success)) { + functor.functor_run = cb; + gpr_event_init(&finished); + } +}; + static void child_thread(void* arg) { child_events* ce = static_cast(arg); grpc_event ev; @@ -163,9 +173,74 @@ static void test_connectivity(grpc_end2end_test_config config) { cq_verifier_destroy(cqv); } +static void cb_watch_connectivity( + grpc_experimental_completion_queue_functor* functor, int success) { + CallbackContext* cb_ctx = (CallbackContext*)functor; + + gpr_log(GPR_DEBUG, "cb_watch_connectivity called, verifying"); + + /* callback must not have errors */ + GPR_ASSERT(success != 0); + + gpr_event_set(&cb_ctx->finished, (void*)1); +} + +static void cb_shutdown(grpc_experimental_completion_queue_functor* functor, + int success) { + CallbackContext* cb_ctx = (CallbackContext*)functor; + + gpr_log(GPR_DEBUG, "cb_shutdown called, nothing to do"); + gpr_event_set(&cb_ctx->finished, (void*)1); +} + +static void test_watch_connectivity_cq_callback( + grpc_end2end_test_config config) { + CallbackContext cb_ctx(cb_watch_connectivity); + CallbackContext cb_shutdown_ctx(cb_shutdown); + grpc_completion_queue* cq; + grpc_end2end_test_fixture f = config.create_fixture(nullptr, nullptr); + + config.init_client(&f, nullptr); + + /* start connecting */ + grpc_channel_check_connectivity_state(f.client, 1); + + /* create the cq callback */ + cq = grpc_completion_queue_create_for_callback(&cb_shutdown_ctx.functor, + nullptr); + + /* start watching for any change, cb is immediately called + * and no dead lock should be raised */ + grpc_channel_watch_connectivity_state(f.client, GRPC_CHANNEL_IDLE, + grpc_timeout_seconds_to_deadline(3), cq, + &cb_ctx.functor); + + /* we just check that the callback was executed once notifying a connection + * transition */ + GPR_ASSERT(gpr_event_wait(&cb_ctx.finished, + gpr_inf_future(GPR_CLOCK_MONOTONIC)) != nullptr); + + /* shutdown, since shutdown cb might be executed in a background thread + * we actively wait till is executed. */ + grpc_completion_queue_shutdown(cq); + gpr_event_wait(&cb_shutdown_ctx.finished, + gpr_inf_future(GPR_CLOCK_MONOTONIC)); + + /* cleanup */ + grpc_channel_destroy(f.client); + grpc_completion_queue_destroy(cq); + + /* shutdown_cq and cq are not used in this test */ + grpc_completion_queue_destroy(f.cq); + grpc_completion_queue_destroy(f.shutdown_cq); + + config.tear_down_data(&f); +} + void connectivity(grpc_end2end_test_config config) { GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION); test_connectivity(config); + test_watch_connectivity_cq_callback(config); } void connectivity_pre_init(void) {} From 1e46a3ab627d9408a02efd5ce63e8e0a5e791977 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 2 Jul 2019 10:15:56 -0700 Subject: [PATCH 048/661] Bump version to v1.22.0 --- BUILD | 2 +- build.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILD b/BUILD index 0ca0d9b7fd8..f08703a2752 100644 --- a/BUILD +++ b/BUILD @@ -78,7 +78,7 @@ g_stands_for = "gale" core_version = "7.0.0" -version = "1.22.0-pre1" +version = "1.22.0" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/build.yaml b/build.yaml index cce7d1bbe5c..d04ffcf3389 100644 --- a/build.yaml +++ b/build.yaml @@ -14,7 +14,7 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 7.0.0 g_stands_for: gale - version: 1.22.0-pre1 + version: 1.22.0 filegroups: - name: alts_proto headers: From 1399d06276a31a7275d52d082a8d25e045aca4db Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 2 Jul 2019 10:16:36 -0700 Subject: [PATCH 049/661] Regenerate projects --- CMakeLists.txt | 2 +- Makefile | 4 ++-- gRPC-C++.podspec | 6 +++--- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.xml | 8 ++++---- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core.Api/VersionInfo.cs | 2 +- src/csharp/build/dependencies.props | 2 +- src/csharp/build_unitypackage.bat | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/objective-c/tests/version.h | 2 +- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_channelz/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_status/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 29 files changed, 35 insertions(+), 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b449e353a9a..5b330d443c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.22.0-pre1") +set(PACKAGE_VERSION "1.22.0") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 0b1a9259d91..d80d72b7d9f 100644 --- a/Makefile +++ b/Makefile @@ -460,8 +460,8 @@ Q = @ endif CORE_VERSION = 7.0.0 -CPP_VERSION = 1.22.0-pre1 -CSHARP_VERSION = 1.22.0-pre1 +CPP_VERSION = 1.22.0 +CSHARP_VERSION = 1.22.0 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 4cdf65fcc99..65c4ec5159b 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -23,15 +23,15 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - # version = '1.22.0-pre1' - version = '0.0.9-pre1' + # version = '1.22.0' + version = '0.0.9' s.version = version s.summary = 'gRPC C++ library' s.homepage = 'https://grpc.io' s.license = 'Apache License, Version 2.0' s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - grpc_version = '1.22.0-pre1' + grpc_version = '1.22.0' s.source = { :git => 'https://github.com/grpc/grpc.git', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index a40c9511fd2..c7ffda130de 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.22.0-pre1' + version = '1.22.0' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 00609603438..2ebcf2d2fd3 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.22.0-pre1' + version = '1.22.0' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index b3423e97791..cc4d710a4dd 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.22.0-pre1' + version = '1.22.0' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 7b13447ff3f..4f6e823b05a 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.22.0-pre1' + version = '1.22.0' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.xml b/package.xml index 01ed99d0f91..0314e8982bc 100644 --- a/package.xml +++ b/package.xml @@ -13,12 +13,12 @@ 2018-01-19 - 1.22.0RC1 - 1.22.0RC1 + 1.22.0 + 1.22.0 - beta - beta + stable + stable Apache 2.0 diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index ebd4f7ef023..c04c12b1728 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.22.0-pre1"; } +grpc::string Version() { return "1.22.0"; } } // namespace grpc diff --git a/src/csharp/Grpc.Core.Api/VersionInfo.cs b/src/csharp/Grpc.Core.Api/VersionInfo.cs index a9b73c24c27..40ad442402c 100644 --- a/src/csharp/Grpc.Core.Api/VersionInfo.cs +++ b/src/csharp/Grpc.Core.Api/VersionInfo.cs @@ -38,6 +38,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.22.0-pre1"; + public const string CurrentVersion = "1.22.0"; } } diff --git a/src/csharp/build/dependencies.props b/src/csharp/build/dependencies.props index 662ac407713..62b8685eecb 100644 --- a/src/csharp/build/dependencies.props +++ b/src/csharp/build/dependencies.props @@ -1,7 +1,7 @@ - 1.22.0-pre1 + 1.22.0 3.7.0 diff --git a/src/csharp/build_unitypackage.bat b/src/csharp/build_unitypackage.bat index b2f855e10e7..8c58c2fff7c 100644 --- a/src/csharp/build_unitypackage.bat +++ b/src/csharp/build_unitypackage.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.22.0-pre1 +set VERSION=1.22.0 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 2769bb3e4e3..c4e9c23d20f 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.22.0-pre1' + v = '1.22.0' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index 05829ac102c..a162f1b1292 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.22.0-pre1" +#define GRPC_OBJC_VERSION_STRING @"1.22.0" diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index 68ea0849659..37db5da9560 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -22,5 +22,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.22.0-pre1" +#define GRPC_OBJC_VERSION_STRING @"1.22.0" #define GRPC_C_VERSION_STRING @"7.0.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 4ebb30d2ff5..d4e0bbcc385 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.22.0RC1" +#define PHP_GRPC_VERSION "1.22.0" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index fa594107fec..b76cdd33908 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.22.0rc1""" +__version__ = """1.22.0""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index e878336b40c..7c5eca53ed9 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.22.0rc1' +VERSION = '1.22.0' diff --git a/src/python/grpcio_channelz/grpc_version.py b/src/python/grpcio_channelz/grpc_version.py index edd2b36e5d3..29ee7f8aaa5 100644 --- a/src/python/grpcio_channelz/grpc_version.py +++ b/src/python/grpcio_channelz/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/grpc_version.py.template`!!! -VERSION = '1.22.0rc1' +VERSION = '1.22.0' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 44b59737fd9..8bae17b37fa 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.22.0rc1' +VERSION = '1.22.0' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 02fc7b80423..d1e46f67036 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.22.0rc1' +VERSION = '1.22.0' diff --git a/src/python/grpcio_status/grpc_version.py b/src/python/grpcio_status/grpc_version.py index 0b70be2fd4b..583b2d9c920 100644 --- a/src/python/grpcio_status/grpc_version.py +++ b/src/python/grpcio_status/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_status/grpc_version.py.template`!!! -VERSION = '1.22.0rc1' +VERSION = '1.22.0' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index 21c75d294e8..c8ff0b0a77a 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.22.0rc1' +VERSION = '1.22.0' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index 2bb40b514a6..2edf51569f8 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.22.0rc1' +VERSION = '1.22.0' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 5e6d6de685a..c80fb62961a 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.22.0.pre1' + VERSION = '1.22.0' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index e86c6330a70..f6c3dfaa05d 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.22.0.pre1' + VERSION = '1.22.0' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index 810493f00da..69c53da15cf 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION = '1.22.0rc1' +VERSION = '1.22.0' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 2de0dbb9af7..f43cff4de0b 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.22.0-pre1 +PROJECT_NUMBER = 1.22.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index ba8a287104a..29c7901c48c 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.22.0-pre1 +PROJECT_NUMBER = 1.22.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From ba39c9255c0b3cc4335d0377da5f53b297804a40 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 8 Jul 2019 10:00:36 -0700 Subject: [PATCH 050/661] Adopt reviewer's comments --- examples/python/cancellation/search.py | 30 +++++++++----------------- examples/python/cancellation/server.py | 3 +++ 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/examples/python/cancellation/search.py b/examples/python/cancellation/search.py index 95e479deffa..8c41baf651c 100644 --- a/examples/python/cancellation/search.py +++ b/examples/python/cancellation/search.py @@ -19,6 +19,7 @@ from __future__ import print_function import base64 import hashlib +import itertools import logging import struct @@ -32,7 +33,7 @@ def _get_hamming_distance(a, b): """Calculates hamming distance between strings of equal length.""" distance = 0 for char_a, char_b in zip(a, b): - if char_a.lower() != char_b.lower(): + if char_a != char_b: distance += 1 return distance @@ -49,8 +50,11 @@ def _get_substring_hamming_distance(candidate, target): The minimum Hamming distance between candidate and target. """ min_distance = None + if len(target) > len(candidate): + raise ValueError("Candidate must be at least as long as target.") for i in range(len(candidate) - len(target) + 1): - distance = _get_hamming_distance(candidate[i:i + len(target)], target) + distance = _get_hamming_distance(candidate[i:i + len(target)].lower(), + target.lower()) if min_distance is None or distance < min_distance: min_distance = distance return min_distance @@ -75,20 +79,8 @@ def _bytestrings_of_length(length): Yields: All bytestrings of length `length`. """ - digits = [0] * length - while True: + for digits in itertools.product(range(_BYTE_MAX), repeat=length): yield b''.join(struct.pack('B', i) for i in digits) - digits[-1] += 1 - i = length - 1 - while digits[i] == _BYTE_MAX + 1: - digits[i] = 0 - i -= 1 - if i == -1: - # Terminate the generator since we've run out of strings of - # `length` bytes. - raise StopIteration() # pylint: disable=stop-iteration-return - else: - digits[i] += 1 def _all_bytestrings(): @@ -99,11 +91,9 @@ def _all_bytestrings(): Yields: All bytestrings in ascending order of length. """ - length = 1 - while True: - for bytestring in _bytestrings_of_length(length): - yield bytestring - length += 1 + for bytestring in itertools.chain.from_iterable( + _bytestrings_of_length(length) for length in itertools.count()): + yield bytestring def search(target, diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 25ce494ee39..22132d81fce 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -90,6 +90,9 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): @contextlib.contextmanager def _running_server(port, maximum_hashes): + # We use only a single servicer thread here to demonstrate that, if managed + # carefully, cancelled RPCs can need not continue occupying servicers + # threads. server = grpc.server( futures.ThreadPoolExecutor(max_workers=1), maximum_concurrent_rpcs=1) hash_name_pb2_grpc.add_HashFinderServicer_to_server( From 79e78d16f703ad743fe1338f9f6abf0f9ff0e83a Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 8 Jul 2019 11:09:44 -0700 Subject: [PATCH 051/661] Pylint --- examples/python/cancellation/client.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index 491dffa170b..f5a180c7e57 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -20,15 +20,9 @@ from __future__ import print_function import argparse import logging import signal -import six -import threading - -from six.moves.queue import Queue -from six.moves.queue import Empty as QueueEmpty +import sys import grpc -import os -import sys from examples.python.cancellation import hash_name_pb2 from examples.python.cancellation import hash_name_pb2_grpc From 805afe647d72b68b9163d743e35e21867d4cdb70 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 8 Jul 2019 11:42:21 -0700 Subject: [PATCH 052/661] Copyright typo --- examples/python/cancellation/client.py | 2 +- examples/python/cancellation/search.py | 2 +- examples/python/cancellation/server.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index f5a180c7e57..f80f9668849 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -1,4 +1,4 @@ -# Copyright the 2019 gRPC authors. +# Copyright 2019 the gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/examples/python/cancellation/search.py b/examples/python/cancellation/search.py index 8c41baf651c..9d2331af1bb 100644 --- a/examples/python/cancellation/search.py +++ b/examples/python/cancellation/search.py @@ -1,4 +1,4 @@ -# Copyright the 2019 gRPC authors. +# Copyright 2019 the gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 22132d81fce..9597e8941b4 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -1,4 +1,4 @@ -# Copyright the 2019 gRPC authors. +# Copyright 2019 the gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From e30dcefeab460ccec0f5583da329a0e9cb2428f5 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 8 Jul 2019 14:50:49 -0700 Subject: [PATCH 053/661] Revert "Merge pull request #19583 from gnossen/revert_signal_handling" This reverts commit 1e7ec75eff60ff74d0c192591a369af0308bca48, reversing changes made to 6d62eb1b703617ff9165773b6d1e7d28ab84856d. --- src/python/grpcio/grpc/_channel.py | 151 ++++++++++------- src/python/grpcio/grpc/_common.py | 50 ++++++ src/python/grpcio_tests/commands.py | 2 + src/python/grpcio_tests/tests/tests.json | 1 + .../grpcio_tests/tests/unit/BUILD.bazel | 8 + .../grpcio_tests/tests/unit/_signal_client.py | 84 ++++++++++ .../tests/unit/_signal_handling_test.py | 156 ++++++++++++++++++ 7 files changed, 393 insertions(+), 59 deletions(-) create mode 100644 src/python/grpcio_tests/tests/unit/_signal_client.py create mode 100644 src/python/grpcio_tests/tests/unit/_signal_handling_test.py diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index 24f928ef69f..0bf8e03b5ce 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -13,6 +13,7 @@ # limitations under the License. """Invocation-side implementation of gRPC Python.""" +import functools import logging import sys import threading @@ -81,17 +82,6 @@ def _unknown_code_details(unknown_cygrpc_code, details): unknown_cygrpc_code, details) -def _wait_once_until(condition, until): - if until is None: - condition.wait() - else: - remaining = until - time.time() - if remaining < 0: - raise grpc.FutureTimeoutError() - else: - condition.wait(timeout=remaining) - - class _RPCState(object): def __init__(self, due, initial_metadata, trailing_metadata, code, details): @@ -178,12 +168,11 @@ def _event_handler(state, response_deserializer): #pylint: disable=too-many-statements def _consume_request_iterator(request_iterator, state, call, request_serializer, event_handler): - if cygrpc.is_fork_support_enabled(): - condition_wait_timeout = 1.0 - else: - condition_wait_timeout = None + """Consume a request iterator supplied by the user.""" def consume_request_iterator(): # pylint: disable=too-many-branches + # Iterate over the request iterator until it is exhausted or an error + # condition is encountered. while True: return_from_user_request_generator_invoked = False try: @@ -224,14 +213,19 @@ def _consume_request_iterator(request_iterator, state, call, request_serializer, state.due.add(cygrpc.OperationType.send_message) else: return - while True: - state.condition.wait(condition_wait_timeout) - cygrpc.block_if_fork_in_progress(state) - if state.code is None: - if cygrpc.OperationType.send_message not in state.due: - break - else: - return + + def _done(): + return (state.code is not None or + cygrpc.OperationType.send_message not in + state.due) + + _common.wait( + state.condition.wait, + _done, + spin_cb=functools.partial( + cygrpc.block_if_fork_in_progress, state)) + if state.code is not None: + return else: return with state.condition: @@ -281,13 +275,21 @@ class _Rendezvous(grpc.RpcError, grpc.Future, grpc.Call): # pylint: disable=too with self._state.condition: return self._state.code is not None + def _is_complete(self): + return self._state.code is not None + def result(self, timeout=None): - until = None if timeout is None else time.time() + timeout + """Returns the result of the computation or raises its exception. + + See grpc.Future.result for the full API contract. + """ with self._state.condition: - while True: - if self._state.code is None: - _wait_once_until(self._state.condition, until) - elif self._state.code is grpc.StatusCode.OK: + timed_out = _common.wait( + self._state.condition.wait, self._is_complete, timeout=timeout) + if timed_out: + raise grpc.FutureTimeoutError() + else: + if self._state.code is grpc.StatusCode.OK: return self._state.response elif self._state.cancelled: raise grpc.FutureCancelledError() @@ -295,12 +297,17 @@ class _Rendezvous(grpc.RpcError, grpc.Future, grpc.Call): # pylint: disable=too raise self def exception(self, timeout=None): - until = None if timeout is None else time.time() + timeout + """Return the exception raised by the computation. + + See grpc.Future.exception for the full API contract. + """ with self._state.condition: - while True: - if self._state.code is None: - _wait_once_until(self._state.condition, until) - elif self._state.code is grpc.StatusCode.OK: + timed_out = _common.wait( + self._state.condition.wait, self._is_complete, timeout=timeout) + if timed_out: + raise grpc.FutureTimeoutError() + else: + if self._state.code is grpc.StatusCode.OK: return None elif self._state.cancelled: raise grpc.FutureCancelledError() @@ -308,12 +315,17 @@ class _Rendezvous(grpc.RpcError, grpc.Future, grpc.Call): # pylint: disable=too return self def traceback(self, timeout=None): - until = None if timeout is None else time.time() + timeout + """Access the traceback of the exception raised by the computation. + + See grpc.future.traceback for the full API contract. + """ with self._state.condition: - while True: - if self._state.code is None: - _wait_once_until(self._state.condition, until) - elif self._state.code is grpc.StatusCode.OK: + timed_out = _common.wait( + self._state.condition.wait, self._is_complete, timeout=timeout) + if timed_out: + raise grpc.FutureTimeoutError() + else: + if self._state.code is grpc.StatusCode.OK: return None elif self._state.cancelled: raise grpc.FutureCancelledError() @@ -345,17 +357,23 @@ class _Rendezvous(grpc.RpcError, grpc.Future, grpc.Call): # pylint: disable=too raise StopIteration() else: raise self - while True: - self._state.condition.wait() - if self._state.response is not None: - response = self._state.response - self._state.response = None - return response - elif cygrpc.OperationType.receive_message not in self._state.due: - if self._state.code is grpc.StatusCode.OK: - raise StopIteration() - elif self._state.code is not None: - raise self + + def _response_ready(): + return ( + self._state.response is not None or + (cygrpc.OperationType.receive_message not in self._state.due + and self._state.code is not None)) + + _common.wait(self._state.condition.wait, _response_ready) + if self._state.response is not None: + response = self._state.response + self._state.response = None + return response + elif cygrpc.OperationType.receive_message not in self._state.due: + if self._state.code is grpc.StatusCode.OK: + raise StopIteration() + elif self._state.code is not None: + raise self def __iter__(self): return self @@ -386,32 +404,47 @@ class _Rendezvous(grpc.RpcError, grpc.Future, grpc.Call): # pylint: disable=too def initial_metadata(self): with self._state.condition: - while self._state.initial_metadata is None: - self._state.condition.wait() + + def _done(): + return self._state.initial_metadata is not None + + _common.wait(self._state.condition.wait, _done) return self._state.initial_metadata def trailing_metadata(self): with self._state.condition: - while self._state.trailing_metadata is None: - self._state.condition.wait() + + def _done(): + return self._state.trailing_metadata is not None + + _common.wait(self._state.condition.wait, _done) return self._state.trailing_metadata def code(self): with self._state.condition: - while self._state.code is None: - self._state.condition.wait() + + def _done(): + return self._state.code is not None + + _common.wait(self._state.condition.wait, _done) return self._state.code def details(self): with self._state.condition: - while self._state.details is None: - self._state.condition.wait() + + def _done(): + return self._state.details is not None + + _common.wait(self._state.condition.wait, _done) return _common.decode(self._state.details) def debug_error_string(self): with self._state.condition: - while self._state.debug_error_string is None: - self._state.condition.wait() + + def _done(): + return self._state.debug_error_string is not None + + _common.wait(self._state.condition.wait, _done) return _common.decode(self._state.debug_error_string) def _repr(self): diff --git a/src/python/grpcio/grpc/_common.py b/src/python/grpcio/grpc/_common.py index f69127e38ef..b4b24738e8f 100644 --- a/src/python/grpcio/grpc/_common.py +++ b/src/python/grpcio/grpc/_common.py @@ -15,6 +15,7 @@ import logging +import time import six import grpc @@ -60,6 +61,8 @@ STATUS_CODE_TO_CYGRPC_STATUS_CODE = { CYGRPC_STATUS_CODE_TO_STATUS_CODE) } +MAXIMUM_WAIT_TIMEOUT = 0.1 + def encode(s): if isinstance(s, bytes): @@ -96,3 +99,50 @@ def deserialize(serialized_message, deserializer): def fully_qualified_method(group, method): return '/{}/{}'.format(group, method) + + +def _wait_once(wait_fn, timeout, spin_cb): + wait_fn(timeout=timeout) + if spin_cb is not None: + spin_cb() + + +def wait(wait_fn, wait_complete_fn, timeout=None, spin_cb=None): + """Blocks waiting for an event without blocking the thread indefinitely. + + See https://github.com/grpc/grpc/issues/19464 for full context. CPython's + `threading.Event.wait` and `threading.Condition.wait` methods, if invoked + without a timeout kwarg, may block the calling thread indefinitely. If the + call is made from the main thread, this means that signal handlers may not + run for an arbitrarily long period of time. + + This wrapper calls the supplied wait function with an arbitrary short + timeout to ensure that no signal handler has to wait longer than + MAXIMUM_WAIT_TIMEOUT before executing. + + Args: + wait_fn: A callable acceptable a single float-valued kwarg named + `timeout`. This function is expected to be one of `threading.Event.wait` + or `threading.Condition.wait`. + wait_complete_fn: A callable taking no arguments and returning a bool. + When this function returns true, it indicates that waiting should cease. + timeout: An optional float-valued number of seconds after which the wait + should cease. + spin_cb: An optional Callable taking no arguments and returning nothing. + This callback will be called on each iteration of the spin. This may be + used for, e.g. work related to forking. + + Returns: + True if a timeout was supplied and it was reached. False otherwise. + """ + if timeout is None: + while not wait_complete_fn(): + _wait_once(wait_fn, MAXIMUM_WAIT_TIMEOUT, spin_cb) + else: + end = time.time() + timeout + while not wait_complete_fn(): + remaining = min(end - time.time(), MAXIMUM_WAIT_TIMEOUT) + if remaining < 0: + return True + _wait_once(wait_fn, remaining, spin_cb) + return False diff --git a/src/python/grpcio_tests/commands.py b/src/python/grpcio_tests/commands.py index dc0795d4a12..166cea101a4 100644 --- a/src/python/grpcio_tests/commands.py +++ b/src/python/grpcio_tests/commands.py @@ -145,6 +145,8 @@ class TestGevent(setuptools.Command): 'unit._exit_test.ExitTest.test_in_flight_partial_unary_stream_call', 'unit._exit_test.ExitTest.test_in_flight_partial_stream_unary_call', 'unit._exit_test.ExitTest.test_in_flight_partial_stream_stream_call', + # TODO(https://github.com/grpc/grpc/issues/18980): Reenable. + 'unit._signal_handling_test.SignalHandlingTest', 'unit._metadata_flags_test', 'health_check._health_servicer_test.HealthServicerTest.test_cancelled_watch_removed_from_watch_list', # TODO(https://github.com/grpc/grpc/issues/17330) enable these three tests diff --git a/src/python/grpcio_tests/tests/tests.json b/src/python/grpcio_tests/tests/tests.json index cc08d56248a..16ba4847bc0 100644 --- a/src/python/grpcio_tests/tests/tests.json +++ b/src/python/grpcio_tests/tests/tests.json @@ -67,6 +67,7 @@ "unit._server_ssl_cert_config_test.ServerSSLCertReloadTestWithoutClientAuth", "unit._server_test.ServerTest", "unit._session_cache_test.SSLSessionCacheTest", + "unit._signal_handling_test.SignalHandlingTest", "unit._version_test.VersionTest", "unit.beta._beta_features_test.BetaFeaturesTest", "unit.beta._beta_features_test.ContextManagementAndLifecycleTest", diff --git a/src/python/grpcio_tests/tests/unit/BUILD.bazel b/src/python/grpcio_tests/tests/unit/BUILD.bazel index a161794f8be..d21f5a59ad1 100644 --- a/src/python/grpcio_tests/tests/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/BUILD.bazel @@ -16,6 +16,7 @@ GRPCIO_TESTS_UNIT = [ "_credentials_test.py", "_dns_resolver_test.py", "_empty_message_test.py", + "_error_message_encoding_test.py", "_exit_test.py", "_interceptor_test.py", "_invalid_metadata_test.py", @@ -27,6 +28,7 @@ GRPCIO_TESTS_UNIT = [ # "_reconnect_test.py", "_resource_exhausted_test.py", "_rpc_test.py", + "_signal_handling_test.py", # TODO(ghostwriternr): To be added later. # "_server_ssl_cert_config_test.py", "_server_test.py", @@ -39,6 +41,11 @@ py_library( srcs = ["_tcp_proxy.py"], ) +py_library( + name = "_signal_client", + srcs = ["_signal_client.py"], +) + py_library( name = "resources", srcs = ["resources.py"], @@ -87,6 +94,7 @@ py_library( ":_server_shutdown_scenarios", ":_from_grpc_import_star", ":_tcp_proxy", + ":_signal_client", "//src/python/grpcio_tests/tests/unit/framework/common", "//src/python/grpcio_tests/tests/testing", requirement('six'), diff --git a/src/python/grpcio_tests/tests/unit/_signal_client.py b/src/python/grpcio_tests/tests/unit/_signal_client.py new file mode 100644 index 00000000000..65ddd6d858e --- /dev/null +++ b/src/python/grpcio_tests/tests/unit/_signal_client.py @@ -0,0 +1,84 @@ +# Copyright 2019 the gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Client for testing responsiveness to signals.""" + +from __future__ import print_function + +import argparse +import functools +import logging +import signal +import sys + +import grpc + +SIGTERM_MESSAGE = "Handling sigterm!" + +UNARY_UNARY = "/test/Unary" +UNARY_STREAM = "/test/ServerStreaming" + +_MESSAGE = b'\x00\x00\x00' + +_ASSERTION_MESSAGE = "Control flow should never reach here." + +# NOTE(gnossen): We use a global variable here so that the signal handler can be +# installed before the RPC begins. If we do not do this, then we may receive the +# SIGINT before the signal handler is installed. I'm not happy with per-process +# global state, but the per-process global state that is signal handlers +# somewhat forces my hand. +per_process_rpc_future = None + + +def handle_sigint(unused_signum, unused_frame): + print(SIGTERM_MESSAGE) + if per_process_rpc_future is not None: + per_process_rpc_future.cancel() + sys.stderr.flush() + sys.exit(0) + + +def main_unary(server_target): + """Initiate a unary RPC to be interrupted by a SIGINT.""" + global per_process_rpc_future # pylint: disable=global-statement + with grpc.insecure_channel(server_target) as channel: + multicallable = channel.unary_unary(UNARY_UNARY) + signal.signal(signal.SIGINT, handle_sigint) + per_process_rpc_future = multicallable.future( + _MESSAGE, wait_for_ready=True) + result = per_process_rpc_future.result() + assert False, _ASSERTION_MESSAGE + + +def main_streaming(server_target): + """Initiate a streaming RPC to be interrupted by a SIGINT.""" + global per_process_rpc_future # pylint: disable=global-statement + with grpc.insecure_channel(server_target) as channel: + signal.signal(signal.SIGINT, handle_sigint) + per_process_rpc_future = channel.unary_stream(UNARY_STREAM)( + _MESSAGE, wait_for_ready=True) + for result in per_process_rpc_future: + pass + assert False, _ASSERTION_MESSAGE + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Signal test client.') + parser.add_argument('server', help='Server target') + parser.add_argument( + 'arity', help='RPC arity', choices=('unary', 'streaming')) + args = parser.parse_args() + if args.arity == 'unary': + main_unary(args.server) + else: + main_streaming(args.server) diff --git a/src/python/grpcio_tests/tests/unit/_signal_handling_test.py b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py new file mode 100644 index 00000000000..467b8df27f9 --- /dev/null +++ b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py @@ -0,0 +1,156 @@ +# Copyright 2019 the gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Test of responsiveness to signals.""" + +import logging +import os +import signal +import subprocess +import tempfile +import threading +import unittest +import sys + +import grpc + +from tests.unit import test_common +from tests.unit import _signal_client + +_CLIENT_PATH = os.path.abspath(os.path.realpath(_signal_client.__file__)) +_HOST = 'localhost' + + +class _GenericHandler(grpc.GenericRpcHandler): + + def __init__(self): + self._connected_clients_lock = threading.RLock() + self._connected_clients_event = threading.Event() + self._connected_clients = 0 + + self._unary_unary_handler = grpc.unary_unary_rpc_method_handler( + self._handle_unary_unary) + self._unary_stream_handler = grpc.unary_stream_rpc_method_handler( + self._handle_unary_stream) + + def _on_client_connect(self): + with self._connected_clients_lock: + self._connected_clients += 1 + self._connected_clients_event.set() + + def _on_client_disconnect(self): + with self._connected_clients_lock: + self._connected_clients -= 1 + if self._connected_clients == 0: + self._connected_clients_event.clear() + + def await_connected_client(self): + """Blocks until a client connects to the server.""" + self._connected_clients_event.wait() + + def _handle_unary_unary(self, request, servicer_context): + """Handles a unary RPC. + + Blocks until the client disconnects and then echoes. + """ + stop_event = threading.Event() + + def on_rpc_end(): + self._on_client_disconnect() + stop_event.set() + + servicer_context.add_callback(on_rpc_end) + self._on_client_connect() + stop_event.wait() + return request + + def _handle_unary_stream(self, request, servicer_context): + """Handles a server streaming RPC. + + Blocks until the client disconnects and then echoes. + """ + stop_event = threading.Event() + + def on_rpc_end(): + self._on_client_disconnect() + stop_event.set() + + servicer_context.add_callback(on_rpc_end) + self._on_client_connect() + stop_event.wait() + yield request + + def service(self, handler_call_details): + if handler_call_details.method == _signal_client.UNARY_UNARY: + return self._unary_unary_handler + elif handler_call_details.method == _signal_client.UNARY_STREAM: + return self._unary_stream_handler + else: + return None + + +def _read_stream(stream): + stream.seek(0) + return stream.read() + + +class SignalHandlingTest(unittest.TestCase): + + def setUp(self): + self._server = test_common.test_server() + self._port = self._server.add_insecure_port('{}:0'.format(_HOST)) + self._handler = _GenericHandler() + self._server.add_generic_rpc_handlers((self._handler,)) + self._server.start() + + def tearDown(self): + self._server.stop(None) + + @unittest.skipIf(os.name == 'nt', 'SIGINT not supported on windows') + def testUnary(self): + """Tests that the server unary code path does not stall signal handlers.""" + server_target = '{}:{}'.format(_HOST, self._port) + with tempfile.TemporaryFile(mode='r') as client_stdout: + with tempfile.TemporaryFile(mode='r') as client_stderr: + client = subprocess.Popen( + (sys.executable, _CLIENT_PATH, server_target, 'unary'), + stdout=client_stdout, + stderr=client_stderr) + self._handler.await_connected_client() + client.send_signal(signal.SIGINT) + self.assertFalse(client.wait(), msg=_read_stream(client_stderr)) + client_stdout.seek(0) + self.assertIn(_signal_client.SIGTERM_MESSAGE, + client_stdout.read()) + + @unittest.skipIf(os.name == 'nt', 'SIGINT not supported on windows') + def testStreaming(self): + """Tests that the server streaming code path does not stall signal handlers.""" + server_target = '{}:{}'.format(_HOST, self._port) + with tempfile.TemporaryFile(mode='r') as client_stdout: + with tempfile.TemporaryFile(mode='r') as client_stderr: + client = subprocess.Popen( + (sys.executable, _CLIENT_PATH, server_target, 'streaming'), + stdout=client_stdout, + stderr=client_stderr) + self._handler.await_connected_client() + client.send_signal(signal.SIGINT) + self.assertFalse(client.wait(), msg=_read_stream(client_stderr)) + client_stdout.seek(0) + self.assertIn(_signal_client.SIGTERM_MESSAGE, + client_stdout.read()) + + +if __name__ == '__main__': + logging.basicConfig() + unittest.main(verbosity=2) From 674de801232dcfd2e420246c62e52613d837a6fd Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 9 Jul 2019 14:12:27 -0700 Subject: [PATCH 054/661] Function in an internal environment --- .../tests/unit/_signal_handling_test.py | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/python/grpcio_tests/tests/unit/_signal_handling_test.py b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py index 467b8df27f9..5e9dc676a7c 100644 --- a/src/python/grpcio_tests/tests/unit/_signal_handling_test.py +++ b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py @@ -27,7 +27,18 @@ import grpc from tests.unit import test_common from tests.unit import _signal_client -_CLIENT_PATH = os.path.abspath(os.path.realpath(_signal_client.__file__)) +_CLIENT_PATH = None +if sys.executable is not None: + _CLIENT_PATH = os.path.abspath(os.path.realpath(_signal_client.__file__)) +else: + # Note(rbellevi): For compatibility with internal testing. + if len(sys.argv) != 2: + raise RuntimeError("Must supply path to executable client.") + client_name = sys.argv[1].split("/")[-1] + del sys.argv[1] # For compatibility with test runner. + _CLIENT_PATH = os.path.realpath( + os.path.join(os.path.dirname(os.path.abspath(__file__)), client_name)) + _HOST = 'localhost' @@ -104,6 +115,15 @@ def _read_stream(stream): return stream.read() +def _start_client(args, stdout, stderr): + invocation = None + if sys.executable is not None: + invocation = (sys.executable, _CLIENT_PATH) + tuple(args) + else: + invocation = (_CLIENT_PATH,) + tuple(args) + return subprocess.Popen(invocation, stdout=stdout, stderr=stderr) + + class SignalHandlingTest(unittest.TestCase): def setUp(self): @@ -122,10 +142,8 @@ class SignalHandlingTest(unittest.TestCase): server_target = '{}:{}'.format(_HOST, self._port) with tempfile.TemporaryFile(mode='r') as client_stdout: with tempfile.TemporaryFile(mode='r') as client_stderr: - client = subprocess.Popen( - (sys.executable, _CLIENT_PATH, server_target, 'unary'), - stdout=client_stdout, - stderr=client_stderr) + client = _start_client((server_target, 'unary'), client_stdout, + client_stderr) self._handler.await_connected_client() client.send_signal(signal.SIGINT) self.assertFalse(client.wait(), msg=_read_stream(client_stderr)) @@ -139,10 +157,8 @@ class SignalHandlingTest(unittest.TestCase): server_target = '{}:{}'.format(_HOST, self._port) with tempfile.TemporaryFile(mode='r') as client_stdout: with tempfile.TemporaryFile(mode='r') as client_stderr: - client = subprocess.Popen( - (sys.executable, _CLIENT_PATH, server_target, 'streaming'), - stdout=client_stdout, - stderr=client_stderr) + client = _start_client((server_target, 'streaming'), + client_stdout, client_stderr) self._handler.await_connected_client() client.send_signal(signal.SIGINT) self.assertFalse(client.wait(), msg=_read_stream(client_stderr)) From d6e3d04cf861ac62a4c235bfe49737f76f0a1c98 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 9 Jul 2019 15:57:19 -0700 Subject: [PATCH 055/661] Capitalize comment --- src/python/grpcio_tests/tests/unit/_signal_handling_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/grpcio_tests/tests/unit/_signal_handling_test.py b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py index 5e9dc676a7c..8ef156c596d 100644 --- a/src/python/grpcio_tests/tests/unit/_signal_handling_test.py +++ b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py @@ -31,7 +31,7 @@ _CLIENT_PATH = None if sys.executable is not None: _CLIENT_PATH = os.path.abspath(os.path.realpath(_signal_client.__file__)) else: - # Note(rbellevi): For compatibility with internal testing. + # NOTE(rbellevi): For compatibility with internal testing. if len(sys.argv) != 2: raise RuntimeError("Must supply path to executable client.") client_name = sys.argv[1].split("/")[-1] From 6fbe9d916daae8e507e3797c4a6a9ad544ecc8c2 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Wed, 10 Jul 2019 20:56:38 +1200 Subject: [PATCH 056/661] Add ChannelBase, change client base argument --- src/csharp/Grpc.Core.Api/ChannelBase.cs | 52 +++++++++++++++++++++++++ src/csharp/Grpc.Core/Channel.cs | 24 ++++++------ src/csharp/Grpc.Core/ClientBase.cs | 4 +- 3 files changed, 65 insertions(+), 15 deletions(-) create mode 100644 src/csharp/Grpc.Core.Api/ChannelBase.cs diff --git a/src/csharp/Grpc.Core.Api/ChannelBase.cs b/src/csharp/Grpc.Core.Api/ChannelBase.cs new file mode 100644 index 00000000000..54546300e81 --- /dev/null +++ b/src/csharp/Grpc.Core.Api/ChannelBase.cs @@ -0,0 +1,52 @@ +#region Copyright notice and license + +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using Grpc.Core.Utils; + +namespace Grpc.Core +{ + /// + /// Base class for gRPC channel. Channels are an abstraction of long-lived connections to remote servers. + /// + public abstract class ChannelBase + { + private readonly string target; + + /// + /// Initializes a new instance of class that connects to a specific host. + /// + /// Target of the channel. + protected ChannelBase(string target) + { + this.target = GrpcPreconditions.CheckNotNull(target, nameof(target)); + } + + /// The original target used to create the channel. + public string Target + { + get { return this.target; } + } + + /// + /// Create a new for the channel. + /// + /// A new . + public abstract CallInvoker CreateCallInvoker(); + } +} diff --git a/src/csharp/Grpc.Core/Channel.cs b/src/csharp/Grpc.Core/Channel.cs index 97f79b0fb4f..fb58c077c70 100644 --- a/src/csharp/Grpc.Core/Channel.cs +++ b/src/csharp/Grpc.Core/Channel.cs @@ -30,7 +30,7 @@ namespace Grpc.Core /// More client objects can reuse the same channel. Creating a channel is an expensive operation compared to invoking /// a remote call so in general you should reuse a single channel for as many calls as possible. /// - public class Channel + public class Channel : ChannelBase { static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); @@ -38,7 +38,6 @@ namespace Grpc.Core readonly AtomicCounter activeCallCounter = new AtomicCounter(); readonly CancellationTokenSource shutdownTokenSource = new CancellationTokenSource(); - readonly string target; readonly GrpcEnvironment environment; readonly CompletionQueueSafeHandle completionQueue; readonly ChannelSafeHandle handle; @@ -64,9 +63,8 @@ namespace Grpc.Core /// Target of the channel. /// Credentials to secure the channel. /// Channel options. - public Channel(string target, ChannelCredentials credentials, IEnumerable options) + public Channel(string target, ChannelCredentials credentials, IEnumerable options) : base(target) { - this.target = GrpcPreconditions.CheckNotNull(target, "target"); this.options = CreateOptionsDictionary(options); EnsureUserAgentChannelOption(this.options); this.environment = GrpcEnvironment.AddRef(); @@ -179,15 +177,6 @@ namespace Grpc.Core } } - /// The original target used to create the channel. - public string Target - { - get - { - return this.target; - } - } - /// /// Returns a token that gets cancelled once ShutdownAsync is invoked. /// @@ -257,6 +246,15 @@ namespace Grpc.Core await GrpcEnvironment.ReleaseAsync().ConfigureAwait(false); } + /// + /// Create a new for the channel. + /// + /// A new . + public override CallInvoker CreateCallInvoker() + { + return new DefaultCallInvoker(this); + } + internal ChannelSafeHandle Handle { get diff --git a/src/csharp/Grpc.Core/ClientBase.cs b/src/csharp/Grpc.Core/ClientBase.cs index 05edce7467d..243c35e20c1 100644 --- a/src/csharp/Grpc.Core/ClientBase.cs +++ b/src/csharp/Grpc.Core/ClientBase.cs @@ -51,7 +51,7 @@ namespace Grpc.Core /// Initializes a new instance of ClientBase class. /// /// The channel to use for remote call invocation. - public ClientBase(Channel channel) : base(channel) + public ClientBase(ChannelBase channel) : base(channel) { } @@ -113,7 +113,7 @@ namespace Grpc.Core /// Initializes a new instance of ClientBase class. /// /// The channel to use for remote call invocation. - public ClientBase(Channel channel) : this(new DefaultCallInvoker(channel)) + public ClientBase(ChannelBase channel) : this(channel.CreateCallInvoker()) { } From 3b380ccb58fc666c4b22515e9faa7416af0a5e11 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Fri, 12 Jul 2019 15:33:10 -0700 Subject: [PATCH 057/661] Added sample tvOS project and modified some podspec deployment targets --- .../RemoteTestClient/RemoteTest.podspec | 1 + src/objective-c/examples/tvOS-sample/Podfile | 31 ++ .../tvOS-sample.xcodeproj/project.pbxproj | 401 ++++++++++++++++++ .../tvOS-sample/tvOS-sample/AppDelegate.h | 17 + .../tvOS-sample/tvOS-sample/AppDelegate.m | 51 +++ .../Content.imageset/Contents.json | 11 + .../Back.imagestacklayer/Contents.json | 6 + .../Contents.json | 17 + .../Content.imageset/Contents.json | 11 + .../Front.imagestacklayer/Contents.json | 6 + .../Content.imageset/Contents.json | 11 + .../Middle.imagestacklayer/Contents.json | 6 + .../Content.imageset/Contents.json | 16 + .../Back.imagestacklayer/Contents.json | 6 + .../App Icon.imagestack/Contents.json | 17 + .../Content.imageset/Contents.json | 16 + .../Front.imagestacklayer/Contents.json | 6 + .../Content.imageset/Contents.json | 16 + .../Middle.imagestacklayer/Contents.json | 6 + .../Contents.json | 32 ++ .../Contents.json | 24 ++ .../Top Shelf Image.imageset/Contents.json | 24 ++ .../tvOS-sample/Assets.xcassets/Contents.json | 6 + .../Launch Image.launchimage/Contents.json | 22 + .../tvOS-sample/Base.lproj/Main.storyboard | 43 ++ .../tvOS-sample/tvOS-sample/Info.plist | 32 ++ .../tvOS-sample/tvOS-sample/ViewController.h | 15 + .../tvOS-sample/tvOS-sample/ViewController.m | 54 +++ .../examples/tvOS-sample/tvOS-sample/main.m | 16 + 29 files changed, 920 insertions(+) create mode 100644 src/objective-c/examples/tvOS-sample/Podfile create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.h create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Launch Image.launchimage/Contents.json create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Base.lproj/Main.storyboard create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.h create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/main.m diff --git a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec index cd9464c453e..97faa0d9236 100644 --- a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec @@ -9,6 +9,7 @@ Pod::Spec.new do |s| s.ios.deployment_target = '7.1' s.osx.deployment_target = '10.9' + s.tvos.deployment_target = '10.0' # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. s.dependency "!ProtoCompiler-gRPCPlugin" diff --git a/src/objective-c/examples/tvOS-sample/Podfile b/src/objective-c/examples/tvOS-sample/Podfile new file mode 100644 index 00000000000..20d20e27bdf --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/Podfile @@ -0,0 +1,31 @@ +platform :tvos, '10.0' + +install! 'cocoapods', :deterministic_uuids => false + +ROOT_DIR = '../../../..' + +target 'tvOS-sample' do + pod 'gRPC-ProtoRPC', :path => ROOT_DIR + pod 'gRPC', :path => ROOT_DIR + pod 'gRPC-Core', :path => ROOT_DIR + pod 'gRPC-RxLibrary', :path => ROOT_DIR + pod 'RemoteTest', :path => "../RemoteTestClient" + pod '!ProtoCompiler-gRPCPlugin', :path => "#{ROOT_DIR}/src/objective-c" +end + +pre_install do |installer| + grpc_core_spec = installer.pod_targets.find{|t| t.name.start_with?('gRPC-Core')}.root_spec + + src_root = "$(PODS_TARGET_SRCROOT)" + grpc_core_spec.pod_target_xcconfig = { + 'GRPC_SRC_ROOT' => src_root, + 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', + 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"', + # If we don't set these two settings, `include/grpc/support/time.h` and + # `src/core/lib/gpr/string.h` shadow the system `` and ``, breaking the + # build. + 'USE_HEADERMAP' => 'NO', + 'ALWAYS_SEARCH_USER_PATHS' => 'NO', + } +end + diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..91ebf53215f --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj @@ -0,0 +1,401 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 565ABB2FA1065F0EC355A9AA /* libPods-tvOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 968ABA42FAF2C82FA0BF740C /* libPods-tvOS-sample.a */; }; + ABB17D3A22D8FB8B00C26D6E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D3922D8FB8B00C26D6E /* AppDelegate.m */; }; + ABB17D3D22D8FB8B00C26D6E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D3C22D8FB8B00C26D6E /* ViewController.m */; }; + ABB17D4022D8FB8B00C26D6E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D3E22D8FB8B00C26D6E /* Main.storyboard */; }; + ABB17D4222D8FB8D00C26D6E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D4122D8FB8D00C26D6E /* Assets.xcassets */; }; + ABB17D4522D8FB8D00C26D6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D4422D8FB8D00C26D6E /* main.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 288D31799283F13AE615B2E7 /* Pods-tvOS-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS-sample.debug.xcconfig"; path = "Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample.debug.xcconfig"; sourceTree = ""; }; + 68CC4CF97E776A55036CCBD2 /* Pods-tvOS-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS-sample.release.xcconfig"; path = "Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample.release.xcconfig"; sourceTree = ""; }; + 968ABA42FAF2C82FA0BF740C /* libPods-tvOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-tvOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + ABB17D3522D8FB8B00C26D6E /* tvOS-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "tvOS-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + ABB17D3822D8FB8B00C26D6E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + ABB17D3922D8FB8B00C26D6E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + ABB17D3B22D8FB8B00C26D6E /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + ABB17D3C22D8FB8B00C26D6E /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + ABB17D3F22D8FB8B00C26D6E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + ABB17D4122D8FB8D00C26D6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + ABB17D4322D8FB8D00C26D6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + ABB17D4422D8FB8D00C26D6E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + ABB17D3222D8FB8B00C26D6E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 565ABB2FA1065F0EC355A9AA /* libPods-tvOS-sample.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1D5885E1FE0BFAC7841076C2 /* Pods */ = { + isa = PBXGroup; + children = ( + 288D31799283F13AE615B2E7 /* Pods-tvOS-sample.debug.xcconfig */, + 68CC4CF97E776A55036CCBD2 /* Pods-tvOS-sample.release.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + ABB17D2C22D8FB8B00C26D6E = { + isa = PBXGroup; + children = ( + ABB17D3722D8FB8B00C26D6E /* tvOS-sample */, + ABB17D3622D8FB8B00C26D6E /* Products */, + 1D5885E1FE0BFAC7841076C2 /* Pods */, + EC43163F87C0DE6118957F38 /* Frameworks */, + ); + sourceTree = ""; + }; + ABB17D3622D8FB8B00C26D6E /* Products */ = { + isa = PBXGroup; + children = ( + ABB17D3522D8FB8B00C26D6E /* tvOS-sample.app */, + ); + name = Products; + sourceTree = ""; + }; + ABB17D3722D8FB8B00C26D6E /* tvOS-sample */ = { + isa = PBXGroup; + children = ( + ABB17D3822D8FB8B00C26D6E /* AppDelegate.h */, + ABB17D3922D8FB8B00C26D6E /* AppDelegate.m */, + ABB17D3B22D8FB8B00C26D6E /* ViewController.h */, + ABB17D3C22D8FB8B00C26D6E /* ViewController.m */, + ABB17D3E22D8FB8B00C26D6E /* Main.storyboard */, + ABB17D4122D8FB8D00C26D6E /* Assets.xcassets */, + ABB17D4322D8FB8D00C26D6E /* Info.plist */, + ABB17D4422D8FB8D00C26D6E /* main.m */, + ); + path = "tvOS-sample"; + sourceTree = ""; + }; + EC43163F87C0DE6118957F38 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 968ABA42FAF2C82FA0BF740C /* libPods-tvOS-sample.a */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + ABB17D3422D8FB8B00C26D6E /* tvOS-sample */ = { + isa = PBXNativeTarget; + buildConfigurationList = ABB17D4822D8FB8D00C26D6E /* Build configuration list for PBXNativeTarget "tvOS-sample" */; + buildPhases = ( + 3963C36BEF44FBF8792B6A8A /* [CP] Check Pods Manifest.lock */, + ABB17D3122D8FB8B00C26D6E /* Sources */, + ABB17D3222D8FB8B00C26D6E /* Frameworks */, + ABB17D3322D8FB8B00C26D6E /* Resources */, + 3A325E5E27D64D1CC36130E2 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "tvOS-sample"; + productName = "tvOS-sample"; + productReference = ABB17D3522D8FB8B00C26D6E /* tvOS-sample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + ABB17D2D22D8FB8B00C26D6E /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = "Tony Lu"; + TargetAttributes = { + ABB17D3422D8FB8B00C26D6E = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = ABB17D3022D8FB8B00C26D6E /* Build configuration list for PBXProject "tvOS-sample" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = ABB17D2C22D8FB8B00C26D6E; + productRefGroup = ABB17D3622D8FB8B00C26D6E /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + ABB17D3422D8FB8B00C26D6E /* tvOS-sample */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + ABB17D3322D8FB8B00C26D6E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ABB17D4222D8FB8D00C26D6E /* Assets.xcassets in Resources */, + ABB17D4022D8FB8B00C26D6E /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3963C36BEF44FBF8792B6A8A /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-tvOS-sample-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 3A325E5E27D64D1CC36130E2 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + ABB17D3122D8FB8B00C26D6E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ABB17D3D22D8FB8B00C26D6E /* ViewController.m in Sources */, + ABB17D4522D8FB8D00C26D6E /* main.m in Sources */, + ABB17D3A22D8FB8B00C26D6E /* AppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + ABB17D3E22D8FB8B00C26D6E /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + ABB17D3F22D8FB8B00C26D6E /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + ABB17D4622D8FB8D00C26D6E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = appletvos; + TVOS_DEPLOYMENT_TARGET = 12.1; + }; + name = Debug; + }; + ABB17D4722D8FB8D00C26D6E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = appletvos; + TVOS_DEPLOYMENT_TARGET = 12.1; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + ABB17D4922D8FB8D00C26D6E /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 288D31799283F13AE615B2E7 /* Pods-tvOS-sample.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + INFOPLIST_FILE = "tvOS-sample/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-grpc-sample"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = 3; + }; + name = Debug; + }; + ABB17D4A22D8FB8D00C26D6E /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 68CC4CF97E776A55036CCBD2 /* Pods-tvOS-sample.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + INFOPLIST_FILE = "tvOS-sample/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-grpc-sample"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = 3; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + ABB17D3022D8FB8B00C26D6E /* Build configuration list for PBXProject "tvOS-sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ABB17D4622D8FB8D00C26D6E /* Debug */, + ABB17D4722D8FB8D00C26D6E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + ABB17D4822D8FB8D00C26D6E /* Build configuration list for PBXNativeTarget "tvOS-sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ABB17D4922D8FB8D00C26D6E /* Debug */, + ABB17D4A22D8FB8D00C26D6E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = ABB17D2D22D8FB8B00C26D6E /* Project object */; +} diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.h b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.h new file mode 100644 index 00000000000..24f0d222e54 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.h @@ -0,0 +1,17 @@ +// +// AppDelegate.h +// tvOS-sample +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m new file mode 100644 index 00000000000..e04dba4c4c1 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m @@ -0,0 +1,51 @@ +// +// AppDelegate.m +// tvOS-sample +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. +} + + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + + +@end diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000000..48ecb4fa43e --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,11 @@ +{ + "images" : [ + { + "idiom" : "tv" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 00000000000..da4a164c918 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json new file mode 100644 index 00000000000..d29f024ed5c --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000000..48ecb4fa43e --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,11 @@ +{ + "images" : [ + { + "idiom" : "tv" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 00000000000..da4a164c918 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000000..48ecb4fa43e --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,11 @@ +{ + "images" : [ + { + "idiom" : "tv" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 00000000000..da4a164c918 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000000..16a370df014 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 00000000000..da4a164c918 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json new file mode 100644 index 00000000000..d29f024ed5c --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000000..16a370df014 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 00000000000..da4a164c918 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000000..16a370df014 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 00000000000..da4a164c918 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json new file mode 100644 index 00000000000..db288f368f1 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json @@ -0,0 +1,32 @@ +{ + "assets" : [ + { + "size" : "1280x768", + "idiom" : "tv", + "filename" : "App Icon - App Store.imagestack", + "role" : "primary-app-icon" + }, + { + "size" : "400x240", + "idiom" : "tv", + "filename" : "App Icon.imagestack", + "role" : "primary-app-icon" + }, + { + "size" : "2320x720", + "idiom" : "tv", + "filename" : "Top Shelf Image Wide.imageset", + "role" : "top-shelf-image-wide" + }, + { + "size" : "1920x720", + "idiom" : "tv", + "filename" : "Top Shelf Image.imageset", + "role" : "top-shelf-image" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json new file mode 100644 index 00000000000..7dc95020229 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json @@ -0,0 +1,24 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + }, + { + "idiom" : "tv-marketing", + "scale" : "1x" + }, + { + "idiom" : "tv-marketing", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json new file mode 100644 index 00000000000..7dc95020229 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json @@ -0,0 +1,24 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + }, + { + "idiom" : "tv-marketing", + "scale" : "1x" + }, + { + "idiom" : "tv-marketing", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Contents.json new file mode 100644 index 00000000000..da4a164c918 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Launch Image.launchimage/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Launch Image.launchimage/Contents.json new file mode 100644 index 00000000000..d746a609003 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Launch Image.launchimage/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "orientation" : "landscape", + "idiom" : "tv", + "extent" : "full-screen", + "minimum-system-version" : "11.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "tv", + "extent" : "full-screen", + "minimum-system-version" : "9.0", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Base.lproj/Main.storyboard b/src/objective-c/examples/tvOS-sample/tvOS-sample/Base.lproj/Main.storyboard new file mode 100644 index 00000000000..783cc4062b3 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Base.lproj/Main.storyboard @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist b/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist new file mode 100644 index 00000000000..02942a34f3e --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + arm64 + + UIUserInterfaceStyle + Automatic + + diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.h b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.h new file mode 100644 index 00000000000..703e8bdb36e --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// tvOS-sample +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m new file mode 100644 index 00000000000..1a733523f50 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m @@ -0,0 +1,54 @@ +// +// ViewController.m +// tvOS-sample +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import "ViewController.h" + +#import +#import + + +static NSString *const kPackage = @"grpc.testing"; +static NSString *const kService = @"TestService"; + +@interface ViewController () + +@end + +@implementation ViewController { + GRPCCallOptions *_options; + RMTTestService *_service; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + _options = options; + + _service = [[RMTTestService alloc] initWithHost:@"grpc-test.sandbox.googleapis.com" + callOptions:_options]; +} + +- (IBAction)makeCall:(id)sender { + RMTSimpleRequest *request = [RMTSimpleRequest message]; + request.responseSize = 100; + GRPCUnaryProtoCall *call = [_service unaryCallWithMessage:request + responseHandler:self + callOptions:nil]; + [call start]; +} + +- (void)didReceiveProtoMessage:(GPBMessage *)message { + NSLog(@"%@", [message data]); +} + +- (dispatch_queue_t)dispatchQueue { + return dispatch_get_main_queue(); +} + +@end diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m new file mode 100644 index 00000000000..f18a9db860e --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m @@ -0,0 +1,16 @@ +// +// main.m +// tvOS-sample +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} From 90dac25693c18888982de6408779cc92a21106f1 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Fri, 12 Jul 2019 17:21:35 -0700 Subject: [PATCH 058/661] Added watchOS sample --- gRPC-Core.podspec | 1 + gRPC-ProtoRPC.podspec | 1 + gRPC-RxLibrary.podspec | 1 + gRPC.podspec | 1 + .../!ProtoCompiler-gRPCPlugin.podspec | 1 + src/objective-c/!ProtoCompiler.podspec | 1 + src/objective-c/BoringSSL-GRPC.podspec | 1 + .../RemoteTestClient/RemoteTest.podspec | 1 + .../tvOS-sample.xcodeproj/project.pbxproj | 62 +- .../tvOS-sample/tvOS-sample/ViewController.m | 4 - .../examples/watchOS-sample/Podfile | 41 + .../AppIcon.appiconset/Contents.json | 81 ++ .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/Interface.storyboard | 27 + .../watchOS-sample WatchKit App/Info.plist | 33 + .../Circular.imageset/Contents.json | 18 + .../Contents.json | 48 ++ .../Extra Large.imageset/Contents.json | 18 + .../Graphic Bezel.imageset/Contents.json | 18 + .../Graphic Circular.imageset/Contents.json | 18 + .../Graphic Corner.imageset/Contents.json | 18 + .../Contents.json | 18 + .../Modular.imageset/Contents.json | 18 + .../Utilitarian.imageset/Contents.json | 18 + .../Assets.xcassets/Contents.json | 6 + .../ExtensionDelegate.h | 13 + .../ExtensionDelegate.m | 61 ++ .../Info.plist | 36 + .../InterfaceController.h | 14 + .../InterfaceController.m | 68 ++ .../watchOS-sample.xcodeproj/project.pbxproj | 750 ++++++++++++++++++ .../watchOS-sample/AppDelegate.h | 17 + .../watchOS-sample/AppDelegate.m | 51 ++ .../AppIcon.appiconset/Contents.json | 98 +++ .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/LaunchScreen.storyboard | 25 + .../watchOS-sample/Base.lproj/Main.storyboard | 24 + .../watchOS-sample/watchOS-sample/Info.plist | 45 ++ .../watchOS-sample/ViewController.h | 15 + .../watchOS-sample/ViewController.m | 25 + .../watchOS-sample/watchOS-sample/main.m | 16 + 41 files changed, 1689 insertions(+), 35 deletions(-) create mode 100644 src/objective-c/examples/watchOS-sample/Podfile create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Base.lproj/Interface.storyboard create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Info.plist create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.h create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.m create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Info.plist create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.h create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.m create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.h create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/Contents.json create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/LaunchScreen.storyboard create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/Main.storyboard create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.h create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample/main.m diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 2dfcb311b5d..4dee494b6b5 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -41,6 +41,7 @@ Pod::Spec.new do |s| s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' s.requires_arc = false diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 2c0441ba95c..62bff003934 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -36,6 +36,7 @@ Pod::Spec.new do |s| s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' name = 'ProtoRPC' s.module_name = name diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 12a8728ac34..e9a19ac65df 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -36,6 +36,7 @@ Pod::Spec.new do |s| s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' name = 'RxLibrary' s.module_name = name diff --git a/gRPC.podspec b/gRPC.podspec index bbfd08f9774..0374e525b0d 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -35,6 +35,7 @@ Pod::Spec.new do |s| s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' name = 'GRPCClient' s.module_name = name diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 939078def22..ec88ee7a5af 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -106,6 +106,7 @@ Pod::Spec.new do |s| s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' # Restrict the gRPC runtime version to the one supported by this plugin. s.dependency 'gRPC-ProtoRPC', v diff --git a/src/objective-c/!ProtoCompiler.podspec b/src/objective-c/!ProtoCompiler.podspec index d8ce4d8e89d..b75d93a58be 100644 --- a/src/objective-c/!ProtoCompiler.podspec +++ b/src/objective-c/!ProtoCompiler.podspec @@ -113,6 +113,7 @@ Pod::Spec.new do |s| s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' # This is only for local development of protoc: If the Podfile brings this pod from a local # directory using `:path`, CocoaPods won't download the zip file and so the compiler won't be diff --git a/src/objective-c/BoringSSL-GRPC.podspec b/src/objective-c/BoringSSL-GRPC.podspec index 2ec146e7ebe..f0d9750d6d1 100644 --- a/src/objective-c/BoringSSL-GRPC.podspec +++ b/src/objective-c/BoringSSL-GRPC.podspec @@ -82,6 +82,7 @@ Pod::Spec.new do |s| s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.7' s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' name = 'openssl_grpc' diff --git a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec index 97faa0d9236..63c6ba4ad5c 100644 --- a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec @@ -10,6 +10,7 @@ Pod::Spec.new do |s| s.ios.deployment_target = '7.1' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. s.dependency "!ProtoCompiler-gRPCPlugin" diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj index 91ebf53215f..8840882b145 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj @@ -7,18 +7,17 @@ objects = { /* Begin PBXBuildFile section */ - 565ABB2FA1065F0EC355A9AA /* libPods-tvOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 968ABA42FAF2C82FA0BF740C /* libPods-tvOS-sample.a */; }; ABB17D3A22D8FB8B00C26D6E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D3922D8FB8B00C26D6E /* AppDelegate.m */; }; ABB17D3D22D8FB8B00C26D6E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D3C22D8FB8B00C26D6E /* ViewController.m */; }; ABB17D4022D8FB8B00C26D6E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D3E22D8FB8B00C26D6E /* Main.storyboard */; }; ABB17D4222D8FB8D00C26D6E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D4122D8FB8D00C26D6E /* Assets.xcassets */; }; ABB17D4522D8FB8D00C26D6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D4422D8FB8D00C26D6E /* main.m */; }; + F9B775DB1DDCBD39DF92BFA8 /* libPods-tvOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40071025CBF9E79B9522398F /* libPods-tvOS-sample.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 288D31799283F13AE615B2E7 /* Pods-tvOS-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS-sample.debug.xcconfig"; path = "Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample.debug.xcconfig"; sourceTree = ""; }; - 68CC4CF97E776A55036CCBD2 /* Pods-tvOS-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS-sample.release.xcconfig"; path = "Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample.release.xcconfig"; sourceTree = ""; }; - 968ABA42FAF2C82FA0BF740C /* libPods-tvOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-tvOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 40071025CBF9E79B9522398F /* libPods-tvOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-tvOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 93F3CF0DB110860F8E180685 /* Pods-tvOS-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS-sample.release.xcconfig"; path = "Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample.release.xcconfig"; sourceTree = ""; }; ABB17D3522D8FB8B00C26D6E /* tvOS-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "tvOS-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; ABB17D3822D8FB8B00C26D6E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; ABB17D3922D8FB8B00C26D6E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -28,6 +27,7 @@ ABB17D4122D8FB8D00C26D6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; ABB17D4322D8FB8D00C26D6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; ABB17D4422D8FB8D00C26D6E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + D2D1C60CE9BD00C1371BC913 /* Pods-tvOS-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS-sample.debug.xcconfig"; path = "Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -35,18 +35,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 565ABB2FA1065F0EC355A9AA /* libPods-tvOS-sample.a in Frameworks */, + F9B775DB1DDCBD39DF92BFA8 /* libPods-tvOS-sample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 1D5885E1FE0BFAC7841076C2 /* Pods */ = { + 28FD2EFD84992131D85ADAE6 /* Pods */ = { isa = PBXGroup; children = ( - 288D31799283F13AE615B2E7 /* Pods-tvOS-sample.debug.xcconfig */, - 68CC4CF97E776A55036CCBD2 /* Pods-tvOS-sample.release.xcconfig */, + D2D1C60CE9BD00C1371BC913 /* Pods-tvOS-sample.debug.xcconfig */, + 93F3CF0DB110860F8E180685 /* Pods-tvOS-sample.release.xcconfig */, ); name = Pods; path = Pods; @@ -57,8 +57,8 @@ children = ( ABB17D3722D8FB8B00C26D6E /* tvOS-sample */, ABB17D3622D8FB8B00C26D6E /* Products */, - 1D5885E1FE0BFAC7841076C2 /* Pods */, - EC43163F87C0DE6118957F38 /* Frameworks */, + 28FD2EFD84992131D85ADAE6 /* Pods */, + D280E557B55AAB044C083DB5 /* Frameworks */, ); sourceTree = ""; }; @@ -85,10 +85,10 @@ path = "tvOS-sample"; sourceTree = ""; }; - EC43163F87C0DE6118957F38 /* Frameworks */ = { + D280E557B55AAB044C083DB5 /* Frameworks */ = { isa = PBXGroup; children = ( - 968ABA42FAF2C82FA0BF740C /* libPods-tvOS-sample.a */, + 40071025CBF9E79B9522398F /* libPods-tvOS-sample.a */, ); name = Frameworks; sourceTree = ""; @@ -100,11 +100,11 @@ isa = PBXNativeTarget; buildConfigurationList = ABB17D4822D8FB8D00C26D6E /* Build configuration list for PBXNativeTarget "tvOS-sample" */; buildPhases = ( - 3963C36BEF44FBF8792B6A8A /* [CP] Check Pods Manifest.lock */, + BCFBD1317F97D9F34D9AFD4A /* [CP] Check Pods Manifest.lock */, ABB17D3122D8FB8B00C26D6E /* Sources */, ABB17D3222D8FB8B00C26D6E /* Frameworks */, ABB17D3322D8FB8B00C26D6E /* Resources */, - 3A325E5E27D64D1CC36130E2 /* [CP] Copy Pods Resources */, + 340B0470EBFB87C5242C058E /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -160,43 +160,43 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 3963C36BEF44FBF8792B6A8A /* [CP] Check Pods Manifest.lock */ = { + 340B0470EBFB87C5242C058E /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-tvOS-sample-checkManifestLockResult.txt", + "${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 3A325E5E27D64D1CC36130E2 /* [CP] Copy Pods Resources */ = { + BCFBD1317F97D9F34D9AFD4A /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Copy Pods Resources"; + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-tvOS-sample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -338,7 +338,7 @@ }; ABB17D4922D8FB8D00C26D6E /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 288D31799283F13AE615B2E7 /* Pods-tvOS-sample.debug.xcconfig */; + baseConfigurationReference = D2D1C60CE9BD00C1371BC913 /* Pods-tvOS-sample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; @@ -357,7 +357,7 @@ }; ABB17D4A22D8FB8D00C26D6E /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 68CC4CF97E776A55036CCBD2 /* Pods-tvOS-sample.release.xcconfig */; + baseConfigurationReference = 93F3CF0DB110860F8E180685 /* Pods-tvOS-sample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m index 1a733523f50..69e1e0ce87b 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m @@ -11,10 +11,6 @@ #import #import - -static NSString *const kPackage = @"grpc.testing"; -static NSString *const kService = @"TestService"; - @interface ViewController () @end diff --git a/src/objective-c/examples/watchOS-sample/Podfile b/src/objective-c/examples/watchOS-sample/Podfile new file mode 100644 index 00000000000..60626ca493f --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/Podfile @@ -0,0 +1,41 @@ +install! 'cocoapods', :deterministic_uuids => false + +ROOT_DIR = '../../../..' + +def grpc_deps + pod 'gRPC-ProtoRPC', :path => ROOT_DIR + pod 'gRPC', :path => ROOT_DIR + pod 'gRPC-Core', :path => ROOT_DIR + pod 'gRPC-RxLibrary', :path => ROOT_DIR + pod 'RemoteTest', :path => "../RemoteTestClient" + pod '!ProtoCompiler-gRPCPlugin', :path => "#{ROOT_DIR}/src/objective-c" + pod 'BoringSSL-GRPC', :path => "#{ROOT_DIR}/third_party/boringssl" + pod '!ProtoCompiler', :path => "#{ROOT_DIR}/src/objective-c" +end + +target 'watchOS-sample' do +platform :ios, '8.0' + grpc_deps +end + +target 'watchOS-sample WatchKit Extension' do +platform :watchos, '4.0' + grpc_deps +end + +pre_install do |installer| + grpc_core_spec = installer.pod_targets.find{|t| t.name.start_with?('gRPC-Core')}.root_spec + + src_root = "$(PODS_TARGET_SRCROOT)" + grpc_core_spec.pod_target_xcconfig = { + 'GRPC_SRC_ROOT' => src_root, + 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', + 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"', + # If we don't set these two settings, `include/grpc/support/time.h` and + # `src/core/lib/gpr/string.h` shadow the system `` and ``, breaking the + # build. + 'USE_HEADERMAP' => 'NO', + 'ALWAYS_SEARCH_USER_PATHS' => 'NO', + } +end + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000000..6c0f2b4204b --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,81 @@ +{ + "images" : [ + { + "size" : "24x24", + "idiom" : "watch", + "scale" : "2x", + "role" : "notificationCenter", + "subtype" : "38mm" + }, + { + "size" : "27.5x27.5", + "idiom" : "watch", + "scale" : "2x", + "role" : "notificationCenter", + "subtype" : "42mm" + }, + { + "size" : "29x29", + "idiom" : "watch", + "role" : "companionSettings", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "watch", + "role" : "companionSettings", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "watch", + "scale" : "2x", + "role" : "appLauncher", + "subtype" : "38mm" + }, + { + "size" : "44x44", + "idiom" : "watch", + "scale" : "2x", + "role" : "appLauncher", + "subtype" : "40mm" + }, + { + "size" : "50x50", + "idiom" : "watch", + "scale" : "2x", + "role" : "appLauncher", + "subtype" : "44mm" + }, + { + "size" : "86x86", + "idiom" : "watch", + "scale" : "2x", + "role" : "quickLook", + "subtype" : "38mm" + }, + { + "size" : "98x98", + "idiom" : "watch", + "scale" : "2x", + "role" : "quickLook", + "subtype" : "42mm" + }, + { + "size" : "108x108", + "idiom" : "watch", + "scale" : "2x", + "role" : "quickLook", + "subtype" : "44mm" + }, + { + "idiom" : "watch-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/Contents.json new file mode 100644 index 00000000000..da4a164c918 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Base.lproj/Interface.storyboard b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Base.lproj/Interface.storyboard new file mode 100644 index 00000000000..6c4d9248113 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Base.lproj/Interface.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Info.plist b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Info.plist new file mode 100644 index 00000000000..68081b1f6e0 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Info.plist @@ -0,0 +1,33 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + watchOS-sample WatchKit App + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + + WKCompanionAppBundleIdentifier + com.google.watchOS-grpc-sample + WKWatchKitApp + + + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json new file mode 100644 index 00000000000..f84499ba516 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : "<=145" + }, + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : ">145" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Contents.json new file mode 100644 index 00000000000..1571c7e531b --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Contents.json @@ -0,0 +1,48 @@ +{ + "assets" : [ + { + "idiom" : "watch", + "filename" : "Circular.imageset", + "role" : "circular" + }, + { + "idiom" : "watch", + "filename" : "Extra Large.imageset", + "role" : "extra-large" + }, + { + "idiom" : "watch", + "filename" : "Graphic Bezel.imageset", + "role" : "graphic-bezel" + }, + { + "idiom" : "watch", + "filename" : "Graphic Circular.imageset", + "role" : "graphic-circular" + }, + { + "idiom" : "watch", + "filename" : "Graphic Corner.imageset", + "role" : "graphic-corner" + }, + { + "idiom" : "watch", + "filename" : "Graphic Large Rectangular.imageset", + "role" : "graphic-large-rectangular" + }, + { + "idiom" : "watch", + "filename" : "Modular.imageset", + "role" : "modular" + }, + { + "idiom" : "watch", + "filename" : "Utilitarian.imageset", + "role" : "utilitarian" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json new file mode 100644 index 00000000000..f84499ba516 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : "<=145" + }, + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : ">145" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json new file mode 100644 index 00000000000..f84499ba516 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : "<=145" + }, + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : ">145" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json new file mode 100644 index 00000000000..f84499ba516 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : "<=145" + }, + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : ">145" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json new file mode 100644 index 00000000000..f84499ba516 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : "<=145" + }, + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : ">145" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json new file mode 100644 index 00000000000..f84499ba516 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : "<=145" + }, + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : ">145" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json new file mode 100644 index 00000000000..f84499ba516 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : "<=145" + }, + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : ">145" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json new file mode 100644 index 00000000000..f84499ba516 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : "<=145" + }, + { + "idiom" : "watch", + "scale" : "2x", + "screen-width" : ">145" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Contents.json new file mode 100644 index 00000000000..da4a164c918 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.h b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.h new file mode 100644 index 00000000000..df2e8e156b6 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.h @@ -0,0 +1,13 @@ +// +// ExtensionDelegate.h +// watchOS-sample WatchKit Extension +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import + +@interface ExtensionDelegate : NSObject + +@end diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.m b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.m new file mode 100644 index 00000000000..97d553aa855 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.m @@ -0,0 +1,61 @@ +// +// ExtensionDelegate.m +// watchOS-sample WatchKit Extension +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import "ExtensionDelegate.h" + +@implementation ExtensionDelegate + +- (void)applicationDidFinishLaunching { + // Perform any final initialization of your application. +} + +- (void)applicationDidBecomeActive { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillResignActive { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, etc. +} + +- (void)handleBackgroundTasks:(NSSet *)backgroundTasks { + // Sent when the system needs to launch the application in the background to process tasks. Tasks arrive in a set, so loop through and process each one. + for (WKRefreshBackgroundTask * task in backgroundTasks) { + // Check the Class of each task to decide how to process it + if ([task isKindOfClass:[WKApplicationRefreshBackgroundTask class]]) { + // Be sure to complete the background task once you’re done. + WKApplicationRefreshBackgroundTask *backgroundTask = (WKApplicationRefreshBackgroundTask*)task; + [backgroundTask setTaskCompletedWithSnapshot:NO]; + } else if ([task isKindOfClass:[WKSnapshotRefreshBackgroundTask class]]) { + // Snapshot tasks have a unique completion call, make sure to set your expiration date + WKSnapshotRefreshBackgroundTask *snapshotTask = (WKSnapshotRefreshBackgroundTask*)task; + [snapshotTask setTaskCompletedWithDefaultStateRestored:YES estimatedSnapshotExpiration:[NSDate distantFuture] userInfo:nil]; + } else if ([task isKindOfClass:[WKWatchConnectivityRefreshBackgroundTask class]]) { + // Be sure to complete the background task once you’re done. + WKWatchConnectivityRefreshBackgroundTask *backgroundTask = (WKWatchConnectivityRefreshBackgroundTask*)task; + [backgroundTask setTaskCompletedWithSnapshot:NO]; + } else if ([task isKindOfClass:[WKURLSessionRefreshBackgroundTask class]]) { + // Be sure to complete the background task once you’re done. + WKURLSessionRefreshBackgroundTask *backgroundTask = (WKURLSessionRefreshBackgroundTask*)task; + [backgroundTask setTaskCompletedWithSnapshot:NO]; + } else if ([task isKindOfClass:[WKRelevantShortcutRefreshBackgroundTask class]]) { + // Be sure to complete the relevant-shortcut task once you’re done. + WKRelevantShortcutRefreshBackgroundTask *relevantShortcutTask = (WKRelevantShortcutRefreshBackgroundTask*)task; + [relevantShortcutTask setTaskCompletedWithSnapshot:NO]; + } else if ([task isKindOfClass:[WKIntentDidRunRefreshBackgroundTask class]]) { + // Be sure to complete the intent-did-run task once you’re done. + WKIntentDidRunRefreshBackgroundTask *intentDidRunTask = (WKIntentDidRunRefreshBackgroundTask*)task; + [intentDidRunTask setTaskCompletedWithSnapshot:NO]; + } else { + // make sure to complete unhandled task types + [task setTaskCompletedWithSnapshot:NO]; + } + } +} + +@end diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Info.plist b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Info.plist new file mode 100644 index 00000000000..457a48af2d8 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Info.plist @@ -0,0 +1,36 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + watchOS-sample WatchKit Extension + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + XPC! + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + NSExtension + + NSExtensionAttributes + + WKAppBundleIdentifier + com.google.watchOS-grpc-sample.watchkitapp + + NSExtensionPointIdentifier + com.apple.watchkit + + WKExtensionDelegateClassName + ExtensionDelegate + + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.h b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.h new file mode 100644 index 00000000000..cd5752bcc5c --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.h @@ -0,0 +1,14 @@ +// +// InterfaceController.h +// watchOS-sample WatchKit Extension +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import +#import + +@interface InterfaceController : WKInterfaceController + +@end diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.m b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.m new file mode 100644 index 00000000000..9722a80ca50 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.m @@ -0,0 +1,68 @@ +// +// InterfaceController.m +// watchOS-sample WatchKit Extension +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import "InterfaceController.h" + +#import +#import + +@interface InterfaceController () + +@end + + +@implementation InterfaceController { + GRPCCallOptions *_options; + RMTTestService *_service; +} + +- (void)awakeWithContext:(id)context { + [super awakeWithContext:context]; + + // Configure interface objects here. + + + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + _options = options; + + _service = [[RMTTestService alloc] initWithHost:@"grpc-test.sandbox.googleapis.com" + callOptions:_options]; +} + +- (void)willActivate { + // This method is called when watch view controller is about to be visible to user + [super willActivate]; +} + +- (void)didDeactivate { + // This method is called when watch view controller is no longer visible + [super didDeactivate]; +} + +- (IBAction)makeCall { + + RMTSimpleRequest *request = [RMTSimpleRequest message]; + request.responseSize = 100; + GRPCUnaryProtoCall *call = [_service unaryCallWithMessage:request + responseHandler:self + callOptions:nil]; + [call start]; +} + +- (void)didReceiveProtoMessage:(GPBMessage *)message { + NSLog(@"%@", [message data]); +} + +- (dispatch_queue_t)dispatchQueue { + return dispatch_get_main_queue(); +} + +@end + + + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..12e7f29b7a0 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj @@ -0,0 +1,750 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + 8C710D86B987697CC3B243A8 /* libPods-watchOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 56BDF7E8B01683A4EFDEC9CF /* libPods-watchOS-sample.a */; }; + 8F4EFFA8E14960D3C5BD0046 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 76AFD66D880975F945E377C9 /* libPods-watchOS-sample WatchKit Extension.a */; }; + ABB17D5922D93BAB00C26D6E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D5822D93BAB00C26D6E /* AppDelegate.m */; }; + ABB17D5C22D93BAB00C26D6E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D5B22D93BAB00C26D6E /* ViewController.m */; }; + ABB17D5F22D93BAB00C26D6E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D5D22D93BAB00C26D6E /* Main.storyboard */; }; + ABB17D6122D93BAC00C26D6E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D6022D93BAC00C26D6E /* Assets.xcassets */; }; + ABB17D6422D93BAC00C26D6E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D6222D93BAC00C26D6E /* LaunchScreen.storyboard */; }; + ABB17D6722D93BAC00C26D6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D6622D93BAC00C26D6E /* main.m */; }; + ABB17D6B22D93BAC00C26D6E /* watchOS-sample WatchKit App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = ABB17D6A22D93BAC00C26D6E /* watchOS-sample WatchKit App.app */; }; + ABB17D7122D93BAC00C26D6E /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D6F22D93BAC00C26D6E /* Interface.storyboard */; }; + ABB17D7322D93BAC00C26D6E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D7222D93BAC00C26D6E /* Assets.xcassets */; }; + ABB17D7A22D93BAC00C26D6E /* watchOS-sample WatchKit Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = ABB17D7922D93BAC00C26D6E /* watchOS-sample WatchKit Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + ABB17D8022D93BAC00C26D6E /* InterfaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D7F22D93BAC00C26D6E /* InterfaceController.m */; }; + ABB17D8322D93BAC00C26D6E /* ExtensionDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D8222D93BAC00C26D6E /* ExtensionDelegate.m */; }; + ABB17D8522D93BAD00C26D6E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D8422D93BAD00C26D6E /* Assets.xcassets */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + ABB17D6C22D93BAC00C26D6E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = ABB17D4C22D93BAB00C26D6E /* Project object */; + proxyType = 1; + remoteGlobalIDString = ABB17D6922D93BAC00C26D6E; + remoteInfo = "watchOS-sample WatchKit App"; + }; + ABB17D7B22D93BAC00C26D6E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = ABB17D4C22D93BAB00C26D6E /* Project object */; + proxyType = 1; + remoteGlobalIDString = ABB17D7822D93BAC00C26D6E; + remoteInfo = "watchOS-sample WatchKit Extension"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + ABB17D8C22D93BAD00C26D6E /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + ABB17D7A22D93BAC00C26D6E /* watchOS-sample WatchKit Extension.appex in Embed App Extensions */, + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; + ABB17D9022D93BAD00C26D6E /* Embed Watch Content */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(CONTENTS_FOLDER_PATH)/Watch"; + dstSubfolderSpec = 16; + files = ( + ABB17D6B22D93BAC00C26D6E /* watchOS-sample WatchKit App.app in Embed Watch Content */, + ); + name = "Embed Watch Content"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0D53169393FEB36944484D25 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample WatchKit Extension.release.xcconfig"; path = "Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension.release.xcconfig"; sourceTree = ""; }; + 56BDF7E8B01683A4EFDEC9CF /* libPods-watchOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 76AFD66D880975F945E377C9 /* libPods-watchOS-sample WatchKit Extension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample WatchKit Extension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 7DB8462D385A70A534800DAF /* Pods-watchOS-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample.release.xcconfig"; path = "Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample.release.xcconfig"; sourceTree = ""; }; + 8C5540E3A034586596BEFE2B /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample WatchKit Extension.debug.xcconfig"; path = "Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension.debug.xcconfig"; sourceTree = ""; }; + ABB17D5422D93BAB00C26D6E /* watchOS-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "watchOS-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + ABB17D5722D93BAB00C26D6E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + ABB17D5822D93BAB00C26D6E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + ABB17D5A22D93BAB00C26D6E /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + ABB17D5B22D93BAB00C26D6E /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + ABB17D5E22D93BAB00C26D6E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + ABB17D6022D93BAC00C26D6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + ABB17D6322D93BAC00C26D6E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + ABB17D6522D93BAC00C26D6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + ABB17D6622D93BAC00C26D6E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + ABB17D6A22D93BAC00C26D6E /* watchOS-sample WatchKit App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "watchOS-sample WatchKit App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + ABB17D7022D93BAC00C26D6E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Interface.storyboard; sourceTree = ""; }; + ABB17D7222D93BAC00C26D6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + ABB17D7422D93BAC00C26D6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + ABB17D7922D93BAC00C26D6E /* watchOS-sample WatchKit Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "watchOS-sample WatchKit Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; + ABB17D7E22D93BAC00C26D6E /* InterfaceController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InterfaceController.h; sourceTree = ""; }; + ABB17D7F22D93BAC00C26D6E /* InterfaceController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InterfaceController.m; sourceTree = ""; }; + ABB17D8122D93BAC00C26D6E /* ExtensionDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExtensionDelegate.h; sourceTree = ""; }; + ABB17D8222D93BAC00C26D6E /* ExtensionDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExtensionDelegate.m; sourceTree = ""; }; + ABB17D8422D93BAD00C26D6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + ABB17D8622D93BAD00C26D6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + CC865626944D2C3DD838F762 /* Pods-watchOS-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample.debug.xcconfig"; path = "Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + ABB17D5122D93BAB00C26D6E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8C710D86B987697CC3B243A8 /* libPods-watchOS-sample.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + ABB17D7622D93BAC00C26D6E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8F4EFFA8E14960D3C5BD0046 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F374C9EC9D24282B20A64719 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2C4A0708747AAA7298F757DA /* Pods */ = { + isa = PBXGroup; + children = ( + CC865626944D2C3DD838F762 /* Pods-watchOS-sample.debug.xcconfig */, + 7DB8462D385A70A534800DAF /* Pods-watchOS-sample.release.xcconfig */, + 8C5540E3A034586596BEFE2B /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */, + 0D53169393FEB36944484D25 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + 589283F4A582EEF2434E0220 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 56BDF7E8B01683A4EFDEC9CF /* libPods-watchOS-sample.a */, + 76AFD66D880975F945E377C9 /* libPods-watchOS-sample WatchKit Extension.a */, + ); + name = Frameworks; + sourceTree = ""; + }; + ABB17D4B22D93BAB00C26D6E = { + isa = PBXGroup; + children = ( + ABB17D5622D93BAB00C26D6E /* watchOS-sample */, + ABB17D6E22D93BAC00C26D6E /* watchOS-sample WatchKit App */, + ABB17D7D22D93BAC00C26D6E /* watchOS-sample WatchKit Extension */, + ABB17D5522D93BAB00C26D6E /* Products */, + 2C4A0708747AAA7298F757DA /* Pods */, + 589283F4A582EEF2434E0220 /* Frameworks */, + ); + sourceTree = ""; + }; + ABB17D5522D93BAB00C26D6E /* Products */ = { + isa = PBXGroup; + children = ( + ABB17D5422D93BAB00C26D6E /* watchOS-sample.app */, + ABB17D6A22D93BAC00C26D6E /* watchOS-sample WatchKit App.app */, + ABB17D7922D93BAC00C26D6E /* watchOS-sample WatchKit Extension.appex */, + ); + name = Products; + sourceTree = ""; + }; + ABB17D5622D93BAB00C26D6E /* watchOS-sample */ = { + isa = PBXGroup; + children = ( + ABB17D5722D93BAB00C26D6E /* AppDelegate.h */, + ABB17D5822D93BAB00C26D6E /* AppDelegate.m */, + ABB17D5A22D93BAB00C26D6E /* ViewController.h */, + ABB17D5B22D93BAB00C26D6E /* ViewController.m */, + ABB17D5D22D93BAB00C26D6E /* Main.storyboard */, + ABB17D6022D93BAC00C26D6E /* Assets.xcassets */, + ABB17D6222D93BAC00C26D6E /* LaunchScreen.storyboard */, + ABB17D6522D93BAC00C26D6E /* Info.plist */, + ABB17D6622D93BAC00C26D6E /* main.m */, + ); + path = "watchOS-sample"; + sourceTree = ""; + }; + ABB17D6E22D93BAC00C26D6E /* watchOS-sample WatchKit App */ = { + isa = PBXGroup; + children = ( + ABB17D6F22D93BAC00C26D6E /* Interface.storyboard */, + ABB17D7222D93BAC00C26D6E /* Assets.xcassets */, + ABB17D7422D93BAC00C26D6E /* Info.plist */, + ); + path = "watchOS-sample WatchKit App"; + sourceTree = ""; + }; + ABB17D7D22D93BAC00C26D6E /* watchOS-sample WatchKit Extension */ = { + isa = PBXGroup; + children = ( + ABB17D7E22D93BAC00C26D6E /* InterfaceController.h */, + ABB17D7F22D93BAC00C26D6E /* InterfaceController.m */, + ABB17D8122D93BAC00C26D6E /* ExtensionDelegate.h */, + ABB17D8222D93BAC00C26D6E /* ExtensionDelegate.m */, + ABB17D8422D93BAD00C26D6E /* Assets.xcassets */, + ABB17D8622D93BAD00C26D6E /* Info.plist */, + ); + path = "watchOS-sample WatchKit Extension"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + ABB17D5322D93BAB00C26D6E /* watchOS-sample */ = { + isa = PBXNativeTarget; + buildConfigurationList = ABB17D9122D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample" */; + buildPhases = ( + 94316399D2F0BC04388E77B0 /* [CP] Check Pods Manifest.lock */, + ABB17D5022D93BAB00C26D6E /* Sources */, + ABB17D5122D93BAB00C26D6E /* Frameworks */, + ABB17D5222D93BAB00C26D6E /* Resources */, + ABB17D9022D93BAD00C26D6E /* Embed Watch Content */, + 1E38C9CB686CAEF71A5A25B7 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ABB17D6D22D93BAC00C26D6E /* PBXTargetDependency */, + ); + name = "watchOS-sample"; + productName = "watchOS-sample"; + productReference = ABB17D5422D93BAB00C26D6E /* watchOS-sample.app */; + productType = "com.apple.product-type.application"; + }; + ABB17D6922D93BAC00C26D6E /* watchOS-sample WatchKit App */ = { + isa = PBXNativeTarget; + buildConfigurationList = ABB17D8D22D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample WatchKit App" */; + buildPhases = ( + ABB17D6822D93BAC00C26D6E /* Resources */, + ABB17D8C22D93BAD00C26D6E /* Embed App Extensions */, + F374C9EC9D24282B20A64719 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ABB17D7C22D93BAC00C26D6E /* PBXTargetDependency */, + ); + name = "watchOS-sample WatchKit App"; + productName = "watchOS-sample WatchKit App"; + productReference = ABB17D6A22D93BAC00C26D6E /* watchOS-sample WatchKit App.app */; + productType = "com.apple.product-type.application.watchapp2"; + }; + ABB17D7822D93BAC00C26D6E /* watchOS-sample WatchKit Extension */ = { + isa = PBXNativeTarget; + buildConfigurationList = ABB17D8922D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample WatchKit Extension" */; + buildPhases = ( + 097AA61E20DEB1DB1E771FC9 /* [CP] Check Pods Manifest.lock */, + ABB17D7522D93BAC00C26D6E /* Sources */, + ABB17D7622D93BAC00C26D6E /* Frameworks */, + ABB17D7722D93BAC00C26D6E /* Resources */, + 8F82497BD93485F0621F0F30 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "watchOS-sample WatchKit Extension"; + productName = "watchOS-sample WatchKit Extension"; + productReference = ABB17D7922D93BAC00C26D6E /* watchOS-sample WatchKit Extension.appex */; + productType = "com.apple.product-type.watchkit2-extension"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + ABB17D4C22D93BAB00C26D6E /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = "Tony Lu"; + TargetAttributes = { + ABB17D5322D93BAB00C26D6E = { + CreatedOnToolsVersion = 10.1; + }; + ABB17D6922D93BAC00C26D6E = { + CreatedOnToolsVersion = 10.1; + }; + ABB17D7822D93BAC00C26D6E = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = ABB17D4F22D93BAB00C26D6E /* Build configuration list for PBXProject "watchOS-sample" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = ABB17D4B22D93BAB00C26D6E; + productRefGroup = ABB17D5522D93BAB00C26D6E /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + ABB17D5322D93BAB00C26D6E /* watchOS-sample */, + ABB17D6922D93BAC00C26D6E /* watchOS-sample WatchKit App */, + ABB17D7822D93BAC00C26D6E /* watchOS-sample WatchKit Extension */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + ABB17D5222D93BAB00C26D6E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ABB17D6422D93BAC00C26D6E /* LaunchScreen.storyboard in Resources */, + ABB17D6122D93BAC00C26D6E /* Assets.xcassets in Resources */, + ABB17D5F22D93BAB00C26D6E /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + ABB17D6822D93BAC00C26D6E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ABB17D7322D93BAC00C26D6E /* Assets.xcassets in Resources */, + ABB17D7122D93BAC00C26D6E /* Interface.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + ABB17D7722D93BAC00C26D6E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ABB17D8522D93BAD00C26D6E /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 097AA61E20DEB1DB1E771FC9 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-watchOS-sample WatchKit Extension-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 1E38C9CB686CAEF71A5A25B7 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 8F82497BD93485F0621F0F30 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 94316399D2F0BC04388E77B0 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-watchOS-sample-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + ABB17D5022D93BAB00C26D6E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ABB17D5C22D93BAB00C26D6E /* ViewController.m in Sources */, + ABB17D6722D93BAC00C26D6E /* main.m in Sources */, + ABB17D5922D93BAB00C26D6E /* AppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + ABB17D7522D93BAC00C26D6E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ABB17D8322D93BAC00C26D6E /* ExtensionDelegate.m in Sources */, + ABB17D8022D93BAC00C26D6E /* InterfaceController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + ABB17D6D22D93BAC00C26D6E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = ABB17D6922D93BAC00C26D6E /* watchOS-sample WatchKit App */; + targetProxy = ABB17D6C22D93BAC00C26D6E /* PBXContainerItemProxy */; + }; + ABB17D7C22D93BAC00C26D6E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = ABB17D7822D93BAC00C26D6E /* watchOS-sample WatchKit Extension */; + targetProxy = ABB17D7B22D93BAC00C26D6E /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + ABB17D5D22D93BAB00C26D6E /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + ABB17D5E22D93BAB00C26D6E /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + ABB17D6222D93BAC00C26D6E /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + ABB17D6322D93BAC00C26D6E /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; + ABB17D6F22D93BAC00C26D6E /* Interface.storyboard */ = { + isa = PBXVariantGroup; + children = ( + ABB17D7022D93BAC00C26D6E /* Base */, + ); + name = Interface.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + ABB17D8722D93BAD00C26D6E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + ABB17D8822D93BAD00C26D6E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + ABB17D8A22D93BAD00C26D6E /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 8C5540E3A034586596BEFE2B /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + INFOPLIST_FILE = "watchOS-sample WatchKit Extension/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp.watchkitextension"; + PRODUCT_NAME = "${TARGET_NAME}"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 4; + WATCHOS_DEPLOYMENT_TARGET = 5.1; + }; + name = Debug; + }; + ABB17D8B22D93BAD00C26D6E /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 0D53169393FEB36944484D25 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + INFOPLIST_FILE = "watchOS-sample WatchKit Extension/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp.watchkitextension"; + PRODUCT_NAME = "${TARGET_NAME}"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 4; + WATCHOS_DEPLOYMENT_TARGET = 5.1; + }; + name = Release; + }; + ABB17D8E22D93BAD00C26D6E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + IBSC_MODULE = watchOS_sample_WatchKit_Extension; + INFOPLIST_FILE = "watchOS-sample WatchKit App/Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 4; + WATCHOS_DEPLOYMENT_TARGET = 5.1; + }; + name = Debug; + }; + ABB17D8F22D93BAD00C26D6E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + IBSC_MODULE = watchOS_sample_WatchKit_Extension; + INFOPLIST_FILE = "watchOS-sample WatchKit App/Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 4; + WATCHOS_DEPLOYMENT_TARGET = 5.1; + }; + name = Release; + }; + ABB17D9222D93BAD00C26D6E /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CC865626944D2C3DD838F762 /* Pods-watchOS-sample.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + INFOPLIST_FILE = "watchOS-sample/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + ABB17D9322D93BAD00C26D6E /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7DB8462D385A70A534800DAF /* Pods-watchOS-sample.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + INFOPLIST_FILE = "watchOS-sample/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + ABB17D4F22D93BAB00C26D6E /* Build configuration list for PBXProject "watchOS-sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ABB17D8722D93BAD00C26D6E /* Debug */, + ABB17D8822D93BAD00C26D6E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + ABB17D8922D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample WatchKit Extension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ABB17D8A22D93BAD00C26D6E /* Debug */, + ABB17D8B22D93BAD00C26D6E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + ABB17D8D22D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample WatchKit App" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ABB17D8E22D93BAD00C26D6E /* Debug */, + ABB17D8F22D93BAD00C26D6E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + ABB17D9122D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ABB17D9222D93BAD00C26D6E /* Debug */, + ABB17D9322D93BAD00C26D6E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = ABB17D4C22D93BAB00C26D6E /* Project object */; +} diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.h b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.h new file mode 100644 index 00000000000..762a16888a2 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.h @@ -0,0 +1,17 @@ +// +// AppDelegate.h +// watchOS-sample +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m new file mode 100644 index 00000000000..1f77c1fb15c --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m @@ -0,0 +1,51 @@ +// +// AppDelegate.m +// watchOS-sample +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. +} + + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. +} + + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + + +@end diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000000..d8db8d65fd7 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/Contents.json new file mode 100644 index 00000000000..da4a164c918 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/LaunchScreen.storyboard b/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000000..bfa36129419 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/Main.storyboard b/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/Main.storyboard new file mode 100644 index 00000000000..123b8115aa4 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/Main.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist b/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist new file mode 100644 index 00000000000..16be3b68112 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.h b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.h new file mode 100644 index 00000000000..336e0ee57f2 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// watchOS-sample +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m new file mode 100644 index 00000000000..bc2f24a168b --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m @@ -0,0 +1,25 @@ +// +// ViewController.m +// watchOS-sample +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import "ViewController.h" + +#import + +@interface ViewController () + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. +} + + +@end diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m new file mode 100644 index 00000000000..a57a3cac1a5 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m @@ -0,0 +1,16 @@ +// +// main.m +// watchOS-sample +// +// Created by Tony Lu on 7/12/19. +// Copyright © 2019 Tony Lu. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} From 46de95536a16472c517393934052119ab297b124 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Sun, 14 Jul 2019 09:03:37 +1200 Subject: [PATCH 059/661] Move ClientBase to Grpc.Core.Api, change client project references to Grpc.Core.Api, use ChannelBase in codegen --- src/compiler/csharp_generator.cc | 2 +- .../ClientBase.cs | 0 .../Internal/UnimplementedCallInvoker.cs | 60 +++++++++++++++++++ src/csharp/Grpc.Core.Api/LiteClientBase.cs | 36 +---------- .../Grpc.HealthCheck.Tests.csproj | 3 +- .../Grpc.HealthCheck/Grpc.HealthCheck.csproj | 4 +- src/csharp/Grpc.HealthCheck/HealthGrpc.cs | 2 +- .../Grpc.Reflection.Tests.csproj | 3 +- .../Grpc.Reflection/Grpc.Reflection.csproj | 2 +- src/csharp/Grpc.Reflection/ReflectionGrpc.cs | 2 +- 10 files changed, 71 insertions(+), 43 deletions(-) rename src/csharp/{Grpc.Core => Grpc.Core.Api}/ClientBase.cs (100%) create mode 100644 src/csharp/Grpc.Core.Api/Internal/UnimplementedCallInvoker.cs diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index a45408a4cb8..386d1783b9f 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -437,7 +437,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service, "/// The channel to use to make remote " "calls.\n", "servicename", GetServiceClassName(service)); - out->Print("public $name$(grpc::Channel channel) : base(channel)\n", "name", + out->Print("public $name$(grpc::ChannelBase channel) : base(channel)\n", "name", GetClientClassName(service)); out->Print("{\n"); out->Print("}\n"); diff --git a/src/csharp/Grpc.Core/ClientBase.cs b/src/csharp/Grpc.Core.Api/ClientBase.cs similarity index 100% rename from src/csharp/Grpc.Core/ClientBase.cs rename to src/csharp/Grpc.Core.Api/ClientBase.cs diff --git a/src/csharp/Grpc.Core.Api/Internal/UnimplementedCallInvoker.cs b/src/csharp/Grpc.Core.Api/Internal/UnimplementedCallInvoker.cs new file mode 100644 index 00000000000..c7be74ecf30 --- /dev/null +++ b/src/csharp/Grpc.Core.Api/Internal/UnimplementedCallInvoker.cs @@ -0,0 +1,60 @@ +#region Copyright notice and license + +// Copyright 2015-2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Threading.Tasks; +using Grpc.Core; +using Grpc.Core.Utils; + +namespace Grpc.Core.Internal +{ + /// + /// Call invoker that throws NotImplementedException for all requests. + /// + internal class UnimplementedCallInvoker : CallInvoker + { + public UnimplementedCallInvoker() + { + } + + public override TResponse BlockingUnaryCall(Method method, string host, CallOptions options, TRequest request) + { + throw new NotImplementedException(); + } + + public override AsyncUnaryCall AsyncUnaryCall(Method method, string host, CallOptions options, TRequest request) + { + throw new NotImplementedException(); + } + + public override AsyncServerStreamingCall AsyncServerStreamingCall(Method method, string host, CallOptions options, TRequest request) + { + throw new NotImplementedException(); + } + + public override AsyncClientStreamingCall AsyncClientStreamingCall(Method method, string host, CallOptions options) + { + throw new NotImplementedException(); + } + + public override AsyncDuplexStreamingCall AsyncDuplexStreamingCall(Method method, string host, CallOptions options) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/csharp/Grpc.Core.Api/LiteClientBase.cs b/src/csharp/Grpc.Core.Api/LiteClientBase.cs index c3215f016a0..132f10a912f 100644 --- a/src/csharp/Grpc.Core.Api/LiteClientBase.cs +++ b/src/csharp/Grpc.Core.Api/LiteClientBase.cs @@ -17,6 +17,7 @@ #endregion using System; +using Grpc.Core.Internal; using Grpc.Core.Utils; namespace Grpc.Core @@ -58,40 +59,5 @@ namespace Grpc.Core { get { return this.callInvoker; } } - - /// - /// Call invoker that throws NotImplementedException for all requests. - /// - private class UnimplementedCallInvoker : CallInvoker - { - public UnimplementedCallInvoker() - { - } - - public override TResponse BlockingUnaryCall(Method method, string host, CallOptions options, TRequest request) - { - throw new NotImplementedException(); - } - - public override AsyncUnaryCall AsyncUnaryCall(Method method, string host, CallOptions options, TRequest request) - { - throw new NotImplementedException(); - } - - public override AsyncServerStreamingCall AsyncServerStreamingCall(Method method, string host, CallOptions options, TRequest request) - { - throw new NotImplementedException(); - } - - public override AsyncClientStreamingCall AsyncClientStreamingCall(Method method, string host, CallOptions options) - { - throw new NotImplementedException(); - } - - public override AsyncDuplexStreamingCall AsyncDuplexStreamingCall(Method method, string host, CallOptions options) - { - throw new NotImplementedException(); - } - } } } diff --git a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj index 223c9985ecd..05f7320ad57 100755 --- a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj +++ b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -10,6 +10,7 @@ + diff --git a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj index 7e8a8a7de87..391aee81cbc 100755 --- a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj +++ b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj @@ -1,4 +1,4 @@ - + @@ -26,7 +26,7 @@ - + None diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index 7137b907274..d5051f3b05a 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -102,7 +102,7 @@ namespace Grpc.Health.V1 { { /// Creates a new client for Health /// The channel to use to make remote calls. - public HealthClient(grpc::Channel channel) : base(channel) + public HealthClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for Health that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj b/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj index ef9d2a1c570..e19020808f7 100755 --- a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj +++ b/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -10,6 +10,7 @@ + diff --git a/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj b/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj index cf08e58ed65..4dbc8d69390 100755 --- a/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj +++ b/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj @@ -26,7 +26,7 @@ - + None diff --git a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs index f97b3143a69..fa482eba494 100644 --- a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs +++ b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs @@ -69,7 +69,7 @@ namespace Grpc.Reflection.V1Alpha { { /// Creates a new client for ServerReflection /// The channel to use to make remote calls. - public ServerReflectionClient(grpc::Channel channel) : base(channel) + public ServerReflectionClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for ServerReflection that uses a custom CallInvoker. From 8ca58d55fe6d50951f14714ad6bdef40b07b155c Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Sun, 14 Jul 2019 09:10:49 +1200 Subject: [PATCH 060/661] Add ClientBase type forward --- src/csharp/Grpc.Core/ForwardedTypes.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/csharp/Grpc.Core/ForwardedTypes.cs b/src/csharp/Grpc.Core/ForwardedTypes.cs index fb99cfc018d..ad30814eb70 100644 --- a/src/csharp/Grpc.Core/ForwardedTypes.cs +++ b/src/csharp/Grpc.Core/ForwardedTypes.cs @@ -38,6 +38,8 @@ using Grpc.Core.Utils; [assembly:TypeForwardedToAttribute(typeof(CallInvoker))] [assembly:TypeForwardedToAttribute(typeof(CallInvokerExtensions))] [assembly:TypeForwardedToAttribute(typeof(CallOptions))] +[assembly:TypeForwardedToAttribute(typeof(ClientBase))] +[assembly:TypeForwardedToAttribute(typeof(ClientBase<>))] [assembly:TypeForwardedToAttribute(typeof(ClientInterceptorContext<,>))] [assembly:TypeForwardedToAttribute(typeof(ContextPropagationOptions))] [assembly:TypeForwardedToAttribute(typeof(ContextPropagationToken))] From 9e65a8876290bdd782e197fe8b98c35530c90427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Sobala?= Date: Mon, 15 Jul 2019 16:11:35 +0200 Subject: [PATCH 061/661] Fixed "implicitly-declared operator=" error from gcc 9 --- include/grpcpp/impl/codegen/call_op_set.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/grpcpp/impl/codegen/call_op_set.h b/include/grpcpp/impl/codegen/call_op_set.h index 84d1407cbe2..814cf29f913 100644 --- a/include/grpcpp/impl/codegen/call_op_set.h +++ b/include/grpcpp/impl/codegen/call_op_set.h @@ -88,6 +88,9 @@ class WriteOptions { WriteOptions(const WriteOptions& other) : flags_(other.flags_), last_message_(other.last_message_) {} + /// Default assignment operator + WriteOptions& operator=(const WriteOptions& other) = default; + /// Clear all flags. inline void Clear() { flags_ = 0; } From bb04e070b3177d7bd8e69c4086dc420f662b8f28 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Mon, 15 Jul 2019 11:34:04 -0700 Subject: [PATCH 062/661] doc/statuscodes.md: Remove HTTP status codes The HTTP status codes are more for REST; they don't work with gRPC. We shouldn't be encouraging them and they are confusing when you compare them to doc/http-grpc-status-mapping.md . --- doc/statuscodes.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/doc/statuscodes.md b/doc/statuscodes.md index a5c395d0ceb..ac34da591fc 100644 --- a/doc/statuscodes.md +++ b/doc/statuscodes.md @@ -3,25 +3,25 @@ gRPC uses a set of well defined status codes as part of the RPC API. These statuses are defined as such: -| Code | Number | Description | Closest HTTP Mapping | -|------------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------| -| OK | 0 | Not an error; returned on success. | 200 OK | -| CANCELLED | 1 | The operation was cancelled, typically by the caller. | 499 Client Closed Request | -| UNKNOWN | 2 | Unknown error. For example, this error may be returned when a `Status` value received from another address space belongs to an error space that is not known in this address space. Also errors raised by APIs that do not return enough error information may be converted to this error. | 500 Internal Server Error | -| INVALID_ARGUMENT | 3 | The client specified an invalid argument. Note that this differs from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments that are problematic regardless of the state of the system (e.g., a malformed file name). | 400 Bad Request | -| DEADLINE_EXCEEDED | 4 | The deadline expired before the operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long | 504 Gateway Timeout | -| NOT_FOUND | 5 | Some requested entity (e.g., file or directory) was not found. Note to server developers: if a request is denied for an entire class of users, such as gradual feature rollout or undocumented whitelist, `NOT_FOUND` may be used. If a request is denied for some users within a class of users, such as user-based access control, `PERMISSION_DENIED` must be used. | 404 Not Found | -| ALREADY_EXISTS | 6 | The entity that a client attempted to create (e.g., file or directory) already exists. | 409 Conflict | -| PERMISSION_DENIED | 7 | The caller does not have permission to execute the specified operation. `PERMISSION_DENIED` must not be used for rejections caused by exhausting some resource (use `RESOURCE_EXHAUSTED` instead for those errors). `PERMISSION_DENIED` must not be used if the caller can not be identified (use `UNAUTHENTICATED` instead for those errors). This error code does not imply the request is valid or the requested entity exists or satisfies other pre-conditions. | 403 Forbidden | -| UNAUTHENTICATED | 16 | The request does not have valid authentication credentials for the operation. | 401 Unauthorized | -| RESOURCE_EXHAUSTED | 8 | Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space. | 429 Too Many Requests | -| FAILED_PRECONDITION | 9 | The operation was rejected because the system is not in a state required for the operation's execution. For example, the directory to be deleted is non-empty, an rmdir operation is applied to a non-directory, etc. Service implementors can use the following guidelines to decide between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: (a) Use `UNAVAILABLE` if the client can retry just the failing call. (b) Use `ABORTED` if the client should retry at a higher level (e.g., when a client-specified test-and-set fails, indicating the client should restart a read-modify-write sequence). (c) Use `FAILED_PRECONDITION` if the client should not retry until the system state has been explicitly fixed. E.g., if an "rmdir" fails because the directory is non-empty, `FAILED_PRECONDITION` should be returned since the client should not retry unless the files are deleted from the directory. | 400 Bad Request | -| ABORTED | 10 | The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort. See the guidelines above for deciding between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`. | 409 Conflict | -| OUT_OF_RANGE | 11 | The operation was attempted past the valid range. E.g., seeking or reading past end-of-file. Unlike `INVALID_ARGUMENT`, this error indicates a problem that may be fixed if the system state changes. For example, a 32-bit file system will generate `INVALID_ARGUMENT` if asked to read at an offset that is not in the range [0,2^32-1], but it will generate `OUT_OF_RANGE` if asked to read from an offset past the current file size. There is a fair bit of overlap between `FAILED_PRECONDITION` and `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific error) when it applies so that callers who are iterating through a space can easily look for an `OUT_OF_RANGE` error to detect when they are done. | 400 Bad Request | -| UNIMPLEMENTED | 12 | The operation is not implemented or is not supported/enabled in this service. | 501 Not Implemented | -| INTERNAL | 13 | Internal errors. This means that some invariants expected by the underlying system have been broken. This error code is reserved for serious errors. | 500 Internal Server Error | -| UNAVAILABLE | 14 | The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff. Note that it is not always safe to retry non-idempotent operations. | 503 Service Unavailable | -| DATA_LOSS | 15 | Unrecoverable data loss or corruption. | 500 Internal Server Error | +| Code | Number | Description | +|------------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| OK | 0 | Not an error; returned on success. | +| CANCELLED | 1 | The operation was cancelled, typically by the caller. | +| UNKNOWN | 2 | Unknown error. For example, this error may be returned when a `Status` value received from another address space belongs to an error space that is not known in this address space. Also errors raised by APIs that do not return enough error information may be converted to this error. | +| INVALID_ARGUMENT | 3 | The client specified an invalid argument. Note that this differs from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments that are problematic regardless of the state of the system (e.g., a malformed file name). | +| DEADLINE_EXCEEDED | 4 | The deadline expired before the operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long | +| NOT_FOUND | 5 | Some requested entity (e.g., file or directory) was not found. Note to server developers: if a request is denied for an entire class of users, such as gradual feature rollout or undocumented whitelist, `NOT_FOUND` may be used. If a request is denied for some users within a class of users, such as user-based access control, `PERMISSION_DENIED` must be used. | +| ALREADY_EXISTS | 6 | The entity that a client attempted to create (e.g., file or directory) already exists. | +| PERMISSION_DENIED | 7 | The caller does not have permission to execute the specified operation. `PERMISSION_DENIED` must not be used for rejections caused by exhausting some resource (use `RESOURCE_EXHAUSTED` instead for those errors). `PERMISSION_DENIED` must not be used if the caller can not be identified (use `UNAUTHENTICATED` instead for those errors). This error code does not imply the request is valid or the requested entity exists or satisfies other pre-conditions. | +| UNAUTHENTICATED | 16 | The request does not have valid authentication credentials for the operation. | +| RESOURCE_EXHAUSTED | 8 | Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space. | +| FAILED_PRECONDITION | 9 | The operation was rejected because the system is not in a state required for the operation's execution. For example, the directory to be deleted is non-empty, an rmdir operation is applied to a non-directory, etc. Service implementors can use the following guidelines to decide between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: (a) Use `UNAVAILABLE` if the client can retry just the failing call. (b) Use `ABORTED` if the client should retry at a higher level (e.g., when a client-specified test-and-set fails, indicating the client should restart a read-modify-write sequence). (c) Use `FAILED_PRECONDITION` if the client should not retry until the system state has been explicitly fixed. E.g., if an "rmdir" fails because the directory is non-empty, `FAILED_PRECONDITION` should be returned since the client should not retry unless the files are deleted from the directory. | +| ABORTED | 10 | The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort. See the guidelines above for deciding between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`. | +| OUT_OF_RANGE | 11 | The operation was attempted past the valid range. E.g., seeking or reading past end-of-file. Unlike `INVALID_ARGUMENT`, this error indicates a problem that may be fixed if the system state changes. For example, a 32-bit file system will generate `INVALID_ARGUMENT` if asked to read at an offset that is not in the range [0,2^32-1], but it will generate `OUT_OF_RANGE` if asked to read from an offset past the current file size. There is a fair bit of overlap between `FAILED_PRECONDITION` and `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific error) when it applies so that callers who are iterating through a space can easily look for an `OUT_OF_RANGE` error to detect when they are done. | +| UNIMPLEMENTED | 12 | The operation is not implemented or is not supported/enabled in this service. | +| INTERNAL | 13 | Internal errors. This means that some invariants expected by the underlying system have been broken. This error code is reserved for serious errors. | +| UNAVAILABLE | 14 | The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff. Note that it is not always safe to retry non-idempotent operations. | +| DATA_LOSS | 15 | Unrecoverable data loss or corruption. | All RPCs started at a client return a `status` object composed of an integer `code` and a string `message`. The server-side can choose the status it From eaef598a90f990b999df72bfb2c136c2ab516974 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Mon, 15 Jul 2019 15:36:13 -0700 Subject: [PATCH 063/661] Changed to remote sources --- src/objective-c/examples/watchOS-sample/Podfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/examples/watchOS-sample/Podfile b/src/objective-c/examples/watchOS-sample/Podfile index 60626ca493f..a0f93bef730 100644 --- a/src/objective-c/examples/watchOS-sample/Podfile +++ b/src/objective-c/examples/watchOS-sample/Podfile @@ -9,7 +9,7 @@ def grpc_deps pod 'gRPC-RxLibrary', :path => ROOT_DIR pod 'RemoteTest', :path => "../RemoteTestClient" pod '!ProtoCompiler-gRPCPlugin', :path => "#{ROOT_DIR}/src/objective-c" - pod 'BoringSSL-GRPC', :path => "#{ROOT_DIR}/third_party/boringssl" + pod 'BoringSSL-GRPC', :podspec => "#{ROOT_DIR}/src/objective-c" pod '!ProtoCompiler', :path => "#{ROOT_DIR}/src/objective-c" end From dce5408b848bd7ceb8577bdbbccfb94019de372a Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 16 Jul 2019 08:13:42 -0400 Subject: [PATCH 064/661] clang format code --- src/compiler/csharp_generator.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index 386d1783b9f..d7ba4f2636a 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -437,8 +437,8 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service, "/// The channel to use to make remote " "calls.\n", "servicename", GetServiceClassName(service)); - out->Print("public $name$(grpc::ChannelBase channel) : base(channel)\n", "name", - GetClientClassName(service)); + out->Print("public $name$(grpc::ChannelBase channel) : base(channel)\n", + "name", GetClientClassName(service)); out->Print("{\n"); out->Print("}\n"); } From fd3d125988862b13c452abb1f844e8961994946a Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 16 Jul 2019 08:31:44 -0400 Subject: [PATCH 065/661] regenerate C# protos with src/csharp/generate_proto_csharp.sh --- src/csharp/Grpc.Examples/MathGrpc.cs | 2 +- .../BenchmarkServiceGrpc.cs | 2 +- .../EmptyServiceGrpc.cs | 2 +- .../Grpc.IntegrationTesting/Messages.cs | 110 ++++++++++++++---- .../Grpc.IntegrationTesting/MetricsGrpc.cs | 2 +- .../ReportQpsScenarioServiceGrpc.cs | 2 +- .../Grpc.IntegrationTesting/TestGrpc.cs | 6 +- .../WorkerServiceGrpc.cs | 2 +- 8 files changed, 96 insertions(+), 32 deletions(-) diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index fab64354411..5186d2f6dae 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -130,7 +130,7 @@ namespace Math { { /// Creates a new client for Math /// The channel to use to make remote calls. - public MathClient(grpc::Channel channel) : base(channel) + public MathClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for Math that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs index 5b37b144f2a..4a608be318c 100644 --- a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs @@ -148,7 +148,7 @@ namespace Grpc.Testing { { /// Creates a new client for BenchmarkService /// The channel to use to make remote calls. - public BenchmarkServiceClient(grpc::Channel channel) : base(channel) + public BenchmarkServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for BenchmarkService that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs index 50c6e159206..30fd6dec542 100644 --- a/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs @@ -49,7 +49,7 @@ namespace Grpc.Testing { { /// Creates a new client for EmptyService /// The channel to use to make remote calls. - public EmptyServiceClient(grpc::Channel channel) : base(channel) + public EmptyServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for EmptyService that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.IntegrationTesting/Messages.cs b/src/csharp/Grpc.IntegrationTesting/Messages.cs index 3b6c0010222..5c5042b75b6 100644 --- a/src/csharp/Grpc.IntegrationTesting/Messages.cs +++ b/src/csharp/Grpc.IntegrationTesting/Messages.cs @@ -28,41 +28,42 @@ namespace Grpc.Testing { "LnRlc3RpbmciGgoJQm9vbFZhbHVlEg0KBXZhbHVlGAEgASgIIkAKB1BheWxv", "YWQSJwoEdHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXlsb2FkVHlwZRIM", "CgRib2R5GAIgASgMIisKCkVjaG9TdGF0dXMSDAoEY29kZRgBIAEoBRIPCgdt", - "ZXNzYWdlGAIgASgJIs4CCg1TaW1wbGVSZXF1ZXN0EjAKDXJlc3BvbnNlX3R5", + "ZXNzYWdlGAIgASgJIuYCCg1TaW1wbGVSZXF1ZXN0EjAKDXJlc3BvbnNlX3R5", "cGUYASABKA4yGS5ncnBjLnRlc3RpbmcuUGF5bG9hZFR5cGUSFQoNcmVzcG9u", "c2Vfc2l6ZRgCIAEoBRImCgdwYXlsb2FkGAMgASgLMhUuZ3JwYy50ZXN0aW5n", "LlBheWxvYWQSFQoNZmlsbF91c2VybmFtZRgEIAEoCBIYChBmaWxsX29hdXRo", "X3Njb3BlGAUgASgIEjQKE3Jlc3BvbnNlX2NvbXByZXNzZWQYBiABKAsyFy5n", "cnBjLnRlc3RpbmcuQm9vbFZhbHVlEjEKD3Jlc3BvbnNlX3N0YXR1cxgHIAEo", "CzIYLmdycGMudGVzdGluZy5FY2hvU3RhdHVzEjIKEWV4cGVjdF9jb21wcmVz", - "c2VkGAggASgLMhcuZ3JwYy50ZXN0aW5nLkJvb2xWYWx1ZSJfCg5TaW1wbGVS", - "ZXNwb25zZRImCgdwYXlsb2FkGAEgASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxv", - "YWQSEAoIdXNlcm5hbWUYAiABKAkSEwoLb2F1dGhfc2NvcGUYAyABKAkidwoZ", - "U3RyZWFtaW5nSW5wdXRDYWxsUmVxdWVzdBImCgdwYXlsb2FkGAEgASgLMhUu", - "Z3JwYy50ZXN0aW5nLlBheWxvYWQSMgoRZXhwZWN0X2NvbXByZXNzZWQYAiAB", - "KAsyFy5ncnBjLnRlc3RpbmcuQm9vbFZhbHVlIj0KGlN0cmVhbWluZ0lucHV0", - "Q2FsbFJlc3BvbnNlEh8KF2FnZ3JlZ2F0ZWRfcGF5bG9hZF9zaXplGAEgASgF", - "ImQKElJlc3BvbnNlUGFyYW1ldGVycxIMCgRzaXplGAEgASgFEhMKC2ludGVy", - "dmFsX3VzGAIgASgFEisKCmNvbXByZXNzZWQYAyABKAsyFy5ncnBjLnRlc3Rp", - "bmcuQm9vbFZhbHVlIugBChpTdHJlYW1pbmdPdXRwdXRDYWxsUmVxdWVzdBIw", - "Cg1yZXNwb25zZV90eXBlGAEgASgOMhkuZ3JwYy50ZXN0aW5nLlBheWxvYWRU", - "eXBlEj0KE3Jlc3BvbnNlX3BhcmFtZXRlcnMYAiADKAsyIC5ncnBjLnRlc3Rp", - "bmcuUmVzcG9uc2VQYXJhbWV0ZXJzEiYKB3BheWxvYWQYAyABKAsyFS5ncnBj", - "LnRlc3RpbmcuUGF5bG9hZBIxCg9yZXNwb25zZV9zdGF0dXMYByABKAsyGC5n", - "cnBjLnRlc3RpbmcuRWNob1N0YXR1cyJFChtTdHJlYW1pbmdPdXRwdXRDYWxs", - "UmVzcG9uc2USJgoHcGF5bG9hZBgBIAEoCzIVLmdycGMudGVzdGluZy5QYXls", - "b2FkIjMKD1JlY29ubmVjdFBhcmFtcxIgChhtYXhfcmVjb25uZWN0X2JhY2tv", - "ZmZfbXMYASABKAUiMwoNUmVjb25uZWN0SW5mbxIOCgZwYXNzZWQYASABKAgS", - "EgoKYmFja29mZl9tcxgCIAMoBSofCgtQYXlsb2FkVHlwZRIQCgxDT01QUkVT", - "U0FCTEUQAGIGcHJvdG8z")); + "c2VkGAggASgLMhcuZ3JwYy50ZXN0aW5nLkJvb2xWYWx1ZRIWCg5maWxsX3Nl", + "cnZlcl9pZBgJIAEoCCJyCg5TaW1wbGVSZXNwb25zZRImCgdwYXlsb2FkGAEg", + "ASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxvYWQSEAoIdXNlcm5hbWUYAiABKAkS", + "EwoLb2F1dGhfc2NvcGUYAyABKAkSEQoJc2VydmVyX2lkGAQgASgJIncKGVN0", + "cmVhbWluZ0lucHV0Q2FsbFJlcXVlc3QSJgoHcGF5bG9hZBgBIAEoCzIVLmdy", + "cGMudGVzdGluZy5QYXlsb2FkEjIKEWV4cGVjdF9jb21wcmVzc2VkGAIgASgL", + "MhcuZ3JwYy50ZXN0aW5nLkJvb2xWYWx1ZSI9ChpTdHJlYW1pbmdJbnB1dENh", + "bGxSZXNwb25zZRIfChdhZ2dyZWdhdGVkX3BheWxvYWRfc2l6ZRgBIAEoBSJk", + "ChJSZXNwb25zZVBhcmFtZXRlcnMSDAoEc2l6ZRgBIAEoBRITCgtpbnRlcnZh", + "bF91cxgCIAEoBRIrCgpjb21wcmVzc2VkGAMgASgLMhcuZ3JwYy50ZXN0aW5n", + "LkJvb2xWYWx1ZSLoAQoaU3RyZWFtaW5nT3V0cHV0Q2FsbFJlcXVlc3QSMAoN", + "cmVzcG9uc2VfdHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXlsb2FkVHlw", + "ZRI9ChNyZXNwb25zZV9wYXJhbWV0ZXJzGAIgAygLMiAuZ3JwYy50ZXN0aW5n", + "LlJlc3BvbnNlUGFyYW1ldGVycxImCgdwYXlsb2FkGAMgASgLMhUuZ3JwYy50", + "ZXN0aW5nLlBheWxvYWQSMQoPcmVzcG9uc2Vfc3RhdHVzGAcgASgLMhguZ3Jw", + "Yy50ZXN0aW5nLkVjaG9TdGF0dXMiRQobU3RyZWFtaW5nT3V0cHV0Q2FsbFJl", + "c3BvbnNlEiYKB3BheWxvYWQYASABKAsyFS5ncnBjLnRlc3RpbmcuUGF5bG9h", + "ZCIzCg9SZWNvbm5lY3RQYXJhbXMSIAoYbWF4X3JlY29ubmVjdF9iYWNrb2Zm", + "X21zGAEgASgFIjMKDVJlY29ubmVjdEluZm8SDgoGcGFzc2VkGAEgASgIEhIK", + "CmJhY2tvZmZfbXMYAiADKAUqHwoLUGF5bG9hZFR5cGUSEAoMQ09NUFJFU1NB", + "QkxFEABiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Grpc.Testing.PayloadType), }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.BoolValue), global::Grpc.Testing.BoolValue.Parser, new[]{ "Value" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Payload), global::Grpc.Testing.Payload.Parser, new[]{ "Type", "Body" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.EchoStatus), global::Grpc.Testing.EchoStatus.Parser, new[]{ "Code", "Message" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleRequest), global::Grpc.Testing.SimpleRequest.Parser, new[]{ "ResponseType", "ResponseSize", "Payload", "FillUsername", "FillOauthScope", "ResponseCompressed", "ResponseStatus", "ExpectCompressed" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleResponse), global::Grpc.Testing.SimpleResponse.Parser, new[]{ "Payload", "Username", "OauthScope" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleRequest), global::Grpc.Testing.SimpleRequest.Parser, new[]{ "ResponseType", "ResponseSize", "Payload", "FillUsername", "FillOauthScope", "ResponseCompressed", "ResponseStatus", "ExpectCompressed", "FillServerId" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleResponse), global::Grpc.Testing.SimpleResponse.Parser, new[]{ "Payload", "Username", "OauthScope", "ServerId" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingInputCallRequest), global::Grpc.Testing.StreamingInputCallRequest.Parser, new[]{ "Payload", "ExpectCompressed" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingInputCallResponse), global::Grpc.Testing.StreamingInputCallResponse.Parser, new[]{ "AggregatedPayloadSize" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ResponseParameters), global::Grpc.Testing.ResponseParameters.Parser, new[]{ "Size", "IntervalUs", "Compressed" }, null, null, null), @@ -589,6 +590,7 @@ namespace Grpc.Testing { responseCompressed_ = other.responseCompressed_ != null ? other.responseCompressed_.Clone() : null; responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; expectCompressed_ = other.expectCompressed_ != null ? other.expectCompressed_.Clone() : null; + fillServerId_ = other.fillServerId_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -713,6 +715,20 @@ namespace Grpc.Testing { } } + /// Field number for the "fill_server_id" field. + public const int FillServerIdFieldNumber = 9; + private bool fillServerId_; + /// + /// Whether SimpleResponse should include server_id. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool FillServerId { + get { return fillServerId_; } + set { + fillServerId_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as SimpleRequest); @@ -734,6 +750,7 @@ namespace Grpc.Testing { if (!object.Equals(ResponseCompressed, other.ResponseCompressed)) return false; if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; if (!object.Equals(ExpectCompressed, other.ExpectCompressed)) return false; + if (FillServerId != other.FillServerId) return false; return Equals(_unknownFields, other._unknownFields); } @@ -748,6 +765,7 @@ namespace Grpc.Testing { if (responseCompressed_ != null) hash ^= ResponseCompressed.GetHashCode(); if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); if (expectCompressed_ != null) hash ^= ExpectCompressed.GetHashCode(); + if (FillServerId != false) hash ^= FillServerId.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -793,6 +811,10 @@ namespace Grpc.Testing { output.WriteRawTag(66); output.WriteMessage(ExpectCompressed); } + if (FillServerId != false) { + output.WriteRawTag(72); + output.WriteBool(FillServerId); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -825,6 +847,9 @@ namespace Grpc.Testing { if (expectCompressed_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExpectCompressed); } + if (FillServerId != false) { + size += 1 + 1; + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -872,6 +897,9 @@ namespace Grpc.Testing { } ExpectCompressed.MergeFrom(other.ExpectCompressed); } + if (other.FillServerId != false) { + FillServerId = other.FillServerId; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -927,6 +955,10 @@ namespace Grpc.Testing { input.ReadMessage(ExpectCompressed); break; } + case 72: { + FillServerId = input.ReadBool(); + break; + } } } } @@ -964,6 +996,7 @@ namespace Grpc.Testing { payload_ = other.payload_ != null ? other.payload_.Clone() : null; username_ = other.username_; oauthScope_ = other.oauthScope_; + serverId_ = other.serverId_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -1015,6 +1048,21 @@ namespace Grpc.Testing { } } + /// Field number for the "server_id" field. + public const int ServerIdFieldNumber = 4; + private string serverId_ = ""; + /// + /// Server ID. This must be unique among different server instances, + /// but the same across all RPC's made to a particular server instance. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ServerId { + get { return serverId_; } + set { + serverId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as SimpleResponse); @@ -1031,6 +1079,7 @@ namespace Grpc.Testing { if (!object.Equals(Payload, other.Payload)) return false; if (Username != other.Username) return false; if (OauthScope != other.OauthScope) return false; + if (ServerId != other.ServerId) return false; return Equals(_unknownFields, other._unknownFields); } @@ -1040,6 +1089,7 @@ namespace Grpc.Testing { if (payload_ != null) hash ^= Payload.GetHashCode(); if (Username.Length != 0) hash ^= Username.GetHashCode(); if (OauthScope.Length != 0) hash ^= OauthScope.GetHashCode(); + if (ServerId.Length != 0) hash ^= ServerId.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1065,6 +1115,10 @@ namespace Grpc.Testing { output.WriteRawTag(26); output.WriteString(OauthScope); } + if (ServerId.Length != 0) { + output.WriteRawTag(34); + output.WriteString(ServerId); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -1082,6 +1136,9 @@ namespace Grpc.Testing { if (OauthScope.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(OauthScope); } + if (ServerId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ServerId); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1105,6 +1162,9 @@ namespace Grpc.Testing { if (other.OauthScope.Length != 0) { OauthScope = other.OauthScope; } + if (other.ServerId.Length != 0) { + ServerId = other.ServerId; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1131,6 +1191,10 @@ namespace Grpc.Testing { OauthScope = input.ReadString(); break; } + case 34: { + ServerId = input.ReadString(); + break; + } } } } diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs index 9b11e990d2d..fbc3690d2ac 100644 --- a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -92,7 +92,7 @@ namespace Grpc.Testing { { /// Creates a new client for MetricsService /// The channel to use to make remote calls. - public MetricsServiceClient(grpc::Channel channel) : base(channel) + public MetricsServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for MetricsService that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs index 1a505ebc764..e35c7c39fd5 100644 --- a/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs @@ -67,7 +67,7 @@ namespace Grpc.Testing { { /// Creates a new client for ReportQpsScenarioService /// The channel to use to make remote calls. - public ReportQpsScenarioServiceClient(grpc::Channel channel) : base(channel) + public ReportQpsScenarioServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for ReportQpsScenarioService that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index e7b93094c65..f358a6d175c 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -216,7 +216,7 @@ namespace Grpc.Testing { { /// Creates a new client for TestService /// The channel to use to make remote calls. - public TestServiceClient(grpc::Channel channel) : base(channel) + public TestServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for TestService that uses a custom CallInvoker. @@ -602,7 +602,7 @@ namespace Grpc.Testing { { /// Creates a new client for UnimplementedService /// The channel to use to make remote calls. - public UnimplementedServiceClient(grpc::Channel channel) : base(channel) + public UnimplementedServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for UnimplementedService that uses a custom CallInvoker. @@ -741,7 +741,7 @@ namespace Grpc.Testing { { /// Creates a new client for ReconnectService /// The channel to use to make remote calls. - public ReconnectServiceClient(grpc::Channel channel) : base(channel) + public ReconnectServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for ReconnectService that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs index 14c26f99a6b..66378081626 100644 --- a/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs @@ -138,7 +138,7 @@ namespace Grpc.Testing { { /// Creates a new client for WorkerService /// The channel to use to make remote calls. - public WorkerServiceClient(grpc::Channel channel) : base(channel) + public WorkerServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for WorkerService that uses a custom CallInvoker. From c6bc2b1875d283d237b64a7ec9b153fd1a98b845 Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Fri, 19 Jul 2019 10:23:22 -0700 Subject: [PATCH 066/661] Add threadpool benchmark and build files --- CMakeLists.txt | 48 +++ Makefile | 49 +++ build.yaml | 21 ++ test/cpp/microbenchmarks/BUILD | 8 + test/cpp/microbenchmarks/bm_threadpool.cc | 343 ++++++++++++++++++ .../generated/sources_and_headers.json | 21 ++ tools/run_tests/generated/tests.json | 22 ++ 7 files changed, 512 insertions(+) create mode 100644 test/cpp/microbenchmarks/bm_threadpool.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 726638aa004..ed6af47010b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -594,6 +594,9 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_cxx bm_pollset) endif() if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) +add_dependencies(buildtests_cxx bm_threadpool) +endif() +if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_cxx bm_timer) endif() add_dependencies(buildtests_cxx byte_stream_test) @@ -12414,6 +12417,51 @@ target_link_libraries(bm_pollset ) +endif() +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) +if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) + +add_executable(bm_threadpool + test/cpp/microbenchmarks/bm_threadpool.cc + third_party/googletest/googletest/src/gtest-all.cc + third_party/googletest/googlemock/src/gmock-all.cc +) + + +target_include_directories(bm_threadpool + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} + PRIVATE ${_gRPC_CARES_INCLUDE_DIR} + PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest + PRIVATE third_party/googletest/googlemock/include + PRIVATE third_party/googletest/googlemock + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(bm_threadpool + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc_benchmark + ${_gRPC_BENCHMARK_LIBRARIES} + grpc++_test_util_unsecure + grpc_test_util_unsecure + grpc++_unsecure + grpc_unsecure + gpr + grpc++_test_config + ${_gRPC_GFLAGS_LIBRARIES} +) + + endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) diff --git a/Makefile b/Makefile index 4ca15ac0f47..10c3eafddfa 100644 --- a/Makefile +++ b/Makefile @@ -1180,6 +1180,7 @@ bm_fullstack_trickle: $(BINDIR)/$(CONFIG)/bm_fullstack_trickle bm_fullstack_unary_ping_pong: $(BINDIR)/$(CONFIG)/bm_fullstack_unary_ping_pong bm_metadata: $(BINDIR)/$(CONFIG)/bm_metadata bm_pollset: $(BINDIR)/$(CONFIG)/bm_pollset +bm_threadpool: $(BINDIR)/$(CONFIG)/bm_threadpool bm_timer: $(BINDIR)/$(CONFIG)/bm_timer byte_stream_test: $(BINDIR)/$(CONFIG)/byte_stream_test channel_arguments_test: $(BINDIR)/$(CONFIG)/channel_arguments_test @@ -1658,6 +1659,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/bm_fullstack_unary_ping_pong \ $(BINDIR)/$(CONFIG)/bm_metadata \ $(BINDIR)/$(CONFIG)/bm_pollset \ + $(BINDIR)/$(CONFIG)/bm_threadpool \ $(BINDIR)/$(CONFIG)/bm_timer \ $(BINDIR)/$(CONFIG)/byte_stream_test \ $(BINDIR)/$(CONFIG)/channel_arguments_test \ @@ -1824,6 +1826,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/bm_fullstack_unary_ping_pong \ $(BINDIR)/$(CONFIG)/bm_metadata \ $(BINDIR)/$(CONFIG)/bm_pollset \ + $(BINDIR)/$(CONFIG)/bm_threadpool \ $(BINDIR)/$(CONFIG)/bm_timer \ $(BINDIR)/$(CONFIG)/byte_stream_test \ $(BINDIR)/$(CONFIG)/channel_arguments_test \ @@ -2295,6 +2298,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/bm_metadata || ( echo test bm_metadata failed ; exit 1 ) $(E) "[RUN] Testing bm_pollset" $(Q) $(BINDIR)/$(CONFIG)/bm_pollset || ( echo test bm_pollset failed ; exit 1 ) + $(E) "[RUN] Testing bm_threadpool" + $(Q) $(BINDIR)/$(CONFIG)/bm_threadpool || ( echo test bm_threadpool failed ; exit 1 ) $(E) "[RUN] Testing bm_timer" $(Q) $(BINDIR)/$(CONFIG)/bm_timer || ( echo test bm_timer failed ; exit 1 ) $(E) "[RUN] Testing byte_stream_test" @@ -15415,6 +15420,50 @@ endif endif +BM_THREADPOOL_SRC = \ + test/cpp/microbenchmarks/bm_threadpool.cc \ + +BM_THREADPOOL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(BM_THREADPOOL_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/bm_threadpool: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+. + +$(BINDIR)/$(CONFIG)/bm_threadpool: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/bm_threadpool: $(PROTOBUF_DEP) $(BM_THREADPOOL_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(BM_THREADPOOL_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/bm_threadpool + +endif + +endif + +$(BM_THREADPOOL_OBJS): CPPFLAGS += -Ithird_party/benchmark/include -DHAVE_POSIX_REGEX +$(OBJDIR)/$(CONFIG)/test/cpp/microbenchmarks/bm_threadpool.o: $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a + +deps_bm_threadpool: $(BM_THREADPOOL_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(BM_THREADPOOL_OBJS:.o=.dep) +endif +endif + + BM_TIMER_SRC = \ test/cpp/microbenchmarks/bm_timer.cc \ diff --git a/build.yaml b/build.yaml index 6d69c419b71..50689b66ff8 100644 --- a/build.yaml +++ b/build.yaml @@ -4449,6 +4449,27 @@ targets: - mac - linux - posix +- name: bm_threadpool + build: test + language: c++ + src: + - test/cpp/microbenchmarks/bm_threadpool.cc + deps: + - grpc_benchmark + - benchmark + - grpc++_test_util_unsecure + - grpc_test_util_unsecure + - grpc++_unsecure + - grpc_unsecure + - gpr + - grpc++_test_config + benchmark: true + defaults: benchmark + platforms: + - mac + - linux + - posix + uses_polling: false - name: bm_timer build: test language: c++ diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD index d9424f24f16..b8e9b14d4b4 100644 --- a/test/cpp/microbenchmarks/BUILD +++ b/test/cpp/microbenchmarks/BUILD @@ -222,6 +222,14 @@ grpc_cc_binary( deps = [":helpers"], ) +grpc_cc_binary( + name = "bm_threadpool", + testonly = 1, + srcs = ["bm_threadpool.cc"], + tags = ["no_windows"], + deps = [":helpers"], +) + grpc_cc_library( name = "bm_callback_test_service_impl", testonly = 1, diff --git a/test/cpp/microbenchmarks/bm_threadpool.cc b/test/cpp/microbenchmarks/bm_threadpool.cc new file mode 100644 index 00000000000..07b99146064 --- /dev/null +++ b/test/cpp/microbenchmarks/bm_threadpool.cc @@ -0,0 +1,343 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include + +#include +#include + +#include "src/core/lib/iomgr/executor/threadpool.h" +#include "test/cpp/microbenchmarks/helpers.h" +#include "test/cpp/util/test_config.h" + +namespace grpc { +namespace testing { + +// This helper class allows a thread to block for a pre-specified number of +// actions. BlockingCounter has an initial non-negative count on initialization +// Each call to DecrementCount will decrease the count by 1. When making a call +// to Wait, if the count is greater than 0, the thread will be block, until +// the count reaches 0. +class BlockingCounter { + public: + BlockingCounter(int count) : count_(count) {} + void DecrementCount() { + std::lock_guard l(mu_); + count_--; + if (count_ == 0) cv_.notify_one(); + } + + void Wait() { + std::unique_lock l(mu_); + while (count_ > 0) { + cv_.wait(l); + } + } + private: + int count_; + std::mutex mu_; + std::condition_variable cv_; +}; + +// This is a functor/closure class for threadpool microbenchmark. +// This functor (closure) class will add another functor into pool if the +// number passed in (num_add) is greater than 0. Otherwise, it will decrement +// the counter to indicate that task is finished. This functor will suicide at +// the end, therefore, no need for caller to do clean-ups. +class AddAnotherFunctor : public grpc_experimental_completion_queue_functor { + public: + AddAnotherFunctor(grpc_core::ThreadPool* pool, BlockingCounter* counter, + int num_add) + : pool_(pool), counter_(counter), num_add_(num_add) { + functor_run = &AddAnotherFunctor::Run; + internal_next = this; + internal_success = 0; + } + ~AddAnotherFunctor() {} + // When the functor gets to run in thread pool, it will take itself as first + // argument and internal_success as second one. + static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { + auto* callback = static_cast(cb); + if (--callback->num_add_ > 0) { + callback->pool_->Add(new AddAnotherFunctor( + callback->pool_, callback->counter_, callback->num_add_)); + } else { + callback->counter_->DecrementCount(); + } + // Suicide + delete callback; + } + + private: + grpc_core::ThreadPool* pool_; + BlockingCounter* counter_; + int num_add_; +}; + +void ThreadPoolAddAnotherHelper(benchmark::State& state, + int concurrent_functor) { + const int num_threads = state.range(1); + const int num_iterations = state.range(0); + // number of adds done by each closure + const int num_add = num_iterations / concurrent_functor; + grpc_core::ThreadPool pool(num_threads); + while (state.KeepRunningBatch(num_iterations)) { + BlockingCounter counter(concurrent_functor); + for (int i = 0; i < concurrent_functor; ++i) { + pool.Add(new AddAnotherFunctor(&pool, &counter, num_add)); + } + counter.Wait(); + } + state.SetItemsProcessed(state.iterations()); +} + +static void BM_ThreadPool1AddAnother(benchmark::State& state) { + ThreadPoolAddAnotherHelper(state, 1); +} +// first pair is range for batch_size, second pair is range for thread pool size +BENCHMARK(BM_ThreadPool1AddAnother)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool4AddAnother(benchmark::State& state) { + ThreadPoolAddAnotherHelper(state, 4); +} +BENCHMARK(BM_ThreadPool4AddAnother)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool8AddAnother(benchmark::State& state) { + ThreadPoolAddAnotherHelper(state, 8); +} +BENCHMARK(BM_ThreadPool8AddAnother)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool16AddAnother(benchmark::State& state) { + ThreadPoolAddAnotherHelper(state, 16); +} +BENCHMARK(BM_ThreadPool16AddAnother)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool32AddAnother(benchmark::State& state) { + ThreadPoolAddAnotherHelper(state, 32); +} +BENCHMARK(BM_ThreadPool32AddAnother)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool64AddAnother(benchmark::State& state) { + ThreadPoolAddAnotherHelper(state, 64); +} +BENCHMARK(BM_ThreadPool64AddAnother)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool128AddAnother(benchmark::State& state) { + ThreadPoolAddAnotherHelper(state, 128); +} +BENCHMARK(BM_ThreadPool128AddAnother)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool512AddAnother(benchmark::State& state) { + ThreadPoolAddAnotherHelper(state, 512); +} +BENCHMARK(BM_ThreadPool512AddAnother)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool2048AddAnother(benchmark::State& state) { + ThreadPoolAddAnotherHelper(state, 2048); +} +BENCHMARK(BM_ThreadPool2048AddAnother)->RangePair(524288, 524288, 1, 1024); + + + +// A functor class that will delete self on end of running. +class SuicideFunctorForAdd + : public grpc_experimental_completion_queue_functor { + public: + SuicideFunctorForAdd(BlockingCounter* counter) : counter_(counter) { + functor_run = &SuicideFunctorForAdd::Run; + internal_next = this; + internal_success = 0; + } + ~SuicideFunctorForAdd() {} + static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { + // On running, the first argument would be itself. + auto* callback = static_cast(cb); + callback->counter_->DecrementCount(); + delete callback; + } + + private: + BlockingCounter* counter_; +}; + + +// Performs the scenario of external thread(s) adding closures into pool. +static void BM_ThreadPoolExternalAdd(benchmark::State& state) { + static grpc_core::ThreadPool* external_add_pool = nullptr; + // Setup for each run of test + if (state.thread_index == 0) { + const int num_threads = state.range(1); + external_add_pool = new grpc_core::ThreadPool(num_threads); + } +const int num_iterations = state.range(0); + while (state.KeepRunningBatch(num_iterations)) { + BlockingCounter counter(num_iterations); + for (int i = 0; i < num_iterations; ++i) { + external_add_pool->Add(new SuicideFunctorForAdd(&counter)); + } + counter.Wait(); + } + state.SetItemsProcessed(num_iterations); + + // Teardown at the end of each test run + if (state.thread_index == 0) { + Delete(external_add_pool); + } +} +BENCHMARK(BM_ThreadPoolExternalAdd) + ->RangePair(524288, 524288, 1, 1024) // ThreadPool size + ->ThreadRange(1, 256); // Concurrent external thread(s) up to 256 + +// Functor (closure) that adds itself into pool repeatedly. By adding self, the +// overhead would be low and can measure the time of add more accurately. +class AddSelfFunctor : public grpc_experimental_completion_queue_functor { + public: + AddSelfFunctor(grpc_core::ThreadPool* pool, BlockingCounter* counter, + int num_add) + : pool_(pool), counter_(counter), num_add_(num_add) { + functor_run = &AddSelfFunctor::Run; + internal_next = this; + internal_success = 0; + } + ~AddSelfFunctor() {} + // When the functor gets to run in thread pool, it will take internal_next + // as first argument and internal_success as second one. Therefore, the + // first argument here would be the closure itself. + static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { + auto* callback = static_cast(cb); + if (--callback->num_add_ > 0) { + callback->pool_->Add(cb); + } else { + callback->counter_->DecrementCount(); + // Suicide + delete callback; + } + } + + private: + grpc_core::ThreadPool* pool_; + BlockingCounter* counter_; + int num_add_; +}; + +static void BM_ThreadPoolAddSelf(benchmark::State& state) { + const int num_threads = state.range(0); + const int kNumIteration = 524288; + int concurrent_functor = num_threads; + int num_add = kNumIteration / concurrent_functor; + grpc_core::ThreadPool pool(num_threads); + while (state.KeepRunningBatch(kNumIteration)) { + BlockingCounter counter(concurrent_functor); + for (int i = 0; i < concurrent_functor; ++i) { + pool.Add(new AddSelfFunctor(&pool, &counter, num_add)); + } + counter.Wait(); + } + state.SetItemsProcessed(state.iterations()); +} + +BENCHMARK(BM_ThreadPoolAddSelf)->Range(1, 1024); + +#if defined(__GNUC__) && !defined(SWIG) +#if defined(__i386__) || defined(__x86_64__) +#define ABSL_CACHELINE_SIZE 64 +#elif defined(__powerpc64__) +#define ABSL_CACHELINE_SIZE 128 +#elif defined(__aarch64__) +#define ABSL_CACHELINE_SIZE 64 +#elif defined(__arm__) +#if defined(__ARM_ARCH_5T__) +#define ABSL_CACHELINE_SIZE 32 +#elif defined(__ARM_ARCH_7A__) +#define ABSL_CACHELINE_SIZE 64 +#endif +#endif +#ifndef ABSL_CACHELINE_SIZE +#define ABSL_CACHELINE_SIZE 64 +#endif +#endif + +// A functor (closure) that simulates closures with small but non-trivial amount +// of work. +class ShortWorkFunctorForAdd + : public grpc_experimental_completion_queue_functor { + public: + BlockingCounter* counter_; + + ShortWorkFunctorForAdd() { + functor_run = &ShortWorkFunctorForAdd::Run; + internal_next = this; + internal_success = 0; + val_ = 0; + } + ~ShortWorkFunctorForAdd() {} + static void Run(grpc_experimental_completion_queue_functor *cb, int ok) { + auto* callback = static_cast(cb); + for (int i = 0; i < 1000; ++i) { + callback->val_++; + } + callback->counter_->DecrementCount(); + } + private: + char pad[ABSL_CACHELINE_SIZE]; + volatile int val_; +}; + +// Simulates workloads where many short running callbacks are added to the +// threadpool. The callbacks are not enough to keep all the workers busy +// continuously so the number of workers running changes overtime. +// +// In effect this tests how well the threadpool avoids spurious wakeups. +static void BM_SpikyLoad(benchmark::State& state) { + const int num_threads = state.range(0); + + const int kNumSpikes = 1000; + const int batch_size = 3 * num_threads; + std::vector work_vector(batch_size); + while (state.KeepRunningBatch(kNumSpikes * batch_size)) { + grpc_core::ThreadPool pool(num_threads); + for (int i = 0; i != kNumSpikes; ++i) { + BlockingCounter counter(batch_size); + for (auto& w : work_vector) { + w.counter_ = &counter; + pool.Add(&w); + } + counter.Wait(); + } + } + state.SetItemsProcessed(state.iterations() * batch_size); +} +BENCHMARK(BM_SpikyLoad)->Arg(1)->Arg(2)->Arg(4)->Arg(8)->Arg(16); + +} // namespace testing +} // namespace grpc + +// Some distros have RunSpecifiedBenchmarks under the benchmark namespace, +// and others do not. This allows us to support both modes. +namespace benchmark { +void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); } +} // namespace benchmark + +int main(int argc, char* argv[]) { + LibraryInitializer libInit; + ::benchmark::Initialize(&argc, argv); + ::grpc::testing::InitTest(&argc, &argv, false); + benchmark::RunTheBenchmarksNamespaced(); + return 0; +} diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index b2feea44d53..524709588f0 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -3140,6 +3140,27 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "benchmark", + "gpr", + "grpc++_test_config", + "grpc++_test_util_unsecure", + "grpc++_unsecure", + "grpc_benchmark", + "grpc_test_util_unsecure", + "grpc_unsecure" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "bm_threadpool", + "src": [ + "test/cpp/microbenchmarks/bm_threadpool.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "benchmark", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index d4a19741729..8f1b0edaff2 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -3903,6 +3903,28 @@ ], "uses_polling": true }, + { + "args": [], + "benchmark": true, + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": false, + "language": "c++", + "name": "bm_threadpool", + "platforms": [ + "linux", + "mac", + "posix" + ], + "uses_polling": false + }, { "args": [], "benchmark": true, From f50301fde8bbccb87bc1ae2c1a85bf48c268e9ba Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Fri, 19 Jul 2019 10:36:10 -0700 Subject: [PATCH 067/661] Add LIFO and Chunked List --- src/core/lib/iomgr/executor/mpmcqueue.cc | 120 ++++++++++++++++++----- src/core/lib/iomgr/executor/mpmcqueue.h | 68 ++++++++++--- test/core/iomgr/mpmcqueue_test.cc | 45 +++++++++ 3 files changed, 191 insertions(+), 42 deletions(-) diff --git a/src/core/lib/iomgr/executor/mpmcqueue.cc b/src/core/lib/iomgr/executor/mpmcqueue.cc index 72c318e2bb1..7ef5cf40e14 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.cc +++ b/src/core/lib/iomgr/executor/mpmcqueue.cc @@ -26,18 +26,15 @@ DebugOnlyTraceFlag grpc_thread_pool_trace(false, "thread_pool"); inline void* InfLenFIFOQueue::PopFront() { // Caller should already check queue is not empty and has already held the - // mutex. This function will only do the job of removal. + // mutex. This function will assume that there is at least one element in the + // queue (aka queue_head_ content is valid). void* result = queue_head_->content; - Node* head_to_remove = queue_head_; - queue_head_ = queue_head_->next; - count_.Store(count_.Load(MemoryOrder::RELAXED) - 1, MemoryOrder::RELAXED); + // Updates Stats when trace flag turned on. if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace)) { - gpr_timespec wait_time = - gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), head_to_remove->insert_time); - - // Updates Stats info + gpr_timespec wait_time = gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), + queue_head_->insert_time); stats_.num_completed++; stats_.total_queue_time = gpr_time_add(stats_.total_queue_time, wait_time); stats_.max_queue_time = gpr_time_max( @@ -58,44 +55,87 @@ inline void* InfLenFIFOQueue::PopFront() { gpr_timespec_to_micros(stats_.busy_queue_time)); } - Delete(head_to_remove); + queue_head_ = queue_head_->next; // Signal waiting thread - if (count_.Load(MemoryOrder::RELAXED) > 0 && num_waiters_ > 0) { - wait_nonempty_.Signal(); + if (count_.Load(MemoryOrder::RELAXED) > 0) { + TopWaiter()->cv.Signal(); } return result; } +InfLenFIFOQueue::Node* InfLenFIFOQueue::AllocateNodes(int num) { + Node* new_chunk = static_cast(gpr_zalloc(sizeof(Node) * num)); + new_chunk[0].next = &new_chunk[1]; + new_chunk[num - 1].prev = &new_chunk[num - 2]; + for (int i = 1; i < num - 1; ++i) { + new_chunk[i].prev = &new_chunk[i - 1]; + new_chunk[i].next = &new_chunk[i + 1]; + } + return new_chunk; +} + +InfLenFIFOQueue::InfLenFIFOQueue() { + delete_list_size_ = 1024; + delete_list_ = + static_cast(gpr_zalloc(sizeof(Node*) * delete_list_size_)); + + Node* new_chunk = AllocateNodes(1024); + delete_list_[delete_list_count_++] = new_chunk; + queue_head_ = queue_tail_ = new_chunk; + new_chunk[0].prev = &new_chunk[1023]; + new_chunk[1023].next = &new_chunk[0]; + + waiters_.next = &waiters_; + waiters_.prev = &waiters_; +} + InfLenFIFOQueue::~InfLenFIFOQueue() { GPR_ASSERT(count_.Load(MemoryOrder::RELAXED) == 0); - GPR_ASSERT(num_waiters_ == 0); + for (size_t i = 0; i < delete_list_count_; ++i) { + gpr_free(delete_list_[i]); + } + gpr_free(delete_list_); } void InfLenFIFOQueue::Put(void* elem) { MutexLock l(&mu_); - Node* new_node = New(elem); - if (count_.Load(MemoryOrder::RELAXED) == 0) { - if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace)) { - busy_time = gpr_now(GPR_CLOCK_MONOTONIC); + int curr_count = count_.Load(MemoryOrder::RELAXED); + + if (queue_tail_ == queue_head_ && curr_count!= 0) { + // List is full. Expands list to double size by inserting new chunk of nodes + Node* new_chunk = AllocateNodes(curr_count); + delete_list_[delete_list_count_++] = new_chunk; + // Expands delete list on full. + if (delete_list_count_ == delete_list_size_) { + delete_list_size_ = delete_list_size_ * 2; + delete_list_ = static_cast( + gpr_realloc(delete_list_, sizeof(Node*) * delete_list_size_)); } - queue_head_ = queue_tail_ = new_node; - } else { - queue_tail_->next = new_node; - queue_tail_ = queue_tail_->next; + new_chunk[0].prev = queue_tail_->prev; + new_chunk[curr_count - 1].next = queue_head_; + queue_tail_->prev->next = new_chunk; + queue_head_->prev = &new_chunk[curr_count - 1]; + queue_tail_ = new_chunk; } - count_.Store(count_.Load(MemoryOrder::RELAXED) + 1, MemoryOrder::RELAXED); + queue_tail_->content = static_cast(elem); + // Updates Stats info if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace)) { stats_.num_started++; gpr_log(GPR_INFO, "[InfLenFIFOQueue Put] num_started: %" PRIu64, stats_.num_started); + if (curr_count == 0) { + busy_time = gpr_now(GPR_CLOCK_MONOTONIC); + } + queue_tail_->insert_time = gpr_now(GPR_CLOCK_MONOTONIC); } - if (num_waiters_ > 0) { - wait_nonempty_.Signal(); - } + count_.Store(curr_count + 1, MemoryOrder::RELAXED); + queue_tail_ = queue_tail_->next; + + TopWaiter()->cv.Signal(); } void* InfLenFIFOQueue::Get(gpr_timespec* wait_time) { @@ -108,11 +148,12 @@ void* InfLenFIFOQueue::Get(gpr_timespec* wait_time) { start_time = gpr_now(GPR_CLOCK_MONOTONIC); } - num_waiters_++; + Waiter self; + PushWaiter(&self); do { - wait_nonempty_.Wait(&mu_); + self.cv.Wait(&mu_); } while (count_.Load(MemoryOrder::RELAXED) == 0); - num_waiters_--; + RemoveWaiter(&self); if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace) && wait_time != nullptr) { *wait_time = gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), start_time); @@ -122,4 +163,29 @@ void* InfLenFIFOQueue::Get(gpr_timespec* wait_time) { return PopFront(); } +size_t InfLenFIFOQueue::num_node() { + size_t num = 1024; + for (size_t i = 1; i < delete_list_count_; ++i) { + num = num* 2; + } + return num; +} + +void InfLenFIFOQueue::PushWaiter(Waiter* waiter) { + waiter->next = waiters_.next; + waiter->prev = &waiters_; + waiter->next->prev = waiter; + waiter->prev->next = waiter; +} + +void InfLenFIFOQueue::RemoveWaiter(Waiter* waiter) { + GPR_DEBUG_ASSERT(waiter != &waiters_); + waiter->next->prev = waiter->prev; + waiter->prev->next = waiter->next; +} + +InfLenFIFOQueue::Waiter* InfLenFIFOQueue::TopWaiter() { + return waiters_.next; +} + } // namespace grpc_core diff --git a/src/core/lib/iomgr/executor/mpmcqueue.h b/src/core/lib/iomgr/executor/mpmcqueue.h index c6102b3add0..05e5a0a7579 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.h +++ b/src/core/lib/iomgr/executor/mpmcqueue.h @@ -54,7 +54,7 @@ class MPMCQueueInterface { class InfLenFIFOQueue : public MPMCQueueInterface { public: // Creates a new MPMC Queue. The queue created will have infinite length. - InfLenFIFOQueue() {} + InfLenFIFOQueue(); // Releases all resources held by the queue. The queue must be empty, and no // one waits on conditional variables. @@ -66,8 +66,8 @@ class InfLenFIFOQueue : public MPMCQueueInterface { // Removes the oldest element from the queue and returns it. // This routine will cause the thread to block if queue is currently empty. - // Argument wait_time should be passed in when turning on the trace flag - // grpc_thread_pool_trace (for collecting stats info purpose.) + // Argument wait_time should be passed in when trace flag turning on (for + // collecting stats info purpose.) void* Get(gpr_timespec* wait_time = nullptr); // Returns number of elements in queue currently. @@ -75,24 +75,30 @@ class InfLenFIFOQueue : public MPMCQueueInterface { // quickly. int count() const { return count_.Load(MemoryOrder::RELAXED); } - private: - // For Internal Use Only. - // Removes the oldest element from the queue and returns it. This routine - // will NOT check whether queue is empty, and it will NOT acquire mutex. - // Caller should do the check and acquire mutex before callling. - void* PopFront(); - struct Node { Node* next; // Linking + Node* prev; void* content; // Points to actual element gpr_timespec insert_time; // Time for stats - Node(void* c) : content(c) { - next = nullptr; - insert_time = gpr_now(GPR_CLOCK_MONOTONIC); + Node() { + next = prev = nullptr; + content = nullptr; } }; + // For test purpose only. Returns number of nodes allocated in queue. + // All allocated nodes will not be free until destruction of queue. + size_t num_node(); + + private: + // For Internal Use Only. + // Removes the oldest element from the queue and returns it. This routine + // will NOT check whether queue is empty, and it will NOT acquire mutex. + // Caller MUST check that queue is not empty and must acquire mutex before + // callling. + void* PopFront(); + // Stats of queue. This will only be collect when debug trace mode is on. // All printed stats info will have time measurement in microsecond. struct Stats { @@ -115,15 +121,47 @@ class InfLenFIFOQueue : public MPMCQueueInterface { } }; + // Node for waiting thread queue. Stands for one waiting thread, should have + // exact one thread waiting on its CondVar. + // Using a doubly linked list for waiting thread queue to wake up waiting + // threads in LIFO order to reduce cache misses. + struct Waiter { + CondVar cv; + Waiter* next; + Waiter* prev; + }; + + // Pushs waiter to the front of queue, require caller held mutex + void PushWaiter(Waiter* waiter); + + // Removes waiter from queue, require caller held mutex + void RemoveWaiter(Waiter* waiter); + + // Returns pointer to the waiter that should be waken up next, should be the + // last added waiter. + Waiter* TopWaiter(); + Mutex mu_; // Protecting lock - CondVar wait_nonempty_; // Wait on empty queue on get - int num_waiters_ = 0; // Number of waiters + Waiter waiters_; // Head of waiting thread queue + + Node** delete_list_ = nullptr; // Keeps track of all allocated array entries + // for deleting on destruction + size_t delete_list_count_ = 0; // Number of entries in list + size_t delete_list_size_ = 0; // Size of the list. List will be expanded to + // double size on full Node* queue_head_ = nullptr; // Head of the queue, remove position Node* queue_tail_ = nullptr; // End of queue, insert position Atomic count_{0}; // Number of elements in queue + Stats stats_; // Stats info gpr_timespec busy_time; // Start time of busy queue + + // Internal Helper. + // Allocates an array of nodes of size "num", links all nodes together except + // the first node's prev and last node's next. They should be set by caller + // manually afterward. + Node* AllocateNodes(int num); }; } // namespace grpc_core diff --git a/test/core/iomgr/mpmcqueue_test.cc b/test/core/iomgr/mpmcqueue_test.cc index a301832f608..68d1da65405 100644 --- a/test/core/iomgr/mpmcqueue_test.cc +++ b/test/core/iomgr/mpmcqueue_test.cc @@ -119,6 +119,50 @@ static void test_FIFO(void) { } } +static void test_space_efficiency(void) { + gpr_log(GPR_INFO, "test_space_efficiency"); + grpc_core::InfLenFIFOQueue queue; + for (int i = 0; i < 1024; ++i) { + queue.Put(static_cast(grpc_core::New(i))); + } + GPR_ASSERT(queue.num_node() == 1024); + for (int i = 0; i < 1024; ++i) { + WorkItem* item = static_cast(queue.Get()); + queue.Put(item); + } + GPR_ASSERT(queue.num_node() == 1024); + for (int i = 0; i < 1024; ++i) { + WorkItem* item = static_cast(queue.Get()); + grpc_core::Delete(item); + } + GPR_ASSERT(queue.num_node() == 1024); + GPR_ASSERT(queue.count() == 0); + // queue empty now + for (int i = 0; i < 4000; ++i) { + queue.Put(static_cast(grpc_core::New(i))); + } + GPR_ASSERT(queue.count() == 4000); + GPR_ASSERT(queue.num_node() == 4096); + for (int i = 0; i < 2000; ++i) { + WorkItem* item = static_cast(queue.Get()); + grpc_core::Delete(item); + } + GPR_ASSERT(queue.count() == 2000); + GPR_ASSERT(queue.num_node() == 4096); + for (int i = 0; i < 1000; ++i) { + queue.Put(static_cast(grpc_core::New(i))); + } + GPR_ASSERT(queue.count() == 3000); + GPR_ASSERT(queue.num_node() == 4096); + for (int i = 0; i < 3000; ++i) { + WorkItem* item = static_cast(queue.Get()); + grpc_core::Delete(item); + } + GPR_ASSERT(queue.count() == 0); + GPR_ASSERT(queue.num_node() == 4096); + gpr_log(GPR_DEBUG, "Done."); +} + static void test_many_thread(void) { gpr_log(GPR_INFO, "test_many_thread"); const int num_producer_threads = 10; @@ -172,6 +216,7 @@ int main(int argc, char** argv) { grpc::testing::TestEnvironment env(argc, argv); grpc_init(); test_FIFO(); + test_space_efficiency(); test_many_thread(); grpc_shutdown(); return 0; From 85314b3fcc4a71ac25911deaac03a1540514e5f7 Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Fri, 19 Jul 2019 10:49:35 -0700 Subject: [PATCH 068/661] Re-format --- test/cpp/microbenchmarks/bm_threadpool.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_threadpool.cc b/test/cpp/microbenchmarks/bm_threadpool.cc index 07b99146064..468b6b53a91 100644 --- a/test/cpp/microbenchmarks/bm_threadpool.cc +++ b/test/cpp/microbenchmarks/bm_threadpool.cc @@ -49,6 +49,7 @@ class BlockingCounter { cv_.wait(l); } } + private: int count_; std::mutex mu_; @@ -153,11 +154,8 @@ static void BM_ThreadPool2048AddAnother(benchmark::State& state) { } BENCHMARK(BM_ThreadPool2048AddAnother)->RangePair(524288, 524288, 1, 1024); - - // A functor class that will delete self on end of running. -class SuicideFunctorForAdd - : public grpc_experimental_completion_queue_functor { +class SuicideFunctorForAdd : public grpc_experimental_completion_queue_functor { public: SuicideFunctorForAdd(BlockingCounter* counter) : counter_(counter) { functor_run = &SuicideFunctorForAdd::Run; @@ -176,7 +174,6 @@ class SuicideFunctorForAdd BlockingCounter* counter_; }; - // Performs the scenario of external thread(s) adding closures into pool. static void BM_ThreadPoolExternalAdd(benchmark::State& state) { static grpc_core::ThreadPool* external_add_pool = nullptr; @@ -185,7 +182,7 @@ static void BM_ThreadPoolExternalAdd(benchmark::State& state) { const int num_threads = state.range(1); external_add_pool = new grpc_core::ThreadPool(num_threads); } -const int num_iterations = state.range(0); + const int num_iterations = state.range(0); while (state.KeepRunningBatch(num_iterations)) { BlockingCounter counter(num_iterations); for (int i = 0; i < num_iterations; ++i) { @@ -287,13 +284,14 @@ class ShortWorkFunctorForAdd val_ = 0; } ~ShortWorkFunctorForAdd() {} - static void Run(grpc_experimental_completion_queue_functor *cb, int ok) { + static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { auto* callback = static_cast(cb); for (int i = 0; i < 1000; ++i) { callback->val_++; } callback->counter_->DecrementCount(); } + private: char pad[ABSL_CACHELINE_SIZE]; volatile int val_; From 3ec57262161aafe4a5d0d1c0a52400016c97ce74 Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Fri, 19 Jul 2019 10:57:28 -0700 Subject: [PATCH 069/661] Re-format --- src/core/lib/iomgr/executor/mpmcqueue.cc | 12 +++++------- src/core/lib/iomgr/executor/mpmcqueue.h | 10 +++++----- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/core/lib/iomgr/executor/mpmcqueue.cc b/src/core/lib/iomgr/executor/mpmcqueue.cc index 7ef5cf40e14..15b2938a3ac 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.cc +++ b/src/core/lib/iomgr/executor/mpmcqueue.cc @@ -33,8 +33,8 @@ inline void* InfLenFIFOQueue::PopFront() { // Updates Stats when trace flag turned on. if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace)) { - gpr_timespec wait_time = gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), - queue_head_->insert_time); + gpr_timespec wait_time = + gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), queue_head_->insert_time); stats_.num_completed++; stats_.total_queue_time = gpr_time_add(stats_.total_queue_time, wait_time); stats_.max_queue_time = gpr_time_max( @@ -103,7 +103,7 @@ void InfLenFIFOQueue::Put(void* elem) { int curr_count = count_.Load(MemoryOrder::RELAXED); - if (queue_tail_ == queue_head_ && curr_count!= 0) { + if (queue_tail_ == queue_head_ && curr_count != 0) { // List is full. Expands list to double size by inserting new chunk of nodes Node* new_chunk = AllocateNodes(curr_count); delete_list_[delete_list_count_++] = new_chunk; @@ -166,7 +166,7 @@ void* InfLenFIFOQueue::Get(gpr_timespec* wait_time) { size_t InfLenFIFOQueue::num_node() { size_t num = 1024; for (size_t i = 1; i < delete_list_count_; ++i) { - num = num* 2; + num = num * 2; } return num; } @@ -184,8 +184,6 @@ void InfLenFIFOQueue::RemoveWaiter(Waiter* waiter) { waiter->prev->next = waiter->next; } -InfLenFIFOQueue::Waiter* InfLenFIFOQueue::TopWaiter() { - return waiters_.next; -} +InfLenFIFOQueue::Waiter* InfLenFIFOQueue::TopWaiter() { return waiters_.next; } } // namespace grpc_core diff --git a/src/core/lib/iomgr/executor/mpmcqueue.h b/src/core/lib/iomgr/executor/mpmcqueue.h index 05e5a0a7579..49bebf8af4b 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.h +++ b/src/core/lib/iomgr/executor/mpmcqueue.h @@ -76,7 +76,7 @@ class InfLenFIFOQueue : public MPMCQueueInterface { int count() const { return count_.Load(MemoryOrder::RELAXED); } struct Node { - Node* next; // Linking + Node* next; // Linking Node* prev; void* content; // Points to actual element gpr_timespec insert_time; // Time for stats @@ -141,8 +141,8 @@ class InfLenFIFOQueue : public MPMCQueueInterface { // last added waiter. Waiter* TopWaiter(); - Mutex mu_; // Protecting lock - Waiter waiters_; // Head of waiting thread queue + Mutex mu_; // Protecting lock + Waiter waiters_; // Head of waiting thread queue Node** delete_list_ = nullptr; // Keeps track of all allocated array entries // for deleting on destruction @@ -154,8 +154,8 @@ class InfLenFIFOQueue : public MPMCQueueInterface { Node* queue_tail_ = nullptr; // End of queue, insert position Atomic count_{0}; // Number of elements in queue - Stats stats_; // Stats info - gpr_timespec busy_time; // Start time of busy queue + Stats stats_; // Stats info + gpr_timespec busy_time; // Start time of busy queue // Internal Helper. // Allocates an array of nodes of size "num", links all nodes together except From 847faf407f4f2a45aa13478d97187b38d9ea350e Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Fri, 19 Jul 2019 12:10:52 -0700 Subject: [PATCH 070/661] Removes unused variable error --- test/cpp/microbenchmarks/bm_threadpool.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/test/cpp/microbenchmarks/bm_threadpool.cc b/test/cpp/microbenchmarks/bm_threadpool.cc index 468b6b53a91..cee0fa4c497 100644 --- a/test/cpp/microbenchmarks/bm_threadpool.cc +++ b/test/cpp/microbenchmarks/bm_threadpool.cc @@ -286,6 +286,7 @@ class ShortWorkFunctorForAdd ~ShortWorkFunctorForAdd() {} static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { auto* callback = static_cast(cb); + callback->pad[0] = 0; for (int i = 0; i < 1000; ++i) { callback->val_++; } From 6e7ed1441c88b0d996c7c95ca6abbad9352ae73a Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Fri, 19 Jul 2019 16:29:24 -0700 Subject: [PATCH 071/661] Added copyright statements --- .../tvOS-sample/tvOS-sample/AppDelegate.h | 24 ++++++++++++------ .../tvOS-sample/tvOS-sample/AppDelegate.m | 24 ++++++++++++------ .../tvOS-sample/tvOS-sample/ViewController.h | 24 ++++++++++++------ .../tvOS-sample/tvOS-sample/ViewController.m | 24 ++++++++++++------ .../examples/tvOS-sample/tvOS-sample/main.m | 24 ++++++++++++------ .../ExtensionDelegate.h | 24 ++++++++++++------ .../ExtensionDelegate.m | 24 ++++++++++++------ .../InterfaceController.h | 24 ++++++++++++------ .../InterfaceController.m | 25 +++++++++++++------ .../watchOS-sample/AppDelegate.h | 24 ++++++++++++------ .../watchOS-sample/AppDelegate.m | 24 ++++++++++++------ .../watchOS-sample/ViewController.h | 24 ++++++++++++------ .../watchOS-sample/ViewController.m | 24 ++++++++++++------ .../watchOS-sample/watchOS-sample/main.m | 24 ++++++++++++------ 14 files changed, 238 insertions(+), 99 deletions(-) diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.h b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.h index 24f0d222e54..a1de90167cd 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.h +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.h @@ -1,10 +1,20 @@ -// -// AppDelegate.h -// tvOS-sample -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m index e04dba4c4c1..25b429523a3 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m @@ -1,10 +1,20 @@ -// -// AppDelegate.m -// tvOS-sample -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import "AppDelegate.h" diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.h b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.h index 703e8bdb36e..79de577af81 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.h +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.h @@ -1,10 +1,20 @@ -// -// ViewController.h -// tvOS-sample -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m index 69e1e0ce87b..289de19f5de 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m @@ -1,10 +1,20 @@ -// -// ViewController.m -// tvOS-sample -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import "ViewController.h" diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m index f18a9db860e..62a9f8e6efb 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m @@ -1,10 +1,20 @@ -// -// main.m -// tvOS-sample -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import #import "AppDelegate.h" diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.h b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.h index df2e8e156b6..9b48cc95e6a 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.h +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.h @@ -1,10 +1,20 @@ -// -// ExtensionDelegate.h -// watchOS-sample WatchKit Extension -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.m b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.m index 97d553aa855..47de32a3de9 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.m @@ -1,10 +1,20 @@ -// -// ExtensionDelegate.m -// watchOS-sample WatchKit Extension -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import "ExtensionDelegate.h" diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.h b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.h index cd5752bcc5c..46032d6030e 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.h +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.h @@ -1,10 +1,20 @@ -// -// InterfaceController.h -// watchOS-sample WatchKit Extension -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import #import diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.m b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.m index 9722a80ca50..ec3e90c95a5 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.m @@ -1,11 +1,20 @@ -// -// InterfaceController.m -// watchOS-sample WatchKit Extension -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// - +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import "InterfaceController.h" #import diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.h b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.h index 762a16888a2..a1de90167cd 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.h +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.h @@ -1,10 +1,20 @@ -// -// AppDelegate.h -// watchOS-sample -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m index 1f77c1fb15c..571139a3d64 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m @@ -1,10 +1,20 @@ -// -// AppDelegate.m -// watchOS-sample -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import "AppDelegate.h" diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.h b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.h index 336e0ee57f2..79de577af81 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.h +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.h @@ -1,10 +1,20 @@ -// -// ViewController.h -// watchOS-sample -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m index bc2f24a168b..c5cea11f5bc 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m @@ -1,10 +1,20 @@ -// -// ViewController.m -// watchOS-sample -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import "ViewController.h" diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m index a57a3cac1a5..62a9f8e6efb 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m @@ -1,10 +1,20 @@ -// -// main.m -// watchOS-sample -// -// Created by Tony Lu on 7/12/19. -// Copyright © 2019 Tony Lu. All rights reserved. -// +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #import #import "AppDelegate.h" From b458f3e6a52b9811a1e47c5a649cfc29a158933a Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Fri, 19 Jul 2019 16:33:40 -0700 Subject: [PATCH 072/661] Fixed clang_code_format --- .../tvOS-sample/tvOS-sample/AppDelegate.h | 6 ++-- .../tvOS-sample/tvOS-sample/AppDelegate.m | 32 ++++++++++--------- .../tvOS-sample/tvOS-sample/ViewController.h | 2 -- .../tvOS-sample/tvOS-sample/ViewController.m | 9 +++--- .../examples/tvOS-sample/tvOS-sample/main.m | 4 +-- .../watchOS-sample/AppDelegate.h | 6 ++-- .../watchOS-sample/AppDelegate.m | 32 ++++++++++--------- .../watchOS-sample/ViewController.h | 2 -- .../watchOS-sample/ViewController.m | 1 - .../watchOS-sample/watchOS-sample/main.m | 4 +-- templates/gRPC-Core.podspec.template | 3 +- templates/gRPC-RxLibrary.podspec.template | 1 + templates/gRPC.podspec.template | 1 + 13 files changed, 50 insertions(+), 53 deletions(-) diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.h b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.h index a1de90167cd..183abcf4ec8 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.h +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.h @@ -18,10 +18,8 @@ #import -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; +@interface AppDelegate : UIResponder +@property(strong, nonatomic) UIWindow* window; @end - diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m index 25b429523a3..11b6c418aee 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m @@ -24,38 +24,40 @@ @implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { +- (BOOL)application:(UIApplication *)application + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. return YES; } - - (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. + // Sent when the application is about to move from active to inactive state. This can occur for + // certain types of temporary interruptions (such as an incoming phone call or SMS message) or + // when the user quits the application and it begins the transition to the background state. Use + // this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. + // Games should use this method to pause the game. } - - (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + // Use this method to release shared resources, save user data, invalidate timers, and store + // enough application state information to restore your application to its current state in case + // it is terminated later. If your application supports background execution, this method is + // called instead of applicationWillTerminate: when the user quits. } - - (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + // Called as part of the transition from the background to the active state; here you can undo + // many of the changes made on entering the background. } - - (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + // Restart any tasks that were paused (or not yet started) while the application was inactive. If + // the application was previously in the background, optionally refresh the user interface. } - - (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + // Called when the application is about to terminate. Save data if appropriate. See also + // applicationDidEnterBackground:. } - @end diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.h b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.h index 79de577af81..0aa0b2a73a7 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.h +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.h @@ -20,6 +20,4 @@ @interface ViewController : UIViewController - @end - diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m index 289de19f5de..0d291e44842 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m @@ -32,10 +32,10 @@ - (void)viewDidLoad { [super viewDidLoad]; - + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; _options = options; - + _service = [[RMTTestService alloc] initWithHost:@"grpc-test.sandbox.googleapis.com" callOptions:_options]; } @@ -43,9 +43,8 @@ - (IBAction)makeCall:(id)sender { RMTSimpleRequest *request = [RMTSimpleRequest message]; request.responseSize = 100; - GRPCUnaryProtoCall *call = [_service unaryCallWithMessage:request - responseHandler:self - callOptions:nil]; + GRPCUnaryProtoCall *call = + [_service unaryCallWithMessage:request responseHandler:self callOptions:nil]; [call start]; } diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m index 62a9f8e6efb..2797c6f17f2 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m @@ -19,8 +19,8 @@ #import #import "AppDelegate.h" -int main(int argc, char * argv[]) { +int main(int argc, char* argv[]) { @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.h b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.h index a1de90167cd..183abcf4ec8 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.h +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.h @@ -18,10 +18,8 @@ #import -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; +@interface AppDelegate : UIResponder +@property(strong, nonatomic) UIWindow* window; @end - diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m index 571139a3d64..d78f5f2175c 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m @@ -24,38 +24,40 @@ @implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { +- (BOOL)application:(UIApplication *)application + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. return YES; } - - (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + // Sent when the application is about to move from active to inactive state. This can occur for + // certain types of temporary interruptions (such as an incoming phone call or SMS message) or + // when the user quits the application and it begins the transition to the background state. Use + // this method to pause ongoing tasks, disable timers, and invalidate graphics rendering + // callbacks. Games should use this method to pause the game. } - - (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + // Use this method to release shared resources, save user data, invalidate timers, and store + // enough application state information to restore your application to its current state in case + // it is terminated later. If your application supports background execution, this method is + // called instead of applicationWillTerminate: when the user quits. } - - (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + // Called as part of the transition from the background to the active state; here you can undo + // many of the changes made on entering the background. } - - (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + // Restart any tasks that were paused (or not yet started) while the application was inactive. If + // the application was previously in the background, optionally refresh the user interface. } - - (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + // Called when the application is about to terminate. Save data if appropriate. See also + // applicationDidEnterBackground:. } - @end diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.h b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.h index 79de577af81..0aa0b2a73a7 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.h +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.h @@ -20,6 +20,4 @@ @interface ViewController : UIViewController - @end - diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m index c5cea11f5bc..cd06242f80b 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m @@ -31,5 +31,4 @@ // Do any additional setup after loading the view, typically from a nib. } - @end diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m index 62a9f8e6efb..2797c6f17f2 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m @@ -19,8 +19,8 @@ #import #import "AppDelegate.h" -int main(int argc, char * argv[]) { +int main(int argc, char* argv[]) { @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index d367ce4f45f..43645edf2e4 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -94,7 +94,8 @@ s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' - + s.watchos.deployment_target = '4.0' + s.requires_arc = false name = 'grpc' diff --git a/templates/gRPC-RxLibrary.podspec.template b/templates/gRPC-RxLibrary.podspec.template index 0973b6551db..9389c5ecd8d 100644 --- a/templates/gRPC-RxLibrary.podspec.template +++ b/templates/gRPC-RxLibrary.podspec.template @@ -38,6 +38,7 @@ s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' name = 'RxLibrary' s.module_name = name diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index c9723933fcd..8cb380ede03 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -37,6 +37,7 @@ s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' name = 'GRPCClient' s.module_name = name From 3b5f0fd7658c1d9713665051ddb0743ffe022f22 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 10 Jul 2019 18:47:38 -0700 Subject: [PATCH 073/661] Make dependency injection for Objective-C transport --- gRPC.podspec | 84 +- .../GRPCClient/GRPCCall+ChannelArg.m | 4 +- .../GRPCClient/GRPCCall+ChannelCredentials.m | 2 +- src/objective-c/GRPCClient/GRPCCall+Cronet.h | 12 +- src/objective-c/GRPCClient/GRPCCall+Cronet.m | 4 +- src/objective-c/GRPCClient/GRPCCall+Tests.m | 2 +- src/objective-c/GRPCClient/GRPCCall.h | 134 +-- src/objective-c/GRPCClient/GRPCCall.m | 864 +++--------------- src/objective-c/GRPCClient/GRPCCallLegacy.h | 136 +++ src/objective-c/GRPCClient/GRPCCallLegacy.m | 679 ++++++++++++++ src/objective-c/GRPCClient/GRPCCallOptions.h | 31 +- src/objective-c/GRPCClient/GRPCCallOptions.m | 27 +- src/objective-c/GRPCClient/GRPCDispatchable.h | 30 + src/objective-c/GRPCClient/GRPCInterceptor.h | 33 +- src/objective-c/GRPCClient/GRPCInterceptor.m | 267 ++++-- src/objective-c/GRPCClient/GRPCTransport.h | 61 ++ src/objective-c/GRPCClient/GRPCTransport.m | 116 +++ .../internal_testing/GRPCCall+InternalTests.m | 2 +- .../private/{ => GRPCCore}/ChannelArgsUtil.h | 0 .../private/{ => GRPCCore}/ChannelArgsUtil.m | 0 .../private/{ => GRPCCore}/GRPCCall+V2API.h | 6 - .../private/{ => GRPCCore}/GRPCCallInternal.h | 15 +- .../private/{ => GRPCCore}/GRPCCallInternal.m | 138 +-- .../private/{ => GRPCCore}/GRPCChannel.h | 0 .../private/{ => GRPCCore}/GRPCChannel.m | 70 +- .../{ => GRPCCore}/GRPCChannelFactory.h | 0 .../{ => GRPCCore}/GRPCChannelPool+Test.h | 0 .../private/{ => GRPCCore}/GRPCChannelPool.h | 4 +- .../private/{ => GRPCCore}/GRPCChannelPool.m | 4 +- .../{ => GRPCCore}/GRPCCompletionQueue.h | 0 .../{ => GRPCCore}/GRPCCompletionQueue.m | 0 .../GRPCCoreCronet/GRPCCoreCronetFactory.h | 23 + .../GRPCCoreCronet/GRPCCoreCronetFactory.m | 53 ++ .../GRPCCronetChannelFactory.h | 0 .../GRPCCronetChannelFactory.m | 20 - .../private/GRPCCore/GRPCCoreFactory.h | 40 + .../private/GRPCCore/GRPCCoreFactory.m | 68 ++ .../private/{ => GRPCCore}/GRPCHost.h | 0 .../private/{ => GRPCCore}/GRPCHost.m | 21 +- .../GRPCInsecureChannelFactory.h | 0 .../GRPCInsecureChannelFactory.m | 0 .../private/{ => GRPCCore}/GRPCOpBatchLog.h | 0 .../private/{ => GRPCCore}/GRPCOpBatchLog.m | 0 .../GRPCReachabilityFlagNames.xmacro.h | 0 .../{ => GRPCCore}/GRPCRequestHeaders.h | 2 +- .../{ => GRPCCore}/GRPCRequestHeaders.m | 0 .../{ => GRPCCore}/GRPCSecureChannelFactory.h | 0 .../{ => GRPCCore}/GRPCSecureChannelFactory.m | 0 .../private/{ => GRPCCore}/GRPCWrappedCall.h | 0 .../private/{ => GRPCCore}/GRPCWrappedCall.m | 0 .../private/{ => GRPCCore}/NSData+GRPC.h | 0 .../private/{ => GRPCCore}/NSData+GRPC.m | 0 .../{ => GRPCCore}/NSDictionary+GRPC.h | 0 .../{ => GRPCCore}/NSDictionary+GRPC.m | 0 .../private/{ => GRPCCore}/NSError+GRPC.h | 0 .../private/{ => GRPCCore}/NSError+GRPC.m | 0 .../GRPCClient/private/GRPCCore/version.h | 25 + .../private/GRPCTransport+Private.h | 55 ++ .../private/GRPCTransport+Private.m | 108 +++ src/objective-c/tests/ConfigureCronet.h | 4 - src/objective-c/tests/ConfigureCronet.m | 4 - .../InteropTestsRemoteWithCronet.m | 16 + .../tests/InteropTests/InteropTests.h | 8 + .../tests/InteropTests/InteropTests.m | 174 ++-- .../InteropTests/InteropTestsLocalCleartext.m | 5 +- .../tests/InteropTests/InteropTestsLocalSSL.m | 7 +- .../InteropTestsMultipleChannels.m | 2 - .../tests/InteropTests/InteropTestsRemote.m | 6 - src/objective-c/tests/Podfile | 4 +- .../tests/Tests.xcodeproj/project.pbxproj | 4 +- .../tests/UnitTests/ChannelPoolTest.m | 6 +- .../tests/UnitTests/ChannelTests.m | 10 +- .../tests/UnitTests/NSErrorUnitTests.m | 2 +- templates/gRPC.podspec.template | 84 +- 74 files changed, 2142 insertions(+), 1334 deletions(-) create mode 100644 src/objective-c/GRPCClient/GRPCCallLegacy.h create mode 100644 src/objective-c/GRPCClient/GRPCCallLegacy.m create mode 100644 src/objective-c/GRPCClient/GRPCDispatchable.h create mode 100644 src/objective-c/GRPCClient/GRPCTransport.h create mode 100644 src/objective-c/GRPCClient/GRPCTransport.m rename src/objective-c/GRPCClient/private/{ => GRPCCore}/ChannelArgsUtil.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/ChannelArgsUtil.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCCall+V2API.h (79%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCCallInternal.h (71%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCCallInternal.m (68%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCChannel.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCChannel.m (77%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCChannelFactory.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCChannelPool+Test.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCChannelPool.h (97%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCChannelPool.m (98%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCCompletionQueue.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCCompletionQueue.m (100%) create mode 100644 src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h create mode 100644 src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m rename src/objective-c/GRPCClient/private/{ => GRPCCore/GRPCCoreCronet}/GRPCCronetChannelFactory.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore/GRPCCoreCronet}/GRPCCronetChannelFactory.m (79%) create mode 100644 src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h create mode 100644 src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCHost.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCHost.m (87%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCInsecureChannelFactory.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCInsecureChannelFactory.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCOpBatchLog.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCOpBatchLog.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCReachabilityFlagNames.xmacro.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCRequestHeaders.h (95%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCRequestHeaders.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCSecureChannelFactory.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCSecureChannelFactory.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCWrappedCall.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCWrappedCall.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/NSData+GRPC.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/NSData+GRPC.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/NSDictionary+GRPC.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/NSDictionary+GRPC.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/NSError+GRPC.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/NSError+GRPC.m (100%) create mode 100644 src/objective-c/GRPCClient/private/GRPCCore/version.h create mode 100644 src/objective-c/GRPCClient/private/GRPCTransport+Private.h create mode 100644 src/objective-c/GRPCClient/private/GRPCTransport+Private.m diff --git a/gRPC.podspec b/gRPC.podspec index bbfd08f9774..815da6ef7c1 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -40,10 +40,8 @@ Pod::Spec.new do |s| s.module_name = name s.header_dir = name - src_dir = 'src/objective-c/GRPCClient' - s.dependency 'gRPC-RxLibrary', version - s.default_subspec = 'Main' + s.default_subspec = 'Interface', 'GRPCCore' # Certificates, to be able to establish TLS connections: s.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } @@ -54,29 +52,75 @@ Pod::Spec.new do |s| 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } - s.subspec 'Main' do |ss| - ss.header_mappings_dir = "#{src_dir}" + s.subspec 'Interface' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' + + ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall.h', + 'src/objective-c/GRPCClient/GRPCCall+Interceptor.h', + 'src/objective-c/GRPCClient/GRPCCallOptions.h', + 'src/objective-c/GRPCClient/GRPCInterceptor.h', + 'src/objective-c/GRPCClient/GRPCTransport.h', + 'src/objective-c/GRPCClient/GRPCDispatchable.h', + 'src/objective-c/GRPCClient/internal/*.h' + + ss.source_files = 'src/objective-c/GRPCClient/GRPCCall.h', + 'src/objective-c/GRPCClient/GRPCCall.m', + 'src/objective-c/GRPCClient/GRPCCall+Interceptor.h', + 'src/objective-c/GRPCClient/GRPCCall+Interceptor.m', + 'src/objective-c/GRPCClient/GRPCCallOptions.h', + 'src/objective-c/GRPCClient/GRPCCallOptions.m', + 'src/objective-c/GRPCClient/GRPCDispatchable.h', + 'src/objective-c/GRPCClient/GRPCInterceptor.h', + 'src/objective-c/GRPCClient/GRPCInterceptor.m', + 'src/objective-c/GRPCClient/GRPCTransport.h', + 'src/objective-c/GRPCClient/GRPCTransport.m', + 'src/objective-c/GRPCClient/private/GRPCTransport+Private.h', + 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m' + end - ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" - ss.exclude_files = "#{src_dir}/GRPCCall+GID.{h,m}" - ss.private_header_files = "#{src_dir}/private/*.h", "#{src_dir}/internal/*.h" + s.subspec 'GRPCCore' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' + + ss.public_header_files = 'src/objective-c/GRPCClient/ChannelArg.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', + 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', + 'src/objective-c/GRPCClient/GRPCCall+Tests.h', + 'src/objective-c/GRPCClient/GRPCCallLegacy.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', + 'src/objective-c/GRPCClient/internal_testing/*.h' + ss.private_header_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.h' + ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.h', + 'src/objective-c/GRPCClient/private/GRPCCore/*.{h,m}', + 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.m', + 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', + 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', + 'src/objective-c/GRPCClient/GRPCCall+OAuth2.m', + 'src/objective-c/GRPCClient/GRPCCall+Tests.h', + 'src/objective-c/GRPCClient/GRPCCall+Tests.m', + 'src/objective-c/GRPCClient/GRPCCallLegacy.h', + 'src/objective-c/GRPCClient/GRPCCallLegacy.m' ss.dependency 'gRPC-Core', version + ss.dependency "#{s.name}/Interface", version end - # CFStream is now default. Leaving this subspec only for compatibility purpose. - s.subspec 'CFStream' do |ss| - ss.dependency "#{s.name}/Main", version - end - - s.subspec 'GID' do |ss| - ss.ios.deployment_target = '7.0' - - ss.header_mappings_dir = "#{src_dir}" + s.subspec 'GRPCCoreCronet' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' - ss.source_files = "#{src_dir}/GRPCCall+GID.{h,m}" + ss.source_files = 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', + 'src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/*.{h,m}' + ss.dependency 'CronetFramework' + ss.dependency 'gRPC-Core/Cronet-Implementation', version + end - ss.dependency "#{s.name}/Main", version - ss.dependency 'Google/SignIn' + # CFStream is now default. Leaving this subspec only for compatibility purpose. + s.subspec 'CFStream' do |ss| + ss.dependency "#{s.name}/GRPCCore", version end end diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m index ae60d6208e1..aae1b740c71 100644 --- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m +++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m @@ -18,8 +18,8 @@ #import "GRPCCall+ChannelArg.h" -#import "private/GRPCChannelPool.h" -#import "private/GRPCHost.h" +#import "private/GRPCCore/GRPCChannelPool.h" +#import "private/GRPCCore/GRPCHost.h" #import diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m index 2689ec2effb..aa97ca82bf8 100644 --- a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m +++ b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m @@ -18,7 +18,7 @@ #import "GRPCCall+ChannelCredentials.h" -#import "private/GRPCHost.h" +#import "private/GRPCCore/GRPCHost.h" @implementation GRPCCall (ChannelCredentials) diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.h b/src/objective-c/GRPCClient/GRPCCall+Cronet.h index 3059c6f1860..c77816b8df6 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.h +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.h @@ -15,12 +15,16 @@ * limitations under the License. * */ -#ifdef GRPC_COMPILE_WITH_CRONET -#import #import "GRPCCall.h" +#import "GRPCTransport.h" -// Deprecated interface. Please use GRPCCallOptions instead. +typedef struct stream_engine stream_engine; + +// Transport id for Cronet transport +extern const GRPCTransportId gGRPCCoreCronetId; + +// Deprecated class. Please use the previous transport id with GRPCCallOptions instead. @interface GRPCCall (Cronet) + (void)useCronetWithEngine:(stream_engine*)engine; @@ -28,4 +32,4 @@ + (BOOL)isUsingCronet; @end -#endif + diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.m b/src/objective-c/GRPCClient/GRPCCall+Cronet.m index ba8d2c23db8..a732208e1f6 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.m +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.m @@ -18,7 +18,8 @@ #import "GRPCCall+Cronet.h" -#ifdef GRPC_COMPILE_WITH_CRONET +const GRPCTransportId gGRPCCoreCronetId = "io.grpc.transport.core.cronet"; + static BOOL useCronet = NO; static stream_engine *globalCronetEngine; @@ -38,4 +39,3 @@ static stream_engine *globalCronetEngine; } @end -#endif diff --git a/src/objective-c/GRPCClient/GRPCCall+Tests.m b/src/objective-c/GRPCClient/GRPCCall+Tests.m index ac3b6a658f9..9a704443e62 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Tests.m +++ b/src/objective-c/GRPCClient/GRPCCall+Tests.m @@ -18,7 +18,7 @@ #import "GRPCCall+Tests.h" -#import "private/GRPCHost.h" +#import "private/GRPCCore/GRPCHost.h" #import "GRPCCallOptions.h" diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index d02ec601727..504da43329a 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -33,11 +33,16 @@ */ #import -#import -#include +#import "GRPCCallOptions.h" +#import "GRPCDispatchable.h" -#include "GRPCCallOptions.h" +// The legacy header is included for backwards compatibility. Some V1 API users are still using +// GRPCCall by importing GRPCCall.h header so we need this import. However, if a user needs to +// exclude the core implementation, they may do so by defining GRPC_OBJC_NO_LEGACY_COMPATIBILITY. +#ifndef GRPC_OBJC_NO_LEGACY_COMPATIBILITY +#import "GRPCCallLegacy.h" +#endif NS_ASSUME_NONNULL_BEGIN @@ -52,6 +57,8 @@ extern NSString *const kGRPCErrorDomain; * server applications to produce. */ typedef NS_ENUM(NSUInteger, GRPCErrorCode) { + GRPCErrorCodeOk = 0, + /** The operation was cancelled (typically by the caller). */ GRPCErrorCodeCancelled = 1, @@ -152,15 +159,7 @@ extern NSString *const kGRPCHeadersKey; extern NSString *const kGRPCTrailersKey; /** An object can implement this protocol to receive responses from server from a call. */ -@protocol GRPCResponseHandler - -@required - -/** - * All the responses must be issued to a user-provided dispatch queue. This property specifies the - * dispatch queue to be used for issuing the notifications. - */ -@property(atomic, readonly) dispatch_queue_t dispatchQueue; +@protocol GRPCResponseHandler @optional @@ -302,114 +301,3 @@ extern NSString *const kGRPCTrailersKey; @end NS_ASSUME_NONNULL_END - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnullability-completeness" - -/** - * This interface is deprecated. Please use \a GRPCcall2. - * - * Represents a single gRPC remote call. - */ -@interface GRPCCall : GRXWriter - -- (instancetype)init NS_UNAVAILABLE; - -/** - * The container of the request headers of an RPC conforms to this protocol, which is a subset of - * NSMutableDictionary's interface. It will become a NSMutableDictionary later on. - * The keys of this container are the header names, which per the HTTP standard are case- - * insensitive. They are stored in lowercase (which is how HTTP/2 mandates them on the wire), and - * can only consist of ASCII characters. - * A header value is a NSString object (with only ASCII characters), unless the header name has the - * suffix "-bin", in which case the value has to be a NSData object. - */ -/** - * These HTTP headers will be passed to the server as part of this call. Each HTTP header is a - * name-value pair with string names and either string or binary values. - * - * The passed dictionary has to use NSString keys, corresponding to the header names. The value - * associated to each can be a NSString object or a NSData object. E.g.: - * - * call.requestHeaders = @{@"authorization": @"Bearer ..."}; - * - * call.requestHeaders[@"my-header-bin"] = someData; - * - * After the call is started, trying to modify this property is an error. - * - * The property is initialized to an empty NSMutableDictionary. - */ -@property(atomic, readonly) NSMutableDictionary *requestHeaders; - -/** - * This dictionary is populated with the HTTP headers received from the server. This happens before - * any response message is received from the server. It has the same structure as the request - * headers dictionary: Keys are NSString header names; names ending with the suffix "-bin" have a - * NSData value; the others have a NSString value. - * - * The value of this property is nil until all response headers are received, and will change before - * any of -writeValue: or -writesFinishedWithError: are sent to the writeable. - */ -@property(atomic, readonly) NSDictionary *responseHeaders; - -/** - * Same as responseHeaders, but populated with the HTTP trailers received from the server before the - * call finishes. - * - * The value of this property is nil until all response trailers are received, and will change - * before -writesFinishedWithError: is sent to the writeable. - */ -@property(atomic, readonly) NSDictionary *responseTrailers; - -/** - * The request writer has to write NSData objects into the provided Writeable. The server will - * receive each of those separately and in order as distinct messages. - * A gRPC call might not complete until the request writer finishes. On the other hand, the request - * finishing doesn't necessarily make the call to finish, as the server might continue sending - * messages to the response side of the call indefinitely (depending on the semantics of the - * specific remote method called). - * To finish a call right away, invoke cancel. - * host parameter should not contain the scheme (http:// or https://), only the name or IP addr - * and the port number, for example @"localhost:5050". - */ -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - requestsWriter:(GRXWriter *)requestWriter; - -/** - * Finishes the request side of this call, notifies the server that the RPC should be cancelled, and - * finishes the response side of the call with an error of code CANCELED. - */ -- (void)cancel; - -/** - * The following methods are deprecated. - */ -+ (void)setCallSafety:(GRPCCallSafety)callSafety host:(NSString *)host path:(NSString *)path; -@property(atomic, copy, readwrite) NSString *serverName; -@property NSTimeInterval timeout; -- (void)setResponseDispatchQueue:(dispatch_queue_t)queue; - -@end - -#pragma mark Backwards compatibiity - -/** This protocol is kept for backwards compatibility with existing code. */ -DEPRECATED_MSG_ATTRIBUTE("Use NSDictionary or NSMutableDictionary instead.") -@protocol GRPCRequestHeaders -@property(nonatomic, readonly) NSUInteger count; - -- (id)objectForKeyedSubscript:(id)key; -- (void)setObject:(id)obj forKeyedSubscript:(id)key; - -- (void)removeAllObjects; -- (void)removeObjectForKey:(id)key; -@end - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" -/** This is only needed for backwards-compatibility. */ -@interface NSMutableDictionary (GRPCRequestHeaders) -@end -#pragma clang diagnostic pop -#pragma clang diagnostic pop diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index cd293cc8e59..2f2a89c20ac 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -17,56 +17,84 @@ */ #import "GRPCCall.h" -#import "GRPCCall+Interceptor.h" -#import "GRPCCall+OAuth2.h" -#import "GRPCCallOptions.h" -#import "GRPCInterceptor.h" -#import -#import -#import -#import -#include #include +#import "GRPCCallOptions.h" +#import "GRPCInterceptor.h" +#import "GRPCCall+Interceptor.h" -#import "private/GRPCCall+V2API.h" -#import "private/GRPCCallInternal.h" -#import "private/GRPCChannelPool.h" -#import "private/GRPCCompletionQueue.h" -#import "private/GRPCHost.h" -#import "private/GRPCRequestHeaders.h" -#import "private/GRPCWrappedCall.h" -#import "private/NSData+GRPC.h" -#import "private/NSDictionary+GRPC.h" -#import "private/NSError+GRPC.h" - -// At most 6 ops can be in an op batch for a client: SEND_INITIAL_METADATA, -// SEND_MESSAGE, SEND_CLOSE_FROM_CLIENT, RECV_INITIAL_METADATA, RECV_MESSAGE, -// and RECV_STATUS_ON_CLIENT. -NSInteger kMaxClientBatch = 6; +#import "private/GRPCTransport+Private.h" +#import "private/GRPCCore/GRPCCoreFactory.h" NSString *const kGRPCHeadersKey = @"io.grpc.HeadersKey"; NSString *const kGRPCTrailersKey = @"io.grpc.TrailersKey"; -static NSMutableDictionary *callFlags; -static NSString *const kAuthorizationHeader = @"authorization"; -static NSString *const kBearerPrefix = @"Bearer "; +/** + * The response dispatcher creates its own serial dispatch queue and target the queue to the + * dispatch queue of a user provided response handler. It removes the requirement of having to use + * serial dispatch queue in the user provided response handler. + */ +@interface GRPCResponseDispatcher : NSObject + +- (nullable instancetype)initWithResponseHandler:(id)responseHandler; + +@end + +@implementation GRPCResponseDispatcher { + id _responseHandler; + dispatch_queue_t _dispatchQueue; +} + +- (instancetype)initWithResponseHandler:(id)responseHandler { + if ((self = [super init])) { + _responseHandler = responseHandler; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 + if (@available(iOS 8.0, macOS 10.10, *)) { + _dispatchQueue = dispatch_queue_create(NULL, dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); + } else { +#else + { +#endif + _dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); + } + dispatch_set_target_queue(_dispatchQueue, _responseHandler.dispatchQueue); + } -const char *kCFStreamVarName = "grpc_cfstream"; + return self; +} -@interface GRPCCall () -// Make them read-write. -@property(atomic, strong) NSDictionary *responseHeaders; -@property(atomic, strong) NSDictionary *responseTrailers; + - (dispatch_queue_t)dispatchQueue { + return _dispatchQueue; + } -- (void)receiveNextMessages:(NSUInteger)numberOfMessages; + - (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata { + if ([_responseHandler respondsToSelector:@selector(didReceiveInitialMetadata:)]) { + [_responseHandler didReceiveInitialMetadata:initialMetadata]; + } + } -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - callSafety:(GRPCCallSafety)safety - requestsWriter:(GRXWriter *)requestsWriter - callOptions:(GRPCCallOptions *)callOptions - writeDone:(void (^)(void))writeDone; + - (void)didReceiveData:(id)data { + // For backwards compatibility with didReceiveRawMessage, if the user provided a response handler + // that handles didReceiveRawMesssage, we issue to that method instead + if ([_responseHandler respondsToSelector:@selector(didReceiveRawMessage:)]) { + [_responseHandler didReceiveRawMessage:data]; + } else if ([_responseHandler respondsToSelector:@selector(didReceiveData:)]) { + [_responseHandler didReceiveData:data]; + } + } + + - (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata +error:(nullable NSError *)error { + if ([_responseHandler respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { + [_responseHandler didCloseWithTrailingMetadata:trailingMetadata error:error]; + } +} + + - (void)didWriteData { + if ([_responseHandler respondsToSelector:@selector(didWriteData)]) { + [_responseHandler didWriteData]; + } + } @end @@ -140,54 +168,35 @@ const char *kCFStreamVarName = "grpc_cfstream"; } _responseHandler = responseHandler; - // Initialize the interceptor chain - - // First initialize the internal call - GRPCCall2Internal *internalCall = [[GRPCCall2Internal alloc] init]; - id nextInterceptor = internalCall; - GRPCInterceptorManager *nextManager = nil; - - // Then initialize the global interceptor, if applicable + GRPCResponseDispatcher *dispatcher = [[GRPCResponseDispatcher alloc] initWithResponseHandler:_responseHandler]; + NSMutableArray> *interceptorFactories; + if (_actualCallOptions.interceptorFactories != nil) { + interceptorFactories = [NSMutableArray arrayWithArray:_actualCallOptions.interceptorFactories]; + } else { + interceptorFactories = [NSMutableArray array]; + } id globalInterceptorFactory = [GRPCCall2 globalInterceptorFactory]; - if (globalInterceptorFactory) { - GRPCInterceptorManager *manager = - [[GRPCInterceptorManager alloc] initWithNextInterceptor:nextInterceptor]; - GRPCInterceptor *interceptor = - [globalInterceptorFactory createInterceptorWithManager:manager]; - if (interceptor != nil) { - [internalCall setResponseHandler:interceptor]; - nextInterceptor = interceptor; - nextManager = manager; - } + if (globalInterceptorFactory != nil) { + [interceptorFactories addObject:globalInterceptorFactory]; } - - // Finally initialize the interceptors in the chain - NSArray *interceptorFactories = _actualCallOptions.interceptorFactories; - for (int i = (int)interceptorFactories.count - 1; i >= 0; i--) { - GRPCInterceptorManager *manager = - [[GRPCInterceptorManager alloc] initWithNextInterceptor:nextInterceptor]; - GRPCInterceptor *interceptor = [interceptorFactories[i] createInterceptorWithManager:manager]; - NSAssert(interceptor != nil, @"Failed to create interceptor from factory: %@", - interceptorFactories[i]); - if (interceptor == nil) { - NSLog(@"Failed to create interceptor from factory: %@", interceptorFactories[i]); - continue; - } - if (nextManager == nil) { - [internalCall setResponseHandler:interceptor]; + // continuously create interceptor until one is successfully created + while (_firstInterceptor == nil) { + if (interceptorFactories.count == 0) { + _firstInterceptor = [[GRPCTransportManager alloc] initWithTransportId:_callOptions.transport previousInterceptor:dispatcher]; + break; } else { - [nextManager setPreviousInterceptor:interceptor]; + _firstInterceptor = [[GRPCInterceptorManager alloc] initWithFactories:interceptorFactories + previousInterceptor:dispatcher + transportId:_callOptions.transport]; + if (_firstInterceptor == nil) { + [interceptorFactories removeObjectAtIndex:0]; + } } - nextInterceptor = interceptor; - nextManager = manager; } - if (nextManager == nil) { - [internalCall setResponseHandler:_responseHandler]; - } else { - [nextManager setPreviousInterceptor:_responseHandler]; + NSAssert(_firstInterceptor != nil, @"Failed to create interceptor or transport."); + if (_firstInterceptor == nil) { + NSLog(@"Failed to create interceptor or transport."); } - - _firstInterceptor = nextInterceptor; } return self; @@ -200,696 +209,43 @@ const char *kCFStreamVarName = "grpc_cfstream"; } - (void)start { - id copiedFirstInterceptor; - @synchronized(self) { - copiedFirstInterceptor = _firstInterceptor; - } - GRPCRequestOptions *requestOptions = [_requestOptions copy]; - GRPCCallOptions *callOptions = [_actualCallOptions copy]; - if ([copiedFirstInterceptor respondsToSelector:@selector(startWithRequestOptions:callOptions:)]) { - dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ - [copiedFirstInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; - }); - } + id copiedFirstInterceptor = _firstInterceptor; + GRPCRequestOptions *requestOptions = _requestOptions; + GRPCCallOptions *callOptions = _actualCallOptions; + dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ + [copiedFirstInterceptor startWithRequestOptions:requestOptions + callOptions:callOptions]; + }); } - (void)cancel { - id copiedFirstInterceptor; - @synchronized(self) { - copiedFirstInterceptor = _firstInterceptor; - } - if ([copiedFirstInterceptor respondsToSelector:@selector(cancel)]) { - dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ + id copiedFirstInterceptor = _firstInterceptor; + if (copiedFirstInterceptor != nil) { + dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ [copiedFirstInterceptor cancel]; }); } } - (void)writeData:(id)data { - id copiedFirstInterceptor; - @synchronized(self) { - copiedFirstInterceptor = _firstInterceptor; - } - if ([copiedFirstInterceptor respondsToSelector:@selector(writeData:)]) { - dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ - [copiedFirstInterceptor writeData:data]; - }); - } -} - -- (void)finish { - id copiedFirstInterceptor; - @synchronized(self) { - copiedFirstInterceptor = _firstInterceptor; - } - if ([copiedFirstInterceptor respondsToSelector:@selector(finish)]) { - dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ - [copiedFirstInterceptor finish]; - }); - } -} - -- (void)receiveNextMessages:(NSUInteger)numberOfMessages { - id copiedFirstInterceptor; - @synchronized(self) { - copiedFirstInterceptor = _firstInterceptor; - } - if ([copiedFirstInterceptor respondsToSelector:@selector(receiveNextMessages:)]) { - dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ - [copiedFirstInterceptor receiveNextMessages:numberOfMessages]; - }); - } -} - -@end - -// The following methods of a C gRPC call object aren't reentrant, and thus -// calls to them must be serialized: -// - start_batch -// - destroy -// -// start_batch with a SEND_MESSAGE argument can only be called after the -// OP_COMPLETE event for any previous write is received. This is achieved by -// pausing the requests writer immediately every time it writes a value, and -// resuming it again when OP_COMPLETE is received. -// -// Similarly, start_batch with a RECV_MESSAGE argument can only be called after -// the OP_COMPLETE event for any previous read is received.This is easier to -// enforce, as we're writing the received messages into the writeable: -// start_batch is enqueued once upon receiving the OP_COMPLETE event for the -// RECV_METADATA batch, and then once after receiving each OP_COMPLETE event for -// each RECV_MESSAGE batch. -@implementation GRPCCall { - dispatch_queue_t _callQueue; - - NSString *_host; - NSString *_path; - GRPCCallSafety _callSafety; - GRPCCallOptions *_callOptions; - GRPCWrappedCall *_wrappedCall; - - // The C gRPC library has less guarantees on the ordering of events than we - // do. Particularly, in the face of errors, there's no ordering guarantee at - // all. This wrapper over our actual writeable ensures thread-safety and - // correct ordering. - GRXConcurrentWriteable *_responseWriteable; - - // The network thread wants the requestWriter to resume (when the server is ready for more input), - // or to stop (on errors), concurrently with user threads that want to start it, pause it or stop - // it. Because a writer isn't thread-safe, we'll synchronize those operations on it. - // We don't use a dispatch queue for that purpose, because the writer can call writeValue: or - // writesFinishedWithError: on this GRPCCall as part of those operations. We want to be able to - // pause the writer immediately on writeValue:, so we need our locking to be recursive. - GRXWriter *_requestWriter; - - // To create a retain cycle when a call is started, up until it finishes. See - // |startWithWriteable:| and |finishWithError:|. This saves users from having to retain a - // reference to the call object if all they're interested in is the handler being executed when - // the response arrives. - GRPCCall *_retainSelf; - - GRPCRequestHeaders *_requestHeaders; - - // In the case that the call is a unary call (i.e. the writer to GRPCCall is of type - // GRXImmediateSingleWriter), GRPCCall will delay sending ops (not send them to C core - // immediately) and buffer them into a batch _unaryOpBatch. The batch is sent to C core when - // the SendClose op is added. - BOOL _unaryCall; - NSMutableArray *_unaryOpBatch; - - // The dispatch queue to be used for enqueuing responses to user. Defaulted to the main dispatch - // queue - dispatch_queue_t _responseQueue; - - // The OAuth2 token fetched from a token provider. - NSString *_fetchedOauth2AccessToken; - - // The callback to be called when a write message op is done. - void (^_writeDone)(void); - - // Indicate a read request to core is pending. - BOOL _pendingCoreRead; - - // Indicate pending read message request from user. - NSUInteger _pendingReceiveNextMessages; -} - -@synthesize state = _state; - -+ (void)initialize { - // Guarantees the code in {} block is invoked only once. See ref at: - // https://developer.apple.com/documentation/objectivec/nsobject/1418639-initialize?language=objc - if (self == [GRPCCall self]) { - grpc_init(); - callFlags = [NSMutableDictionary dictionary]; - } -} - -+ (void)setCallSafety:(GRPCCallSafety)callSafety host:(NSString *)host path:(NSString *)path { - if (host.length == 0 || path.length == 0) { - return; - } - NSString *hostAndPath = [NSString stringWithFormat:@"%@/%@", host, path]; - @synchronized(callFlags) { - switch (callSafety) { - case GRPCCallSafetyDefault: - callFlags[hostAndPath] = @0; - break; - case GRPCCallSafetyIdempotentRequest: - callFlags[hostAndPath] = @GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; - break; - case GRPCCallSafetyCacheableRequest: - callFlags[hostAndPath] = @GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; - break; - default: - break; - } - } -} - -+ (uint32_t)callFlagsForHost:(NSString *)host path:(NSString *)path { - NSString *hostAndPath = [NSString stringWithFormat:@"%@/%@", host, path]; - @synchronized(callFlags) { - return [callFlags[hostAndPath] intValue]; - } -} - -// Designated initializer -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - requestsWriter:(GRXWriter *)requestWriter { - return [self initWithHost:host - path:path - callSafety:GRPCCallSafetyDefault - requestsWriter:requestWriter - callOptions:nil]; -} - -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - callSafety:(GRPCCallSafety)safety - requestsWriter:(GRXWriter *)requestsWriter - callOptions:(GRPCCallOptions *)callOptions { - return [self initWithHost:host - path:path - callSafety:safety - requestsWriter:requestsWriter - callOptions:callOptions - writeDone:nil]; -} - -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - callSafety:(GRPCCallSafety)safety - requestsWriter:(GRXWriter *)requestsWriter - callOptions:(GRPCCallOptions *)callOptions - writeDone:(void (^)(void))writeDone { - // Purposely using pointer rather than length (host.length == 0) for backwards compatibility. - NSAssert(host != nil && path != nil, @"Neither host nor path can be nil."); - NSAssert(safety <= GRPCCallSafetyCacheableRequest, @"Invalid call safety value."); - NSAssert(requestsWriter.state == GRXWriterStateNotStarted, - @"The requests writer can't be already started."); - if (!host || !path) { - return nil; - } - if (safety > GRPCCallSafetyCacheableRequest) { - return nil; - } - if (requestsWriter.state != GRXWriterStateNotStarted) { - return nil; - } - - if ((self = [super init])) { - _host = [host copy]; - _path = [path copy]; - _callSafety = safety; - _callOptions = [callOptions copy]; - - // Serial queue to invoke the non-reentrant methods of the grpc_call object. - _callQueue = dispatch_queue_create("io.grpc.call", DISPATCH_QUEUE_SERIAL); - - _requestWriter = requestsWriter; - _requestHeaders = [[GRPCRequestHeaders alloc] initWithCall:self]; - _writeDone = writeDone; - - if ([requestsWriter isKindOfClass:[GRXImmediateSingleWriter class]]) { - _unaryCall = YES; - _unaryOpBatch = [NSMutableArray arrayWithCapacity:kMaxClientBatch]; - } - - _responseQueue = dispatch_get_main_queue(); - - // do not start a read until initial metadata is received - _pendingReceiveNextMessages = 0; - _pendingCoreRead = YES; - } - return self; -} - -- (void)setResponseDispatchQueue:(dispatch_queue_t)queue { - @synchronized(self) { - if (_state != GRXWriterStateNotStarted) { - return; - } - _responseQueue = queue; - } -} - -#pragma mark Finish - -// This function should support being called within a @synchronized(self) block in another function -// Should not manipulate _requestWriter for deadlock prevention. -- (void)finishWithError:(NSError *)errorOrNil { - @synchronized(self) { - if (_state == GRXWriterStateFinished) { - return; - } - _state = GRXWriterStateFinished; - - if (errorOrNil) { - [_responseWriteable cancelWithError:errorOrNil]; - } else { - [_responseWriteable enqueueSuccessfulCompletion]; - } - - // If the call isn't retained anywhere else, it can be deallocated now. - _retainSelf = nil; - } -} - -- (void)cancel { - @synchronized(self) { - if (_state == GRXWriterStateFinished) { - return; - } - [self finishWithError:[NSError - errorWithDomain:kGRPCErrorDomain - code:GRPCErrorCodeCancelled - userInfo:@{NSLocalizedDescriptionKey : @"Canceled by app"}]]; - [_wrappedCall cancel]; - } - _requestWriter.state = GRXWriterStateFinished; -} - -- (void)dealloc { - __block GRPCWrappedCall *wrappedCall = _wrappedCall; - dispatch_async(_callQueue, ^{ - wrappedCall = nil; + id copiedFirstInterceptor = _firstInterceptor; + dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ + [copiedFirstInterceptor writeData:data]; }); } -#pragma mark Read messages - -// Only called from the call queue. -// The handler will be called from the network queue. -- (void)startReadWithHandler:(void (^)(grpc_byte_buffer *))handler { - // TODO(jcanizales): Add error handlers for async failures - [_wrappedCall startBatchWithOperations:@[ [[GRPCOpRecvMessage alloc] initWithHandler:handler] ]]; -} - -// Called initially from the network queue once response headers are received, -// then "recursively" from the responseWriteable queue after each response from the -// server has been written. -// If the call is currently paused, this is a noop. Restarting the call will invoke this -// method. -// TODO(jcanizales): Rename to readResponseIfNotPaused. -- (void)maybeStartNextRead { - @synchronized(self) { - if (_state != GRXWriterStateStarted) { - return; - } - if (_callOptions.flowControlEnabled && (_pendingCoreRead || _pendingReceiveNextMessages == 0)) { - return; - } - _pendingCoreRead = YES; - _pendingReceiveNextMessages--; - } - - dispatch_async(_callQueue, ^{ - __weak GRPCCall *weakSelf = self; - [self startReadWithHandler:^(grpc_byte_buffer *message) { - if (message == NULL) { - // No more messages from the server - return; - } - __strong GRPCCall *strongSelf = weakSelf; - if (strongSelf == nil) { - grpc_byte_buffer_destroy(message); - return; - } - NSData *data = [NSData grpc_dataWithByteBuffer:message]; - grpc_byte_buffer_destroy(message); - if (!data) { - // The app doesn't have enough memory to hold the server response. We - // don't want to throw, because the app shouldn't crash for a behavior - // that's on the hands of any server to have. Instead we finish and ask - // the server to cancel. - @synchronized(strongSelf) { - strongSelf->_pendingCoreRead = NO; - [strongSelf - finishWithError:[NSError errorWithDomain:kGRPCErrorDomain - code:GRPCErrorCodeResourceExhausted - userInfo:@{ - NSLocalizedDescriptionKey : - @"Client does not have enough memory to " - @"hold the server response." - }]]; - [strongSelf->_wrappedCall cancel]; - } - strongSelf->_requestWriter.state = GRXWriterStateFinished; - } else { - @synchronized(strongSelf) { - [strongSelf->_responseWriteable enqueueValue:data - completionHandler:^{ - __strong GRPCCall *strongSelf = weakSelf; - if (strongSelf) { - @synchronized(strongSelf) { - strongSelf->_pendingCoreRead = NO; - [strongSelf maybeStartNextRead]; - } - } - }]; - } - } - }]; - }); -} - -#pragma mark Send headers - -- (void)sendHeaders { - // TODO (mxyan): Remove after deprecated methods are removed - uint32_t callSafetyFlags = 0; - switch (_callSafety) { - case GRPCCallSafetyDefault: - callSafetyFlags = 0; - break; - case GRPCCallSafetyIdempotentRequest: - callSafetyFlags = GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; - break; - case GRPCCallSafetyCacheableRequest: - callSafetyFlags = GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; - break; - } - - NSMutableDictionary *headers = [_requestHeaders mutableCopy]; - NSString *fetchedOauth2AccessToken; - @synchronized(self) { - fetchedOauth2AccessToken = _fetchedOauth2AccessToken; - } - if (fetchedOauth2AccessToken != nil) { - headers[@"authorization"] = [kBearerPrefix stringByAppendingString:fetchedOauth2AccessToken]; - } else if (_callOptions.oauth2AccessToken != nil) { - headers[@"authorization"] = - [kBearerPrefix stringByAppendingString:_callOptions.oauth2AccessToken]; - } - - // TODO(jcanizales): Add error handlers for async failures - GRPCOpSendMetadata *op = [[GRPCOpSendMetadata alloc] - initWithMetadata:headers - flags:callSafetyFlags - handler:nil]; // No clean-up needed after SEND_INITIAL_METADATA - dispatch_async(_callQueue, ^{ - if (!self->_unaryCall) { - [self->_wrappedCall startBatchWithOperations:@[ op ]]; - } else { - [self->_unaryOpBatch addObject:op]; - } +- (void)finish { + id copiedFirstInterceptor = _firstInterceptor; + dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ + [copiedFirstInterceptor finish]; }); } - (void)receiveNextMessages:(NSUInteger)numberOfMessages { - if (numberOfMessages == 0) { - return; - } - @synchronized(self) { - _pendingReceiveNextMessages += numberOfMessages; - - if (_state != GRXWriterStateStarted || !_callOptions.flowControlEnabled) { - return; - } - [self maybeStartNextRead]; - } -} - -#pragma mark GRXWriteable implementation - -// Only called from the call queue. The error handler will be called from the -// network queue if the write didn't succeed. -// If the call is a unary call, parameter \a errorHandler will be ignored and -// the error handler of GRPCOpSendClose will be executed in case of error. -- (void)writeMessage:(NSData *)message withErrorHandler:(void (^)(void))errorHandler { - __weak GRPCCall *weakSelf = self; - void (^resumingHandler)(void) = ^{ - // Resume the request writer. - GRPCCall *strongSelf = weakSelf; - if (strongSelf) { - strongSelf->_requestWriter.state = GRXWriterStateStarted; - if (strongSelf->_writeDone) { - strongSelf->_writeDone(); - } - } - }; - GRPCOpSendMessage *op = - [[GRPCOpSendMessage alloc] initWithMessage:message handler:resumingHandler]; - if (!_unaryCall) { - [_wrappedCall startBatchWithOperations:@[ op ] errorHandler:errorHandler]; - } else { - // Ignored errorHandler since it is the same as the one for GRPCOpSendClose. - // TODO (mxyan): unify the error handlers of all Ops into a single closure. - [_unaryOpBatch addObject:op]; - } -} - -- (void)writeValue:(id)value { - NSAssert([value isKindOfClass:[NSData class]], @"value must be of type NSData"); - - @synchronized(self) { - if (_state == GRXWriterStateFinished) { - return; - } - } - - // Pause the input and only resume it when the C layer notifies us that writes - // can proceed. - _requestWriter.state = GRXWriterStatePaused; - - dispatch_async(_callQueue, ^{ - // Write error is not processed here. It is handled by op batch of GRPC_OP_RECV_STATUS_ON_CLIENT - [self writeMessage:value withErrorHandler:nil]; + id copiedFirstInterceptor = _firstInterceptor; + dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ + [copiedFirstInterceptor receiveNextMessages:numberOfMessages]; }); } -// Only called from the call queue. The error handler will be called from the -// network queue if the requests stream couldn't be closed successfully. -- (void)finishRequestWithErrorHandler:(void (^)(void))errorHandler { - if (!_unaryCall) { - [_wrappedCall startBatchWithOperations:@[ [[GRPCOpSendClose alloc] init] ] - errorHandler:errorHandler]; - } else { - [_unaryOpBatch addObject:[[GRPCOpSendClose alloc] init]]; - [_wrappedCall startBatchWithOperations:_unaryOpBatch errorHandler:errorHandler]; - } -} - -- (void)writesFinishedWithError:(NSError *)errorOrNil { - if (errorOrNil) { - [self cancel]; - } else { - dispatch_async(_callQueue, ^{ - // EOS error is not processed here. It is handled by op batch of GRPC_OP_RECV_STATUS_ON_CLIENT - [self finishRequestWithErrorHandler:nil]; - }); - } -} - -#pragma mark Invoke - -// Both handlers will eventually be called, from the network queue. Writes can start immediately -// after this. -// The first one (headersHandler), when the response headers are received. -// The second one (completionHandler), whenever the RPC finishes for any reason. -- (void)invokeCallWithHeadersHandler:(void (^)(NSDictionary *))headersHandler - completionHandler:(void (^)(NSError *, NSDictionary *))completionHandler { - dispatch_async(_callQueue, ^{ - // TODO(jcanizales): Add error handlers for async failures - [self->_wrappedCall - startBatchWithOperations:@[ [[GRPCOpRecvMetadata alloc] initWithHandler:headersHandler] ]]; - [self->_wrappedCall - startBatchWithOperations:@[ [[GRPCOpRecvStatus alloc] initWithHandler:completionHandler] ]]; - }); -} - -- (void)invokeCall { - __weak GRPCCall *weakSelf = self; - [self invokeCallWithHeadersHandler:^(NSDictionary *headers) { - // Response headers received. - __strong GRPCCall *strongSelf = weakSelf; - if (strongSelf) { - @synchronized(strongSelf) { - // it is ok to set nil because headers are only received once - strongSelf.responseHeaders = nil; - // copy the header so that the GRPCOpRecvMetadata object may be dealloc'ed - NSDictionary *copiedHeaders = - [[NSDictionary alloc] initWithDictionary:headers copyItems:YES]; - strongSelf.responseHeaders = copiedHeaders; - strongSelf->_pendingCoreRead = NO; - [strongSelf maybeStartNextRead]; - } - } - } - completionHandler:^(NSError *error, NSDictionary *trailers) { - __strong GRPCCall *strongSelf = weakSelf; - if (strongSelf) { - strongSelf.responseTrailers = trailers; - - if (error) { - NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; - if (error.userInfo) { - [userInfo addEntriesFromDictionary:error.userInfo]; - } - userInfo[kGRPCTrailersKey] = strongSelf.responseTrailers; - // Since gRPC core does not guarantee the headers block being called before this block, - // responseHeaders might be nil. - userInfo[kGRPCHeadersKey] = strongSelf.responseHeaders; - error = [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo]; - } - [strongSelf finishWithError:error]; - strongSelf->_requestWriter.state = GRXWriterStateFinished; - } - }]; -} - -#pragma mark GRXWriter implementation - -// Lock acquired inside startWithWriteable: -- (void)startCallWithWriteable:(id)writeable { - @synchronized(self) { - if (_state == GRXWriterStateFinished) { - return; - } - - _responseWriteable = - [[GRXConcurrentWriteable alloc] initWithWriteable:writeable dispatchQueue:_responseQueue]; - - GRPCPooledChannel *channel = - [[GRPCChannelPool sharedInstance] channelWithHost:_host callOptions:_callOptions]; - _wrappedCall = [channel wrappedCallWithPath:_path - completionQueue:[GRPCCompletionQueue completionQueue] - callOptions:_callOptions]; - - if (_wrappedCall == nil) { - [self finishWithError:[NSError errorWithDomain:kGRPCErrorDomain - code:GRPCErrorCodeUnavailable - userInfo:@{ - NSLocalizedDescriptionKey : - @"Failed to create call or channel." - }]]; - return; - } - - [self sendHeaders]; - [self invokeCall]; - } - - // Now that the RPC has been initiated, request writes can start. - [_requestWriter startWithWriteable:self]; -} - -- (void)startWithWriteable:(id)writeable { - id tokenProvider = nil; - @synchronized(self) { - _state = GRXWriterStateStarted; - - // Create a retain cycle so that this instance lives until the RPC finishes (or is cancelled). - // This makes RPCs in which the call isn't externally retained possible (as long as it is - // started before being autoreleased). Care is taken not to retain self strongly in any of the - // blocks used in this implementation, so that the life of the instance is determined by this - // retain cycle. - _retainSelf = self; - - if (_callOptions == nil) { - GRPCMutableCallOptions *callOptions = [[GRPCHost callOptionsForHost:_host] mutableCopy]; - if (_serverName.length != 0) { - callOptions.serverAuthority = _serverName; - } - if (_timeout > 0) { - callOptions.timeout = _timeout; - } - uint32_t callFlags = [GRPCCall callFlagsForHost:_host path:_path]; - if (callFlags != 0) { - if (callFlags == GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) { - _callSafety = GRPCCallSafetyIdempotentRequest; - } else if (callFlags == GRPC_INITIAL_METADATA_CACHEABLE_REQUEST) { - _callSafety = GRPCCallSafetyCacheableRequest; - } - } - - id tokenProvider = self.tokenProvider; - if (tokenProvider != nil) { - callOptions.authTokenProvider = tokenProvider; - } - _callOptions = callOptions; - } - - NSAssert(_callOptions.authTokenProvider == nil || _callOptions.oauth2AccessToken == nil, - @"authTokenProvider and oauth2AccessToken cannot be set at the same time"); - - tokenProvider = _callOptions.authTokenProvider; - } - - if (tokenProvider != nil) { - __weak typeof(self) weakSelf = self; - [tokenProvider getTokenWithHandler:^(NSString *token) { - __strong typeof(self) strongSelf = weakSelf; - if (strongSelf) { - BOOL startCall = NO; - @synchronized(strongSelf) { - if (strongSelf->_state != GRXWriterStateFinished) { - startCall = YES; - if (token) { - strongSelf->_fetchedOauth2AccessToken = [token copy]; - } - } - } - if (startCall) { - [strongSelf startCallWithWriteable:writeable]; - } - } - }]; - } else { - [self startCallWithWriteable:writeable]; - } -} - -- (void)setState:(GRXWriterState)newState { - @synchronized(self) { - // Manual transitions are only allowed from the started or paused states. - if (_state == GRXWriterStateNotStarted || _state == GRXWriterStateFinished) { - return; - } - - switch (newState) { - case GRXWriterStateFinished: - _state = newState; - // Per GRXWriter's contract, setting the state to Finished manually - // means one doesn't wish the writeable to be messaged anymore. - [_responseWriteable cancelSilently]; - _responseWriteable = nil; - return; - case GRXWriterStatePaused: - _state = newState; - return; - case GRXWriterStateStarted: - if (_state == GRXWriterStatePaused) { - _state = newState; - [self maybeStartNextRead]; - } - return; - case GRXWriterStateNotStarted: - return; - } - } -} - @end diff --git a/src/objective-c/GRPCClient/GRPCCallLegacy.h b/src/objective-c/GRPCClient/GRPCCallLegacy.h new file mode 100644 index 00000000000..6c2c8ceada8 --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCCallLegacy.h @@ -0,0 +1,136 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/** + * This is the legacy interface of this gRPC library. This API is deprecated and users should use + * the API in GRPCCall.h. This API exists solely for the purpose of backwards compatibility. + */ + +#import "GRPCCallOptions.h" +#import + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnullability-completeness" + +/** + * This interface is deprecated. Please use \a GRPCCall2. + * + * Represents a single gRPC remote call. + */ +@interface GRPCCall : GRXWriter + +- (instancetype)init NS_UNAVAILABLE; + +/** + * The container of the request headers of an RPC conforms to this protocol, which is a subset of + * NSMutableDictionary's interface. It will become a NSMutableDictionary later on. + * The keys of this container are the header names, which per the HTTP standard are case- + * insensitive. They are stored in lowercase (which is how HTTP/2 mandates them on the wire), and + * can only consist of ASCII characters. + * A header value is a NSString object (with only ASCII characters), unless the header name has the + * suffix "-bin", in which case the value has to be a NSData object. + */ +/** + * These HTTP headers will be passed to the server as part of this call. Each HTTP header is a + * name-value pair with string names and either string or binary values. + * + * The passed dictionary has to use NSString keys, corresponding to the header names. The value + * associated to each can be a NSString object or a NSData object. E.g.: + * + * call.requestHeaders = @{@"authorization": @"Bearer ..."}; + * + * call.requestHeaders[@"my-header-bin"] = someData; + * + * After the call is started, trying to modify this property is an error. + * + * The property is initialized to an empty NSMutableDictionary. + */ +@property(atomic, readonly) NSMutableDictionary *requestHeaders; + +/** + * This dictionary is populated with the HTTP headers received from the server. This happens before + * any response message is received from the server. It has the same structure as the request + * headers dictionary: Keys are NSString header names; names ending with the suffix "-bin" have a + * NSData value; the others have a NSString value. + * + * The value of this property is nil until all response headers are received, and will change before + * any of -writeValue: or -writesFinishedWithError: are sent to the writeable. + */ +@property(atomic, readonly) NSDictionary *responseHeaders; + +/** + * Same as responseHeaders, but populated with the HTTP trailers received from the server before the + * call finishes. + * + * The value of this property is nil until all response trailers are received, and will change + * before -writesFinishedWithError: is sent to the writeable. + */ +@property(atomic, readonly) NSDictionary *responseTrailers; + +/** + * The request writer has to write NSData objects into the provided Writeable. The server will + * receive each of those separately and in order as distinct messages. + * A gRPC call might not complete until the request writer finishes. On the other hand, the request + * finishing doesn't necessarily make the call to finish, as the server might continue sending + * messages to the response side of the call indefinitely (depending on the semantics of the + * specific remote method called). + * To finish a call right away, invoke cancel. + * host parameter should not contain the scheme (http:// or https://), only the name or IP addr + * and the port number, for example @"localhost:5050". + */ +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + requestsWriter:(GRXWriter *)requestWriter; + +/** + * Finishes the request side of this call, notifies the server that the RPC should be cancelled, and + * finishes the response side of the call with an error of code CANCELED. + */ +- (void)cancel; + +/** + * The following methods are deprecated. + */ ++ (void)setCallSafety:(GRPCCallSafety)callSafety host:(NSString *)host path:(NSString *)path; +@property(atomic, copy, readwrite) NSString *serverName; +@property NSTimeInterval timeout; +- (void)setResponseDispatchQueue:(dispatch_queue_t)queue; + +@end + +#pragma mark Backwards compatibiity + +/** This protocol is kept for backwards compatibility with existing code. */ +DEPRECATED_MSG_ATTRIBUTE("Use NSDictionary or NSMutableDictionary instead.") +@protocol GRPCRequestHeaders +@property(nonatomic, readonly) NSUInteger count; + +- (id)objectForKeyedSubscript:(id)key; +- (void)setObject:(id)obj forKeyedSubscript:(id)key; + +- (void)removeAllObjects; +- (void)removeObjectForKey:(id)key; +@end + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" +/** This is only needed for backwards-compatibility. */ +@interface NSMutableDictionary (GRPCRequestHeaders) +@end +#pragma clang diagnostic pop +#pragma clang diagnostic pop diff --git a/src/objective-c/GRPCClient/GRPCCallLegacy.m b/src/objective-c/GRPCClient/GRPCCallLegacy.m new file mode 100644 index 00000000000..18a1eda1b39 --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCCallLegacy.m @@ -0,0 +1,679 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "GRPCCallLegacy.h" + +#import "GRPCCall+OAuth2.h" +#import "GRPCCallOptions.h" +#import "GRPCCall+Cronet.h" + +#import "private/GRPCCore/GRPCChannelPool.h" +#import "private/GRPCCore/GRPCCompletionQueue.h" +#import "private/GRPCCore/GRPCHost.h" +#import "private/GRPCCore/GRPCWrappedCall.h" +#import "private/GRPCCore/NSData+GRPC.h" + +#import +#import +#import +#import + +#include + +const char *kCFStreamVarName = "grpc_cfstream"; +static NSMutableDictionary *callFlags; + +// At most 6 ops can be in an op batch for a client: SEND_INITIAL_METADATA, +// SEND_MESSAGE, SEND_CLOSE_FROM_CLIENT, RECV_INITIAL_METADATA, RECV_MESSAGE, +// and RECV_STATUS_ON_CLIENT. +NSInteger kMaxClientBatch = 6; + +static NSString *const kAuthorizationHeader = @"authorization"; +static NSString *const kBearerPrefix = @"Bearer "; + +@interface GRPCCall () +// Make them read-write. +@property(atomic, strong) NSDictionary *responseHeaders; +@property(atomic, strong) NSDictionary *responseTrailers; + +- (void)receiveNextMessages:(NSUInteger)numberOfMessages; + +@end + +// The following methods of a C gRPC call object aren't reentrant, and thus +// calls to them must be serialized: +// - start_batch +// - destroy +// +// start_batch with a SEND_MESSAGE argument can only be called after the +// OP_COMPLETE event for any previous write is received. This is achieved by +// pausing the requests writer immediately every time it writes a value, and +// resuming it again when OP_COMPLETE is received. +// +// Similarly, start_batch with a RECV_MESSAGE argument can only be called after +// the OP_COMPLETE event for any previous read is received.This is easier to +// enforce, as we're writing the received messages into the writeable: +// start_batch is enqueued once upon receiving the OP_COMPLETE event for the +// RECV_METADATA batch, and then once after receiving each OP_COMPLETE event for +// each RECV_MESSAGE batch. +@implementation GRPCCall { + dispatch_queue_t _callQueue; + + NSString *_host; + NSString *_path; + GRPCCallSafety _callSafety; + GRPCCallOptions *_callOptions; + GRPCWrappedCall *_wrappedCall; + + // The C gRPC library has less guarantees on the ordering of events than we + // do. Particularly, in the face of errors, there's no ordering guarantee at + // all. This wrapper over our actual writeable ensures thread-safety and + // correct ordering. + GRXConcurrentWriteable *_responseWriteable; + + // The network thread wants the requestWriter to resume (when the server is ready for more input), + // or to stop (on errors), concurrently with user threads that want to start it, pause it or stop + // it. Because a writer isn't thread-safe, we'll synchronize those operations on it. + // We don't use a dispatch queue for that purpose, because the writer can call writeValue: or + // writesFinishedWithError: on this GRPCCall as part of those operations. We want to be able to + // pause the writer immediately on writeValue:, so we need our locking to be recursive. + GRXWriter *_requestWriter; + + // To create a retain cycle when a call is started, up until it finishes. See + // |startWithWriteable:| and |finishWithError:|. This saves users from having to retain a + // reference to the call object if all they're interested in is the handler being executed when + // the response arrives. + GRPCCall *_retainSelf; + + GRPCRequestHeaders *_requestHeaders; + + // In the case that the call is a unary call (i.e. the writer to GRPCCall is of type + // GRXImmediateSingleWriter), GRPCCall will delay sending ops (not send them to C core + // immediately) and buffer them into a batch _unaryOpBatch. The batch is sent to C core when + // the SendClose op is added. + BOOL _unaryCall; + NSMutableArray *_unaryOpBatch; + + // The dispatch queue to be used for enqueuing responses to user. Defaulted to the main dispatch + // queue + dispatch_queue_t _responseQueue; + + // The OAuth2 token fetched from a token provider. + NSString *_fetchedOauth2AccessToken; + + // The callback to be called when a write message op is done. + void (^_writeDone)(void); + + // Indicate a read request to core is pending. + BOOL _pendingCoreRead; + + // Indicate pending read message request from user. + NSUInteger _pendingReceiveNextMessages; +} + +@synthesize state = _state; + ++ (void)initialize { + // Guarantees the code in {} block is invoked only once. See ref at: + // https://developer.apple.com/documentation/objectivec/nsobject/1418639-initialize?language=objc + if (self == [GRPCCall self]) { + grpc_init(); + callFlags = [NSMutableDictionary dictionary]; + } +} + ++ (void)setCallSafety:(GRPCCallSafety)callSafety host:(NSString *)host path:(NSString *)path { + if (host.length == 0 || path.length == 0) { + return; + } + NSString *hostAndPath = [NSString stringWithFormat:@"%@/%@", host, path]; + @synchronized(callFlags) { + switch (callSafety) { + case GRPCCallSafetyDefault: + callFlags[hostAndPath] = @0; + break; + case GRPCCallSafetyIdempotentRequest: + callFlags[hostAndPath] = @GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; + break; + case GRPCCallSafetyCacheableRequest: + callFlags[hostAndPath] = @GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; + break; + default: + break; + } + } +} + ++ (uint32_t)callFlagsForHost:(NSString *)host path:(NSString *)path { + NSString *hostAndPath = [NSString stringWithFormat:@"%@/%@", host, path]; + @synchronized(callFlags) { + return [callFlags[hostAndPath] intValue]; + } +} + +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + requestsWriter:(GRXWriter *)requestWriter { + return [self initWithHost:host + path:path + callSafety:GRPCCallSafetyDefault + requestsWriter:requestWriter + callOptions:nil + writeDone:nil]; +} + +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + callSafety:(GRPCCallSafety)safety + requestsWriter:(GRXWriter *)requestsWriter + callOptions:(GRPCCallOptions *)callOptions + writeDone:(void (^)(void))writeDone { + // Purposely using pointer rather than length (host.length == 0) for backwards compatibility. + NSAssert(host != nil && path != nil, @"Neither host nor path can be nil."); + NSAssert(safety <= GRPCCallSafetyCacheableRequest, @"Invalid call safety value."); + NSAssert(requestsWriter.state == GRXWriterStateNotStarted, + @"The requests writer can't be already started."); + if (!host || !path) { + return nil; + } + if (safety > GRPCCallSafetyCacheableRequest) { + return nil; + } + if (requestsWriter.state != GRXWriterStateNotStarted) { + return nil; + } + + if ((self = [super init])) { + _host = [host copy]; + _path = [path copy]; + _callSafety = safety; + _callOptions = [callOptions copy]; + + // Serial queue to invoke the non-reentrant methods of the grpc_call object. + _callQueue = dispatch_queue_create("io.grpc.call", DISPATCH_QUEUE_SERIAL); + + _requestWriter = requestsWriter; + _requestHeaders = [[GRPCRequestHeaders alloc] initWithCall:self]; + _writeDone = writeDone; + + if ([requestsWriter isKindOfClass:[GRXImmediateSingleWriter class]]) { + _unaryCall = YES; + _unaryOpBatch = [NSMutableArray arrayWithCapacity:kMaxClientBatch]; + } + + _responseQueue = dispatch_get_main_queue(); + + // do not start a read until initial metadata is received + _pendingReceiveNextMessages = 0; + _pendingCoreRead = YES; + } + return self; +} + +- (void)setResponseDispatchQueue:(dispatch_queue_t)queue { + @synchronized(self) { + if (_state != GRXWriterStateNotStarted) { + return; + } + _responseQueue = queue; + } +} + +#pragma mark Finish + +// This function should support being called within a @synchronized(self) block in another function +// Should not manipulate _requestWriter for deadlock prevention. +- (void)finishWithError:(NSError *)errorOrNil { + @synchronized(self) { + if (_state == GRXWriterStateFinished) { + return; + } + _state = GRXWriterStateFinished; + + if (errorOrNil) { + [_responseWriteable cancelWithError:errorOrNil]; + } else { + [_responseWriteable enqueueSuccessfulCompletion]; + } + + // If the call isn't retained anywhere else, it can be deallocated now. + _retainSelf = nil; + } +} + +- (void)cancel { + @synchronized(self) { + if (_state == GRXWriterStateFinished) { + return; + } + [self finishWithError:[NSError + errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeCancelled + userInfo:@{NSLocalizedDescriptionKey : @"Canceled by app"}]]; + [_wrappedCall cancel]; + } + _requestWriter.state = GRXWriterStateFinished; +} + +- (void)dealloc { + __block GRPCWrappedCall *wrappedCall = _wrappedCall; + dispatch_async(_callQueue, ^{ + wrappedCall = nil; + }); +} + +#pragma mark Read messages + +// Only called from the call queue. +// The handler will be called from the network queue. +- (void)startReadWithHandler:(void (^)(grpc_byte_buffer *))handler { + // TODO(jcanizales): Add error handlers for async failures + [_wrappedCall startBatchWithOperations:@[ [[GRPCOpRecvMessage alloc] initWithHandler:handler] ]]; +} + +// Called initially from the network queue once response headers are received, +// then "recursively" from the responseWriteable queue after each response from the +// server has been written. +// If the call is currently paused, this is a noop. Restarting the call will invoke this +// method. +// TODO(jcanizales): Rename to readResponseIfNotPaused. +- (void)maybeStartNextRead { + @synchronized(self) { + if (_state != GRXWriterStateStarted) { + return; + } + if (_callOptions.flowControlEnabled && (_pendingCoreRead || _pendingReceiveNextMessages == 0)) { + return; + } + _pendingCoreRead = YES; + _pendingReceiveNextMessages--; + } + + dispatch_async(_callQueue, ^{ + __weak GRPCCall *weakSelf = self; + [self startReadWithHandler:^(grpc_byte_buffer *message) { + if (message == NULL) { + // No more messages from the server + return; + } + __strong GRPCCall *strongSelf = weakSelf; + if (strongSelf == nil) { + grpc_byte_buffer_destroy(message); + return; + } + NSData *data = [NSData grpc_dataWithByteBuffer:message]; + grpc_byte_buffer_destroy(message); + if (!data) { + // The app doesn't have enough memory to hold the server response. We + // don't want to throw, because the app shouldn't crash for a behavior + // that's on the hands of any server to have. Instead we finish and ask + // the server to cancel. + @synchronized(strongSelf) { + strongSelf->_pendingCoreRead = NO; + [strongSelf + finishWithError:[NSError errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeResourceExhausted + userInfo:@{ + NSLocalizedDescriptionKey : + @"Client does not have enough memory to " + @"hold the server response." + }]]; + [strongSelf->_wrappedCall cancel]; + } + strongSelf->_requestWriter.state = GRXWriterStateFinished; + } else { + @synchronized(strongSelf) { + [strongSelf->_responseWriteable enqueueValue:data + completionHandler:^{ + __strong GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + @synchronized(strongSelf) { + strongSelf->_pendingCoreRead = NO; + [strongSelf maybeStartNextRead]; + } + } + }]; + } + } + }]; + }); +} + +#pragma mark Send headers + +- (void)sendHeaders { + // TODO (mxyan): Remove after deprecated methods are removed + uint32_t callSafetyFlags = 0; + switch (_callSafety) { + case GRPCCallSafetyDefault: + callSafetyFlags = 0; + break; + case GRPCCallSafetyIdempotentRequest: + callSafetyFlags = GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; + break; + case GRPCCallSafetyCacheableRequest: + callSafetyFlags = GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; + break; + } + + NSMutableDictionary *headers = [_requestHeaders mutableCopy]; + NSString *fetchedOauth2AccessToken; + @synchronized(self) { + fetchedOauth2AccessToken = _fetchedOauth2AccessToken; + } + if (fetchedOauth2AccessToken != nil) { + headers[@"authorization"] = [kBearerPrefix stringByAppendingString:fetchedOauth2AccessToken]; + } else if (_callOptions.oauth2AccessToken != nil) { + headers[@"authorization"] = + [kBearerPrefix stringByAppendingString:_callOptions.oauth2AccessToken]; + } + + // TODO(jcanizales): Add error handlers for async failures + GRPCOpSendMetadata *op = [[GRPCOpSendMetadata alloc] + initWithMetadata:headers + flags:callSafetyFlags + handler:nil]; // No clean-up needed after SEND_INITIAL_METADATA + dispatch_async(_callQueue, ^{ + if (!self->_unaryCall) { + [self->_wrappedCall startBatchWithOperations:@[ op ]]; + } else { + [self->_unaryOpBatch addObject:op]; + } + }); +} + +- (void)receiveNextMessages:(NSUInteger)numberOfMessages { + if (numberOfMessages == 0) { + return; + } + @synchronized(self) { + _pendingReceiveNextMessages += numberOfMessages; + + if (_state != GRXWriterStateStarted || !_callOptions.flowControlEnabled) { + return; + } + [self maybeStartNextRead]; + } +} + +#pragma mark GRXWriteable implementation + +// Only called from the call queue. The error handler will be called from the +// network queue if the write didn't succeed. +// If the call is a unary call, parameter \a errorHandler will be ignored and +// the error handler of GRPCOpSendClose will be executed in case of error. +- (void)writeMessage:(NSData *)message withErrorHandler:(void (^)(void))errorHandler { + __weak GRPCCall *weakSelf = self; + void (^resumingHandler)(void) = ^{ + // Resume the request writer. + GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + strongSelf->_requestWriter.state = GRXWriterStateStarted; + if (strongSelf->_writeDone) { + strongSelf->_writeDone(); + } + } + }; + GRPCOpSendMessage *op = + [[GRPCOpSendMessage alloc] initWithMessage:message handler:resumingHandler]; + if (!_unaryCall) { + [_wrappedCall startBatchWithOperations:@[ op ] errorHandler:errorHandler]; + } else { + // Ignored errorHandler since it is the same as the one for GRPCOpSendClose. + // TODO (mxyan): unify the error handlers of all Ops into a single closure. + [_unaryOpBatch addObject:op]; + } +} + +- (void)writeValue:(id)value { + NSAssert([value isKindOfClass:[NSData class]], @"value must be of type NSData"); + + @synchronized(self) { + if (_state == GRXWriterStateFinished) { + return; + } + } + + // Pause the input and only resume it when the C layer notifies us that writes + // can proceed. + _requestWriter.state = GRXWriterStatePaused; + + dispatch_async(_callQueue, ^{ + // Write error is not processed here. It is handled by op batch of GRPC_OP_RECV_STATUS_ON_CLIENT + [self writeMessage:value withErrorHandler:nil]; + }); +} + +// Only called from the call queue. The error handler will be called from the +// network queue if the requests stream couldn't be closed successfully. +- (void)finishRequestWithErrorHandler:(void (^)(void))errorHandler { + if (!_unaryCall) { + [_wrappedCall startBatchWithOperations:@[ [[GRPCOpSendClose alloc] init] ] + errorHandler:errorHandler]; + } else { + [_unaryOpBatch addObject:[[GRPCOpSendClose alloc] init]]; + [_wrappedCall startBatchWithOperations:_unaryOpBatch errorHandler:errorHandler]; + } +} + +- (void)writesFinishedWithError:(NSError *)errorOrNil { + if (errorOrNil) { + [self cancel]; + } else { + dispatch_async(_callQueue, ^{ + // EOS error is not processed here. It is handled by op batch of GRPC_OP_RECV_STATUS_ON_CLIENT + [self finishRequestWithErrorHandler:nil]; + }); + } +} + +#pragma mark Invoke + +// Both handlers will eventually be called, from the network queue. Writes can start immediately +// after this. +// The first one (headersHandler), when the response headers are received. +// The second one (completionHandler), whenever the RPC finishes for any reason. +- (void)invokeCallWithHeadersHandler:(void (^)(NSDictionary *))headersHandler + completionHandler:(void (^)(NSError *, NSDictionary *))completionHandler { + dispatch_async(_callQueue, ^{ + // TODO(jcanizales): Add error handlers for async failures + [self->_wrappedCall + startBatchWithOperations:@[ [[GRPCOpRecvMetadata alloc] initWithHandler:headersHandler] ]]; + [self->_wrappedCall + startBatchWithOperations:@[ [[GRPCOpRecvStatus alloc] initWithHandler:completionHandler] ]]; + }); +} + +- (void)invokeCall { + __weak GRPCCall *weakSelf = self; + [self invokeCallWithHeadersHandler:^(NSDictionary *headers) { + // Response headers received. + __strong GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + @synchronized(strongSelf) { + // it is ok to set nil because headers are only received once + strongSelf.responseHeaders = nil; + // copy the header so that the GRPCOpRecvMetadata object may be dealloc'ed + NSDictionary *copiedHeaders = + [[NSDictionary alloc] initWithDictionary:headers copyItems:YES]; + strongSelf.responseHeaders = copiedHeaders; + strongSelf->_pendingCoreRead = NO; + [strongSelf maybeStartNextRead]; + } + } + } + completionHandler:^(NSError *error, NSDictionary *trailers) { + __strong GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + strongSelf.responseTrailers = trailers; + + if (error) { + NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; + if (error.userInfo) { + [userInfo addEntriesFromDictionary:error.userInfo]; + } + userInfo[kGRPCTrailersKey] = strongSelf.responseTrailers; + // Since gRPC core does not guarantee the headers block being called before this block, + // responseHeaders might be nil. + userInfo[kGRPCHeadersKey] = strongSelf.responseHeaders; + error = [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo]; + } + [strongSelf finishWithError:error]; + strongSelf->_requestWriter.state = GRXWriterStateFinished; + } + }]; +} + +#pragma mark GRXWriter implementation + +// Lock acquired inside startWithWriteable: +- (void)startCallWithWriteable:(id)writeable { + @synchronized(self) { + if (_state == GRXWriterStateFinished) { + return; + } + + _responseWriteable = + [[GRXConcurrentWriteable alloc] initWithWriteable:writeable dispatchQueue:_responseQueue]; + + GRPCPooledChannel *channel = + [[GRPCChannelPool sharedInstance] channelWithHost:_host callOptions:_callOptions]; + _wrappedCall = [channel wrappedCallWithPath:_path + completionQueue:[GRPCCompletionQueue completionQueue] + callOptions:_callOptions]; + + if (_wrappedCall == nil) { + [self finishWithError:[NSError errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeUnavailable + userInfo:@{ + NSLocalizedDescriptionKey : + @"Failed to create call or channel." + }]]; + return; + } + + [self sendHeaders]; + [self invokeCall]; + } + + // Now that the RPC has been initiated, request writes can start. + [_requestWriter startWithWriteable:self]; +} + +- (void)startWithWriteable:(id)writeable { + id tokenProvider = nil; + @synchronized(self) { + _state = GRXWriterStateStarted; + + // Create a retain cycle so that this instance lives until the RPC finishes (or is cancelled). + // This makes RPCs in which the call isn't externally retained possible (as long as it is + // started before being autoreleased). Care is taken not to retain self strongly in any of the + // blocks used in this implementation, so that the life of the instance is determined by this + // retain cycle. + _retainSelf = self; + + if (_callOptions == nil) { + GRPCMutableCallOptions *callOptions = [[GRPCHost callOptionsForHost:_host] mutableCopy]; + // By v1 API logic, insecure channel precedes Cronet channel; Cronet channel preceeds default + // channel. We maintain backwards compatibility here with v1 API by keep this logic. + if (callOptions.transport == GRPCTransportTypeDefault && [GRPCCall isUsingCronet]) { + callOptions.transport = gGRPCCoreCronetId; + } + if (_serverName.length != 0) { + callOptions.serverAuthority = _serverName; + } + if (_timeout > 0) { + callOptions.timeout = _timeout; + } + uint32_t callFlags = [GRPCCall callFlagsForHost:_host path:_path]; + if (callFlags != 0) { + if (callFlags == GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) { + _callSafety = GRPCCallSafetyIdempotentRequest; + } else if (callFlags == GRPC_INITIAL_METADATA_CACHEABLE_REQUEST) { + _callSafety = GRPCCallSafetyCacheableRequest; + } + } + + id tokenProvider = self.tokenProvider; + if (tokenProvider != nil) { + callOptions.authTokenProvider = tokenProvider; + } + _callOptions = callOptions; + } + + NSAssert(_callOptions.authTokenProvider == nil || _callOptions.oauth2AccessToken == nil, + @"authTokenProvider and oauth2AccessToken cannot be set at the same time"); + + tokenProvider = _callOptions.authTokenProvider; + } + + if (tokenProvider != nil) { + __weak typeof(self) weakSelf = self; + [tokenProvider getTokenWithHandler:^(NSString *token) { + __strong typeof(self) strongSelf = weakSelf; + if (strongSelf) { + BOOL startCall = NO; + @synchronized(strongSelf) { + if (strongSelf->_state != GRXWriterStateFinished) { + startCall = YES; + if (token) { + strongSelf->_fetchedOauth2AccessToken = [token copy]; + } + } + } + if (startCall) { + [strongSelf startCallWithWriteable:writeable]; + } + } + }]; + } else { + [self startCallWithWriteable:writeable]; + } +} + +- (void)setState:(GRXWriterState)newState { + @synchronized(self) { + // Manual transitions are only allowed from the started or paused states. + if (_state == GRXWriterStateNotStarted || _state == GRXWriterStateFinished) { + return; + } + + switch (newState) { + case GRXWriterStateFinished: + _state = newState; + // Per GRXWriter's contract, setting the state to Finished manually + // means one doesn't wish the writeable to be messaged anymore. + [_responseWriteable cancelSilently]; + _responseWriteable = nil; + return; + case GRXWriterStatePaused: + _state = newState; + return; + case GRXWriterStateStarted: + if (_state == GRXWriterStatePaused) { + _state = newState; + [self maybeStartNextRead]; + } + return; + case GRXWriterStateNotStarted: + return; + } + } +} + +@end diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.h b/src/objective-c/GRPCClient/GRPCCallOptions.h index 98511e3f5cb..80c0244d78d 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.h +++ b/src/objective-c/GRPCClient/GRPCCallOptions.h @@ -20,6 +20,9 @@ NS_ASSUME_NONNULL_BEGIN +typedef char *GRPCTransportId; +@protocol GRPCInterceptorFactory; + /** * Safety remark of a gRPC method as defined in RFC 2616 Section 9.1 */ @@ -104,7 +107,7 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) { * this array. This parameter should not be modified by any interceptor and will * not take effect if done so. */ -@property(copy, readonly) NSArray *interceptorFactories; +@property(copy, readonly) NSArray> *interceptorFactories; // OAuth2 parameters. Users of gRPC may specify one of the following two parameters. @@ -192,10 +195,21 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) { @property(copy, readonly, nullable) NSString *PEMCertificateChain; /** + * Deprecated: this option is deprecated. Please use the property \a transport + * instead. + * * Select the transport type to be used for this call. */ @property(readonly) GRPCTransportType transportType; +/** + * The transport to be used for this call. Users may choose a native transport + * identifier defined in \a GRPCTransport or provided by a non-native transport + * implementation. If the option is left to be NULL, gRPC will use its default + * transport. + */ +@property(readonly) GRPCTransportId transport; + /** * Override the hostname during the TLS hostname validation process. */ @@ -267,7 +281,7 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) { * this array. This parameter should not be modified by any interceptor and will * not take effect if done so. */ -@property(copy, readwrite) NSArray *interceptorFactories; +@property(copy, readwrite) NSArray> *interceptorFactories; // OAuth2 parameters. Users of gRPC may specify one of the following two parameters. @@ -357,10 +371,23 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) { @property(copy, readwrite, nullable) NSString *PEMCertificateChain; /** + * Deprecated: this option is deprecated. Please use the property \a transport + * instead. + * * Select the transport type to be used for this call. */ @property(readwrite) GRPCTransportType transportType; +/** + * The transport to be used for this call. Users may choose a native transport + * identifier defined in \a GRPCTransport or provided by a non-native ttransport + * implementation. If the option is left to be NULL, gRPC will use its default + * transport. + * + * An interceptor must not change the value of this option. + */ +@property(readwrite) GRPCTransportId transport; + /** * Override the hostname during the TLS hostname validation process. */ diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.m b/src/objective-c/GRPCClient/GRPCCallOptions.m index 392e42a9d47..2080f9915a9 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.m +++ b/src/objective-c/GRPCClient/GRPCCallOptions.m @@ -18,12 +18,13 @@ #import "GRPCCallOptions.h" #import "internal/GRPCCallOptions+Internal.h" +#import "GRPCTransport.h" // The default values for the call options. static NSString *const kDefaultServerAuthority = nil; static const NSTimeInterval kDefaultTimeout = 0; static const BOOL kDefaultFlowControlEnabled = NO; -static NSArray *const kDefaultInterceptorFactories = nil; +static NSArray> *const kDefaultInterceptorFactories = nil; static NSDictionary *const kDefaultInitialMetadata = nil; static NSString *const kDefaultUserAgentPrefix = nil; static const NSUInteger kDefaultResponseSizeLimit = 0; @@ -41,6 +42,7 @@ static NSString *const kDefaultPEMCertificateChain = nil; static NSString *const kDefaultOauth2AccessToken = nil; static const id kDefaultAuthTokenProvider = nil; static const GRPCTransportType kDefaultTransportType = GRPCTransportTypeChttp2BoringSSL; +static const GRPCTransportId kDefaultTransport = NULL; static NSString *const kDefaultHostNameOverride = nil; static const id kDefaultLogContext = nil; static NSString *const kDefaultChannelPoolDomain = nil; @@ -62,7 +64,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { NSString *_serverAuthority; NSTimeInterval _timeout; BOOL _flowControlEnabled; - NSArray *_interceptorFactories; + NSArray> *_interceptorFactories; NSString *_oauth2AccessToken; id _authTokenProvider; NSDictionary *_initialMetadata; @@ -80,6 +82,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { NSString *_PEMPrivateKey; NSString *_PEMCertificateChain; GRPCTransportType _transportType; + GRPCTransportId _transport; NSString *_hostNameOverride; id _logContext; NSString *_channelPoolDomain; @@ -107,6 +110,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { @synthesize PEMPrivateKey = _PEMPrivateKey; @synthesize PEMCertificateChain = _PEMCertificateChain; @synthesize transportType = _transportType; +@synthesize transport = _transport; @synthesize hostNameOverride = _hostNameOverride; @synthesize logContext = _logContext; @synthesize channelPoolDomain = _channelPoolDomain; @@ -134,6 +138,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:kDefaultPEMPrivateKey PEMCertificateChain:kDefaultPEMCertificateChain transportType:kDefaultTransportType + transport:kDefaultTransport hostNameOverride:kDefaultHostNameOverride logContext:kDefaultLogContext channelPoolDomain:kDefaultChannelPoolDomain @@ -143,7 +148,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { - (instancetype)initWithServerAuthority:(NSString *)serverAuthority timeout:(NSTimeInterval)timeout flowControlEnabled:(BOOL)flowControlEnabled - interceptorFactories:(NSArray *)interceptorFactories + interceptorFactories:(NSArray> *)interceptorFactories oauth2AccessToken:(NSString *)oauth2AccessToken authTokenProvider:(id)authTokenProvider initialMetadata:(NSDictionary *)initialMetadata @@ -161,6 +166,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:(NSString *)PEMPrivateKey PEMCertificateChain:(NSString *)PEMCertificateChain transportType:(GRPCTransportType)transportType + transport:(GRPCTransportId)transport hostNameOverride:(NSString *)hostNameOverride logContext:(id)logContext channelPoolDomain:(NSString *)channelPoolDomain @@ -193,6 +199,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { _PEMPrivateKey = [PEMPrivateKey copy]; _PEMCertificateChain = [PEMCertificateChain copy]; _transportType = transportType; + _transport = transport; _hostNameOverride = [hostNameOverride copy]; _logContext = logContext; _channelPoolDomain = [channelPoolDomain copy]; @@ -224,6 +231,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:_PEMPrivateKey PEMCertificateChain:_PEMCertificateChain transportType:_transportType + transport:_transport hostNameOverride:_hostNameOverride logContext:_logContext channelPoolDomain:_channelPoolDomain @@ -256,6 +264,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:[_PEMPrivateKey copy] PEMCertificateChain:[_PEMCertificateChain copy] transportType:_transportType + transport:_transport hostNameOverride:[_hostNameOverride copy] logContext:_logContext channelPoolDomain:[_channelPoolDomain copy] @@ -280,6 +289,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { if (!areObjectsEqual(callOptions.PEMCertificateChain, _PEMCertificateChain)) return NO; if (!areObjectsEqual(callOptions.hostNameOverride, _hostNameOverride)) return NO; if (!(callOptions.transportType == _transportType)) return NO; + if (!(TransportIdIsEqual(callOptions.transport, _transport))) return NO; if (!areObjectsEqual(callOptions.logContext, _logContext)) return NO; if (!areObjectsEqual(callOptions.channelPoolDomain, _channelPoolDomain)) return NO; if (!(callOptions.channelID == _channelID)) return NO; @@ -304,6 +314,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { result ^= _PEMCertificateChain.hash; result ^= _hostNameOverride.hash; result ^= _transportType; + result ^= TransportIdHash(_transport); result ^= _logContext.hash; result ^= _channelPoolDomain.hash; result ^= _channelID; @@ -336,6 +347,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { @dynamic PEMPrivateKey; @dynamic PEMCertificateChain; @dynamic transportType; +@dynamic transport; @dynamic hostNameOverride; @dynamic logContext; @dynamic channelPoolDomain; @@ -363,6 +375,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:kDefaultPEMPrivateKey PEMCertificateChain:kDefaultPEMCertificateChain transportType:kDefaultTransportType + transport:kDefaultTransport hostNameOverride:kDefaultHostNameOverride logContext:kDefaultLogContext channelPoolDomain:kDefaultChannelPoolDomain @@ -392,6 +405,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:_PEMPrivateKey PEMCertificateChain:_PEMCertificateChain transportType:_transportType + transport:_transport hostNameOverride:_hostNameOverride logContext:_logContext channelPoolDomain:_channelPoolDomain @@ -422,6 +436,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:_PEMPrivateKey PEMCertificateChain:_PEMCertificateChain transportType:_transportType + transport:_transport hostNameOverride:_hostNameOverride logContext:_logContext channelPoolDomain:_channelPoolDomain @@ -445,7 +460,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { _flowControlEnabled = flowControlEnabled; } -- (void)setInterceptorFactories:(NSArray *)interceptorFactories { +- (void)setInterceptorFactories:(NSArray> *)interceptorFactories { _interceptorFactories = interceptorFactories; } @@ -538,6 +553,10 @@ static BOOL areObjectsEqual(id obj1, id obj2) { _transportType = transportType; } +- (void)setTransport:(GRPCTransportId)transport { + _transport = transport; +} + - (void)setHostNameOverride:(NSString *)hostNameOverride { _hostNameOverride = [hostNameOverride copy]; } diff --git a/src/objective-c/GRPCClient/GRPCDispatchable.h b/src/objective-c/GRPCClient/GRPCDispatchable.h new file mode 100644 index 00000000000..3322766e3bc --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCDispatchable.h @@ -0,0 +1,30 @@ + +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/** + * An object that process its methods with a dispatch queue. + */ +@protocol GRPCDispatchable + +/** + * The dispatch queue where the object's methods should be run on. + */ +@property(atomic, readonly) dispatch_queue_t dispatchQueue; + +@end diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.h b/src/objective-c/GRPCClient/GRPCInterceptor.h index 3b62c1b3ec0..f8a97ac13e8 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.h +++ b/src/objective-c/GRPCClient/GRPCInterceptor.h @@ -106,22 +106,20 @@ */ #import "GRPCCall.h" +#import "GRPCDispatchable.h" NS_ASSUME_NONNULL_BEGIN @class GRPCInterceptorManager; @class GRPCInterceptor; +@class GRPCRequestOptions; +@class GRPCCallOptions; +@protocol GRPCResponseHandler; /** * The GRPCInterceptorInterface defines the request events that can occur to an interceptr. */ -@protocol GRPCInterceptorInterface - -/** - * The queue on which all methods of this interceptor should be dispatched on. The queue must be a - * serial queue. - */ -@property(readonly) dispatch_queue_t requestDispatchQueue; +@protocol GRPCInterceptorInterface /** * To start the call. This method will only be called once for each instance. @@ -171,19 +169,16 @@ NS_ASSUME_NONNULL_BEGIN * invoke shutDown method of its corresponding manager so that references to other interceptors can * be released. */ -@interface GRPCInterceptorManager : NSObject +@interface GRPCInterceptorManager : NSObject - (instancetype)init NS_UNAVAILABLE; + (instancetype) new NS_UNAVAILABLE; -- (nullable instancetype)initWithNextInterceptor:(id)nextInterceptor - NS_DESIGNATED_INITIALIZER; - -/** Set the previous interceptor in the chain. Can only be set once. */ -- (void)setPreviousInterceptor:(id)previousInterceptor; +- (nullable instancetype)initWithFactories:(nullable NSArray> *)factories + previousInterceptor:(nullable id)previousInterceptor + transportId:(GRPCTransportId)transportId; -/** Indicate shutdown of the interceptor; release the reference to other interceptors */ - (void)shutDown; // Methods to forward GRPCInterceptorInterface calls to the next interceptor @@ -235,22 +230,18 @@ NS_ASSUME_NONNULL_BEGIN @interface GRPCInterceptor : NSObject - (instancetype)init NS_UNAVAILABLE; - -+ (instancetype) new NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; /** * Initialize the interceptor with the next interceptor in the chain, and provide the dispatch queue * that this interceptor's methods are dispatched onto. */ - (nullable instancetype)initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue - NS_DESIGNATED_INITIALIZER; + dispatchQueue:(dispatch_queue_t)dispatchQueue; // Default implementation of GRPCInterceptorInterface -- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions - callOptions:(GRPCCallOptions *)callOptions; +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions; - (void)writeData:(id)data; - (void)finish; - (void)cancel; diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.m b/src/objective-c/GRPCClient/GRPCInterceptor.m index a385ecd7813..aa3380cc024 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.m +++ b/src/objective-c/GRPCClient/GRPCInterceptor.m @@ -19,150 +19,273 @@ #import #import "GRPCInterceptor.h" +#import "private/GRPCTransport+Private.h" + +@interface GRPCInterceptorManager () + +@end @implementation GRPCInterceptorManager { id _nextInterceptor; id _previousInterceptor; + GRPCInterceptor *_thisInterceptor; + dispatch_queue_t _dispatchQueue; + NSArray> *_factories; + GRPCTransportId _transportId; + BOOL _shutDown; } -- (instancetype)initWithNextInterceptor:(id)nextInterceptor { +- (instancetype)initWithFactories:(NSArray> *)factories + previousInterceptor:(id)previousInterceptor + transportId:(nonnull GRPCTransportId)transportId { if ((self = [super init])) { - _nextInterceptor = nextInterceptor; + if (factories.count == 0) { + [NSException raise:NSInternalInconsistencyException format:@"Interceptor manager must have factories"]; + } + _thisInterceptor = [factories[0] createInterceptorWithManager:self]; + if (_thisInterceptor == nil) { + return nil; + } + _previousInterceptor = previousInterceptor; + _factories = factories; + // Generate interceptor +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 + if (@available(iOS 8.0, macOS 10.10, *)) { + _dispatchQueue = dispatch_queue_create(NULL, dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); + } else { +#else + { +#endif + _dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); + } + dispatch_set_target_queue(_dispatchQueue, _thisInterceptor.dispatchQueue); + _transportId = transportId; } - - return self; -} - -- (void)setPreviousInterceptor:(id)previousInterceptor { - _previousInterceptor = previousInterceptor; + return self; } - (void)shutDown { _nextInterceptor = nil; _previousInterceptor = nil; + _thisInterceptor = nil; + _shutDown = YES; } -- (void)startNextInterceptorWithRequest:(GRPCRequestOptions *)requestOptions - callOptions:(GRPCCallOptions *)callOptions { - if (_nextInterceptor != nil) { - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ - [copiedNextInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; - }); + - (void)createNextInterceptor { + NSAssert(_nextInterceptor == nil, @"Starting the next interceptor more than once"); + NSAssert(_factories.count > 0, @"Interceptor manager of transport cannot start next interceptor"); + if (_nextInterceptor != nil) { + NSLog(@"Starting the next interceptor more than once"); + return; + } + NSMutableArray> *interceptorFactories = [NSMutableArray arrayWithArray:[_factories subarrayWithRange:NSMakeRange(1, _factories.count - 1)]]; + while (_nextInterceptor == nil) { + if (interceptorFactories.count == 0) { + _nextInterceptor = [[GRPCTransportManager alloc] initWithTransportId:_transportId previousInterceptor:self]; + break; + } else { + _nextInterceptor = [[GRPCInterceptorManager alloc] initWithFactories:interceptorFactories + previousInterceptor:self + transportId:_transportId]; + if (_nextInterceptor == nil) { + [interceptorFactories removeObjectAtIndex:0]; + } + } + } + NSAssert(_nextInterceptor != nil, @"Failed to create interceptor or transport."); + if (_nextInterceptor == nil) { + NSLog(@"Failed to create interceptor or transport."); + } + } + + - (void)startNextInterceptorWithRequest:(GRPCRequestOptions *)requestOptions +callOptions:(GRPCCallOptions *)callOptions { + if (_nextInterceptor == nil && !_shutDown) { + [self createNextInterceptor]; + } + if (_nextInterceptor == nil) { + return; } + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ + [copiedNextInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; + }); } - (void)writeNextInterceptorWithData:(id)data { - if (_nextInterceptor != nil) { - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ - [copiedNextInterceptor writeData:data]; - }); + if (_nextInterceptor == nil && !_shutDown) { + [self createNextInterceptor]; } + if (_nextInterceptor == nil) { + return; + } + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ + [copiedNextInterceptor writeData:data]; + }); } - (void)finishNextInterceptor { - if (_nextInterceptor != nil) { - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ - [copiedNextInterceptor finish]; - }); + if (_nextInterceptor == nil && !_shutDown) { + [self createNextInterceptor]; + } + if (_nextInterceptor == nil) { + return; } + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ + [copiedNextInterceptor finish]; + }); } - (void)cancelNextInterceptor { - if (_nextInterceptor != nil) { - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ - [copiedNextInterceptor cancel]; - }); + if (_nextInterceptor == nil && !_shutDown) { + [self createNextInterceptor]; + } + if (_nextInterceptor == nil) { + return; } + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ + [copiedNextInterceptor cancel]; + }); } /** Notify the next interceptor in the chain to receive more messages */ - (void)receiveNextInterceptorMessages:(NSUInteger)numberOfMessages { - if (_nextInterceptor != nil) { - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ - [copiedNextInterceptor receiveNextMessages:numberOfMessages]; - }); + if (_nextInterceptor == nil && !_shutDown) { + [self createNextInterceptor]; } + if (_nextInterceptor == nil) { + return; + } + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ + [copiedNextInterceptor receiveNextMessages:numberOfMessages]; + }); } // Methods to forward GRPCResponseHandler callbacks to the previous object /** Forward initial metadata to the previous interceptor in the chain */ -- (void)forwardPreviousInterceptorWithInitialMetadata:(nullable NSDictionary *)initialMetadata { - if ([_previousInterceptor respondsToSelector:@selector(didReceiveInitialMetadata:)]) { - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didReceiveInitialMetadata:initialMetadata]; - }); +- (void)forwardPreviousInterceptorWithInitialMetadata:(NSDictionary *)initialMetadata { + if (_nextInterceptor == nil && !_shutDown) { + [self createNextInterceptor]; + } + if (_nextInterceptor == nil) { + return; } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didReceiveInitialMetadata:initialMetadata]; + }); } /** Forward a received message to the previous interceptor in the chain */ - (void)forwardPreviousInterceptorWithData:(id)data { - if ([_previousInterceptor respondsToSelector:@selector(didReceiveData:)]) { - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didReceiveData:data]; - }); + if (_previousInterceptor == nil) { + return; } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didReceiveData:data]; + }); } /** Forward call close and trailing metadata to the previous interceptor in the chain */ -- (void)forwardPreviousInterceptorCloseWithTrailingMetadata: - (nullable NSDictionary *)trailingMetadata - error:(nullable NSError *)error { - if ([_previousInterceptor respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; - }); + - (void)forwardPreviousInterceptorCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata +error:(NSError *)error { + if (_previousInterceptor == nil) { + return; } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; + }); } /** Forward write completion to the previous interceptor in the chain */ - (void)forwardPreviousInterceptorDidWriteData { - if ([_previousInterceptor respondsToSelector:@selector(didWriteData)]) { - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didWriteData]; - }); + if (_previousInterceptor == nil) { + return; + } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didWriteData]; + }); +} + + - (dispatch_queue_t)dispatchQueue { + return _dispatchQueue; + } + + - (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { + [_thisInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; + } + + - (void)writeData:(id)data { + [_thisInterceptor writeData:data]; + } + + - (void)finish { + [_thisInterceptor finish]; + } + + - (void)cancel { + [_thisInterceptor cancel]; + } + + - (void)receiveNextMessages:(NSUInteger)numberOfMessages { + [_thisInterceptor receiveNextMessages:numberOfMessages]; + } + + - (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata { + if ([_thisInterceptor respondsToSelector:@selector(didReceiveInitialMetadata:)]) { + [_thisInterceptor didReceiveInitialMetadata:initialMetadata]; + } + } + + - (void)didReceiveData:(id)data { + if ([_thisInterceptor respondsToSelector:@selector(didReceiveData:)]) { + [_thisInterceptor didReceiveData:data]; + } + } + + - (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata + error:(nullable NSError *)error { + if ([_thisInterceptor respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { + [_thisInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; } } + - (void)didWriteData { + if ([_thisInterceptor respondsToSelector:@selector(didWriteData)]) { + [_thisInterceptor didWriteData]; + } + } + @end @implementation GRPCInterceptor { GRPCInterceptorManager *_manager; - dispatch_queue_t _requestDispatchQueue; - dispatch_queue_t _responseDispatchQueue; + dispatch_queue_t _dispatchQueue; } - (instancetype)initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue { + dispatchQueue:(dispatch_queue_t)dispatchQueue { if ((self = [super init])) { _manager = interceptorManager; - _requestDispatchQueue = requestDispatchQueue; - _responseDispatchQueue = responseDispatchQueue; + _dispatchQueue = dispatchQueue; } return self; } -- (dispatch_queue_t)requestDispatchQueue { - return _requestDispatchQueue; -} - - (dispatch_queue_t)dispatchQueue { - return _responseDispatchQueue; + return _dispatchQueue; } -- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions - callOptions:(GRPCCallOptions *)callOptions { +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { [_manager startNextInterceptorWithRequest:requestOptions callOptions:callOptions]; } diff --git a/src/objective-c/GRPCClient/GRPCTransport.h b/src/objective-c/GRPCClient/GRPCTransport.h new file mode 100644 index 00000000000..2da6ab3dc6a --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCTransport.h @@ -0,0 +1,61 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "GRPCInterceptor.h" + +NS_ASSUME_NONNULL_BEGIN + +#pragma mark Transport ID + +extern const struct GRPCTransportImplList { + const GRPCTransportId core_secure; + const GRPCTransportId core_insecure; +} GRPCTransportImplList; + +BOOL TransportIdIsEqual(GRPCTransportId lhs, GRPCTransportId rhs); + +NSUInteger TransportIdHash(GRPCTransportId); + +#pragma mark Transport and factory + +@protocol GRPCInterceptorInterface; +@protocol GRPCResponseHandler; +@class GRPCTransportManager; +@class GRPCRequestOptions; +@class GRPCCallOptions; +@class GRPCTransport; + +@protocol GRPCTransportFactory + +- (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager; + +@end + +@interface GRPCTransportRegistry : NSObject + ++ (instancetype)sharedInstance; + +- (void)registerTransportWithId:(GRPCTransportId)id factory:(id)factory; + +@end + +@interface GRPCTransport : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/objective-c/GRPCClient/GRPCTransport.m b/src/objective-c/GRPCClient/GRPCTransport.m new file mode 100644 index 00000000000..0621c4e6450 --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCTransport.m @@ -0,0 +1,116 @@ +#import "GRPCTransport.h" + +static const GRPCTransportId gGRPCCoreSecureId = "io.grpc.transport.core.secure"; +static const GRPCTransportId gGRPCCoreInsecureId = "io.grpc.transport.core.insecure"; + +const struct GRPCTransportImplList GRPCTransportImplList = { + .core_secure = gGRPCCoreSecureId, + .core_insecure = gGRPCCoreInsecureId}; + +static const GRPCTransportId gDefaultTransportId = gGRPCCoreSecureId; + +static GRPCTransportRegistry *gTransportRegistry = nil; +static dispatch_once_t initTransportRegistry; + +BOOL TransportIdIsEqual(GRPCTransportId lhs, GRPCTransportId rhs) { + // Directly comparing pointers works because we require users to use the id provided by each + // implementation, not coming up with their own string. + return lhs == rhs; +} + +NSUInteger TransportIdHash(GRPCTransportId transportId) { + if (transportId == NULL) { + transportId = gDefaultTransportId; + } + return [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding].hash; +} + +@implementation GRPCTransportRegistry { + NSMutableDictionary> *_registry; + id _defaultFactory; +} + ++ (instancetype)sharedInstance { + dispatch_once(&initTransportRegistry, ^{ + gTransportRegistry = [[GRPCTransportRegistry alloc] init]; + NSAssert(gTransportRegistry != nil, @"Unable to initialize transport registry."); + if (gTransportRegistry == nil) { + NSLog(@"Unable to initialize transport registry."); + [NSException raise:NSGenericException format:@"Unable to initialize transport registry."]; + } + }); + return gTransportRegistry; +} + +- (instancetype)init { + if ((self = [super init])) { + _registry = [NSMutableDictionary dictionary]; + } + return self; +} + +- (void)registerTransportWithId:(GRPCTransportId)transportId factory:(id)factory { + NSString *nsTransportId = [NSString stringWithCString:transportId + encoding:NSUTF8StringEncoding]; + NSAssert(_registry[nsTransportId] == nil, @"The transport %@ has already been registered.", nsTransportId); + if (_registry[nsTransportId] != nil) { + NSLog(@"The transport %@ has already been registered.", nsTransportId); + return; + } + _registry[nsTransportId] = factory; + + // if the default transport is registered, mark it. + if (0 == strcmp(transportId, gDefaultTransportId)) { + _defaultFactory = factory; + } +} + +- (id)getTransportFactoryWithId:(GRPCTransportId)transportId { + if (transportId == NULL) { + if (_defaultFactory == nil) { + [NSException raise:NSInvalidArgumentException format:@"Unable to get default transport factory"]; + return nil; + } + return _defaultFactory; + } + NSString *nsTransportId = [NSString stringWithCString:transportId + encoding:NSUTF8StringEncoding]; + id transportFactory = _registry[nsTransportId]; + if (transportFactory == nil) { + // User named a transport id that was not registered with the registry. + [NSException raise:NSInvalidArgumentException format:@"Unable to get transport factory with id %s", transportId]; + return nil; + } + return transportFactory; +} + +@end + +@implementation GRPCTransport + +- (dispatch_queue_t)dispatchQueue { + [NSException raise:NSGenericException format:@"Implementations should override the dispatch queue"]; + return nil; +} + +- (void)startWithRequestOptions:(nonnull GRPCRequestOptions *)requestOptions callOptions:(nonnull GRPCCallOptions *)callOptions { + [NSException raise:NSGenericException format:@"Implementations should override the methods of GRPCTransport"]; +} + +- (void)writeData:(nonnull id)data { + [NSException raise:NSGenericException format:@"Implementations should override the methods of GRPCTransport"]; +} + +- (void)cancel { + [NSException raise:NSGenericException format:@"Implementations should override the methods of GRPCTransport"]; +} + +- (void)finish { + [NSException raise:NSGenericException format:@"Implementations should override the methods of GRPCTransport"]; +} + +- (void)receiveNextMessages:(NSUInteger)numberOfMessages { + [NSException raise:NSGenericException format:@"Implementations should override the methods of GRPCTransport"]; +} + +@end diff --git a/src/objective-c/GRPCClient/internal_testing/GRPCCall+InternalTests.m b/src/objective-c/GRPCClient/internal_testing/GRPCCall+InternalTests.m index 1bb352f0be2..8f98daa6348 100644 --- a/src/objective-c/GRPCClient/internal_testing/GRPCCall+InternalTests.m +++ b/src/objective-c/GRPCClient/internal_testing/GRPCCall+InternalTests.m @@ -20,7 +20,7 @@ #import "GRPCCall+InternalTests.h" -#import "../private/GRPCOpBatchLog.h" +#import "../private/GRPCCore/GRPCOpBatchLog.h" @implementation GRPCCall (InternalTests) diff --git a/src/objective-c/GRPCClient/private/ChannelArgsUtil.h b/src/objective-c/GRPCClient/private/GRPCCore/ChannelArgsUtil.h similarity index 100% rename from src/objective-c/GRPCClient/private/ChannelArgsUtil.h rename to src/objective-c/GRPCClient/private/GRPCCore/ChannelArgsUtil.h diff --git a/src/objective-c/GRPCClient/private/ChannelArgsUtil.m b/src/objective-c/GRPCClient/private/GRPCCore/ChannelArgsUtil.m similarity index 100% rename from src/objective-c/GRPCClient/private/ChannelArgsUtil.m rename to src/objective-c/GRPCClient/private/GRPCCore/ChannelArgsUtil.m diff --git a/src/objective-c/GRPCClient/private/GRPCCall+V2API.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCall+V2API.h similarity index 79% rename from src/objective-c/GRPCClient/private/GRPCCall+V2API.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCall+V2API.h index 22bf16962c6..f6db3023cac 100644 --- a/src/objective-c/GRPCClient/private/GRPCCall+V2API.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCall+V2API.h @@ -18,12 +18,6 @@ @interface GRPCCall (V2API) -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - callSafety:(GRPCCallSafety)safety - requestsWriter:(GRXWriter *)requestsWriter - callOptions:(GRPCCallOptions *)callOptions; - - (instancetype)initWithHost:(NSString *)host path:(NSString *)path callSafety:(GRPCCallSafety)safety diff --git a/src/objective-c/GRPCClient/private/GRPCCallInternal.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.h similarity index 71% rename from src/objective-c/GRPCClient/private/GRPCCallInternal.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.h index ac2d1cba2ec..ff7a9f6e838 100644 --- a/src/objective-c/GRPCClient/private/GRPCCallInternal.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.h @@ -16,20 +16,21 @@ * */ -#import +#import NS_ASSUME_NONNULL_BEGIN -@interface GRPCCall2Internal : NSObject +@protocol GRPCResponseHandler; +@class GRPCCallOptions; +@protocol GRPCChannelFactory; -- (instancetype)init; +@interface GRPCCall2Internal : GRPCTransport -- (void)setResponseHandler:(id)responseHandler; +- (instancetype)initWithTransportManager:(GRPCTransportManager*)transportManager; -- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions - callOptions:(nullable GRPCCallOptions *)callOptions; +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions; -- (void)writeData:(NSData *)data; +- (void)writeData:(id)data; - (void)finish; diff --git a/src/objective-c/GRPCClient/private/GRPCCallInternal.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m similarity index 68% rename from src/objective-c/GRPCClient/private/GRPCCallInternal.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m index 32e38158fad..7ff8c6a5945 100644 --- a/src/objective-c/GRPCClient/private/GRPCCallInternal.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m @@ -19,17 +19,19 @@ #import "GRPCCallInternal.h" #import +#import #import #import "GRPCCall+V2API.h" +#import "../GRPCTransport+Private.h" @implementation GRPCCall2Internal { /** Request for the call. */ GRPCRequestOptions *_requestOptions; /** Options for the call. */ GRPCCallOptions *_callOptions; - /** The handler of responses. */ - id _handler; + /** The interceptor manager to process responses. */ + GRPCTransportManager *_transportManager; /** * Make use of legacy GRPCCall to make calls. Nullified when call is finished. @@ -51,45 +53,33 @@ NSUInteger _pendingReceiveNextMessages; } -- (instancetype)init { - if ((self = [super init])) { - // Set queue QoS only when iOS version is 8.0 or above and Xcode version is 9.0 or above + - (instancetype)initWithTransportManager:(GRPCTransportManager *)transportManager { + dispatch_queue_t dispatchQueue; + // Set queue QoS only when iOS version is 8.0 or above and Xcode version is 9.0 or above #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 if (@available(iOS 8.0, macOS 10.10, *)) { - _dispatchQueue = dispatch_queue_create( - NULL, - dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); + dispatchQueue = dispatch_queue_create( + NULL, + dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); } else { #else - { + { #endif - _dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); - } + dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); + } + if ((self = [super init])) { _pipe = [GRXBufferedPipe pipe]; + _transportManager = transportManager; + _dispatchQueue = dispatchQueue; } return self; } -- (void)setResponseHandler:(id)responseHandler { - @synchronized(self) { - NSAssert(!_started, @"Call already started."); - if (_started) { - return; - } - _handler = responseHandler; - _initialMetadataPublished = NO; - _started = NO; - _canceled = NO; - _finished = NO; - } -} - -- (dispatch_queue_t)requestDispatchQueue { +- (dispatch_queue_t)dispatchQueue { return _dispatchQueue; } -- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions - callOptions:(GRPCCallOptions *)callOptions { +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { NSAssert(requestOptions.host.length != 0 && requestOptions.path.length != 0, @"Neither host nor path can be nil."); NSAssert(requestOptions.safety <= GRPCCallSafetyCacheableRequest, @"Invalid call safety value."); @@ -102,26 +92,15 @@ return; } + GRPCCall *copiedCall = nil; @synchronized(self) { - NSAssert(_handler != nil, @"Response handler required."); - if (_handler == nil) { - NSLog(@"Invalid response handler."); - return; - } _requestOptions = requestOptions; if (callOptions == nil) { _callOptions = [[GRPCCallOptions alloc] init]; } else { _callOptions = [callOptions copy]; } - } - [self start]; -} - -- (void)start { - GRPCCall *copiedCall = nil; - @synchronized(self) { NSAssert(!_started, @"Call already started."); NSAssert(!_canceled, @"Call already canceled."); if (_started) { @@ -140,7 +119,7 @@ callOptions:_callOptions writeDone:^{ @synchronized(self) { - if (self->_handler) { + if (self->_transportManager) { [self issueDidWriteData]; } } @@ -158,7 +137,7 @@ void (^valueHandler)(id value) = ^(id value) { @synchronized(self) { - if (self->_handler) { + if (self->_transportManager) { if (!self->_initialMetadataPublished) { self->_initialMetadataPublished = YES; [self issueInitialMetadata:self->_call.responseHeaders]; @@ -171,7 +150,7 @@ }; void (^completionHandler)(NSError *errorOrNil) = ^(NSError *errorOrNil) { @synchronized(self) { - if (self->_handler) { + if (self->_transportManager) { if (!self->_initialMetadataPublished) { self->_initialMetadataPublished = YES; [self issueInitialMetadata:self->_call.responseHeaders]; @@ -207,20 +186,15 @@ _call = nil; _pipe = nil; - if ([_handler respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { - id copiedHandler = _handler; - _handler = nil; - dispatch_async(copiedHandler.dispatchQueue, ^{ - [copiedHandler didCloseWithTrailingMetadata:nil - error:[NSError errorWithDomain:kGRPCErrorDomain - code:GRPCErrorCodeCancelled - userInfo:@{ - NSLocalizedDescriptionKey : - @"Canceled by app" - }]]; - }); - } else { - _handler = nil; + if (_transportManager != nil) { + [_transportManager forwardPreviousInterceptorCloseWithTrailingMetadata:nil + error:[NSError errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeCancelled + userInfo:@{ + NSLocalizedDescriptionKey : + @"Canceled by app" + }]]; + [_transportManager shutDown]; } } [copiedCall cancel]; @@ -271,59 +245,25 @@ } - (void)issueInitialMetadata:(NSDictionary *)initialMetadata { - @synchronized(self) { - if (initialMetadata != nil && - [_handler respondsToSelector:@selector(didReceiveInitialMetadata:)]) { - id copiedHandler = _handler; - dispatch_async(_handler.dispatchQueue, ^{ - [copiedHandler didReceiveInitialMetadata:initialMetadata]; - }); - } + if (initialMetadata != nil) { + [_transportManager forwardPreviousInterceptorWithInitialMetadata:initialMetadata]; } } - (void)issueMessage:(id)message { - @synchronized(self) { - if (message != nil) { - if ([_handler respondsToSelector:@selector(didReceiveData:)]) { - id copiedHandler = _handler; - dispatch_async(_handler.dispatchQueue, ^{ - [copiedHandler didReceiveData:message]; - }); - } else if ([_handler respondsToSelector:@selector(didReceiveRawMessage:)]) { - id copiedHandler = _handler; - dispatch_async(_handler.dispatchQueue, ^{ - [copiedHandler didReceiveRawMessage:message]; - }); - } - } + if (message != nil) { + [_transportManager forwardPreviousInterceptorWithData:message]; } } - (void)issueClosedWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { - @synchronized(self) { - if ([_handler respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { - id copiedHandler = _handler; - // Clean up _handler so that no more responses are reported to the handler. - _handler = nil; - dispatch_async(copiedHandler.dispatchQueue, ^{ - [copiedHandler didCloseWithTrailingMetadata:trailingMetadata error:error]; - }); - } else { - _handler = nil; - } - } + [_transportManager forwardPreviousInterceptorCloseWithTrailingMetadata:trailingMetadata + error:error]; + [_transportManager shutDown]; } - (void)issueDidWriteData { - @synchronized(self) { - if (_callOptions.flowControlEnabled && [_handler respondsToSelector:@selector(didWriteData)]) { - id copiedHandler = _handler; - dispatch_async(copiedHandler.dispatchQueue, ^{ - [copiedHandler didWriteData]; - }); - } - } + [_transportManager forwardPreviousInterceptorDidWriteData]; } - (void)receiveNextMessages:(NSUInteger)numberOfMessages { diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCChannel.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.h diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m similarity index 77% rename from src/objective-c/GRPCClient/private/GRPCChannel.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m index 1a79fb04a0d..846e8331b4b 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m @@ -20,15 +20,16 @@ #include -#import "../internal/GRPCCallOptions+Internal.h" +#import "../../internal/GRPCCallOptions+Internal.h" #import "ChannelArgsUtil.h" #import "GRPCChannelFactory.h" #import "GRPCChannelPool.h" #import "GRPCCompletionQueue.h" -#import "GRPCCronetChannelFactory.h" #import "GRPCInsecureChannelFactory.h" #import "GRPCSecureChannelFactory.h" #import "version.h" +#import "GRPCCoreFactory.h" +#import "../GRPCTransport+Private.h" #import #import @@ -50,32 +51,44 @@ } - (id)channelFactory { - GRPCTransportType type = _callOptions.transportType; - switch (type) { - case GRPCTransportTypeChttp2BoringSSL: - // TODO (mxyan): Remove when the API is deprecated -#ifdef GRPC_COMPILE_WITH_CRONET - if (![GRPCCall isUsingCronet]) { -#else - { -#endif - NSError *error; - id factory = [GRPCSecureChannelFactory - factoryWithPEMRootCertificates:_callOptions.PEMRootCertificates - privateKey:_callOptions.PEMPrivateKey - certChain:_callOptions.PEMCertificateChain - error:&error]; - NSAssert(factory != nil, @"Failed to create secure channel factory"); - if (factory == nil) { - NSLog(@"Error creating secure channel factory: %@", error); - } - return factory; + if (_callOptions.transport != NULL) { + id transportFactory = [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:_callOptions.transport]; + if (![transportFactory respondsToSelector:@selector(createCoreChannelFactoryWithCallOptions:)]) { + // impossible because we are using GRPCCore now + [NSException raise:NSInternalInconsistencyException format:@"Transport factory type is wrong"]; + } + id coreTransportFactory = (id)transportFactory; + return [coreTransportFactory createCoreChannelFactoryWithCallOptions:_callOptions]; + } else { + // To maintain backwards compatibility with tranportType + GRPCTransportType type = _callOptions.transportType; + switch (type) { + case GRPCTransportTypeChttp2BoringSSL: + // TODO (mxyan): Remove when the API is deprecated + { + NSError *error; + id factory = [GRPCSecureChannelFactory + factoryWithPEMRootCertificates:_callOptions.PEMRootCertificates + privateKey:_callOptions.PEMPrivateKey + certChain:_callOptions.PEMCertificateChain + error:&error]; + NSAssert(factory != nil, @"Failed to create secure channel factory"); + if (factory == nil) { + NSLog(@"Error creating secure channel factory: %@", error); + } + return factory; + } + case GRPCTransportTypeCronet: + { + id transportFactory = (id)[[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:gGRPCCoreCronetId]; + return [transportFactory createCoreChannelFactoryWithCallOptions:_callOptions]; } - // fallthrough - case GRPCTransportTypeCronet: - return [GRPCCronetChannelFactory sharedInstance]; - case GRPCTransportTypeInsecure: - return [GRPCInsecureChannelFactory sharedInstance]; + case GRPCTransportTypeInsecure: + return [GRPCInsecureChannelFactory sharedInstance]; + default: + NSLog(@"Unrecognized transport type"); + return nil; + } } } @@ -178,7 +191,7 @@ grpc_channel *_unmanagedChannel; } -- (instancetype)initWithChannelConfiguration:(GRPCChannelConfiguration *)channelConfiguration { + - (instancetype)initWithChannelConfiguration:(GRPCChannelConfiguration *)channelConfiguration { NSAssert(channelConfiguration != nil, @"channelConfiguration must not be empty."); if (channelConfiguration == nil) { return nil; @@ -198,6 +211,7 @@ } else { channelArgs = channelConfiguration.channelArgs; } + id factory = channelConfiguration.channelFactory; _unmanagedChannel = [factory createChannelWithHost:host channelArgs:channelArgs]; NSAssert(_unmanagedChannel != NULL, @"Failed to create channel"); diff --git a/src/objective-c/GRPCClient/private/GRPCChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelFactory.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCChannelFactory.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelFactory.h diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool+Test.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool+Test.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCChannelPool+Test.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool+Test.h diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.h similarity index 97% rename from src/objective-c/GRPCClient/private/GRPCChannelPool.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.h index e00ee69e63a..5adb9cea168 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannelPool.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.h @@ -18,8 +18,6 @@ #import -#import "GRPCChannelFactory.h" - NS_ASSUME_NONNULL_BEGIN @protocol GRPCChannel; @@ -45,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN * Initialize with an actual channel object \a channel and a reference to the channel pool. */ - (nullable instancetype)initWithChannelConfiguration: - (GRPCChannelConfiguration *)channelConfiguration; +(GRPCChannelConfiguration *)channelConfiguration; /** * Create a GRPCWrappedCall object (grpc_call) from this channel. If channel is disconnected, get a diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m similarity index 98% rename from src/objective-c/GRPCClient/private/GRPCChannelPool.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m index d545793fcce..faabb3ae336 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannelPool.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m @@ -18,19 +18,17 @@ #import -#import "../internal/GRPCCallOptions+Internal.h" +#import "../../internal/GRPCCallOptions+Internal.h" #import "GRPCChannel.h" #import "GRPCChannelFactory.h" #import "GRPCChannelPool+Test.h" #import "GRPCChannelPool.h" #import "GRPCCompletionQueue.h" -#import "GRPCCronetChannelFactory.h" #import "GRPCInsecureChannelFactory.h" #import "GRPCSecureChannelFactory.h" #import "GRPCWrappedCall.h" #import "version.h" -#import #include extern const char *kCFStreamVarName; diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCompletionQueue.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.h diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCompletionQueue.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.m diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h new file mode 100644 index 00000000000..8c781f4a448 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h @@ -0,0 +1,23 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "GRPCCoreFactory.h" + +@interface GRPCCoreCronetFactory : NSObject + +@end diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m new file mode 100644 index 00000000000..661df006e57 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m @@ -0,0 +1,53 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "GRPCCoreCronetFactory.h" + +#import +#import + +#import "GRPCCoreFactory.h" +#import "GRPCCallInternal.h" +#import "GRPCCronetChannelFactory.h" + +static GRPCCoreCronetFactory *gGRPCCoreCronetFactory = nil; +static dispatch_once_t gInitGRPCCoreCronetFactory; + +@implementation GRPCCoreCronetFactory + ++ (instancetype)sharedInstance { + dispatch_once(&gInitGRPCCoreCronetFactory, ^{ + gGRPCCoreCronetFactory = [[GRPCCoreCronetFactory alloc] init]; + }); + return gGRPCCoreCronetFactory; +} + ++ (void)load { + [[GRPCTransportRegistry sharedInstance] registerTransportWithId:gGRPCCoreCronetId + factory:[GRPCCoreCronetFactory sharedInstance]]; +} + +- (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager { + return [[GRPCCall2Internal alloc] initWithTransportManager:transportManager]; +} + +- (id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions { + return [GRPCCronetChannelFactory sharedInstance]; +} + +@end diff --git a/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.h diff --git a/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m similarity index 79% rename from src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m index 5bcb021dc4b..8744d27e04f 100644 --- a/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m @@ -21,8 +21,6 @@ #import "ChannelArgsUtil.h" #import "GRPCChannel.h" -#ifdef GRPC_COMPILE_WITH_CRONET - #import #include @@ -59,21 +57,3 @@ } @end - -#else - -@implementation GRPCCronetChannelFactory - -+ (instancetype)sharedInstance { - NSAssert(NO, @"Must enable macro GRPC_COMPILE_WITH_CRONET to build Cronet channel."); - return nil; -} - -- (grpc_channel *)createChannelWithHost:(NSString *)host channelArgs:(NSDictionary *)args { - NSAssert(NO, @"Must enable macro GRPC_COMPILE_WITH_CRONET to build Cronet channel."); - return NULL; -} - -@end - -#endif diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h new file mode 100644 index 00000000000..d4d8ef586df --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h @@ -0,0 +1,40 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol GRPCChannelFactory; +@protocol GRPCCallOptions; + +@protocol GRPCCoreTransportFactory + +- (nullable id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions; + +@end + +@interface GRPCCoreSecureFactory : NSObject + +@end + +@interface GRPCCoreInsecureFactory : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m new file mode 100644 index 00000000000..609cda17697 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m @@ -0,0 +1,68 @@ +#import "GRPCCoreFactory.h" + +#import + +#import "GRPCCallInternal.h" +#import "GRPCSecureChannelFactory.h" +#import "GRPCInsecureChannelFactory.h" + +static GRPCCoreSecureFactory *gGRPCCoreSecureFactory = nil; +static GRPCCoreInsecureFactory *gGRPCCoreInsecureFactory = nil; +static dispatch_once_t gInitGRPCCoreSecureFactory; +static dispatch_once_t gInitGRPCCoreInsecureFactory; + +@implementation GRPCCoreSecureFactory + ++ (instancetype)sharedInstance { + dispatch_once(&gInitGRPCCoreSecureFactory, ^{ + gGRPCCoreSecureFactory = [[GRPCCoreSecureFactory alloc] init]; + }); + return gGRPCCoreSecureFactory; +} + ++ (void)load { + [[GRPCTransportRegistry sharedInstance] registerTransportWithId:GRPCTransportImplList.core_secure + factory:[self sharedInstance]]; +} + +- (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager { + return [[GRPCCall2Internal alloc] initWithTransportManager:transportManager]; +} + +- (id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions { + NSError *error; + id factory = [GRPCSecureChannelFactory factoryWithPEMRootCertificates:callOptions.PEMRootCertificates + privateKey:callOptions.PEMPrivateKey + certChain:callOptions.PEMCertificateChain error:&error]; + if (error != nil) { + NSLog(@"Unable to create secure channel factory"); + return nil; + } + return factory; +} + +@end + +@implementation GRPCCoreInsecureFactory + ++ (instancetype)sharedInstance { + dispatch_once(&gInitGRPCCoreInsecureFactory, ^{ + gGRPCCoreInsecureFactory = [[GRPCCoreInsecureFactory alloc] init]; + }); + return gGRPCCoreInsecureFactory; +} + ++ (void)load { + [[GRPCTransportRegistry sharedInstance] registerTransportWithId:GRPCTransportImplList.core_insecure + factory:[self sharedInstance]]; +} + +- (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager { + return [[GRPCCall2Internal alloc] initWithTransportManager:transportManager]; +} + +- (id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions { + return [GRPCInsecureChannelFactory sharedInstance]; +} + +@end diff --git a/src/objective-c/GRPCClient/private/GRPCHost.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCHost.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.h diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m similarity index 87% rename from src/objective-c/GRPCClient/private/GRPCHost.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m index 63ffc927411..89a184d8c26 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m @@ -25,10 +25,9 @@ #include #include -#import "../internal/GRPCCallOptions+Internal.h" +#import "../../internal/GRPCCallOptions+Internal.h" #import "GRPCChannelFactory.h" #import "GRPCCompletionQueue.h" -#import "GRPCCronetChannelFactory.h" #import "GRPCSecureChannelFactory.h" #import "NSDictionary+GRPC.h" #import "version.h" @@ -113,20 +112,10 @@ static NSMutableDictionary *gHostCache; options.PEMPrivateKey = _PEMPrivateKey; options.PEMCertificateChain = _PEMCertificateChain; options.hostNameOverride = _hostNameOverride; -#ifdef GRPC_COMPILE_WITH_CRONET - // By old API logic, insecure channel precedes Cronet channel; Cronet channel preceeds default - // channel. - if ([GRPCCall isUsingCronet]) { - if (_transportType == GRPCTransportTypeInsecure) { - options.transportType = GRPCTransportTypeInsecure; - } else { - NSAssert(_transportType == GRPCTransportTypeDefault, @"Invalid transport type"); - options.transportType = GRPCTransportTypeCronet; - } - } else -#endif - { - options.transportType = _transportType; + if (_transportType == GRPCTransportTypeInsecure) { + options.transport = GRPCTransportImplList.core_insecure; + } else { + options.transport = GRPCTransportImplList.core_secure; } options.logContext = _logContext; diff --git a/src/objective-c/GRPCClient/private/GRPCInsecureChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCInsecureChannelFactory.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCInsecureChannelFactory.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCInsecureChannelFactory.h diff --git a/src/objective-c/GRPCClient/private/GRPCInsecureChannelFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCInsecureChannelFactory.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCInsecureChannelFactory.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCInsecureChannelFactory.m diff --git a/src/objective-c/GRPCClient/private/GRPCOpBatchLog.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCOpBatchLog.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCOpBatchLog.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCOpBatchLog.h diff --git a/src/objective-c/GRPCClient/private/GRPCOpBatchLog.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCOpBatchLog.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCOpBatchLog.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCOpBatchLog.m diff --git a/src/objective-c/GRPCClient/private/GRPCReachabilityFlagNames.xmacro.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCReachabilityFlagNames.xmacro.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCReachabilityFlagNames.xmacro.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCReachabilityFlagNames.xmacro.h diff --git a/src/objective-c/GRPCClient/private/GRPCRequestHeaders.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.h similarity index 95% rename from src/objective-c/GRPCClient/private/GRPCRequestHeaders.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.h index 545ff1cea82..0fced0c385a 100644 --- a/src/objective-c/GRPCClient/private/GRPCRequestHeaders.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.h @@ -18,7 +18,7 @@ #import -#import "../GRPCCall.h" +#import @interface GRPCRequestHeaders : NSMutableDictionary diff --git a/src/objective-c/GRPCClient/private/GRPCRequestHeaders.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCRequestHeaders.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.m diff --git a/src/objective-c/GRPCClient/private/GRPCSecureChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCSecureChannelFactory.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCSecureChannelFactory.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCSecureChannelFactory.h diff --git a/src/objective-c/GRPCClient/private/GRPCSecureChannelFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCSecureChannelFactory.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCSecureChannelFactory.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCSecureChannelFactory.m diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCWrappedCall.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCWrappedCall.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCWrappedCall.h diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCWrappedCall.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCWrappedCall.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCWrappedCall.m diff --git a/src/objective-c/GRPCClient/private/NSData+GRPC.h b/src/objective-c/GRPCClient/private/GRPCCore/NSData+GRPC.h similarity index 100% rename from src/objective-c/GRPCClient/private/NSData+GRPC.h rename to src/objective-c/GRPCClient/private/GRPCCore/NSData+GRPC.h diff --git a/src/objective-c/GRPCClient/private/NSData+GRPC.m b/src/objective-c/GRPCClient/private/GRPCCore/NSData+GRPC.m similarity index 100% rename from src/objective-c/GRPCClient/private/NSData+GRPC.m rename to src/objective-c/GRPCClient/private/GRPCCore/NSData+GRPC.m diff --git a/src/objective-c/GRPCClient/private/NSDictionary+GRPC.h b/src/objective-c/GRPCClient/private/GRPCCore/NSDictionary+GRPC.h similarity index 100% rename from src/objective-c/GRPCClient/private/NSDictionary+GRPC.h rename to src/objective-c/GRPCClient/private/GRPCCore/NSDictionary+GRPC.h diff --git a/src/objective-c/GRPCClient/private/NSDictionary+GRPC.m b/src/objective-c/GRPCClient/private/GRPCCore/NSDictionary+GRPC.m similarity index 100% rename from src/objective-c/GRPCClient/private/NSDictionary+GRPC.m rename to src/objective-c/GRPCClient/private/GRPCCore/NSDictionary+GRPC.m diff --git a/src/objective-c/GRPCClient/private/NSError+GRPC.h b/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.h similarity index 100% rename from src/objective-c/GRPCClient/private/NSError+GRPC.h rename to src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.h diff --git a/src/objective-c/GRPCClient/private/NSError+GRPC.m b/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m similarity index 100% rename from src/objective-c/GRPCClient/private/NSError+GRPC.m rename to src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m diff --git a/src/objective-c/GRPCClient/private/GRPCCore/version.h b/src/objective-c/GRPCClient/private/GRPCCore/version.h new file mode 100644 index 00000000000..3b248db0148 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCCore/version.h @@ -0,0 +1,25 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// This file is autogenerated from a template file. Please make +// modifications to +// `templates/src/objective-c/GRPCClient/private/version.h.template` +// instead. This file can be regenerated from the template by running +// `tools/buildgen/generate_projects.sh`. + +#define GRPC_OBJC_VERSION_STRING @"1.23.0-dev" diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h new file mode 100644 index 00000000000..9115b915659 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h @@ -0,0 +1,55 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface GRPCTransportRegistry (Private) + +- (nullable instancetype)initWithTransportId:(GRPCTransportId)transportId + previousInterceptor:(id)previousInterceptor; + +- (id)getTransportFactoryWithId:(GRPCTransportId)id; + +@end + +@interface GRPCTransportManager : NSObject + +- (instancetype)initWithTransportId:(GRPCTransportId)transportId + previousInterceptor:(id)previousInterceptor; + +- (void)shutDown; + +/** Forward initial metadata to the previous interceptor in the interceptor chain */ +- (void)forwardPreviousInterceptorWithInitialMetadata:(nullable NSDictionary *)initialMetadata; + +/** Forward a received message to the previous interceptor in the interceptor chain */ +- (void)forwardPreviousInterceptorWithData:(nullable id)data; + +/** Forward call close and trailing metadata to the previous interceptor in the interceptor chain */ +- (void)forwardPreviousInterceptorCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata + error:(nullable NSError *)error; + +/** Forward write completion to the previous interceptor in the interceptor chain */ +- (void)forwardPreviousInterceptorDidWriteData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m new file mode 100644 index 00000000000..1050280e07b --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m @@ -0,0 +1,108 @@ +#import "GRPCTransport+Private.h" + +#import + +@implementation GRPCTransportManager { + GRPCTransportId _transportId; + GRPCTransport *_transport; + id _previousInterceptor; + dispatch_queue_t _dispatchQueue; +} + +- (instancetype)initWithTransportId:(GRPCTransportId)transportId + previousInterceptor:(id)previousInterceptor { + if ((self = [super init])) { + id factory = [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:transportId]; + + _transport = [factory createTransportWithManager:self]; + NSAssert(_transport != nil, @"Failed to create transport with id: %s", transportId); + if (_transport == nil) { + NSLog(@"Failed to create transport with id: %s", transportId); + return nil; + } + _previousInterceptor = previousInterceptor; + _dispatchQueue = _transport.dispatchQueue; + _transportId = transportId; + } + return self; +} + +- (void)shutDown { + _transport = nil; + _previousInterceptor = nil; +} + +- (dispatch_queue_t)dispatchQueue { + return _dispatchQueue; +} + +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { + if (_transportId != callOptions.transport) { + [NSException raise:NSInvalidArgumentException format:@"Interceptors cannot change the call option 'transport'"]; + return; + } + [_transport startWithRequestOptions:requestOptions callOptions:callOptions]; +} + +- (void)writeData:(id)data { + [_transport writeData:data]; +} + +- (void)finish { + [_transport finish]; +} + +- (void)cancel { + [_transport cancel]; +} + +- (void)receiveNextMessages:(NSUInteger)numberOfMessages { + [_transport receiveNextMessages:numberOfMessages]; +} + +/** Forward initial metadata to the previous interceptor in the chain */ +- (void)forwardPreviousInterceptorWithInitialMetadata:(NSDictionary *)initialMetadata { + if (_previousInterceptor == nil) { + return; + } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didReceiveInitialMetadata:initialMetadata]; + }); +} + +/** Forward a received message to the previous interceptor in the chain */ +- (void)forwardPreviousInterceptorWithData:(id)data { + if (_previousInterceptor == nil) { + return; + } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didReceiveData:data]; + }); +} + +/** Forward call close and trailing metadata to the previous interceptor in the chain */ +- (void)forwardPreviousInterceptorCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata + error:(NSError *)error { + if (_previousInterceptor == nil) { + return; + } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; + }); +} + +/** Forward write completion to the previous interceptor in the chain */ +- (void)forwardPreviousInterceptorDidWriteData { + if (_previousInterceptor == nil) { + return; + } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didWriteData]; + }); +} + +@end diff --git a/src/objective-c/tests/ConfigureCronet.h b/src/objective-c/tests/ConfigureCronet.h index cc5c038f3c6..ba0efc4df66 100644 --- a/src/objective-c/tests/ConfigureCronet.h +++ b/src/objective-c/tests/ConfigureCronet.h @@ -16,8 +16,6 @@ * */ -#ifdef GRPC_COMPILE_WITH_CRONET - #ifdef __cplusplus extern "C" { #endif @@ -30,5 +28,3 @@ void configureCronet(void); #ifdef __cplusplus } #endif - -#endif diff --git a/src/objective-c/tests/ConfigureCronet.m b/src/objective-c/tests/ConfigureCronet.m index ab137e28cad..6fc7e0ee9f5 100644 --- a/src/objective-c/tests/ConfigureCronet.m +++ b/src/objective-c/tests/ConfigureCronet.m @@ -16,8 +16,6 @@ * */ -#ifdef GRPC_COMPILE_WITH_CRONET - #import "ConfigureCronet.h" #import @@ -35,5 +33,3 @@ void configureCronet(void) { [Cronet startNetLogToFile:@"cronet_netlog.json" logBytes:YES]; }); } - -#endif diff --git a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m index a2a79c46316..c1c51fb06ab 100644 --- a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m +++ b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m @@ -23,6 +23,8 @@ #import #import "InteropTests.h" +#import "../ConfigureCronet.h" + // The server address is derived from preprocessor macro, which is // in turn derived from environment variable of the same name. @@ -40,10 +42,24 @@ static int32_t kRemoteInteropServerOverhead = 12; @implementation InteropTestsRemoteWithCronet ++ (void)setUp { + configureCronet(); + if ([self useCronet]) { + [GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]]; + } + + [super setUp]; +} + + + (NSString *)host { return kRemoteSSLHost; } ++ (GRPCTransportId)transport { + return gGRPCCoreCronetId; +} + + (BOOL)useCronet { return YES; } diff --git a/src/objective-c/tests/InteropTests/InteropTests.h b/src/objective-c/tests/InteropTests/InteropTests.h index cffa90ac497..b6af8e316e2 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.h +++ b/src/objective-c/tests/InteropTests/InteropTests.h @@ -42,11 +42,19 @@ - (int32_t)encodingOverhead; /** + * DEPRECATED: \a transportType is a deprecated option. Please use \a transport instead. + * * The type of transport to be used. The base implementation returns default. Subclasses should * override to appropriate settings. */ + (GRPCTransportType)transportType; +/* + * The transport to be used. The base implementation returns NULL. Subclasses should override to + * appropriate settings. + */ ++ (GRPCTransportId)transport; + /** * The root certificates to be used. The base implementation returns nil. Subclasses should override * to appropriate settings. diff --git a/src/objective-c/tests/InteropTests/InteropTests.m b/src/objective-c/tests/InteropTests/InteropTests.m index 3260e918f2f..25f96050e59 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.m +++ b/src/objective-c/tests/InteropTests/InteropTests.m @@ -20,9 +20,7 @@ #include -#ifdef GRPC_COMPILE_WITH_CRONET #import -#endif #import #import #import @@ -38,7 +36,6 @@ #import #import -#import "../ConfigureCronet.h" #import "InteropTestsBlockCallbacks.h" #define TEST_TIMEOUT 32 @@ -92,8 +89,7 @@ BOOL isRemoteInteropTest(NSString *host) { - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { dispatch_queue_t queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); return [[GRPCInterceptor alloc] initWithInterceptorManager:interceptorManager - requestDispatchQueue:queue - responseDispatchQueue:queue]; + dispatchQueue:queue]; } @end @@ -101,8 +97,7 @@ BOOL isRemoteInteropTest(NSString *host) { @interface HookInterceptorFactory : NSObject - (instancetype) -initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue +initWithDispatchQueue:(dispatch_queue_t)dispatchQueue startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook @@ -125,8 +120,7 @@ initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - (instancetype) initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue +dispatchQueue:(dispatch_queue_t)dispatchQueue startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook @@ -155,13 +149,11 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager void (^_responseCloseHook)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager); void (^_didWriteDataHook)(GRPCInterceptorManager *manager); - dispatch_queue_t _requestDispatchQueue; - dispatch_queue_t _responseDispatchQueue; + dispatch_queue_t _dispatchQueue; } - (instancetype) -initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue +initWithDispatchQueue:(dispatch_queue_t)dispatchQueue startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook @@ -176,8 +168,7 @@ initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue GRPCInterceptorManager *manager))responseCloseHook didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { if ((self = [super init])) { - _requestDispatchQueue = requestDispatchQueue; - _responseDispatchQueue = responseDispatchQueue; + _dispatchQueue = dispatchQueue; _startHook = startHook; _writeDataHook = writeDataHook; _finishHook = finishHook; @@ -192,8 +183,7 @@ initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { return [[HookInterceptor alloc] initWithInterceptorManager:interceptorManager - requestDispatchQueue:_requestDispatchQueue - responseDispatchQueue:_responseDispatchQueue + dispatchQueue:_dispatchQueue startHook:_startHook writeDataHook:_writeDataHook finishHook:_finishHook @@ -218,22 +208,16 @@ initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue GRPCInterceptorManager *manager); void (^_didWriteDataHook)(GRPCInterceptorManager *manager); GRPCInterceptorManager *_manager; - dispatch_queue_t _requestDispatchQueue; - dispatch_queue_t _responseDispatchQueue; -} - -- (dispatch_queue_t)requestDispatchQueue { - return _requestDispatchQueue; + dispatch_queue_t _dispatchQueue; } - (dispatch_queue_t)dispatchQueue { - return _responseDispatchQueue; + return _dispatchQueue; } - (instancetype) initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue +dispatchQueue:(dispatch_queue_t)dispatchQueue startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook @@ -248,8 +232,7 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager GRPCInterceptorManager *manager))responseCloseHook didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { if ((self = [super initWithInterceptorManager:interceptorManager - requestDispatchQueue:requestDispatchQueue - responseDispatchQueue:responseDispatchQueue])) { + dispatchQueue:dispatchQueue])) { _startHook = startHook; _writeDataHook = writeDataHook; _finishHook = finishHook; @@ -258,8 +241,7 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager _responseDataHook = responseDataHook; _responseCloseHook = responseCloseHook; _didWriteDataHook = didWriteDataHook; - _requestDispatchQueue = requestDispatchQueue; - _responseDispatchQueue = responseDispatchQueue; + _dispatchQueue = dispatchQueue; _manager = interceptorManager; } return self; @@ -320,8 +302,7 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager @property BOOL enabled; -- (instancetype)initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue; +- (instancetype)initWithDispatchQueue:(dispatch_queue_t)dispatchQueue; - (void)setStartHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook @@ -340,11 +321,9 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager @implementation GlobalInterceptorFactory -- (instancetype)initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue { +- (instancetype)initWithDispatchQueue:(dispatch_queue_t)dispatchQueue { _enabled = NO; - return [super initWithRequestDispatchQueue:requestDispatchQueue - responseDispatchQueue:responseDispatchQueue + return [super initWithDispatchQueue:dispatchQueue startHook:nil writeDataHook:nil finishHook:nil @@ -358,8 +337,7 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { if (_enabled) { return [[HookInterceptor alloc] initWithInterceptorManager:interceptorManager - requestDispatchQueue:_requestDispatchQueue - responseDispatchQueue:_responseDispatchQueue + dispatchQueue:_dispatchQueue startHook:_startHook writeDataHook:_writeDataHook finishHook:_finishHook @@ -417,10 +395,15 @@ static dispatch_once_t initGlobalInterceptorFactory; return 0; } +// For backwards compatibility + (GRPCTransportType)transportType { return GRPCTransportTypeChttp2BoringSSL; } ++ (GRPCTransportId)transport { + return NULL; +} + + (NSString *)PEMRootCertificates { return nil; } @@ -434,21 +417,10 @@ static dispatch_once_t initGlobalInterceptorFactory; } + (void)setUp { -#ifdef GRPC_COMPILE_WITH_CRONET - configureCronet(); - if ([self useCronet]) { - [GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]]; - } -#endif -#ifdef GRPC_CFSTREAM - setenv(kCFStreamVarName, "1", 1); -#endif - dispatch_once(&initGlobalInterceptorFactory, ^{ dispatch_queue_t globalInterceptorQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); globalInterceptorFactory = - [[GlobalInterceptorFactory alloc] initWithRequestDispatchQueue:globalInterceptorQueue - responseDispatchQueue:globalInterceptorQueue]; + [[GlobalInterceptorFactory alloc] initWithDispatchQueue:globalInterceptorQueue]; [GRPCCall2 registerGlobalInterceptor:globalInterceptorFactory]; }); } @@ -494,7 +466,9 @@ static dispatch_once_t initGlobalInterceptorFactory; GPBEmpty *request = [GPBEmpty message]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -523,7 +497,9 @@ static dispatch_once_t initGlobalInterceptorFactory; GPBEmpty *request = [GPBEmpty message]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -600,7 +576,9 @@ static dispatch_once_t initGlobalInterceptorFactory; request.payload.body = [NSMutableData dataWithLength:271828]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -648,7 +626,9 @@ static dispatch_once_t initGlobalInterceptorFactory; request.responseStatus.code = GRPC_STATUS_CANCELLED; } GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -950,7 +930,9 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -1002,7 +984,9 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.flowControlEnabled = YES; @@ -1159,7 +1143,9 @@ static dispatch_once_t initGlobalInterceptorFactory; __block BOOL receivedResponse = NO; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = self.class.transportType; + options.transport = [[self class] transport]; options.PEMRootCertificates = self.class.PEMRootCertificates; options.hostNameOverride = [[self class] hostNameOverride]; @@ -1192,7 +1178,9 @@ static dispatch_once_t initGlobalInterceptorFactory; [self expectationWithDescription:@"Call completed."]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = self.class.transportType; + options.transport = [[self class] transport]; options.PEMRootCertificates = self.class.PEMRootCertificates; options.hostNameOverride = [[self class] hostNameOverride]; @@ -1278,48 +1266,43 @@ static dispatch_once_t initGlobalInterceptorFactory; [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil]; } -#ifndef GRPC_COMPILE_WITH_CRONET -- (void)testKeepalive { +- (void)testKeepaliveWithV2API { XCTAssertNotNil([[self class] host]); __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Keepalive"]; - [GRPCCall setKeepaliveWithInterval:1500 timeout:0 forHost:[[self class] host]]; - NSArray *requests = @[ @27182, @8 ]; - NSArray *responses = @[ @31415, @9 ]; + NSNumber *kRequestSize = @27182; + NSNumber *kResponseSize = @31415; - GRXBufferedPipe *requestsBuffer = [[GRXBufferedPipe alloc] init]; - - __block int index = 0; - - id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] - requestedResponseSize:responses[index]]; - [requestsBuffer writeValue:request]; + id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:kRequestSize + requestedResponseSize:kResponseSize]; + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; + options.PEMRootCertificates = [[self class] PEMRootCertificates]; + options.hostNameOverride = [[self class] hostNameOverride]; + options.keepaliveInterval = 1.5; + options.keepaliveTimeout = 0; - [_service - fullDuplexCallWithRequestsWriter:requestsBuffer - eventHandler:^(BOOL done, RMTStreamingOutputCallResponse *response, - NSError *error) { - if (index == 0) { - XCTAssertNil(error, @"Finished with unexpected error: %@", error); - XCTAssertTrue(response, @"Event handler called without an event."); - XCTAssertFalse(done); - index++; - } else { - // Keepalive should kick after 1s elapsed and fails the call. - XCTAssertNotNil(error); - XCTAssertEqual(error.code, GRPC_STATUS_UNAVAILABLE); - XCTAssertEqualObjects( - error.localizedDescription, @"keepalive watchdog timeout", - @"Unexpected failure that is not keepalive watchdog timeout."); - XCTAssertTrue(done); - [expectation fulfill]; - } - }]; + __block GRPCStreamingProtoCall *call = [_service + fullDuplexCallWithResponseHandler:[[InteropTestsBlockCallbacks alloc] + initWithInitialMetadataCallback:nil + messageCallback:nil + closeCallback:^(NSDictionary *trailingMetadata, + NSError *error) { + XCTAssertNotNil(error); + XCTAssertEqual(error.code, GRPC_STATUS_UNAVAILABLE, + @"Received status %ld instead of UNAVAILABLE (14).", + error.code); + [expectation fulfill]; + }] + callOptions:options]; + [call writeMessage:request]; + [call start]; [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil]; + [call finish]; } -#endif - (void)testDefaultInterceptor { XCTAssertNotNil([[self class] host]); @@ -1334,7 +1317,9 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.interceptorFactories = @[ [[DefaultInterceptorFactory alloc] init] ]; @@ -1389,8 +1374,7 @@ static dispatch_once_t initGlobalInterceptorFactory; __block NSUInteger responseCloseCount = 0; __block NSUInteger didWriteDataCount = 0; id factory = [[HookInterceptorFactory alloc] - initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) - responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager) { startCount++; @@ -1438,7 +1422,9 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.flowControlEnabled = YES; @@ -1516,8 +1502,7 @@ static dispatch_once_t initGlobalInterceptorFactory; __block NSUInteger responseDataCount = 0; __block NSUInteger responseCloseCount = 0; id factory = [[HookInterceptorFactory alloc] - initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) - responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager) { startCount++; @@ -1544,6 +1529,7 @@ static dispatch_once_t initGlobalInterceptorFactory; // finish must happen after the hijacking, so directly reply with a close [manager forwardPreviousInterceptorCloseWithTrailingMetadata:@{@"grpc-status" : @"0"} error:nil]; + [manager shutDown]; } receiveNextMessagesHook:nil responseHeaderHook:^(NSDictionary *initialMetadata, GRPCInterceptorManager *manager) { @@ -1563,14 +1549,16 @@ static dispatch_once_t initGlobalInterceptorFactory; XCTAssertEqual(error.code, GRPC_STATUS_CANCELLED); [expectCallInternalComplete fulfill]; } - didWriteDataHook:nil]; + didWriteDataHook:nil]; NSArray *requests = @[ @1, @2, @3, @4 ]; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.interceptorFactories = @[ [[DefaultInterceptorFactory alloc] init], factory ]; @@ -1679,7 +1667,9 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.flowControlEnabled = YES; @@ -1734,8 +1724,7 @@ static dispatch_once_t initGlobalInterceptorFactory; - (void)testConflictingGlobalInterceptors { id factory = [[HookInterceptorFactory alloc] - initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) - responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) startHook:nil writeDataHook:nil finishHook:nil @@ -1767,8 +1756,7 @@ static dispatch_once_t initGlobalInterceptorFactory; __block NSUInteger didWriteDataCount = 0; id factory = [[HookInterceptorFactory alloc] - initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) - responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager) { startCount++; @@ -1864,7 +1852,9 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.flowControlEnabled = YES; diff --git a/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m b/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m index a9c69183332..c8d21199454 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m +++ b/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m @@ -18,6 +18,7 @@ #import #import +#import #import "InteropTests.h" @@ -60,8 +61,8 @@ static int32_t kLocalInteropServerOverhead = 10; [GRPCCall useInsecureConnectionsForHost:kLocalCleartextHost]; } -+ (GRPCTransportType)transportType { - return GRPCTransportTypeInsecure; ++ (GRPCTransportId)transport { + return GRPCTransportImplList.core_insecure; } @end diff --git a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m index e8222f602f4..d28513cc673 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m +++ b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m @@ -18,6 +18,7 @@ #import #import +#import #import "InteropTests.h" // The server address is derived from preprocessor macro, which is @@ -57,7 +58,11 @@ static int32_t kLocalInteropServerOverhead = 10; } + (GRPCTransportType)transportType { - return GRPCTransportTypeChttp2BoringSSL; + return GRPCTransportTypeDefault; +} + ++ (GRPCTransportId)transport { + return GRPCTransportImplList.core_secure; } - (void)setUp { diff --git a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m index 14ba2871aa2..fef9f2e7ddd 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m +++ b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m @@ -18,9 +18,7 @@ #import -#ifdef GRPC_COMPILE_WITH_CRONET #import -#endif #import #import #import diff --git a/src/objective-c/tests/InteropTests/InteropTestsRemote.m b/src/objective-c/tests/InteropTests/InteropTestsRemote.m index c1cd9b81efc..2dd8f0aed89 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsRemote.m +++ b/src/objective-c/tests/InteropTests/InteropTestsRemote.m @@ -53,14 +53,8 @@ static int32_t kRemoteInteropServerOverhead = 12; return kRemoteInteropServerOverhead; // bytes } -#ifdef GRPC_COMPILE_WITH_CRONET -+ (GRPCTransportType)transportType { - return GRPCTransportTypeCronet; -} -#else + (GRPCTransportType)transportType { return GRPCTransportTypeChttp2BoringSSL; } -#endif @end diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index 60d2a98fba2..4a821df85dc 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -50,13 +50,13 @@ end pod 'BoringSSL-GRPC', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true - pod 'gRPC', :path => GRPC_LOCAL_SRC + pod 'gRPC/GRPCCoreCronet', :path => GRPC_LOCAL_SRC pod 'gRPC-Core', :path => GRPC_LOCAL_SRC pod 'gRPC-RxLibrary', :path => GRPC_LOCAL_SRC pod 'gRPC-ProtoRPC', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true pod 'RemoteTest', :path => "RemoteTestClient", :inhibit_warnings => true - pod 'gRPC-Core/Cronet-Implementation', :path => GRPC_LOCAL_SRC + # pod 'gRPC-Core/Cronet-Implementation', :path => GRPC_LOCAL_SRC pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c" pod 'gRPC-Core/Tests', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true end diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 737d52b547d..a37b2a75d5f 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -630,7 +630,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC.default-GRPCCoreCronet/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( @@ -728,7 +728,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC.default-GRPCCoreCronet/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( diff --git a/src/objective-c/tests/UnitTests/ChannelPoolTest.m b/src/objective-c/tests/UnitTests/ChannelPoolTest.m index eab8c5193fb..0b1eca389b9 100644 --- a/src/objective-c/tests/UnitTests/ChannelPoolTest.m +++ b/src/objective-c/tests/UnitTests/ChannelPoolTest.m @@ -18,9 +18,9 @@ #import -#import "../../GRPCClient/private/GRPCChannel.h" -#import "../../GRPCClient/private/GRPCChannelPool+Test.h" -#import "../../GRPCClient/private/GRPCCompletionQueue.h" +#import "../../GRPCClient/private/GRPCCore/GRPCChannel.h" +#import "../../GRPCClient/private/GRPCCore/GRPCChannelPool+Test.h" +#import "../../GRPCClient/private/GRPCCore/GRPCCompletionQueue.h" #define TEST_TIMEOUT 32 diff --git a/src/objective-c/tests/UnitTests/ChannelTests.m b/src/objective-c/tests/UnitTests/ChannelTests.m index df78e8b1162..1ed0f16ecaf 100644 --- a/src/objective-c/tests/UnitTests/ChannelTests.m +++ b/src/objective-c/tests/UnitTests/ChannelTests.m @@ -19,11 +19,11 @@ #import #import "../../GRPCClient/GRPCCallOptions.h" -#import "../../GRPCClient/private/GRPCChannel.h" -#import "../../GRPCClient/private/GRPCChannelPool+Test.h" -#import "../../GRPCClient/private/GRPCChannelPool.h" -#import "../../GRPCClient/private/GRPCCompletionQueue.h" -#import "../../GRPCClient/private/GRPCWrappedCall.h" +#import "../../GRPCClient/private/GRPCCore/GRPCChannel.h" +#import "../../GRPCClient/private/GRPCCore/GRPCChannelPool+Test.h" +#import "../../GRPCClient/private/GRPCCore/GRPCChannelPool.h" +#import "../../GRPCClient/private/GRPCCore/GRPCCompletionQueue.h" +#import "../../GRPCClient/private/GRPCCore/GRPCWrappedCall.h" static NSString *kDummyHost = @"dummy.host"; static NSString *kDummyPath = @"/dummy/path"; diff --git a/src/objective-c/tests/UnitTests/NSErrorUnitTests.m b/src/objective-c/tests/UnitTests/NSErrorUnitTests.m index 8a4f03a4460..74e5794c480 100644 --- a/src/objective-c/tests/UnitTests/NSErrorUnitTests.m +++ b/src/objective-c/tests/UnitTests/NSErrorUnitTests.m @@ -20,7 +20,7 @@ #import -#import "../../GRPCClient/private/NSError+GRPC.h" +#import "../../GRPCClient/private/GRPCCore/NSError+GRPC.h" @interface NSErrorUnitTests : XCTestCase diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index c9723933fcd..fa4d7608c26 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -42,10 +42,8 @@ s.module_name = name s.header_dir = name - src_dir = 'src/objective-c/GRPCClient' - s.dependency 'gRPC-RxLibrary', version - s.default_subspec = 'Main' + s.default_subspec = 'Interface', 'GRPCCore' # Certificates, to be able to establish TLS connections: s.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } @@ -56,29 +54,75 @@ 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } - s.subspec 'Main' do |ss| - ss.header_mappings_dir = "#{src_dir}" + s.subspec 'Interface' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' + + ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall.h', + 'src/objective-c/GRPCClient/GRPCCall+Interceptor.h', + 'src/objective-c/GRPCClient/GRPCCallOptions.h', + 'src/objective-c/GRPCClient/GRPCInterceptor.h', + 'src/objective-c/GRPCClient/GRPCTransport.h', + 'src/objective-c/GRPCClient/GRPCDispatchable.h', + 'src/objective-c/GRPCClient/internal/*.h' + + ss.source_files = 'src/objective-c/GRPCClient/GRPCCall.h', + 'src/objective-c/GRPCClient/GRPCCall.m', + 'src/objective-c/GRPCClient/GRPCCall+Interceptor.h', + 'src/objective-c/GRPCClient/GRPCCall+Interceptor.m', + 'src/objective-c/GRPCClient/GRPCCallOptions.h', + 'src/objective-c/GRPCClient/GRPCCallOptions.m', + 'src/objective-c/GRPCClient/GRPCDispatchable.h', + 'src/objective-c/GRPCClient/GRPCInterceptor.h', + 'src/objective-c/GRPCClient/GRPCInterceptor.m', + 'src/objective-c/GRPCClient/GRPCTransport.h', + 'src/objective-c/GRPCClient/GRPCTransport.m', + 'src/objective-c/GRPCClient/private/GRPCTransport+Private.h', + 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m' + end - ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" - ss.exclude_files = "#{src_dir}/GRPCCall+GID.{h,m}" - ss.private_header_files = "#{src_dir}/private/*.h", "#{src_dir}/internal/*.h" + s.subspec 'GRPCCore' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' + + ss.public_header_files = 'src/objective-c/GRPCClient/ChannelArg.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', + 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', + 'src/objective-c/GRPCClient/GRPCCall+Tests.h', + 'src/objective-c/GRPCClient/GRPCCallLegacy.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', + 'src/objective-c/GRPCClient/internal_testing/*.h' + ss.private_header_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.h' + ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.h', + 'src/objective-c/GRPCClient/private/GRPCCore/*.{h,m}', + 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.m', + 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', + 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', + 'src/objective-c/GRPCClient/GRPCCall+OAuth2.m', + 'src/objective-c/GRPCClient/GRPCCall+Tests.h', + 'src/objective-c/GRPCClient/GRPCCall+Tests.m', + 'src/objective-c/GRPCClient/GRPCCallLegacy.h', + 'src/objective-c/GRPCClient/GRPCCallLegacy.m' ss.dependency 'gRPC-Core', version + ss.dependency "#{s.name}/Interface", version end - # CFStream is now default. Leaving this subspec only for compatibility purpose. - s.subspec 'CFStream' do |ss| - ss.dependency "#{s.name}/Main", version - end - - s.subspec 'GID' do |ss| - ss.ios.deployment_target = '7.0' - - ss.header_mappings_dir = "#{src_dir}" + s.subspec 'GRPCCoreCronet' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' - ss.source_files = "#{src_dir}/GRPCCall+GID.{h,m}" + ss.source_files = 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', + 'src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/*.{h,m}' + ss.dependency 'CronetFramework' + ss.dependency 'gRPC-Core/Cronet-Implementation', version + end - ss.dependency "#{s.name}/Main", version - ss.dependency 'Google/SignIn' + # CFStream is now default. Leaving this subspec only for compatibility purpose. + s.subspec 'CFStream' do |ss| + ss.dependency "#{s.name}/GRPCCore", version end end From 640966dbf397b26a763d1b445a522d6fa3d59eca Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 22 Jul 2019 10:03:08 -0700 Subject: [PATCH 074/661] fix internal testing targets --- gRPC.podspec | 2 +- src/objective-c/tests/Podfile | 2 +- templates/gRPC.podspec.template | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gRPC.podspec b/gRPC.podspec index 815da6ef7c1..b2d7b910042 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -90,7 +90,7 @@ Pod::Spec.new do |s| 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', 'src/objective-c/GRPCClient/internal_testing/*.h' ss.private_header_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.h' - ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.h', + ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.{h,m}', 'src/objective-c/GRPCClient/private/GRPCCore/*.{h,m}', 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.m', diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index 4a821df85dc..20a68f7bf67 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -116,7 +116,7 @@ post_install do |installer| # the test target 'InteropTestsRemoteWithCronet' # Activate GRPCCall+InternalTests functions for the dedicated build configuration 'Test', which will # be used by all test targets using it. - if /gRPC-(mac|i)OS/.match(target.name) + if /gRPC(-macOS|-iOS|\.)/.match(target.name) target.build_configurations.each do |config| if config.name == 'Cronet' config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_COMPILE_WITH_CRONET=1 GRPC_TEST_OBJC=1' diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index fa4d7608c26..2ba7089c717 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -92,7 +92,7 @@ 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', 'src/objective-c/GRPCClient/internal_testing/*.h' ss.private_header_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.h' - ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.h', + ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.{h,m}', 'src/objective-c/GRPCClient/private/GRPCCore/*.{h,m}', 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.m', From 8278d3e6a5e4181d56b5b90f3cea343065548d49 Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Mon, 22 Jul 2019 17:24:09 -0700 Subject: [PATCH 075/661] Resolving comments --- test/cpp/microbenchmarks/bm_threadpool.cc | 61 ++++++++++++----------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_threadpool.cc b/test/cpp/microbenchmarks/bm_threadpool.cc index cee0fa4c497..128f3c2d63d 100644 --- a/test/cpp/microbenchmarks/bm_threadpool.cc +++ b/test/cpp/microbenchmarks/bm_threadpool.cc @@ -30,9 +30,9 @@ namespace grpc { namespace testing { // This helper class allows a thread to block for a pre-specified number of -// actions. BlockingCounter has an initial non-negative count on initialization +// actions. BlockingCounter has an initial non-negative count on initialization. // Each call to DecrementCount will decrease the count by 1. When making a call -// to Wait, if the count is greater than 0, the thread will be block, until +// to Wait, if the count is greater than 0, the thread will be blocked, until // the count reaches 0. class BlockingCounter { public: @@ -81,7 +81,7 @@ class AddAnotherFunctor : public grpc_experimental_completion_queue_functor { } else { callback->counter_->DecrementCount(); } - // Suicide + // Suicides. delete callback; } @@ -93,9 +93,9 @@ class AddAnotherFunctor : public grpc_experimental_completion_queue_functor { void ThreadPoolAddAnotherHelper(benchmark::State& state, int concurrent_functor) { - const int num_threads = state.range(1); const int num_iterations = state.range(0); - // number of adds done by each closure + const int num_threads = state.range(1); + // Number of adds done by each closure. const int num_add = num_iterations / concurrent_functor; grpc_core::ThreadPool pool(num_threads); while (state.KeepRunningBatch(num_iterations)) { @@ -111,7 +111,8 @@ void ThreadPoolAddAnotherHelper(benchmark::State& state, static void BM_ThreadPool1AddAnother(benchmark::State& state) { ThreadPoolAddAnotherHelper(state, 1); } -// first pair is range for batch_size, second pair is range for thread pool size +// First pair is range for number of iterations (num_iterations). +// Second pair is range for thread pool size (num_threads). BENCHMARK(BM_ThreadPool1AddAnother)->RangePair(524288, 524288, 1, 1024); static void BM_ThreadPool4AddAnother(benchmark::State& state) { @@ -177,12 +178,12 @@ class SuicideFunctorForAdd : public grpc_experimental_completion_queue_functor { // Performs the scenario of external thread(s) adding closures into pool. static void BM_ThreadPoolExternalAdd(benchmark::State& state) { static grpc_core::ThreadPool* external_add_pool = nullptr; - // Setup for each run of test + // Setup for each run of test. if (state.thread_index == 0) { const int num_threads = state.range(1); - external_add_pool = new grpc_core::ThreadPool(num_threads); + external_add_pool = grpc_core::New(num_threads); } - const int num_iterations = state.range(0); + const int num_iterations = state.range(0) / state.threads; while (state.KeepRunningBatch(num_iterations)) { BlockingCounter counter(num_iterations); for (int i = 0; i < num_iterations; ++i) { @@ -190,15 +191,17 @@ static void BM_ThreadPoolExternalAdd(benchmark::State& state) { } counter.Wait(); } - state.SetItemsProcessed(num_iterations); - // Teardown at the end of each test run + // Teardown at the end of each test run. if (state.thread_index == 0) { - Delete(external_add_pool); + state.SetItemsProcessed(state.range(0)); + grpc_core::Delete(external_add_pool); } } BENCHMARK(BM_ThreadPoolExternalAdd) - ->RangePair(524288, 524288, 1, 1024) // ThreadPool size + // First pair is range for number of iterations (num_iterations). + // Second pair is range for thread pool size (num_threads). + ->RangePair(524288, 524288, 1, 1024) ->ThreadRange(1, 256); // Concurrent external thread(s) up to 256 // Functor (closure) that adds itself into pool repeatedly. By adding self, the @@ -222,7 +225,7 @@ class AddSelfFunctor : public grpc_experimental_completion_queue_functor { callback->pool_->Add(cb); } else { callback->counter_->DecrementCount(); - // Suicide + // Suicides. delete callback; } } @@ -234,12 +237,12 @@ class AddSelfFunctor : public grpc_experimental_completion_queue_functor { }; static void BM_ThreadPoolAddSelf(benchmark::State& state) { - const int num_threads = state.range(0); - const int kNumIteration = 524288; + const int num_iterations = state.range(0); + const int num_threads = state.range(1); int concurrent_functor = num_threads; - int num_add = kNumIteration / concurrent_functor; + int num_add = num_iterations / concurrent_functor; grpc_core::ThreadPool pool(num_threads); - while (state.KeepRunningBatch(kNumIteration)) { + while (state.KeepRunningBatch(num_iterations)) { BlockingCounter counter(concurrent_functor); for (int i = 0; i < concurrent_functor; ++i) { pool.Add(new AddSelfFunctor(&pool, &counter, num_add)); @@ -248,25 +251,26 @@ static void BM_ThreadPoolAddSelf(benchmark::State& state) { } state.SetItemsProcessed(state.iterations()); } - -BENCHMARK(BM_ThreadPoolAddSelf)->Range(1, 1024); +// First pair is range for number of iterations (num_iterations). +// Second pair is range for thread pool size (num_threads). +BENCHMARK(BM_ThreadPoolAddSelf)->RangePair(524288, 524288, 1, 1024); #if defined(__GNUC__) && !defined(SWIG) #if defined(__i386__) || defined(__x86_64__) -#define ABSL_CACHELINE_SIZE 64 +#define CACHELINE_SIZE 64 #elif defined(__powerpc64__) -#define ABSL_CACHELINE_SIZE 128 +#define CACHELINE_SIZE 128 #elif defined(__aarch64__) -#define ABSL_CACHELINE_SIZE 64 +#define CACHELINE_SIZE 64 #elif defined(__arm__) #if defined(__ARM_ARCH_5T__) -#define ABSL_CACHELINE_SIZE 32 +#define CACHELINE_SIZE 32 #elif defined(__ARM_ARCH_7A__) -#define ABSL_CACHELINE_SIZE 64 +#define CACHELINE_SIZE 64 #endif #endif -#ifndef ABSL_CACHELINE_SIZE -#define ABSL_CACHELINE_SIZE 64 +#ifndef CACHELINE_SIZE +#define CACHELINE_SIZE 64 #endif #endif @@ -286,6 +290,7 @@ class ShortWorkFunctorForAdd ~ShortWorkFunctorForAdd() {} static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { auto* callback = static_cast(cb); + // Uses pad to avoid compiler complaining unused variable error. callback->pad[0] = 0; for (int i = 0; i < 1000; ++i) { callback->val_++; @@ -294,7 +299,7 @@ class ShortWorkFunctorForAdd } private: - char pad[ABSL_CACHELINE_SIZE]; + char pad[CACHELINE_SIZE]; volatile int val_; }; From b82d5ecc5ad524335f3eb47f231bb0277d0e9a37 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Mon, 22 Jul 2019 17:52:12 -0700 Subject: [PATCH 076/661] Removed space from dir name to fix clang_format_code --- gRPC-Core.podspec | 2 +- src/core/lib/gpr/env_linux.cc | 31 ++++++------------- src/core/lib/gpr/env_posix.cc | 5 --- src/core/lib/iomgr/combiner.cc | 8 ++--- src/core/lib/surface/completion_queue.cc | 24 +++++++++----- src/core/lib/surface/server.cc | 2 ++ .../Circular.imageset/Contents.json | 0 .../Contents.json | 0 .../Extra Large.imageset/Contents.json | 0 .../Graphic Bezel.imageset/Contents.json | 0 .../Graphic Circular.imageset/Contents.json | 0 .../Graphic Corner.imageset/Contents.json | 0 .../Contents.json | 0 .../Modular.imageset/Contents.json | 0 .../Utilitarian.imageset/Contents.json | 0 .../Assets.xcassets/Contents.json | 0 .../ExtensionDelegate.h | 0 .../ExtensionDelegate.m | 0 .../Info.plist | 0 .../InterfaceController.h | 0 .../InterfaceController.m | 0 .../watchOS-sample.xcodeproj/project.pbxproj | 10 +++--- templates/gRPC-Core.podspec.template | 2 +- templates/gRPC-ProtoRPC.podspec.template | 1 + ...!ProtoCompiler-gRPCPlugin.podspec.template | 1 + .../BoringSSL-GRPC.podspec.template | 1 + 26 files changed, 43 insertions(+), 44 deletions(-) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/Assets.xcassets/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/ExtensionDelegate.h (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/ExtensionDelegate.m (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/Info.plist (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/InterfaceController.h (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit Extension => watchOS-sample-WatchKit-Extension}/InterfaceController.m (100%) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 0d4f8e4f0d3..9583f7f0740 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' s.watchos.deployment_target = '4.0' - + s.requires_arc = false name = 'grpc' diff --git a/src/core/lib/gpr/env_linux.cc b/src/core/lib/gpr/env_linux.cc index 3a3aa541672..6a78dc14155 100644 --- a/src/core/lib/gpr/env_linux.cc +++ b/src/core/lib/gpr/env_linux.cc @@ -38,19 +38,20 @@ #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" -static const char* gpr_getenv_silent(const char* name, char** dst) { - const char* insecure_func_used = nullptr; +char* gpr_getenv(const char* name) { char* result = nullptr; #if defined(GPR_BACKWARDS_COMPATIBILITY_MODE) typedef char* (*getenv_type)(const char*); - static getenv_type getenv_func = NULL; + static getenv_type getenv_func = nullptr; /* Check to see which getenv variant is supported (go from most * to least secure) */ - const char* names[] = {"secure_getenv", "__secure_getenv", "getenv"}; - for (size_t i = 0; getenv_func == NULL && i < GPR_ARRAY_SIZE(names); i++) { - getenv_func = (getenv_type)dlsym(RTLD_DEFAULT, names[i]); - if (getenv_func != NULL && strstr(names[i], "secure") == NULL) { - insecure_func_used = names[i]; + if (getenv_func == nullptr) { + const char* names[] = {"secure_getenv", "__secure_getenv", "getenv"}; + for (size_t i = 0; i < GPR_ARRAY_SIZE(names); i++) { + getenv_func = (getenv_type)dlsym(RTLD_DEFAULT, names[i]); + if (getenv_func != nullptr) { + break; + } } } result = getenv_func(name); @@ -58,20 +59,8 @@ static const char* gpr_getenv_silent(const char* name, char** dst) { result = secure_getenv(name); #else result = getenv(name); - insecure_func_used = "getenv"; #endif - *dst = result == nullptr ? result : gpr_strdup(result); - return insecure_func_used; -} - -char* gpr_getenv(const char* name) { - char* result = nullptr; - const char* insecure_func_used = gpr_getenv_silent(name, &result); - if (insecure_func_used != nullptr) { - gpr_log(GPR_DEBUG, "Warning: insecure environment read function '%s' used", - insecure_func_used); - } - return result; + return result == nullptr ? result : gpr_strdup(result); } void gpr_setenv(const char* name, const char* value) { diff --git a/src/core/lib/gpr/env_posix.cc b/src/core/lib/gpr/env_posix.cc index 30ddc50f682..232095b4e22 100644 --- a/src/core/lib/gpr/env_posix.cc +++ b/src/core/lib/gpr/env_posix.cc @@ -29,11 +29,6 @@ #include #include "src/core/lib/gpr/string.h" -const char* gpr_getenv_silent(const char* name, char** dst) { - *dst = gpr_getenv(name); - return nullptr; -} - char* gpr_getenv(const char* name) { char* result = getenv(name); return result == nullptr ? result : gpr_strdup(result); diff --git a/src/core/lib/iomgr/combiner.cc b/src/core/lib/iomgr/combiner.cc index 4fc4a9dccf4..9a6290f29a8 100644 --- a/src/core/lib/iomgr/combiner.cc +++ b/src/core/lib/iomgr/combiner.cc @@ -233,11 +233,11 @@ bool grpc_combiner_continue_exec_ctx() { // offload only if all the following conditions are true: // 1. the combiner is contended and has more than one closure to execute // 2. the current execution context needs to finish as soon as possible - // 3. the DEFAULT executor is threaded - // 4. the current thread is not a worker for any background poller + // 3. the current thread is not a worker for any background poller + // 4. the DEFAULT executor is threaded if (contended && grpc_core::ExecCtx::Get()->IsReadyToFinish() && - grpc_core::Executor::IsThreadedDefault() && - !grpc_iomgr_is_any_background_poller_thread()) { + !grpc_iomgr_is_any_background_poller_thread() && + grpc_core::Executor::IsThreadedDefault()) { GPR_TIMER_MARK("offload_from_finished_exec_ctx", 0); // this execution context wants to move on: schedule remaining work to be // picked up on the executor diff --git a/src/core/lib/surface/completion_queue.cc b/src/core/lib/surface/completion_queue.cc index 60a7d78b525..82f87e769bf 100644 --- a/src/core/lib/surface/completion_queue.cc +++ b/src/core/lib/surface/completion_queue.cc @@ -857,17 +857,20 @@ static void cq_end_op_for_callback( } auto* functor = static_cast(tag); - if (internal) { + if (internal || grpc_iomgr_is_any_background_poller_thread()) { grpc_core::ApplicationCallbackExecCtx::Enqueue(functor, (error == GRPC_ERROR_NONE)); GRPC_ERROR_UNREF(error); - } else { - GRPC_CLOSURE_SCHED( - GRPC_CLOSURE_CREATE( - functor_callback, functor, - grpc_core::Executor::Scheduler(grpc_core::ExecutorJobType::SHORT)), - error); + return; } + + // Schedule the callback on a closure if not internal or triggered + // from a background poller thread. + GRPC_CLOSURE_SCHED( + GRPC_CLOSURE_CREATE( + functor_callback, functor, + grpc_core::Executor::Scheduler(grpc_core::ExecutorJobType::SHORT)), + error); } void grpc_cq_end_op(grpc_completion_queue* cq, void* tag, grpc_error* error, @@ -1352,6 +1355,13 @@ static void cq_finish_shutdown_callback(grpc_completion_queue* cq) { GPR_ASSERT(cqd->shutdown_called); cq->poller_vtable->shutdown(POLLSET_FROM_CQ(cq), &cq->pollset_shutdown_done); + if (grpc_iomgr_is_any_background_poller_thread()) { + grpc_core::ApplicationCallbackExecCtx::Enqueue(callback, true); + return; + } + + // Schedule the callback on a closure if not internal or triggered + // from a background poller thread. GRPC_CLOSURE_SCHED( GRPC_CLOSURE_CREATE( functor_callback, callback, diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index a1c7d132ade..7fe05c10a54 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -711,8 +711,10 @@ static void maybe_finish_shutdown(grpc_server* server) { return; } + gpr_mu_lock(&server->mu_call); kill_pending_work_locked( server, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown")); + gpr_mu_unlock(&server->mu_call); if (server->root_channel_data.next != &server->root_channel_data || server->listeners_destroyed < num_listeners(server)) { diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Contents.json rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Assets.xcassets/Contents.json rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.h b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.h similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.h rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.h diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.m b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.m similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/ExtensionDelegate.m rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.m diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Info.plist b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Info.plist similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/Info.plist rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Info.plist diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.h b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.h similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.h rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.h diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.m b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.m similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit Extension/InterfaceController.m rename to src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.m diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj index 12e7f29b7a0..191bde5d9e0 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj @@ -148,7 +148,7 @@ children = ( ABB17D5622D93BAB00C26D6E /* watchOS-sample */, ABB17D6E22D93BAC00C26D6E /* watchOS-sample WatchKit App */, - ABB17D7D22D93BAC00C26D6E /* watchOS-sample WatchKit Extension */, + ABB17D7D22D93BAC00C26D6E /* watchOS-sample-WatchKit-Extension */, ABB17D5522D93BAB00C26D6E /* Products */, 2C4A0708747AAA7298F757DA /* Pods */, 589283F4A582EEF2434E0220 /* Frameworks */, @@ -191,7 +191,7 @@ path = "watchOS-sample WatchKit App"; sourceTree = ""; }; - ABB17D7D22D93BAC00C26D6E /* watchOS-sample WatchKit Extension */ = { + ABB17D7D22D93BAC00C26D6E /* watchOS-sample-WatchKit-Extension */ = { isa = PBXGroup; children = ( ABB17D7E22D93BAC00C26D6E /* InterfaceController.h */, @@ -201,7 +201,7 @@ ABB17D8422D93BAD00C26D6E /* Assets.xcassets */, ABB17D8622D93BAD00C26D6E /* Info.plist */, ); - path = "watchOS-sample WatchKit Extension"; + path = "watchOS-sample-WatchKit-Extension"; sourceTree = ""; }; /* End PBXGroup section */ @@ -598,7 +598,7 @@ ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; - INFOPLIST_FILE = "watchOS-sample WatchKit Extension/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/watchOS-sample-WatchKit-Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -620,7 +620,7 @@ ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; - INFOPLIST_FILE = "watchOS-sample WatchKit Extension/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/watchOS-sample-WatchKit-Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 43645edf2e4..b838e86413a 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -94,7 +94,7 @@ s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' - s.watchos.deployment_target = '4.0' + s.watchos.deployment_target = '4.0' s.requires_arc = false diff --git a/templates/gRPC-ProtoRPC.podspec.template b/templates/gRPC-ProtoRPC.podspec.template index e4d5f3ffd3d..457d2988036 100644 --- a/templates/gRPC-ProtoRPC.podspec.template +++ b/templates/gRPC-ProtoRPC.podspec.template @@ -38,6 +38,7 @@ s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' name = 'ProtoRPC' s.module_name = name diff --git a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template index b2335ac8a9e..f612bd56cff 100644 --- a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template +++ b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template @@ -108,6 +108,7 @@ s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' # Restrict the gRPC runtime version to the one supported by this plugin. s.dependency 'gRPC-ProtoRPC', v diff --git a/templates/src/objective-c/BoringSSL-GRPC.podspec.template b/templates/src/objective-c/BoringSSL-GRPC.podspec.template index 408970e25e3..3d2736e3307 100644 --- a/templates/src/objective-c/BoringSSL-GRPC.podspec.template +++ b/templates/src/objective-c/BoringSSL-GRPC.podspec.template @@ -87,6 +87,7 @@ s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.7' s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' name = 'openssl_grpc' From 9242fe122d2eaec7c7e4486799c1215a1fe479e2 Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Tue, 23 Jul 2019 09:47:26 -0700 Subject: [PATCH 077/661] AddSelf more scenarios --- test/cpp/microbenchmarks/bm_threadpool.cc | 53 +++++++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_threadpool.cc b/test/cpp/microbenchmarks/bm_threadpool.cc index 128f3c2d63d..1cd41dafa7f 100644 --- a/test/cpp/microbenchmarks/bm_threadpool.cc +++ b/test/cpp/microbenchmarks/bm_threadpool.cc @@ -236,11 +236,12 @@ class AddSelfFunctor : public grpc_experimental_completion_queue_functor { int num_add_; }; -static void BM_ThreadPoolAddSelf(benchmark::State& state) { +void ThreadPoolAddSelfHelper(benchmark::State& state, + int concurrent_functor) { const int num_iterations = state.range(0); const int num_threads = state.range(1); - int concurrent_functor = num_threads; - int num_add = num_iterations / concurrent_functor; + // Number of adds done by each closure. + const int num_add = num_iterations / concurrent_functor; grpc_core::ThreadPool pool(num_threads); while (state.KeepRunningBatch(num_iterations)) { BlockingCounter counter(concurrent_functor); @@ -251,9 +252,53 @@ static void BM_ThreadPoolAddSelf(benchmark::State& state) { } state.SetItemsProcessed(state.iterations()); } + +static void BM_ThreadPool1AddSelf(benchmark::State& state) { + ThreadPoolAddSelfHelper(state, 1); +} // First pair is range for number of iterations (num_iterations). // Second pair is range for thread pool size (num_threads). -BENCHMARK(BM_ThreadPoolAddSelf)->RangePair(524288, 524288, 1, 1024); +BENCHMARK(BM_ThreadPool1AddSelf)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool4AddSelf(benchmark::State& state) { + ThreadPoolAddSelfHelper(state, 4); +} +BENCHMARK(BM_ThreadPool4AddSelf)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool8AddSelf(benchmark::State& state) { + ThreadPoolAddSelfHelper(state, 8); +} +BENCHMARK(BM_ThreadPool8AddSelf)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool16AddSelf(benchmark::State& state) { + ThreadPoolAddSelfHelper(state, 16); +} +BENCHMARK(BM_ThreadPool16AddSelf)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool32AddSelf(benchmark::State& state) { + ThreadPoolAddSelfHelper(state, 32); +} +BENCHMARK(BM_ThreadPool32AddSelf)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool64AddSelf(benchmark::State& state) { + ThreadPoolAddSelfHelper(state, 64); +} +BENCHMARK(BM_ThreadPool64AddSelf)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool128AddSelf(benchmark::State& state) { + ThreadPoolAddSelfHelper(state, 128); +} +BENCHMARK(BM_ThreadPool128AddSelf)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool512AddSelf(benchmark::State& state) { + ThreadPoolAddSelfHelper(state, 512); +} +BENCHMARK(BM_ThreadPool512AddSelf)->RangePair(524288, 524288, 1, 1024); + +static void BM_ThreadPool2048AddSelf(benchmark::State& state) { + ThreadPoolAddSelfHelper(state, 2048); +} +BENCHMARK(BM_ThreadPool2048AddSelf)->RangePair(524288, 524288, 1, 1024); #if defined(__GNUC__) && !defined(SWIG) #if defined(__i386__) || defined(__x86_64__) From 1423df37a89951839ad8663c40eac41dbdf4aa7a Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 22 Jul 2019 16:56:02 -0700 Subject: [PATCH 078/661] Minor podspec change --- gRPC.podspec | 5 ++--- templates/gRPC.podspec.template | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/gRPC.podspec b/gRPC.podspec index b2d7b910042..e4eb63ff4e7 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -40,7 +40,6 @@ Pod::Spec.new do |s| s.module_name = name s.header_dir = name - s.dependency 'gRPC-RxLibrary', version s.default_subspec = 'Interface', 'GRPCCore' # Certificates, to be able to establish TLS connections: @@ -81,8 +80,7 @@ Pod::Spec.new do |s| s.subspec 'GRPCCore' do |ss| ss.header_mappings_dir = 'src/objective-c/GRPCClient' - ss.public_header_files = 'src/objective-c/GRPCClient/ChannelArg.h', - 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', + ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', 'src/objective-c/GRPCClient/GRPCCall+Tests.h', @@ -107,6 +105,7 @@ Pod::Spec.new do |s| ss.dependency 'gRPC-Core', version ss.dependency "#{s.name}/Interface", version + ss.dependency 'gRPC-RxLibrary', version end s.subspec 'GRPCCoreCronet' do |ss| diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index 2ba7089c717..146da4a323a 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -42,7 +42,6 @@ s.module_name = name s.header_dir = name - s.dependency 'gRPC-RxLibrary', version s.default_subspec = 'Interface', 'GRPCCore' # Certificates, to be able to establish TLS connections: @@ -83,8 +82,7 @@ s.subspec 'GRPCCore' do |ss| ss.header_mappings_dir = 'src/objective-c/GRPCClient' - ss.public_header_files = 'src/objective-c/GRPCClient/ChannelArg.h', - 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', + ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', 'src/objective-c/GRPCClient/GRPCCall+Tests.h', @@ -109,6 +107,7 @@ ss.dependency 'gRPC-Core', version ss.dependency "#{s.name}/Interface", version + ss.dependency 'gRPC-RxLibrary', version end s.subspec 'GRPCCoreCronet' do |ss| From ad51e66324b0885f5ade6ee656e28e8113cd1b3e Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 22 Jul 2019 18:22:41 -0700 Subject: [PATCH 079/661] Update proto compiler --- src/compiler/objective_c_generator.cc | 75 ++++++++++++++++----------- src/compiler/objective_c_generator.h | 11 ++-- src/compiler/objective_c_plugin.cc | 28 +++++++--- 3 files changed, 75 insertions(+), 39 deletions(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 24845ecdb06..5b2609f5b03 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -238,19 +238,21 @@ void PrintV2Implementation(Printer* printer, const MethodDescriptor* method, } void PrintMethodImplementations(Printer* printer, - const MethodDescriptor* method) { + const MethodDescriptor* method, + const Parameters& generator_params) { map< ::grpc::string, ::grpc::string> vars = GetMethodVars(method); PrintProtoRpcDeclarationAsPragma(printer, method, vars); - // TODO(jcanizales): Print documentation from the method. - printer->Print("// Deprecated methods.\n"); - PrintSimpleSignature(printer, method, vars); - PrintSimpleImplementation(printer, method, vars); + if (!generator_params.no_v1_compatibility) { + // TODO(jcanizales): Print documentation from the method. + PrintSimpleSignature(printer, method, vars); + PrintSimpleImplementation(printer, method, vars); - printer->Print("// Returns a not-yet-started RPC object.\n"); - PrintAdvancedSignature(printer, method, vars); - PrintAdvancedImplementation(printer, method, vars); + printer->Print("// Returns a not-yet-started RPC object.\n"); + PrintAdvancedSignature(printer, method, vars); + PrintAdvancedImplementation(printer, method, vars); + } PrintV2Signature(printer, method, vars); PrintV2Implementation(printer, method, vars); @@ -276,9 +278,11 @@ void PrintMethodImplementations(Printer* printer, return output; } -::grpc::string GetProtocol(const ServiceDescriptor* service) { +::grpc::string GetProtocol(const ServiceDescriptor* service, const Parameters& generator_params) { ::grpc::string output; + if (generator_params.no_v1_compatibility) return output; + // Scope the output stream so it closes and finalizes output to the string. grpc::protobuf::io::StringOutputStream output_stream(&output); Printer printer(&output_stream, '$'); @@ -292,7 +296,7 @@ void PrintMethodImplementations(Printer* printer, "that have been deprecated. They do not\n" " * recognize call options provided in the initializer. Using " "the v2 protocol is recommended.\n" - " */\n"); + " */\n\n"); printer.Print(vars, "@protocol $service_class$ \n\n"); for (int i = 0; i < service->method_count(); i++) { PrintMethodDeclarations(&printer, service->method(i)); @@ -321,7 +325,7 @@ void PrintMethodImplementations(Printer* printer, return output; } -::grpc::string GetInterface(const ServiceDescriptor* service) { +::grpc::string GetInterface(const ServiceDescriptor* service, const Parameters& generator_params) { ::grpc::string output; // Scope the output stream so it closes and finalizes output to the string. @@ -338,7 +342,11 @@ void PrintMethodImplementations(Printer* printer, " */\n"); printer.Print(vars, "@interface $service_class$ :" - " GRPCProtoService<$service_class$, $service_class$2>\n"); + " GRPCProtoService<$service_class$2"); + if (!generator_params.no_v1_compatibility) { + printer.Print(vars, ", $service_class$"); + } + printer.Print(">\n"); printer.Print( "- (instancetype)initWithHost:(NSString *)host " "callOptions:(GRPCCallOptions " @@ -347,17 +355,19 @@ void PrintMethodImplementations(Printer* printer, printer.Print( "+ (instancetype)serviceWithHost:(NSString *)host " "callOptions:(GRPCCallOptions *_Nullable)callOptions;\n"); - printer.Print( - "// The following methods belong to a set of old APIs that have been " - "deprecated.\n"); - printer.Print("- (instancetype)initWithHost:(NSString *)host;\n"); - printer.Print("+ (instancetype)serviceWithHost:(NSString *)host;\n"); + if (!generator_params.no_v1_compatibility) { + printer.Print( + "// The following methods belong to a set of old APIs that have been " + "deprecated.\n"); + printer.Print("- (instancetype)initWithHost:(NSString *)host;\n"); + printer.Print("+ (instancetype)serviceWithHost:(NSString *)host;\n"); + } printer.Print("@end\n"); return output; } -::grpc::string GetSource(const ServiceDescriptor* service) { +::grpc::string GetSource(const ServiceDescriptor* service, const Parameters& generator_params) { ::grpc::string output; { // Scope the output stream so it closes and finalizes output to the string. @@ -381,13 +391,16 @@ void PrintMethodImplementations(Printer* printer, " packageName:@\"$package$\"\n" " serviceName:@\"$service_name$\"\n" " callOptions:callOptions];\n" - "}\n\n" - "- (instancetype)initWithHost:(NSString *)host {\n" - " return [super initWithHost:host\n" - " packageName:@\"$package$\"\n" - " serviceName:@\"$service_name$\"];\n" - "}\n\n" - "#pragma clang diagnostic pop\n\n"); + "}\n\n"); + if (!generator_params.no_v1_compatibility) { + printer.Print(vars, + "- (instancetype)initWithHost:(NSString *)host {\n" + " return [super initWithHost:host\n" + " packageName:@\"$package$\"\n" + " serviceName:@\"$service_name$\"];\n" + "}\n\n"); + } + printer.Print("#pragma clang diagnostic pop\n\n"); printer.Print( "// Override superclass initializer to disallow different" @@ -404,11 +417,13 @@ void PrintMethodImplementations(Printer* printer, " return [self initWithHost:host callOptions:callOptions];\n" "}\n\n"); + printer.Print("#pragma mark - Class Methods\n\n"); + if (!generator_params.no_v1_compatibility) { + printer.Print("+ (instancetype)serviceWithHost:(NSString *)host {\n" + " return [[self alloc] initWithHost:host];\n" + "}\n\n"); + } printer.Print( - "#pragma mark - Class Methods\n\n" - "+ (instancetype)serviceWithHost:(NSString *)host {\n" - " return [[self alloc] initWithHost:host];\n" - "}\n\n" "+ (instancetype)serviceWithHost:(NSString *)host " "callOptions:(GRPCCallOptions *_Nullable)callOptions {\n" " return [[self alloc] initWithHost:host callOptions:callOptions];\n" @@ -417,7 +432,7 @@ void PrintMethodImplementations(Printer* printer, printer.Print("#pragma mark - Method Implementations\n\n"); for (int i = 0; i < service->method_count(); i++) { - PrintMethodImplementations(&printer, service->method(i)); + PrintMethodImplementations(&printer, service->method(i), generator_params); } printer.Print("@end\n"); diff --git a/src/compiler/objective_c_generator.h b/src/compiler/objective_c_generator.h index c171e5bf772..3f5b3e8b780 100644 --- a/src/compiler/objective_c_generator.h +++ b/src/compiler/objective_c_generator.h @@ -23,6 +23,11 @@ namespace grpc_objective_c_generator { +struct Parameters { + // Do not generate V1 interface and implementation + bool no_v1_compatibility; +}; + using ::grpc::protobuf::FileDescriptor; using ::grpc::protobuf::FileDescriptor; using ::grpc::protobuf::ServiceDescriptor; @@ -34,7 +39,7 @@ string GetAllMessageClasses(const FileDescriptor* file); // Returns the content to be included defining the @protocol segment at the // insertion point of the generated implementation file. This interface is // legacy and for backwards compatibility. -string GetProtocol(const ServiceDescriptor* service); +string GetProtocol(const ServiceDescriptor* service, const Parameters& generator_params); // Returns the content to be included defining the @protocol segment at the // insertion point of the generated implementation file. @@ -42,11 +47,11 @@ string GetV2Protocol(const ServiceDescriptor* service); // Returns the content to be included defining the @interface segment at the // insertion point of the generated implementation file. -string GetInterface(const ServiceDescriptor* service); +string GetInterface(const ServiceDescriptor* service, const Parameters& generator_params); // Returns the content to be included in the "global_scope" insertion point of // the generated implementation file. -string GetSource(const ServiceDescriptor* service); +string GetSource(const ServiceDescriptor* service, const Parameters& generator_params); } // namespace grpc_objective_c_generator diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index 87977095d05..b46a50b81a1 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -83,13 +83,29 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string file_name = google::protobuf::compiler::objectivec::FilePath(file); + grpc_objective_c_generator::Parameters generator_params; + generator_params.no_v1_compatibility = false; + + if (!parameter.empty()) { + std::vector parameters_list = + grpc_generator::tokenize(parameter, ","); + for (auto parameter_string = parameters_list.begin(); + parameter_string != parameters_list.end(); parameter_string++) { + std::vector param = + grpc_generator::tokenize(*parameter_string, "="); + if (param[0] == "no_v1_compatibility") { + generator_params.no_v1_compatibility = true; + } + } + } + { // Generate .pbrpc.h ::grpc::string imports = LocalImport(file_name + ".pbobjc.h"); - ::grpc::string system_imports = SystemImport("ProtoRPC/ProtoService.h") + - SystemImport("ProtoRPC/ProtoRPC.h") + + ::grpc::string system_imports = (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoService.h") : SystemImport("ProtoRPC/ProtoServiceLegacy.h")) + + (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoRPC.h") : SystemImport("ProtoRPC/ProtoRPCLegacy.h")) + SystemImport("RxLibrary/GRXWriteable.h") + SystemImport("RxLibrary/GRXWriter.h"); @@ -118,13 +134,13 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string protocols; for (int i = 0; i < file->service_count(); i++) { const grpc::protobuf::ServiceDescriptor* service = file->service(i); - protocols += grpc_objective_c_generator::GetProtocol(service); + protocols += grpc_objective_c_generator::GetProtocol(service, generator_params); } ::grpc::string interfaces; for (int i = 0; i < file->service_count(); i++) { const grpc::protobuf::ServiceDescriptor* service = file->service(i); - interfaces += grpc_objective_c_generator::GetInterface(service); + interfaces += grpc_objective_c_generator::GetInterface(service, generator_params); } Write(context, file_name + ".pbrpc.h", @@ -143,7 +159,7 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string imports = LocalImport(file_name + ".pbrpc.h") + LocalImport(file_name + ".pbobjc.h") + - SystemImport("ProtoRPC/ProtoRPC.h") + + (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoRPC.h") : SystemImport("ProtoRPC/ProtoRPCLegacy.h")) + SystemImport("RxLibrary/GRXWriter+Immediate.h"); ::grpc::string class_imports; @@ -154,7 +170,7 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string definitions; for (int i = 0; i < file->service_count(); i++) { const grpc::protobuf::ServiceDescriptor* service = file->service(i); - definitions += grpc_objective_c_generator::GetSource(service); + definitions += grpc_objective_c_generator::GetSource(service, generator_params); } Write(context, file_name + ".pbrpc.m", From d6a201b62b0673bb7d24a10f2f9ecb7b843d499a Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 23 Jul 2019 10:14:25 -0700 Subject: [PATCH 080/661] Isolate legacy in ProtoRPC --- gRPC-ProtoRPC.podspec | 18 +++- src/objective-c/GRPCClient/GRPCCall.h | 5 +- src/objective-c/ProtoRPC/ProtoRPC.h | 37 ++------ src/objective-c/ProtoRPC/ProtoRPC.m | 75 +---------------- src/objective-c/ProtoRPC/ProtoRPCLegacy.h | 34 ++++++++ src/objective-c/ProtoRPC/ProtoRPCLegacy.m | 84 +++++++++++++++++++ src/objective-c/ProtoRPC/ProtoService.h | 15 ++-- src/objective-c/ProtoRPC/ProtoService.m | 35 +------- src/objective-c/ProtoRPC/ProtoServiceLegacy.h | 18 ++++ src/objective-c/ProtoRPC/ProtoServiceLegacy.m | 40 +++++++++ templates/gRPC-ProtoRPC.podspec.template | 18 +++- 11 files changed, 220 insertions(+), 159 deletions(-) create mode 100644 src/objective-c/ProtoRPC/ProtoRPCLegacy.h create mode 100644 src/objective-c/ProtoRPC/ProtoRPCLegacy.m create mode 100644 src/objective-c/ProtoRPC/ProtoServiceLegacy.h create mode 100644 src/objective-c/ProtoRPC/ProtoServiceLegacy.m diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 2c0441ba95c..3de3c553567 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -43,20 +43,32 @@ Pod::Spec.new do |s| src_dir = 'src/objective-c/ProtoRPC' - s.default_subspec = 'Main' + s.default_subspec = 'Main', 'Legacy' s.subspec 'Main' do |ss| ss.header_mappings_dir = "#{src_dir}" ss.dependency 'gRPC', version + ss.dependency 'Protobuf', '~> 3.0' + + ss.source_files = "src/objective-c/ProtoRPC/ProtoMethod.{h,m}", + "src/objective-c/ProtoRPC/ProtoRPC.{h,m}", + "src/objective-c/ProtoRPC/ProtoService.{h,m}" + end + + s.subspec 'Legacy' do |ss| + ss.header_mappings_dir = "#{src_dir}" + ss.dependency "#{s.name}/Main", version + ss.dependency 'gRPC/GRPCCore', version ss.dependency 'gRPC-RxLibrary', version ss.dependency 'Protobuf', '~> 3.0' - ss.source_files = "#{src_dir}/*.{h,m}" + ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.{h,m}", + "src/objective-c/ProtoRPC/ProtoServiceLegacy.{h,m}" end # CFStream is now default. Leaving this subspec only for compatibility purpose. s.subspec 'CFStream' do |ss| - ss.dependency "#{s.name}/Main", version + ss.dependency "#{s.name}/Legacy", version end s.pod_target_xcconfig = { diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 504da43329a..2ab69480fb8 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -38,11 +38,8 @@ #import "GRPCDispatchable.h" // The legacy header is included for backwards compatibility. Some V1 API users are still using -// GRPCCall by importing GRPCCall.h header so we need this import. However, if a user needs to -// exclude the core implementation, they may do so by defining GRPC_OBJC_NO_LEGACY_COMPATIBILITY. -#ifndef GRPC_OBJC_NO_LEGACY_COMPATIBILITY +// GRPCCall by importing GRPCCall.h header so we need this import. #import "GRPCCallLegacy.h" -#endif NS_ASSUME_NONNULL_BEGIN diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h index 12db46adeda..ab9a180eb97 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.h +++ b/src/objective-c/ProtoRPC/ProtoRPC.h @@ -17,12 +17,13 @@ */ #import -#import #import "ProtoMethod.h" NS_ASSUME_NONNULL_BEGIN +@class GRPCRequestOptions; +@class GRPCCallOptions; @class GPBMessage; /** An object can implement this protocol to receive responses from server from a call. */ @@ -159,36 +160,10 @@ NS_ASSUME_NONNULL_BEGIN @end -NS_ASSUME_NONNULL_END - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnullability-completeness" - -__attribute__((deprecated("Please use GRPCProtoCall."))) @interface ProtoRPC - : GRPCCall - - /** - * host parameter should not contain the scheme (http:// or https://), only the name or IP - * addr and the port number, for example @"localhost:5050". - */ - - - (instancetype)initWithHost : (NSString *)host method - : (GRPCProtoMethod *)method requestsWriter : (GRXWriter *)requestsWriter responseClass - : (Class)responseClass responsesWriteable - : (id)responsesWriteable NS_DESIGNATED_INITIALIZER; - -- (void)start; -@end - /** - * This subclass is empty now. Eventually we'll remove ProtoRPC class - * to avoid potential naming conflict + * Generate an NSError object that represents a failure in parsing a proto class. For gRPC internal + * use only. */ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - @interface GRPCProtoCall : ProtoRPC -#pragma clang diagnostic pop +NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError); - @end - -#pragma clang diagnostic pop +NS_ASSUME_NONNULL_END diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m index 4700fdd1124..4067dbd1820 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.m +++ b/src/objective-c/ProtoRPC/ProtoRPC.m @@ -30,7 +30,7 @@ /** * Generate an NSError object that represents a failure in parsing a proto class. */ -static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError) { +NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError) { NSDictionary *info = @{ NSLocalizedDescriptionKey : @"Unable to parse response from the server", NSLocalizedRecoverySuggestionErrorKey : @@ -291,76 +291,3 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing } @end - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -@implementation ProtoRPC { -#pragma clang diagnostic pop - id _responseWriteable; -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-designated-initializers" -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - requestsWriter:(GRXWriter *)requestsWriter { - [NSException raise:NSInvalidArgumentException - format:@"Please use ProtoRPC's designated initializer instead."]; - return nil; -} -#pragma clang diagnostic pop - -// Designated initializer -- (instancetype)initWithHost:(NSString *)host - method:(GRPCProtoMethod *)method - requestsWriter:(GRXWriter *)requestsWriter - responseClass:(Class)responseClass - responsesWriteable:(id)responsesWriteable { - // Because we can't tell the type system to constrain the class, we need to check at runtime: - if (![responseClass respondsToSelector:@selector(parseFromData:error:)]) { - [NSException raise:NSInvalidArgumentException - format:@"A protobuf class to parse the responses must be provided."]; - } - // A writer that serializes the proto messages to send. - GRXWriter *bytesWriter = [requestsWriter map:^id(GPBMessage *proto) { - if (![proto isKindOfClass:[GPBMessage class]]) { - [NSException raise:NSInvalidArgumentException - format:@"Request must be a proto message: %@", proto]; - } - return [proto data]; - }]; - if ((self = [super initWithHost:host path:method.HTTPPath requestsWriter:bytesWriter])) { - __weak ProtoRPC *weakSelf = self; - - // A writeable that parses the proto messages received. - _responseWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { - // TODO(jcanizales): This is done in the main thread, and needs to happen in another thread. - NSError *error = nil; - id parsed = [responseClass parseFromData:value error:&error]; - if (parsed) { - [responsesWriteable writeValue:parsed]; - } else { - [weakSelf finishWithError:ErrorForBadProto(value, responseClass, error)]; - } - } - completionHandler:^(NSError *errorOrNil) { - [responsesWriteable writesFinishedWithError:errorOrNil]; - }]; - } - return self; -} - -- (void)start { - [self startWithWriteable:_responseWriteable]; -} - -- (void)startWithWriteable:(id)writeable { - [super startWithWriteable:writeable]; - // Break retain cycles. - _responseWriteable = nil; -} -@end - -@implementation GRPCProtoCall - -@end diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h new file mode 100644 index 00000000000..893d8047104 --- /dev/null +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h @@ -0,0 +1,34 @@ +#import "ProtoRPC.h" +#import + +@class GRPCProtoMethod; +@class GRXWriter; +@protocol GRXWriteable; + +__attribute__((deprecated("Please use GRPCProtoCall."))) @interface ProtoRPC +: GRPCCall + +/** + * host parameter should not contain the scheme (http:// or https://), only the name or IP + * addr and the port number, for example @"localhost:5050". + */ +- +(instancetype)initWithHost : (NSString *)host method +: (GRPCProtoMethod *)method requestsWriter : (GRXWriter *)requestsWriter responseClass +: (Class)responseClass responsesWriteable +: (id)responsesWriteable NS_DESIGNATED_INITIALIZER; + +- (void)start; +@end + +/** + * This subclass is empty now. Eventually we'll remove ProtoRPC class + * to avoid potential naming conflict + */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +@interface GRPCProtoCall : ProtoRPC +#pragma clang diagnostic pop + +@end + diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m new file mode 100644 index 00000000000..45f873dc889 --- /dev/null +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m @@ -0,0 +1,84 @@ +#import "ProtoRPCLegacy.h" + +#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS +#import +#else +#import +#endif +#import +#import +#import + + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" +@implementation ProtoRPC { +#pragma clang diagnostic pop + id _responseWriteable; +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wobjc-designated-initializers" +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + requestsWriter:(GRXWriter *)requestsWriter { + [NSException raise:NSInvalidArgumentException + format:@"Please use ProtoRPC's designated initializer instead."]; + return nil; +} +#pragma clang diagnostic pop + +// Designated initializer +- (instancetype)initWithHost:(NSString *)host + method:(GRPCProtoMethod *)method + requestsWriter:(GRXWriter *)requestsWriter + responseClass:(Class)responseClass + responsesWriteable:(id)responsesWriteable { + // Because we can't tell the type system to constrain the class, we need to check at runtime: + if (![responseClass respondsToSelector:@selector(parseFromData:error:)]) { + [NSException raise:NSInvalidArgumentException + format:@"A protobuf class to parse the responses must be provided."]; + } + // A writer that serializes the proto messages to send. + GRXWriter *bytesWriter = [requestsWriter map:^id(GPBMessage *proto) { + if (![proto isKindOfClass:[GPBMessage class]]) { + [NSException raise:NSInvalidArgumentException + format:@"Request must be a proto message: %@", proto]; + } + return [proto data]; + }]; + if ((self = [super initWithHost:host path:method.HTTPPath requestsWriter:bytesWriter])) { + __weak ProtoRPC *weakSelf = self; + + // A writeable that parses the proto messages received. + _responseWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { + // TODO(jcanizales): This is done in the main thread, and needs to happen in another thread. + NSError *error = nil; + id parsed = [responseClass parseFromData:value error:&error]; + if (parsed) { + [responsesWriteable writeValue:parsed]; + } else { + [weakSelf finishWithError:ErrorForBadProto(value, responseClass, error)]; + } + } + completionHandler:^(NSError *errorOrNil) { + [responsesWriteable writesFinishedWithError:errorOrNil]; + }]; + } + return self; +} + +- (void)start { + [self startWithWriteable:_responseWriteable]; +} + +- (void)startWithWriteable:(id)writeable { + [super startWithWriteable:writeable]; + // Break retain cycles. + _responseWriteable = nil; +} +@end + +@implementation GRPCProtoCall + +@end diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index 900ec8d0e1e..e99d75fd3d8 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -31,22 +31,17 @@ #pragma clang diagnostic ignored "-Wnullability-completeness" __attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoService - : NSObject +: NSObject { + NSString *_host; + NSString *_packageName; + NSString *_serviceName; +} - (nullable instancetype)initWithHost : (nonnull NSString *)host packageName : (nonnull NSString *)packageName serviceName : (nonnull NSString *)serviceName callOptions : (nullable GRPCCallOptions *)callOptions NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithHost:(NSString *)host - packageName:(NSString *)packageName - serviceName:(NSString *)serviceName; - -- (GRPCProtoCall *)RPCToMethod:(NSString *)method - requestsWriter:(GRXWriter *)requestsWriter - responseClass:(Class)responseClass - responsesWriteable:(id)responsesWriteable; - - (nullable GRPCUnaryProtoCall *)RPCToMethod:(nonnull NSString *)method message:(nonnull id)message responseHandler:(nonnull id)handler diff --git a/src/objective-c/ProtoRPC/ProtoService.m b/src/objective-c/ProtoRPC/ProtoService.m index 80a1f2f226c..3a8417d0afa 100644 --- a/src/objective-c/ProtoRPC/ProtoService.m +++ b/src/objective-c/ProtoRPC/ProtoService.m @@ -29,14 +29,11 @@ #pragma clang diagnostic ignored "-Wdeprecated-implementations" @implementation ProtoService { #pragma clang diagnostic pop - NSString *_host; - NSString *_packageName; - NSString *_serviceName; GRPCCallOptions *_callOptions; } - (instancetype)init { - return [self initWithHost:nil packageName:nil serviceName:nil]; + return [self initWithHost:nil packageName:nil serviceName:nil callOptions:nil]; } // Designated initializer @@ -58,38 +55,8 @@ return self; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-designated-initializers" -// Do not call designated initializer here due to nullability incompatibility. This method is from -// old API and does not assert on nullability of the parameters. - -- (instancetype)initWithHost:(NSString *)host - packageName:(NSString *)packageName - serviceName:(NSString *)serviceName { - if ((self = [super init])) { - _host = [host copy]; - _packageName = [packageName copy]; - _serviceName = [serviceName copy]; - _callOptions = nil; - } - return self; -} - #pragma clang diagnostic pop -- (GRPCProtoCall *)RPCToMethod:(NSString *)method - requestsWriter:(GRXWriter *)requestsWriter - responseClass:(Class)responseClass - responsesWriteable:(id)responsesWriteable { - GRPCProtoMethod *methodName = - [[GRPCProtoMethod alloc] initWithPackage:_packageName service:_serviceName method:method]; - return [[GRPCProtoCall alloc] initWithHost:_host - method:methodName - requestsWriter:requestsWriter - responseClass:responseClass - responsesWriteable:responsesWriteable]; -} - - (GRPCUnaryProtoCall *)RPCToMethod:(NSString *)method message:(id)message responseHandler:(id)handler diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.h b/src/objective-c/ProtoRPC/ProtoServiceLegacy.h new file mode 100644 index 00000000000..dd5e533379c --- /dev/null +++ b/src/objective-c/ProtoRPC/ProtoServiceLegacy.h @@ -0,0 +1,18 @@ +#import "ProtoService.h" + +@class GRPCProtoCall; +@class GRXWriter; +@protocol GRXWriteable; + +@interface ProtoService (Legacy) + +- (instancetype)initWithHost:(NSString *)host + packageName:(NSString *)packageName + serviceName:(NSString *)serviceName; + +- (GRPCProtoCall *)RPCToMethod:(NSString *)method + requestsWriter:(GRXWriter *)requestsWriter + responseClass:(Class)responseClass + responsesWriteable:(id)responsesWriteable; + +@end diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m new file mode 100644 index 00000000000..34f2b0f2cbb --- /dev/null +++ b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m @@ -0,0 +1,40 @@ +#import "ProtoServiceLegacy.h" +#import "ProtoRPCLegacy.h" +#import "ProtoMethod.h" + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" +@implementation ProtoService (Legacy) +#pragma clang diagnostic pop + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wobjc-designated-initializers" +// Do not call designated initializer here due to nullability incompatibility. This method is from +// old API and does not assert on nullability of the parameters. + +- (instancetype)initWithHost:(NSString *)host + packageName:(NSString *)packageName + serviceName:(NSString *)serviceName { + if ((self = [super init])) { + _host = [host copy]; + _packageName = [packageName copy]; + _serviceName = [serviceName copy]; + } + return self; +} + + +- (GRPCProtoCall *)RPCToMethod:(NSString *)method + requestsWriter:(GRXWriter *)requestsWriter + responseClass:(Class)responseClass + responsesWriteable:(id)responsesWriteable { + GRPCProtoMethod *methodName = + [[GRPCProtoMethod alloc] initWithPackage:_packageName service:_serviceName method:method]; + return [[GRPCProtoCall alloc] initWithHost:_host + method:methodName + requestsWriter:requestsWriter + responseClass:responseClass + responsesWriteable:responsesWriteable]; +} + +@end diff --git a/templates/gRPC-ProtoRPC.podspec.template b/templates/gRPC-ProtoRPC.podspec.template index e4d5f3ffd3d..8c0d7ffdb3e 100644 --- a/templates/gRPC-ProtoRPC.podspec.template +++ b/templates/gRPC-ProtoRPC.podspec.template @@ -45,20 +45,32 @@ src_dir = 'src/objective-c/ProtoRPC' - s.default_subspec = 'Main' + s.default_subspec = 'Main', 'Legacy' s.subspec 'Main' do |ss| ss.header_mappings_dir = "#{src_dir}" ss.dependency 'gRPC', version + ss.dependency 'Protobuf', '~> 3.0' + + ss.source_files = "src/objective-c/ProtoRPC/ProtoMethod.{h,m}", + "src/objective-c/ProtoRPC/ProtoRPC.{h,m}", + "src/objective-c/ProtoRPC/ProtoService.{h,m}" + end + + s.subspec 'Legacy' do |ss| + ss.header_mappings_dir = "#{src_dir}" + ss.dependency "#{s.name}/Main", version + ss.dependency 'gRPC/GRPCCore', version ss.dependency 'gRPC-RxLibrary', version ss.dependency 'Protobuf', '~> 3.0' - ss.source_files = "#{src_dir}/*.{h,m}" + ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.{h,m}", + "src/objective-c/ProtoRPC/ProtoServiceLegacy.{h,m}" end # CFStream is now default. Leaving this subspec only for compatibility purpose. s.subspec 'CFStream' do |ss| - ss.dependency "#{s.name}/Main", version + ss.dependency "#{s.name}/Legacy", version end s.pod_target_xcconfig = { From 4a4b37ef1ce61c741f21b2a5916d65a9e5a1ada8 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 23 Jul 2019 10:48:37 -0700 Subject: [PATCH 081/661] Adapted to Bazel/Blaze's import/include convention --- .../project.pbxproj | 70 +++++++++---------- .../InterceptorSample/ViewController.m | 4 +- .../RemoteTestClient/RemoteTest.podspec | 17 +++-- .../examples/RemoteTestClient/test.proto | 2 +- 4 files changed, 48 insertions(+), 45 deletions(-) diff --git a/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj b/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj index 8b8811d4c62..f3388fc2a84 100644 --- a/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 1C4854A76EEB56F8096DBDEF /* libPods-InterceptorSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CB7A7A5B91FC976FCF4637AE /* libPods-InterceptorSample.a */; }; 5EE960FB2266768A0044A74F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE960FA2266768A0044A74F /* AppDelegate.m */; }; 5EE960FE2266768A0044A74F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE960FD2266768A0044A74F /* ViewController.m */; }; 5EE961012266768A0044A74F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EE960FF2266768A0044A74F /* Main.storyboard */; }; @@ -15,10 +14,11 @@ 5EE961062266768C0044A74F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EE961042266768C0044A74F /* LaunchScreen.storyboard */; }; 5EE961092266768C0044A74F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE961082266768C0044A74F /* main.m */; }; 5EE9611222668CF20044A74F /* CacheInterceptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE9611122668CF20044A74F /* CacheInterceptor.m */; }; + B39AA5EDA7B541C915C1D823 /* libPods-InterceptorSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EE3A6DB9460D83EFDECDEF27 /* libPods-InterceptorSample.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 09457A264AAE5323BF50B1F8 /* Pods-InterceptorSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.debug.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.debug.xcconfig"; sourceTree = ""; }; + 53E7AEA20F8F0F23BFC5E85A /* Pods-InterceptorSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.release.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.release.xcconfig"; sourceTree = ""; }; 5EE960F62266768A0044A74F /* InterceptorSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InterceptorSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5EE960FA2266768A0044A74F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 5EE960FC2266768A0044A74F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; @@ -31,8 +31,8 @@ 5EE9610F2266774C0044A74F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 5EE9611022668CE20044A74F /* CacheInterceptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CacheInterceptor.h; sourceTree = ""; }; 5EE9611122668CF20044A74F /* CacheInterceptor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CacheInterceptor.m; sourceTree = ""; }; - A0789280A4035D0F22F96BE6 /* Pods-InterceptorSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.release.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.release.xcconfig"; sourceTree = ""; }; - CB7A7A5B91FC976FCF4637AE /* libPods-InterceptorSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InterceptorSample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 61819C78C7CC39640B0AF90B /* Pods-InterceptorSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.debug.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.debug.xcconfig"; sourceTree = ""; }; + EE3A6DB9460D83EFDECDEF27 /* libPods-InterceptorSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InterceptorSample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -40,20 +40,28 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 1C4854A76EEB56F8096DBDEF /* libPods-InterceptorSample.a in Frameworks */, + B39AA5EDA7B541C915C1D823 /* libPods-InterceptorSample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 5DBBA8A4C272D71DA0B942A2 /* Frameworks */ = { + isa = PBXGroup; + children = ( + EE3A6DB9460D83EFDECDEF27 /* libPods-InterceptorSample.a */, + ); + name = Frameworks; + sourceTree = ""; + }; 5EE960ED2266768A0044A74F = { isa = PBXGroup; children = ( 5EE960F82266768A0044A74F /* InterceptorSample */, 5EE960F72266768A0044A74F /* Products */, 9D49DB75F3BEDAFDE7028B51 /* Pods */, - BD7184728351C7DDAFBA5FA2 /* Frameworks */, + 5DBBA8A4C272D71DA0B942A2 /* Frameworks */, ); sourceTree = ""; }; @@ -86,20 +94,12 @@ 9D49DB75F3BEDAFDE7028B51 /* Pods */ = { isa = PBXGroup; children = ( - 09457A264AAE5323BF50B1F8 /* Pods-InterceptorSample.debug.xcconfig */, - A0789280A4035D0F22F96BE6 /* Pods-InterceptorSample.release.xcconfig */, + 61819C78C7CC39640B0AF90B /* Pods-InterceptorSample.debug.xcconfig */, + 53E7AEA20F8F0F23BFC5E85A /* Pods-InterceptorSample.release.xcconfig */, ); path = Pods; sourceTree = ""; }; - BD7184728351C7DDAFBA5FA2 /* Frameworks */ = { - isa = PBXGroup; - children = ( - CB7A7A5B91FC976FCF4637AE /* libPods-InterceptorSample.a */, - ); - name = Frameworks; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -107,11 +107,11 @@ isa = PBXNativeTarget; buildConfigurationList = 5EE9610C2266768C0044A74F /* Build configuration list for PBXNativeTarget "InterceptorSample" */; buildPhases = ( - 7531607F028A04DAAF5E97B5 /* [CP] Check Pods Manifest.lock */, + 6313E891EAC080560B6D470D /* [CP] Check Pods Manifest.lock */, 5EE960F22266768A0044A74F /* Sources */, 5EE960F32266768A0044A74F /* Frameworks */, 5EE960F42266768A0044A74F /* Resources */, - 17700C95BAEBB27F7A3D1B01 /* [CP] Copy Pods Resources */, + A3ABCCE79BCEB8687DE0D995 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -168,43 +168,43 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 17700C95BAEBB27F7A3D1B01 /* [CP] Copy Pods Resources */ = { + 6313E891EAC080560B6D470D /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Copy Pods Resources"; + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-InterceptorSample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 7531607F028A04DAAF5E97B5 /* [CP] Check Pods Manifest.lock */ = { + A3ABCCE79BCEB8687DE0D995 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-InterceptorSample-checkManifestLockResult.txt", + "${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -357,7 +357,7 @@ }; 5EE9610D2266768C0044A74F /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 09457A264AAE5323BF50B1F8 /* Pods-InterceptorSample.debug.xcconfig */; + baseConfigurationReference = 61819C78C7CC39640B0AF90B /* Pods-InterceptorSample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; @@ -374,7 +374,7 @@ }; 5EE9610E2266768C0044A74F /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A0789280A4035D0F22F96BE6 /* Pods-InterceptorSample.release.xcconfig */; + baseConfigurationReference = 53E7AEA20F8F0F23BFC5E85A /* Pods-InterceptorSample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; diff --git a/src/objective-c/examples/InterceptorSample/InterceptorSample/ViewController.m b/src/objective-c/examples/InterceptorSample/InterceptorSample/ViewController.m index 9da6dedbf9e..b0e66636028 100644 --- a/src/objective-c/examples/InterceptorSample/InterceptorSample/ViewController.m +++ b/src/objective-c/examples/InterceptorSample/InterceptorSample/ViewController.m @@ -19,8 +19,8 @@ #import "ViewController.h" #import -#import -#import +#import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" #import "CacheInterceptor.h" diff --git a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec index cd9464c453e..f6c2f91f16a 100644 --- a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec @@ -14,31 +14,34 @@ Pod::Spec.new do |s| s.dependency "!ProtoCompiler-gRPCPlugin" repo_root = '../../../..' - bin_dir = "#{repo_root}/bins/$CONFIG" + bin_dir = "bins/$CONFIG" protoc = "#{bin_dir}/protobuf/protoc" - well_known_types_dir = "#{repo_root}/third_party/protobuf/src" + well_known_types_dir = "third_party/protobuf/src" plugin = "#{bin_dir}/grpc_objective_c_plugin" + out_dir = "src/objective-c/examples/RemoteTestClient" s.prepare_command = <<-CMD + pushd #{repo_root} #{protoc} \ --plugin=protoc-gen-grpc=#{plugin} \ - --objc_out=. \ - --grpc_out=. \ + --objc_out=#{out_dir} \ + --grpc_out=#{out_dir} \ -I . \ -I #{well_known_types_dir} \ - *.proto + #{out_dir}/*.proto + popd CMD s.subspec 'Messages' do |ms| - ms.source_files = '*.pbobjc.{h,m}' + ms.source_files = '**/*.pbobjc.{h,m}' ms.header_mappings_dir = '.' ms.requires_arc = false ms.dependency 'Protobuf' end s.subspec 'Services' do |ss| - ss.source_files = '*.pbrpc.{h,m}' + ss.source_files = '**/*.pbrpc.{h,m}' ss.header_mappings_dir = '.' ss.requires_arc = true ss.dependency 'gRPC-ProtoRPC' diff --git a/src/objective-c/examples/RemoteTestClient/test.proto b/src/objective-c/examples/RemoteTestClient/test.proto index c5696043630..8c91f7d9f2e 100644 --- a/src/objective-c/examples/RemoteTestClient/test.proto +++ b/src/objective-c/examples/RemoteTestClient/test.proto @@ -17,7 +17,7 @@ syntax = "proto3"; import "google/protobuf/empty.proto"; -import "messages.proto"; +import "src/objective-c/examples/RemoteTestClient/messages.proto"; package grpc.testing; From efd6946d21a86212e58e992c9960da9ab8838eee Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Tue, 23 Jul 2019 15:35:50 -0700 Subject: [PATCH 082/661] Reformat --- test/cpp/microbenchmarks/bm_threadpool.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_threadpool.cc b/test/cpp/microbenchmarks/bm_threadpool.cc index 1cd41dafa7f..c800fadf9d0 100644 --- a/test/cpp/microbenchmarks/bm_threadpool.cc +++ b/test/cpp/microbenchmarks/bm_threadpool.cc @@ -236,8 +236,7 @@ class AddSelfFunctor : public grpc_experimental_completion_queue_functor { int num_add_; }; -void ThreadPoolAddSelfHelper(benchmark::State& state, - int concurrent_functor) { +void ThreadPoolAddSelfHelper(benchmark::State& state, int concurrent_functor) { const int num_iterations = state.range(0); const int num_threads = state.range(1); // Number of adds done by each closure. From b2e8417400a3b7a5030a2d28299e1cdcb1b8bafb Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 23 Jul 2019 16:23:10 -0700 Subject: [PATCH 083/661] clang_format_code'd files previously parsed wrong --- .../ExtensionDelegate.h | 2 +- .../ExtensionDelegate.m | 80 +++++++++++-------- .../InterfaceController.h | 2 +- .../InterfaceController.m | 13 +-- 4 files changed, 50 insertions(+), 47 deletions(-) diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.h b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.h index 9b48cc95e6a..fbf67335f7d 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.h +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.h @@ -18,6 +18,6 @@ #import -@interface ExtensionDelegate : NSObject +@interface ExtensionDelegate : NSObject @end diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.m b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.m index 47de32a3de9..5be441937b6 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.m @@ -21,51 +21,61 @@ @implementation ExtensionDelegate - (void)applicationDidFinishLaunching { - // Perform any final initialization of your application. + // Perform any final initialization of your application. } - (void)applicationDidBecomeActive { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + // Restart any tasks that were paused (or not yet started) while the application was inactive. If + // the application was previously in the background, optionally refresh the user interface. } - (void)applicationWillResignActive { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, etc. + // Sent when the application is about to move from active to inactive state. This can occur for + // certain types of temporary interruptions (such as an incoming phone call or SMS message) or + // when the user quits the application and it begins the transition to the background state. Use + // this method to pause ongoing tasks, disable timers, etc. } - (void)handleBackgroundTasks:(NSSet *)backgroundTasks { - // Sent when the system needs to launch the application in the background to process tasks. Tasks arrive in a set, so loop through and process each one. - for (WKRefreshBackgroundTask * task in backgroundTasks) { - // Check the Class of each task to decide how to process it - if ([task isKindOfClass:[WKApplicationRefreshBackgroundTask class]]) { - // Be sure to complete the background task once you’re done. - WKApplicationRefreshBackgroundTask *backgroundTask = (WKApplicationRefreshBackgroundTask*)task; - [backgroundTask setTaskCompletedWithSnapshot:NO]; - } else if ([task isKindOfClass:[WKSnapshotRefreshBackgroundTask class]]) { - // Snapshot tasks have a unique completion call, make sure to set your expiration date - WKSnapshotRefreshBackgroundTask *snapshotTask = (WKSnapshotRefreshBackgroundTask*)task; - [snapshotTask setTaskCompletedWithDefaultStateRestored:YES estimatedSnapshotExpiration:[NSDate distantFuture] userInfo:nil]; - } else if ([task isKindOfClass:[WKWatchConnectivityRefreshBackgroundTask class]]) { - // Be sure to complete the background task once you’re done. - WKWatchConnectivityRefreshBackgroundTask *backgroundTask = (WKWatchConnectivityRefreshBackgroundTask*)task; - [backgroundTask setTaskCompletedWithSnapshot:NO]; - } else if ([task isKindOfClass:[WKURLSessionRefreshBackgroundTask class]]) { - // Be sure to complete the background task once you’re done. - WKURLSessionRefreshBackgroundTask *backgroundTask = (WKURLSessionRefreshBackgroundTask*)task; - [backgroundTask setTaskCompletedWithSnapshot:NO]; - } else if ([task isKindOfClass:[WKRelevantShortcutRefreshBackgroundTask class]]) { - // Be sure to complete the relevant-shortcut task once you’re done. - WKRelevantShortcutRefreshBackgroundTask *relevantShortcutTask = (WKRelevantShortcutRefreshBackgroundTask*)task; - [relevantShortcutTask setTaskCompletedWithSnapshot:NO]; - } else if ([task isKindOfClass:[WKIntentDidRunRefreshBackgroundTask class]]) { - // Be sure to complete the intent-did-run task once you’re done. - WKIntentDidRunRefreshBackgroundTask *intentDidRunTask = (WKIntentDidRunRefreshBackgroundTask*)task; - [intentDidRunTask setTaskCompletedWithSnapshot:NO]; - } else { - // make sure to complete unhandled task types - [task setTaskCompletedWithSnapshot:NO]; - } + // Sent when the system needs to launch the application in the background to process tasks. Tasks + // arrive in a set, so loop through and process each one. + for (WKRefreshBackgroundTask *task in backgroundTasks) { + // Check the Class of each task to decide how to process it + if ([task isKindOfClass:[WKApplicationRefreshBackgroundTask class]]) { + // Be sure to complete the background task once you’re done. + WKApplicationRefreshBackgroundTask *backgroundTask = + (WKApplicationRefreshBackgroundTask *)task; + [backgroundTask setTaskCompletedWithSnapshot:NO]; + } else if ([task isKindOfClass:[WKSnapshotRefreshBackgroundTask class]]) { + // Snapshot tasks have a unique completion call, make sure to set your expiration date + WKSnapshotRefreshBackgroundTask *snapshotTask = (WKSnapshotRefreshBackgroundTask *)task; + [snapshotTask setTaskCompletedWithDefaultStateRestored:YES + estimatedSnapshotExpiration:[NSDate distantFuture] + userInfo:nil]; + } else if ([task isKindOfClass:[WKWatchConnectivityRefreshBackgroundTask class]]) { + // Be sure to complete the background task once you’re done. + WKWatchConnectivityRefreshBackgroundTask *backgroundTask = + (WKWatchConnectivityRefreshBackgroundTask *)task; + [backgroundTask setTaskCompletedWithSnapshot:NO]; + } else if ([task isKindOfClass:[WKURLSessionRefreshBackgroundTask class]]) { + // Be sure to complete the background task once you’re done. + WKURLSessionRefreshBackgroundTask *backgroundTask = (WKURLSessionRefreshBackgroundTask *)task; + [backgroundTask setTaskCompletedWithSnapshot:NO]; + } else if ([task isKindOfClass:[WKRelevantShortcutRefreshBackgroundTask class]]) { + // Be sure to complete the relevant-shortcut task once you’re done. + WKRelevantShortcutRefreshBackgroundTask *relevantShortcutTask = + (WKRelevantShortcutRefreshBackgroundTask *)task; + [relevantShortcutTask setTaskCompletedWithSnapshot:NO]; + } else if ([task isKindOfClass:[WKIntentDidRunRefreshBackgroundTask class]]) { + // Be sure to complete the intent-did-run task once you’re done. + WKIntentDidRunRefreshBackgroundTask *intentDidRunTask = + (WKIntentDidRunRefreshBackgroundTask *)task; + [intentDidRunTask setTaskCompletedWithSnapshot:NO]; + } else { + // make sure to complete unhandled task types + [task setTaskCompletedWithSnapshot:NO]; } + } } @end diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.h b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.h index 46032d6030e..edcc75d5530 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.h +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.h @@ -16,8 +16,8 @@ * */ -#import #import +#import @interface InterfaceController : WKInterfaceController diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.m b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.m index ec3e90c95a5..77efbc42447 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.m @@ -24,7 +24,6 @@ @end - @implementation InterfaceController { GRPCCallOptions *_options; RMTTestService *_service; @@ -35,10 +34,9 @@ // Configure interface objects here. - GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; _options = options; - + _service = [[RMTTestService alloc] initWithHost:@"grpc-test.sandbox.googleapis.com" callOptions:_options]; } @@ -54,12 +52,10 @@ } - (IBAction)makeCall { - RMTSimpleRequest *request = [RMTSimpleRequest message]; request.responseSize = 100; - GRPCUnaryProtoCall *call = [_service unaryCallWithMessage:request - responseHandler:self - callOptions:nil]; + GRPCUnaryProtoCall *call = + [_service unaryCallWithMessage:request responseHandler:self callOptions:nil]; [call start]; } @@ -72,6 +68,3 @@ } @end - - - From 0161de3a566d030891c3ffb245b6ba17e46c613e Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Tue, 23 Jul 2019 17:11:45 -0700 Subject: [PATCH 084/661] Addressing comments --- src/core/lib/iomgr/executor/mpmcqueue.cc | 20 +++++------- src/core/lib/iomgr/executor/mpmcqueue.h | 9 +++++- test/core/iomgr/mpmcqueue_test.cc | 40 ++++++++++++++---------- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/src/core/lib/iomgr/executor/mpmcqueue.cc b/src/core/lib/iomgr/executor/mpmcqueue.cc index 15b2938a3ac..377a135e1f3 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.cc +++ b/src/core/lib/iomgr/executor/mpmcqueue.cc @@ -27,7 +27,7 @@ DebugOnlyTraceFlag grpc_thread_pool_trace(false, "thread_pool"); inline void* InfLenFIFOQueue::PopFront() { // Caller should already check queue is not empty and has already held the // mutex. This function will assume that there is at least one element in the - // queue (aka queue_head_ content is valid). + // queue (i.e. queue_head_->content is valid). void* result = queue_head_->content; count_.Store(count_.Load(MemoryOrder::RELAXED) - 1, MemoryOrder::RELAXED); @@ -65,6 +65,7 @@ inline void* InfLenFIFOQueue::PopFront() { } InfLenFIFOQueue::Node* InfLenFIFOQueue::AllocateNodes(int num) { + num_nodes_ = num_nodes_ + num; Node* new_chunk = static_cast(gpr_zalloc(sizeof(Node) * num)); new_chunk[0].next = &new_chunk[1]; new_chunk[num - 1].prev = &new_chunk[num - 2]; @@ -76,11 +77,11 @@ InfLenFIFOQueue::Node* InfLenFIFOQueue::AllocateNodes(int num) { } InfLenFIFOQueue::InfLenFIFOQueue() { - delete_list_size_ = 1024; + delete_list_size_ = kDeleteListInitSize; delete_list_ = static_cast(gpr_zalloc(sizeof(Node*) * delete_list_size_)); - Node* new_chunk = AllocateNodes(1024); + Node* new_chunk = AllocateNodes(kDeleteListInitSize); delete_list_[delete_list_count_++] = new_chunk; queue_head_ = queue_tail_ = new_chunk; new_chunk[0].prev = &new_chunk[1023]; @@ -126,10 +127,11 @@ void InfLenFIFOQueue::Put(void* elem) { stats_.num_started++; gpr_log(GPR_INFO, "[InfLenFIFOQueue Put] num_started: %" PRIu64, stats_.num_started); + auto current_time = gpr_now(GPR_CLOCK_MONOTONIC); if (curr_count == 0) { - busy_time = gpr_now(GPR_CLOCK_MONOTONIC); + busy_time = current_time; } - queue_tail_->insert_time = gpr_now(GPR_CLOCK_MONOTONIC); + queue_tail_->insert_time = current_time; } count_.Store(curr_count + 1, MemoryOrder::RELAXED); @@ -163,14 +165,6 @@ void* InfLenFIFOQueue::Get(gpr_timespec* wait_time) { return PopFront(); } -size_t InfLenFIFOQueue::num_node() { - size_t num = 1024; - for (size_t i = 1; i < delete_list_count_; ++i) { - num = num * 2; - } - return num; -} - void InfLenFIFOQueue::PushWaiter(Waiter* waiter) { waiter->next = waiters_.next; waiter->prev = &waiters_; diff --git a/src/core/lib/iomgr/executor/mpmcqueue.h b/src/core/lib/iomgr/executor/mpmcqueue.h index 49bebf8af4b..41e7e2a11be 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.h +++ b/src/core/lib/iomgr/executor/mpmcqueue.h @@ -89,7 +89,10 @@ class InfLenFIFOQueue : public MPMCQueueInterface { // For test purpose only. Returns number of nodes allocated in queue. // All allocated nodes will not be free until destruction of queue. - size_t num_node(); + int num_nodes() const { return num_nodes_; } + + // For test purpose only. Returns the initial number of nodes in queue. + int init_num_nodes() const { return kQueueInitNumNodes; } private: // For Internal Use Only. @@ -144,6 +147,9 @@ class InfLenFIFOQueue : public MPMCQueueInterface { Mutex mu_; // Protecting lock Waiter waiters_; // Head of waiting thread queue + const int kDeleteListInitSize = 1024; // Initial size for delete list + const int kQueueInitNumNodes = 1024; // Initial number of nodes allocated + Node** delete_list_ = nullptr; // Keeps track of all allocated array entries // for deleting on destruction size_t delete_list_count_ = 0; // Number of entries in list @@ -153,6 +159,7 @@ class InfLenFIFOQueue : public MPMCQueueInterface { Node* queue_head_ = nullptr; // Head of the queue, remove position Node* queue_tail_ = nullptr; // End of queue, insert position Atomic count_{0}; // Number of elements in queue + int num_nodes_ = 0; // Number of nodes allocated Stats stats_; // Stats info gpr_timespec busy_time; // Start time of busy queue diff --git a/test/core/iomgr/mpmcqueue_test.cc b/test/core/iomgr/mpmcqueue_test.cc index 68d1da65405..732c43a06f5 100644 --- a/test/core/iomgr/mpmcqueue_test.cc +++ b/test/core/iomgr/mpmcqueue_test.cc @@ -119,47 +119,53 @@ static void test_FIFO(void) { } } +// Test if queue's behavior of expanding is correct. (Only does expansion when +// it gets full, and each time expands to doubled size). static void test_space_efficiency(void) { gpr_log(GPR_INFO, "test_space_efficiency"); grpc_core::InfLenFIFOQueue queue; - for (int i = 0; i < 1024; ++i) { + for (int i = 0; i < queue.init_num_nodes(); ++i) { queue.Put(static_cast(grpc_core::New(i))); } - GPR_ASSERT(queue.num_node() == 1024); - for (int i = 0; i < 1024; ++i) { + // List should not have been expanded at this time. + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes()); + for (int i = 0; i < queue.init_num_nodes(); ++i) { WorkItem* item = static_cast(queue.Get()); queue.Put(item); } - GPR_ASSERT(queue.num_node() == 1024); - for (int i = 0; i < 1024; ++i) { + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes()); + for (int i = 0; i < queue.init_num_nodes(); ++i) { WorkItem* item = static_cast(queue.Get()); grpc_core::Delete(item); } - GPR_ASSERT(queue.num_node() == 1024); + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes()); GPR_ASSERT(queue.count() == 0); // queue empty now - for (int i = 0; i < 4000; ++i) { + for (int i = 0; i < queue.init_num_nodes() * 2; ++i) { queue.Put(static_cast(grpc_core::New(i))); } - GPR_ASSERT(queue.count() == 4000); - GPR_ASSERT(queue.num_node() == 4096); - for (int i = 0; i < 2000; ++i) { + GPR_ASSERT(queue.count() == queue.init_num_nodes() * 2); + // List should have been expanded once. + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes() * 2); + for (int i = 0; i < queue.init_num_nodes(); ++i) { WorkItem* item = static_cast(queue.Get()); grpc_core::Delete(item); } - GPR_ASSERT(queue.count() == 2000); - GPR_ASSERT(queue.num_node() == 4096); - for (int i = 0; i < 1000; ++i) { + GPR_ASSERT(queue.count() == queue.init_num_nodes()); + // List will never shrink, should keep same number of node as before. + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes() * 2); + for (int i = 0; i < queue.init_num_nodes() + 1; ++i) { queue.Put(static_cast(grpc_core::New(i))); } - GPR_ASSERT(queue.count() == 3000); - GPR_ASSERT(queue.num_node() == 4096); - for (int i = 0; i < 3000; ++i) { + GPR_ASSERT(queue.count() == queue.init_num_nodes() * 2 + 1); + // List should have been expanded twice. + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes() * 4); + for (int i = 0; i < queue.init_num_nodes() * 2 + 1; ++i) { WorkItem* item = static_cast(queue.Get()); grpc_core::Delete(item); } GPR_ASSERT(queue.count() == 0); - GPR_ASSERT(queue.num_node() == 4096); + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes() * 4); gpr_log(GPR_DEBUG, "Done."); } From 8b3da5a69863c62b1358b5d8a02d27bd3483733c Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 23 Jul 2019 18:49:15 -0700 Subject: [PATCH 085/661] Adopted the Bazel way of import + quick fix on Swift sample --- .../project.pbxproj | 48 +- .../RemoteTestClient/RemoteTest.podspec | 16 +- .../Sample/Sample.xcodeproj/project.pbxproj | 34 +- .../examples/Sample/Sample/ViewController.m | 4 +- src/objective-c/examples/SwiftSample/Podfile | 2 +- .../examples/SwiftSample/RemoteTest.podspec | 55 +++ .../SwiftSample.xcodeproj/project.pbxproj | 65 ++- .../examples/SwiftSample/messages.proto | 118 +++++ .../examples/SwiftSample/test.proto | 57 +++ .../tests/InteropTests/InteropTests.m | 6 +- .../InteropTestsMultipleChannels.m | 6 +- src/objective-c/tests/MacTests/StressTests.m | 6 +- .../tests/RemoteTestClient/RemoteTest.podspec | 12 +- .../tests/RemoteTestClient/test.proto | 2 +- .../tests/Tests.xcodeproj/project.pbxproj | 413 ++++++------------ src/objective-c/tests/UnitTests/APIv2Tests.m | 2 +- .../tests/UnitTests/GRPCClientTests.m | 2 +- 17 files changed, 452 insertions(+), 396 deletions(-) create mode 100644 src/objective-c/examples/SwiftSample/RemoteTest.podspec create mode 100644 src/objective-c/examples/SwiftSample/messages.proto create mode 100644 src/objective-c/examples/SwiftSample/test.proto diff --git a/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj b/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj index f3388fc2a84..840f9760879 100644 --- a/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj @@ -3,10 +3,11 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ + 4182FA3FC32428BA5E84C311 /* libPods-InterceptorSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 48F0BD18AEBB640DE5E58D79 /* libPods-InterceptorSample.a */; }; 5EE960FB2266768A0044A74F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE960FA2266768A0044A74F /* AppDelegate.m */; }; 5EE960FE2266768A0044A74F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE960FD2266768A0044A74F /* ViewController.m */; }; 5EE961012266768A0044A74F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EE960FF2266768A0044A74F /* Main.storyboard */; }; @@ -14,11 +15,10 @@ 5EE961062266768C0044A74F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EE961042266768C0044A74F /* LaunchScreen.storyboard */; }; 5EE961092266768C0044A74F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE961082266768C0044A74F /* main.m */; }; 5EE9611222668CF20044A74F /* CacheInterceptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE9611122668CF20044A74F /* CacheInterceptor.m */; }; - B39AA5EDA7B541C915C1D823 /* libPods-InterceptorSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EE3A6DB9460D83EFDECDEF27 /* libPods-InterceptorSample.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 53E7AEA20F8F0F23BFC5E85A /* Pods-InterceptorSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.release.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.release.xcconfig"; sourceTree = ""; }; + 48F0BD18AEBB640DE5E58D79 /* libPods-InterceptorSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InterceptorSample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 5EE960F62266768A0044A74F /* InterceptorSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InterceptorSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5EE960FA2266768A0044A74F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 5EE960FC2266768A0044A74F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; @@ -31,8 +31,8 @@ 5EE9610F2266774C0044A74F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 5EE9611022668CE20044A74F /* CacheInterceptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CacheInterceptor.h; sourceTree = ""; }; 5EE9611122668CF20044A74F /* CacheInterceptor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CacheInterceptor.m; sourceTree = ""; }; - 61819C78C7CC39640B0AF90B /* Pods-InterceptorSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.debug.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.debug.xcconfig"; sourceTree = ""; }; - EE3A6DB9460D83EFDECDEF27 /* libPods-InterceptorSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InterceptorSample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 64B0278876AF54F8F95EDDCE /* Pods-InterceptorSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.release.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.release.xcconfig"; sourceTree = ""; }; + 6637EF5BBDFE0FFD47D9EAE7 /* Pods-InterceptorSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.debug.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -40,28 +40,20 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - B39AA5EDA7B541C915C1D823 /* libPods-InterceptorSample.a in Frameworks */, + 4182FA3FC32428BA5E84C311 /* libPods-InterceptorSample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 5DBBA8A4C272D71DA0B942A2 /* Frameworks */ = { - isa = PBXGroup; - children = ( - EE3A6DB9460D83EFDECDEF27 /* libPods-InterceptorSample.a */, - ); - name = Frameworks; - sourceTree = ""; - }; 5EE960ED2266768A0044A74F = { isa = PBXGroup; children = ( 5EE960F82266768A0044A74F /* InterceptorSample */, 5EE960F72266768A0044A74F /* Products */, 9D49DB75F3BEDAFDE7028B51 /* Pods */, - 5DBBA8A4C272D71DA0B942A2 /* Frameworks */, + A48ECC1BD9AFC8D93ECD2467 /* Frameworks */, ); sourceTree = ""; }; @@ -94,12 +86,20 @@ 9D49DB75F3BEDAFDE7028B51 /* Pods */ = { isa = PBXGroup; children = ( - 61819C78C7CC39640B0AF90B /* Pods-InterceptorSample.debug.xcconfig */, - 53E7AEA20F8F0F23BFC5E85A /* Pods-InterceptorSample.release.xcconfig */, + 6637EF5BBDFE0FFD47D9EAE7 /* Pods-InterceptorSample.debug.xcconfig */, + 64B0278876AF54F8F95EDDCE /* Pods-InterceptorSample.release.xcconfig */, ); path = Pods; sourceTree = ""; }; + A48ECC1BD9AFC8D93ECD2467 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 48F0BD18AEBB640DE5E58D79 /* libPods-InterceptorSample.a */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -107,11 +107,11 @@ isa = PBXNativeTarget; buildConfigurationList = 5EE9610C2266768C0044A74F /* Build configuration list for PBXNativeTarget "InterceptorSample" */; buildPhases = ( - 6313E891EAC080560B6D470D /* [CP] Check Pods Manifest.lock */, + 471EAA5F4DD4F2A125B3488B /* [CP] Check Pods Manifest.lock */, 5EE960F22266768A0044A74F /* Sources */, 5EE960F32266768A0044A74F /* Frameworks */, 5EE960F42266768A0044A74F /* Resources */, - A3ABCCE79BCEB8687DE0D995 /* [CP] Copy Pods Resources */, + 77C5553636C977821737C752 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -168,7 +168,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 6313E891EAC080560B6D470D /* [CP] Check Pods Manifest.lock */ = { + 471EAA5F4DD4F2A125B3488B /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -190,7 +190,7 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - A3ABCCE79BCEB8687DE0D995 /* [CP] Copy Pods Resources */ = { + 77C5553636C977821737C752 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -357,7 +357,7 @@ }; 5EE9610D2266768C0044A74F /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 61819C78C7CC39640B0AF90B /* Pods-InterceptorSample.debug.xcconfig */; + baseConfigurationReference = 6637EF5BBDFE0FFD47D9EAE7 /* Pods-InterceptorSample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; @@ -369,12 +369,13 @@ PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InterceptorSample; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ""; }; name = Debug; }; 5EE9610E2266768C0044A74F /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 53E7AEA20F8F0F23BFC5E85A /* Pods-InterceptorSample.release.xcconfig */; + baseConfigurationReference = 64B0278876AF54F8F95EDDCE /* Pods-InterceptorSample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; @@ -386,6 +387,7 @@ PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InterceptorSample; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ""; }; name = Release; }; diff --git a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec index f6c2f91f16a..cf7e317be70 100644 --- a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec @@ -14,23 +14,20 @@ Pod::Spec.new do |s| s.dependency "!ProtoCompiler-gRPCPlugin" repo_root = '../../../..' - bin_dir = "bins/$CONFIG" + bin_dir = "#{repo_root}/bins/$CONFIG" protoc = "#{bin_dir}/protobuf/protoc" - well_known_types_dir = "third_party/protobuf/src" + well_known_types_dir = "#{repo_root}/third_party/protobuf/src" plugin = "#{bin_dir}/grpc_objective_c_plugin" - out_dir = "src/objective-c/examples/RemoteTestClient" s.prepare_command = <<-CMD - pushd #{repo_root} #{protoc} \ --plugin=protoc-gen-grpc=#{plugin} \ - --objc_out=#{out_dir} \ - --grpc_out=#{out_dir} \ - -I . \ + --objc_out=. \ + --grpc_out=. \ + -I #{repo_root} \ -I #{well_known_types_dir} \ - #{out_dir}/*.proto - popd + #{repo_root}/src/objective-c/examples/RemoteTestClient/*.proto CMD s.subspec 'Messages' do |ms| @@ -54,4 +51,5 @@ Pod::Spec.new do |s| # This is needed by all pods that depend on gRPC-RxLibrary: 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', } + end diff --git a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj index cdd1c6c8f7e..33bdc378165 100644 --- a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -7,12 +7,12 @@ objects = { /* Begin PBXBuildFile section */ - 3F035697392F601049D3DDE1 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC1B27EA0C428429B07BC34B /* Pods_Sample.framework */; }; 6369A2701A9322E20015FC5C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A26F1A9322E20015FC5C /* main.m */; }; 6369A2731A9322E20015FC5C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A2721A9322E20015FC5C /* AppDelegate.m */; }; 6369A2761A9322E20015FC5C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A2751A9322E20015FC5C /* ViewController.m */; }; 6369A2791A9322E20015FC5C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6369A2771A9322E20015FC5C /* Main.storyboard */; }; 6369A27B1A9322E20015FC5C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6369A27A1A9322E20015FC5C /* Images.xcassets */; }; + C8B8323DA07AC8C4499DC557 /* libPods-Sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A874B5E91AC811A1EA0D12CF /* libPods-Sample.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -26,7 +26,7 @@ 6369A2751A9322E20015FC5C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 6369A2781A9322E20015FC5C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 6369A27A1A9322E20015FC5C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - CC1B27EA0C428429B07BC34B /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A874B5E91AC811A1EA0D12CF /* libPods-Sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; E3C01DF315C4E7433BCEC6E6 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -35,7 +35,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 3F035697392F601049D3DDE1 /* Pods_Sample.framework in Frameworks */, + C8B8323DA07AC8C4499DC557 /* libPods-Sample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -95,7 +95,7 @@ C4C2C5219053E079C9EFB930 /* Frameworks */ = { isa = PBXGroup; children = ( - CC1B27EA0C428429B07BC34B /* Pods_Sample.framework */, + A874B5E91AC811A1EA0D12CF /* libPods-Sample.a */, ); name = Frameworks; sourceTree = ""; @@ -112,7 +112,6 @@ 6369A2671A9322E20015FC5C /* Frameworks */, 6369A2681A9322E20015FC5C /* Resources */, 04554623324BE4A838846086 /* [CP] Copy Pods Resources */, - C7FAD018D05AB5F0B0FE81E2 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -174,13 +173,16 @@ files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; showEnvVarsInLog = 0; }; 41F7486D8F66994B0BFB84AF /* [CP] Check Pods Manifest.lock */ = { @@ -189,28 +191,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Sample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - C7FAD018D05AB5F0B0FE81E2 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/src/objective-c/examples/Sample/Sample/ViewController.m b/src/objective-c/examples/Sample/Sample/ViewController.m index 9bcb002027b..2171a923d79 100644 --- a/src/objective-c/examples/Sample/Sample/ViewController.m +++ b/src/objective-c/examples/Sample/Sample/ViewController.m @@ -20,8 +20,8 @@ #import #import -#import -#import +#import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" #import #import diff --git a/src/objective-c/examples/SwiftSample/Podfile b/src/objective-c/examples/SwiftSample/Podfile index 8214371bc59..01ef90696ca 100644 --- a/src/objective-c/examples/SwiftSample/Podfile +++ b/src/objective-c/examples/SwiftSample/Podfile @@ -10,7 +10,7 @@ GRPC_LOCAL_SRC = '../../../..' target 'SwiftSample' do # Depend on the generated RemoteTestClient library - pod 'RemoteTest', :path => "../RemoteTestClient" + pod 'RemoteTest', :path => "." # Use the local versions of Protobuf, BoringSSL, and gRPC. You don't need any of the following # lines in your application. diff --git a/src/objective-c/examples/SwiftSample/RemoteTest.podspec b/src/objective-c/examples/SwiftSample/RemoteTest.podspec new file mode 100644 index 00000000000..e5f910c82d0 --- /dev/null +++ b/src/objective-c/examples/SwiftSample/RemoteTest.podspec @@ -0,0 +1,55 @@ +Pod::Spec.new do |s| + s.name = 'RemoteTest' + s.version = '0.0.1' + s.license = 'Apache License, Version 2.0' + s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' } + s.homepage = 'https://grpc.io/' + s.summary = 'RemoteTest example' + s.source = { :git => 'https://github.com/grpc/grpc.git' } + + s.ios.deployment_target = '7.1' + s.osx.deployment_target = '10.9' + + # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. + s.dependency "!ProtoCompiler-gRPCPlugin" + + repo_root = '../../../..' + bin_dir = "#{repo_root}/bins/$CONFIG" + + protoc = "#{bin_dir}/protobuf/protoc" + well_known_types_dir = "#{repo_root}/third_party/protobuf/src" + plugin = "#{bin_dir}/grpc_objective_c_plugin" + + s.prepare_command = <<-CMD + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --objc_out=. \ + --grpc_out=. \ + -I . \ + -I #{well_known_types_dir} \ + *.proto + CMD + + s.subspec 'Messages' do |ms| + ms.source_files = '**/*.pbobjc.{h,m}' + ms.header_mappings_dir = '.' + ms.requires_arc = false + ms.dependency 'Protobuf' + end + + s.subspec 'Services' do |ss| + ss.source_files = '**/*.pbrpc.{h,m}' + ss.header_mappings_dir = '.' + ss.requires_arc = true + ss.dependency 'gRPC-ProtoRPC' + ss.dependency "#{s.name}/Messages" + end + + s.pod_target_xcconfig = { + # This is needed by all pods that depend on Protobuf: + 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', + # This is needed by all pods that depend on gRPC-RxLibrary: + 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', + } + +end diff --git a/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj b/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj index 0113d9c5d6a..ec8883456e4 100644 --- a/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 2C0B024CB798839E17F76126 /* Pods_SwiftSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B394F343BDE186C5436DBDB9 /* Pods_SwiftSample.framework */; }; + 2A4D33FC1BAD9EE77F27E82F /* Pods_SwiftSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D24BFC7BA3339DF6B9A04EF /* Pods_SwiftSample.framework */; }; 633BFFC81B950B210007E424 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 633BFFC71B950B210007E424 /* AppDelegate.swift */; }; 633BFFCA1B950B210007E424 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 633BFFC91B950B210007E424 /* ViewController.swift */; }; 633BFFCD1B950B210007E424 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 633BFFCB1B950B210007E424 /* Main.storyboard */; }; @@ -21,9 +21,9 @@ 633BFFC91B950B210007E424 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 633BFFCC1B950B210007E424 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 633BFFCE1B950B210007E424 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - A7E614A494D89D01BB395761 /* Pods-SwiftSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftSample/Pods-SwiftSample.debug.xcconfig"; sourceTree = ""; }; - B394F343BDE186C5436DBDB9 /* Pods_SwiftSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - C314E3E246AF23AC29B38FCF /* Pods-SwiftSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftSample/Pods-SwiftSample.release.xcconfig"; sourceTree = ""; }; + 7AD632A1760ED763C0BFFD0A /* Pods-SwiftSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.release.xcconfig"; path = "Target Support Files/Pods-SwiftSample/Pods-SwiftSample.release.xcconfig"; sourceTree = ""; }; + 7D24BFC7BA3339DF6B9A04EF /* Pods_SwiftSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D6F1AAEB4FD0559A16605616 /* Pods-SwiftSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.debug.xcconfig"; path = "Target Support Files/Pods-SwiftSample/Pods-SwiftSample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -31,20 +31,21 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 2C0B024CB798839E17F76126 /* Pods_SwiftSample.framework in Frameworks */, + 2A4D33FC1BAD9EE77F27E82F /* Pods_SwiftSample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 31F283C976AE97586C17CCD9 /* Pods */ = { + 3C394733A73BFFE2995E6DC5 /* Pods */ = { isa = PBXGroup; children = ( - A7E614A494D89D01BB395761 /* Pods-SwiftSample.debug.xcconfig */, - C314E3E246AF23AC29B38FCF /* Pods-SwiftSample.release.xcconfig */, + D6F1AAEB4FD0559A16605616 /* Pods-SwiftSample.debug.xcconfig */, + 7AD632A1760ED763C0BFFD0A /* Pods-SwiftSample.release.xcconfig */, ); name = Pods; + path = Pods; sourceTree = ""; }; 633BFFB91B950B210007E424 = { @@ -52,8 +53,8 @@ children = ( 633BFFC41B950B210007E424 /* SwiftSample */, 633BFFC31B950B210007E424 /* Products */, - 31F283C976AE97586C17CCD9 /* Pods */, - 9D63A7F6423989BA306810CA /* Frameworks */, + 3C394733A73BFFE2995E6DC5 /* Pods */, + B3B46435EDEAE7572BF484F5 /* Frameworks */, ); sourceTree = ""; }; @@ -85,10 +86,10 @@ name = "Supporting Files"; sourceTree = ""; }; - 9D63A7F6423989BA306810CA /* Frameworks */ = { + B3B46435EDEAE7572BF484F5 /* Frameworks */ = { isa = PBXGroup; children = ( - B394F343BDE186C5436DBDB9 /* Pods_SwiftSample.framework */, + 7D24BFC7BA3339DF6B9A04EF /* Pods_SwiftSample.framework */, ); name = Frameworks; sourceTree = ""; @@ -100,12 +101,11 @@ isa = PBXNativeTarget; buildConfigurationList = 633BFFE11B950B210007E424 /* Build configuration list for PBXNativeTarget "SwiftSample" */; buildPhases = ( - 6BEEB33CA2705D7D2F2210E6 /* [CP] Check Pods Manifest.lock */, + 0BCFE5CC859FA15414AF3B5A /* [CP] Check Pods Manifest.lock */, 633BFFBE1B950B210007E424 /* Sources */, 633BFFBF1B950B210007E424 /* Frameworks */, 633BFFC01B950B210007E424 /* Resources */, - AC2F6F9AB1C090BB0BEE6E4D /* [CP] Copy Pods Resources */, - A1738A987353B0BF2C64F0F7 /* [CP] Embed Pods Frameworks */, + 6998570BEA68700C0183464C /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -162,16 +162,20 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 6BEEB33CA2705D7D2F2210E6 /* [CP] Check Pods Manifest.lock */ = { + 0BCFE5CC859FA15414AF3B5A /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-SwiftSample-checkManifestLockResult.txt", ); @@ -180,14 +184,14 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - A1738A987353B0BF2C64F0F7 /* [CP] Embed Pods Frameworks */ = { + 6998570BEA68700C0183464C /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-SwiftSample/Pods-SwiftSample-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/BoringSSL/openssl.framework", + "${PODS_ROOT}/Target Support Files/Pods-SwiftSample/Pods-SwiftSample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC/openssl_grpc.framework", "${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework", "${BUILT_PRODUCTS_DIR}/RemoteTest/RemoteTest.framework", "${BUILT_PRODUCTS_DIR}/gRPC/GRPCClient.framework", @@ -198,7 +202,7 @@ ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RemoteTest.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRPCClient.framework", @@ -209,22 +213,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftSample/Pods-SwiftSample-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - AC2F6F9AB1C090BB0BEE6E4D /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftSample/Pods-SwiftSample-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SwiftSample/Pods-SwiftSample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -341,7 +330,7 @@ }; 633BFFE21B950B210007E424 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A7E614A494D89D01BB395761 /* Pods-SwiftSample.debug.xcconfig */; + baseConfigurationReference = D6F1AAEB4FD0559A16605616 /* Pods-SwiftSample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = Info.plist; @@ -356,7 +345,7 @@ }; 633BFFE31B950B210007E424 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = C314E3E246AF23AC29B38FCF /* Pods-SwiftSample.release.xcconfig */; + baseConfigurationReference = 7AD632A1760ED763C0BFFD0A /* Pods-SwiftSample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = Info.plist; diff --git a/src/objective-c/examples/SwiftSample/messages.proto b/src/objective-c/examples/SwiftSample/messages.proto new file mode 100644 index 00000000000..128efd9337e --- /dev/null +++ b/src/objective-c/examples/SwiftSample/messages.proto @@ -0,0 +1,118 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Message definitions to be used by integration test service definitions. + +syntax = "proto3"; + +package grpc.testing; + +option objc_class_prefix = "RMT"; + +// The type of payload that should be returned. +enum PayloadType { + // Compressable text format. + COMPRESSABLE = 0; + + // Uncompressable binary format. + UNCOMPRESSABLE = 1; + + // Randomly chosen from all other formats defined in this enum. + RANDOM = 2; +} + +// A block of data, to simply increase gRPC message size. +message Payload { + // The type of data in body. + PayloadType type = 1; + // Primary contents of payload. + bytes body = 2; +} + +// Unary request. +message SimpleRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, server randomly chooses one from other formats. + PayloadType response_type = 1; + + // Desired payload size in the response from the server. + // If response_type is COMPRESSABLE, this denotes the size before compression. + int32 response_size = 2; + + // Optional input payload sent along with the request. + Payload payload = 3; + + // Whether SimpleResponse should include username. + bool fill_username = 4; + + // Whether SimpleResponse should include OAuth scope. + bool fill_oauth_scope = 5; +} + +// Unary response, as configured by the request. +message SimpleResponse { + // Payload to increase message size. + Payload payload = 1; + // The user the request came from, for verifying authentication was + // successful when the client expected it. + string username = 2; + // OAuth scope. + string oauth_scope = 3; +} + +// Client-streaming request. +message StreamingInputCallRequest { + // Optional input payload sent along with the request. + Payload payload = 1; + + // Not expecting any payload from the response. +} + +// Client-streaming response. +message StreamingInputCallResponse { + // Aggregated size of payloads received from the client. + int32 aggregated_payload_size = 1; +} + +// Configuration for a particular response. +message ResponseParameters { + // Desired payload sizes in responses from the server. + // If response_type is COMPRESSABLE, this denotes the size before compression. + int32 size = 1; + + // Desired interval between consecutive responses in the response stream in + // microseconds. + int32 interval_us = 2; +} + +// Server-streaming request. +message StreamingOutputCallRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, the payload from each response in the stream + // might be of different types. This is to simulate a mixed type of payload + // stream. + PayloadType response_type = 1; + + // Configuration for each expected response message. + repeated ResponseParameters response_parameters = 2; + + // Optional input payload sent along with the request. + Payload payload = 3; +} + +// Server-streaming response, as configured by the request and parameters. +message StreamingOutputCallResponse { + // Payload to increase response size. + Payload payload = 1; +} diff --git a/src/objective-c/examples/SwiftSample/test.proto b/src/objective-c/examples/SwiftSample/test.proto new file mode 100644 index 00000000000..c5696043630 --- /dev/null +++ b/src/objective-c/examples/SwiftSample/test.proto @@ -0,0 +1,57 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +syntax = "proto3"; + +import "google/protobuf/empty.proto"; +import "messages.proto"; + +package grpc.testing; + +option objc_class_prefix = "RMT"; + +// A simple service to test the various types of RPCs and experiment with +// performance with various types of payload. +service TestService { + // One empty request followed by one empty response. + rpc EmptyCall(google.protobuf.Empty) returns (google.protobuf.Empty); + + // One request followed by one response. + rpc UnaryCall(SimpleRequest) returns (SimpleResponse); + + // One request followed by a sequence of responses (streamed download). + // The server returns the payload with client desired type and sizes. + rpc StreamingOutputCall(StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); + + // A sequence of requests followed by one response (streamed upload). + // The server returns the aggregated size of client payload as the result. + rpc StreamingInputCall(stream StreamingInputCallRequest) + returns (StreamingInputCallResponse); + + // A sequence of requests with each request served by the server immediately. + // As one request could lead to multiple responses, this interface + // demonstrates the idea of full duplexing. + rpc FullDuplexCall(stream StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); + + // A sequence of requests followed by a sequence of responses. + // The server buffers all the client requests and then serves them in order. A + // stream of responses are returned to the client when the server starts with + // first request. + rpc HalfDuplexCall(stream StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); +} diff --git a/src/objective-c/tests/InteropTests/InteropTests.m b/src/objective-c/tests/InteropTests/InteropTests.m index 3260e918f2f..ae5651651e0 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.m +++ b/src/objective-c/tests/InteropTests/InteropTests.m @@ -30,9 +30,9 @@ #import #import #import -#import -#import -#import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" #import #import #import diff --git a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m index 14ba2871aa2..44bd5ab3924 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m +++ b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m @@ -21,9 +21,9 @@ #ifdef GRPC_COMPILE_WITH_CRONET #import #endif -#import -#import -#import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" #import #import "../ConfigureCronet.h" diff --git a/src/objective-c/tests/MacTests/StressTests.m b/src/objective-c/tests/MacTests/StressTests.m index 3c6ecd52610..8421d48e108 100644 --- a/src/objective-c/tests/MacTests/StressTests.m +++ b/src/objective-c/tests/MacTests/StressTests.m @@ -21,9 +21,9 @@ #import #import #import -#import -#import -#import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" #import #import #import diff --git a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec index 93b56d56059..60727d4d94e 100644 --- a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec @@ -27,9 +27,9 @@ Pod::Spec.new do |s| --plugin=protoc-gen-grpc=#{plugin} \ --objc_out=. \ --grpc_out=. \ - -I . \ + -I #{repo_root} \ -I #{well_known_types_dir} \ - *.proto + #{repo_root}/src/objective-c/tests/RemoteTestClient/*.proto else # protoc was not found bin_dir, use installed version instead (>&2 echo "\nWARNING: Using installed version of protoc. It might be incompatible with gRPC") @@ -38,21 +38,21 @@ Pod::Spec.new do |s| --plugin=protoc-gen-grpc=#{plugin} \ --objc_out=. \ --grpc_out=. \ - -I . \ + -I #{repo_root} \ -I #{well_known_types_dir} \ - *.proto + #{repo_root}/src/objective-c/tests/RemoteTestClient/*.proto fi CMD s.subspec "Messages" do |ms| - ms.source_files = "*.pbobjc.{h,m}" + ms.source_files = "**/*.pbobjc.{h,m}" ms.header_mappings_dir = "." ms.requires_arc = false ms.dependency "Protobuf" end s.subspec "Services" do |ss| - ss.source_files = "*.pbrpc.{h,m}" + ss.source_files = "**/*.pbrpc.{h,m}" ss.header_mappings_dir = "." ss.requires_arc = true ss.dependency "gRPC-ProtoRPC" diff --git a/src/objective-c/tests/RemoteTestClient/test.proto b/src/objective-c/tests/RemoteTestClient/test.proto index c5696043630..6931600edc0 100644 --- a/src/objective-c/tests/RemoteTestClient/test.proto +++ b/src/objective-c/tests/RemoteTestClient/test.proto @@ -17,7 +17,7 @@ syntax = "proto3"; import "google/protobuf/empty.proto"; -import "messages.proto"; +import "src/objective-c/tests/RemoteTestClient/messages.proto"; package grpc.testing; diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 737d52b547d..578970f4271 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 01574004C238BE75F6A7651D /* libPods-MacTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B6E36AF835D0DC279DC0C18 /* libPods-MacTests.a */; }; + 3E8DD339E611E92DCE8A5A48 /* libPods-CronetTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2067DD4BEA93EFB61A753183 /* libPods-CronetTests.a */; }; 5E0282E9215AA697007AC99D /* NSErrorUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0282E8215AA697007AC99D /* NSErrorUnitTests.m */; }; 5E3F14842278B461007C6D90 /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; 5E3F14852278BF5D007C6D90 /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; @@ -34,62 +36,24 @@ 5EA4770322736178000F72FC /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; }; 5EA477042273617B000F72FC /* InteropTestsLocalCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */; }; 5EA4770522736AC4000F72FC /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; - 65EB19E418B39A8374D407BB /* libPods-CronetTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B1511C20E16A8422B58D61A /* libPods-CronetTests.a */; }; - 903163C7FE885838580AEC7A /* libPods-InteropTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D457AD9797664CFA191C3280 /* libPods-InteropTests.a */; }; - 953CD2942A3A6D6CE695BE87 /* libPods-MacTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 276873A05AC5479B60DF6079 /* libPods-MacTests.a */; }; + 80EA8F48AFAA5E3D758AC3D5 /* libPods-UnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D4287E190CCD0CACC3F2CC3 /* libPods-UnitTests.a */; }; B071230B22669EED004B64A1 /* StressTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B071230A22669EED004B64A1 /* StressTests.m */; }; B0BB3F08225E7ABA008DA580 /* NSErrorUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0282E8215AA697007AC99D /* NSErrorUnitTests.m */; }; B0BB3F0A225EA511008DA580 /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; B0D39B9A2266F3CB00A4078D /* StressTestsSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = B0D39B992266F3CB00A4078D /* StressTestsSSL.m */; }; B0D39B9C2266FF9800A4078D /* StressTestsCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = B0D39B9B2266FF9800A4078D /* StressTestsCleartext.m */; }; - CCF5C0719EF608276AE16374 /* libPods-UnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22A3EBB488699C8CEA19707B /* libPods-UnitTests.a */; }; + C8217D49007E8E4693F058B1 /* libPods-InteropTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DD0F486470BDFF1E1E4943B8 /* libPods-InteropTests.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 02192CF1FF9534E3D18C65FC /* Pods-CronetUnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetUnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests.release.xcconfig"; sourceTree = ""; }; - 070266E2626EB997B54880A3 /* Pods-InteropTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTests/Pods-InteropTests.test.xcconfig"; sourceTree = ""; }; - 07D10A965323BEA7FE59A74B /* Pods-RxLibraryUnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.debug.xcconfig"; sourceTree = ""; }; - 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; - 0BDA4BA011779D5D25B5618C /* libPods-InteropTestsLocalCleartextCFStream.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsLocalCleartextCFStream.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 0D2284C3DF7E57F0ED504E39 /* Pods-CoreCronetEnd2EndTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreCronetEnd2EndTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests.debug.xcconfig"; sourceTree = ""; }; - 1286B30AD74CB64CD91FB17D /* Pods-APIv2Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-APIv2Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-APIv2Tests/Pods-APIv2Tests.debug.xcconfig"; sourceTree = ""; }; - 1295CCBD1082B4A7CFCED95F /* Pods-InteropTestsMultipleChannels.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsMultipleChannels.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsMultipleChannels/Pods-InteropTestsMultipleChannels.cronet.xcconfig"; sourceTree = ""; }; - 12B238CD1702393C2BA5DE80 /* Pods-APIv2Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-APIv2Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-APIv2Tests/Pods-APIv2Tests.release.xcconfig"; sourceTree = ""; }; - 14B09A58FEE53A7A6B838920 /* Pods-InteropTestsLocalSSL.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.cronet.xcconfig"; sourceTree = ""; }; - 1588C85DEAF7FC0ACDEA4C02 /* Pods-InteropTestsLocalCleartext.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.test.xcconfig"; sourceTree = ""; }; - 16A2E4C5839C83FBDA63881F /* Pods-MacTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-MacTests/Pods-MacTests.cronet.xcconfig"; sourceTree = ""; }; - 17F60BF2871F6AF85FB3FA12 /* Pods-InteropTestsRemoteWithCronet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.debug.xcconfig"; sourceTree = ""; }; - 1B1511C20E16A8422B58D61A /* libPods-CronetTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CronetTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 1E43EAE443CBB4482B1EB071 /* Pods-MacTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-MacTests/Pods-MacTests.release.xcconfig"; sourceTree = ""; }; - 1F5E788FBF9A4A06EB9E1ACD /* Pods-MacTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-MacTests/Pods-MacTests.test.xcconfig"; sourceTree = ""; }; - 20DFF2F3C97EF098FE5A3171 /* libPods-Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 20F6A3D59D0EE091E2D43953 /* Pods-CronetTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.cronet.xcconfig"; sourceTree = ""; }; - 22A3EBB488699C8CEA19707B /* libPods-UnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-UnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2650FEF00956E7924772F9D9 /* Pods-InteropTestsMultipleChannels.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsMultipleChannels.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsMultipleChannels/Pods-InteropTestsMultipleChannels.release.xcconfig"; sourceTree = ""; }; - 276873A05AC5479B60DF6079 /* libPods-MacTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MacTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2B89F3037963E6EDDD48D8C3 /* Pods-InteropTestsRemoteWithCronet.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.test.xcconfig"; sourceTree = ""; }; - 303F4A17EB1650FC44603D17 /* Pods-InteropTestsRemoteCFStream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.release.xcconfig"; sourceTree = ""; }; - 32748C4078AEB05F8F954361 /* Pods-InteropTestsRemoteCFStream.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.debug.xcconfig"; sourceTree = ""; }; - 355D0E30AD224763BC9519F4 /* libPods-InteropTestsMultipleChannels.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsMultipleChannels.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 386712AEACF7C2190C4B8B3F /* Pods-CronetUnitTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetUnitTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests.cronet.xcconfig"; sourceTree = ""; }; - 3A98DF08852F60AF1D96481D /* Pods-InteropTestsCallOptions.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsCallOptions.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsCallOptions/Pods-InteropTestsCallOptions.debug.xcconfig"; sourceTree = ""; }; - 3B0861FC805389C52DB260D4 /* Pods-RxLibraryUnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.release.xcconfig"; sourceTree = ""; }; - 3CADF86203B9D03EA96C359D /* Pods-InteropTestsMultipleChannels.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsMultipleChannels.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsMultipleChannels/Pods-InteropTestsMultipleChannels.debug.xcconfig"; sourceTree = ""; }; - 3EB55EF291706E3DDE23C3B7 /* Pods-InteropTestsLocalSSLCFStream.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.debug.xcconfig"; sourceTree = ""; }; - 3F27B2E744482771EB93C394 /* Pods-InteropTestsRemoteWithCronet.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.cronet.xcconfig"; sourceTree = ""; }; - 41AA59529240A6BBBD3DB904 /* Pods-InteropTestsLocalSSLCFStream.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.test.xcconfig"; sourceTree = ""; }; - 48F1841C9A920626995DC28C /* libPods-ChannelTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ChannelTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 4A1A42B2E941CCD453489E5B /* Pods-InteropTestsRemoteCFStream.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.cronet.xcconfig"; sourceTree = ""; }; - 4AD97096D13D7416DC91A72A /* Pods-CoreCronetEnd2EndTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreCronetEnd2EndTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests.release.xcconfig"; sourceTree = ""; }; - 4ADEA1C8BBE10D90940AC68E /* Pods-InteropTestsRemote.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.cronet.xcconfig"; sourceTree = ""; }; - 51A275E86C141416ED63FF76 /* Pods-InteropTestsLocalCleartext.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.release.xcconfig"; sourceTree = ""; }; - 51F2A64B7AADBA1B225B132E /* Pods-APIv2Tests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-APIv2Tests.test.xcconfig"; path = "Pods/Target Support Files/Pods-APIv2Tests/Pods-APIv2Tests.test.xcconfig"; sourceTree = ""; }; - 553BBBED24E4162D1F769D65 /* Pods-InteropTestsLocalSSL.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.debug.xcconfig"; sourceTree = ""; }; - 55B630C1FF8C36D1EFC4E0A4 /* Pods-InteropTestsLocalSSLCFStream.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.cronet.xcconfig"; sourceTree = ""; }; - 573450F334B331D0BED8B961 /* Pods-CoreCronetEnd2EndTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreCronetEnd2EndTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests.cronet.xcconfig"; sourceTree = ""; }; - 5761E98978DDDF136A58CB7E /* Pods-AllTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.release.xcconfig"; sourceTree = ""; }; - 5AB9A82F289D548D6B8816F9 /* Pods-CronetTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.test.xcconfig"; sourceTree = ""; }; + 16B9B1262FE6FBFC353B62BB /* Pods-InteropTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.cronet.xcconfig"; path = "Target Support Files/Pods-InteropTests/Pods-InteropTests.cronet.xcconfig"; sourceTree = ""; }; + 2067DD4BEA93EFB61A753183 /* libPods-CronetTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CronetTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 2D4287E190CCD0CACC3F2CC3 /* libPods-UnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-UnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 42DF8A339EF81AFE13553D04 /* Pods-InteropTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.release.xcconfig"; path = "Target Support Files/Pods-InteropTests/Pods-InteropTests.release.xcconfig"; sourceTree = ""; }; + 4A76E027206C07B7DBECB301 /* Pods-UnitTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.cronet.xcconfig"; path = "Target Support Files/Pods-UnitTests/Pods-UnitTests.cronet.xcconfig"; sourceTree = ""; }; + 5287652093398BAA7C5A90E8 /* Pods-MacTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.release.xcconfig"; path = "Target Support Files/Pods-MacTests/Pods-MacTests.release.xcconfig"; sourceTree = ""; }; + 55BBF7900C93644CD8236BD2 /* Pods-CronetTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.test.xcconfig"; path = "Target Support Files/Pods-CronetTests/Pods-CronetTests.test.xcconfig"; sourceTree = ""; }; + 5CF07AAE0442D200BCD81ABC /* Pods-InteropTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.test.xcconfig"; path = "Target Support Files/Pods-InteropTests/Pods-InteropTests.test.xcconfig"; sourceTree = ""; }; 5E0282E6215AA697007AC99D /* UnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 5E0282E8215AA697007AC99D /* NSErrorUnitTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSErrorUnitTests.m; sourceTree = ""; }; 5E3F14822278B42D007C6D90 /* InteropTestsBlockCallbacks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InteropTestsBlockCallbacks.h; sourceTree = ""; }; @@ -109,7 +73,6 @@ 5E7F488822778B04006656AD /* InteropTestsRemote.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InteropTestsRemote.m; sourceTree = ""; }; 5E7F488A22778B5D006656AD /* RxLibraryUnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RxLibraryUnitTests.m; sourceTree = ""; }; 5EA476F42272816A000F72FC /* InteropTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InteropTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 5EA908CF4CDA4CE218352A06 /* Pods-InteropTestsLocalSSLCFStream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.release.xcconfig"; sourceTree = ""; }; 5EAD6D261E27047400002378 /* CronetUnitTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = CronetUnitTests.mm; path = CronetTests/CronetUnitTests.mm; sourceTree = SOURCE_ROOT; }; 5EAFE8271F8EFB87007F2189 /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; 5EE84BF31D4717E40050C6CC /* InteropTestsRemoteWithCronet.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = InteropTestsRemoteWithCronet.m; path = CronetTests/InteropTestsRemoteWithCronet.m; sourceTree = SOURCE_ROOT; }; @@ -117,66 +80,24 @@ 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InteropTestsLocalCleartext.m; path = InteropTests/InteropTestsLocalCleartext.m; sourceTree = SOURCE_ROOT; }; 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InteropTestsLocalSSL.m; path = InteropTests/InteropTestsLocalSSL.m; sourceTree = SOURCE_ROOT; }; 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = TestCertificates.bundle; sourceTree = ""; }; - 64F68A9A6A63CC930DD30A6E /* Pods-CronetUnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetUnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests.debug.xcconfig"; sourceTree = ""; }; - 6793C9D019CB268C5BB491A2 /* Pods-CoreCronetEnd2EndTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreCronetEnd2EndTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests.test.xcconfig"; sourceTree = ""; }; - 680439AC2BC8761EDD54A1EA /* Pods-InteropTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTests/Pods-InteropTests.debug.xcconfig"; sourceTree = ""; }; - 73D2DF07027835BA0FB0B1C0 /* Pods-InteropTestsCallOptions.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsCallOptions.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsCallOptions/Pods-InteropTestsCallOptions.cronet.xcconfig"; sourceTree = ""; }; - 781089FAE980F51F88A3BE0B /* Pods-RxLibraryUnitTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.test.xcconfig"; sourceTree = ""; }; - 79C68EFFCB5533475D810B79 /* Pods-RxLibraryUnitTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.cronet.xcconfig"; sourceTree = ""; }; - 7A2E97E3F469CC2A758D77DE /* Pods-InteropTestsLocalSSL.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.release.xcconfig"; sourceTree = ""; }; - 7BA53C6D224288D5870FE6F3 /* Pods-InteropTestsLocalCleartextCFStream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.release.xcconfig"; sourceTree = ""; }; - 7F4F42EBAF311E9F84FCA32E /* Pods-CronetTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.release.xcconfig"; sourceTree = ""; }; - 8B498B05C6DA0818B2FA91D4 /* Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig"; sourceTree = ""; }; - 8C233E85C3EB45B3CAE52EDF /* Pods-APIv2Tests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-APIv2Tests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-APIv2Tests/Pods-APIv2Tests.cronet.xcconfig"; sourceTree = ""; }; - 90E63AD3C4A1E3E6BC745096 /* Pods-ChannelTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ChannelTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-ChannelTests/Pods-ChannelTests.cronet.xcconfig"; sourceTree = ""; }; - 943138072A9605B5B8DC1FC0 /* Pods-InteropTestsLocalCleartextCFStream.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.debug.xcconfig"; sourceTree = ""; }; - 94D7A5FAA13480E9A5166D7A /* Pods-UnitTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests.test.xcconfig"; sourceTree = ""; }; - 9E9444C764F0FFF64A7EB58E /* libPods-InteropTestsRemoteWithCronet.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsRemoteWithCronet.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - A25967A0D40ED14B3287AD81 /* Pods-InteropTestsCallOptions.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsCallOptions.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsCallOptions/Pods-InteropTestsCallOptions.test.xcconfig"; sourceTree = ""; }; - A2DCF2570BE515B62CB924CA /* Pods-UnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests.debug.xcconfig"; sourceTree = ""; }; - A58BE6DF1C62D1739EBB2C78 /* libPods-RxLibraryUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RxLibraryUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - A6F832FCEFA6F6881E620F12 /* Pods-InteropTestsRemote.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.test.xcconfig"; sourceTree = ""; }; - AA7CB64B4DD9915AE7C03163 /* Pods-InteropTestsLocalCleartext.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.cronet.xcconfig"; sourceTree = ""; }; - AC414EF7A6BF76ED02B6E480 /* Pods-InteropTestsRemoteWithCronet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.release.xcconfig"; sourceTree = ""; }; - AF3FC2CFFE7B0961823BC740 /* libPods-InteropTestsCallOptions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsCallOptions.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 6B6E36AF835D0DC279DC0C18 /* libPods-MacTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MacTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 7612BA4B2A55BC4F508570C2 /* Pods-MacTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.cronet.xcconfig"; path = "Target Support Files/Pods-MacTests/Pods-MacTests.cronet.xcconfig"; sourceTree = ""; }; + 936ADE0FD98D66144C935C37 /* Pods-UnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.debug.xcconfig"; path = "Target Support Files/Pods-UnitTests/Pods-UnitTests.debug.xcconfig"; sourceTree = ""; }; + 9AEB5A4889D2018866BE6050 /* Pods-CronetTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.debug.xcconfig"; path = "Target Support Files/Pods-CronetTests/Pods-CronetTests.debug.xcconfig"; sourceTree = ""; }; + 9E48AF01E76B19FAAAACAE23 /* Pods-UnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.release.xcconfig"; path = "Target Support Files/Pods-UnitTests/Pods-UnitTests.release.xcconfig"; sourceTree = ""; }; B071230A22669EED004B64A1 /* StressTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StressTests.m; sourceTree = ""; }; B0BB3EF7225E795F008DA580 /* MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MacTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; B0BB3EFB225E795F008DA580 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; B0C5FC172267C77200F192BE /* StressTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StressTests.h; sourceTree = ""; }; B0D39B992266F3CB00A4078D /* StressTestsSSL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StressTestsSSL.m; sourceTree = ""; }; B0D39B9B2266FF9800A4078D /* StressTestsCleartext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StressTestsCleartext.m; sourceTree = ""; }; - B226619DC4E709E0FFFF94B8 /* Pods-CronetUnitTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetUnitTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests.test.xcconfig"; sourceTree = ""; }; - B6AD69CACF67505B0F028E92 /* libPods-APIv2Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-APIv2Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - B94C27C06733CF98CE1B2757 /* Pods-AllTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.debug.xcconfig"; sourceTree = ""; }; - BED74BC8ABF9917C66175879 /* Pods-ChannelTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ChannelTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-ChannelTests/Pods-ChannelTests.test.xcconfig"; sourceTree = ""; }; - C17F57E5BCB989AB1C2F1F25 /* Pods-InteropTestsRemoteCFStream.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.test.xcconfig"; sourceTree = ""; }; - C6134277D2EB8B380862A03F /* libPods-CronetUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CronetUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - C9172F9020E8C97A470D7250 /* Pods-InteropTestsCallOptions.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsCallOptions.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsCallOptions/Pods-InteropTestsCallOptions.release.xcconfig"; sourceTree = ""; }; - CAE086D5B470DA367D415AB0 /* libPods-AllTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AllTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - CDF6CC70B8BF9D10EFE7D199 /* Pods-InteropTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTests/Pods-InteropTests.cronet.xcconfig"; sourceTree = ""; }; - D13BEC8181B8E678A1B52F54 /* Pods-InteropTestsLocalSSL.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.test.xcconfig"; sourceTree = ""; }; - D457AD9797664CFA191C3280 /* libPods-InteropTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - D52B92A7108602F170DA8091 /* Pods-ChannelTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ChannelTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ChannelTests/Pods-ChannelTests.release.xcconfig"; sourceTree = ""; }; - DB1F4391AF69D20D38D74B67 /* Pods-AllTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.test.xcconfig"; sourceTree = ""; }; - DBE059B4AC7A51919467EEC0 /* libPods-InteropTestsRemote.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsRemote.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - DBEDE45BDA60DF1E1C8950C0 /* libPods-InteropTestsLocalSSL.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsLocalSSL.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - DC3CA1D948F068E76957A861 /* Pods-InteropTestsRemote.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.debug.xcconfig"; sourceTree = ""; }; - E1486220285AF123EB124008 /* Pods-InteropTestsLocalCleartext.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.debug.xcconfig"; sourceTree = ""; }; - E1E7660656D902104F728892 /* Pods-UnitTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests.cronet.xcconfig"; sourceTree = ""; }; - E3ACD4D5902745976D9C2229 /* Pods-MacTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MacTests/Pods-MacTests.debug.xcconfig"; sourceTree = ""; }; - E4275A759BDBDF143B9B438F /* Pods-InteropTestsRemote.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.release.xcconfig"; sourceTree = ""; }; - E4FD4606D4AB8D5A314D72F0 /* Pods-InteropTestsLocalCleartextCFStream.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.test.xcconfig"; sourceTree = ""; }; - E7E4D3FD76E3B745D992AF5F /* Pods-AllTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.cronet.xcconfig"; sourceTree = ""; }; - EA8B122ACDE73E3AAA0E4A19 /* Pods-InteropTestsMultipleChannels.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsMultipleChannels.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsMultipleChannels/Pods-InteropTestsMultipleChannels.test.xcconfig"; sourceTree = ""; }; - EBFFEC04B514CB0D4922DC40 /* Pods-UnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests.release.xcconfig"; sourceTree = ""; }; - EC66920112123D2DB1CB7F6C /* Pods-CronetTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.debug.xcconfig"; sourceTree = ""; }; - F3AB031E0E26AC8EF30A2A2A /* libPods-InteropTestsLocalSSLCFStream.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsLocalSSLCFStream.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - F44AC3F44E3491A8C0D890FE /* libPods-InteropTestsRemoteCFStream.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsRemoteCFStream.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - F6A7EECACBB4849DDD3F450A /* Pods-InteropTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTests/Pods-InteropTests.release.xcconfig"; sourceTree = ""; }; - F9E48EF5ACB1F38825171C5F /* Pods-ChannelTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ChannelTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ChannelTests/Pods-ChannelTests.debug.xcconfig"; sourceTree = ""; }; - FBD98AC417B9882D32B19F28 /* libPods-CoreCronetEnd2EndTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CoreCronetEnd2EndTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - FD346DB2C23F676C4842F3FF /* libPods-InteropTestsLocalCleartext.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsLocalCleartext.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; + B3C890A1E6F082CD283069BF /* Pods-UnitTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.test.xcconfig"; path = "Target Support Files/Pods-UnitTests/Pods-UnitTests.test.xcconfig"; sourceTree = ""; }; + B43404F2B37A38483BE4704A /* Pods-CronetTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.cronet.xcconfig"; path = "Target Support Files/Pods-CronetTests/Pods-CronetTests.cronet.xcconfig"; sourceTree = ""; }; + BC5D3F3B5B38B71CA279AF7F /* Pods-MacTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.debug.xcconfig"; path = "Target Support Files/Pods-MacTests/Pods-MacTests.debug.xcconfig"; sourceTree = ""; }; + C56A093740F31650ACDD9630 /* Pods-InteropTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.debug.xcconfig"; path = "Target Support Files/Pods-InteropTests/Pods-InteropTests.debug.xcconfig"; sourceTree = ""; }; + DA532DBBE1BC0DC8EC879FE1 /* Pods-MacTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.test.xcconfig"; path = "Target Support Files/Pods-MacTests/Pods-MacTests.test.xcconfig"; sourceTree = ""; }; + DD0F486470BDFF1E1E4943B8 /* libPods-InteropTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + FF0A4B1F995C18C1EB86D155 /* Pods-CronetTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.release.xcconfig"; path = "Target Support Files/Pods-CronetTests/Pods-CronetTests.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -184,7 +105,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - CCF5C0719EF608276AE16374 /* libPods-UnitTests.a in Frameworks */, + 80EA8F48AFAA5E3D758AC3D5 /* libPods-UnitTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -192,7 +113,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 65EB19E418B39A8374D407BB /* libPods-CronetTests.a in Frameworks */, + 3E8DD339E611E92DCE8A5A48 /* libPods-CronetTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -200,7 +121,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 903163C7FE885838580AEC7A /* libPods-InteropTests.a in Frameworks */, + C8217D49007E8E4693F058B1 /* libPods-InteropTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -208,7 +129,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 953CD2942A3A6D6CE695BE87 /* libPods-MacTests.a in Frameworks */, + 01574004C238BE75F6A7651D /* libPods-MacTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -219,116 +140,14 @@ isa = PBXGroup; children = ( 5E7F486622776AD8006656AD /* Cronet.framework */, - 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */, - CAE086D5B470DA367D415AB0 /* libPods-AllTests.a */, - FD346DB2C23F676C4842F3FF /* libPods-InteropTestsLocalCleartext.a */, - DBEDE45BDA60DF1E1C8950C0 /* libPods-InteropTestsLocalSSL.a */, - DBE059B4AC7A51919467EEC0 /* libPods-InteropTestsRemote.a */, - A58BE6DF1C62D1739EBB2C78 /* libPods-RxLibraryUnitTests.a */, - 20DFF2F3C97EF098FE5A3171 /* libPods-Tests.a */, - FBD98AC417B9882D32B19F28 /* libPods-CoreCronetEnd2EndTests.a */, - 9E9444C764F0FFF64A7EB58E /* libPods-InteropTestsRemoteWithCronet.a */, - C6134277D2EB8B380862A03F /* libPods-CronetUnitTests.a */, - F44AC3F44E3491A8C0D890FE /* libPods-InteropTestsRemoteCFStream.a */, - 0BDA4BA011779D5D25B5618C /* libPods-InteropTestsLocalCleartextCFStream.a */, - F3AB031E0E26AC8EF30A2A2A /* libPods-InteropTestsLocalSSLCFStream.a */, - 48F1841C9A920626995DC28C /* libPods-ChannelTests.a */, - 355D0E30AD224763BC9519F4 /* libPods-InteropTestsMultipleChannels.a */, - AF3FC2CFFE7B0961823BC740 /* libPods-InteropTestsCallOptions.a */, - 22A3EBB488699C8CEA19707B /* libPods-UnitTests.a */, - B6AD69CACF67505B0F028E92 /* libPods-APIv2Tests.a */, - 276873A05AC5479B60DF6079 /* libPods-MacTests.a */, - D457AD9797664CFA191C3280 /* libPods-InteropTests.a */, - 1B1511C20E16A8422B58D61A /* libPods-CronetTests.a */, + 2067DD4BEA93EFB61A753183 /* libPods-CronetTests.a */, + DD0F486470BDFF1E1E4943B8 /* libPods-InteropTests.a */, + 6B6E36AF835D0DC279DC0C18 /* libPods-MacTests.a */, + 2D4287E190CCD0CACC3F2CC3 /* libPods-UnitTests.a */, ); name = Frameworks; sourceTree = ""; }; - 51E4650F34F854F41FF053B3 /* Pods */ = { - isa = PBXGroup; - children = ( - FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */, - 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */, - B94C27C06733CF98CE1B2757 /* Pods-AllTests.debug.xcconfig */, - 5761E98978DDDF136A58CB7E /* Pods-AllTests.release.xcconfig */, - E1486220285AF123EB124008 /* Pods-InteropTestsLocalCleartext.debug.xcconfig */, - 51A275E86C141416ED63FF76 /* Pods-InteropTestsLocalCleartext.release.xcconfig */, - 553BBBED24E4162D1F769D65 /* Pods-InteropTestsLocalSSL.debug.xcconfig */, - 7A2E97E3F469CC2A758D77DE /* Pods-InteropTestsLocalSSL.release.xcconfig */, - DC3CA1D948F068E76957A861 /* Pods-InteropTestsRemote.debug.xcconfig */, - E4275A759BDBDF143B9B438F /* Pods-InteropTestsRemote.release.xcconfig */, - 07D10A965323BEA7FE59A74B /* Pods-RxLibraryUnitTests.debug.xcconfig */, - 3B0861FC805389C52DB260D4 /* Pods-RxLibraryUnitTests.release.xcconfig */, - 0D2284C3DF7E57F0ED504E39 /* Pods-CoreCronetEnd2EndTests.debug.xcconfig */, - 4AD97096D13D7416DC91A72A /* Pods-CoreCronetEnd2EndTests.release.xcconfig */, - 17F60BF2871F6AF85FB3FA12 /* Pods-InteropTestsRemoteWithCronet.debug.xcconfig */, - AC414EF7A6BF76ED02B6E480 /* Pods-InteropTestsRemoteWithCronet.release.xcconfig */, - E7E4D3FD76E3B745D992AF5F /* Pods-AllTests.cronet.xcconfig */, - 573450F334B331D0BED8B961 /* Pods-CoreCronetEnd2EndTests.cronet.xcconfig */, - AA7CB64B4DD9915AE7C03163 /* Pods-InteropTestsLocalCleartext.cronet.xcconfig */, - 14B09A58FEE53A7A6B838920 /* Pods-InteropTestsLocalSSL.cronet.xcconfig */, - 4ADEA1C8BBE10D90940AC68E /* Pods-InteropTestsRemote.cronet.xcconfig */, - 3F27B2E744482771EB93C394 /* Pods-InteropTestsRemoteWithCronet.cronet.xcconfig */, - 79C68EFFCB5533475D810B79 /* Pods-RxLibraryUnitTests.cronet.xcconfig */, - 64F68A9A6A63CC930DD30A6E /* Pods-CronetUnitTests.debug.xcconfig */, - 386712AEACF7C2190C4B8B3F /* Pods-CronetUnitTests.cronet.xcconfig */, - 02192CF1FF9534E3D18C65FC /* Pods-CronetUnitTests.release.xcconfig */, - DB1F4391AF69D20D38D74B67 /* Pods-AllTests.test.xcconfig */, - 6793C9D019CB268C5BB491A2 /* Pods-CoreCronetEnd2EndTests.test.xcconfig */, - B226619DC4E709E0FFFF94B8 /* Pods-CronetUnitTests.test.xcconfig */, - 1588C85DEAF7FC0ACDEA4C02 /* Pods-InteropTestsLocalCleartext.test.xcconfig */, - D13BEC8181B8E678A1B52F54 /* Pods-InteropTestsLocalSSL.test.xcconfig */, - A6F832FCEFA6F6881E620F12 /* Pods-InteropTestsRemote.test.xcconfig */, - 2B89F3037963E6EDDD48D8C3 /* Pods-InteropTestsRemoteWithCronet.test.xcconfig */, - 781089FAE980F51F88A3BE0B /* Pods-RxLibraryUnitTests.test.xcconfig */, - 32748C4078AEB05F8F954361 /* Pods-InteropTestsRemoteCFStream.debug.xcconfig */, - C17F57E5BCB989AB1C2F1F25 /* Pods-InteropTestsRemoteCFStream.test.xcconfig */, - 4A1A42B2E941CCD453489E5B /* Pods-InteropTestsRemoteCFStream.cronet.xcconfig */, - 303F4A17EB1650FC44603D17 /* Pods-InteropTestsRemoteCFStream.release.xcconfig */, - 943138072A9605B5B8DC1FC0 /* Pods-InteropTestsLocalCleartextCFStream.debug.xcconfig */, - E4FD4606D4AB8D5A314D72F0 /* Pods-InteropTestsLocalCleartextCFStream.test.xcconfig */, - 8B498B05C6DA0818B2FA91D4 /* Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig */, - 7BA53C6D224288D5870FE6F3 /* Pods-InteropTestsLocalCleartextCFStream.release.xcconfig */, - 3EB55EF291706E3DDE23C3B7 /* Pods-InteropTestsLocalSSLCFStream.debug.xcconfig */, - 41AA59529240A6BBBD3DB904 /* Pods-InteropTestsLocalSSLCFStream.test.xcconfig */, - 55B630C1FF8C36D1EFC4E0A4 /* Pods-InteropTestsLocalSSLCFStream.cronet.xcconfig */, - 5EA908CF4CDA4CE218352A06 /* Pods-InteropTestsLocalSSLCFStream.release.xcconfig */, - F9E48EF5ACB1F38825171C5F /* Pods-ChannelTests.debug.xcconfig */, - BED74BC8ABF9917C66175879 /* Pods-ChannelTests.test.xcconfig */, - 90E63AD3C4A1E3E6BC745096 /* Pods-ChannelTests.cronet.xcconfig */, - D52B92A7108602F170DA8091 /* Pods-ChannelTests.release.xcconfig */, - 3CADF86203B9D03EA96C359D /* Pods-InteropTestsMultipleChannels.debug.xcconfig */, - EA8B122ACDE73E3AAA0E4A19 /* Pods-InteropTestsMultipleChannels.test.xcconfig */, - 1295CCBD1082B4A7CFCED95F /* Pods-InteropTestsMultipleChannels.cronet.xcconfig */, - 2650FEF00956E7924772F9D9 /* Pods-InteropTestsMultipleChannels.release.xcconfig */, - 3A98DF08852F60AF1D96481D /* Pods-InteropTestsCallOptions.debug.xcconfig */, - A25967A0D40ED14B3287AD81 /* Pods-InteropTestsCallOptions.test.xcconfig */, - 73D2DF07027835BA0FB0B1C0 /* Pods-InteropTestsCallOptions.cronet.xcconfig */, - C9172F9020E8C97A470D7250 /* Pods-InteropTestsCallOptions.release.xcconfig */, - A2DCF2570BE515B62CB924CA /* Pods-UnitTests.debug.xcconfig */, - 94D7A5FAA13480E9A5166D7A /* Pods-UnitTests.test.xcconfig */, - E1E7660656D902104F728892 /* Pods-UnitTests.cronet.xcconfig */, - EBFFEC04B514CB0D4922DC40 /* Pods-UnitTests.release.xcconfig */, - 1286B30AD74CB64CD91FB17D /* Pods-APIv2Tests.debug.xcconfig */, - 51F2A64B7AADBA1B225B132E /* Pods-APIv2Tests.test.xcconfig */, - 8C233E85C3EB45B3CAE52EDF /* Pods-APIv2Tests.cronet.xcconfig */, - 12B238CD1702393C2BA5DE80 /* Pods-APIv2Tests.release.xcconfig */, - E3ACD4D5902745976D9C2229 /* Pods-MacTests.debug.xcconfig */, - 1F5E788FBF9A4A06EB9E1ACD /* Pods-MacTests.test.xcconfig */, - 16A2E4C5839C83FBDA63881F /* Pods-MacTests.cronet.xcconfig */, - 1E43EAE443CBB4482B1EB071 /* Pods-MacTests.release.xcconfig */, - 680439AC2BC8761EDD54A1EA /* Pods-InteropTests.debug.xcconfig */, - 070266E2626EB997B54880A3 /* Pods-InteropTests.test.xcconfig */, - CDF6CC70B8BF9D10EFE7D199 /* Pods-InteropTests.cronet.xcconfig */, - F6A7EECACBB4849DDD3F450A /* Pods-InteropTests.release.xcconfig */, - EC66920112123D2DB1CB7F6C /* Pods-CronetTests.debug.xcconfig */, - 5AB9A82F289D548D6B8816F9 /* Pods-CronetTests.test.xcconfig */, - 20F6A3D59D0EE091E2D43953 /* Pods-CronetTests.cronet.xcconfig */, - 7F4F42EBAF311E9F84FCA32E /* Pods-CronetTests.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; 5E0282E7215AA697007AC99D /* UnitTests */ = { isa = PBXGroup; children = ( @@ -377,8 +196,8 @@ B0BB3EF8225E795F008DA580 /* MacTests */, 5E7F485A22775B15006656AD /* CronetTests */, 635697C81B14FC11007A7283 /* Products */, - 51E4650F34F854F41FF053B3 /* Pods */, 136D535E19727099B941D7B1 /* Frameworks */, + E549E472D8DBE9DD5C7D6247 /* Pods */, ); sourceTree = ""; }; @@ -424,6 +243,30 @@ path = MacTests; sourceTree = ""; }; + E549E472D8DBE9DD5C7D6247 /* Pods */ = { + isa = PBXGroup; + children = ( + 9AEB5A4889D2018866BE6050 /* Pods-CronetTests.debug.xcconfig */, + 55BBF7900C93644CD8236BD2 /* Pods-CronetTests.test.xcconfig */, + B43404F2B37A38483BE4704A /* Pods-CronetTests.cronet.xcconfig */, + FF0A4B1F995C18C1EB86D155 /* Pods-CronetTests.release.xcconfig */, + C56A093740F31650ACDD9630 /* Pods-InteropTests.debug.xcconfig */, + 5CF07AAE0442D200BCD81ABC /* Pods-InteropTests.test.xcconfig */, + 16B9B1262FE6FBFC353B62BB /* Pods-InteropTests.cronet.xcconfig */, + 42DF8A339EF81AFE13553D04 /* Pods-InteropTests.release.xcconfig */, + BC5D3F3B5B38B71CA279AF7F /* Pods-MacTests.debug.xcconfig */, + DA532DBBE1BC0DC8EC879FE1 /* Pods-MacTests.test.xcconfig */, + 7612BA4B2A55BC4F508570C2 /* Pods-MacTests.cronet.xcconfig */, + 5287652093398BAA7C5A90E8 /* Pods-MacTests.release.xcconfig */, + 936ADE0FD98D66144C935C37 /* Pods-UnitTests.debug.xcconfig */, + B3C890A1E6F082CD283069BF /* Pods-UnitTests.test.xcconfig */, + 4A76E027206C07B7DBECB301 /* Pods-UnitTests.cronet.xcconfig */, + 9E48AF01E76B19FAAAACAE23 /* Pods-UnitTests.release.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -431,11 +274,11 @@ isa = PBXNativeTarget; buildConfigurationList = 5E0282F2215AA697007AC99D /* Build configuration list for PBXNativeTarget "UnitTests" */; buildPhases = ( - F07941C0BAF6A7C67AA60C48 /* [CP] Check Pods Manifest.lock */, + 1C48C52EEA28609437176C56 /* [CP] Check Pods Manifest.lock */, 5E0282E2215AA697007AC99D /* Sources */, 5E0282E3215AA697007AC99D /* Frameworks */, 5E0282E4215AA697007AC99D /* Resources */, - 9AD0B5E94F2AA5962EA6AA36 /* [CP] Copy Pods Resources */, + 9D72085F3319466831FF534B /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -450,12 +293,12 @@ isa = PBXNativeTarget; buildConfigurationList = 5E7F485E22775B15006656AD /* Build configuration list for PBXNativeTarget "CronetTests" */; buildPhases = ( - CCAEC0F23E05489651A07D53 /* [CP] Check Pods Manifest.lock */, + A9802246E6D152C53B842F78 /* [CP] Check Pods Manifest.lock */, 5E7F485522775B15006656AD /* Sources */, 5E7F485622775B15006656AD /* Frameworks */, 5E7F485722775B15006656AD /* Resources */, - 292EA42A76AC7933A37235FD /* [CP] Embed Pods Frameworks */, - 30AFD6F6FC40B9923632A866 /* [CP] Copy Pods Resources */, + B112143D0A46BAE4E66475F8 /* [CP] Embed Pods Frameworks */, + 996BCBE3467BA6EA7FD49408 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -470,12 +313,12 @@ isa = PBXNativeTarget; buildConfigurationList = 5EA477002272816B000F72FC /* Build configuration list for PBXNativeTarget "InteropTests" */; buildPhases = ( - 40BCDB09674DF988C708D22B /* [CP] Check Pods Manifest.lock */, + 71F4FF8BADB6E545CD692B6C /* [CP] Check Pods Manifest.lock */, 5EA476F02272816A000F72FC /* Sources */, 5EA476F12272816A000F72FC /* Frameworks */, 5EA476F22272816A000F72FC /* Resources */, - D11CB94CF56A1E53760D29D8 /* [CP] Copy Pods Resources */, - 0FEFD5FC6B323AC95549AE4A /* [CP] Embed Pods Frameworks */, + E31E6BE4FCE4DD9487BBAD24 /* [CP] Embed Pods Frameworks */, + 4CC1D806002539B97E065D5A /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -490,11 +333,11 @@ isa = PBXNativeTarget; buildConfigurationList = B0BB3EFC225E795F008DA580 /* Build configuration list for PBXNativeTarget "MacTests" */; buildPhases = ( - E5B20F69559C6AE299DFEA7C /* [CP] Check Pods Manifest.lock */, + E180B0BE16D2B14B9071B2F8 /* [CP] Check Pods Manifest.lock */, B0BB3EF3225E795F008DA580 /* Sources */, B0BB3EF4225E795F008DA580 /* Frameworks */, B0BB3EF5225E795F008DA580 /* Resources */, - 452FDC3918FEC23ECAFD31EC /* [CP] Copy Pods Resources */, + 8694D2A1C7CEB7391B497CE0 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -587,49 +430,35 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 0FEFD5FC6B323AC95549AE4A /* [CP] Embed Pods Frameworks */ = { + 1C48C52EEA28609437176C56 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh", - "${PODS_ROOT}/CronetFramework/Cronet.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 292EA42A76AC7933A37235FD /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( + inputFileListPaths = ( ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-frameworks.sh", - "${PODS_ROOT}/CronetFramework/Cronet.framework", + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( ); - name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", + "$(DERIVED_FILE_DIR)/Pods-UnitTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 30AFD6F6FC40B9923632A866 /* [CP] Copy Pods Resources */ = { + 4CC1D806002539B97E065D5A /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh", + "${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-resources.sh", "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; @@ -638,10 +467,10 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 40BCDB09674DF988C708D22B /* [CP] Check Pods Manifest.lock */ = { + 71F4FF8BADB6E545CD692B6C /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -663,7 +492,7 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 452FDC3918FEC23ECAFD31EC /* [CP] Copy Pods Resources */ = { + 8694D2A1C7CEB7391B497CE0 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -681,7 +510,25 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MacTests/Pods-MacTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 9AD0B5E94F2AA5962EA6AA36 /* [CP] Copy Pods Resources */ = { + 996BCBE3467BA6EA7FD49408 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 9D72085F3319466831FF534B /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -699,7 +546,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-UnitTests/Pods-UnitTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - CCAEC0F23E05489651A07D53 /* [CP] Check Pods Manifest.lock */ = { + A9802246E6D152C53B842F78 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -721,25 +568,25 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - D11CB94CF56A1E53760D29D8 /* [CP] Copy Pods Resources */ = { + B112143D0A46BAE4E66475F8 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", + "${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-frameworks.sh", + "${PODS_ROOT}/CronetFramework/Cronet.framework", ); - name = "[CP] Copy Pods Resources"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - E5B20F69559C6AE299DFEA7C /* [CP] Check Pods Manifest.lock */ = { + E180B0BE16D2B14B9071B2F8 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -761,22 +608,22 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - F07941C0BAF6A7C67AA60C48 /* [CP] Check Pods Manifest.lock */ = { + E31E6BE4FCE4DD9487BBAD24 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", + "${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh", + "${PODS_ROOT}/CronetFramework/Cronet.framework", ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-UnitTests-checkManifestLockResult.txt", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -845,7 +692,7 @@ /* Begin XCBuildConfiguration section */ 5E0282EE215AA697007AC99D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A2DCF2570BE515B62CB924CA /* Pods-UnitTests.debug.xcconfig */; + baseConfigurationReference = 936ADE0FD98D66144C935C37 /* Pods-UnitTests.debug.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -876,7 +723,7 @@ }; 5E0282EF215AA697007AC99D /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 94D7A5FAA13480E9A5166D7A /* Pods-UnitTests.test.xcconfig */; + baseConfigurationReference = B3C890A1E6F082CD283069BF /* Pods-UnitTests.test.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -905,7 +752,7 @@ }; 5E0282F0215AA697007AC99D /* Cronet */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E1E7660656D902104F728892 /* Pods-UnitTests.cronet.xcconfig */; + baseConfigurationReference = 4A76E027206C07B7DBECB301 /* Pods-UnitTests.cronet.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -934,7 +781,7 @@ }; 5E0282F1215AA697007AC99D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = EBFFEC04B514CB0D4922DC40 /* Pods-UnitTests.release.xcconfig */; + baseConfigurationReference = 9E48AF01E76B19FAAAACAE23 /* Pods-UnitTests.release.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1010,7 +857,7 @@ }; 5E7F485F22775B15006656AD /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = EC66920112123D2DB1CB7F6C /* Pods-CronetTests.debug.xcconfig */; + baseConfigurationReference = 9AEB5A4889D2018866BE6050 /* Pods-CronetTests.debug.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1051,7 +898,7 @@ }; 5E7F486022775B15006656AD /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 5AB9A82F289D548D6B8816F9 /* Pods-CronetTests.test.xcconfig */; + baseConfigurationReference = 55BBF7900C93644CD8236BD2 /* Pods-CronetTests.test.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1089,7 +936,7 @@ }; 5E7F486122775B15006656AD /* Cronet */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 20F6A3D59D0EE091E2D43953 /* Pods-CronetTests.cronet.xcconfig */; + baseConfigurationReference = B43404F2B37A38483BE4704A /* Pods-CronetTests.cronet.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1127,7 +974,7 @@ }; 5E7F486222775B15006656AD /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7F4F42EBAF311E9F84FCA32E /* Pods-CronetTests.release.xcconfig */; + baseConfigurationReference = FF0A4B1F995C18C1EB86D155 /* Pods-CronetTests.release.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1165,7 +1012,7 @@ }; 5EA476FC2272816B000F72FC /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 680439AC2BC8761EDD54A1EA /* Pods-InteropTests.debug.xcconfig */; + baseConfigurationReference = C56A093740F31650ACDD9630 /* Pods-InteropTests.debug.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1200,7 +1047,7 @@ }; 5EA476FD2272816B000F72FC /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 070266E2626EB997B54880A3 /* Pods-InteropTests.test.xcconfig */; + baseConfigurationReference = 5CF07AAE0442D200BCD81ABC /* Pods-InteropTests.test.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1232,7 +1079,7 @@ }; 5EA476FE2272816B000F72FC /* Cronet */ = { isa = XCBuildConfiguration; - baseConfigurationReference = CDF6CC70B8BF9D10EFE7D199 /* Pods-InteropTests.cronet.xcconfig */; + baseConfigurationReference = 16B9B1262FE6FBFC353B62BB /* Pods-InteropTests.cronet.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1264,7 +1111,7 @@ }; 5EA476FF2272816B000F72FC /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = F6A7EECACBB4849DDD3F450A /* Pods-InteropTests.release.xcconfig */; + baseConfigurationReference = 42DF8A339EF81AFE13553D04 /* Pods-InteropTests.release.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1424,7 +1271,7 @@ }; B0BB3EFD225E795F008DA580 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E3ACD4D5902745976D9C2229 /* Pods-MacTests.debug.xcconfig */; + baseConfigurationReference = BC5D3F3B5B38B71CA279AF7F /* Pods-MacTests.debug.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1461,7 +1308,7 @@ }; B0BB3EFE225E795F008DA580 /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 1F5E788FBF9A4A06EB9E1ACD /* Pods-MacTests.test.xcconfig */; + baseConfigurationReference = DA532DBBE1BC0DC8EC879FE1 /* Pods-MacTests.test.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1504,7 +1351,7 @@ }; B0BB3EFF225E795F008DA580 /* Cronet */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 16A2E4C5839C83FBDA63881F /* Pods-MacTests.cronet.xcconfig */; + baseConfigurationReference = 7612BA4B2A55BC4F508570C2 /* Pods-MacTests.cronet.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1538,7 +1385,7 @@ }; B0BB3F00225E795F008DA580 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 1E43EAE443CBB4482B1EB071 /* Pods-MacTests.release.xcconfig */; + baseConfigurationReference = 5287652093398BAA7C5A90E8 /* Pods-MacTests.release.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; diff --git a/src/objective-c/tests/UnitTests/APIv2Tests.m b/src/objective-c/tests/UnitTests/APIv2Tests.m index db293750ca3..99c947e335b 100644 --- a/src/objective-c/tests/UnitTests/APIv2Tests.m +++ b/src/objective-c/tests/UnitTests/APIv2Tests.m @@ -18,7 +18,7 @@ #import #import -#import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" #import #include diff --git a/src/objective-c/tests/UnitTests/GRPCClientTests.m b/src/objective-c/tests/UnitTests/GRPCClientTests.m index bcd87c17b78..579f113eada 100644 --- a/src/objective-c/tests/UnitTests/GRPCClientTests.m +++ b/src/objective-c/tests/UnitTests/GRPCClientTests.m @@ -26,7 +26,7 @@ #import #import #import -#import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" #import #import #import From f78f3e4d6c712b92ff214b207c5221f3283a86e6 Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Wed, 24 Jul 2019 10:36:51 -0700 Subject: [PATCH 086/661] Re-format --- src/core/lib/iomgr/executor/mpmcqueue.cc | 2 +- src/core/lib/iomgr/executor/mpmcqueue.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/lib/iomgr/executor/mpmcqueue.cc b/src/core/lib/iomgr/executor/mpmcqueue.cc index 377a135e1f3..62226450a18 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.cc +++ b/src/core/lib/iomgr/executor/mpmcqueue.cc @@ -65,7 +65,7 @@ inline void* InfLenFIFOQueue::PopFront() { } InfLenFIFOQueue::Node* InfLenFIFOQueue::AllocateNodes(int num) { - num_nodes_ = num_nodes_ + num; + num_nodes_ = num_nodes_ + num; Node* new_chunk = static_cast(gpr_zalloc(sizeof(Node) * num)); new_chunk[0].next = &new_chunk[1]; new_chunk[num - 1].prev = &new_chunk[num - 2]; diff --git a/src/core/lib/iomgr/executor/mpmcqueue.h b/src/core/lib/iomgr/executor/mpmcqueue.h index 41e7e2a11be..0d44b7231d3 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.h +++ b/src/core/lib/iomgr/executor/mpmcqueue.h @@ -159,7 +159,7 @@ class InfLenFIFOQueue : public MPMCQueueInterface { Node* queue_head_ = nullptr; // Head of the queue, remove position Node* queue_tail_ = nullptr; // End of queue, insert position Atomic count_{0}; // Number of elements in queue - int num_nodes_ = 0; // Number of nodes allocated + int num_nodes_ = 0; // Number of nodes allocated Stats stats_; // Stats info gpr_timespec busy_time; // Start time of busy queue From d87b5285cab2959c65e8dc0ec6df120f3be3b1c3 Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Wed, 24 Jul 2019 13:33:24 -0700 Subject: [PATCH 087/661] Fix comment --- test/cpp/microbenchmarks/bm_threadpool.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_threadpool.cc b/test/cpp/microbenchmarks/bm_threadpool.cc index c800fadf9d0..8b83aa2ed28 100644 --- a/test/cpp/microbenchmarks/bm_threadpool.cc +++ b/test/cpp/microbenchmarks/bm_threadpool.cc @@ -40,7 +40,7 @@ class BlockingCounter { void DecrementCount() { std::lock_guard l(mu_); count_--; - if (count_ == 0) cv_.notify_one(); + if (count_ == 0) cv_.notify_all(); } void Wait() { @@ -70,7 +70,6 @@ class AddAnotherFunctor : public grpc_experimental_completion_queue_functor { internal_next = this; internal_success = 0; } - ~AddAnotherFunctor() {} // When the functor gets to run in thread pool, it will take itself as first // argument and internal_success as second one. static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { @@ -163,7 +162,7 @@ class SuicideFunctorForAdd : public grpc_experimental_completion_queue_functor { internal_next = this; internal_success = 0; } - ~SuicideFunctorForAdd() {} + static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { // On running, the first argument would be itself. auto* callback = static_cast(cb); @@ -215,10 +214,8 @@ class AddSelfFunctor : public grpc_experimental_completion_queue_functor { internal_next = this; internal_success = 0; } - ~AddSelfFunctor() {} - // When the functor gets to run in thread pool, it will take internal_next - // as first argument and internal_success as second one. Therefore, the - // first argument here would be the closure itself. + // When the functor gets to run in thread pool, it will take itself as first + // argument and internal_success as second one. static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { auto* callback = static_cast(cb); if (--callback->num_add_ > 0) { @@ -331,7 +328,6 @@ class ShortWorkFunctorForAdd internal_success = 0; val_ = 0; } - ~ShortWorkFunctorForAdd() {} static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { auto* callback = static_cast(cb); // Uses pad to avoid compiler complaining unused variable error. From e246a307d316b0468274b73b1b08cb277c888854 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 24 Jul 2019 13:36:31 -0700 Subject: [PATCH 088/661] more generator fix --- src/compiler/objective_c_generator.cc | 17 ++++++++++------- src/compiler/objective_c_plugin.cc | 22 ++++++++++++++-------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 5b2609f5b03..837113841a8 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -402,14 +402,17 @@ void PrintMethodImplementations(Printer* printer, } printer.Print("#pragma clang diagnostic pop\n\n"); + if (!generator_params.no_v1_compatibility) { + printer.Print( + "// Override superclass initializer to disallow different" + " package and service names.\n" + "- (instancetype)initWithHost:(NSString *)host\n" + " packageName:(NSString *)packageName\n" + " serviceName:(NSString *)serviceName {\n" + " return [self initWithHost:host];\n" + "}\n\n"); + } printer.Print( - "// Override superclass initializer to disallow different" - " package and service names.\n" - "- (instancetype)initWithHost:(NSString *)host\n" - " packageName:(NSString *)packageName\n" - " serviceName:(NSString *)serviceName {\n" - " return [self initWithHost:host];\n" - "}\n\n" "- (instancetype)initWithHost:(NSString *)host\n" " packageName:(NSString *)packageName\n" " serviceName:(NSString *)serviceName\n" diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index b46a50b81a1..21c68995cbb 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -105,17 +105,21 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string imports = LocalImport(file_name + ".pbobjc.h"); ::grpc::string system_imports = (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoService.h") : SystemImport("ProtoRPC/ProtoServiceLegacy.h")) + - (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoRPC.h") : SystemImport("ProtoRPC/ProtoRPCLegacy.h")) + - SystemImport("RxLibrary/GRXWriteable.h") + - SystemImport("RxLibrary/GRXWriter.h"); + (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoRPC.h") : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); + if (!generator_params.no_v1_compatibility) { + system_imports += SystemImport("RxLibrary/GRXWriteable.h") + + SystemImport("RxLibrary/GRXWriter.h"); + } ::grpc::string forward_declarations = - "@class GRPCProtoCall;\n" "@class GRPCUnaryProtoCall;\n" "@class GRPCStreamingProtoCall;\n" "@class GRPCCallOptions;\n" - "@protocol GRPCProtoResponseHandler;\n" - "\n"; + "@protocol GRPCProtoResponseHandler;\n"; + if (!generator_params.no_v1_compatibility) { + forward_declarations += "@class GRPCProtoCall;\n"; + } + forward_declarations += "\n"; ::grpc::string class_declarations = grpc_objective_c_generator::GetAllMessageClasses(file); @@ -159,8 +163,10 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string imports = LocalImport(file_name + ".pbrpc.h") + LocalImport(file_name + ".pbobjc.h") + - (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoRPC.h") : SystemImport("ProtoRPC/ProtoRPCLegacy.h")) + - SystemImport("RxLibrary/GRXWriter+Immediate.h"); + (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoRPC.h") : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); + if (!generator_params.no_v1_compatibility) { + imports += SystemImport("RxLibrary/GRXWriter+Immediate.h"); + } ::grpc::string class_imports; for (int i = 0; i < file->dependency_count(); i++) { From 32aad8a11c8726cb02b0551b6ae6dc4d07029a0b Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 24 Jul 2019 15:46:56 -0700 Subject: [PATCH 089/661] More fixes --- src/objective-c/GRPCClient/GRPCCall.m | 2 -- .../private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h | 2 +- .../private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m | 4 ++-- .../GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.h | 2 +- .../GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m | 4 ++-- src/objective-c/ProtoRPC/ProtoService.m | 5 +++++ 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 2f2a89c20ac..c62cb03ddd8 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -18,13 +18,11 @@ #import "GRPCCall.h" -#include #import "GRPCCallOptions.h" #import "GRPCInterceptor.h" #import "GRPCCall+Interceptor.h" #import "private/GRPCTransport+Private.h" -#import "private/GRPCCore/GRPCCoreFactory.h" NSString *const kGRPCHeadersKey = @"io.grpc.HeadersKey"; NSString *const kGRPCTrailersKey = @"io.grpc.TrailersKey"; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h index 8c781f4a448..f1ad1b05e44 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h @@ -16,7 +16,7 @@ * */ -#import "GRPCCoreFactory.h" +#import "../GRPCCoreFactory.h" @interface GRPCCoreCronetFactory : NSObject diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m index 661df006e57..0a19e31999e 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m @@ -21,8 +21,8 @@ #import #import -#import "GRPCCoreFactory.h" -#import "GRPCCallInternal.h" +#import "../GRPCCoreFactory.h" +#import "../GRPCCallInternal.h" #import "GRPCCronetChannelFactory.h" static GRPCCoreCronetFactory *gGRPCCoreCronetFactory = nil; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.h index 738dfdb7370..138ddf1f730 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.h @@ -15,7 +15,7 @@ * limitations under the License. * */ -#import "GRPCChannelFactory.h" +#import "../GRPCChannelFactory.h" @class GRPCChannel; typedef struct stream_engine stream_engine; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m index 8744d27e04f..da3f3afd855 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m @@ -18,8 +18,8 @@ #import "GRPCCronetChannelFactory.h" -#import "ChannelArgsUtil.h" -#import "GRPCChannel.h" +#import "../ChannelArgsUtil.h" +#import "../GRPCChannel.h" #import #include diff --git a/src/objective-c/ProtoRPC/ProtoService.m b/src/objective-c/ProtoRPC/ProtoService.m index 3a8417d0afa..c3684c8e2f2 100644 --- a/src/objective-c/ProtoRPC/ProtoService.m +++ b/src/objective-c/ProtoRPC/ProtoService.m @@ -32,9 +32,14 @@ GRPCCallOptions *_callOptions; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnonnull" +// Do not call the default init method - (instancetype)init { + [NSException raise:NSGenericException format:@"Do not call init method of ProtoService"]; return [self initWithHost:nil packageName:nil serviceName:nil callOptions:nil]; } +#pragma clang diasnostic pop // Designated initializer - (instancetype)initWithHost:(NSString *)host From 3ea28709148f0b9615d892eb44d3b394a7d2816e Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 24 Jul 2019 16:59:09 -0700 Subject: [PATCH 090/661] Config'd the projects so that they actually run on tvOS 10.0 and watchOS 4.0 Removed unnecessary code stubs --- .../tvOS-sample.xcodeproj/project.pbxproj | 5 +- .../tvOS-sample/tvOS-sample/AppDelegate.m | 36 ----- .../ExtensionDelegate.m | 58 -------- .../InterfaceController.m | 10 -- .../watchOS-sample.xcodeproj/project.pbxproj | 106 +++++++-------- .../watchOS-sample WatchKit App.xcscheme | 127 ++++++++++++++++++ .../xcschemes/watchOS-sample.xcscheme | 91 +++++++++++++ .../watchOS-sample/AppDelegate.m | 36 ----- .../watchOS-sample/ViewController.m | 5 - 9 files changed, 274 insertions(+), 200 deletions(-) create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample WatchKit App.xcscheme create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample.xcscheme diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj index 8840882b145..a19281242bd 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ @@ -48,7 +48,6 @@ D2D1C60CE9BD00C1371BC913 /* Pods-tvOS-sample.debug.xcconfig */, 93F3CF0DB110860F8E180685 /* Pods-tvOS-sample.release.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -352,6 +351,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-grpc-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 10.0; }; name = Debug; }; @@ -371,6 +371,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-grpc-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 10.0; }; name = Release; }; diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m index 11b6c418aee..4a76f4c488c 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m @@ -24,40 +24,4 @@ @implementation AppDelegate -- (BOOL)application:(UIApplication *)application - didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. - return YES; -} - -- (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for - // certain types of temporary interruptions (such as an incoming phone call or SMS message) or - // when the user quits the application and it begins the transition to the background state. Use - // this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. - // Games should use this method to pause the game. -} - -- (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store - // enough application state information to restore your application to its current state in case - // it is terminated later. If your application supports background execution, this method is - // called instead of applicationWillTerminate: when the user quits. -} - -- (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the active state; here you can undo - // many of the changes made on entering the background. -} - -- (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If - // the application was previously in the background, optionally refresh the user interface. -} - -- (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also - // applicationDidEnterBackground:. -} - @end diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.m b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.m index 5be441937b6..b64d60256de 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.m @@ -20,62 +20,4 @@ @implementation ExtensionDelegate -- (void)applicationDidFinishLaunching { - // Perform any final initialization of your application. -} - -- (void)applicationDidBecomeActive { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If - // the application was previously in the background, optionally refresh the user interface. -} - -- (void)applicationWillResignActive { - // Sent when the application is about to move from active to inactive state. This can occur for - // certain types of temporary interruptions (such as an incoming phone call or SMS message) or - // when the user quits the application and it begins the transition to the background state. Use - // this method to pause ongoing tasks, disable timers, etc. -} - -- (void)handleBackgroundTasks:(NSSet *)backgroundTasks { - // Sent when the system needs to launch the application in the background to process tasks. Tasks - // arrive in a set, so loop through and process each one. - for (WKRefreshBackgroundTask *task in backgroundTasks) { - // Check the Class of each task to decide how to process it - if ([task isKindOfClass:[WKApplicationRefreshBackgroundTask class]]) { - // Be sure to complete the background task once you’re done. - WKApplicationRefreshBackgroundTask *backgroundTask = - (WKApplicationRefreshBackgroundTask *)task; - [backgroundTask setTaskCompletedWithSnapshot:NO]; - } else if ([task isKindOfClass:[WKSnapshotRefreshBackgroundTask class]]) { - // Snapshot tasks have a unique completion call, make sure to set your expiration date - WKSnapshotRefreshBackgroundTask *snapshotTask = (WKSnapshotRefreshBackgroundTask *)task; - [snapshotTask setTaskCompletedWithDefaultStateRestored:YES - estimatedSnapshotExpiration:[NSDate distantFuture] - userInfo:nil]; - } else if ([task isKindOfClass:[WKWatchConnectivityRefreshBackgroundTask class]]) { - // Be sure to complete the background task once you’re done. - WKWatchConnectivityRefreshBackgroundTask *backgroundTask = - (WKWatchConnectivityRefreshBackgroundTask *)task; - [backgroundTask setTaskCompletedWithSnapshot:NO]; - } else if ([task isKindOfClass:[WKURLSessionRefreshBackgroundTask class]]) { - // Be sure to complete the background task once you’re done. - WKURLSessionRefreshBackgroundTask *backgroundTask = (WKURLSessionRefreshBackgroundTask *)task; - [backgroundTask setTaskCompletedWithSnapshot:NO]; - } else if ([task isKindOfClass:[WKRelevantShortcutRefreshBackgroundTask class]]) { - // Be sure to complete the relevant-shortcut task once you’re done. - WKRelevantShortcutRefreshBackgroundTask *relevantShortcutTask = - (WKRelevantShortcutRefreshBackgroundTask *)task; - [relevantShortcutTask setTaskCompletedWithSnapshot:NO]; - } else if ([task isKindOfClass:[WKIntentDidRunRefreshBackgroundTask class]]) { - // Be sure to complete the intent-did-run task once you’re done. - WKIntentDidRunRefreshBackgroundTask *intentDidRunTask = - (WKIntentDidRunRefreshBackgroundTask *)task; - [intentDidRunTask setTaskCompletedWithSnapshot:NO]; - } else { - // make sure to complete unhandled task types - [task setTaskCompletedWithSnapshot:NO]; - } - } -} - @end diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.m b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.m index 77efbc42447..d7f0c94adc9 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.m @@ -41,16 +41,6 @@ callOptions:_options]; } -- (void)willActivate { - // This method is called when watch view controller is about to be visible to user - [super willActivate]; -} - -- (void)didDeactivate { - // This method is called when watch view controller is no longer visible - [super didDeactivate]; -} - - (IBAction)makeCall { RMTSimpleRequest *request = [RMTSimpleRequest message]; request.responseSize = 100; diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj index 191bde5d9e0..9d40fc4b0cf 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj @@ -7,8 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 8C710D86B987697CC3B243A8 /* libPods-watchOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 56BDF7E8B01683A4EFDEC9CF /* libPods-watchOS-sample.a */; }; - 8F4EFFA8E14960D3C5BD0046 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 76AFD66D880975F945E377C9 /* libPods-watchOS-sample WatchKit Extension.a */; }; + 6CD34817C1124B7090EFB679 /* libPods-watchOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 81BB6B1D8754281EF32EB3F2 /* libPods-watchOS-sample.a */; }; ABB17D5922D93BAB00C26D6E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D5822D93BAB00C26D6E /* AppDelegate.m */; }; ABB17D5C22D93BAB00C26D6E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D5B22D93BAB00C26D6E /* ViewController.m */; }; ABB17D5F22D93BAB00C26D6E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D5D22D93BAB00C26D6E /* Main.storyboard */; }; @@ -22,6 +21,7 @@ ABB17D8022D93BAC00C26D6E /* InterfaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D7F22D93BAC00C26D6E /* InterfaceController.m */; }; ABB17D8322D93BAC00C26D6E /* ExtensionDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D8222D93BAC00C26D6E /* ExtensionDelegate.m */; }; ABB17D8522D93BAD00C26D6E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D8422D93BAD00C26D6E /* Assets.xcassets */; }; + CCC7943770AD2447C8F33431 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B9B6F1C6465A4AAC45CAF14 /* libPods-watchOS-sample WatchKit Extension.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -67,11 +67,10 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 0D53169393FEB36944484D25 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample WatchKit Extension.release.xcconfig"; path = "Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension.release.xcconfig"; sourceTree = ""; }; - 56BDF7E8B01683A4EFDEC9CF /* libPods-watchOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 76AFD66D880975F945E377C9 /* libPods-watchOS-sample WatchKit Extension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample WatchKit Extension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 7DB8462D385A70A534800DAF /* Pods-watchOS-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample.release.xcconfig"; path = "Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample.release.xcconfig"; sourceTree = ""; }; - 8C5540E3A034586596BEFE2B /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample WatchKit Extension.debug.xcconfig"; path = "Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension.debug.xcconfig"; sourceTree = ""; }; + 574DCD2DDCABCC45B2308601 /* Pods-watchOS-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample.debug.xcconfig"; path = "Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample.debug.xcconfig"; sourceTree = ""; }; + 5B9B6F1C6465A4AAC45CAF14 /* libPods-watchOS-sample WatchKit Extension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample WatchKit Extension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 81BB6B1D8754281EF32EB3F2 /* libPods-watchOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 957B59E3DE8281B41B6DB3FD /* Pods-watchOS-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample.release.xcconfig"; path = "Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample.release.xcconfig"; sourceTree = ""; }; ABB17D5422D93BAB00C26D6E /* watchOS-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "watchOS-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; ABB17D5722D93BAB00C26D6E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; ABB17D5822D93BAB00C26D6E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -93,7 +92,8 @@ ABB17D8222D93BAC00C26D6E /* ExtensionDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExtensionDelegate.m; sourceTree = ""; }; ABB17D8422D93BAD00C26D6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; ABB17D8622D93BAD00C26D6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - CC865626944D2C3DD838F762 /* Pods-watchOS-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample.debug.xcconfig"; path = "Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample.debug.xcconfig"; sourceTree = ""; }; + EDC6FF21CD9F393E8FDF02F6 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample WatchKit Extension.release.xcconfig"; path = "Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension.release.xcconfig"; sourceTree = ""; }; + FBBABD10A996E7CCA4B2F937 /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample WatchKit Extension.debug.xcconfig"; path = "Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -101,7 +101,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 8C710D86B987697CC3B243A8 /* libPods-watchOS-sample.a in Frameworks */, + 6CD34817C1124B7090EFB679 /* libPods-watchOS-sample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -109,7 +109,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 8F4EFFA8E14960D3C5BD0046 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */, + CCC7943770AD2447C8F33431 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -126,23 +126,14 @@ 2C4A0708747AAA7298F757DA /* Pods */ = { isa = PBXGroup; children = ( - CC865626944D2C3DD838F762 /* Pods-watchOS-sample.debug.xcconfig */, - 7DB8462D385A70A534800DAF /* Pods-watchOS-sample.release.xcconfig */, - 8C5540E3A034586596BEFE2B /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */, - 0D53169393FEB36944484D25 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */, + 574DCD2DDCABCC45B2308601 /* Pods-watchOS-sample.debug.xcconfig */, + 957B59E3DE8281B41B6DB3FD /* Pods-watchOS-sample.release.xcconfig */, + FBBABD10A996E7CCA4B2F937 /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */, + EDC6FF21CD9F393E8FDF02F6 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */, ); path = Pods; sourceTree = ""; }; - 589283F4A582EEF2434E0220 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 56BDF7E8B01683A4EFDEC9CF /* libPods-watchOS-sample.a */, - 76AFD66D880975F945E377C9 /* libPods-watchOS-sample WatchKit Extension.a */, - ); - name = Frameworks; - sourceTree = ""; - }; ABB17D4B22D93BAB00C26D6E = { isa = PBXGroup; children = ( @@ -151,7 +142,7 @@ ABB17D7D22D93BAC00C26D6E /* watchOS-sample-WatchKit-Extension */, ABB17D5522D93BAB00C26D6E /* Products */, 2C4A0708747AAA7298F757DA /* Pods */, - 589283F4A582EEF2434E0220 /* Frameworks */, + FDB2CA47351660A961DBE458 /* Frameworks */, ); sourceTree = ""; }; @@ -204,6 +195,15 @@ path = "watchOS-sample-WatchKit-Extension"; sourceTree = ""; }; + FDB2CA47351660A961DBE458 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 81BB6B1D8754281EF32EB3F2 /* libPods-watchOS-sample.a */, + 5B9B6F1C6465A4AAC45CAF14 /* libPods-watchOS-sample WatchKit Extension.a */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -211,12 +211,12 @@ isa = PBXNativeTarget; buildConfigurationList = ABB17D9122D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample" */; buildPhases = ( - 94316399D2F0BC04388E77B0 /* [CP] Check Pods Manifest.lock */, + C094DF31B83C380F13D80132 /* [CP] Check Pods Manifest.lock */, ABB17D5022D93BAB00C26D6E /* Sources */, ABB17D5122D93BAB00C26D6E /* Frameworks */, ABB17D5222D93BAB00C26D6E /* Resources */, ABB17D9022D93BAD00C26D6E /* Embed Watch Content */, - 1E38C9CB686CAEF71A5A25B7 /* [CP] Copy Pods Resources */, + E8B22C16C7C7397CEC79CCF6 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -250,11 +250,11 @@ isa = PBXNativeTarget; buildConfigurationList = ABB17D8922D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample WatchKit Extension" */; buildPhases = ( - 097AA61E20DEB1DB1E771FC9 /* [CP] Check Pods Manifest.lock */, + 370B91D5CA71A3A771721814 /* [CP] Check Pods Manifest.lock */, ABB17D7522D93BAC00C26D6E /* Sources */, ABB17D7622D93BAC00C26D6E /* Frameworks */, ABB17D7722D93BAC00C26D6E /* Resources */, - 8F82497BD93485F0621F0F30 /* [CP] Copy Pods Resources */, + DB65546E9DFC6EADD365E270 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -336,7 +336,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 097AA61E20DEB1DB1E771FC9 /* [CP] Check Pods Manifest.lock */ = { + 370B91D5CA71A3A771721814 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -358,24 +358,29 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 1E38C9CB686CAEF71A5A25B7 /* [CP] Copy Pods Resources */ = { + C094DF31B83C380F13D80132 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Copy Pods Resources"; + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-watchOS-sample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 8F82497BD93485F0621F0F30 /* [CP] Copy Pods Resources */ = { + DB65546E9DFC6EADD365E270 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -392,26 +397,21 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 94316399D2F0BC04388E77B0 /* [CP] Check Pods Manifest.lock */ = { + E8B22C16C7C7397CEC79CCF6 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-watchOS-sample-checkManifestLockResult.txt", + "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -593,7 +593,7 @@ }; ABB17D8A22D93BAD00C26D6E /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 8C5540E3A034586596BEFE2B /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */; + baseConfigurationReference = FBBABD10A996E7CCA4B2F937 /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; CODE_SIGN_STYLE = Automatic; @@ -609,13 +609,13 @@ SDKROOT = watchos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 4; - WATCHOS_DEPLOYMENT_TARGET = 5.1; + WATCHOS_DEPLOYMENT_TARGET = 4.0; }; name = Debug; }; ABB17D8B22D93BAD00C26D6E /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 0D53169393FEB36944484D25 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */; + baseConfigurationReference = EDC6FF21CD9F393E8FDF02F6 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; CODE_SIGN_STYLE = Automatic; @@ -631,7 +631,7 @@ SDKROOT = watchos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 4; - WATCHOS_DEPLOYMENT_TARGET = 5.1; + WATCHOS_DEPLOYMENT_TARGET = 4.0; }; name = Release; }; @@ -648,7 +648,7 @@ SDKROOT = watchos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 4; - WATCHOS_DEPLOYMENT_TARGET = 5.1; + WATCHOS_DEPLOYMENT_TARGET = 4.0; }; name = Debug; }; @@ -665,13 +665,13 @@ SDKROOT = watchos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 4; - WATCHOS_DEPLOYMENT_TARGET = 5.1; + WATCHOS_DEPLOYMENT_TARGET = 4.0; }; name = Release; }; ABB17D9222D93BAD00C26D6E /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = CC865626944D2C3DD838F762 /* Pods-watchOS-sample.debug.xcconfig */; + baseConfigurationReference = 574DCD2DDCABCC45B2308601 /* Pods-watchOS-sample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; @@ -689,7 +689,7 @@ }; ABB17D9322D93BAD00C26D6E /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7DB8462D385A70A534800DAF /* Pods-watchOS-sample.release.xcconfig */; + baseConfigurationReference = 957B59E3DE8281B41B6DB3FD /* Pods-watchOS-sample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample WatchKit App.xcscheme b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample WatchKit App.xcscheme new file mode 100644 index 00000000000..7c7e35eea14 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample WatchKit App.xcscheme @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample.xcscheme b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample.xcscheme new file mode 100644 index 00000000000..51e4fa09792 --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m index d78f5f2175c..4a76f4c488c 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m @@ -24,40 +24,4 @@ @implementation AppDelegate -- (BOOL)application:(UIApplication *)application - didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. - return YES; -} - -- (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for - // certain types of temporary interruptions (such as an incoming phone call or SMS message) or - // when the user quits the application and it begins the transition to the background state. Use - // this method to pause ongoing tasks, disable timers, and invalidate graphics rendering - // callbacks. Games should use this method to pause the game. -} - -- (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store - // enough application state information to restore your application to its current state in case - // it is terminated later. If your application supports background execution, this method is - // called instead of applicationWillTerminate: when the user quits. -} - -- (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the active state; here you can undo - // many of the changes made on entering the background. -} - -- (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If - // the application was previously in the background, optionally refresh the user interface. -} - -- (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also - // applicationDidEnterBackground:. -} - @end diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m index cd06242f80b..d15c78482bb 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m @@ -26,9 +26,4 @@ @implementation ViewController -- (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. -} - @end From 3e4cdf20b04b199a77fd15e860404721d0ba6bbe Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 24 Jul 2019 18:16:12 -0700 Subject: [PATCH 091/661] Tring --objc_opt=generate_for_named_framework --- .../RemoteTestClient/RemoteTest.podspec | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec index cf7e317be70..5bf1252aed8 100644 --- a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec @@ -19,15 +19,26 @@ Pod::Spec.new do |s| protoc = "#{bin_dir}/protobuf/protoc" well_known_types_dir = "#{repo_root}/third_party/protobuf/src" plugin = "#{bin_dir}/grpc_objective_c_plugin" - + s.prepare_command = <<-CMD - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --objc_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{well_known_types_dir} \ - #{repo_root}/src/objective-c/examples/RemoteTestClient/*.proto + if [ "$FRAMEWORKS" == "" ]; then + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --objc_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{well_known_types_dir} \ + #{repo_root}/src/objective-c/examples/RemoteTestClient/*.proto + else + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --objc_out=. \ + --grpc_out=. \ + --objc_opt=generate_for_named_framework=#{s.name} \ + -I #{repo_root} \ + -I #{well_known_types_dir} \ + #{repo_root}/src/objective-c/examples/RemoteTestClient/*.proto + fi CMD s.subspec 'Messages' do |ms| From 1d038a8f2970168901071c17f4dcc1765690a00a Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 24 Jul 2019 20:57:54 -0700 Subject: [PATCH 092/661] More proto fixes --- src/objective-c/GRPCClient/GRPCCall.h | 2 -- src/objective-c/ProtoRPC/ProtoRPC.h | 9 +++------ src/objective-c/ProtoRPC/ProtoRPC.m | 18 ------------------ src/objective-c/ProtoRPC/ProtoRPCLegacy.h | 7 ++++++- src/objective-c/ProtoRPC/ProtoRPCLegacy.m | 19 +++++++++++++++++++ 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 2ab69480fb8..153ddc5c171 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -54,8 +54,6 @@ extern NSString *const kGRPCErrorDomain; * server applications to produce. */ typedef NS_ENUM(NSUInteger, GRPCErrorCode) { - GRPCErrorCodeOk = 0, - /** The operation was cancelled (typically by the caller). */ GRPCErrorCodeCancelled = 1, diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h index ab9a180eb97..c91adc7b7cd 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.h +++ b/src/objective-c/ProtoRPC/ProtoRPC.h @@ -18,6 +18,9 @@ #import +// import legacy header for compatibility with users using the ProtoRPC interface +#import "ProtoRPCLegacy.h" + #import "ProtoMethod.h" NS_ASSUME_NONNULL_BEGIN @@ -160,10 +163,4 @@ NS_ASSUME_NONNULL_BEGIN @end -/** - * Generate an NSError object that represents a failure in parsing a proto class. For gRPC internal - * use only. - */ -NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError); - NS_ASSUME_NONNULL_END diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m index 4067dbd1820..dbfa3c0f23d 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.m +++ b/src/objective-c/ProtoRPC/ProtoRPC.m @@ -27,24 +27,6 @@ #import #import -/** - * Generate an NSError object that represents a failure in parsing a proto class. - */ -NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError) { - NSDictionary *info = @{ - NSLocalizedDescriptionKey : @"Unable to parse response from the server", - NSLocalizedRecoverySuggestionErrorKey : - @"If this RPC is idempotent, retry " - @"with exponential backoff. Otherwise, query the server status before " - @"retrying.", - NSUnderlyingErrorKey : parsingError, - @"Expected class" : expectedClass, - @"Received value" : proto, - }; - // TODO(jcanizales): Use kGRPCErrorDomain and GRPCErrorCodeInternal when they're public. - return [NSError errorWithDomain:@"io.grpc" code:13 userInfo:info]; -} - @implementation GRPCUnaryProtoCall { GRPCStreamingProtoCall *_call; GPBMessage *_message; diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h index 893d8047104..bff487e9a0b 100644 --- a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h @@ -1,4 +1,3 @@ -#import "ProtoRPC.h" #import @class GRPCProtoMethod; @@ -32,3 +31,9 @@ __attribute__((deprecated("Please use GRPCProtoCall."))) @interface ProtoRPC @end +/** + * Generate an NSError object that represents a failure in parsing a proto class. For gRPC internal + * use only. + */ +NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError); + diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m index 45f873dc889..d20da5db840 100644 --- a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m @@ -82,3 +82,22 @@ @implementation GRPCProtoCall @end + +/** + * Generate an NSError object that represents a failure in parsing a proto class. + */ +NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError) { + NSDictionary *info = @{ + NSLocalizedDescriptionKey : @"Unable to parse response from the server", + NSLocalizedRecoverySuggestionErrorKey : + @"If this RPC is idempotent, retry " + @"with exponential backoff. Otherwise, query the server status before " + @"retrying.", + NSUnderlyingErrorKey : parsingError, + @"Expected class" : expectedClass, + @"Received value" : proto, + }; + // TODO(jcanizales): Use kGRPCErrorDomain and GRPCErrorCodeInternal when they're public. + return [NSError errorWithDomain:@"io.grpc" code:13 userInfo:info]; +} + From f20cfd38442cff30b94e2867436ad4f1ae4e404d Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 24 Jul 2019 21:40:58 -0700 Subject: [PATCH 093/661] Build system reorg --- gRPC-ProtoRPC.podspec | 18 ++++++++++++------ gRPC.podspec | 23 ++++++++++++++++------- src/objective-c/ProtoRPC/ProtoRPCLegacy.m | 2 ++ templates/gRPC-ProtoRPC.podspec.template | 18 ++++++++++++------ templates/gRPC.podspec.template | 23 ++++++++++++++++------- 5 files changed, 58 insertions(+), 26 deletions(-) diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 3de3c553567..28ef1d980c6 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -41,13 +41,18 @@ Pod::Spec.new do |s| s.module_name = name s.header_dir = name - src_dir = 'src/objective-c/ProtoRPC' + s.default_subspec = 'Main', 'Legacy', 'Legacy-Header' - s.default_subspec = 'Main', 'Legacy' + s.subspec 'Legacy-Header' do |ss| + ss.header_mappings_dir = "src/objective-c/ProtoRPC" + ss.public_header_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.h" + ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.h" + end s.subspec 'Main' do |ss| - ss.header_mappings_dir = "#{src_dir}" - ss.dependency 'gRPC', version + ss.header_mappings_dir = "src/objective-c/ProtoRPC" + ss.dependency "#{s.name}/Legacy-Header", version + ss.dependency 'gRPC/Interface', version ss.dependency 'Protobuf', '~> 3.0' ss.source_files = "src/objective-c/ProtoRPC/ProtoMethod.{h,m}", @@ -56,13 +61,14 @@ Pod::Spec.new do |s| end s.subspec 'Legacy' do |ss| - ss.header_mappings_dir = "#{src_dir}" + ss.header_mappings_dir = "src/objective-c/ProtoRPC" ss.dependency "#{s.name}/Main", version + ss.dependency "#{s.name}/Legacy-Header", version ss.dependency 'gRPC/GRPCCore', version ss.dependency 'gRPC-RxLibrary', version ss.dependency 'Protobuf', '~> 3.0' - ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.{h,m}", + ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.m", "src/objective-c/ProtoRPC/ProtoServiceLegacy.{h,m}" end diff --git a/gRPC.podspec b/gRPC.podspec index e4eb63ff4e7..7af8e841d78 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -42,15 +42,20 @@ Pod::Spec.new do |s| s.default_subspec = 'Interface', 'GRPCCore' - # Certificates, to be able to establish TLS connections: - s.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } - s.pod_target_xcconfig = { # This is needed by all pods that depend on gRPC-RxLibrary: 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } + s.subspec 'Interface-Legacy' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' + + ss.public_header_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h" + + ss.source_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h" + end + s.subspec 'Interface' do |ss| ss.header_mappings_dir = 'src/objective-c/GRPCClient' @@ -75,6 +80,8 @@ Pod::Spec.new do |s| 'src/objective-c/GRPCClient/GRPCTransport.m', 'src/objective-c/GRPCClient/private/GRPCTransport+Private.h', 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m' + + ss.dependency "#{s.name}/Interface-Legacy", version end s.subspec 'GRPCCore' do |ss| @@ -84,7 +91,6 @@ Pod::Spec.new do |s| 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', 'src/objective-c/GRPCClient/GRPCCall+Tests.h', - 'src/objective-c/GRPCClient/GRPCCallLegacy.h', 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', 'src/objective-c/GRPCClient/internal_testing/*.h' ss.private_header_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.h' @@ -100,11 +106,13 @@ Pod::Spec.new do |s| 'src/objective-c/GRPCClient/GRPCCall+OAuth2.m', 'src/objective-c/GRPCClient/GRPCCall+Tests.h', 'src/objective-c/GRPCClient/GRPCCall+Tests.m', - 'src/objective-c/GRPCClient/GRPCCallLegacy.h', 'src/objective-c/GRPCClient/GRPCCallLegacy.m' - ss.dependency 'gRPC-Core', version + # Certificates, to be able to establish TLS connections: + ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } + ss.dependency "#{s.name}/Interface", version + ss.dependency 'gRPC-Core', version ss.dependency 'gRPC-RxLibrary', version end @@ -114,8 +122,9 @@ Pod::Spec.new do |s| ss.source_files = 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', 'src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/*.{h,m}' - ss.dependency 'CronetFramework' + ss.dependency "#{s.name}/GRPCCore", version ss.dependency 'gRPC-Core/Cronet-Implementation', version + ss.dependency 'CronetFramework' end # CFStream is now default. Leaving this subspec only for compatibility purpose. diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m index d20da5db840..a4ea1836bdf 100644 --- a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m @@ -1,5 +1,7 @@ #import "ProtoRPCLegacy.h" +#import "ProtoMethod.h" + #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS #import #else diff --git a/templates/gRPC-ProtoRPC.podspec.template b/templates/gRPC-ProtoRPC.podspec.template index 8c0d7ffdb3e..b8a881c06a9 100644 --- a/templates/gRPC-ProtoRPC.podspec.template +++ b/templates/gRPC-ProtoRPC.podspec.template @@ -43,13 +43,18 @@ s.module_name = name s.header_dir = name - src_dir = 'src/objective-c/ProtoRPC' + s.default_subspec = 'Main', 'Legacy', 'Legacy-Header' - s.default_subspec = 'Main', 'Legacy' + s.subspec 'Legacy-Header' do |ss| + ss.header_mappings_dir = "src/objective-c/ProtoRPC" + ss.public_header_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.h" + ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.h" + end s.subspec 'Main' do |ss| - ss.header_mappings_dir = "#{src_dir}" - ss.dependency 'gRPC', version + ss.header_mappings_dir = "src/objective-c/ProtoRPC" + ss.dependency "#{s.name}/Legacy-Header", version + ss.dependency 'gRPC/Interface', version ss.dependency 'Protobuf', '~> 3.0' ss.source_files = "src/objective-c/ProtoRPC/ProtoMethod.{h,m}", @@ -58,13 +63,14 @@ end s.subspec 'Legacy' do |ss| - ss.header_mappings_dir = "#{src_dir}" + ss.header_mappings_dir = "src/objective-c/ProtoRPC" ss.dependency "#{s.name}/Main", version + ss.dependency "#{s.name}/Legacy-Header", version ss.dependency 'gRPC/GRPCCore', version ss.dependency 'gRPC-RxLibrary', version ss.dependency 'Protobuf', '~> 3.0' - ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.{h,m}", + ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.m", "src/objective-c/ProtoRPC/ProtoServiceLegacy.{h,m}" end diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index 146da4a323a..59ef8290b6f 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -44,15 +44,20 @@ s.default_subspec = 'Interface', 'GRPCCore' - # Certificates, to be able to establish TLS connections: - s.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } - s.pod_target_xcconfig = { # This is needed by all pods that depend on gRPC-RxLibrary: 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } + s.subspec 'Interface-Legacy' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' + + ss.public_header_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h" + + ss.source_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h" + end + s.subspec 'Interface' do |ss| ss.header_mappings_dir = 'src/objective-c/GRPCClient' @@ -77,6 +82,8 @@ 'src/objective-c/GRPCClient/GRPCTransport.m', 'src/objective-c/GRPCClient/private/GRPCTransport+Private.h', 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m' + + ss.dependency "#{s.name}/Interface-Legacy", version end s.subspec 'GRPCCore' do |ss| @@ -86,7 +93,6 @@ 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', 'src/objective-c/GRPCClient/GRPCCall+Tests.h', - 'src/objective-c/GRPCClient/GRPCCallLegacy.h', 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', 'src/objective-c/GRPCClient/internal_testing/*.h' ss.private_header_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.h' @@ -102,11 +108,13 @@ 'src/objective-c/GRPCClient/GRPCCall+OAuth2.m', 'src/objective-c/GRPCClient/GRPCCall+Tests.h', 'src/objective-c/GRPCClient/GRPCCall+Tests.m', - 'src/objective-c/GRPCClient/GRPCCallLegacy.h', 'src/objective-c/GRPCClient/GRPCCallLegacy.m' - ss.dependency 'gRPC-Core', version + # Certificates, to be able to establish TLS connections: + ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } + ss.dependency "#{s.name}/Interface", version + ss.dependency 'gRPC-Core', version ss.dependency 'gRPC-RxLibrary', version end @@ -116,8 +124,9 @@ ss.source_files = 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', 'src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/*.{h,m}' - ss.dependency 'CronetFramework' + ss.dependency "#{s.name}/GRPCCore", version ss.dependency 'gRPC-Core/Cronet-Implementation', version + ss.dependency 'CronetFramework' end # CFStream is now default. Leaving this subspec only for compatibility purpose. From 8fa870c4e55780e96b6d39e07685363befb2f7fd Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 25 Jul 2019 14:17:54 +0200 Subject: [PATCH 094/661] Make UnaryCallOverheadBenchmark parametrized --- .../UnaryCallOverheadBenchmark.cs | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs index 4953806f6f4..8448f03dd62 100644 --- a/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs +++ b/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs @@ -33,14 +33,28 @@ namespace Grpc.Microbenchmarks public class UnaryCallOverheadBenchmark { private static readonly Task CompletedString = Task.FromResult(""); - private static readonly byte[] EmptyBlob = new byte[0]; - private static readonly Marshaller EmptyMarshaller = new Marshaller(_ => EmptyBlob, _ => ""); - private static readonly Method PingMethod = new Method(MethodType.Unary, nameof(PingBenchmark), "Ping", EmptyMarshaller, EmptyMarshaller); + private static readonly Marshaller IdentityMarshaller = new Marshaller(msg => msg, payload => payload); + private static readonly Method PingMethod = new Method(MethodType.Unary, nameof(PingBenchmark), "Ping", IdentityMarshaller, IdentityMarshaller); + + private int payloadSize; + private byte[] payload; + + // size of payload that is sent as request and received as response. + [Params(0, 1, 10, 100, 1000)] + public int PayloadSize + { + get { return payloadSize; } + set + { + payloadSize = value; + payload = new byte[value]; + } + } [Benchmark] - public string SyncUnaryCallOverhead() + public byte[] SyncUnaryCallOverhead() { - return client.Ping("", new CallOptions()); + return client.Ping(payload, new CallOptions()); } Channel channel; @@ -81,7 +95,7 @@ namespace Grpc.Microbenchmarks { public PingClient(CallInvoker callInvoker) : base(callInvoker) { } - public string Ping(string request, CallOptions options) + public byte[] Ping(byte[] request, CallOptions options) { return CallInvoker.BlockingUnaryCall(PingMethod, null, options, request); } From 5e1f96c5b8588b48cfdd1d86dd2f411670c58275 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 25 Jul 2019 08:45:02 -0700 Subject: [PATCH 095/661] Test fixes --- .../tests/CronetTests/InteropTestsRemoteWithCronet.m | 8 +------- src/objective-c/tests/InteropTests/InteropTests.h | 5 ----- src/objective-c/tests/InteropTests/InteropTests.m | 9 ++++----- src/objective-c/tests/Podfile | 4 ++-- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m index c1c51fb06ab..37fa1b418c1 100644 --- a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m +++ b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m @@ -44,9 +44,7 @@ static int32_t kRemoteInteropServerOverhead = 12; + (void)setUp { configureCronet(); - if ([self useCronet]) { - [GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]]; - } + [GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]]; [super setUp]; } @@ -60,10 +58,6 @@ static int32_t kRemoteInteropServerOverhead = 12; return gGRPCCoreCronetId; } -+ (BOOL)useCronet { - return YES; -} - - (int32_t)encodingOverhead { return kRemoteInteropServerOverhead; // bytes } diff --git a/src/objective-c/tests/InteropTests/InteropTests.h b/src/objective-c/tests/InteropTests/InteropTests.h index b6af8e316e2..17fdedc75f4 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.h +++ b/src/objective-c/tests/InteropTests/InteropTests.h @@ -67,9 +67,4 @@ */ + (NSString *)hostNameOverride; -/** - * Whether to use Cronet for all the v1 API tests in the test suite. - */ -+ (BOOL)useCronet; - @end diff --git a/src/objective-c/tests/InteropTests/InteropTests.m b/src/objective-c/tests/InteropTests/InteropTests.m index 25f96050e59..dcdbdc2beb5 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.m +++ b/src/objective-c/tests/InteropTests/InteropTests.m @@ -20,7 +20,6 @@ #include -#import #import #import #import @@ -412,10 +411,6 @@ static dispatch_once_t initGlobalInterceptorFactory; return nil; } -+ (BOOL)useCronet { - return NO; -} - + (void)setUp { dispatch_once(&initGlobalInterceptorFactory, ^{ dispatch_queue_t globalInterceptorQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); @@ -1268,6 +1263,10 @@ static dispatch_once_t initGlobalInterceptorFactory; - (void)testKeepaliveWithV2API { XCTAssertNotNil([[self class] host]); + if ([[self class] transport] == gGRPCCoreCronetId) { + // Cronet does not support keepalive + return; + } __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Keepalive"]; diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index 20a68f7bf67..7f50fa19c5a 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -116,7 +116,7 @@ post_install do |installer| # the test target 'InteropTestsRemoteWithCronet' # Activate GRPCCall+InternalTests functions for the dedicated build configuration 'Test', which will # be used by all test targets using it. - if /gRPC(-macOS|-iOS|\.)/.match(target.name) + if /gRPC(-macOS|-iOS|\.|-[0-9a-f])/.match(target.name) target.build_configurations.each do |config| if config.name == 'Cronet' config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_COMPILE_WITH_CRONET=1 GRPC_TEST_OBJC=1' @@ -127,7 +127,7 @@ post_install do |installer| end # Enable NSAssert on gRPC - if /(gRPC|ProtoRPC|RxLibrary)-(mac|i)OS/.match(target.name) + if /(gRPC|ProtoRPC|RxLibrary)/.match(target.name) target.build_configurations.each do |config| if config.name != 'Release' config.build_settings['ENABLE_NS_ASSERTIONS'] = 'YES' From 08b21aed41d92e0e1b8477cd89a5a7b80ecbf75c Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 25 Jul 2019 09:53:15 -0700 Subject: [PATCH 096/661] add comments and clang-format --- src/compiler/objective_c_generator.cc | 19 ++- src/compiler/objective_c_generator.h | 9 +- src/compiler/objective_c_plugin.cc | 27 +++- src/objective-c/GRPCClient/GRPCCall+Cronet.h | 3 +- src/objective-c/GRPCClient/GRPCCall.m | 69 ++++---- src/objective-c/GRPCClient/GRPCCallLegacy.h | 2 +- src/objective-c/GRPCClient/GRPCCallLegacy.m | 4 +- src/objective-c/GRPCClient/GRPCCallOptions.m | 14 +- src/objective-c/GRPCClient/GRPCDispatchable.h | 2 +- src/objective-c/GRPCClient/GRPCInterceptor.h | 11 +- src/objective-c/GRPCClient/GRPCInterceptor.m | 147 +++++++++--------- src/objective-c/GRPCClient/GRPCTransport.h | 29 +++- src/objective-c/GRPCClient/GRPCTransport.m | 44 +++--- .../private/GRPCCore/GRPCCallInternal.h | 5 +- .../private/GRPCCore/GRPCCallInternal.m | 46 +++--- .../GRPCClient/private/GRPCCore/GRPCChannel.m | 48 +++--- .../private/GRPCCore/GRPCChannelPool.h | 2 +- .../GRPCCoreCronet/GRPCCoreCronetFactory.h | 9 ++ .../GRPCCoreCronet/GRPCCoreCronetFactory.m | 9 +- .../private/GRPCCore/GRPCCoreFactory.h | 9 +- .../private/GRPCCore/GRPCCoreFactory.m | 20 ++- .../GRPCClient/private/GRPCCore/GRPCHost.m | 4 +- .../private/GRPCTransport+Private.h | 21 ++- .../private/GRPCTransport+Private.m | 11 +- src/objective-c/ProtoRPC/ProtoRPCLegacy.h | 39 ++--- src/objective-c/ProtoRPC/ProtoRPCLegacy.m | 8 +- src/objective-c/ProtoRPC/ProtoService.h | 12 +- src/objective-c/ProtoRPC/ProtoServiceLegacy.m | 5 +- .../InteropTestsRemoteWithCronet.m | 4 +- .../tests/InteropTests/InteropTests.m | 131 ++++++++-------- .../InteropTests/InteropTestsLocalCleartext.m | 4 +- .../tests/InteropTests/InteropTestsLocalSSL.m | 4 +- 32 files changed, 434 insertions(+), 337 deletions(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 837113841a8..122ea3c3b69 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -278,7 +278,8 @@ void PrintMethodImplementations(Printer* printer, return output; } -::grpc::string GetProtocol(const ServiceDescriptor* service, const Parameters& generator_params) { +::grpc::string GetProtocol(const ServiceDescriptor* service, + const Parameters& generator_params) { ::grpc::string output; if (generator_params.no_v1_compatibility) return output; @@ -325,7 +326,8 @@ void PrintMethodImplementations(Printer* printer, return output; } -::grpc::string GetInterface(const ServiceDescriptor* service, const Parameters& generator_params) { +::grpc::string GetInterface(const ServiceDescriptor* service, + const Parameters& generator_params) { ::grpc::string output; // Scope the output stream so it closes and finalizes output to the string. @@ -367,7 +369,8 @@ void PrintMethodImplementations(Printer* printer, return output; } -::grpc::string GetSource(const ServiceDescriptor* service, const Parameters& generator_params) { +::grpc::string GetSource(const ServiceDescriptor* service, + const Parameters& generator_params) { ::grpc::string output; { // Scope the output stream so it closes and finalizes output to the string. @@ -422,9 +425,10 @@ void PrintMethodImplementations(Printer* printer, printer.Print("#pragma mark - Class Methods\n\n"); if (!generator_params.no_v1_compatibility) { - printer.Print("+ (instancetype)serviceWithHost:(NSString *)host {\n" - " return [[self alloc] initWithHost:host];\n" - "}\n\n"); + printer.Print( + "+ (instancetype)serviceWithHost:(NSString *)host {\n" + " return [[self alloc] initWithHost:host];\n" + "}\n\n"); } printer.Print( "+ (instancetype)serviceWithHost:(NSString *)host " @@ -435,7 +439,8 @@ void PrintMethodImplementations(Printer* printer, printer.Print("#pragma mark - Method Implementations\n\n"); for (int i = 0; i < service->method_count(); i++) { - PrintMethodImplementations(&printer, service->method(i), generator_params); + PrintMethodImplementations(&printer, service->method(i), + generator_params); } printer.Print("@end\n"); diff --git a/src/compiler/objective_c_generator.h b/src/compiler/objective_c_generator.h index 3f5b3e8b780..518962fceee 100644 --- a/src/compiler/objective_c_generator.h +++ b/src/compiler/objective_c_generator.h @@ -39,7 +39,8 @@ string GetAllMessageClasses(const FileDescriptor* file); // Returns the content to be included defining the @protocol segment at the // insertion point of the generated implementation file. This interface is // legacy and for backwards compatibility. -string GetProtocol(const ServiceDescriptor* service, const Parameters& generator_params); +string GetProtocol(const ServiceDescriptor* service, + const Parameters& generator_params); // Returns the content to be included defining the @protocol segment at the // insertion point of the generated implementation file. @@ -47,11 +48,13 @@ string GetV2Protocol(const ServiceDescriptor* service); // Returns the content to be included defining the @interface segment at the // insertion point of the generated implementation file. -string GetInterface(const ServiceDescriptor* service, const Parameters& generator_params); +string GetInterface(const ServiceDescriptor* service, + const Parameters& generator_params); // Returns the content to be included in the "global_scope" insertion point of // the generated implementation file. -string GetSource(const ServiceDescriptor* service, const Parameters& generator_params); +string GetSource(const ServiceDescriptor* service, + const Parameters& generator_params); } // namespace grpc_objective_c_generator diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index 21c68995cbb..cdd184b6c18 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -104,8 +104,13 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string imports = LocalImport(file_name + ".pbobjc.h"); - ::grpc::string system_imports = (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoService.h") : SystemImport("ProtoRPC/ProtoServiceLegacy.h")) + - (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoRPC.h") : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); + ::grpc::string system_imports = + (generator_params.no_v1_compatibility + ? SystemImport("ProtoRPC/ProtoService.h") + : SystemImport("ProtoRPC/ProtoServiceLegacy.h")) + + (generator_params.no_v1_compatibility + ? SystemImport("ProtoRPC/ProtoRPC.h") + : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); if (!generator_params.no_v1_compatibility) { system_imports += SystemImport("RxLibrary/GRXWriteable.h") + SystemImport("RxLibrary/GRXWriter.h"); @@ -138,13 +143,15 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string protocols; for (int i = 0; i < file->service_count(); i++) { const grpc::protobuf::ServiceDescriptor* service = file->service(i); - protocols += grpc_objective_c_generator::GetProtocol(service, generator_params); + protocols += + grpc_objective_c_generator::GetProtocol(service, generator_params); } ::grpc::string interfaces; for (int i = 0; i < file->service_count(); i++) { const grpc::protobuf::ServiceDescriptor* service = file->service(i); - interfaces += grpc_objective_c_generator::GetInterface(service, generator_params); + interfaces += + grpc_objective_c_generator::GetInterface(service, generator_params); } Write(context, file_name + ".pbrpc.h", @@ -161,9 +168,12 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { { // Generate .pbrpc.m - ::grpc::string imports = LocalImport(file_name + ".pbrpc.h") + - LocalImport(file_name + ".pbobjc.h") + - (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoRPC.h") : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); + ::grpc::string imports = + LocalImport(file_name + ".pbrpc.h") + + LocalImport(file_name + ".pbobjc.h") + + (generator_params.no_v1_compatibility + ? SystemImport("ProtoRPC/ProtoRPC.h") + : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); if (!generator_params.no_v1_compatibility) { imports += SystemImport("RxLibrary/GRXWriter+Immediate.h"); } @@ -176,7 +186,8 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string definitions; for (int i = 0; i < file->service_count(); i++) { const grpc::protobuf::ServiceDescriptor* service = file->service(i); - definitions += grpc_objective_c_generator::GetSource(service, generator_params); + definitions += + grpc_objective_c_generator::GetSource(service, generator_params); } Write(context, file_name + ".pbrpc.m", diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.h b/src/objective-c/GRPCClient/GRPCCall+Cronet.h index c77816b8df6..c49d7cf16f3 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.h +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.h @@ -24,7 +24,7 @@ typedef struct stream_engine stream_engine; // Transport id for Cronet transport extern const GRPCTransportId gGRPCCoreCronetId; -// Deprecated class. Please use the previous transport id with GRPCCallOptions instead. +// Deprecated class. Please use the gGRPCCoreCronetId with GRPCCallOptions.transport instead. @interface GRPCCall (Cronet) + (void)useCronetWithEngine:(stream_engine*)engine; @@ -32,4 +32,3 @@ extern const GRPCTransportId gGRPCCoreCronetId; + (BOOL)isUsingCronet; @end - diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index c62cb03ddd8..26f42032537 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -18,9 +18,9 @@ #import "GRPCCall.h" +#import "GRPCCall+Interceptor.h" #import "GRPCCallOptions.h" #import "GRPCInterceptor.h" -#import "GRPCCall+Interceptor.h" #import "private/GRPCTransport+Private.h" @@ -32,7 +32,7 @@ NSString *const kGRPCTrailersKey = @"io.grpc.TrailersKey"; * dispatch queue of a user provided response handler. It removes the requirement of having to use * serial dispatch queue in the user provided response handler. */ -@interface GRPCResponseDispatcher : NSObject +@interface GRPCResponseDispatcher : NSObject - (nullable instancetype)initWithResponseHandler:(id)responseHandler; @@ -48,7 +48,9 @@ NSString *const kGRPCTrailersKey = @"io.grpc.TrailersKey"; _responseHandler = responseHandler; #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 if (@available(iOS 8.0, macOS 10.10, *)) { - _dispatchQueue = dispatch_queue_create(NULL, dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); + _dispatchQueue = dispatch_queue_create( + NULL, + dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); } else { #else { @@ -61,38 +63,38 @@ NSString *const kGRPCTrailersKey = @"io.grpc.TrailersKey"; return self; } - - (dispatch_queue_t)dispatchQueue { - return _dispatchQueue; - } +- (dispatch_queue_t)dispatchQueue { + return _dispatchQueue; +} - - (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata { - if ([_responseHandler respondsToSelector:@selector(didReceiveInitialMetadata:)]) { - [_responseHandler didReceiveInitialMetadata:initialMetadata]; - } +- (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata { + if ([_responseHandler respondsToSelector:@selector(didReceiveInitialMetadata:)]) { + [_responseHandler didReceiveInitialMetadata:initialMetadata]; } +} - - (void)didReceiveData:(id)data { - // For backwards compatibility with didReceiveRawMessage, if the user provided a response handler - // that handles didReceiveRawMesssage, we issue to that method instead - if ([_responseHandler respondsToSelector:@selector(didReceiveRawMessage:)]) { - [_responseHandler didReceiveRawMessage:data]; - } else if ([_responseHandler respondsToSelector:@selector(didReceiveData:)]) { - [_responseHandler didReceiveData:data]; - } +- (void)didReceiveData:(id)data { + // For backwards compatibility with didReceiveRawMessage, if the user provided a response handler + // that handles didReceiveRawMesssage, we issue to that method instead + if ([_responseHandler respondsToSelector:@selector(didReceiveRawMessage:)]) { + [_responseHandler didReceiveRawMessage:data]; + } else if ([_responseHandler respondsToSelector:@selector(didReceiveData:)]) { + [_responseHandler didReceiveData:data]; } +} - - (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata -error:(nullable NSError *)error { +- (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata + error:(nullable NSError *)error { if ([_responseHandler respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { [_responseHandler didCloseWithTrailingMetadata:trailingMetadata error:error]; } } - - (void)didWriteData { - if ([_responseHandler respondsToSelector:@selector(didWriteData)]) { - [_responseHandler didWriteData]; - } +- (void)didWriteData { + if ([_responseHandler respondsToSelector:@selector(didWriteData)]) { + [_responseHandler didWriteData]; } +} @end @@ -166,10 +168,12 @@ error:(nullable NSError *)error { } _responseHandler = responseHandler; - GRPCResponseDispatcher *dispatcher = [[GRPCResponseDispatcher alloc] initWithResponseHandler:_responseHandler]; + GRPCResponseDispatcher *dispatcher = + [[GRPCResponseDispatcher alloc] initWithResponseHandler:_responseHandler]; NSMutableArray> *interceptorFactories; if (_actualCallOptions.interceptorFactories != nil) { - interceptorFactories = [NSMutableArray arrayWithArray:_actualCallOptions.interceptorFactories]; + interceptorFactories = + [NSMutableArray arrayWithArray:_actualCallOptions.interceptorFactories]; } else { interceptorFactories = [NSMutableArray array]; } @@ -180,12 +184,14 @@ error:(nullable NSError *)error { // continuously create interceptor until one is successfully created while (_firstInterceptor == nil) { if (interceptorFactories.count == 0) { - _firstInterceptor = [[GRPCTransportManager alloc] initWithTransportId:_callOptions.transport previousInterceptor:dispatcher]; + _firstInterceptor = [[GRPCTransportManager alloc] initWithTransportId:_callOptions.transport + previousInterceptor:dispatcher]; break; } else { - _firstInterceptor = [[GRPCInterceptorManager alloc] initWithFactories:interceptorFactories - previousInterceptor:dispatcher - transportId:_callOptions.transport]; + _firstInterceptor = + [[GRPCInterceptorManager alloc] initWithFactories:interceptorFactories + previousInterceptor:dispatcher + transportId:_callOptions.transport]; if (_firstInterceptor == nil) { [interceptorFactories removeObjectAtIndex:0]; } @@ -211,8 +217,7 @@ error:(nullable NSError *)error { GRPCRequestOptions *requestOptions = _requestOptions; GRPCCallOptions *callOptions = _actualCallOptions; dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ - [copiedFirstInterceptor startWithRequestOptions:requestOptions - callOptions:callOptions]; + [copiedFirstInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; }); } diff --git a/src/objective-c/GRPCClient/GRPCCallLegacy.h b/src/objective-c/GRPCClient/GRPCCallLegacy.h index 6c2c8ceada8..e6103498639 100644 --- a/src/objective-c/GRPCClient/GRPCCallLegacy.h +++ b/src/objective-c/GRPCClient/GRPCCallLegacy.h @@ -21,8 +21,8 @@ * the API in GRPCCall.h. This API exists solely for the purpose of backwards compatibility. */ -#import "GRPCCallOptions.h" #import +#import "GRPCCallOptions.h" #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-completeness" diff --git a/src/objective-c/GRPCClient/GRPCCallLegacy.m b/src/objective-c/GRPCClient/GRPCCallLegacy.m index 18a1eda1b39..e25048cfc7e 100644 --- a/src/objective-c/GRPCClient/GRPCCallLegacy.m +++ b/src/objective-c/GRPCClient/GRPCCallLegacy.m @@ -18,9 +18,9 @@ #import "GRPCCallLegacy.h" +#import "GRPCCall+Cronet.h" #import "GRPCCall+OAuth2.h" #import "GRPCCallOptions.h" -#import "GRPCCall+Cronet.h" #import "private/GRPCCore/GRPCChannelPool.h" #import "private/GRPCCore/GRPCCompletionQueue.h" @@ -552,7 +552,7 @@ static NSString *const kBearerPrefix = @"Bearer "; [[GRXConcurrentWriteable alloc] initWithWriteable:writeable dispatchQueue:_responseQueue]; GRPCPooledChannel *channel = - [[GRPCChannelPool sharedInstance] channelWithHost:_host callOptions:_callOptions]; + [[GRPCChannelPool sharedInstance] channelWithHost:_host callOptions:_callOptions]; _wrappedCall = [channel wrappedCallWithPath:_path completionQueue:[GRPCCompletionQueue completionQueue] callOptions:_callOptions]; diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.m b/src/objective-c/GRPCClient/GRPCCallOptions.m index 2080f9915a9..7f88098eb6f 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.m +++ b/src/objective-c/GRPCClient/GRPCCallOptions.m @@ -17,8 +17,8 @@ */ #import "GRPCCallOptions.h" -#import "internal/GRPCCallOptions+Internal.h" #import "GRPCTransport.h" +#import "internal/GRPCCallOptions+Internal.h" // The default values for the call options. static NSString *const kDefaultServerAuthority = nil; @@ -138,7 +138,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:kDefaultPEMPrivateKey PEMCertificateChain:kDefaultPEMCertificateChain transportType:kDefaultTransportType - transport:kDefaultTransport + transport:kDefaultTransport hostNameOverride:kDefaultHostNameOverride logContext:kDefaultLogContext channelPoolDomain:kDefaultChannelPoolDomain @@ -166,7 +166,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:(NSString *)PEMPrivateKey PEMCertificateChain:(NSString *)PEMCertificateChain transportType:(GRPCTransportType)transportType - transport:(GRPCTransportId)transport + transport:(GRPCTransportId)transport hostNameOverride:(NSString *)hostNameOverride logContext:(id)logContext channelPoolDomain:(NSString *)channelPoolDomain @@ -231,7 +231,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:_PEMPrivateKey PEMCertificateChain:_PEMCertificateChain transportType:_transportType - transport:_transport + transport:_transport hostNameOverride:_hostNameOverride logContext:_logContext channelPoolDomain:_channelPoolDomain @@ -264,7 +264,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:[_PEMPrivateKey copy] PEMCertificateChain:[_PEMCertificateChain copy] transportType:_transportType - transport:_transport + transport:_transport hostNameOverride:[_hostNameOverride copy] logContext:_logContext channelPoolDomain:[_channelPoolDomain copy] @@ -375,7 +375,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:kDefaultPEMPrivateKey PEMCertificateChain:kDefaultPEMCertificateChain transportType:kDefaultTransportType - transport:kDefaultTransport + transport:kDefaultTransport hostNameOverride:kDefaultHostNameOverride logContext:kDefaultLogContext channelPoolDomain:kDefaultChannelPoolDomain @@ -436,7 +436,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:_PEMPrivateKey PEMCertificateChain:_PEMCertificateChain transportType:_transportType - transport:_transport + transport:_transport hostNameOverride:_hostNameOverride logContext:_logContext channelPoolDomain:_channelPoolDomain diff --git a/src/objective-c/GRPCClient/GRPCDispatchable.h b/src/objective-c/GRPCClient/GRPCDispatchable.h index 3322766e3bc..650103603d4 100644 --- a/src/objective-c/GRPCClient/GRPCDispatchable.h +++ b/src/objective-c/GRPCClient/GRPCDispatchable.h @@ -18,7 +18,7 @@ */ /** - * An object that process its methods with a dispatch queue. + * An object that processes its methods with a dispatch queue. */ @protocol GRPCDispatchable diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.h b/src/objective-c/GRPCClient/GRPCInterceptor.h index f8a97ac13e8..509749769b3 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.h +++ b/src/objective-c/GRPCClient/GRPCInterceptor.h @@ -169,7 +169,7 @@ NS_ASSUME_NONNULL_BEGIN * invoke shutDown method of its corresponding manager so that references to other interceptors can * be released. */ -@interface GRPCInterceptorManager : NSObject +@interface GRPCInterceptorManager : NSObject - (instancetype)init NS_UNAVAILABLE; @@ -179,6 +179,10 @@ NS_ASSUME_NONNULL_BEGIN previousInterceptor:(nullable id)previousInterceptor transportId:(GRPCTransportId)transportId; +/** + * Notify the manager that the interceptor has shut down and the manager should release references + * to other interceptors and stop forwarding requests/responses. + */ - (void)shutDown; // Methods to forward GRPCInterceptorInterface calls to the next interceptor @@ -230,7 +234,7 @@ NS_ASSUME_NONNULL_BEGIN @interface GRPCInterceptor : NSObject - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)new NS_UNAVAILABLE; ++ (instancetype) new NS_UNAVAILABLE; /** * Initialize the interceptor with the next interceptor in the chain, and provide the dispatch queue @@ -241,7 +245,8 @@ NS_ASSUME_NONNULL_BEGIN // Default implementation of GRPCInterceptorInterface -- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions; +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions + callOptions:(GRPCCallOptions *)callOptions; - (void)writeData:(id)data; - (void)finish; - (void)cancel; diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.m b/src/objective-c/GRPCClient/GRPCInterceptor.m index aa3380cc024..b18f7550260 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.m +++ b/src/objective-c/GRPCClient/GRPCInterceptor.m @@ -40,7 +40,8 @@ transportId:(nonnull GRPCTransportId)transportId { if ((self = [super init])) { if (factories.count == 0) { - [NSException raise:NSInternalInconsistencyException format:@"Interceptor manager must have factories"]; + [NSException raise:NSInternalInconsistencyException + format:@"Interceptor manager must have factories"]; } _thisInterceptor = [factories[0] createInterceptorWithManager:self]; if (_thisInterceptor == nil) { @@ -48,20 +49,22 @@ } _previousInterceptor = previousInterceptor; _factories = factories; - // Generate interceptor + // Generate interceptor #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 if (@available(iOS 8.0, macOS 10.10, *)) { - _dispatchQueue = dispatch_queue_create(NULL, dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); + _dispatchQueue = dispatch_queue_create( + NULL, + dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); } else { #else - { + { #endif - _dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); - } - dispatch_set_target_queue(_dispatchQueue, _thisInterceptor.dispatchQueue); - _transportId = transportId; + _dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); + } + dispatch_set_target_queue(_dispatchQueue, _thisInterceptor.dispatchQueue); + _transportId = transportId; } - return self; + return self; } - (void)shutDown { @@ -71,35 +74,37 @@ _shutDown = YES; } - - (void)createNextInterceptor { - NSAssert(_nextInterceptor == nil, @"Starting the next interceptor more than once"); - NSAssert(_factories.count > 0, @"Interceptor manager of transport cannot start next interceptor"); - if (_nextInterceptor != nil) { - NSLog(@"Starting the next interceptor more than once"); - return; - } - NSMutableArray> *interceptorFactories = [NSMutableArray arrayWithArray:[_factories subarrayWithRange:NSMakeRange(1, _factories.count - 1)]]; - while (_nextInterceptor == nil) { - if (interceptorFactories.count == 0) { - _nextInterceptor = [[GRPCTransportManager alloc] initWithTransportId:_transportId previousInterceptor:self]; - break; - } else { - _nextInterceptor = [[GRPCInterceptorManager alloc] initWithFactories:interceptorFactories - previousInterceptor:self - transportId:_transportId]; - if (_nextInterceptor == nil) { - [interceptorFactories removeObjectAtIndex:0]; - } +- (void)createNextInterceptor { + NSAssert(_nextInterceptor == nil, @"Starting the next interceptor more than once"); + NSAssert(_factories.count > 0, @"Interceptor manager of transport cannot start next interceptor"); + if (_nextInterceptor != nil) { + NSLog(@"Starting the next interceptor more than once"); + return; + } + NSMutableArray> *interceptorFactories = [NSMutableArray + arrayWithArray:[_factories subarrayWithRange:NSMakeRange(1, _factories.count - 1)]]; + while (_nextInterceptor == nil) { + if (interceptorFactories.count == 0) { + _nextInterceptor = + [[GRPCTransportManager alloc] initWithTransportId:_transportId previousInterceptor:self]; + break; + } else { + _nextInterceptor = [[GRPCInterceptorManager alloc] initWithFactories:interceptorFactories + previousInterceptor:self + transportId:_transportId]; + if (_nextInterceptor == nil) { + [interceptorFactories removeObjectAtIndex:0]; } } - NSAssert(_nextInterceptor != nil, @"Failed to create interceptor or transport."); - if (_nextInterceptor == nil) { - NSLog(@"Failed to create interceptor or transport."); - } } + NSAssert(_nextInterceptor != nil, @"Failed to create interceptor or transport."); + if (_nextInterceptor == nil) { + NSLog(@"Failed to create interceptor or transport."); + } +} - - (void)startNextInterceptorWithRequest:(GRPCRequestOptions *)requestOptions -callOptions:(GRPCCallOptions *)callOptions { +- (void)startNextInterceptorWithRequest:(GRPCRequestOptions *)requestOptions + callOptions:(GRPCCallOptions *)callOptions { if (_nextInterceptor == nil && !_shutDown) { [self createNextInterceptor]; } @@ -193,8 +198,8 @@ callOptions:(GRPCCallOptions *)callOptions { } /** Forward call close and trailing metadata to the previous interceptor in the chain */ - - (void)forwardPreviousInterceptorCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata -error:(NSError *)error { +- (void)forwardPreviousInterceptorCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata + error:(NSError *)error { if (_previousInterceptor == nil) { return; } @@ -215,54 +220,55 @@ error:(NSError *)error { }); } - - (dispatch_queue_t)dispatchQueue { - return _dispatchQueue; - } +- (dispatch_queue_t)dispatchQueue { + return _dispatchQueue; +} - - (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { - [_thisInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; - } +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions + callOptions:(GRPCCallOptions *)callOptions { + [_thisInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; +} - - (void)writeData:(id)data { - [_thisInterceptor writeData:data]; - } +- (void)writeData:(id)data { + [_thisInterceptor writeData:data]; +} - - (void)finish { - [_thisInterceptor finish]; - } +- (void)finish { + [_thisInterceptor finish]; +} - - (void)cancel { - [_thisInterceptor cancel]; - } +- (void)cancel { + [_thisInterceptor cancel]; +} - - (void)receiveNextMessages:(NSUInteger)numberOfMessages { - [_thisInterceptor receiveNextMessages:numberOfMessages]; - } +- (void)receiveNextMessages:(NSUInteger)numberOfMessages { + [_thisInterceptor receiveNextMessages:numberOfMessages]; +} - - (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata { - if ([_thisInterceptor respondsToSelector:@selector(didReceiveInitialMetadata:)]) { - [_thisInterceptor didReceiveInitialMetadata:initialMetadata]; - } +- (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata { + if ([_thisInterceptor respondsToSelector:@selector(didReceiveInitialMetadata:)]) { + [_thisInterceptor didReceiveInitialMetadata:initialMetadata]; } +} - - (void)didReceiveData:(id)data { - if ([_thisInterceptor respondsToSelector:@selector(didReceiveData:)]) { - [_thisInterceptor didReceiveData:data]; - } +- (void)didReceiveData:(id)data { + if ([_thisInterceptor respondsToSelector:@selector(didReceiveData:)]) { + [_thisInterceptor didReceiveData:data]; } +} - - (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata - error:(nullable NSError *)error { +- (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata + error:(nullable NSError *)error { if ([_thisInterceptor respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { [_thisInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; } } - - (void)didWriteData { - if ([_thisInterceptor respondsToSelector:@selector(didWriteData)]) { - [_thisInterceptor didWriteData]; - } +- (void)didWriteData { + if ([_thisInterceptor respondsToSelector:@selector(didWriteData)]) { + [_thisInterceptor didWriteData]; } +} @end @@ -272,7 +278,7 @@ error:(NSError *)error { } - (instancetype)initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - dispatchQueue:(dispatch_queue_t)dispatchQueue { + dispatchQueue:(dispatch_queue_t)dispatchQueue { if ((self = [super init])) { _manager = interceptorManager; _dispatchQueue = dispatchQueue; @@ -285,7 +291,8 @@ error:(NSError *)error { return _dispatchQueue; } -- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions + callOptions:(GRPCCallOptions *)callOptions { [_manager startNextInterceptorWithRequest:requestOptions callOptions:callOptions]; } diff --git a/src/objective-c/GRPCClient/GRPCTransport.h b/src/objective-c/GRPCClient/GRPCTransport.h index 2da6ab3dc6a..d5637922152 100644 --- a/src/objective-c/GRPCClient/GRPCTransport.h +++ b/src/objective-c/GRPCClient/GRPCTransport.h @@ -16,19 +16,27 @@ * */ +// The interface for a transport implementation + #import "GRPCInterceptor.h" NS_ASSUME_NONNULL_BEGIN #pragma mark Transport ID -extern const struct GRPCTransportImplList { +/** + * The default transport implementations available in gRPC. These implementations will be provided + * by gRPC by default unless explicitly excluded. + */ +extern const struct GRPCDefaultTransportImplList { const GRPCTransportId core_secure; const GRPCTransportId core_insecure; -} GRPCTransportImplList; +} GRPCDefaultTransportImplList; +/** Returns whether two transport id's are identical. */ BOOL TransportIdIsEqual(GRPCTransportId lhs, GRPCTransportId rhs); +/** Returns the hash value of a transport id. */ NSUInteger TransportIdHash(GRPCTransportId); #pragma mark Transport and factory @@ -40,20 +48,33 @@ NSUInteger TransportIdHash(GRPCTransportId); @class GRPCCallOptions; @class GRPCTransport; -@protocol GRPCTransportFactory +/** The factory method to create a transport. */ +@protocol GRPCTransportFactory - (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager; @end +/** The registry of transport implementations. */ @interface GRPCTransportRegistry : NSObject + (instancetype)sharedInstance; -- (void)registerTransportWithId:(GRPCTransportId)id factory:(id)factory; +/** + * Register a transport implementation with the registry. All transport implementations to be used + * in a process must register with the registry on process start-up in its +load: class method. + * Parameter \a transportId is the identifier of the implementation, and \a factory is the factory + * object to create the corresponding transport instance. + */ +- (void)registerTransportWithId:(GRPCTransportId)transportId + factory:(id)factory; @end +/** + * Base class for transport implementations. All transport implementation should inherit from this + * class. + */ @interface GRPCTransport : NSObject @end diff --git a/src/objective-c/GRPCClient/GRPCTransport.m b/src/objective-c/GRPCClient/GRPCTransport.m index 0621c4e6450..edb973a8f62 100644 --- a/src/objective-c/GRPCClient/GRPCTransport.m +++ b/src/objective-c/GRPCClient/GRPCTransport.m @@ -3,9 +3,8 @@ static const GRPCTransportId gGRPCCoreSecureId = "io.grpc.transport.core.secure"; static const GRPCTransportId gGRPCCoreInsecureId = "io.grpc.transport.core.insecure"; -const struct GRPCTransportImplList GRPCTransportImplList = { - .core_secure = gGRPCCoreSecureId, - .core_insecure = gGRPCCoreInsecureId}; +const struct GRPCDefaultTransportImplList GRPCDefaultTransportImplList = { + .core_secure = gGRPCCoreSecureId, .core_insecure = gGRPCCoreInsecureId}; static const GRPCTransportId gDefaultTransportId = gGRPCCoreSecureId; @@ -49,10 +48,11 @@ NSUInteger TransportIdHash(GRPCTransportId transportId) { return self; } -- (void)registerTransportWithId:(GRPCTransportId)transportId factory:(id)factory { - NSString *nsTransportId = [NSString stringWithCString:transportId - encoding:NSUTF8StringEncoding]; - NSAssert(_registry[nsTransportId] == nil, @"The transport %@ has already been registered.", nsTransportId); +- (void)registerTransportWithId:(GRPCTransportId)transportId + factory:(id)factory { + NSString *nsTransportId = [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding]; + NSAssert(_registry[nsTransportId] == nil, @"The transport %@ has already been registered.", + nsTransportId); if (_registry[nsTransportId] != nil) { NSLog(@"The transport %@ has already been registered.", nsTransportId); return; @@ -68,17 +68,18 @@ NSUInteger TransportIdHash(GRPCTransportId transportId) { - (id)getTransportFactoryWithId:(GRPCTransportId)transportId { if (transportId == NULL) { if (_defaultFactory == nil) { - [NSException raise:NSInvalidArgumentException format:@"Unable to get default transport factory"]; + [NSException raise:NSInvalidArgumentException + format:@"Unable to get default transport factory"]; return nil; } return _defaultFactory; } - NSString *nsTransportId = [NSString stringWithCString:transportId - encoding:NSUTF8StringEncoding]; + NSString *nsTransportId = [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding]; id transportFactory = _registry[nsTransportId]; if (transportFactory == nil) { // User named a transport id that was not registered with the registry. - [NSException raise:NSInvalidArgumentException format:@"Unable to get transport factory with id %s", transportId]; + [NSException raise:NSInvalidArgumentException + format:@"Unable to get transport factory with id %s", transportId]; return nil; } return transportFactory; @@ -89,28 +90,35 @@ NSUInteger TransportIdHash(GRPCTransportId transportId) { @implementation GRPCTransport - (dispatch_queue_t)dispatchQueue { - [NSException raise:NSGenericException format:@"Implementations should override the dispatch queue"]; + [NSException raise:NSGenericException + format:@"Implementations should override the dispatch queue"]; return nil; } -- (void)startWithRequestOptions:(nonnull GRPCRequestOptions *)requestOptions callOptions:(nonnull GRPCCallOptions *)callOptions { - [NSException raise:NSGenericException format:@"Implementations should override the methods of GRPCTransport"]; +- (void)startWithRequestOptions:(nonnull GRPCRequestOptions *)requestOptions + callOptions:(nonnull GRPCCallOptions *)callOptions { + [NSException raise:NSGenericException + format:@"Implementations should override the methods of GRPCTransport"]; } - (void)writeData:(nonnull id)data { - [NSException raise:NSGenericException format:@"Implementations should override the methods of GRPCTransport"]; + [NSException raise:NSGenericException + format:@"Implementations should override the methods of GRPCTransport"]; } - (void)cancel { - [NSException raise:NSGenericException format:@"Implementations should override the methods of GRPCTransport"]; + [NSException raise:NSGenericException + format:@"Implementations should override the methods of GRPCTransport"]; } - (void)finish { - [NSException raise:NSGenericException format:@"Implementations should override the methods of GRPCTransport"]; + [NSException raise:NSGenericException + format:@"Implementations should override the methods of GRPCTransport"]; } - (void)receiveNextMessages:(NSUInteger)numberOfMessages { - [NSException raise:NSGenericException format:@"Implementations should override the methods of GRPCTransport"]; + [NSException raise:NSGenericException + format:@"Implementations should override the methods of GRPCTransport"]; } @end diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.h index ff7a9f6e838..641b1fb2e8a 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.h @@ -26,9 +26,10 @@ NS_ASSUME_NONNULL_BEGIN @interface GRPCCall2Internal : GRPCTransport -- (instancetype)initWithTransportManager:(GRPCTransportManager*)transportManager; +- (instancetype)initWithTransportManager:(GRPCTransportManager *)transportManager; -- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions; +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions + callOptions:(GRPCCallOptions *)callOptions; - (void)writeData:(id)data; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m index 7ff8c6a5945..ea01fcaf594 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m @@ -22,8 +22,8 @@ #import #import -#import "GRPCCall+V2API.h" #import "../GRPCTransport+Private.h" +#import "GRPCCall+V2API.h" @implementation GRPCCall2Internal { /** Request for the call. */ @@ -53,20 +53,19 @@ NSUInteger _pendingReceiveNextMessages; } - - (instancetype)initWithTransportManager:(GRPCTransportManager *)transportManager { - dispatch_queue_t dispatchQueue; - // Set queue QoS only when iOS version is 8.0 or above and Xcode version is 9.0 or above +- (instancetype)initWithTransportManager:(GRPCTransportManager *)transportManager { + dispatch_queue_t dispatchQueue; + // Set queue QoS only when iOS version is 8.0 or above and Xcode version is 9.0 or above #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 - if (@available(iOS 8.0, macOS 10.10, *)) { - dispatchQueue = dispatch_queue_create( - NULL, - dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); - } else { + if (@available(iOS 8.0, macOS 10.10, *)) { + dispatchQueue = dispatch_queue_create( + NULL, dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); + } else { #else - { + { #endif - dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); - } + dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); + } if ((self = [super init])) { _pipe = [GRXBufferedPipe pipe]; _transportManager = transportManager; @@ -79,7 +78,8 @@ return _dispatchQueue; } -- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions + callOptions:(GRPCCallOptions *)callOptions { NSAssert(requestOptions.host.length != 0 && requestOptions.path.length != 0, @"Neither host nor path can be nil."); NSAssert(requestOptions.safety <= GRPCCallSafetyCacheableRequest, @"Invalid call safety value."); @@ -187,13 +187,17 @@ _pipe = nil; if (_transportManager != nil) { - [_transportManager forwardPreviousInterceptorCloseWithTrailingMetadata:nil - error:[NSError errorWithDomain:kGRPCErrorDomain - code:GRPCErrorCodeCancelled - userInfo:@{ - NSLocalizedDescriptionKey : - @"Canceled by app" - }]]; + [_transportManager + forwardPreviousInterceptorCloseWithTrailingMetadata:nil + error: + [NSError + errorWithDomain:kGRPCErrorDomain + code: + GRPCErrorCodeCancelled + userInfo:@{ + NSLocalizedDescriptionKey : + @"Canceled by app" + }]]; [_transportManager shutDown]; } } @@ -258,7 +262,7 @@ - (void)issueClosedWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { [_transportManager forwardPreviousInterceptorCloseWithTrailingMetadata:trailingMetadata - error:error]; + error:error]; [_transportManager shutDown]; } diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m index 846e8331b4b..e0fd4c18e78 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m @@ -21,15 +21,15 @@ #include #import "../../internal/GRPCCallOptions+Internal.h" +#import "../GRPCTransport+Private.h" #import "ChannelArgsUtil.h" #import "GRPCChannelFactory.h" #import "GRPCChannelPool.h" #import "GRPCCompletionQueue.h" +#import "GRPCCoreFactory.h" #import "GRPCInsecureChannelFactory.h" #import "GRPCSecureChannelFactory.h" #import "version.h" -#import "GRPCCoreFactory.h" -#import "../GRPCTransport+Private.h" #import #import @@ -52,12 +52,16 @@ - (id)channelFactory { if (_callOptions.transport != NULL) { - id transportFactory = [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:_callOptions.transport]; - if (![transportFactory respondsToSelector:@selector(createCoreChannelFactoryWithCallOptions:)]) { + id transportFactory = + [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:_callOptions.transport]; + if (! + [transportFactory respondsToSelector:@selector(createCoreChannelFactoryWithCallOptions:)]) { // impossible because we are using GRPCCore now - [NSException raise:NSInternalInconsistencyException format:@"Transport factory type is wrong"]; + [NSException raise:NSInternalInconsistencyException + format:@"Transport factory type is wrong"]; } - id coreTransportFactory = (id)transportFactory; + id coreTransportFactory = + (id)transportFactory; return [coreTransportFactory createCoreChannelFactoryWithCallOptions:_callOptions]; } else { // To maintain backwards compatibility with tranportType @@ -65,22 +69,22 @@ switch (type) { case GRPCTransportTypeChttp2BoringSSL: // TODO (mxyan): Remove when the API is deprecated - { - NSError *error; - id factory = [GRPCSecureChannelFactory - factoryWithPEMRootCertificates:_callOptions.PEMRootCertificates - privateKey:_callOptions.PEMPrivateKey - certChain:_callOptions.PEMCertificateChain - error:&error]; - NSAssert(factory != nil, @"Failed to create secure channel factory"); - if (factory == nil) { - NSLog(@"Error creating secure channel factory: %@", error); - } - return factory; + { + NSError *error; + id factory = [GRPCSecureChannelFactory + factoryWithPEMRootCertificates:_callOptions.PEMRootCertificates + privateKey:_callOptions.PEMPrivateKey + certChain:_callOptions.PEMCertificateChain + error:&error]; + NSAssert(factory != nil, @"Failed to create secure channel factory"); + if (factory == nil) { + NSLog(@"Error creating secure channel factory: %@", error); } - case GRPCTransportTypeCronet: - { - id transportFactory = (id)[[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:gGRPCCoreCronetId]; + return factory; + } + case GRPCTransportTypeCronet: { + id transportFactory = (id)[ + [GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:gGRPCCoreCronetId]; return [transportFactory createCoreChannelFactoryWithCallOptions:_callOptions]; } case GRPCTransportTypeInsecure: @@ -191,7 +195,7 @@ grpc_channel *_unmanagedChannel; } - - (instancetype)initWithChannelConfiguration:(GRPCChannelConfiguration *)channelConfiguration { +- (instancetype)initWithChannelConfiguration:(GRPCChannelConfiguration *)channelConfiguration { NSAssert(channelConfiguration != nil, @"channelConfiguration must not be empty."); if (channelConfiguration == nil) { return nil; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.h index 5adb9cea168..b83a28a2368 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.h @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN * Initialize with an actual channel object \a channel and a reference to the channel pool. */ - (nullable instancetype)initWithChannelConfiguration: -(GRPCChannelConfiguration *)channelConfiguration; + (GRPCChannelConfiguration *)channelConfiguration; /** * Create a GRPCWrappedCall object (grpc_call) from this channel. If channel is disconnected, get a diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h index f1ad1b05e44..83d279d2c72 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h @@ -18,6 +18,15 @@ #import "../GRPCCoreFactory.h" +/** + * The factory for gRPC Core + Cronet transport implementation. The + * implementation is not part of the default transports of gRPC and is for + * testing purpose only on Github. + * + * To use this transport, a user must include the GRPCCoreCronet module as a + * dependency of the project and use gGRPCCoreCronetId in call options to + * specify that this is the transport to be used for a call. + */ @interface GRPCCoreCronetFactory : NSObject @end diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m index 0a19e31999e..5772694fc54 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m @@ -18,11 +18,11 @@ #import "GRPCCoreCronetFactory.h" -#import #import +#import -#import "../GRPCCoreFactory.h" #import "../GRPCCallInternal.h" +#import "../GRPCCoreFactory.h" #import "GRPCCronetChannelFactory.h" static GRPCCoreCronetFactory *gGRPCCoreCronetFactory = nil; @@ -38,8 +38,9 @@ static dispatch_once_t gInitGRPCCoreCronetFactory; } + (void)load { - [[GRPCTransportRegistry sharedInstance] registerTransportWithId:gGRPCCoreCronetId - factory:[GRPCCoreCronetFactory sharedInstance]]; + [[GRPCTransportRegistry sharedInstance] + registerTransportWithId:gGRPCCoreCronetId + factory:[GRPCCoreCronetFactory sharedInstance]]; } - (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager { diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h index d4d8ef586df..3cd312d4ad0 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h @@ -23,16 +23,21 @@ NS_ASSUME_NONNULL_BEGIN @protocol GRPCChannelFactory; @protocol GRPCCallOptions; -@protocol GRPCCoreTransportFactory +/** The interface for transport implementations that are based on Core. */ +@protocol GRPCCoreTransportFactory -- (nullable id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions; +/** Get the channel factory for GRPCChannel from call options. */ +- (nullable id)createCoreChannelFactoryWithCallOptions: + (GRPCCallOptions *)callOptions; @end +/** The factory for gRPC Core + CFStream + TLS secure channel transport implementation. */ @interface GRPCCoreSecureFactory : NSObject @end +/** The factory for gRPC Core + CFStream + insecure channel transport implementation. */ @interface GRPCCoreInsecureFactory : NSObject @end diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m index 609cda17697..f5d6276a570 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m @@ -3,8 +3,8 @@ #import #import "GRPCCallInternal.h" -#import "GRPCSecureChannelFactory.h" #import "GRPCInsecureChannelFactory.h" +#import "GRPCSecureChannelFactory.h" static GRPCCoreSecureFactory *gGRPCCoreSecureFactory = nil; static GRPCCoreInsecureFactory *gGRPCCoreInsecureFactory = nil; @@ -21,8 +21,9 @@ static dispatch_once_t gInitGRPCCoreInsecureFactory; } + (void)load { - [[GRPCTransportRegistry sharedInstance] registerTransportWithId:GRPCTransportImplList.core_secure - factory:[self sharedInstance]]; + [[GRPCTransportRegistry sharedInstance] + registerTransportWithId:GRPCDefaultTransportImplList.core_secure + factory:[self sharedInstance]]; } - (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager { @@ -31,9 +32,11 @@ static dispatch_once_t gInitGRPCCoreInsecureFactory; - (id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions { NSError *error; - id factory = [GRPCSecureChannelFactory factoryWithPEMRootCertificates:callOptions.PEMRootCertificates - privateKey:callOptions.PEMPrivateKey - certChain:callOptions.PEMCertificateChain error:&error]; + id factory = + [GRPCSecureChannelFactory factoryWithPEMRootCertificates:callOptions.PEMRootCertificates + privateKey:callOptions.PEMPrivateKey + certChain:callOptions.PEMCertificateChain + error:&error]; if (error != nil) { NSLog(@"Unable to create secure channel factory"); return nil; @@ -53,8 +56,9 @@ static dispatch_once_t gInitGRPCCoreInsecureFactory; } + (void)load { - [[GRPCTransportRegistry sharedInstance] registerTransportWithId:GRPCTransportImplList.core_insecure - factory:[self sharedInstance]]; + [[GRPCTransportRegistry sharedInstance] + registerTransportWithId:GRPCDefaultTransportImplList.core_insecure + factory:[self sharedInstance]]; } - (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager { diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m index 89a184d8c26..efee85e3108 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m @@ -113,9 +113,9 @@ static NSMutableDictionary *gHostCache; options.PEMCertificateChain = _PEMCertificateChain; options.hostNameOverride = _hostNameOverride; if (_transportType == GRPCTransportTypeInsecure) { - options.transport = GRPCTransportImplList.core_insecure; + options.transport = GRPCDefaultTransportImplList.core_insecure; } else { - options.transport = GRPCTransportImplList.core_secure; + options.transport = GRPCDefaultTransportImplList.core_secure; } options.logContext = _logContext; diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h index 9115b915659..dd826a8fc1a 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h @@ -16,17 +16,21 @@ * */ -#import #import +#import NS_ASSUME_NONNULL_BEGIN +/** + * Private interfaces of the transport registry. + */ @interface GRPCTransportRegistry (Private) -- (nullable instancetype)initWithTransportId:(GRPCTransportId)transportId - previousInterceptor:(id)previousInterceptor; - -- (id)getTransportFactoryWithId:(GRPCTransportId)id; +/** + * Get a transport implementation's factory by its transport id. If the transport id was not + * registered with the registry, nil is returned. + */ +- (id)getTransportFactoryWithId:(GRPCTransportId)transportId; @end @@ -35,6 +39,10 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithTransportId:(GRPCTransportId)transportId previousInterceptor:(id)previousInterceptor; +/** + * Notify the manager that the transport has shut down and the manager should release references to + * its response handler and stop forwarding requests/responses. + */ - (void)shutDown; /** Forward initial metadata to the previous interceptor in the interceptor chain */ @@ -44,7 +52,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)forwardPreviousInterceptorWithData:(nullable id)data; /** Forward call close and trailing metadata to the previous interceptor in the interceptor chain */ -- (void)forwardPreviousInterceptorCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata +- (void)forwardPreviousInterceptorCloseWithTrailingMetadata: + (nullable NSDictionary *)trailingMetadata error:(nullable NSError *)error; /** Forward write completion to the previous interceptor in the interceptor chain */ diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m index 1050280e07b..c8198462bd4 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m @@ -12,8 +12,9 @@ - (instancetype)initWithTransportId:(GRPCTransportId)transportId previousInterceptor:(id)previousInterceptor { if ((self = [super init])) { - id factory = [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:transportId]; - + id factory = + [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:transportId]; + _transport = [factory createTransportWithManager:self]; NSAssert(_transport != nil, @"Failed to create transport with id: %s", transportId); if (_transport == nil) { @@ -36,9 +37,11 @@ return _dispatchQueue; } -- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions + callOptions:(GRPCCallOptions *)callOptions { if (_transportId != callOptions.transport) { - [NSException raise:NSInvalidArgumentException format:@"Interceptors cannot change the call option 'transport'"]; + [NSException raise:NSInvalidArgumentException + format:@"Interceptors cannot change the call option 'transport'"]; return; } [_transport startWithRequestOptions:requestOptions callOptions:callOptions]; diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h index bff487e9a0b..2ceb4339bd1 100644 --- a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h @@ -5,17 +5,17 @@ @protocol GRXWriteable; __attribute__((deprecated("Please use GRPCProtoCall."))) @interface ProtoRPC -: GRPCCall - -/** - * host parameter should not contain the scheme (http:// or https://), only the name or IP - * addr and the port number, for example @"localhost:5050". - */ -- -(instancetype)initWithHost : (NSString *)host method -: (GRPCProtoMethod *)method requestsWriter : (GRXWriter *)requestsWriter responseClass -: (Class)responseClass responsesWriteable -: (id)responsesWriteable NS_DESIGNATED_INITIALIZER; + : GRPCCall + + /** + * host parameter should not contain the scheme (http:// or https://), only the name or IP + * addr and the port number, for example @"localhost:5050". + */ + - + (instancetype)initWithHost : (NSString *)host method + : (GRPCProtoMethod *)method requestsWriter : (GRXWriter *)requestsWriter responseClass + : (Class)responseClass responsesWriteable + : (id)responsesWriteable NS_DESIGNATED_INITIALIZER; - (void)start; @end @@ -26,14 +26,15 @@ __attribute__((deprecated("Please use GRPCProtoCall."))) @interface ProtoRPC */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" -@interface GRPCProtoCall : ProtoRPC + @interface GRPCProtoCall + : ProtoRPC #pragma clang diagnostic pop -@end - -/** - * Generate an NSError object that represents a failure in parsing a proto class. For gRPC internal - * use only. - */ -NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError); + @end + /** + * Generate an NSError object that represents a failure in parsing a proto class. For gRPC + * internal use only. + */ + NSError * + ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError); diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m index a4ea1836bdf..b5c0c847c66 100644 --- a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m @@ -11,7 +11,6 @@ #import #import - #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-implementations" @implementation ProtoRPC { @@ -63,9 +62,9 @@ [weakSelf finishWithError:ErrorForBadProto(value, responseClass, error)]; } } - completionHandler:^(NSError *errorOrNil) { - [responsesWriteable writesFinishedWithError:errorOrNil]; - }]; + completionHandler:^(NSError *errorOrNil) { + [responsesWriteable writesFinishedWithError:errorOrNil]; + }]; } return self; } @@ -102,4 +101,3 @@ NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError) // TODO(jcanizales): Use kGRPCErrorDomain and GRPCErrorCodeInternal when they're public. return [NSError errorWithDomain:@"io.grpc" code:13 userInfo:info]; } - diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index e99d75fd3d8..d55ed30a39b 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -30,17 +30,17 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-completeness" -__attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoService -: NSObject { +__attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoService : NSObject { NSString *_host; NSString *_packageName; NSString *_serviceName; } - - - (nullable instancetype)initWithHost : (nonnull NSString *)host packageName - : (nonnull NSString *)packageName serviceName : (nonnull NSString *)serviceName callOptions - : (nullable GRPCCallOptions *)callOptions NS_DESIGNATED_INITIALIZER; +- (nullable instancetype)initWithHost:(nonnull NSString *)host + packageName:(nonnull NSString *)packageName + serviceName:(nonnull NSString *)serviceName + callOptions:(nullable GRPCCallOptions *)callOptions + NS_DESIGNATED_INITIALIZER; - (nullable GRPCUnaryProtoCall *)RPCToMethod:(nonnull NSString *)method message:(nonnull id)message diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m index 34f2b0f2cbb..9484f432216 100644 --- a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m +++ b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m @@ -1,6 +1,6 @@ #import "ProtoServiceLegacy.h" -#import "ProtoRPCLegacy.h" #import "ProtoMethod.h" +#import "ProtoRPCLegacy.h" #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-implementations" @@ -23,13 +23,12 @@ return self; } - - (GRPCProtoCall *)RPCToMethod:(NSString *)method requestsWriter:(GRXWriter *)requestsWriter responseClass:(Class)responseClass responsesWriteable:(id)responsesWriteable { GRPCProtoMethod *methodName = - [[GRPCProtoMethod alloc] initWithPackage:_packageName service:_serviceName method:method]; + [[GRPCProtoMethod alloc] initWithPackage:_packageName service:_serviceName method:method]; return [[GRPCProtoCall alloc] initWithHost:_host method:methodName requestsWriter:requestsWriter diff --git a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m index 37fa1b418c1..aa1af301b96 100644 --- a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m +++ b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m @@ -22,9 +22,8 @@ #import #import -#import "InteropTests.h" #import "../ConfigureCronet.h" - +#import "InteropTests.h" // The server address is derived from preprocessor macro, which is // in turn derived from environment variable of the same name. @@ -49,7 +48,6 @@ static int32_t kRemoteInteropServerOverhead = 12; [super setUp]; } - + (NSString *)host { return kRemoteSSLHost; } diff --git a/src/objective-c/tests/InteropTests/InteropTests.m b/src/objective-c/tests/InteropTests/InteropTests.m index dcdbdc2beb5..2cb5ba21a2f 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.m +++ b/src/objective-c/tests/InteropTests/InteropTests.m @@ -87,8 +87,8 @@ BOOL isRemoteInteropTest(NSString *host) { - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { dispatch_queue_t queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); - return [[GRPCInterceptor alloc] initWithInterceptorManager:interceptorManager - dispatchQueue:queue]; + return + [[GRPCInterceptor alloc] initWithInterceptorManager:interceptorManager dispatchQueue:queue]; } @end @@ -96,20 +96,19 @@ BOOL isRemoteInteropTest(NSString *host) { @interface HookInterceptorFactory : NSObject - (instancetype) -initWithDispatchQueue:(dispatch_queue_t)dispatchQueue - startHook:(void (^)(GRPCRequestOptions *requestOptions, - GRPCCallOptions *callOptions, - GRPCInterceptorManager *manager))startHook - writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook - finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook - receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, - GRPCInterceptorManager *manager))receiveNextMessagesHook - responseHeaderHook:(void (^)(NSDictionary *initialMetadata, - GRPCInterceptorManager *manager))responseHeaderHook - responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook - responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, - GRPCInterceptorManager *manager))responseCloseHook - didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook; + initWithDispatchQueue:(dispatch_queue_t)dispatchQueue + startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, + GRPCInterceptorManager *manager))startHook + writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook + finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook +receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, + GRPCInterceptorManager *manager))receiveNextMessagesHook + responseHeaderHook:(void (^)(NSDictionary *initialMetadata, + GRPCInterceptorManager *manager))responseHeaderHook + responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook + responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, + GRPCInterceptorManager *manager))responseCloseHook + didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook; - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager; @@ -119,7 +118,7 @@ initWithDispatchQueue:(dispatch_queue_t)dispatchQueue - (instancetype) initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager -dispatchQueue:(dispatch_queue_t)dispatchQueue + dispatchQueue:(dispatch_queue_t)dispatchQueue startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook @@ -152,20 +151,19 @@ dispatchQueue:(dispatch_queue_t)dispatchQueue } - (instancetype) -initWithDispatchQueue:(dispatch_queue_t)dispatchQueue - startHook:(void (^)(GRPCRequestOptions *requestOptions, - GRPCCallOptions *callOptions, - GRPCInterceptorManager *manager))startHook - writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook - finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook - receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, - GRPCInterceptorManager *manager))receiveNextMessagesHook - responseHeaderHook:(void (^)(NSDictionary *initialMetadata, - GRPCInterceptorManager *manager))responseHeaderHook - responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook - responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, - GRPCInterceptorManager *manager))responseCloseHook - didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { + initWithDispatchQueue:(dispatch_queue_t)dispatchQueue + startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, + GRPCInterceptorManager *manager))startHook + writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook + finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook +receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, + GRPCInterceptorManager *manager))receiveNextMessagesHook + responseHeaderHook:(void (^)(NSDictionary *initialMetadata, + GRPCInterceptorManager *manager))responseHeaderHook + responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook + responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, + GRPCInterceptorManager *manager))responseCloseHook + didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { if ((self = [super init])) { _dispatchQueue = dispatchQueue; _startHook = startHook; @@ -182,7 +180,7 @@ initWithDispatchQueue:(dispatch_queue_t)dispatchQueue - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { return [[HookInterceptor alloc] initWithInterceptorManager:interceptorManager - dispatchQueue:_dispatchQueue + dispatchQueue:_dispatchQueue startHook:_startHook writeDataHook:_writeDataHook finishHook:_finishHook @@ -216,7 +214,7 @@ initWithDispatchQueue:(dispatch_queue_t)dispatchQueue - (instancetype) initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager -dispatchQueue:(dispatch_queue_t)dispatchQueue + dispatchQueue:(dispatch_queue_t)dispatchQueue startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook @@ -230,8 +228,7 @@ dispatchQueue:(dispatch_queue_t)dispatchQueue responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager))responseCloseHook didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { - if ((self = [super initWithInterceptorManager:interceptorManager - dispatchQueue:dispatchQueue])) { + if ((self = [super initWithInterceptorManager:interceptorManager dispatchQueue:dispatchQueue])) { _startHook = startHook; _writeDataHook = writeDataHook; _finishHook = finishHook; @@ -323,14 +320,14 @@ dispatchQueue:(dispatch_queue_t)dispatchQueue - (instancetype)initWithDispatchQueue:(dispatch_queue_t)dispatchQueue { _enabled = NO; return [super initWithDispatchQueue:dispatchQueue - startHook:nil - writeDataHook:nil - finishHook:nil - receiveNextMessagesHook:nil - responseHeaderHook:nil - responseDataHook:nil - responseCloseHook:nil - didWriteDataHook:nil]; + startHook:nil + writeDataHook:nil + finishHook:nil + receiveNextMessagesHook:nil + responseHeaderHook:nil + responseDataHook:nil + responseCloseHook:nil + didWriteDataHook:nil]; } - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { @@ -621,7 +618,7 @@ static dispatch_once_t initGlobalInterceptorFactory; request.responseStatus.code = GRPC_STATUS_CANCELLED; } GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility + // For backwards compatibility options.transportType = [[self class] transportType]; options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; @@ -1269,7 +1266,6 @@ static dispatch_once_t initGlobalInterceptorFactory; } __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Keepalive"]; - NSNumber *kRequestSize = @27182; NSNumber *kResponseSize = @31415; @@ -1284,18 +1280,19 @@ static dispatch_once_t initGlobalInterceptorFactory; options.keepaliveTimeout = 0; __block GRPCStreamingProtoCall *call = [_service - fullDuplexCallWithResponseHandler:[[InteropTestsBlockCallbacks alloc] - initWithInitialMetadataCallback:nil - messageCallback:nil - closeCallback:^(NSDictionary *trailingMetadata, - NSError *error) { - XCTAssertNotNil(error); - XCTAssertEqual(error.code, GRPC_STATUS_UNAVAILABLE, - @"Received status %ld instead of UNAVAILABLE (14).", - error.code); - [expectation fulfill]; - }] - callOptions:options]; + fullDuplexCallWithResponseHandler: + [[InteropTestsBlockCallbacks alloc] + initWithInitialMetadataCallback:nil + messageCallback:nil + closeCallback:^(NSDictionary *trailingMetadata, NSError *error) { + XCTAssertNotNil(error); + XCTAssertEqual( + error.code, GRPC_STATUS_UNAVAILABLE, + @"Received status %ld instead of UNAVAILABLE (14).", + error.code); + [expectation fulfill]; + }] + callOptions:options]; [call writeMessage:request]; [call start]; @@ -1548,7 +1545,7 @@ static dispatch_once_t initGlobalInterceptorFactory; XCTAssertEqual(error.code, GRPC_STATUS_CANCELLED); [expectCallInternalComplete fulfill]; } - didWriteDataHook:nil]; + didWriteDataHook:nil]; NSArray *requests = @[ @1, @2, @3, @4 ]; @@ -1723,15 +1720,15 @@ static dispatch_once_t initGlobalInterceptorFactory; - (void)testConflictingGlobalInterceptors { id factory = [[HookInterceptorFactory alloc] - initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) - startHook:nil - writeDataHook:nil - finishHook:nil - receiveNextMessagesHook:nil - responseHeaderHook:nil - responseDataHook:nil - responseCloseHook:nil - didWriteDataHook:nil]; + initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + startHook:nil + writeDataHook:nil + finishHook:nil + receiveNextMessagesHook:nil + responseHeaderHook:nil + responseDataHook:nil + responseCloseHook:nil + didWriteDataHook:nil]; @try { [GRPCCall2 registerGlobalInterceptor:factory]; XCTFail(@"Did not receive an exception when registering global interceptor the second time"); diff --git a/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m b/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m index c8d21199454..2e638099e1e 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m +++ b/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m @@ -17,8 +17,8 @@ */ #import -#import #import +#import #import "InteropTests.h" @@ -62,7 +62,7 @@ static int32_t kLocalInteropServerOverhead = 10; } + (GRPCTransportId)transport { - return GRPCTransportImplList.core_insecure; + return GRPCDefaultTransportImplList.core_insecure; } @end diff --git a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m index d28513cc673..1c1c1ddeb1e 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m +++ b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m @@ -17,8 +17,8 @@ */ #import -#import #import +#import #import "InteropTests.h" // The server address is derived from preprocessor macro, which is @@ -62,7 +62,7 @@ static int32_t kLocalInteropServerOverhead = 10; } + (GRPCTransportId)transport { - return GRPCTransportImplList.core_secure; + return GRPCDefaultTransportImplList.core_secure; } - (void)setUp { From 3f16518947238b2cafc6f7a648fa38c6ba53a073 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 25 Jul 2019 10:02:10 -0700 Subject: [PATCH 097/661] Fix build --- gRPC.podspec | 1 + templates/gRPC.podspec.template | 1 + 2 files changed, 2 insertions(+) diff --git a/gRPC.podspec b/gRPC.podspec index 7af8e841d78..9ddbb18d393 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -78,6 +78,7 @@ Pod::Spec.new do |s| 'src/objective-c/GRPCClient/GRPCInterceptor.m', 'src/objective-c/GRPCClient/GRPCTransport.h', 'src/objective-c/GRPCClient/GRPCTransport.m', + 'src/objective-c/GRPCClient/internal/*.h', 'src/objective-c/GRPCClient/private/GRPCTransport+Private.h', 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m' diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index 59ef8290b6f..21cce3c23ee 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -80,6 +80,7 @@ 'src/objective-c/GRPCClient/GRPCInterceptor.m', 'src/objective-c/GRPCClient/GRPCTransport.h', 'src/objective-c/GRPCClient/GRPCTransport.m', + 'src/objective-c/GRPCClient/internal/*.h', 'src/objective-c/GRPCClient/private/GRPCTransport+Private.h', 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m' From 6b7664f642da9537a793775ee7b99e9a55355ee3 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Thu, 25 Jul 2019 11:12:17 -0700 Subject: [PATCH 098/661] Add 1.21.1 and 1.22.1 of grpc-go to interop matrix --- tools/interop_matrix/client_matrix.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py index 585734283a7..51a47d92f97 100644 --- a/tools/interop_matrix/client_matrix.py +++ b/tools/interop_matrix/client_matrix.py @@ -142,8 +142,8 @@ LANG_RELEASE_MATRIX = { ('v1.19.0', ReleaseInfo(runtimes=['go1.11'], testcases_file='go__v1.0.5')), ('v1.20.0', ReleaseInfo(runtimes=['go1.11'])), - ('v1.21.0', ReleaseInfo(runtimes=['go1.11'])), - ('v1.22.0', ReleaseInfo(runtimes=['go1.11'])), + ('v1.21.2', ReleaseInfo(runtimes=['go1.11'])), + ('v1.22.1', ReleaseInfo(runtimes=['go1.11'])), ]), 'java': OrderedDict([ From 431c5306baad10b5623f734d060d9eb40eebd74d Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 25 Jul 2019 14:48:14 -0700 Subject: [PATCH 099/661] Used framework imports within generated stubs where necessary --- src/compiler/objective_c_generator_helpers.h | 12 ++ src/compiler/objective_c_plugin.cc | 48 +++++-- .../project.pbxproj | 58 ++++----- .../InterceptorSample/ViewController.m | 5 + .../examples/InterceptorSample/Podfile | 2 + .../RemoteTestClient/RemoteTest.podspec | 19 +-- src/objective-c/examples/Sample/Podfile | 2 +- .../Sample/Sample.xcodeproj/project.pbxproj | 90 +++++++------ .../examples/Sample/Sample/ViewController.m | 5 + .../AppIcon.appiconset/Contents.json | 30 +++++ .../examples/SwiftSample/RemoteTest.podspec | 55 -------- .../SwiftSample.xcodeproj/project.pbxproj | 50 ++++---- .../examples/SwiftSample/messages.proto | 118 ------------------ .../examples/SwiftSample/test.proto | 57 --------- 14 files changed, 213 insertions(+), 338 deletions(-) delete mode 100644 src/objective-c/examples/SwiftSample/RemoteTest.podspec delete mode 100644 src/objective-c/examples/SwiftSample/messages.proto delete mode 100644 src/objective-c/examples/SwiftSample/test.proto diff --git a/src/compiler/objective_c_generator_helpers.h b/src/compiler/objective_c_generator_helpers.h index a284da97f4b..de8f52d802c 100644 --- a/src/compiler/objective_c_generator_helpers.h +++ b/src/compiler/objective_c_generator_helpers.h @@ -19,6 +19,10 @@ #ifndef GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H #define GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H +#include +using namespace std; + + #include #include "src/compiler/config.h" #include "src/compiler/generator_helpers.h" @@ -45,6 +49,14 @@ inline ::grpc::string LocalImport(const ::grpc::string& import) { return ::grpc::string("#import \"" + import + "\"\n"); } +inline ::grpc::string FrameworkImport(const ::grpc::string& import, const ::grpc::string& framework) { + // Flattens the directory structure + std::size_t pos = import.rfind("/"); + ::grpc::string filename = import.substr(pos + 1, import.size() - pos); + cerr << filename << endl; + return ::grpc::string("#import <" + framework + "/" + filename + ">\n"); +} + inline ::grpc::string SystemImport(const ::grpc::string& import) { return ::grpc::string("#import <" + import + ">\n"); } diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index 87977095d05..3ac7ea13a96 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -30,6 +30,7 @@ using ::google::protobuf::compiler::objectivec:: IsProtobufLibraryBundledProtoFile; using ::google::protobuf::compiler::objectivec::ProtobufLibraryFrameworkName; using ::grpc_objective_c_generator::LocalImport; +using ::grpc_objective_c_generator::FrameworkImport; using ::grpc_objective_c_generator::PreprocIfElse; using ::grpc_objective_c_generator::PreprocIfNot; using ::grpc_objective_c_generator::SystemImport; @@ -37,11 +38,16 @@ using ::grpc_objective_c_generator::SystemImport; namespace { inline ::grpc::string ImportProtoHeaders( - const grpc::protobuf::FileDescriptor* dep, const char* indent) { + const grpc::protobuf::FileDescriptor* dep, const char* indent, const ::grpc::string &framework) { ::grpc::string header = grpc_objective_c_generator::MessageHeaderName(dep); + // cerr << header << endl; if (!IsProtobufLibraryBundledProtoFile(dep)) { - return indent + LocalImport(header); + if (framework.empty()) { + return indent + LocalImport(header); + } else { + return indent + FrameworkImport(header, framework); + } } ::grpc::string base_name = header; @@ -74,6 +80,15 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { return true; } + ::grpc::string framework; + std::vector<::grpc::string> params_list = grpc_generator::tokenize(parameter, ","); + for (auto param_str = params_list.begin(); param_str != params_list.end(); ++param_str) { + std::vector<::grpc::string> param = grpc_generator::tokenize(*param_str, "="); + if (param[0] == "generate_for_named_framework") { + framework = param[1]; + } + } + static const ::grpc::string kNonNullBegin = "NS_ASSUME_NONNULL_BEGIN\n"; static const ::grpc::string kNonNullEnd = "NS_ASSUME_NONNULL_END\n"; static const ::grpc::string kProtocolOnly = "GPB_GRPC_PROTOCOL_ONLY"; @@ -85,8 +100,13 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { { // Generate .pbrpc.h - - ::grpc::string imports = LocalImport(file_name + ".pbobjc.h"); + + ::grpc::string imports; + if (framework.empty()) { + imports = LocalImport(file_name + ".pbobjc.h"); + } else { + imports = FrameworkImport(file_name + ".pbobjc.h", framework); + } ::grpc::string system_imports = SystemImport("ProtoRPC/ProtoService.h") + SystemImport("ProtoRPC/ProtoRPC.h") + @@ -106,7 +126,7 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string class_imports; for (int i = 0; i < file->dependency_count(); i++) { - class_imports += ImportProtoHeaders(file->dependency(i), " "); + class_imports += ImportProtoHeaders(file->dependency(i), " ", framework); } ::grpc::string ng_protocols; @@ -141,14 +161,22 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { { // Generate .pbrpc.m - ::grpc::string imports = LocalImport(file_name + ".pbrpc.h") + - LocalImport(file_name + ".pbobjc.h") + - SystemImport("ProtoRPC/ProtoRPC.h") + - SystemImport("RxLibrary/GRXWriter+Immediate.h"); + ::grpc::string imports; + if (framework.empty()) { + imports = LocalImport(file_name + ".pbrpc.h") + + LocalImport(file_name + ".pbobjc.h") + + SystemImport("ProtoRPC/ProtoRPC.h") + + SystemImport("RxLibrary/GRXWriter+Immediate.h"); + } else { + imports = FrameworkImport(file_name + ".pbrpc.h", framework) + + FrameworkImport(file_name + ".pbobjc.h", framework) + + SystemImport("ProtoRPC/ProtoRPC.h") + + SystemImport("RxLibrary/GRXWriter+Immediate.h"); + } ::grpc::string class_imports; for (int i = 0; i < file->dependency_count(); i++) { - class_imports += ImportProtoHeaders(file->dependency(i), ""); + class_imports += ImportProtoHeaders(file->dependency(i), "", framework); } ::grpc::string definitions; diff --git a/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj b/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj index 840f9760879..b3f9d0500e5 100644 --- a/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 4182FA3FC32428BA5E84C311 /* libPods-InterceptorSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 48F0BD18AEBB640DE5E58D79 /* libPods-InterceptorSample.a */; }; 5EE960FB2266768A0044A74F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE960FA2266768A0044A74F /* AppDelegate.m */; }; 5EE960FE2266768A0044A74F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE960FD2266768A0044A74F /* ViewController.m */; }; 5EE961012266768A0044A74F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EE960FF2266768A0044A74F /* Main.storyboard */; }; @@ -15,10 +14,11 @@ 5EE961062266768C0044A74F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EE961042266768C0044A74F /* LaunchScreen.storyboard */; }; 5EE961092266768C0044A74F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE961082266768C0044A74F /* main.m */; }; 5EE9611222668CF20044A74F /* CacheInterceptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE9611122668CF20044A74F /* CacheInterceptor.m */; }; + 9F142CE7AFDA64BD5AEE9849 /* libPods-InterceptorSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B8FBA9621C9B11B3AC233A96 /* libPods-InterceptorSample.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 48F0BD18AEBB640DE5E58D79 /* libPods-InterceptorSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InterceptorSample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 18F2D91B047D36868BCD504B /* Pods-InterceptorSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.release.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.release.xcconfig"; sourceTree = ""; }; 5EE960F62266768A0044A74F /* InterceptorSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InterceptorSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5EE960FA2266768A0044A74F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 5EE960FC2266768A0044A74F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; @@ -31,8 +31,8 @@ 5EE9610F2266774C0044A74F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 5EE9611022668CE20044A74F /* CacheInterceptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CacheInterceptor.h; sourceTree = ""; }; 5EE9611122668CF20044A74F /* CacheInterceptor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CacheInterceptor.m; sourceTree = ""; }; - 64B0278876AF54F8F95EDDCE /* Pods-InterceptorSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.release.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.release.xcconfig"; sourceTree = ""; }; - 6637EF5BBDFE0FFD47D9EAE7 /* Pods-InterceptorSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.debug.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.debug.xcconfig"; sourceTree = ""; }; + AD256CCFA3FE501D3D876F1D /* Pods-InterceptorSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.debug.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.debug.xcconfig"; sourceTree = ""; }; + B8FBA9621C9B11B3AC233A96 /* libPods-InterceptorSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InterceptorSample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -40,7 +40,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4182FA3FC32428BA5E84C311 /* libPods-InterceptorSample.a in Frameworks */, + 9F142CE7AFDA64BD5AEE9849 /* libPods-InterceptorSample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -53,7 +53,7 @@ 5EE960F82266768A0044A74F /* InterceptorSample */, 5EE960F72266768A0044A74F /* Products */, 9D49DB75F3BEDAFDE7028B51 /* Pods */, - A48ECC1BD9AFC8D93ECD2467 /* Frameworks */, + B3868CDC20EB754A8D582F03 /* Frameworks */, ); sourceTree = ""; }; @@ -86,16 +86,16 @@ 9D49DB75F3BEDAFDE7028B51 /* Pods */ = { isa = PBXGroup; children = ( - 6637EF5BBDFE0FFD47D9EAE7 /* Pods-InterceptorSample.debug.xcconfig */, - 64B0278876AF54F8F95EDDCE /* Pods-InterceptorSample.release.xcconfig */, + AD256CCFA3FE501D3D876F1D /* Pods-InterceptorSample.debug.xcconfig */, + 18F2D91B047D36868BCD504B /* Pods-InterceptorSample.release.xcconfig */, ); path = Pods; sourceTree = ""; }; - A48ECC1BD9AFC8D93ECD2467 /* Frameworks */ = { + B3868CDC20EB754A8D582F03 /* Frameworks */ = { isa = PBXGroup; children = ( - 48F0BD18AEBB640DE5E58D79 /* libPods-InterceptorSample.a */, + B8FBA9621C9B11B3AC233A96 /* libPods-InterceptorSample.a */, ); name = Frameworks; sourceTree = ""; @@ -107,11 +107,11 @@ isa = PBXNativeTarget; buildConfigurationList = 5EE9610C2266768C0044A74F /* Build configuration list for PBXNativeTarget "InterceptorSample" */; buildPhases = ( - 471EAA5F4DD4F2A125B3488B /* [CP] Check Pods Manifest.lock */, + D31C16F578D4BF95F5638778 /* [CP] Check Pods Manifest.lock */, 5EE960F22266768A0044A74F /* Sources */, 5EE960F32266768A0044A74F /* Frameworks */, 5EE960F42266768A0044A74F /* Resources */, - 77C5553636C977821737C752 /* [CP] Copy Pods Resources */, + 45857CF606BB268EB3BC476F /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -168,43 +168,43 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 471EAA5F4DD4F2A125B3488B /* [CP] Check Pods Manifest.lock */ = { + 45857CF606BB268EB3BC476F /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-InterceptorSample-checkManifestLockResult.txt", + "${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 77C5553636C977821737C752 /* [CP] Copy Pods Resources */ = { + D31C16F578D4BF95F5638778 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Copy Pods Resources"; + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-InterceptorSample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -357,7 +357,7 @@ }; 5EE9610D2266768C0044A74F /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 6637EF5BBDFE0FFD47D9EAE7 /* Pods-InterceptorSample.debug.xcconfig */; + baseConfigurationReference = AD256CCFA3FE501D3D876F1D /* Pods-InterceptorSample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; @@ -375,7 +375,7 @@ }; 5EE9610E2266768C0044A74F /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 64B0278876AF54F8F95EDDCE /* Pods-InterceptorSample.release.xcconfig */; + baseConfigurationReference = 18F2D91B047D36868BCD504B /* Pods-InterceptorSample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; diff --git a/src/objective-c/examples/InterceptorSample/InterceptorSample/ViewController.m b/src/objective-c/examples/InterceptorSample/InterceptorSample/ViewController.m index b0e66636028..ac6ce6752d9 100644 --- a/src/objective-c/examples/InterceptorSample/InterceptorSample/ViewController.m +++ b/src/objective-c/examples/InterceptorSample/InterceptorSample/ViewController.m @@ -19,8 +19,13 @@ #import "ViewController.h" #import +#if USE_FRAMEWORKS +#import +#import +#else #import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" +#endif #import "CacheInterceptor.h" diff --git a/src/objective-c/examples/InterceptorSample/Podfile b/src/objective-c/examples/InterceptorSample/Podfile index b20813d32aa..6df6c962148 100644 --- a/src/objective-c/examples/InterceptorSample/Podfile +++ b/src/objective-c/examples/InterceptorSample/Podfile @@ -2,6 +2,8 @@ platform :ios, '8.0' install! 'cocoapods', :deterministic_uuids => false +use_frameworks! if ENV['FRAMEWORKS'] != 'NO' + ROOT_DIR = '../../../..' target 'InterceptorSample' do diff --git a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec index 5bf1252aed8..fbc37317ba1 100644 --- a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec @@ -20,26 +20,29 @@ Pod::Spec.new do |s| well_known_types_dir = "#{repo_root}/third_party/protobuf/src" plugin = "#{bin_dir}/grpc_objective_c_plugin" - s.prepare_command = <<-CMD - if [ "$FRAMEWORKS" == "" ]; then + if ENV['FRAMEWORKS'] != 'NO' then + s.user_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'USE_FRAMEWORKS=1' } + s.prepare_command = <<-CMD #{protoc} \ --plugin=protoc-gen-grpc=#{plugin} \ --objc_out=. \ - --grpc_out=. \ + --grpc_out=generate_for_named_framework=#{s.name}:. \ + --objc_opt=generate_for_named_framework=#{s.name} \ -I #{repo_root} \ -I #{well_known_types_dir} \ #{repo_root}/src/objective-c/examples/RemoteTestClient/*.proto - else + CMD + else + s.prepare_command = <<-CMD #{protoc} \ --plugin=protoc-gen-grpc=#{plugin} \ --objc_out=. \ --grpc_out=. \ - --objc_opt=generate_for_named_framework=#{s.name} \ -I #{repo_root} \ -I #{well_known_types_dir} \ #{repo_root}/src/objective-c/examples/RemoteTestClient/*.proto - fi - CMD + CMD + end s.subspec 'Messages' do |ms| ms.source_files = '**/*.pbobjc.{h,m}' @@ -55,7 +58,7 @@ Pod::Spec.new do |s| ss.dependency 'gRPC-ProtoRPC' ss.dependency "#{s.name}/Messages" end - + s.pod_target_xcconfig = { # This is needed by all pods that depend on Protobuf: 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', diff --git a/src/objective-c/examples/Sample/Podfile b/src/objective-c/examples/Sample/Podfile index bebd55bd628..741a199602e 100644 --- a/src/objective-c/examples/Sample/Podfile +++ b/src/objective-c/examples/Sample/Podfile @@ -3,7 +3,7 @@ platform :ios, '8.0' install! 'cocoapods', :deterministic_uuids => false -use_frameworks! if ENV['FRAMEWORKS'] == 'YES' +use_frameworks! if ENV['FRAMEWORKS'] != 'NO' # Location of gRPC's repo root relative to this file. GRPC_LOCAL_SRC = '../../../..' diff --git a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj index 33bdc378165..43bcac028a1 100644 --- a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -12,11 +12,10 @@ 6369A2761A9322E20015FC5C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A2751A9322E20015FC5C /* ViewController.m */; }; 6369A2791A9322E20015FC5C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6369A2771A9322E20015FC5C /* Main.storyboard */; }; 6369A27B1A9322E20015FC5C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6369A27A1A9322E20015FC5C /* Images.xcassets */; }; - C8B8323DA07AC8C4499DC557 /* libPods-Sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A874B5E91AC811A1EA0D12CF /* libPods-Sample.a */; }; + 81BD5DEB744A906EF0708B68 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E85B2D77543A74F6CACF59A /* Pods_Sample.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 5A8C9F4B28733B249DE4AB6D /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; 6369A26A1A9322E20015FC5C /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 6369A26E1A9322E20015FC5C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 6369A26F1A9322E20015FC5C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -26,8 +25,9 @@ 6369A2751A9322E20015FC5C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 6369A2781A9322E20015FC5C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 6369A27A1A9322E20015FC5C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - A874B5E91AC811A1EA0D12CF /* libPods-Sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - E3C01DF315C4E7433BCEC6E6 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; + 6E85B2D77543A74F6CACF59A /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7544F97DDF1CB3F915E41CB9 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; + 8BDAC28EF9131C53B2E6870D /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -35,20 +35,28 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C8B8323DA07AC8C4499DC557 /* libPods-Sample.a in Frameworks */, + 81BD5DEB744A906EF0708B68 /* Pods_Sample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 14C78F05D9C5E2D5F426D233 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6E85B2D77543A74F6CACF59A /* Pods_Sample.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 6369A2611A9322E20015FC5C = { isa = PBXGroup; children = ( 6369A26C1A9322E20015FC5C /* Sample */, 6369A26B1A9322E20015FC5C /* Products */, - AB3331C9AE6488E61B2B094E /* Pods */, - C4C2C5219053E079C9EFB930 /* Frameworks */, + 9A3B057E55DE3C4F4A543CC5 /* Pods */, + 14C78F05D9C5E2D5F426D233 /* Frameworks */, ); sourceTree = ""; }; @@ -83,21 +91,13 @@ name = "Supporting Files"; sourceTree = ""; }; - AB3331C9AE6488E61B2B094E /* Pods */ = { + 9A3B057E55DE3C4F4A543CC5 /* Pods */ = { isa = PBXGroup; children = ( - E3C01DF315C4E7433BCEC6E6 /* Pods-Sample.debug.xcconfig */, - 5A8C9F4B28733B249DE4AB6D /* Pods-Sample.release.xcconfig */, + 7544F97DDF1CB3F915E41CB9 /* Pods-Sample.debug.xcconfig */, + 8BDAC28EF9131C53B2E6870D /* Pods-Sample.release.xcconfig */, ); - name = Pods; - sourceTree = ""; - }; - C4C2C5219053E079C9EFB930 /* Frameworks */ = { - isa = PBXGroup; - children = ( - A874B5E91AC811A1EA0D12CF /* libPods-Sample.a */, - ); - name = Frameworks; + path = Pods; sourceTree = ""; }; /* End PBXGroup section */ @@ -107,11 +107,11 @@ isa = PBXNativeTarget; buildConfigurationList = 6369A28D1A9322E20015FC5C /* Build configuration list for PBXNativeTarget "Sample" */; buildPhases = ( - 41F7486D8F66994B0BFB84AF /* [CP] Check Pods Manifest.lock */, + B8CFD95B6470E21429BC7DF0 /* [CP] Check Pods Manifest.lock */, 6369A2661A9322E20015FC5C /* Sources */, 6369A2671A9322E20015FC5C /* Frameworks */, 6369A2681A9322E20015FC5C /* Resources */, - 04554623324BE4A838846086 /* [CP] Copy Pods Resources */, + BFA56A3C239159EE5FFE4D61 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -167,40 +167,58 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 04554623324BE4A838846086 /* [CP] Copy Pods Resources */ = { + B8CFD95B6470E21429BC7DF0 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( ); - name = "[CP] Copy Pods Resources"; outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", + "$(DERIVED_FILE_DIR)/Pods-Sample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 41F7486D8F66994B0BFB84AF /* [CP] Check Pods Manifest.lock */ = { + BFA56A3C239159EE5FFE4D61 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", + "${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC/openssl_grpc.framework", + "${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework", + "${BUILT_PRODUCTS_DIR}/RemoteTest/RemoteTest.framework", + "${BUILT_PRODUCTS_DIR}/gRPC/GRPCClient.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-Core/grpc.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-ProtoRPC/ProtoRPC.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-RxLibrary/RxLibrary.framework", + "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Sample-checkManifestLockResult.txt", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RemoteTest.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRPCClient.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/grpc.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ProtoRPC.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxLibrary.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -311,9 +329,10 @@ }; 6369A28E1A9322E20015FC5C /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E3C01DF315C4E7433BCEC6E6 /* Pods-Sample.debug.xcconfig */; + baseConfigurationReference = 7544F97DDF1CB3F915E41CB9 /* Pods-Sample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; INFOPLIST_FILE = Sample/Info.plist; LD_GENERATE_MAP_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -324,9 +343,10 @@ }; 6369A28F1A9322E20015FC5C /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 5A8C9F4B28733B249DE4AB6D /* Pods-Sample.release.xcconfig */; + baseConfigurationReference = 8BDAC28EF9131C53B2E6870D /* Pods-Sample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; INFOPLIST_FILE = Sample/Info.plist; LD_GENERATE_MAP_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; diff --git a/src/objective-c/examples/Sample/Sample/ViewController.m b/src/objective-c/examples/Sample/Sample/ViewController.m index 2171a923d79..e4f3712d72d 100644 --- a/src/objective-c/examples/Sample/Sample/ViewController.m +++ b/src/objective-c/examples/Sample/Sample/ViewController.m @@ -20,8 +20,13 @@ #import #import +#if USE_FRAMEWORKS +#import +#import +#else #import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" +#endif #import #import diff --git a/src/objective-c/examples/SwiftSample/Images.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/examples/SwiftSample/Images.xcassets/AppIcon.appiconset/Contents.json index 36d2c80d889..d8db8d65fd7 100644 --- a/src/objective-c/examples/SwiftSample/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/src/objective-c/examples/SwiftSample/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -30,6 +40,16 @@ "size" : "60x60", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -59,6 +79,16 @@ "idiom" : "ipad", "size" : "76x76", "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/src/objective-c/examples/SwiftSample/RemoteTest.podspec b/src/objective-c/examples/SwiftSample/RemoteTest.podspec deleted file mode 100644 index e5f910c82d0..00000000000 --- a/src/objective-c/examples/SwiftSample/RemoteTest.podspec +++ /dev/null @@ -1,55 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'RemoteTest' - s.version = '0.0.1' - s.license = 'Apache License, Version 2.0' - s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' } - s.homepage = 'https://grpc.io/' - s.summary = 'RemoteTest example' - s.source = { :git => 'https://github.com/grpc/grpc.git' } - - s.ios.deployment_target = '7.1' - s.osx.deployment_target = '10.9' - - # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. - s.dependency "!ProtoCompiler-gRPCPlugin" - - repo_root = '../../../..' - bin_dir = "#{repo_root}/bins/$CONFIG" - - protoc = "#{bin_dir}/protobuf/protoc" - well_known_types_dir = "#{repo_root}/third_party/protobuf/src" - plugin = "#{bin_dir}/grpc_objective_c_plugin" - - s.prepare_command = <<-CMD - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --objc_out=. \ - --grpc_out=. \ - -I . \ - -I #{well_known_types_dir} \ - *.proto - CMD - - s.subspec 'Messages' do |ms| - ms.source_files = '**/*.pbobjc.{h,m}' - ms.header_mappings_dir = '.' - ms.requires_arc = false - ms.dependency 'Protobuf' - end - - s.subspec 'Services' do |ss| - ss.source_files = '**/*.pbrpc.{h,m}' - ss.header_mappings_dir = '.' - ss.requires_arc = true - ss.dependency 'gRPC-ProtoRPC' - ss.dependency "#{s.name}/Messages" - end - - s.pod_target_xcconfig = { - # This is needed by all pods that depend on Protobuf: - 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', - # This is needed by all pods that depend on gRPC-RxLibrary: - 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', - } - -end diff --git a/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj b/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj index ec8883456e4..953152e6153 100644 --- a/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj @@ -7,23 +7,23 @@ objects = { /* Begin PBXBuildFile section */ - 2A4D33FC1BAD9EE77F27E82F /* Pods_SwiftSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D24BFC7BA3339DF6B9A04EF /* Pods_SwiftSample.framework */; }; 633BFFC81B950B210007E424 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 633BFFC71B950B210007E424 /* AppDelegate.swift */; }; 633BFFCA1B950B210007E424 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 633BFFC91B950B210007E424 /* ViewController.swift */; }; 633BFFCD1B950B210007E424 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 633BFFCB1B950B210007E424 /* Main.storyboard */; }; 633BFFCF1B950B210007E424 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 633BFFCE1B950B210007E424 /* Images.xcassets */; }; + AC669361C16100FA4D34D7D1 /* Pods_SwiftSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CB8E8B90EEE20DEB124EE37 /* Pods_SwiftSample.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 544DD51C2905B1B0B00F57F3 /* Pods-SwiftSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.debug.xcconfig"; path = "Target Support Files/Pods-SwiftSample/Pods-SwiftSample.debug.xcconfig"; sourceTree = ""; }; + 5CB8E8B90EEE20DEB124EE37 /* Pods_SwiftSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 633BFFC21B950B210007E424 /* SwiftSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 633BFFC61B950B210007E424 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 633BFFC71B950B210007E424 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 633BFFC91B950B210007E424 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 633BFFCC1B950B210007E424 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 633BFFCE1B950B210007E424 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 7AD632A1760ED763C0BFFD0A /* Pods-SwiftSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.release.xcconfig"; path = "Target Support Files/Pods-SwiftSample/Pods-SwiftSample.release.xcconfig"; sourceTree = ""; }; - 7D24BFC7BA3339DF6B9A04EF /* Pods_SwiftSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D6F1AAEB4FD0559A16605616 /* Pods-SwiftSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.debug.xcconfig"; path = "Target Support Files/Pods-SwiftSample/Pods-SwiftSample.debug.xcconfig"; sourceTree = ""; }; + FAF69508F6AEB00B2D2EB3F2 /* Pods-SwiftSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.release.xcconfig"; path = "Target Support Files/Pods-SwiftSample/Pods-SwiftSample.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -31,30 +31,20 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 2A4D33FC1BAD9EE77F27E82F /* Pods_SwiftSample.framework in Frameworks */, + AC669361C16100FA4D34D7D1 /* Pods_SwiftSample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 3C394733A73BFFE2995E6DC5 /* Pods */ = { - isa = PBXGroup; - children = ( - D6F1AAEB4FD0559A16605616 /* Pods-SwiftSample.debug.xcconfig */, - 7AD632A1760ED763C0BFFD0A /* Pods-SwiftSample.release.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; 633BFFB91B950B210007E424 = { isa = PBXGroup; children = ( 633BFFC41B950B210007E424 /* SwiftSample */, 633BFFC31B950B210007E424 /* Products */, - 3C394733A73BFFE2995E6DC5 /* Pods */, - B3B46435EDEAE7572BF484F5 /* Frameworks */, + B26D8B90A783952E7BE194D9 /* Pods */, + 66C10D7692132083F1F396C6 /* Frameworks */, ); sourceTree = ""; }; @@ -86,14 +76,24 @@ name = "Supporting Files"; sourceTree = ""; }; - B3B46435EDEAE7572BF484F5 /* Frameworks */ = { + 66C10D7692132083F1F396C6 /* Frameworks */ = { isa = PBXGroup; children = ( - 7D24BFC7BA3339DF6B9A04EF /* Pods_SwiftSample.framework */, + 5CB8E8B90EEE20DEB124EE37 /* Pods_SwiftSample.framework */, ); name = Frameworks; sourceTree = ""; }; + B26D8B90A783952E7BE194D9 /* Pods */ = { + isa = PBXGroup; + children = ( + 544DD51C2905B1B0B00F57F3 /* Pods-SwiftSample.debug.xcconfig */, + FAF69508F6AEB00B2D2EB3F2 /* Pods-SwiftSample.release.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -101,11 +101,11 @@ isa = PBXNativeTarget; buildConfigurationList = 633BFFE11B950B210007E424 /* Build configuration list for PBXNativeTarget "SwiftSample" */; buildPhases = ( - 0BCFE5CC859FA15414AF3B5A /* [CP] Check Pods Manifest.lock */, + 405474DAAC9EB5A0055F82FA /* [CP] Check Pods Manifest.lock */, 633BFFBE1B950B210007E424 /* Sources */, 633BFFBF1B950B210007E424 /* Frameworks */, 633BFFC01B950B210007E424 /* Resources */, - 6998570BEA68700C0183464C /* [CP] Embed Pods Frameworks */, + 983E7AC7007F28ADB66E485B /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -162,7 +162,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 0BCFE5CC859FA15414AF3B5A /* [CP] Check Pods Manifest.lock */ = { + 405474DAAC9EB5A0055F82FA /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -184,7 +184,7 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 6998570BEA68700C0183464C /* [CP] Embed Pods Frameworks */ = { + 983E7AC7007F28ADB66E485B /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -330,7 +330,7 @@ }; 633BFFE21B950B210007E424 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D6F1AAEB4FD0559A16605616 /* Pods-SwiftSample.debug.xcconfig */; + baseConfigurationReference = 544DD51C2905B1B0B00F57F3 /* Pods-SwiftSample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = Info.plist; @@ -345,7 +345,7 @@ }; 633BFFE31B950B210007E424 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AD632A1760ED763C0BFFD0A /* Pods-SwiftSample.release.xcconfig */; + baseConfigurationReference = FAF69508F6AEB00B2D2EB3F2 /* Pods-SwiftSample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = Info.plist; diff --git a/src/objective-c/examples/SwiftSample/messages.proto b/src/objective-c/examples/SwiftSample/messages.proto deleted file mode 100644 index 128efd9337e..00000000000 --- a/src/objective-c/examples/SwiftSample/messages.proto +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Message definitions to be used by integration test service definitions. - -syntax = "proto3"; - -package grpc.testing; - -option objc_class_prefix = "RMT"; - -// The type of payload that should be returned. -enum PayloadType { - // Compressable text format. - COMPRESSABLE = 0; - - // Uncompressable binary format. - UNCOMPRESSABLE = 1; - - // Randomly chosen from all other formats defined in this enum. - RANDOM = 2; -} - -// A block of data, to simply increase gRPC message size. -message Payload { - // The type of data in body. - PayloadType type = 1; - // Primary contents of payload. - bytes body = 2; -} - -// Unary request. -message SimpleRequest { - // Desired payload type in the response from the server. - // If response_type is RANDOM, server randomly chooses one from other formats. - PayloadType response_type = 1; - - // Desired payload size in the response from the server. - // If response_type is COMPRESSABLE, this denotes the size before compression. - int32 response_size = 2; - - // Optional input payload sent along with the request. - Payload payload = 3; - - // Whether SimpleResponse should include username. - bool fill_username = 4; - - // Whether SimpleResponse should include OAuth scope. - bool fill_oauth_scope = 5; -} - -// Unary response, as configured by the request. -message SimpleResponse { - // Payload to increase message size. - Payload payload = 1; - // The user the request came from, for verifying authentication was - // successful when the client expected it. - string username = 2; - // OAuth scope. - string oauth_scope = 3; -} - -// Client-streaming request. -message StreamingInputCallRequest { - // Optional input payload sent along with the request. - Payload payload = 1; - - // Not expecting any payload from the response. -} - -// Client-streaming response. -message StreamingInputCallResponse { - // Aggregated size of payloads received from the client. - int32 aggregated_payload_size = 1; -} - -// Configuration for a particular response. -message ResponseParameters { - // Desired payload sizes in responses from the server. - // If response_type is COMPRESSABLE, this denotes the size before compression. - int32 size = 1; - - // Desired interval between consecutive responses in the response stream in - // microseconds. - int32 interval_us = 2; -} - -// Server-streaming request. -message StreamingOutputCallRequest { - // Desired payload type in the response from the server. - // If response_type is RANDOM, the payload from each response in the stream - // might be of different types. This is to simulate a mixed type of payload - // stream. - PayloadType response_type = 1; - - // Configuration for each expected response message. - repeated ResponseParameters response_parameters = 2; - - // Optional input payload sent along with the request. - Payload payload = 3; -} - -// Server-streaming response, as configured by the request and parameters. -message StreamingOutputCallResponse { - // Payload to increase response size. - Payload payload = 1; -} diff --git a/src/objective-c/examples/SwiftSample/test.proto b/src/objective-c/examples/SwiftSample/test.proto deleted file mode 100644 index c5696043630..00000000000 --- a/src/objective-c/examples/SwiftSample/test.proto +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// An integration test service that covers all the method signature permutations -// of unary/streaming requests/responses. -syntax = "proto3"; - -import "google/protobuf/empty.proto"; -import "messages.proto"; - -package grpc.testing; - -option objc_class_prefix = "RMT"; - -// A simple service to test the various types of RPCs and experiment with -// performance with various types of payload. -service TestService { - // One empty request followed by one empty response. - rpc EmptyCall(google.protobuf.Empty) returns (google.protobuf.Empty); - - // One request followed by one response. - rpc UnaryCall(SimpleRequest) returns (SimpleResponse); - - // One request followed by a sequence of responses (streamed download). - // The server returns the payload with client desired type and sizes. - rpc StreamingOutputCall(StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); - - // A sequence of requests followed by one response (streamed upload). - // The server returns the aggregated size of client payload as the result. - rpc StreamingInputCall(stream StreamingInputCallRequest) - returns (StreamingInputCallResponse); - - // A sequence of requests with each request served by the server immediately. - // As one request could lead to multiple responses, this interface - // demonstrates the idea of full duplexing. - rpc FullDuplexCall(stream StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); - - // A sequence of requests followed by a sequence of responses. - // The server buffers all the client requests and then serves them in order. A - // stream of responses are returned to the client when the server starts with - // first request. - rpc HalfDuplexCall(stream StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); -} From 7c1081964180add6101925ee7fb7b7dea01f3636 Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Thu, 25 Jul 2019 15:31:26 -0700 Subject: [PATCH 100/661] Fix comments --- src/core/lib/iomgr/executor/mpmcqueue.cc | 6 +++--- src/core/lib/iomgr/executor/mpmcqueue.h | 8 +++++--- test/core/iomgr/mpmcqueue_test.cc | 9 +++++---- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/core/lib/iomgr/executor/mpmcqueue.cc b/src/core/lib/iomgr/executor/mpmcqueue.cc index 62226450a18..74096a4c5b0 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.cc +++ b/src/core/lib/iomgr/executor/mpmcqueue.cc @@ -81,11 +81,11 @@ InfLenFIFOQueue::InfLenFIFOQueue() { delete_list_ = static_cast(gpr_zalloc(sizeof(Node*) * delete_list_size_)); - Node* new_chunk = AllocateNodes(kDeleteListInitSize); + Node* new_chunk = AllocateNodes(kQueueInitNumNodes); delete_list_[delete_list_count_++] = new_chunk; queue_head_ = queue_tail_ = new_chunk; - new_chunk[0].prev = &new_chunk[1023]; - new_chunk[1023].next = &new_chunk[0]; + new_chunk[0].prev = &new_chunk[kQueueInitNumNodes - 1]; + new_chunk[kQueueInitNumNodes - 1].next = &new_chunk[0]; waiters_.next = &waiters_; waiters_.prev = &waiters_; diff --git a/src/core/lib/iomgr/executor/mpmcqueue.h b/src/core/lib/iomgr/executor/mpmcqueue.h index 0d44b7231d3..ab5c484e094 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.h +++ b/src/core/lib/iomgr/executor/mpmcqueue.h @@ -88,7 +88,7 @@ class InfLenFIFOQueue : public MPMCQueueInterface { }; // For test purpose only. Returns number of nodes allocated in queue. - // All allocated nodes will not be free until destruction of queue. + // Any allocated node will be alive until the destruction of the queue. int num_nodes() const { return num_nodes_; } // For test purpose only. Returns the initial number of nodes in queue. @@ -147,8 +147,10 @@ class InfLenFIFOQueue : public MPMCQueueInterface { Mutex mu_; // Protecting lock Waiter waiters_; // Head of waiting thread queue - const int kDeleteListInitSize = 1024; // Initial size for delete list - const int kQueueInitNumNodes = 1024; // Initial number of nodes allocated + // Initial size for delete list + static const int kDeleteListInitSize = 1024; + // Initial number of nodes allocated + static const int kQueueInitNumNodes = 1024; Node** delete_list_ = nullptr; // Keeps track of all allocated array entries // for deleting on destruction diff --git a/test/core/iomgr/mpmcqueue_test.cc b/test/core/iomgr/mpmcqueue_test.cc index 732c43a06f5..9ebc1cc7363 100644 --- a/test/core/iomgr/mpmcqueue_test.cc +++ b/test/core/iomgr/mpmcqueue_test.cc @@ -127,7 +127,7 @@ static void test_space_efficiency(void) { for (int i = 0; i < queue.init_num_nodes(); ++i) { queue.Put(static_cast(grpc_core::New(i))); } - // List should not have been expanded at this time. + // Queue should not have been expanded at this time. GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes()); for (int i = 0; i < queue.init_num_nodes(); ++i) { WorkItem* item = static_cast(queue.Get()); @@ -138,6 +138,7 @@ static void test_space_efficiency(void) { WorkItem* item = static_cast(queue.Get()); grpc_core::Delete(item); } + // Queue never shrinks even it is empty. GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes()); GPR_ASSERT(queue.count() == 0); // queue empty now @@ -145,20 +146,20 @@ static void test_space_efficiency(void) { queue.Put(static_cast(grpc_core::New(i))); } GPR_ASSERT(queue.count() == queue.init_num_nodes() * 2); - // List should have been expanded once. + // Queue should have been expanded once. GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes() * 2); for (int i = 0; i < queue.init_num_nodes(); ++i) { WorkItem* item = static_cast(queue.Get()); grpc_core::Delete(item); } GPR_ASSERT(queue.count() == queue.init_num_nodes()); - // List will never shrink, should keep same number of node as before. + // Queue will never shrink, should keep same number of node as before. GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes() * 2); for (int i = 0; i < queue.init_num_nodes() + 1; ++i) { queue.Put(static_cast(grpc_core::New(i))); } GPR_ASSERT(queue.count() == queue.init_num_nodes() * 2 + 1); - // List should have been expanded twice. + // Queue should have been expanded twice. GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes() * 4); for (int i = 0; i < queue.init_num_nodes() * 2 + 1; ++i) { WorkItem* item = static_cast(queue.Get()); From e76a5dd73cb719aa588e4844cb4f69956b39b89b Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 25 Jul 2019 14:52:40 -0700 Subject: [PATCH 101/661] Fixed clang_format_code --- src/compiler/objective_c_generator_helpers.h | 4 +- src/compiler/objective_c_plugin.cc | 31 +++++----- .../Sample/Sample.xcodeproj/project.pbxproj | 56 +++++++++---------- .../tests/InteropTests/InteropTests.m | 6 +- .../InteropTestsMultipleChannels.m | 2 +- src/objective-c/tests/MacTests/StressTests.m | 6 +- src/objective-c/tests/UnitTests/APIv2Tests.m | 2 +- .../tests/UnitTests/GRPCClientTests.m | 2 +- 8 files changed, 57 insertions(+), 52 deletions(-) diff --git a/src/compiler/objective_c_generator_helpers.h b/src/compiler/objective_c_generator_helpers.h index de8f52d802c..b5262fcdd6f 100644 --- a/src/compiler/objective_c_generator_helpers.h +++ b/src/compiler/objective_c_generator_helpers.h @@ -22,7 +22,6 @@ #include using namespace std; - #include #include "src/compiler/config.h" #include "src/compiler/generator_helpers.h" @@ -49,7 +48,8 @@ inline ::grpc::string LocalImport(const ::grpc::string& import) { return ::grpc::string("#import \"" + import + "\"\n"); } -inline ::grpc::string FrameworkImport(const ::grpc::string& import, const ::grpc::string& framework) { +inline ::grpc::string FrameworkImport(const ::grpc::string& import, + const ::grpc::string& framework) { // Flattens the directory structure std::size_t pos = import.rfind("/"); ::grpc::string filename = import.substr(pos + 1, import.size() - pos); diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index 3ac7ea13a96..4a452a8265c 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -29,8 +29,8 @@ using ::google::protobuf::compiler::objectivec:: IsProtobufLibraryBundledProtoFile; using ::google::protobuf::compiler::objectivec::ProtobufLibraryFrameworkName; -using ::grpc_objective_c_generator::LocalImport; using ::grpc_objective_c_generator::FrameworkImport; +using ::grpc_objective_c_generator::LocalImport; using ::grpc_objective_c_generator::PreprocIfElse; using ::grpc_objective_c_generator::PreprocIfNot; using ::grpc_objective_c_generator::SystemImport; @@ -38,7 +38,8 @@ using ::grpc_objective_c_generator::SystemImport; namespace { inline ::grpc::string ImportProtoHeaders( - const grpc::protobuf::FileDescriptor* dep, const char* indent, const ::grpc::string &framework) { + const grpc::protobuf::FileDescriptor* dep, const char* indent, + const ::grpc::string& framework) { ::grpc::string header = grpc_objective_c_generator::MessageHeaderName(dep); // cerr << header << endl; @@ -81,9 +82,12 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { } ::grpc::string framework; - std::vector<::grpc::string> params_list = grpc_generator::tokenize(parameter, ","); - for (auto param_str = params_list.begin(); param_str != params_list.end(); ++param_str) { - std::vector<::grpc::string> param = grpc_generator::tokenize(*param_str, "="); + std::vector<::grpc::string> params_list = + grpc_generator::tokenize(parameter, ","); + for (auto param_str = params_list.begin(); param_str != params_list.end(); + ++param_str) { + std::vector<::grpc::string> param = + grpc_generator::tokenize(*param_str, "="); if (param[0] == "generate_for_named_framework") { framework = param[1]; } @@ -100,7 +104,7 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { { // Generate .pbrpc.h - + ::grpc::string imports; if (framework.empty()) { imports = LocalImport(file_name + ".pbobjc.h"); @@ -126,7 +130,8 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string class_imports; for (int i = 0; i < file->dependency_count(); i++) { - class_imports += ImportProtoHeaders(file->dependency(i), " ", framework); + class_imports += + ImportProtoHeaders(file->dependency(i), " ", framework); } ::grpc::string ng_protocols; @@ -164,14 +169,14 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string imports; if (framework.empty()) { imports = LocalImport(file_name + ".pbrpc.h") + - LocalImport(file_name + ".pbobjc.h") + - SystemImport("ProtoRPC/ProtoRPC.h") + - SystemImport("RxLibrary/GRXWriter+Immediate.h"); + LocalImport(file_name + ".pbobjc.h") + + SystemImport("ProtoRPC/ProtoRPC.h") + + SystemImport("RxLibrary/GRXWriter+Immediate.h"); } else { imports = FrameworkImport(file_name + ".pbrpc.h", framework) + - FrameworkImport(file_name + ".pbobjc.h", framework) + - SystemImport("ProtoRPC/ProtoRPC.h") + - SystemImport("RxLibrary/GRXWriter+Immediate.h"); + FrameworkImport(file_name + ".pbobjc.h", framework) + + SystemImport("ProtoRPC/ProtoRPC.h") + + SystemImport("RxLibrary/GRXWriter+Immediate.h"); } ::grpc::string class_imports; diff --git a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj index 43bcac028a1..efb4835eb8d 100644 --- a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -12,7 +12,7 @@ 6369A2761A9322E20015FC5C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A2751A9322E20015FC5C /* ViewController.m */; }; 6369A2791A9322E20015FC5C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6369A2771A9322E20015FC5C /* Main.storyboard */; }; 6369A27B1A9322E20015FC5C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6369A27A1A9322E20015FC5C /* Images.xcassets */; }; - 81BD5DEB744A906EF0708B68 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E85B2D77543A74F6CACF59A /* Pods_Sample.framework */; }; + 983179392696210F31F36D26 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CCD4500A079C9D59E6CC5062 /* Pods_Sample.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -25,9 +25,9 @@ 6369A2751A9322E20015FC5C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 6369A2781A9322E20015FC5C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 6369A27A1A9322E20015FC5C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 6E85B2D77543A74F6CACF59A /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7544F97DDF1CB3F915E41CB9 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; 8BDAC28EF9131C53B2E6870D /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; + CCD4500A079C9D59E6CC5062 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -35,7 +35,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 81BD5DEB744A906EF0708B68 /* Pods_Sample.framework in Frameworks */, + 983179392696210F31F36D26 /* Pods_Sample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -45,7 +45,7 @@ 14C78F05D9C5E2D5F426D233 /* Frameworks */ = { isa = PBXGroup; children = ( - 6E85B2D77543A74F6CACF59A /* Pods_Sample.framework */, + CCD4500A079C9D59E6CC5062 /* Pods_Sample.framework */, ); name = Frameworks; sourceTree = ""; @@ -111,7 +111,7 @@ 6369A2661A9322E20015FC5C /* Sources */, 6369A2671A9322E20015FC5C /* Frameworks */, 6369A2681A9322E20015FC5C /* Resources */, - BFA56A3C239159EE5FFE4D61 /* [CP] Embed Pods Frameworks */, + 619CBF6DBB6BFE7F5B5A4777 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -167,29 +167,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - B8CFD95B6470E21429BC7DF0 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Sample-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - BFA56A3C239159EE5FFE4D61 /* [CP] Embed Pods Frameworks */ = { + 619CBF6DBB6BFE7F5B5A4777 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -221,6 +199,28 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; + B8CFD95B6470E21429BC7DF0 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Sample-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/src/objective-c/tests/InteropTests/InteropTests.m b/src/objective-c/tests/InteropTests/InteropTests.m index ae5651651e0..c13dd1e2b35 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.m +++ b/src/objective-c/tests/InteropTests/InteropTests.m @@ -30,13 +30,13 @@ #import #import #import -#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" -#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" -#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" #import #import #import #import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" #import "../ConfigureCronet.h" #import "InteropTestsBlockCallbacks.h" diff --git a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m index 44bd5ab3924..a2a3e64b1b1 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m +++ b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m @@ -21,10 +21,10 @@ #ifdef GRPC_COMPILE_WITH_CRONET #import #endif +#import #import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" #import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" -#import #import "../ConfigureCronet.h" #import "InteropTestsBlockCallbacks.h" diff --git a/src/objective-c/tests/MacTests/StressTests.m b/src/objective-c/tests/MacTests/StressTests.m index 8421d48e108..c7020740eac 100644 --- a/src/objective-c/tests/MacTests/StressTests.m +++ b/src/objective-c/tests/MacTests/StressTests.m @@ -21,13 +21,13 @@ #import #import #import -#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" -#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" -#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" #import #import #import #import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" #define TEST_TIMEOUT 32 diff --git a/src/objective-c/tests/UnitTests/APIv2Tests.m b/src/objective-c/tests/UnitTests/APIv2Tests.m index 99c947e335b..86d4e8b3619 100644 --- a/src/objective-c/tests/UnitTests/APIv2Tests.m +++ b/src/objective-c/tests/UnitTests/APIv2Tests.m @@ -18,8 +18,8 @@ #import #import -#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" #import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" #include #include diff --git a/src/objective-c/tests/UnitTests/GRPCClientTests.m b/src/objective-c/tests/UnitTests/GRPCClientTests.m index 579f113eada..3d144c33b06 100644 --- a/src/objective-c/tests/UnitTests/GRPCClientTests.m +++ b/src/objective-c/tests/UnitTests/GRPCClientTests.m @@ -26,10 +26,10 @@ #import #import #import -#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" #import #import #import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" #include From 6b99f47bbfc0137ffea34d47030b1d369e459d23 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 25 Jul 2019 17:56:16 -0700 Subject: [PATCH 102/661] Try modifying kokoro job because Sample's default FRAMEWORK is set to YES now --- tools/run_tests/run_tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index f11927bd5d6..cbcd98700c1 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1066,7 +1066,8 @@ class ObjCLanguage(object): cpu_cost=1e6, environ={ 'SCHEME': 'Sample', - 'EXAMPLE_PATH': 'src/objective-c/examples/Sample' + 'EXAMPLE_PATH': 'src/objective-c/examples/Sample', + 'FRAMEWORKS': 'NO' })) out.append( self.config.job_spec( From 07dc75b5ca5fca2ed44a641b14e8ea91aabb416f Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 25 Jul 2019 20:38:48 -0700 Subject: [PATCH 103/661] Fix Frameworks build error --- gRPC.podspec | 12 +++--- src/objective-c/GRPCClient/GRPCCallLegacy.h | 2 +- src/objective-c/GRPCClient/GRPCCallOptions.h | 39 +------------------ src/objective-c/GRPCClient/GRPCTypes.h | 37 ++++++++++++++++++ .../InteropTestsMultipleChannels.m | 1 + templates/gRPC.podspec.template | 12 +++--- 6 files changed, 55 insertions(+), 48 deletions(-) create mode 100644 src/objective-c/GRPCClient/GRPCTypes.h diff --git a/gRPC.podspec b/gRPC.podspec index 9ddbb18d393..19811a01e1f 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -40,7 +40,7 @@ Pod::Spec.new do |s| s.module_name = name s.header_dir = name - s.default_subspec = 'Interface', 'GRPCCore' + s.default_subspec = 'Interface', 'GRPCCore', 'Interface-Legacy' s.pod_target_xcconfig = { # This is needed by all pods that depend on gRPC-RxLibrary: @@ -51,9 +51,11 @@ Pod::Spec.new do |s| s.subspec 'Interface-Legacy' do |ss| ss.header_mappings_dir = 'src/objective-c/GRPCClient' - ss.public_header_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h" + ss.public_header_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h", + "src/objective-c/GRPCClient/GRPCTypes.h" - ss.source_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h" + ss.source_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h", + "src/objective-c/GRPCClient/GRPCTypes.h" end s.subspec 'Interface' do |ss| @@ -64,8 +66,7 @@ Pod::Spec.new do |s| 'src/objective-c/GRPCClient/GRPCCallOptions.h', 'src/objective-c/GRPCClient/GRPCInterceptor.h', 'src/objective-c/GRPCClient/GRPCTransport.h', - 'src/objective-c/GRPCClient/GRPCDispatchable.h', - 'src/objective-c/GRPCClient/internal/*.h' + 'src/objective-c/GRPCClient/GRPCDispatchable.h' ss.source_files = 'src/objective-c/GRPCClient/GRPCCall.h', 'src/objective-c/GRPCClient/GRPCCall.m', @@ -112,6 +113,7 @@ Pod::Spec.new do |s| # Certificates, to be able to establish TLS connections: ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } + ss.dependency "#{s.name}/Interface-Legacy", version ss.dependency "#{s.name}/Interface", version ss.dependency 'gRPC-Core', version ss.dependency 'gRPC-RxLibrary', version diff --git a/src/objective-c/GRPCClient/GRPCCallLegacy.h b/src/objective-c/GRPCClient/GRPCCallLegacy.h index e6103498639..51dd7da3440 100644 --- a/src/objective-c/GRPCClient/GRPCCallLegacy.h +++ b/src/objective-c/GRPCClient/GRPCCallLegacy.h @@ -22,7 +22,7 @@ */ #import -#import "GRPCCallOptions.h" +#import "GRPCTypes.h" #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-completeness" diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.h b/src/objective-c/GRPCClient/GRPCCallOptions.h index 80c0244d78d..6adc8aa1776 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.h +++ b/src/objective-c/GRPCClient/GRPCCallOptions.h @@ -18,48 +18,13 @@ #import +#import "GRPCTypes.h" + NS_ASSUME_NONNULL_BEGIN typedef char *GRPCTransportId; @protocol GRPCInterceptorFactory; -/** - * Safety remark of a gRPC method as defined in RFC 2616 Section 9.1 - */ -typedef NS_ENUM(NSUInteger, GRPCCallSafety) { - /** Signal that there is no guarantees on how the call affects the server state. */ - GRPCCallSafetyDefault = 0, - /** Signal that the call is idempotent. gRPC is free to use PUT verb. */ - GRPCCallSafetyIdempotentRequest = 1, - /** - * Signal that the call is cacheable and will not affect server state. gRPC is free to use GET - * verb. - */ - GRPCCallSafetyCacheableRequest = 2, -}; - -// Compression algorithm to be used by a gRPC call -typedef NS_ENUM(NSUInteger, GRPCCompressionAlgorithm) { - GRPCCompressNone = 0, - GRPCCompressDeflate, - GRPCCompressGzip, - GRPCStreamCompressGzip, -}; - -// GRPCCompressAlgorithm is deprecated; use GRPCCompressionAlgorithm -typedef GRPCCompressionAlgorithm GRPCCompressAlgorithm; - -/** The transport to be used by a gRPC call */ -typedef NS_ENUM(NSUInteger, GRPCTransportType) { - GRPCTransportTypeDefault = 0, - /** gRPC internal HTTP/2 stack with BoringSSL */ - GRPCTransportTypeChttp2BoringSSL = 0, - /** Cronet stack */ - GRPCTransportTypeCronet, - /** Insecure channel. FOR TEST ONLY! */ - GRPCTransportTypeInsecure, -}; - /** * Implement this protocol to provide a token to gRPC when a call is initiated. */ diff --git a/src/objective-c/GRPCClient/GRPCTypes.h b/src/objective-c/GRPCClient/GRPCTypes.h new file mode 100644 index 00000000000..45fbe219a91 --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCTypes.h @@ -0,0 +1,37 @@ +/** + * Safety remark of a gRPC method as defined in RFC 2616 Section 9.1 + */ +typedef NS_ENUM(NSUInteger, GRPCCallSafety) { + /** Signal that there is no guarantees on how the call affects the server state. */ + GRPCCallSafetyDefault = 0, + /** Signal that the call is idempotent. gRPC is free to use PUT verb. */ + GRPCCallSafetyIdempotentRequest = 1, + /** + * Signal that the call is cacheable and will not affect server state. gRPC is free to use GET + * verb. + */ + GRPCCallSafetyCacheableRequest = 2, +}; + +// Compression algorithm to be used by a gRPC call +typedef NS_ENUM(NSUInteger, GRPCCompressionAlgorithm) { + GRPCCompressNone = 0, + GRPCCompressDeflate, + GRPCCompressGzip, + GRPCStreamCompressGzip, +}; + +// GRPCCompressAlgorithm is deprecated; use GRPCCompressionAlgorithm +typedef GRPCCompressionAlgorithm GRPCCompressAlgorithm; + +/** The transport to be used by a gRPC call */ +typedef NS_ENUM(NSUInteger, GRPCTransportType) { + GRPCTransportTypeDefault = 0, + /** gRPC internal HTTP/2 stack with BoringSSL */ + GRPCTransportTypeChttp2BoringSSL = 0, + /** Cronet stack */ + GRPCTransportTypeCronet, + /** Insecure channel. FOR TEST ONLY! */ + GRPCTransportTypeInsecure, +}; + diff --git a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m index fef9f2e7ddd..4a3c2b955ac 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m +++ b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m @@ -23,6 +23,7 @@ #import #import #import +#import #import "../ConfigureCronet.h" #import "InteropTestsBlockCallbacks.h" diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index 21cce3c23ee..78e95abdc9e 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -42,7 +42,7 @@ s.module_name = name s.header_dir = name - s.default_subspec = 'Interface', 'GRPCCore' + s.default_subspec = 'Interface', 'GRPCCore', 'Interface-Legacy' s.pod_target_xcconfig = { # This is needed by all pods that depend on gRPC-RxLibrary: @@ -53,9 +53,11 @@ s.subspec 'Interface-Legacy' do |ss| ss.header_mappings_dir = 'src/objective-c/GRPCClient' - ss.public_header_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h" + ss.public_header_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h", + "src/objective-c/GRPCClient/GRPCTypes.h" - ss.source_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h" + ss.source_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h", + "src/objective-c/GRPCClient/GRPCTypes.h" end s.subspec 'Interface' do |ss| @@ -66,8 +68,7 @@ 'src/objective-c/GRPCClient/GRPCCallOptions.h', 'src/objective-c/GRPCClient/GRPCInterceptor.h', 'src/objective-c/GRPCClient/GRPCTransport.h', - 'src/objective-c/GRPCClient/GRPCDispatchable.h', - 'src/objective-c/GRPCClient/internal/*.h' + 'src/objective-c/GRPCClient/GRPCDispatchable.h' ss.source_files = 'src/objective-c/GRPCClient/GRPCCall.h', 'src/objective-c/GRPCClient/GRPCCall.m', @@ -114,6 +115,7 @@ # Certificates, to be able to establish TLS connections: ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } + ss.dependency "#{s.name}/Interface-Legacy", version ss.dependency "#{s.name}/Interface", version ss.dependency 'gRPC-Core', version ss.dependency 'gRPC-RxLibrary', version From c914fbbc1d9be8030e76d07a005927a63109fc61 Mon Sep 17 00:00:00 2001 From: Lev Pachmanov Date: Fri, 26 Jul 2019 19:49:57 +0300 Subject: [PATCH 104/661] catch the error if socket initialization fails --- src/core/lib/iomgr/tcp_server_custom.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/iomgr/tcp_server_custom.cc b/src/core/lib/iomgr/tcp_server_custom.cc index 767404be21d..61b307fc4c0 100644 --- a/src/core/lib/iomgr/tcp_server_custom.cc +++ b/src/core/lib/iomgr/tcp_server_custom.cc @@ -391,7 +391,7 @@ static grpc_error* tcp_server_add_port(grpc_tcp_server* s, socket->endpoint = nullptr; socket->listener = nullptr; socket->connector = nullptr; - grpc_custom_socket_vtable->init(socket, family); + error = grpc_custom_socket_vtable->init(socket, family); if (error == GRPC_ERROR_NONE) { error = add_socket_to_server(s, socket, addr, port_index, &sp); From c3de8448ea3460184d769e99c99507e050ffcb96 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Fri, 26 Jul 2019 16:49:05 -0700 Subject: [PATCH 105/661] Reverting projct.pbxproj --- .../project.pbxproj | 36 +- .../Sample/Sample.xcodeproj/project.pbxproj | 96 ++-- .../SwiftSample.xcodeproj/project.pbxproj | 77 ++-- .../tests/Tests.xcodeproj/project.pbxproj | 413 ++++++++++++------ 4 files changed, 387 insertions(+), 235 deletions(-) diff --git a/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj b/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj index b3f9d0500e5..8b8811d4c62 100644 --- a/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/InterceptorSample/InterceptorSample.xcodeproj/project.pbxproj @@ -3,10 +3,11 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ + 1C4854A76EEB56F8096DBDEF /* libPods-InterceptorSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CB7A7A5B91FC976FCF4637AE /* libPods-InterceptorSample.a */; }; 5EE960FB2266768A0044A74F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE960FA2266768A0044A74F /* AppDelegate.m */; }; 5EE960FE2266768A0044A74F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE960FD2266768A0044A74F /* ViewController.m */; }; 5EE961012266768A0044A74F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EE960FF2266768A0044A74F /* Main.storyboard */; }; @@ -14,11 +15,10 @@ 5EE961062266768C0044A74F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EE961042266768C0044A74F /* LaunchScreen.storyboard */; }; 5EE961092266768C0044A74F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE961082266768C0044A74F /* main.m */; }; 5EE9611222668CF20044A74F /* CacheInterceptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE9611122668CF20044A74F /* CacheInterceptor.m */; }; - 9F142CE7AFDA64BD5AEE9849 /* libPods-InterceptorSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B8FBA9621C9B11B3AC233A96 /* libPods-InterceptorSample.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 18F2D91B047D36868BCD504B /* Pods-InterceptorSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.release.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.release.xcconfig"; sourceTree = ""; }; + 09457A264AAE5323BF50B1F8 /* Pods-InterceptorSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.debug.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.debug.xcconfig"; sourceTree = ""; }; 5EE960F62266768A0044A74F /* InterceptorSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InterceptorSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5EE960FA2266768A0044A74F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 5EE960FC2266768A0044A74F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; @@ -31,8 +31,8 @@ 5EE9610F2266774C0044A74F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 5EE9611022668CE20044A74F /* CacheInterceptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CacheInterceptor.h; sourceTree = ""; }; 5EE9611122668CF20044A74F /* CacheInterceptor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CacheInterceptor.m; sourceTree = ""; }; - AD256CCFA3FE501D3D876F1D /* Pods-InterceptorSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.debug.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.debug.xcconfig"; sourceTree = ""; }; - B8FBA9621C9B11B3AC233A96 /* libPods-InterceptorSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InterceptorSample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + A0789280A4035D0F22F96BE6 /* Pods-InterceptorSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.release.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.release.xcconfig"; sourceTree = ""; }; + CB7A7A5B91FC976FCF4637AE /* libPods-InterceptorSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InterceptorSample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -40,7 +40,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9F142CE7AFDA64BD5AEE9849 /* libPods-InterceptorSample.a in Frameworks */, + 1C4854A76EEB56F8096DBDEF /* libPods-InterceptorSample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -53,7 +53,7 @@ 5EE960F82266768A0044A74F /* InterceptorSample */, 5EE960F72266768A0044A74F /* Products */, 9D49DB75F3BEDAFDE7028B51 /* Pods */, - B3868CDC20EB754A8D582F03 /* Frameworks */, + BD7184728351C7DDAFBA5FA2 /* Frameworks */, ); sourceTree = ""; }; @@ -86,16 +86,16 @@ 9D49DB75F3BEDAFDE7028B51 /* Pods */ = { isa = PBXGroup; children = ( - AD256CCFA3FE501D3D876F1D /* Pods-InterceptorSample.debug.xcconfig */, - 18F2D91B047D36868BCD504B /* Pods-InterceptorSample.release.xcconfig */, + 09457A264AAE5323BF50B1F8 /* Pods-InterceptorSample.debug.xcconfig */, + A0789280A4035D0F22F96BE6 /* Pods-InterceptorSample.release.xcconfig */, ); path = Pods; sourceTree = ""; }; - B3868CDC20EB754A8D582F03 /* Frameworks */ = { + BD7184728351C7DDAFBA5FA2 /* Frameworks */ = { isa = PBXGroup; children = ( - B8FBA9621C9B11B3AC233A96 /* libPods-InterceptorSample.a */, + CB7A7A5B91FC976FCF4637AE /* libPods-InterceptorSample.a */, ); name = Frameworks; sourceTree = ""; @@ -107,11 +107,11 @@ isa = PBXNativeTarget; buildConfigurationList = 5EE9610C2266768C0044A74F /* Build configuration list for PBXNativeTarget "InterceptorSample" */; buildPhases = ( - D31C16F578D4BF95F5638778 /* [CP] Check Pods Manifest.lock */, + 7531607F028A04DAAF5E97B5 /* [CP] Check Pods Manifest.lock */, 5EE960F22266768A0044A74F /* Sources */, 5EE960F32266768A0044A74F /* Frameworks */, 5EE960F42266768A0044A74F /* Resources */, - 45857CF606BB268EB3BC476F /* [CP] Copy Pods Resources */, + 17700C95BAEBB27F7A3D1B01 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -168,7 +168,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 45857CF606BB268EB3BC476F /* [CP] Copy Pods Resources */ = { + 17700C95BAEBB27F7A3D1B01 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -185,7 +185,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources.sh\"\n"; showEnvVarsInLog = 0; }; - D31C16F578D4BF95F5638778 /* [CP] Check Pods Manifest.lock */ = { + 7531607F028A04DAAF5E97B5 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -357,7 +357,7 @@ }; 5EE9610D2266768C0044A74F /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = AD256CCFA3FE501D3D876F1D /* Pods-InterceptorSample.debug.xcconfig */; + baseConfigurationReference = 09457A264AAE5323BF50B1F8 /* Pods-InterceptorSample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; @@ -369,13 +369,12 @@ PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InterceptorSample; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = ""; }; name = Debug; }; 5EE9610E2266768C0044A74F /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 18F2D91B047D36868BCD504B /* Pods-InterceptorSample.release.xcconfig */; + baseConfigurationReference = A0789280A4035D0F22F96BE6 /* Pods-InterceptorSample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; @@ -387,7 +386,6 @@ PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InterceptorSample; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = ""; }; name = Release; }; diff --git a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj index efb4835eb8d..cdd1c6c8f7e 100644 --- a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -7,15 +7,16 @@ objects = { /* Begin PBXBuildFile section */ + 3F035697392F601049D3DDE1 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC1B27EA0C428429B07BC34B /* Pods_Sample.framework */; }; 6369A2701A9322E20015FC5C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A26F1A9322E20015FC5C /* main.m */; }; 6369A2731A9322E20015FC5C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A2721A9322E20015FC5C /* AppDelegate.m */; }; 6369A2761A9322E20015FC5C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A2751A9322E20015FC5C /* ViewController.m */; }; 6369A2791A9322E20015FC5C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6369A2771A9322E20015FC5C /* Main.storyboard */; }; 6369A27B1A9322E20015FC5C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6369A27A1A9322E20015FC5C /* Images.xcassets */; }; - 983179392696210F31F36D26 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CCD4500A079C9D59E6CC5062 /* Pods_Sample.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 5A8C9F4B28733B249DE4AB6D /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; 6369A26A1A9322E20015FC5C /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 6369A26E1A9322E20015FC5C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 6369A26F1A9322E20015FC5C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -25,9 +26,8 @@ 6369A2751A9322E20015FC5C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 6369A2781A9322E20015FC5C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 6369A27A1A9322E20015FC5C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 7544F97DDF1CB3F915E41CB9 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; - 8BDAC28EF9131C53B2E6870D /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; - CCD4500A079C9D59E6CC5062 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + CC1B27EA0C428429B07BC34B /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E3C01DF315C4E7433BCEC6E6 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -35,28 +35,20 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 983179392696210F31F36D26 /* Pods_Sample.framework in Frameworks */, + 3F035697392F601049D3DDE1 /* Pods_Sample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 14C78F05D9C5E2D5F426D233 /* Frameworks */ = { - isa = PBXGroup; - children = ( - CCD4500A079C9D59E6CC5062 /* Pods_Sample.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; 6369A2611A9322E20015FC5C = { isa = PBXGroup; children = ( 6369A26C1A9322E20015FC5C /* Sample */, 6369A26B1A9322E20015FC5C /* Products */, - 9A3B057E55DE3C4F4A543CC5 /* Pods */, - 14C78F05D9C5E2D5F426D233 /* Frameworks */, + AB3331C9AE6488E61B2B094E /* Pods */, + C4C2C5219053E079C9EFB930 /* Frameworks */, ); sourceTree = ""; }; @@ -91,13 +83,21 @@ name = "Supporting Files"; sourceTree = ""; }; - 9A3B057E55DE3C4F4A543CC5 /* Pods */ = { + AB3331C9AE6488E61B2B094E /* Pods */ = { isa = PBXGroup; children = ( - 7544F97DDF1CB3F915E41CB9 /* Pods-Sample.debug.xcconfig */, - 8BDAC28EF9131C53B2E6870D /* Pods-Sample.release.xcconfig */, + E3C01DF315C4E7433BCEC6E6 /* Pods-Sample.debug.xcconfig */, + 5A8C9F4B28733B249DE4AB6D /* Pods-Sample.release.xcconfig */, ); - path = Pods; + name = Pods; + sourceTree = ""; + }; + C4C2C5219053E079C9EFB930 /* Frameworks */ = { + isa = PBXGroup; + children = ( + CC1B27EA0C428429B07BC34B /* Pods_Sample.framework */, + ); + name = Frameworks; sourceTree = ""; }; /* End PBXGroup section */ @@ -107,11 +107,12 @@ isa = PBXNativeTarget; buildConfigurationList = 6369A28D1A9322E20015FC5C /* Build configuration list for PBXNativeTarget "Sample" */; buildPhases = ( - B8CFD95B6470E21429BC7DF0 /* [CP] Check Pods Manifest.lock */, + 41F7486D8F66994B0BFB84AF /* [CP] Check Pods Manifest.lock */, 6369A2661A9322E20015FC5C /* Sources */, 6369A2671A9322E20015FC5C /* Frameworks */, 6369A2681A9322E20015FC5C /* Resources */, - 619CBF6DBB6BFE7F5B5A4777 /* [CP] Embed Pods Frameworks */, + 04554623324BE4A838846086 /* [CP] Copy Pods Resources */, + C7FAD018D05AB5F0B0FE81E2 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -167,58 +168,49 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 619CBF6DBB6BFE7F5B5A4777 /* [CP] Embed Pods Frameworks */ = { + 04554623324BE4A838846086 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC/openssl_grpc.framework", - "${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework", - "${BUILT_PRODUCTS_DIR}/RemoteTest/RemoteTest.framework", - "${BUILT_PRODUCTS_DIR}/gRPC/GRPCClient.framework", - "${BUILT_PRODUCTS_DIR}/gRPC-Core/grpc.framework", - "${BUILT_PRODUCTS_DIR}/gRPC-ProtoRPC/ProtoRPC.framework", - "${BUILT_PRODUCTS_DIR}/gRPC-RxLibrary/RxLibrary.framework", - "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Copy Pods Resources"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RemoteTest.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRPCClient.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/grpc.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ProtoRPC.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxLibrary.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; showEnvVarsInLog = 0; }; - B8CFD95B6470E21429BC7DF0 /* [CP] Check Pods Manifest.lock */ = { + 41F7486D8F66994B0BFB84AF /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( + outputPaths = ( ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + C7FAD018D05AB5F0B0FE81E2 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Sample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -329,10 +321,9 @@ }; 6369A28E1A9322E20015FC5C /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7544F97DDF1CB3F915E41CB9 /* Pods-Sample.debug.xcconfig */; + baseConfigurationReference = E3C01DF315C4E7433BCEC6E6 /* Pods-Sample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; INFOPLIST_FILE = Sample/Info.plist; LD_GENERATE_MAP_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -343,10 +334,9 @@ }; 6369A28F1A9322E20015FC5C /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 8BDAC28EF9131C53B2E6870D /* Pods-Sample.release.xcconfig */; + baseConfigurationReference = 5A8C9F4B28733B249DE4AB6D /* Pods-Sample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; INFOPLIST_FILE = Sample/Info.plist; LD_GENERATE_MAP_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; diff --git a/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj b/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj index 953152e6153..0113d9c5d6a 100644 --- a/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj @@ -7,23 +7,23 @@ objects = { /* Begin PBXBuildFile section */ + 2C0B024CB798839E17F76126 /* Pods_SwiftSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B394F343BDE186C5436DBDB9 /* Pods_SwiftSample.framework */; }; 633BFFC81B950B210007E424 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 633BFFC71B950B210007E424 /* AppDelegate.swift */; }; 633BFFCA1B950B210007E424 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 633BFFC91B950B210007E424 /* ViewController.swift */; }; 633BFFCD1B950B210007E424 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 633BFFCB1B950B210007E424 /* Main.storyboard */; }; 633BFFCF1B950B210007E424 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 633BFFCE1B950B210007E424 /* Images.xcassets */; }; - AC669361C16100FA4D34D7D1 /* Pods_SwiftSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CB8E8B90EEE20DEB124EE37 /* Pods_SwiftSample.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 544DD51C2905B1B0B00F57F3 /* Pods-SwiftSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.debug.xcconfig"; path = "Target Support Files/Pods-SwiftSample/Pods-SwiftSample.debug.xcconfig"; sourceTree = ""; }; - 5CB8E8B90EEE20DEB124EE37 /* Pods_SwiftSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 633BFFC21B950B210007E424 /* SwiftSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 633BFFC61B950B210007E424 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 633BFFC71B950B210007E424 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 633BFFC91B950B210007E424 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 633BFFCC1B950B210007E424 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 633BFFCE1B950B210007E424 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - FAF69508F6AEB00B2D2EB3F2 /* Pods-SwiftSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.release.xcconfig"; path = "Target Support Files/Pods-SwiftSample/Pods-SwiftSample.release.xcconfig"; sourceTree = ""; }; + A7E614A494D89D01BB395761 /* Pods-SwiftSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftSample/Pods-SwiftSample.debug.xcconfig"; sourceTree = ""; }; + B394F343BDE186C5436DBDB9 /* Pods_SwiftSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C314E3E246AF23AC29B38FCF /* Pods-SwiftSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftSample/Pods-SwiftSample.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -31,20 +31,29 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - AC669361C16100FA4D34D7D1 /* Pods_SwiftSample.framework in Frameworks */, + 2C0B024CB798839E17F76126 /* Pods_SwiftSample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 31F283C976AE97586C17CCD9 /* Pods */ = { + isa = PBXGroup; + children = ( + A7E614A494D89D01BB395761 /* Pods-SwiftSample.debug.xcconfig */, + C314E3E246AF23AC29B38FCF /* Pods-SwiftSample.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; 633BFFB91B950B210007E424 = { isa = PBXGroup; children = ( 633BFFC41B950B210007E424 /* SwiftSample */, 633BFFC31B950B210007E424 /* Products */, - B26D8B90A783952E7BE194D9 /* Pods */, - 66C10D7692132083F1F396C6 /* Frameworks */, + 31F283C976AE97586C17CCD9 /* Pods */, + 9D63A7F6423989BA306810CA /* Frameworks */, ); sourceTree = ""; }; @@ -76,24 +85,14 @@ name = "Supporting Files"; sourceTree = ""; }; - 66C10D7692132083F1F396C6 /* Frameworks */ = { + 9D63A7F6423989BA306810CA /* Frameworks */ = { isa = PBXGroup; children = ( - 5CB8E8B90EEE20DEB124EE37 /* Pods_SwiftSample.framework */, + B394F343BDE186C5436DBDB9 /* Pods_SwiftSample.framework */, ); name = Frameworks; sourceTree = ""; }; - B26D8B90A783952E7BE194D9 /* Pods */ = { - isa = PBXGroup; - children = ( - 544DD51C2905B1B0B00F57F3 /* Pods-SwiftSample.debug.xcconfig */, - FAF69508F6AEB00B2D2EB3F2 /* Pods-SwiftSample.release.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -101,11 +100,12 @@ isa = PBXNativeTarget; buildConfigurationList = 633BFFE11B950B210007E424 /* Build configuration list for PBXNativeTarget "SwiftSample" */; buildPhases = ( - 405474DAAC9EB5A0055F82FA /* [CP] Check Pods Manifest.lock */, + 6BEEB33CA2705D7D2F2210E6 /* [CP] Check Pods Manifest.lock */, 633BFFBE1B950B210007E424 /* Sources */, 633BFFBF1B950B210007E424 /* Frameworks */, 633BFFC01B950B210007E424 /* Resources */, - 983E7AC7007F28ADB66E485B /* [CP] Embed Pods Frameworks */, + AC2F6F9AB1C090BB0BEE6E4D /* [CP] Copy Pods Resources */, + A1738A987353B0BF2C64F0F7 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -162,20 +162,16 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 405474DAAC9EB5A0055F82FA /* [CP] Check Pods Manifest.lock */ = { + 6BEEB33CA2705D7D2F2210E6 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-SwiftSample-checkManifestLockResult.txt", ); @@ -184,14 +180,14 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 983E7AC7007F28ADB66E485B /* [CP] Embed Pods Frameworks */ = { + A1738A987353B0BF2C64F0F7 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-SwiftSample/Pods-SwiftSample-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC/openssl_grpc.framework", + "${SRCROOT}/Pods/Target Support Files/Pods-SwiftSample/Pods-SwiftSample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/BoringSSL/openssl.framework", "${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework", "${BUILT_PRODUCTS_DIR}/RemoteTest/RemoteTest.framework", "${BUILT_PRODUCTS_DIR}/gRPC/GRPCClient.framework", @@ -202,7 +198,7 @@ ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RemoteTest.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRPCClient.framework", @@ -213,7 +209,22 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SwiftSample/Pods-SwiftSample-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftSample/Pods-SwiftSample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + AC2F6F9AB1C090BB0BEE6E4D /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftSample/Pods-SwiftSample-resources.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -330,7 +341,7 @@ }; 633BFFE21B950B210007E424 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 544DD51C2905B1B0B00F57F3 /* Pods-SwiftSample.debug.xcconfig */; + baseConfigurationReference = A7E614A494D89D01BB395761 /* Pods-SwiftSample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = Info.plist; @@ -345,7 +356,7 @@ }; 633BFFE31B950B210007E424 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FAF69508F6AEB00B2D2EB3F2 /* Pods-SwiftSample.release.xcconfig */; + baseConfigurationReference = C314E3E246AF23AC29B38FCF /* Pods-SwiftSample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = Info.plist; diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 578970f4271..737d52b547d 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -7,8 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 01574004C238BE75F6A7651D /* libPods-MacTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B6E36AF835D0DC279DC0C18 /* libPods-MacTests.a */; }; - 3E8DD339E611E92DCE8A5A48 /* libPods-CronetTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2067DD4BEA93EFB61A753183 /* libPods-CronetTests.a */; }; 5E0282E9215AA697007AC99D /* NSErrorUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0282E8215AA697007AC99D /* NSErrorUnitTests.m */; }; 5E3F14842278B461007C6D90 /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; 5E3F14852278BF5D007C6D90 /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; @@ -36,24 +34,62 @@ 5EA4770322736178000F72FC /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; }; 5EA477042273617B000F72FC /* InteropTestsLocalCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */; }; 5EA4770522736AC4000F72FC /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; - 80EA8F48AFAA5E3D758AC3D5 /* libPods-UnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D4287E190CCD0CACC3F2CC3 /* libPods-UnitTests.a */; }; + 65EB19E418B39A8374D407BB /* libPods-CronetTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B1511C20E16A8422B58D61A /* libPods-CronetTests.a */; }; + 903163C7FE885838580AEC7A /* libPods-InteropTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D457AD9797664CFA191C3280 /* libPods-InteropTests.a */; }; + 953CD2942A3A6D6CE695BE87 /* libPods-MacTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 276873A05AC5479B60DF6079 /* libPods-MacTests.a */; }; B071230B22669EED004B64A1 /* StressTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B071230A22669EED004B64A1 /* StressTests.m */; }; B0BB3F08225E7ABA008DA580 /* NSErrorUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0282E8215AA697007AC99D /* NSErrorUnitTests.m */; }; B0BB3F0A225EA511008DA580 /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; B0D39B9A2266F3CB00A4078D /* StressTestsSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = B0D39B992266F3CB00A4078D /* StressTestsSSL.m */; }; B0D39B9C2266FF9800A4078D /* StressTestsCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = B0D39B9B2266FF9800A4078D /* StressTestsCleartext.m */; }; - C8217D49007E8E4693F058B1 /* libPods-InteropTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DD0F486470BDFF1E1E4943B8 /* libPods-InteropTests.a */; }; + CCF5C0719EF608276AE16374 /* libPods-UnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22A3EBB488699C8CEA19707B /* libPods-UnitTests.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 16B9B1262FE6FBFC353B62BB /* Pods-InteropTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.cronet.xcconfig"; path = "Target Support Files/Pods-InteropTests/Pods-InteropTests.cronet.xcconfig"; sourceTree = ""; }; - 2067DD4BEA93EFB61A753183 /* libPods-CronetTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CronetTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2D4287E190CCD0CACC3F2CC3 /* libPods-UnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-UnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 42DF8A339EF81AFE13553D04 /* Pods-InteropTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.release.xcconfig"; path = "Target Support Files/Pods-InteropTests/Pods-InteropTests.release.xcconfig"; sourceTree = ""; }; - 4A76E027206C07B7DBECB301 /* Pods-UnitTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.cronet.xcconfig"; path = "Target Support Files/Pods-UnitTests/Pods-UnitTests.cronet.xcconfig"; sourceTree = ""; }; - 5287652093398BAA7C5A90E8 /* Pods-MacTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.release.xcconfig"; path = "Target Support Files/Pods-MacTests/Pods-MacTests.release.xcconfig"; sourceTree = ""; }; - 55BBF7900C93644CD8236BD2 /* Pods-CronetTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.test.xcconfig"; path = "Target Support Files/Pods-CronetTests/Pods-CronetTests.test.xcconfig"; sourceTree = ""; }; - 5CF07AAE0442D200BCD81ABC /* Pods-InteropTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.test.xcconfig"; path = "Target Support Files/Pods-InteropTests/Pods-InteropTests.test.xcconfig"; sourceTree = ""; }; + 02192CF1FF9534E3D18C65FC /* Pods-CronetUnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetUnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests.release.xcconfig"; sourceTree = ""; }; + 070266E2626EB997B54880A3 /* Pods-InteropTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTests/Pods-InteropTests.test.xcconfig"; sourceTree = ""; }; + 07D10A965323BEA7FE59A74B /* Pods-RxLibraryUnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.debug.xcconfig"; sourceTree = ""; }; + 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; + 0BDA4BA011779D5D25B5618C /* libPods-InteropTestsLocalCleartextCFStream.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsLocalCleartextCFStream.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 0D2284C3DF7E57F0ED504E39 /* Pods-CoreCronetEnd2EndTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreCronetEnd2EndTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests.debug.xcconfig"; sourceTree = ""; }; + 1286B30AD74CB64CD91FB17D /* Pods-APIv2Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-APIv2Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-APIv2Tests/Pods-APIv2Tests.debug.xcconfig"; sourceTree = ""; }; + 1295CCBD1082B4A7CFCED95F /* Pods-InteropTestsMultipleChannels.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsMultipleChannels.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsMultipleChannels/Pods-InteropTestsMultipleChannels.cronet.xcconfig"; sourceTree = ""; }; + 12B238CD1702393C2BA5DE80 /* Pods-APIv2Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-APIv2Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-APIv2Tests/Pods-APIv2Tests.release.xcconfig"; sourceTree = ""; }; + 14B09A58FEE53A7A6B838920 /* Pods-InteropTestsLocalSSL.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.cronet.xcconfig"; sourceTree = ""; }; + 1588C85DEAF7FC0ACDEA4C02 /* Pods-InteropTestsLocalCleartext.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.test.xcconfig"; sourceTree = ""; }; + 16A2E4C5839C83FBDA63881F /* Pods-MacTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-MacTests/Pods-MacTests.cronet.xcconfig"; sourceTree = ""; }; + 17F60BF2871F6AF85FB3FA12 /* Pods-InteropTestsRemoteWithCronet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.debug.xcconfig"; sourceTree = ""; }; + 1B1511C20E16A8422B58D61A /* libPods-CronetTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CronetTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 1E43EAE443CBB4482B1EB071 /* Pods-MacTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-MacTests/Pods-MacTests.release.xcconfig"; sourceTree = ""; }; + 1F5E788FBF9A4A06EB9E1ACD /* Pods-MacTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-MacTests/Pods-MacTests.test.xcconfig"; sourceTree = ""; }; + 20DFF2F3C97EF098FE5A3171 /* libPods-Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 20F6A3D59D0EE091E2D43953 /* Pods-CronetTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.cronet.xcconfig"; sourceTree = ""; }; + 22A3EBB488699C8CEA19707B /* libPods-UnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-UnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 2650FEF00956E7924772F9D9 /* Pods-InteropTestsMultipleChannels.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsMultipleChannels.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsMultipleChannels/Pods-InteropTestsMultipleChannels.release.xcconfig"; sourceTree = ""; }; + 276873A05AC5479B60DF6079 /* libPods-MacTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MacTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 2B89F3037963E6EDDD48D8C3 /* Pods-InteropTestsRemoteWithCronet.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.test.xcconfig"; sourceTree = ""; }; + 303F4A17EB1650FC44603D17 /* Pods-InteropTestsRemoteCFStream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.release.xcconfig"; sourceTree = ""; }; + 32748C4078AEB05F8F954361 /* Pods-InteropTestsRemoteCFStream.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.debug.xcconfig"; sourceTree = ""; }; + 355D0E30AD224763BC9519F4 /* libPods-InteropTestsMultipleChannels.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsMultipleChannels.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 386712AEACF7C2190C4B8B3F /* Pods-CronetUnitTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetUnitTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests.cronet.xcconfig"; sourceTree = ""; }; + 3A98DF08852F60AF1D96481D /* Pods-InteropTestsCallOptions.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsCallOptions.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsCallOptions/Pods-InteropTestsCallOptions.debug.xcconfig"; sourceTree = ""; }; + 3B0861FC805389C52DB260D4 /* Pods-RxLibraryUnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.release.xcconfig"; sourceTree = ""; }; + 3CADF86203B9D03EA96C359D /* Pods-InteropTestsMultipleChannels.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsMultipleChannels.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsMultipleChannels/Pods-InteropTestsMultipleChannels.debug.xcconfig"; sourceTree = ""; }; + 3EB55EF291706E3DDE23C3B7 /* Pods-InteropTestsLocalSSLCFStream.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.debug.xcconfig"; sourceTree = ""; }; + 3F27B2E744482771EB93C394 /* Pods-InteropTestsRemoteWithCronet.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.cronet.xcconfig"; sourceTree = ""; }; + 41AA59529240A6BBBD3DB904 /* Pods-InteropTestsLocalSSLCFStream.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.test.xcconfig"; sourceTree = ""; }; + 48F1841C9A920626995DC28C /* libPods-ChannelTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ChannelTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 4A1A42B2E941CCD453489E5B /* Pods-InteropTestsRemoteCFStream.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.cronet.xcconfig"; sourceTree = ""; }; + 4AD97096D13D7416DC91A72A /* Pods-CoreCronetEnd2EndTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreCronetEnd2EndTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests.release.xcconfig"; sourceTree = ""; }; + 4ADEA1C8BBE10D90940AC68E /* Pods-InteropTestsRemote.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.cronet.xcconfig"; sourceTree = ""; }; + 51A275E86C141416ED63FF76 /* Pods-InteropTestsLocalCleartext.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.release.xcconfig"; sourceTree = ""; }; + 51F2A64B7AADBA1B225B132E /* Pods-APIv2Tests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-APIv2Tests.test.xcconfig"; path = "Pods/Target Support Files/Pods-APIv2Tests/Pods-APIv2Tests.test.xcconfig"; sourceTree = ""; }; + 553BBBED24E4162D1F769D65 /* Pods-InteropTestsLocalSSL.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.debug.xcconfig"; sourceTree = ""; }; + 55B630C1FF8C36D1EFC4E0A4 /* Pods-InteropTestsLocalSSLCFStream.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.cronet.xcconfig"; sourceTree = ""; }; + 573450F334B331D0BED8B961 /* Pods-CoreCronetEnd2EndTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreCronetEnd2EndTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests.cronet.xcconfig"; sourceTree = ""; }; + 5761E98978DDDF136A58CB7E /* Pods-AllTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.release.xcconfig"; sourceTree = ""; }; + 5AB9A82F289D548D6B8816F9 /* Pods-CronetTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.test.xcconfig"; sourceTree = ""; }; 5E0282E6215AA697007AC99D /* UnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 5E0282E8215AA697007AC99D /* NSErrorUnitTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSErrorUnitTests.m; sourceTree = ""; }; 5E3F14822278B42D007C6D90 /* InteropTestsBlockCallbacks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InteropTestsBlockCallbacks.h; sourceTree = ""; }; @@ -73,6 +109,7 @@ 5E7F488822778B04006656AD /* InteropTestsRemote.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InteropTestsRemote.m; sourceTree = ""; }; 5E7F488A22778B5D006656AD /* RxLibraryUnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RxLibraryUnitTests.m; sourceTree = ""; }; 5EA476F42272816A000F72FC /* InteropTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InteropTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 5EA908CF4CDA4CE218352A06 /* Pods-InteropTestsLocalSSLCFStream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.release.xcconfig"; sourceTree = ""; }; 5EAD6D261E27047400002378 /* CronetUnitTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = CronetUnitTests.mm; path = CronetTests/CronetUnitTests.mm; sourceTree = SOURCE_ROOT; }; 5EAFE8271F8EFB87007F2189 /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; 5EE84BF31D4717E40050C6CC /* InteropTestsRemoteWithCronet.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = InteropTestsRemoteWithCronet.m; path = CronetTests/InteropTestsRemoteWithCronet.m; sourceTree = SOURCE_ROOT; }; @@ -80,24 +117,66 @@ 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InteropTestsLocalCleartext.m; path = InteropTests/InteropTestsLocalCleartext.m; sourceTree = SOURCE_ROOT; }; 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InteropTestsLocalSSL.m; path = InteropTests/InteropTestsLocalSSL.m; sourceTree = SOURCE_ROOT; }; 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = TestCertificates.bundle; sourceTree = ""; }; - 6B6E36AF835D0DC279DC0C18 /* libPods-MacTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MacTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 7612BA4B2A55BC4F508570C2 /* Pods-MacTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.cronet.xcconfig"; path = "Target Support Files/Pods-MacTests/Pods-MacTests.cronet.xcconfig"; sourceTree = ""; }; - 936ADE0FD98D66144C935C37 /* Pods-UnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.debug.xcconfig"; path = "Target Support Files/Pods-UnitTests/Pods-UnitTests.debug.xcconfig"; sourceTree = ""; }; - 9AEB5A4889D2018866BE6050 /* Pods-CronetTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.debug.xcconfig"; path = "Target Support Files/Pods-CronetTests/Pods-CronetTests.debug.xcconfig"; sourceTree = ""; }; - 9E48AF01E76B19FAAAACAE23 /* Pods-UnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.release.xcconfig"; path = "Target Support Files/Pods-UnitTests/Pods-UnitTests.release.xcconfig"; sourceTree = ""; }; + 64F68A9A6A63CC930DD30A6E /* Pods-CronetUnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetUnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests.debug.xcconfig"; sourceTree = ""; }; + 6793C9D019CB268C5BB491A2 /* Pods-CoreCronetEnd2EndTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreCronetEnd2EndTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests.test.xcconfig"; sourceTree = ""; }; + 680439AC2BC8761EDD54A1EA /* Pods-InteropTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTests/Pods-InteropTests.debug.xcconfig"; sourceTree = ""; }; + 73D2DF07027835BA0FB0B1C0 /* Pods-InteropTestsCallOptions.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsCallOptions.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsCallOptions/Pods-InteropTestsCallOptions.cronet.xcconfig"; sourceTree = ""; }; + 781089FAE980F51F88A3BE0B /* Pods-RxLibraryUnitTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.test.xcconfig"; sourceTree = ""; }; + 79C68EFFCB5533475D810B79 /* Pods-RxLibraryUnitTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.cronet.xcconfig"; sourceTree = ""; }; + 7A2E97E3F469CC2A758D77DE /* Pods-InteropTestsLocalSSL.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.release.xcconfig"; sourceTree = ""; }; + 7BA53C6D224288D5870FE6F3 /* Pods-InteropTestsLocalCleartextCFStream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.release.xcconfig"; sourceTree = ""; }; + 7F4F42EBAF311E9F84FCA32E /* Pods-CronetTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.release.xcconfig"; sourceTree = ""; }; + 8B498B05C6DA0818B2FA91D4 /* Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig"; sourceTree = ""; }; + 8C233E85C3EB45B3CAE52EDF /* Pods-APIv2Tests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-APIv2Tests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-APIv2Tests/Pods-APIv2Tests.cronet.xcconfig"; sourceTree = ""; }; + 90E63AD3C4A1E3E6BC745096 /* Pods-ChannelTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ChannelTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-ChannelTests/Pods-ChannelTests.cronet.xcconfig"; sourceTree = ""; }; + 943138072A9605B5B8DC1FC0 /* Pods-InteropTestsLocalCleartextCFStream.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.debug.xcconfig"; sourceTree = ""; }; + 94D7A5FAA13480E9A5166D7A /* Pods-UnitTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests.test.xcconfig"; sourceTree = ""; }; + 9E9444C764F0FFF64A7EB58E /* libPods-InteropTestsRemoteWithCronet.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsRemoteWithCronet.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + A25967A0D40ED14B3287AD81 /* Pods-InteropTestsCallOptions.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsCallOptions.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsCallOptions/Pods-InteropTestsCallOptions.test.xcconfig"; sourceTree = ""; }; + A2DCF2570BE515B62CB924CA /* Pods-UnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests.debug.xcconfig"; sourceTree = ""; }; + A58BE6DF1C62D1739EBB2C78 /* libPods-RxLibraryUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RxLibraryUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + A6F832FCEFA6F6881E620F12 /* Pods-InteropTestsRemote.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.test.xcconfig"; sourceTree = ""; }; + AA7CB64B4DD9915AE7C03163 /* Pods-InteropTestsLocalCleartext.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.cronet.xcconfig"; sourceTree = ""; }; + AC414EF7A6BF76ED02B6E480 /* Pods-InteropTestsRemoteWithCronet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.release.xcconfig"; sourceTree = ""; }; + AF3FC2CFFE7B0961823BC740 /* libPods-InteropTestsCallOptions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsCallOptions.a"; sourceTree = BUILT_PRODUCTS_DIR; }; B071230A22669EED004B64A1 /* StressTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StressTests.m; sourceTree = ""; }; B0BB3EF7225E795F008DA580 /* MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MacTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; B0BB3EFB225E795F008DA580 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; B0C5FC172267C77200F192BE /* StressTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StressTests.h; sourceTree = ""; }; B0D39B992266F3CB00A4078D /* StressTestsSSL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StressTestsSSL.m; sourceTree = ""; }; B0D39B9B2266FF9800A4078D /* StressTestsCleartext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StressTestsCleartext.m; sourceTree = ""; }; - B3C890A1E6F082CD283069BF /* Pods-UnitTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.test.xcconfig"; path = "Target Support Files/Pods-UnitTests/Pods-UnitTests.test.xcconfig"; sourceTree = ""; }; - B43404F2B37A38483BE4704A /* Pods-CronetTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.cronet.xcconfig"; path = "Target Support Files/Pods-CronetTests/Pods-CronetTests.cronet.xcconfig"; sourceTree = ""; }; - BC5D3F3B5B38B71CA279AF7F /* Pods-MacTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.debug.xcconfig"; path = "Target Support Files/Pods-MacTests/Pods-MacTests.debug.xcconfig"; sourceTree = ""; }; - C56A093740F31650ACDD9630 /* Pods-InteropTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.debug.xcconfig"; path = "Target Support Files/Pods-InteropTests/Pods-InteropTests.debug.xcconfig"; sourceTree = ""; }; - DA532DBBE1BC0DC8EC879FE1 /* Pods-MacTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.test.xcconfig"; path = "Target Support Files/Pods-MacTests/Pods-MacTests.test.xcconfig"; sourceTree = ""; }; - DD0F486470BDFF1E1E4943B8 /* libPods-InteropTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - FF0A4B1F995C18C1EB86D155 /* Pods-CronetTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.release.xcconfig"; path = "Target Support Files/Pods-CronetTests/Pods-CronetTests.release.xcconfig"; sourceTree = ""; }; + B226619DC4E709E0FFFF94B8 /* Pods-CronetUnitTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetUnitTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests.test.xcconfig"; sourceTree = ""; }; + B6AD69CACF67505B0F028E92 /* libPods-APIv2Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-APIv2Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + B94C27C06733CF98CE1B2757 /* Pods-AllTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.debug.xcconfig"; sourceTree = ""; }; + BED74BC8ABF9917C66175879 /* Pods-ChannelTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ChannelTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-ChannelTests/Pods-ChannelTests.test.xcconfig"; sourceTree = ""; }; + C17F57E5BCB989AB1C2F1F25 /* Pods-InteropTestsRemoteCFStream.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.test.xcconfig"; sourceTree = ""; }; + C6134277D2EB8B380862A03F /* libPods-CronetUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CronetUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + C9172F9020E8C97A470D7250 /* Pods-InteropTestsCallOptions.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsCallOptions.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsCallOptions/Pods-InteropTestsCallOptions.release.xcconfig"; sourceTree = ""; }; + CAE086D5B470DA367D415AB0 /* libPods-AllTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AllTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + CDF6CC70B8BF9D10EFE7D199 /* Pods-InteropTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTests/Pods-InteropTests.cronet.xcconfig"; sourceTree = ""; }; + D13BEC8181B8E678A1B52F54 /* Pods-InteropTestsLocalSSL.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.test.xcconfig"; sourceTree = ""; }; + D457AD9797664CFA191C3280 /* libPods-InteropTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + D52B92A7108602F170DA8091 /* Pods-ChannelTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ChannelTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ChannelTests/Pods-ChannelTests.release.xcconfig"; sourceTree = ""; }; + DB1F4391AF69D20D38D74B67 /* Pods-AllTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.test.xcconfig"; sourceTree = ""; }; + DBE059B4AC7A51919467EEC0 /* libPods-InteropTestsRemote.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsRemote.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + DBEDE45BDA60DF1E1C8950C0 /* libPods-InteropTestsLocalSSL.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsLocalSSL.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + DC3CA1D948F068E76957A861 /* Pods-InteropTestsRemote.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.debug.xcconfig"; sourceTree = ""; }; + E1486220285AF123EB124008 /* Pods-InteropTestsLocalCleartext.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.debug.xcconfig"; sourceTree = ""; }; + E1E7660656D902104F728892 /* Pods-UnitTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests.cronet.xcconfig"; sourceTree = ""; }; + E3ACD4D5902745976D9C2229 /* Pods-MacTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MacTests/Pods-MacTests.debug.xcconfig"; sourceTree = ""; }; + E4275A759BDBDF143B9B438F /* Pods-InteropTestsRemote.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.release.xcconfig"; sourceTree = ""; }; + E4FD4606D4AB8D5A314D72F0 /* Pods-InteropTestsLocalCleartextCFStream.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.test.xcconfig"; sourceTree = ""; }; + E7E4D3FD76E3B745D992AF5F /* Pods-AllTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.cronet.xcconfig"; sourceTree = ""; }; + EA8B122ACDE73E3AAA0E4A19 /* Pods-InteropTestsMultipleChannels.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsMultipleChannels.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsMultipleChannels/Pods-InteropTestsMultipleChannels.test.xcconfig"; sourceTree = ""; }; + EBFFEC04B514CB0D4922DC40 /* Pods-UnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests.release.xcconfig"; sourceTree = ""; }; + EC66920112123D2DB1CB7F6C /* Pods-CronetTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.debug.xcconfig"; sourceTree = ""; }; + F3AB031E0E26AC8EF30A2A2A /* libPods-InteropTestsLocalSSLCFStream.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsLocalSSLCFStream.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + F44AC3F44E3491A8C0D890FE /* libPods-InteropTestsRemoteCFStream.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsRemoteCFStream.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + F6A7EECACBB4849DDD3F450A /* Pods-InteropTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTests/Pods-InteropTests.release.xcconfig"; sourceTree = ""; }; + F9E48EF5ACB1F38825171C5F /* Pods-ChannelTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ChannelTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ChannelTests/Pods-ChannelTests.debug.xcconfig"; sourceTree = ""; }; + FBD98AC417B9882D32B19F28 /* libPods-CoreCronetEnd2EndTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CoreCronetEnd2EndTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + FD346DB2C23F676C4842F3FF /* libPods-InteropTestsLocalCleartext.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsLocalCleartext.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -105,7 +184,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 80EA8F48AFAA5E3D758AC3D5 /* libPods-UnitTests.a in Frameworks */, + CCF5C0719EF608276AE16374 /* libPods-UnitTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -113,7 +192,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 3E8DD339E611E92DCE8A5A48 /* libPods-CronetTests.a in Frameworks */, + 65EB19E418B39A8374D407BB /* libPods-CronetTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -121,7 +200,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C8217D49007E8E4693F058B1 /* libPods-InteropTests.a in Frameworks */, + 903163C7FE885838580AEC7A /* libPods-InteropTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -129,7 +208,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 01574004C238BE75F6A7651D /* libPods-MacTests.a in Frameworks */, + 953CD2942A3A6D6CE695BE87 /* libPods-MacTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -140,14 +219,116 @@ isa = PBXGroup; children = ( 5E7F486622776AD8006656AD /* Cronet.framework */, - 2067DD4BEA93EFB61A753183 /* libPods-CronetTests.a */, - DD0F486470BDFF1E1E4943B8 /* libPods-InteropTests.a */, - 6B6E36AF835D0DC279DC0C18 /* libPods-MacTests.a */, - 2D4287E190CCD0CACC3F2CC3 /* libPods-UnitTests.a */, + 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */, + CAE086D5B470DA367D415AB0 /* libPods-AllTests.a */, + FD346DB2C23F676C4842F3FF /* libPods-InteropTestsLocalCleartext.a */, + DBEDE45BDA60DF1E1C8950C0 /* libPods-InteropTestsLocalSSL.a */, + DBE059B4AC7A51919467EEC0 /* libPods-InteropTestsRemote.a */, + A58BE6DF1C62D1739EBB2C78 /* libPods-RxLibraryUnitTests.a */, + 20DFF2F3C97EF098FE5A3171 /* libPods-Tests.a */, + FBD98AC417B9882D32B19F28 /* libPods-CoreCronetEnd2EndTests.a */, + 9E9444C764F0FFF64A7EB58E /* libPods-InteropTestsRemoteWithCronet.a */, + C6134277D2EB8B380862A03F /* libPods-CronetUnitTests.a */, + F44AC3F44E3491A8C0D890FE /* libPods-InteropTestsRemoteCFStream.a */, + 0BDA4BA011779D5D25B5618C /* libPods-InteropTestsLocalCleartextCFStream.a */, + F3AB031E0E26AC8EF30A2A2A /* libPods-InteropTestsLocalSSLCFStream.a */, + 48F1841C9A920626995DC28C /* libPods-ChannelTests.a */, + 355D0E30AD224763BC9519F4 /* libPods-InteropTestsMultipleChannels.a */, + AF3FC2CFFE7B0961823BC740 /* libPods-InteropTestsCallOptions.a */, + 22A3EBB488699C8CEA19707B /* libPods-UnitTests.a */, + B6AD69CACF67505B0F028E92 /* libPods-APIv2Tests.a */, + 276873A05AC5479B60DF6079 /* libPods-MacTests.a */, + D457AD9797664CFA191C3280 /* libPods-InteropTests.a */, + 1B1511C20E16A8422B58D61A /* libPods-CronetTests.a */, ); name = Frameworks; sourceTree = ""; }; + 51E4650F34F854F41FF053B3 /* Pods */ = { + isa = PBXGroup; + children = ( + FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */, + 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */, + B94C27C06733CF98CE1B2757 /* Pods-AllTests.debug.xcconfig */, + 5761E98978DDDF136A58CB7E /* Pods-AllTests.release.xcconfig */, + E1486220285AF123EB124008 /* Pods-InteropTestsLocalCleartext.debug.xcconfig */, + 51A275E86C141416ED63FF76 /* Pods-InteropTestsLocalCleartext.release.xcconfig */, + 553BBBED24E4162D1F769D65 /* Pods-InteropTestsLocalSSL.debug.xcconfig */, + 7A2E97E3F469CC2A758D77DE /* Pods-InteropTestsLocalSSL.release.xcconfig */, + DC3CA1D948F068E76957A861 /* Pods-InteropTestsRemote.debug.xcconfig */, + E4275A759BDBDF143B9B438F /* Pods-InteropTestsRemote.release.xcconfig */, + 07D10A965323BEA7FE59A74B /* Pods-RxLibraryUnitTests.debug.xcconfig */, + 3B0861FC805389C52DB260D4 /* Pods-RxLibraryUnitTests.release.xcconfig */, + 0D2284C3DF7E57F0ED504E39 /* Pods-CoreCronetEnd2EndTests.debug.xcconfig */, + 4AD97096D13D7416DC91A72A /* Pods-CoreCronetEnd2EndTests.release.xcconfig */, + 17F60BF2871F6AF85FB3FA12 /* Pods-InteropTestsRemoteWithCronet.debug.xcconfig */, + AC414EF7A6BF76ED02B6E480 /* Pods-InteropTestsRemoteWithCronet.release.xcconfig */, + E7E4D3FD76E3B745D992AF5F /* Pods-AllTests.cronet.xcconfig */, + 573450F334B331D0BED8B961 /* Pods-CoreCronetEnd2EndTests.cronet.xcconfig */, + AA7CB64B4DD9915AE7C03163 /* Pods-InteropTestsLocalCleartext.cronet.xcconfig */, + 14B09A58FEE53A7A6B838920 /* Pods-InteropTestsLocalSSL.cronet.xcconfig */, + 4ADEA1C8BBE10D90940AC68E /* Pods-InteropTestsRemote.cronet.xcconfig */, + 3F27B2E744482771EB93C394 /* Pods-InteropTestsRemoteWithCronet.cronet.xcconfig */, + 79C68EFFCB5533475D810B79 /* Pods-RxLibraryUnitTests.cronet.xcconfig */, + 64F68A9A6A63CC930DD30A6E /* Pods-CronetUnitTests.debug.xcconfig */, + 386712AEACF7C2190C4B8B3F /* Pods-CronetUnitTests.cronet.xcconfig */, + 02192CF1FF9534E3D18C65FC /* Pods-CronetUnitTests.release.xcconfig */, + DB1F4391AF69D20D38D74B67 /* Pods-AllTests.test.xcconfig */, + 6793C9D019CB268C5BB491A2 /* Pods-CoreCronetEnd2EndTests.test.xcconfig */, + B226619DC4E709E0FFFF94B8 /* Pods-CronetUnitTests.test.xcconfig */, + 1588C85DEAF7FC0ACDEA4C02 /* Pods-InteropTestsLocalCleartext.test.xcconfig */, + D13BEC8181B8E678A1B52F54 /* Pods-InteropTestsLocalSSL.test.xcconfig */, + A6F832FCEFA6F6881E620F12 /* Pods-InteropTestsRemote.test.xcconfig */, + 2B89F3037963E6EDDD48D8C3 /* Pods-InteropTestsRemoteWithCronet.test.xcconfig */, + 781089FAE980F51F88A3BE0B /* Pods-RxLibraryUnitTests.test.xcconfig */, + 32748C4078AEB05F8F954361 /* Pods-InteropTestsRemoteCFStream.debug.xcconfig */, + C17F57E5BCB989AB1C2F1F25 /* Pods-InteropTestsRemoteCFStream.test.xcconfig */, + 4A1A42B2E941CCD453489E5B /* Pods-InteropTestsRemoteCFStream.cronet.xcconfig */, + 303F4A17EB1650FC44603D17 /* Pods-InteropTestsRemoteCFStream.release.xcconfig */, + 943138072A9605B5B8DC1FC0 /* Pods-InteropTestsLocalCleartextCFStream.debug.xcconfig */, + E4FD4606D4AB8D5A314D72F0 /* Pods-InteropTestsLocalCleartextCFStream.test.xcconfig */, + 8B498B05C6DA0818B2FA91D4 /* Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig */, + 7BA53C6D224288D5870FE6F3 /* Pods-InteropTestsLocalCleartextCFStream.release.xcconfig */, + 3EB55EF291706E3DDE23C3B7 /* Pods-InteropTestsLocalSSLCFStream.debug.xcconfig */, + 41AA59529240A6BBBD3DB904 /* Pods-InteropTestsLocalSSLCFStream.test.xcconfig */, + 55B630C1FF8C36D1EFC4E0A4 /* Pods-InteropTestsLocalSSLCFStream.cronet.xcconfig */, + 5EA908CF4CDA4CE218352A06 /* Pods-InteropTestsLocalSSLCFStream.release.xcconfig */, + F9E48EF5ACB1F38825171C5F /* Pods-ChannelTests.debug.xcconfig */, + BED74BC8ABF9917C66175879 /* Pods-ChannelTests.test.xcconfig */, + 90E63AD3C4A1E3E6BC745096 /* Pods-ChannelTests.cronet.xcconfig */, + D52B92A7108602F170DA8091 /* Pods-ChannelTests.release.xcconfig */, + 3CADF86203B9D03EA96C359D /* Pods-InteropTestsMultipleChannels.debug.xcconfig */, + EA8B122ACDE73E3AAA0E4A19 /* Pods-InteropTestsMultipleChannels.test.xcconfig */, + 1295CCBD1082B4A7CFCED95F /* Pods-InteropTestsMultipleChannels.cronet.xcconfig */, + 2650FEF00956E7924772F9D9 /* Pods-InteropTestsMultipleChannels.release.xcconfig */, + 3A98DF08852F60AF1D96481D /* Pods-InteropTestsCallOptions.debug.xcconfig */, + A25967A0D40ED14B3287AD81 /* Pods-InteropTestsCallOptions.test.xcconfig */, + 73D2DF07027835BA0FB0B1C0 /* Pods-InteropTestsCallOptions.cronet.xcconfig */, + C9172F9020E8C97A470D7250 /* Pods-InteropTestsCallOptions.release.xcconfig */, + A2DCF2570BE515B62CB924CA /* Pods-UnitTests.debug.xcconfig */, + 94D7A5FAA13480E9A5166D7A /* Pods-UnitTests.test.xcconfig */, + E1E7660656D902104F728892 /* Pods-UnitTests.cronet.xcconfig */, + EBFFEC04B514CB0D4922DC40 /* Pods-UnitTests.release.xcconfig */, + 1286B30AD74CB64CD91FB17D /* Pods-APIv2Tests.debug.xcconfig */, + 51F2A64B7AADBA1B225B132E /* Pods-APIv2Tests.test.xcconfig */, + 8C233E85C3EB45B3CAE52EDF /* Pods-APIv2Tests.cronet.xcconfig */, + 12B238CD1702393C2BA5DE80 /* Pods-APIv2Tests.release.xcconfig */, + E3ACD4D5902745976D9C2229 /* Pods-MacTests.debug.xcconfig */, + 1F5E788FBF9A4A06EB9E1ACD /* Pods-MacTests.test.xcconfig */, + 16A2E4C5839C83FBDA63881F /* Pods-MacTests.cronet.xcconfig */, + 1E43EAE443CBB4482B1EB071 /* Pods-MacTests.release.xcconfig */, + 680439AC2BC8761EDD54A1EA /* Pods-InteropTests.debug.xcconfig */, + 070266E2626EB997B54880A3 /* Pods-InteropTests.test.xcconfig */, + CDF6CC70B8BF9D10EFE7D199 /* Pods-InteropTests.cronet.xcconfig */, + F6A7EECACBB4849DDD3F450A /* Pods-InteropTests.release.xcconfig */, + EC66920112123D2DB1CB7F6C /* Pods-CronetTests.debug.xcconfig */, + 5AB9A82F289D548D6B8816F9 /* Pods-CronetTests.test.xcconfig */, + 20F6A3D59D0EE091E2D43953 /* Pods-CronetTests.cronet.xcconfig */, + 7F4F42EBAF311E9F84FCA32E /* Pods-CronetTests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; 5E0282E7215AA697007AC99D /* UnitTests */ = { isa = PBXGroup; children = ( @@ -196,8 +377,8 @@ B0BB3EF8225E795F008DA580 /* MacTests */, 5E7F485A22775B15006656AD /* CronetTests */, 635697C81B14FC11007A7283 /* Products */, + 51E4650F34F854F41FF053B3 /* Pods */, 136D535E19727099B941D7B1 /* Frameworks */, - E549E472D8DBE9DD5C7D6247 /* Pods */, ); sourceTree = ""; }; @@ -243,30 +424,6 @@ path = MacTests; sourceTree = ""; }; - E549E472D8DBE9DD5C7D6247 /* Pods */ = { - isa = PBXGroup; - children = ( - 9AEB5A4889D2018866BE6050 /* Pods-CronetTests.debug.xcconfig */, - 55BBF7900C93644CD8236BD2 /* Pods-CronetTests.test.xcconfig */, - B43404F2B37A38483BE4704A /* Pods-CronetTests.cronet.xcconfig */, - FF0A4B1F995C18C1EB86D155 /* Pods-CronetTests.release.xcconfig */, - C56A093740F31650ACDD9630 /* Pods-InteropTests.debug.xcconfig */, - 5CF07AAE0442D200BCD81ABC /* Pods-InteropTests.test.xcconfig */, - 16B9B1262FE6FBFC353B62BB /* Pods-InteropTests.cronet.xcconfig */, - 42DF8A339EF81AFE13553D04 /* Pods-InteropTests.release.xcconfig */, - BC5D3F3B5B38B71CA279AF7F /* Pods-MacTests.debug.xcconfig */, - DA532DBBE1BC0DC8EC879FE1 /* Pods-MacTests.test.xcconfig */, - 7612BA4B2A55BC4F508570C2 /* Pods-MacTests.cronet.xcconfig */, - 5287652093398BAA7C5A90E8 /* Pods-MacTests.release.xcconfig */, - 936ADE0FD98D66144C935C37 /* Pods-UnitTests.debug.xcconfig */, - B3C890A1E6F082CD283069BF /* Pods-UnitTests.test.xcconfig */, - 4A76E027206C07B7DBECB301 /* Pods-UnitTests.cronet.xcconfig */, - 9E48AF01E76B19FAAAACAE23 /* Pods-UnitTests.release.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -274,11 +431,11 @@ isa = PBXNativeTarget; buildConfigurationList = 5E0282F2215AA697007AC99D /* Build configuration list for PBXNativeTarget "UnitTests" */; buildPhases = ( - 1C48C52EEA28609437176C56 /* [CP] Check Pods Manifest.lock */, + F07941C0BAF6A7C67AA60C48 /* [CP] Check Pods Manifest.lock */, 5E0282E2215AA697007AC99D /* Sources */, 5E0282E3215AA697007AC99D /* Frameworks */, 5E0282E4215AA697007AC99D /* Resources */, - 9D72085F3319466831FF534B /* [CP] Copy Pods Resources */, + 9AD0B5E94F2AA5962EA6AA36 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -293,12 +450,12 @@ isa = PBXNativeTarget; buildConfigurationList = 5E7F485E22775B15006656AD /* Build configuration list for PBXNativeTarget "CronetTests" */; buildPhases = ( - A9802246E6D152C53B842F78 /* [CP] Check Pods Manifest.lock */, + CCAEC0F23E05489651A07D53 /* [CP] Check Pods Manifest.lock */, 5E7F485522775B15006656AD /* Sources */, 5E7F485622775B15006656AD /* Frameworks */, 5E7F485722775B15006656AD /* Resources */, - B112143D0A46BAE4E66475F8 /* [CP] Embed Pods Frameworks */, - 996BCBE3467BA6EA7FD49408 /* [CP] Copy Pods Resources */, + 292EA42A76AC7933A37235FD /* [CP] Embed Pods Frameworks */, + 30AFD6F6FC40B9923632A866 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -313,12 +470,12 @@ isa = PBXNativeTarget; buildConfigurationList = 5EA477002272816B000F72FC /* Build configuration list for PBXNativeTarget "InteropTests" */; buildPhases = ( - 71F4FF8BADB6E545CD692B6C /* [CP] Check Pods Manifest.lock */, + 40BCDB09674DF988C708D22B /* [CP] Check Pods Manifest.lock */, 5EA476F02272816A000F72FC /* Sources */, 5EA476F12272816A000F72FC /* Frameworks */, 5EA476F22272816A000F72FC /* Resources */, - E31E6BE4FCE4DD9487BBAD24 /* [CP] Embed Pods Frameworks */, - 4CC1D806002539B97E065D5A /* [CP] Copy Pods Resources */, + D11CB94CF56A1E53760D29D8 /* [CP] Copy Pods Resources */, + 0FEFD5FC6B323AC95549AE4A /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -333,11 +490,11 @@ isa = PBXNativeTarget; buildConfigurationList = B0BB3EFC225E795F008DA580 /* Build configuration list for PBXNativeTarget "MacTests" */; buildPhases = ( - E180B0BE16D2B14B9071B2F8 /* [CP] Check Pods Manifest.lock */, + E5B20F69559C6AE299DFEA7C /* [CP] Check Pods Manifest.lock */, B0BB3EF3225E795F008DA580 /* Sources */, B0BB3EF4225E795F008DA580 /* Frameworks */, B0BB3EF5225E795F008DA580 /* Resources */, - 8694D2A1C7CEB7391B497CE0 /* [CP] Copy Pods Resources */, + 452FDC3918FEC23ECAFD31EC /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -430,35 +587,49 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 1C48C52EEA28609437176C56 /* [CP] Check Pods Manifest.lock */ = { + 0FEFD5FC6B323AC95549AE4A /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", + "${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh", + "${PODS_ROOT}/CronetFramework/Cronet.framework", ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 292EA42A76AC7933A37235FD /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-frameworks.sh", + "${PODS_ROOT}/CronetFramework/Cronet.framework", ); + name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-UnitTests-checkManifestLockResult.txt", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 4CC1D806002539B97E065D5A /* [CP] Copy Pods Resources */ = { + 30AFD6F6FC40B9923632A866 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-resources.sh", + "${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh", "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; @@ -467,10 +638,10 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 71F4FF8BADB6E545CD692B6C /* [CP] Check Pods Manifest.lock */ = { + 40BCDB09674DF988C708D22B /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -492,7 +663,7 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 8694D2A1C7CEB7391B497CE0 /* [CP] Copy Pods Resources */ = { + 452FDC3918FEC23ECAFD31EC /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -510,25 +681,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MacTests/Pods-MacTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 996BCBE3467BA6EA7FD49408 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 9D72085F3319466831FF534B /* [CP] Copy Pods Resources */ = { + 9AD0B5E94F2AA5962EA6AA36 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -546,7 +699,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-UnitTests/Pods-UnitTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - A9802246E6D152C53B842F78 /* [CP] Check Pods Manifest.lock */ = { + CCAEC0F23E05489651A07D53 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -568,25 +721,25 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - B112143D0A46BAE4E66475F8 /* [CP] Embed Pods Frameworks */ = { + D11CB94CF56A1E53760D29D8 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-frameworks.sh", - "${PODS_ROOT}/CronetFramework/Cronet.framework", + "${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Copy Pods Resources"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - E180B0BE16D2B14B9071B2F8 /* [CP] Check Pods Manifest.lock */ = { + E5B20F69559C6AE299DFEA7C /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -608,22 +761,22 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - E31E6BE4FCE4DD9487BBAD24 /* [CP] Embed Pods Frameworks */ = { + F07941C0BAF6A7C67AA60C48 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh", - "${PODS_ROOT}/CronetFramework/Cronet.framework", + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", + "$(DERIVED_FILE_DIR)/Pods-UnitTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -692,7 +845,7 @@ /* Begin XCBuildConfiguration section */ 5E0282EE215AA697007AC99D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 936ADE0FD98D66144C935C37 /* Pods-UnitTests.debug.xcconfig */; + baseConfigurationReference = A2DCF2570BE515B62CB924CA /* Pods-UnitTests.debug.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -723,7 +876,7 @@ }; 5E0282EF215AA697007AC99D /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = B3C890A1E6F082CD283069BF /* Pods-UnitTests.test.xcconfig */; + baseConfigurationReference = 94D7A5FAA13480E9A5166D7A /* Pods-UnitTests.test.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -752,7 +905,7 @@ }; 5E0282F0215AA697007AC99D /* Cronet */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 4A76E027206C07B7DBECB301 /* Pods-UnitTests.cronet.xcconfig */; + baseConfigurationReference = E1E7660656D902104F728892 /* Pods-UnitTests.cronet.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -781,7 +934,7 @@ }; 5E0282F1215AA697007AC99D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9E48AF01E76B19FAAAACAE23 /* Pods-UnitTests.release.xcconfig */; + baseConfigurationReference = EBFFEC04B514CB0D4922DC40 /* Pods-UnitTests.release.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -857,7 +1010,7 @@ }; 5E7F485F22775B15006656AD /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9AEB5A4889D2018866BE6050 /* Pods-CronetTests.debug.xcconfig */; + baseConfigurationReference = EC66920112123D2DB1CB7F6C /* Pods-CronetTests.debug.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -898,7 +1051,7 @@ }; 5E7F486022775B15006656AD /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 55BBF7900C93644CD8236BD2 /* Pods-CronetTests.test.xcconfig */; + baseConfigurationReference = 5AB9A82F289D548D6B8816F9 /* Pods-CronetTests.test.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -936,7 +1089,7 @@ }; 5E7F486122775B15006656AD /* Cronet */ = { isa = XCBuildConfiguration; - baseConfigurationReference = B43404F2B37A38483BE4704A /* Pods-CronetTests.cronet.xcconfig */; + baseConfigurationReference = 20F6A3D59D0EE091E2D43953 /* Pods-CronetTests.cronet.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -974,7 +1127,7 @@ }; 5E7F486222775B15006656AD /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FF0A4B1F995C18C1EB86D155 /* Pods-CronetTests.release.xcconfig */; + baseConfigurationReference = 7F4F42EBAF311E9F84FCA32E /* Pods-CronetTests.release.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1012,7 +1165,7 @@ }; 5EA476FC2272816B000F72FC /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = C56A093740F31650ACDD9630 /* Pods-InteropTests.debug.xcconfig */; + baseConfigurationReference = 680439AC2BC8761EDD54A1EA /* Pods-InteropTests.debug.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1047,7 +1200,7 @@ }; 5EA476FD2272816B000F72FC /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 5CF07AAE0442D200BCD81ABC /* Pods-InteropTests.test.xcconfig */; + baseConfigurationReference = 070266E2626EB997B54880A3 /* Pods-InteropTests.test.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1079,7 +1232,7 @@ }; 5EA476FE2272816B000F72FC /* Cronet */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 16B9B1262FE6FBFC353B62BB /* Pods-InteropTests.cronet.xcconfig */; + baseConfigurationReference = CDF6CC70B8BF9D10EFE7D199 /* Pods-InteropTests.cronet.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1111,7 +1264,7 @@ }; 5EA476FF2272816B000F72FC /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 42DF8A339EF81AFE13553D04 /* Pods-InteropTests.release.xcconfig */; + baseConfigurationReference = F6A7EECACBB4849DDD3F450A /* Pods-InteropTests.release.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1271,7 +1424,7 @@ }; B0BB3EFD225E795F008DA580 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = BC5D3F3B5B38B71CA279AF7F /* Pods-MacTests.debug.xcconfig */; + baseConfigurationReference = E3ACD4D5902745976D9C2229 /* Pods-MacTests.debug.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1308,7 +1461,7 @@ }; B0BB3EFE225E795F008DA580 /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DA532DBBE1BC0DC8EC879FE1 /* Pods-MacTests.test.xcconfig */; + baseConfigurationReference = 1F5E788FBF9A4A06EB9E1ACD /* Pods-MacTests.test.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1351,7 +1504,7 @@ }; B0BB3EFF225E795F008DA580 /* Cronet */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7612BA4B2A55BC4F508570C2 /* Pods-MacTests.cronet.xcconfig */; + baseConfigurationReference = 16A2E4C5839C83FBDA63881F /* Pods-MacTests.cronet.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -1385,7 +1538,7 @@ }; B0BB3F00225E795F008DA580 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 5287652093398BAA7C5A90E8 /* Pods-MacTests.release.xcconfig */; + baseConfigurationReference = 1E43EAE443CBB4482B1EB071 /* Pods-MacTests.release.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; From 2d498d2b6c01f5f20be71bbe52d49b46ce751332 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Fri, 26 Jul 2019 17:18:37 -0700 Subject: [PATCH 106/661] Add a few tests for ContextList and BufferList. Also, check that timestamps is non-null before modifying it. --- .../chttp2/transport/context_list.cc | 4 +- test/core/iomgr/buffer_list_test.cc | 24 +++++++ .../transport/chttp2/context_list_test.cc | 72 +++++++++++++++++-- 3 files changed, 95 insertions(+), 5 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/context_list.cc b/src/core/ext/transport/chttp2/transport/context_list.cc index df09809067d..245e8135833 100644 --- a/src/core/ext/transport/chttp2/transport/context_list.cc +++ b/src/core/ext/transport/chttp2/transport/context_list.cc @@ -46,7 +46,9 @@ void ContextList::Execute(void* arg, grpc_core::Timestamps* ts, ContextList* to_be_freed; while (head != nullptr) { if (write_timestamps_callback_g) { - ts->byte_offset = static_cast(head->byte_offset_); + if (ts) { + ts->byte_offset = static_cast(head->byte_offset_); + } write_timestamps_callback_g(head->trace_context_, ts, error); } to_be_freed = head; diff --git a/test/core/iomgr/buffer_list_test.cc b/test/core/iomgr/buffer_list_test.cc index 70e36940425..d71bb9ace2b 100644 --- a/test/core/iomgr/buffer_list_test.cc +++ b/test/core/iomgr/buffer_list_test.cc @@ -92,9 +92,33 @@ static void TestVerifierCalledOnAck() { grpc_core::TracedBuffer::Shutdown(&list, nullptr, GRPC_ERROR_NONE); } +/** Tests that shutdown can be called repeatedly. + */ +static void TestRepeatedShutdown() { + struct sock_extended_err serr; + serr.ee_data = 213; + serr.ee_info = grpc_core::SCM_TSTAMP_ACK; + struct grpc_core::scm_timestamping tss; + tss.ts[0].tv_sec = 123; + tss.ts[0].tv_nsec = 456; + grpc_core::grpc_tcp_set_write_timestamps_callback( + TestVerifierCalledOnAckVerifier); + grpc_core::TracedBuffer* list = nullptr; + gpr_atm verifier_called; + gpr_atm_rel_store(&verifier_called, static_cast(0)); + grpc_core::TracedBuffer::AddNewEntry(&list, 213, 0, &verifier_called); + grpc_core::TracedBuffer::ProcessTimestamp(&list, &serr, nullptr, &tss); + GPR_ASSERT(gpr_atm_acq_load(&verifier_called) == static_cast(1)); + GPR_ASSERT(list == nullptr); + grpc_core::TracedBuffer::Shutdown(&list, nullptr, GRPC_ERROR_NONE); + grpc_core::TracedBuffer::Shutdown(&list, nullptr, GRPC_ERROR_NONE); + grpc_core::TracedBuffer::Shutdown(&list, nullptr, GRPC_ERROR_NONE); +} + static void TestTcpBufferList() { TestVerifierCalledOnAck(); TestShutdownFlushesList(); + TestRepeatedShutdown(); } int main(int argc, char** argv) { diff --git a/test/core/transport/chttp2/context_list_test.cc b/test/core/transport/chttp2/context_list_test.cc index 0379eaaee4c..f8c0bee0afb 100644 --- a/test/core/transport/chttp2/context_list_test.cc +++ b/test/core/transport/chttp2/context_list_test.cc @@ -42,21 +42,29 @@ void TestExecuteFlushesListVerifier(void* arg, grpc_core::Timestamps* ts, grpc_error* error) { ASSERT_NE(arg, nullptr); EXPECT_EQ(error, GRPC_ERROR_NONE); - EXPECT_EQ(ts->byte_offset, kByteOffset); + if (ts) { + EXPECT_EQ(ts->byte_offset, kByteOffset); + } gpr_atm* done = reinterpret_cast(arg); gpr_atm_rel_store(done, static_cast(1)); } void discard_write(grpc_slice slice) {} +class ContextListTest : public ::testing::Test { + protected: + void SetUp() override { + grpc_http2_set_write_timestamps_callback(TestExecuteFlushesListVerifier); + grpc_http2_set_fn_get_copied_context(DummyArgsCopier); + } +}; + /** Tests that all ContextList elements in the list are flushed out on * execute. * Also tests that arg and byte_counter are passed correctly. */ -TEST(ContextList, ExecuteFlushesList) { +TEST_F(ContextListTest, ExecuteFlushesList) { grpc_core::ContextList* list = nullptr; - grpc_http2_set_write_timestamps_callback(TestExecuteFlushesListVerifier); - grpc_http2_set_fn_get_copied_context(DummyArgsCopier); const int kNumElems = 5; grpc_core::ExecCtx exec_ctx; grpc_stream_refcount ref; @@ -95,6 +103,62 @@ TEST(ContextList, ExecuteFlushesList) { grpc_resource_quota_unref(resource_quota); exec_ctx.Flush(); } + +TEST_F(ContextListTest, EmptyList) { + grpc_core::ContextList* list = nullptr; + grpc_core::ExecCtx exec_ctx; + grpc_core::Timestamps ts; + grpc_core::ContextList::Execute(list, &ts, GRPC_ERROR_NONE); + exec_ctx.Flush(); +} + +TEST_F(ContextListTest, EmptyListEmptyTimestamp) { + grpc_core::ContextList* list = nullptr; + grpc_core::ExecCtx exec_ctx; + grpc_core::ContextList::Execute(list, nullptr, GRPC_ERROR_NONE); + exec_ctx.Flush(); +} + +TEST_F(ContextListTest, NonEmptyListEmptyTimestamp) { + grpc_core::ContextList* list = nullptr; + const int kNumElems = 5; + grpc_core::ExecCtx exec_ctx; + grpc_stream_refcount ref; + GRPC_STREAM_REF_INIT(&ref, 1, nullptr, nullptr, "dummy ref"); + grpc_resource_quota* resource_quota = + grpc_resource_quota_create("context_list_test"); + grpc_endpoint* mock_endpoint = + grpc_mock_endpoint_create(discard_write, resource_quota); + grpc_transport* t = + grpc_create_chttp2_transport(nullptr, mock_endpoint, true); + std::vector s; + s.reserve(kNumElems); + gpr_atm verifier_called[kNumElems]; + for (auto i = 0; i < kNumElems; i++) { + s.push_back(static_cast( + gpr_malloc(grpc_transport_stream_size(t)))); + grpc_transport_init_stream(reinterpret_cast(t), + reinterpret_cast(s[i]), &ref, + nullptr, nullptr); + s[i]->context = &verifier_called[i]; + s[i]->byte_counter = kByteOffset; + gpr_atm_rel_store(&verifier_called[i], static_cast(0)); + grpc_core::ContextList::Append(&list, s[i]); + } + grpc_core::ContextList::Execute(list, nullptr, GRPC_ERROR_NONE); + for (auto i = 0; i < kNumElems; i++) { + EXPECT_EQ(gpr_atm_acq_load(&verifier_called[i]), static_cast(1)); + grpc_transport_destroy_stream(reinterpret_cast(t), + reinterpret_cast(s[i]), + nullptr); + exec_ctx.Flush(); + gpr_free(s[i]); + } + grpc_transport_destroy(t); + grpc_resource_quota_unref(resource_quota); + exec_ctx.Flush(); +} + } // namespace } // namespace testing } // namespace grpc_core From d06618d56a56775323c1ed4571716ec2f6724dbb Mon Sep 17 00:00:00 2001 From: Zhehao /Tony/ Lu Date: Fri, 26 Jul 2019 22:13:28 -0700 Subject: [PATCH 107/661] Modified script to empty Build/ before each build --- src/objective-c/examples/SwiftSample/Podfile | 2 +- src/objective-c/tests/build_one_example.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/objective-c/examples/SwiftSample/Podfile b/src/objective-c/examples/SwiftSample/Podfile index 01ef90696ca..8214371bc59 100644 --- a/src/objective-c/examples/SwiftSample/Podfile +++ b/src/objective-c/examples/SwiftSample/Podfile @@ -10,7 +10,7 @@ GRPC_LOCAL_SRC = '../../../..' target 'SwiftSample' do # Depend on the generated RemoteTestClient library - pod 'RemoteTest', :path => "." + pod 'RemoteTest', :path => "../RemoteTestClient" # Use the local versions of Protobuf, BoringSSL, and gRPC. You don't need any of the following # lines in your application. diff --git a/src/objective-c/tests/build_one_example.sh b/src/objective-c/tests/build_one_example.sh index 084147f1d46..a7d1eef7b30 100755 --- a/src/objective-c/tests/build_one_example.sh +++ b/src/objective-c/tests/build_one_example.sh @@ -30,6 +30,7 @@ cd `dirname $0`/../../.. cd $EXAMPLE_PATH # clean the directory +rm -rf Build/* rm -rf Pods rm -rf $SCHEME.xcworkspace rm -f Podfile.lock From db3d8be6471998f73a39e37d9f6ee9fb95ab6b9c Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Sat, 27 Jul 2019 12:35:38 -0700 Subject: [PATCH 108/661] Add MetadataInterface abstraction to LB policy API. --- .../filters/client_channel/client_channel.cc | 62 +- .../ext/filters/client_channel/lb_policy.h | 38 +- .../grpclb/client_load_reporting_filter.cc | 30 +- .../client_channel/lb_policy/grpclb/grpclb.cc | 126 ++-- .../client_channel/lb_policy/grpclb/grpclb.h | 7 + .../server_load_reporting_filter.cc | 6 +- src/core/lib/transport/static_metadata.cc | 653 +++++++++--------- src/core/lib/transport/static_metadata.h | 202 +++--- test/core/end2end/fuzzers/hpack.dictionary | 2 - test/core/util/test_lb_policies.cc | 24 +- tools/codegen/core/gen_static_metadata.py | 49 +- 11 files changed, 672 insertions(+), 527 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index c06e995f5a5..8234237cc19 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -320,6 +320,54 @@ class CallData { private: class QueuedPickCanceller; + class Metadata : public LoadBalancingPolicy::MetadataInterface { + public: + Metadata(CallData* calld, grpc_metadata_batch* batch) + : calld_(calld), batch_(batch) {} + + void Add(StringView key, StringView value) override { + grpc_linked_mdelem* linked_mdelem = static_cast( + calld_->arena_->Alloc(sizeof(grpc_linked_mdelem))); + linked_mdelem->md = grpc_mdelem_from_slices( + grpc_slice_from_static_buffer_internal(key.data(), key.size()), + grpc_slice_from_static_buffer_internal(value.data(), value.size())); + GPR_ASSERT(grpc_metadata_batch_link_tail(batch_, linked_mdelem) == + GRPC_ERROR_NONE); + } + + Iterator Begin() const override { + static_assert(sizeof(grpc_linked_mdelem*) <= sizeof(Iterator), + "iterator size too large"); + return reinterpret_cast(batch_->list.head); + } + bool IsEnd(Iterator it) const override { + return reinterpret_cast(it) == nullptr; + } + void Next(Iterator* it) const override { + *it = reinterpret_cast( + reinterpret_cast(*it)->next); + } + StringView Key(Iterator it) const override { + return StringView( + GRPC_MDKEY(reinterpret_cast(it)->md)); + } + StringView Value(Iterator it) const override { + return StringView( + GRPC_MDVALUE(reinterpret_cast(it)->md)); + } + + void Erase(Iterator* it) override { + grpc_linked_mdelem* linked_mdelem = + reinterpret_cast(*it); + *it = reinterpret_cast(linked_mdelem->next); + grpc_metadata_batch_remove(batch_, linked_mdelem); + } + + private: + CallData* calld_; + grpc_metadata_batch* batch_; + }; + class LbCallState : public LoadBalancingPolicy::CallState { public: explicit LbCallState(CallData* calld) : calld_(calld) {} @@ -660,7 +708,8 @@ class CallData { LbCallState lb_call_state_; RefCountedPtr connected_subchannel_; void (*lb_recv_trailing_metadata_ready_)( - void* user_data, grpc_metadata_batch* recv_trailing_metadata, + void* user_data, + LoadBalancingPolicy::MetadataInterface* recv_trailing_metadata, LoadBalancingPolicy::CallState* call_state) = nullptr; void* lb_recv_trailing_metadata_ready_user_data_ = nullptr; grpc_closure pick_closure_; @@ -2109,9 +2158,10 @@ void CallData::RecvTrailingMetadataReadyForLoadBalancingPolicy( void* arg, grpc_error* error) { CallData* calld = static_cast(arg); // Invoke callback to LB policy. + Metadata trailing_metadata(calld, calld->recv_trailing_metadata_); calld->lb_recv_trailing_metadata_ready_( - calld->lb_recv_trailing_metadata_ready_user_data_, - calld->recv_trailing_metadata_, &calld->lb_call_state_); + calld->lb_recv_trailing_metadata_ready_user_data_, &trailing_metadata, + &calld->lb_call_state_); // Chain to original callback. GRPC_CLOSURE_RUN(calld->original_recv_trailing_metadata_ready_, GRPC_ERROR_REF(error)); @@ -3716,11 +3766,13 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) { // attempt) to the LB policy instead the one from the parent channel. LoadBalancingPolicy::PickArgs pick_args; pick_args.call_state = &calld->lb_call_state_; - pick_args.initial_metadata = + Metadata initial_metadata( + calld, calld->seen_send_initial_metadata_ ? &calld->send_initial_metadata_ : calld->pending_batches_[0] - .batch->payload->send_initial_metadata.send_initial_metadata; + .batch->payload->send_initial_metadata.send_initial_metadata); + pick_args.initial_metadata = &initial_metadata; // Grab initial metadata flags so that we can check later if the call has // wait_for_ready enabled. const uint32_t send_initial_metadata_flags = diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h index c21e9d90ec4..c7d3f7c929e 100644 --- a/src/core/ext/filters/client_channel/lb_policy.h +++ b/src/core/ext/filters/client_channel/lb_policy.h @@ -27,10 +27,10 @@ #include "src/core/lib/gprpp/abstract.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" +#include "src/core/lib/gprpp/string_view.h" #include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/iomgr/polling_entity.h" #include "src/core/lib/transport/connectivity_state.h" -#include "src/core/lib/transport/metadata_batch.h" namespace grpc_core { @@ -92,14 +92,44 @@ class LoadBalancingPolicy : public InternallyRefCounted { GRPC_ABSTRACT_BASE_CLASS }; + /// Interface for accessing metadata. + class MetadataInterface { + public: + // Implementations whose iterators fit in intptr_t may internally + // cast this directly to their iterator type. Otherwise, they may + // dynamically allocate their iterators and store the address here. + typedef intptr_t Iterator; + + virtual ~MetadataInterface() = default; + + /// Adds a key/value pair. + /// Does NOT take ownership of \a key or \a value. + /// Implementations must ensure that the key and value remain alive + /// until the call ends. If desired, they may be allocated via + /// CallState::Alloc(). + virtual void Add(StringView key, StringView value) GRPC_ABSTRACT; + + /// Iteration interface. + virtual Iterator Begin() const GRPC_ABSTRACT; + virtual bool IsEnd(Iterator it) const GRPC_ABSTRACT; + virtual void Next(Iterator* it) const GRPC_ABSTRACT; + virtual StringView Key(Iterator it) const GRPC_ABSTRACT; + virtual StringView Value(Iterator it) const GRPC_ABSTRACT; + + /// Removes the element pointed to by \a it, which is modified to + /// point to the next element. + virtual void Erase(Iterator* it) GRPC_ABSTRACT; + + GRPC_ABSTRACT_BASE_CLASS + }; + /// Arguments used when picking a subchannel for an RPC. struct PickArgs { /// Initial metadata associated with the picking call. /// The LB policy may use the existing metadata to influence its routing /// decision, and it may add new metadata elements to be sent with the /// call to the chosen backend. - // TODO(roth): Provide a more generic metadata API here. - grpc_metadata_batch* initial_metadata = nullptr; + MetadataInterface* initial_metadata; /// An interface for accessing call state. Can be used to allocate /// data associated with the call in an efficient way. CallState* call_state; @@ -145,7 +175,7 @@ class LoadBalancingPolicy : public InternallyRefCounted { /// however, so any data that needs to be used after returning must /// be copied. void (*recv_trailing_metadata_ready)( - void* user_data, grpc_metadata_batch* recv_trailing_metadata, + void* user_data, MetadataInterface* recv_trailing_metadata, CallState* call_state) = nullptr; void* recv_trailing_metadata_ready_user_data = nullptr; }; diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc index 3bb31fe3b08..3057b26d315 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc @@ -20,9 +20,12 @@ #include "src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h" +#include + #include #include +#include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h" #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/profiling/timers.h" @@ -95,22 +98,33 @@ static void start_transport_stream_op_batch( GPR_TIMER_SCOPE("clr_start_transport_stream_op_batch", 0); // Handle send_initial_metadata. if (batch->send_initial_metadata) { - // Grab client stats object from user_data for LB token metadata. - grpc_linked_mdelem* lb_token = - batch->payload->send_initial_metadata.send_initial_metadata->idx.named - .lb_token; - if (lb_token != nullptr) { + // Grab client stats object from metadata. + grpc_linked_mdelem* client_stats_md = + batch->payload->send_initial_metadata.send_initial_metadata->list.head; + for (; client_stats_md != nullptr; + client_stats_md = client_stats_md->next) { + if (GRPC_SLICE_START_PTR(GRPC_MDKEY(client_stats_md->md)) == + static_cast(grpc_core::kGrpcLbClientStatsMetadataKey)) { + break; + } + } + if (client_stats_md != nullptr) { grpc_core::GrpcLbClientStats* client_stats = - static_cast(grpc_mdelem_get_user_data( - lb_token->md, grpc_core::GrpcLbClientStats::Destroy)); + const_cast( + reinterpret_cast( + GRPC_SLICE_START_PTR(GRPC_MDVALUE(client_stats_md->md)))); if (client_stats != nullptr) { - calld->client_stats = client_stats->Ref(); + calld->client_stats.reset(client_stats); // Intercept completion. calld->original_on_complete_for_send = batch->on_complete; GRPC_CLOSURE_INIT(&calld->on_complete_for_send, on_complete_for_send, calld, grpc_schedule_on_exec_ctx); batch->on_complete = &calld->on_complete_for_send; } + // Remove metadata so it doesn't go out on the wire. + grpc_metadata_batch_remove( + batch->payload->send_initial_metadata.send_initial_metadata, + client_stats_md); } } // Intercept completion of recv_initial_metadata. diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index 2eb1d9d4237..bc4b63b74ec 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -108,11 +108,15 @@ #define GRPC_GRPCLB_DEFAULT_FALLBACK_TIMEOUT_MS 10000 #define GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN "grpc.grpclb_address_lb_token" +#define GRPC_ARG_GRPCLB_ADDRESS_CLIENT_STATS "grpc.grpclb_address_client_stats" namespace grpc_core { TraceFlag grpc_lb_glb_trace(false, "glb"); +const char kGrpcLbClientStatsMetadataKey[] = "grpclb_client_stats"; +const char kGrpcLbLbTokenMetadataKey[] = "lb-token"; + namespace { constexpr char kGrpclb[] = "grpclb"; @@ -445,24 +449,44 @@ UniquePtr GrpcLb::Serverlist::AsText() const { return result; } -// vtable for LB token channel arg. +// vtables for channel args for LB token and client stats. void* lb_token_copy(void* token) { - return token == nullptr - ? nullptr - : (void*)GRPC_MDELEM_REF(grpc_mdelem{(uintptr_t)token}).payload; + return gpr_strdup(static_cast(token)); } -void lb_token_destroy(void* token) { - if (token != nullptr) { - GRPC_MDELEM_UNREF(grpc_mdelem{(uintptr_t)token}); - } +void lb_token_destroy(void* token) { gpr_free(token); } +void* client_stats_copy(void* p) { + GrpcLbClientStats* client_stats = static_cast(p); + client_stats->Ref().release(); + return p; +} +void client_stats_destroy(void* p) { + GrpcLbClientStats* client_stats = static_cast(p); + client_stats->Unref(); } -int lb_token_cmp(void* token1, void* token2) { +int equal_cmp(void* p1, void* p2) { // Always indicate a match, since we don't want this channel arg to // affect the subchannel's key in the index. + // TODO(roth): Is this right? This does prevent us from needlessly + // recreating the subchannel whenever the LB token or client stats + // changes (i.e., when the balancer call is terminated and reestablished). + // However, it means that we don't actually recreate the subchannel, + // which means that we won't ever switch over to using the new LB + // token or client stats. A better approach might be to find somewhere + // other than the subchannel args to store the LB token and client + // stats. They could be stored in a map and then looked up for each + // call (although we'd need to make sure our Map<> implementation is + // performant enough). Or we could do something more complicated whereby + // we create our own subchannel wrapper to store them, although that would + // involve a lot of refcounting overhead. + // Given that we're trying to move from grpclb to xds at this point, + // and that no one has actually reported any problems with this, we + // probably won't bother fixing this at this point. return 0; } const grpc_arg_pointer_vtable lb_token_arg_vtable = { - lb_token_copy, lb_token_destroy, lb_token_cmp}; + lb_token_copy, lb_token_destroy, equal_cmp}; +const grpc_arg_pointer_vtable client_stats_arg_vtable = { + client_stats_copy, client_stats_destroy, equal_cmp}; bool IsServerValid(const grpc_grpclb_server* server, size_t idx, bool log) { if (server->drop) return false; @@ -498,20 +522,14 @@ ServerAddressList GrpcLb::Serverlist::GetServerAddressList( grpc_resolved_address addr; ParseServer(server, &addr); // LB token processing. - grpc_mdelem lb_token; + char lb_token[GPR_ARRAY_SIZE(server->load_balance_token) + 1]; if (server->has_load_balance_token) { const size_t lb_token_max_length = GPR_ARRAY_SIZE(server->load_balance_token); const size_t lb_token_length = strnlen(server->load_balance_token, lb_token_max_length); - grpc_slice lb_token_mdstr = grpc_slice_from_copied_buffer( - server->load_balance_token, lb_token_length); - lb_token = grpc_mdelem_from_slices(GRPC_MDSTR_LB_TOKEN, lb_token_mdstr); - if (client_stats != nullptr) { - GPR_ASSERT(grpc_mdelem_set_user_data( - lb_token, GrpcLbClientStats::Destroy, - client_stats->Ref().release()) == client_stats); - } + memcpy(lb_token, server->load_balance_token, lb_token_length); + lb_token[lb_token_length] = '\0'; } else { char* uri = grpc_sockaddr_to_uri(&addr); gpr_log(GPR_INFO, @@ -519,16 +537,21 @@ ServerAddressList GrpcLb::Serverlist::GetServerAddressList( "be used instead", uri); gpr_free(uri); - lb_token = GRPC_MDELEM_LB_TOKEN_EMPTY; + lb_token[0] = '\0'; } // Add address. - grpc_arg arg = grpc_channel_arg_pointer_create( - const_cast(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), - (void*)lb_token.payload, &lb_token_arg_vtable); - grpc_channel_args* args = grpc_channel_args_copy_and_add(nullptr, &arg, 1); + InlinedVector args_to_add; + args_to_add.emplace_back(grpc_channel_arg_pointer_create( + const_cast(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), lb_token, + &lb_token_arg_vtable)); + if (client_stats != nullptr) { + args_to_add.emplace_back(grpc_channel_arg_pointer_create( + const_cast(GRPC_ARG_GRPCLB_ADDRESS_CLIENT_STATS), client_stats, + &client_stats_arg_vtable)); + } + grpc_channel_args* args = grpc_channel_args_copy_and_add( + nullptr, args_to_add.data(), args_to_add.size()); addresses.emplace_back(addr, args); - // Clean up. - GRPC_MDELEM_UNREF(lb_token); } return addresses; } @@ -573,25 +596,35 @@ GrpcLb::PickResult GrpcLb::Picker::Pick(PickArgs args) { // If pick succeeded, add LB token to initial metadata. if (result.type == PickResult::PICK_COMPLETE && result.subchannel != nullptr) { - const grpc_arg* arg = grpc_channel_args_find( - result.subchannel->channel_args(), GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN); + // Encode client stats object into metadata for use by + // client_load_reporting filter. + const grpc_arg* arg = + grpc_channel_args_find(result.subchannel->channel_args(), + GRPC_ARG_GRPCLB_ADDRESS_CLIENT_STATS); + if (arg != nullptr && arg->type == GRPC_ARG_POINTER && + arg->value.pointer.p != nullptr) { + GrpcLbClientStats* client_stats = + static_cast(arg->value.pointer.p); + client_stats->Ref().release(); // Ref passed via metadata. + // The metadata value is a hack: we pretend the pointer points to + // a string and rely on the client_load_reporting filter to know + // how to interpret it. + args.initial_metadata->Add( + kGrpcLbClientStatsMetadataKey, + StringView(reinterpret_cast(client_stats), 0)); + // Update calls-started. + client_stats->AddCallStarted(); + } + // Encode the LB token in metadata. + arg = grpc_channel_args_find(result.subchannel->channel_args(), + GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN); if (arg == nullptr) { gpr_log(GPR_ERROR, "[grpclb %p picker %p] No LB token for subchannel %p", parent_, this, result.subchannel.get()); abort(); } - grpc_mdelem lb_token = {reinterpret_cast(arg->value.pointer.p)}; - GPR_ASSERT(!GRPC_MDISNULL(lb_token)); - grpc_linked_mdelem* mdelem_storage = static_cast( - args.call_state->Alloc(sizeof(grpc_linked_mdelem))); - GPR_ASSERT(grpc_metadata_batch_add_tail( - args.initial_metadata, mdelem_storage, - GRPC_MDELEM_REF(lb_token)) == GRPC_ERROR_NONE); - GrpcLbClientStats* client_stats = static_cast( - grpc_mdelem_get_user_data(lb_token, GrpcLbClientStats::Destroy)); - if (client_stats != nullptr) { - client_stats->AddCallStarted(); - } + args.initial_metadata->Add(kGrpcLbLbTokenMetadataKey, + static_cast(arg->value.pointer.p)); } return result; } @@ -1411,10 +1444,10 @@ void GrpcLb::UpdateLocked(UpdateArgs args) { // Returns the backend addresses extracted from the given addresses. ServerAddressList ExtractBackendAddresses(const ServerAddressList& addresses) { - void* lb_token = (void*)GRPC_MDELEM_LB_TOKEN_EMPTY.payload; + static const char* lb_token = ""; grpc_arg arg = grpc_channel_arg_pointer_create( - const_cast(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), lb_token, - &lb_token_arg_vtable); + const_cast(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), + const_cast(lb_token), &lb_token_arg_vtable); ServerAddressList backend_addresses; for (size_t i = 0; i < addresses.size(); ++i) { if (!addresses[i].IsBalancer()) { @@ -1826,7 +1859,12 @@ bool maybe_add_client_load_reporting_filter(grpc_channel_stack_builder* builder, grpc_channel_args_find(args, GRPC_ARG_LB_POLICY_NAME); if (channel_arg != nullptr && channel_arg->type == GRPC_ARG_STRING && strcmp(channel_arg->value.string, "grpclb") == 0) { - return grpc_channel_stack_builder_append_filter( + // TODO(roth): When we get around to re-attempting + // https://github.com/grpc/grpc/pull/16214, we should try to keep + // this filter at the very top of the subchannel stack, since that + // will minimize the number of metadata elements that the filter + // needs to iterate through to find the ClientStats object. + return grpc_channel_stack_builder_prepend_filter( builder, (const grpc_channel_filter*)arg, nullptr, nullptr); } return true; diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h index 4d39c4d504b..a032b5dbf1d 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h @@ -32,5 +32,12 @@ #define GRPC_ARG_ADDRESS_IS_BACKEND_FROM_GRPCLB_LOAD_BALANCER \ "grpc.address_is_backend_from_grpclb_load_balancer" +namespace grpc_core { + +extern const char kGrpcLbClientStatsMetadataKey[]; +extern const char kGrpcLbLbTokenMetadataKey[]; + +} // namespace grpc_core + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_H \ */ diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc b/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc index 1d373c5b994..f48b0f4fdcf 100644 --- a/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +++ b/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc @@ -18,12 +18,15 @@ #include +#include + #include #include #include #include #include +#include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h" #include "src/core/ext/filters/client_channel/parse_address.h" #include "src/core/ext/filters/load_reporting/registered_opencensus_objects.h" #include "src/core/ext/filters/load_reporting/server_load_reporting_filter.h" @@ -225,7 +228,8 @@ grpc_filtered_mdelem ServerLoadReportingCallData::RecvInitialMetadataFilter( calld->target_host_[i] = static_cast( tolower(GRPC_SLICE_START_PTR(target_host_slice)[i])); } - } else if (grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDSTR_LB_TOKEN)) { + } else if (grpc_slice_str_cmp(GRPC_MDKEY(md), + grpc_core::kGrpcLbLbTokenMetadataKey) == 0) { if (calld->client_ip_and_lr_token_ == nullptr) { calld->StoreClientIpAndLrToken( reinterpret_cast GRPC_SLICE_START_PTR(GRPC_MDVALUE(md)), diff --git a/src/core/lib/transport/static_metadata.cc b/src/core/lib/transport/static_metadata.cc index 8b0a6f482d7..c83d1e59491 100644 --- a/src/core/lib/transport/static_metadata.cc +++ b/src/core/lib/transport/static_metadata.cc @@ -49,72 +49,72 @@ static uint8_t g_bytes[] = { 101, 113, 117, 101, 115, 116, 103, 114, 112, 99, 45, 105, 110, 116, 101, 114, 110, 97, 108, 45, 115, 116, 114, 101, 97, 109, 45, 101, 110, 99, 111, 100, 105, 110, 103, 45, 114, 101, 113, 117, 101, 115, 116, 117, 115, - 101, 114, 45, 97, 103, 101, 110, 116, 104, 111, 115, 116, 108, 98, 45, - 116, 111, 107, 101, 110, 103, 114, 112, 99, 45, 112, 114, 101, 118, 105, - 111, 117, 115, 45, 114, 112, 99, 45, 97, 116, 116, 101, 109, 112, 116, - 115, 103, 114, 112, 99, 45, 114, 101, 116, 114, 121, 45, 112, 117, 115, - 104, 98, 97, 99, 107, 45, 109, 115, 103, 114, 112, 99, 45, 116, 105, - 109, 101, 111, 117, 116, 49, 50, 51, 52, 103, 114, 112, 99, 46, 119, - 97, 105, 116, 95, 102, 111, 114, 95, 114, 101, 97, 100, 121, 103, 114, - 112, 99, 46, 116, 105, 109, 101, 111, 117, 116, 103, 114, 112, 99, 46, - 109, 97, 120, 95, 114, 101, 113, 117, 101, 115, 116, 95, 109, 101, 115, - 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 103, 114, 112, 99, 46, - 109, 97, 120, 95, 114, 101, 115, 112, 111, 110, 115, 101, 95, 109, 101, - 115, 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 47, 103, 114, 112, - 99, 46, 108, 98, 46, 118, 49, 46, 76, 111, 97, 100, 66, 97, 108, - 97, 110, 99, 101, 114, 47, 66, 97, 108, 97, 110, 99, 101, 76, 111, - 97, 100, 47, 103, 114, 112, 99, 46, 104, 101, 97, 108, 116, 104, 46, - 118, 49, 46, 72, 101, 97, 108, 116, 104, 47, 87, 97, 116, 99, 104, - 47, 101, 110, 118, 111, 121, 46, 115, 101, 114, 118, 105, 99, 101, 46, - 100, 105, 115, 99, 111, 118, 101, 114, 121, 46, 118, 50, 46, 65, 103, - 103, 114, 101, 103, 97, 116, 101, 100, 68, 105, 115, 99, 111, 118, 101, - 114, 121, 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, 114, 101, 97, - 109, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 82, 101, 115, 111, - 117, 114, 99, 101, 115, 100, 101, 102, 108, 97, 116, 101, 103, 122, 105, - 112, 115, 116, 114, 101, 97, 109, 47, 103, 122, 105, 112, 71, 69, 84, - 80, 79, 83, 84, 47, 47, 105, 110, 100, 101, 120, 46, 104, 116, 109, - 108, 104, 116, 116, 112, 104, 116, 116, 112, 115, 50, 48, 48, 50, 48, - 52, 50, 48, 54, 51, 48, 52, 52, 48, 48, 52, 48, 52, 53, 48, - 48, 97, 99, 99, 101, 112, 116, 45, 99, 104, 97, 114, 115, 101, 116, - 103, 122, 105, 112, 44, 32, 100, 101, 102, 108, 97, 116, 101, 97, 99, - 99, 101, 112, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 97, 99, - 99, 101, 112, 116, 45, 114, 97, 110, 103, 101, 115, 97, 99, 99, 101, - 112, 116, 97, 99, 99, 101, 115, 115, 45, 99, 111, 110, 116, 114, 111, - 108, 45, 97, 108, 108, 111, 119, 45, 111, 114, 105, 103, 105, 110, 97, - 103, 101, 97, 108, 108, 111, 119, 97, 117, 116, 104, 111, 114, 105, 122, - 97, 116, 105, 111, 110, 99, 97, 99, 104, 101, 45, 99, 111, 110, 116, - 114, 111, 108, 99, 111, 110, 116, 101, 110, 116, 45, 100, 105, 115, 112, - 111, 115, 105, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, 45, - 108, 97, 110, 103, 117, 97, 103, 101, 99, 111, 110, 116, 101, 110, 116, - 45, 108, 101, 110, 103, 116, 104, 99, 111, 110, 116, 101, 110, 116, 45, - 108, 111, 99, 97, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, - 45, 114, 97, 110, 103, 101, 99, 111, 111, 107, 105, 101, 100, 97, 116, - 101, 101, 116, 97, 103, 101, 120, 112, 101, 99, 116, 101, 120, 112, 105, - 114, 101, 115, 102, 114, 111, 109, 105, 102, 45, 109, 97, 116, 99, 104, - 105, 102, 45, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, - 99, 101, 105, 102, 45, 110, 111, 110, 101, 45, 109, 97, 116, 99, 104, - 105, 102, 45, 114, 97, 110, 103, 101, 105, 102, 45, 117, 110, 109, 111, - 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 108, 97, 115, - 116, 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 105, 110, 107, 108, - 111, 99, 97, 116, 105, 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, - 97, 114, 100, 115, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, - 110, 116, 105, 99, 97, 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, - 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, - 101, 114, 101, 102, 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, - 114, 101, 116, 114, 121, 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, - 101, 114, 115, 101, 116, 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, - 105, 99, 116, 45, 116, 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, - 101, 99, 117, 114, 105, 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, - 45, 101, 110, 99, 111, 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, - 97, 119, 119, 119, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, - 116, 101, 48, 105, 100, 101, 110, 116, 105, 116, 121, 116, 114, 97, 105, - 108, 101, 114, 115, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, - 47, 103, 114, 112, 99, 103, 114, 112, 99, 80, 85, 84, 108, 98, 45, - 99, 111, 115, 116, 45, 98, 105, 110, 105, 100, 101, 110, 116, 105, 116, - 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, 100, 101, 110, 116, 105, - 116, 121, 44, 103, 122, 105, 112, 100, 101, 102, 108, 97, 116, 101, 44, - 103, 122, 105, 112, 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, - 102, 108, 97, 116, 101, 44, 103, 122, 105, 112}; + 101, 114, 45, 97, 103, 101, 110, 116, 104, 111, 115, 116, 103, 114, 112, + 99, 45, 112, 114, 101, 118, 105, 111, 117, 115, 45, 114, 112, 99, 45, + 97, 116, 116, 101, 109, 112, 116, 115, 103, 114, 112, 99, 45, 114, 101, + 116, 114, 121, 45, 112, 117, 115, 104, 98, 97, 99, 107, 45, 109, 115, + 103, 114, 112, 99, 45, 116, 105, 109, 101, 111, 117, 116, 49, 50, 51, + 52, 103, 114, 112, 99, 46, 119, 97, 105, 116, 95, 102, 111, 114, 95, + 114, 101, 97, 100, 121, 103, 114, 112, 99, 46, 116, 105, 109, 101, 111, + 117, 116, 103, 114, 112, 99, 46, 109, 97, 120, 95, 114, 101, 113, 117, + 101, 115, 116, 95, 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, 116, + 101, 115, 103, 114, 112, 99, 46, 109, 97, 120, 95, 114, 101, 115, 112, + 111, 110, 115, 101, 95, 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, + 116, 101, 115, 47, 103, 114, 112, 99, 46, 108, 98, 46, 118, 49, 46, + 76, 111, 97, 100, 66, 97, 108, 97, 110, 99, 101, 114, 47, 66, 97, + 108, 97, 110, 99, 101, 76, 111, 97, 100, 47, 103, 114, 112, 99, 46, + 104, 101, 97, 108, 116, 104, 46, 118, 49, 46, 72, 101, 97, 108, 116, + 104, 47, 87, 97, 116, 99, 104, 47, 101, 110, 118, 111, 121, 46, 115, + 101, 114, 118, 105, 99, 101, 46, 100, 105, 115, 99, 111, 118, 101, 114, + 121, 46, 118, 50, 46, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, + 68, 105, 115, 99, 111, 118, 101, 114, 121, 83, 101, 114, 118, 105, 99, + 101, 47, 83, 116, 114, 101, 97, 109, 65, 103, 103, 114, 101, 103, 97, + 116, 101, 100, 82, 101, 115, 111, 117, 114, 99, 101, 115, 100, 101, 102, + 108, 97, 116, 101, 103, 122, 105, 112, 115, 116, 114, 101, 97, 109, 47, + 103, 122, 105, 112, 71, 69, 84, 80, 79, 83, 84, 47, 47, 105, 110, + 100, 101, 120, 46, 104, 116, 109, 108, 104, 116, 116, 112, 104, 116, 116, + 112, 115, 50, 48, 48, 50, 48, 52, 50, 48, 54, 51, 48, 52, 52, + 48, 48, 52, 48, 52, 53, 48, 48, 97, 99, 99, 101, 112, 116, 45, + 99, 104, 97, 114, 115, 101, 116, 103, 122, 105, 112, 44, 32, 100, 101, + 102, 108, 97, 116, 101, 97, 99, 99, 101, 112, 116, 45, 108, 97, 110, + 103, 117, 97, 103, 101, 97, 99, 99, 101, 112, 116, 45, 114, 97, 110, + 103, 101, 115, 97, 99, 99, 101, 112, 116, 97, 99, 99, 101, 115, 115, + 45, 99, 111, 110, 116, 114, 111, 108, 45, 97, 108, 108, 111, 119, 45, + 111, 114, 105, 103, 105, 110, 97, 103, 101, 97, 108, 108, 111, 119, 97, + 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 99, 97, 99, + 104, 101, 45, 99, 111, 110, 116, 114, 111, 108, 99, 111, 110, 116, 101, + 110, 116, 45, 100, 105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 99, + 111, 110, 116, 101, 110, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, + 99, 111, 110, 116, 101, 110, 116, 45, 108, 101, 110, 103, 116, 104, 99, + 111, 110, 116, 101, 110, 116, 45, 108, 111, 99, 97, 116, 105, 111, 110, + 99, 111, 110, 116, 101, 110, 116, 45, 114, 97, 110, 103, 101, 99, 111, + 111, 107, 105, 101, 100, 97, 116, 101, 101, 116, 97, 103, 101, 120, 112, + 101, 99, 116, 101, 120, 112, 105, 114, 101, 115, 102, 114, 111, 109, 105, + 102, 45, 109, 97, 116, 99, 104, 105, 102, 45, 109, 111, 100, 105, 102, + 105, 101, 100, 45, 115, 105, 110, 99, 101, 105, 102, 45, 110, 111, 110, + 101, 45, 109, 97, 116, 99, 104, 105, 102, 45, 114, 97, 110, 103, 101, + 105, 102, 45, 117, 110, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, + 105, 110, 99, 101, 108, 97, 115, 116, 45, 109, 111, 100, 105, 102, 105, + 101, 100, 108, 105, 110, 107, 108, 111, 99, 97, 116, 105, 111, 110, 109, + 97, 120, 45, 102, 111, 114, 119, 97, 114, 100, 115, 112, 114, 111, 120, + 121, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 112, + 114, 111, 120, 121, 45, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, + 105, 111, 110, 114, 97, 110, 103, 101, 114, 101, 102, 101, 114, 101, 114, + 114, 101, 102, 114, 101, 115, 104, 114, 101, 116, 114, 121, 45, 97, 102, + 116, 101, 114, 115, 101, 114, 118, 101, 114, 115, 101, 116, 45, 99, 111, + 111, 107, 105, 101, 115, 116, 114, 105, 99, 116, 45, 116, 114, 97, 110, + 115, 112, 111, 114, 116, 45, 115, 101, 99, 117, 114, 105, 116, 121, 116, + 114, 97, 110, 115, 102, 101, 114, 45, 101, 110, 99, 111, 100, 105, 110, + 103, 118, 97, 114, 121, 118, 105, 97, 119, 119, 119, 45, 97, 117, 116, + 104, 101, 110, 116, 105, 99, 97, 116, 101, 48, 105, 100, 101, 110, 116, + 105, 116, 121, 116, 114, 97, 105, 108, 101, 114, 115, 97, 112, 112, 108, + 105, 99, 97, 116, 105, 111, 110, 47, 103, 114, 112, 99, 103, 114, 112, + 99, 80, 85, 84, 108, 98, 45, 99, 111, 115, 116, 45, 98, 105, 110, + 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, + 101, 105, 100, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100, + 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, + 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, + 105, 112}; static grpc_slice_refcount static_sub_refcnt; grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = { @@ -224,7 +224,6 @@ grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = { grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), }; const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { @@ -249,92 +248,91 @@ const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { {&grpc_static_metadata_refcounts[18], {{37, g_bytes + 231}}}, {&grpc_static_metadata_refcounts[19], {{10, g_bytes + 268}}}, {&grpc_static_metadata_refcounts[20], {{4, g_bytes + 278}}}, - {&grpc_static_metadata_refcounts[21], {{8, g_bytes + 282}}}, - {&grpc_static_metadata_refcounts[22], {{26, g_bytes + 290}}}, - {&grpc_static_metadata_refcounts[23], {{22, g_bytes + 316}}}, - {&grpc_static_metadata_refcounts[24], {{12, g_bytes + 338}}}, - {&grpc_static_metadata_refcounts[25], {{1, g_bytes + 350}}}, - {&grpc_static_metadata_refcounts[26], {{1, g_bytes + 351}}}, - {&grpc_static_metadata_refcounts[27], {{1, g_bytes + 352}}}, - {&grpc_static_metadata_refcounts[28], {{1, g_bytes + 353}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, - {&grpc_static_metadata_refcounts[30], {{19, g_bytes + 354}}}, - {&grpc_static_metadata_refcounts[31], {{12, g_bytes + 373}}}, - {&grpc_static_metadata_refcounts[32], {{30, g_bytes + 385}}}, - {&grpc_static_metadata_refcounts[33], {{31, g_bytes + 415}}}, - {&grpc_static_metadata_refcounts[34], {{36, g_bytes + 446}}}, - {&grpc_static_metadata_refcounts[35], {{28, g_bytes + 482}}}, - {&grpc_static_metadata_refcounts[36], {{80, g_bytes + 510}}}, - {&grpc_static_metadata_refcounts[37], {{7, g_bytes + 590}}}, - {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}, - {&grpc_static_metadata_refcounts[39], {{11, g_bytes + 601}}}, - {&grpc_static_metadata_refcounts[40], {{3, g_bytes + 612}}}, - {&grpc_static_metadata_refcounts[41], {{4, g_bytes + 615}}}, - {&grpc_static_metadata_refcounts[42], {{1, g_bytes + 619}}}, - {&grpc_static_metadata_refcounts[43], {{11, g_bytes + 620}}}, - {&grpc_static_metadata_refcounts[44], {{4, g_bytes + 631}}}, - {&grpc_static_metadata_refcounts[45], {{5, g_bytes + 635}}}, - {&grpc_static_metadata_refcounts[46], {{3, g_bytes + 640}}}, - {&grpc_static_metadata_refcounts[47], {{3, g_bytes + 643}}}, - {&grpc_static_metadata_refcounts[48], {{3, g_bytes + 646}}}, - {&grpc_static_metadata_refcounts[49], {{3, g_bytes + 649}}}, - {&grpc_static_metadata_refcounts[50], {{3, g_bytes + 652}}}, - {&grpc_static_metadata_refcounts[51], {{3, g_bytes + 655}}}, - {&grpc_static_metadata_refcounts[52], {{3, g_bytes + 658}}}, - {&grpc_static_metadata_refcounts[53], {{14, g_bytes + 661}}}, - {&grpc_static_metadata_refcounts[54], {{13, g_bytes + 675}}}, - {&grpc_static_metadata_refcounts[55], {{15, g_bytes + 688}}}, - {&grpc_static_metadata_refcounts[56], {{13, g_bytes + 703}}}, - {&grpc_static_metadata_refcounts[57], {{6, g_bytes + 716}}}, - {&grpc_static_metadata_refcounts[58], {{27, g_bytes + 722}}}, - {&grpc_static_metadata_refcounts[59], {{3, g_bytes + 749}}}, - {&grpc_static_metadata_refcounts[60], {{5, g_bytes + 752}}}, - {&grpc_static_metadata_refcounts[61], {{13, g_bytes + 757}}}, - {&grpc_static_metadata_refcounts[62], {{13, g_bytes + 770}}}, - {&grpc_static_metadata_refcounts[63], {{19, g_bytes + 783}}}, - {&grpc_static_metadata_refcounts[64], {{16, g_bytes + 802}}}, - {&grpc_static_metadata_refcounts[65], {{14, g_bytes + 818}}}, - {&grpc_static_metadata_refcounts[66], {{16, g_bytes + 832}}}, - {&grpc_static_metadata_refcounts[67], {{13, g_bytes + 848}}}, - {&grpc_static_metadata_refcounts[68], {{6, g_bytes + 861}}}, - {&grpc_static_metadata_refcounts[69], {{4, g_bytes + 867}}}, - {&grpc_static_metadata_refcounts[70], {{4, g_bytes + 871}}}, - {&grpc_static_metadata_refcounts[71], {{6, g_bytes + 875}}}, - {&grpc_static_metadata_refcounts[72], {{7, g_bytes + 881}}}, - {&grpc_static_metadata_refcounts[73], {{4, g_bytes + 888}}}, - {&grpc_static_metadata_refcounts[74], {{8, g_bytes + 892}}}, - {&grpc_static_metadata_refcounts[75], {{17, g_bytes + 900}}}, - {&grpc_static_metadata_refcounts[76], {{13, g_bytes + 917}}}, - {&grpc_static_metadata_refcounts[77], {{8, g_bytes + 930}}}, - {&grpc_static_metadata_refcounts[78], {{19, g_bytes + 938}}}, - {&grpc_static_metadata_refcounts[79], {{13, g_bytes + 957}}}, - {&grpc_static_metadata_refcounts[80], {{4, g_bytes + 970}}}, - {&grpc_static_metadata_refcounts[81], {{8, g_bytes + 974}}}, - {&grpc_static_metadata_refcounts[82], {{12, g_bytes + 982}}}, - {&grpc_static_metadata_refcounts[83], {{18, g_bytes + 994}}}, - {&grpc_static_metadata_refcounts[84], {{19, g_bytes + 1012}}}, - {&grpc_static_metadata_refcounts[85], {{5, g_bytes + 1031}}}, - {&grpc_static_metadata_refcounts[86], {{7, g_bytes + 1036}}}, - {&grpc_static_metadata_refcounts[87], {{7, g_bytes + 1043}}}, - {&grpc_static_metadata_refcounts[88], {{11, g_bytes + 1050}}}, - {&grpc_static_metadata_refcounts[89], {{6, g_bytes + 1061}}}, - {&grpc_static_metadata_refcounts[90], {{10, g_bytes + 1067}}}, - {&grpc_static_metadata_refcounts[91], {{25, g_bytes + 1077}}}, - {&grpc_static_metadata_refcounts[92], {{17, g_bytes + 1102}}}, - {&grpc_static_metadata_refcounts[93], {{4, g_bytes + 1119}}}, - {&grpc_static_metadata_refcounts[94], {{3, g_bytes + 1123}}}, - {&grpc_static_metadata_refcounts[95], {{16, g_bytes + 1126}}}, - {&grpc_static_metadata_refcounts[96], {{1, g_bytes + 1142}}}, + {&grpc_static_metadata_refcounts[21], {{26, g_bytes + 282}}}, + {&grpc_static_metadata_refcounts[22], {{22, g_bytes + 308}}}, + {&grpc_static_metadata_refcounts[23], {{12, g_bytes + 330}}}, + {&grpc_static_metadata_refcounts[24], {{1, g_bytes + 342}}}, + {&grpc_static_metadata_refcounts[25], {{1, g_bytes + 343}}}, + {&grpc_static_metadata_refcounts[26], {{1, g_bytes + 344}}}, + {&grpc_static_metadata_refcounts[27], {{1, g_bytes + 345}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, + {&grpc_static_metadata_refcounts[29], {{19, g_bytes + 346}}}, + {&grpc_static_metadata_refcounts[30], {{12, g_bytes + 365}}}, + {&grpc_static_metadata_refcounts[31], {{30, g_bytes + 377}}}, + {&grpc_static_metadata_refcounts[32], {{31, g_bytes + 407}}}, + {&grpc_static_metadata_refcounts[33], {{36, g_bytes + 438}}}, + {&grpc_static_metadata_refcounts[34], {{28, g_bytes + 474}}}, + {&grpc_static_metadata_refcounts[35], {{80, g_bytes + 502}}}, + {&grpc_static_metadata_refcounts[36], {{7, g_bytes + 582}}}, + {&grpc_static_metadata_refcounts[37], {{4, g_bytes + 589}}}, + {&grpc_static_metadata_refcounts[38], {{11, g_bytes + 593}}}, + {&grpc_static_metadata_refcounts[39], {{3, g_bytes + 604}}}, + {&grpc_static_metadata_refcounts[40], {{4, g_bytes + 607}}}, + {&grpc_static_metadata_refcounts[41], {{1, g_bytes + 611}}}, + {&grpc_static_metadata_refcounts[42], {{11, g_bytes + 612}}}, + {&grpc_static_metadata_refcounts[43], {{4, g_bytes + 623}}}, + {&grpc_static_metadata_refcounts[44], {{5, g_bytes + 627}}}, + {&grpc_static_metadata_refcounts[45], {{3, g_bytes + 632}}}, + {&grpc_static_metadata_refcounts[46], {{3, g_bytes + 635}}}, + {&grpc_static_metadata_refcounts[47], {{3, g_bytes + 638}}}, + {&grpc_static_metadata_refcounts[48], {{3, g_bytes + 641}}}, + {&grpc_static_metadata_refcounts[49], {{3, g_bytes + 644}}}, + {&grpc_static_metadata_refcounts[50], {{3, g_bytes + 647}}}, + {&grpc_static_metadata_refcounts[51], {{3, g_bytes + 650}}}, + {&grpc_static_metadata_refcounts[52], {{14, g_bytes + 653}}}, + {&grpc_static_metadata_refcounts[53], {{13, g_bytes + 667}}}, + {&grpc_static_metadata_refcounts[54], {{15, g_bytes + 680}}}, + {&grpc_static_metadata_refcounts[55], {{13, g_bytes + 695}}}, + {&grpc_static_metadata_refcounts[56], {{6, g_bytes + 708}}}, + {&grpc_static_metadata_refcounts[57], {{27, g_bytes + 714}}}, + {&grpc_static_metadata_refcounts[58], {{3, g_bytes + 741}}}, + {&grpc_static_metadata_refcounts[59], {{5, g_bytes + 744}}}, + {&grpc_static_metadata_refcounts[60], {{13, g_bytes + 749}}}, + {&grpc_static_metadata_refcounts[61], {{13, g_bytes + 762}}}, + {&grpc_static_metadata_refcounts[62], {{19, g_bytes + 775}}}, + {&grpc_static_metadata_refcounts[63], {{16, g_bytes + 794}}}, + {&grpc_static_metadata_refcounts[64], {{14, g_bytes + 810}}}, + {&grpc_static_metadata_refcounts[65], {{16, g_bytes + 824}}}, + {&grpc_static_metadata_refcounts[66], {{13, g_bytes + 840}}}, + {&grpc_static_metadata_refcounts[67], {{6, g_bytes + 853}}}, + {&grpc_static_metadata_refcounts[68], {{4, g_bytes + 859}}}, + {&grpc_static_metadata_refcounts[69], {{4, g_bytes + 863}}}, + {&grpc_static_metadata_refcounts[70], {{6, g_bytes + 867}}}, + {&grpc_static_metadata_refcounts[71], {{7, g_bytes + 873}}}, + {&grpc_static_metadata_refcounts[72], {{4, g_bytes + 880}}}, + {&grpc_static_metadata_refcounts[73], {{8, g_bytes + 884}}}, + {&grpc_static_metadata_refcounts[74], {{17, g_bytes + 892}}}, + {&grpc_static_metadata_refcounts[75], {{13, g_bytes + 909}}}, + {&grpc_static_metadata_refcounts[76], {{8, g_bytes + 922}}}, + {&grpc_static_metadata_refcounts[77], {{19, g_bytes + 930}}}, + {&grpc_static_metadata_refcounts[78], {{13, g_bytes + 949}}}, + {&grpc_static_metadata_refcounts[79], {{4, g_bytes + 962}}}, + {&grpc_static_metadata_refcounts[80], {{8, g_bytes + 966}}}, + {&grpc_static_metadata_refcounts[81], {{12, g_bytes + 974}}}, + {&grpc_static_metadata_refcounts[82], {{18, g_bytes + 986}}}, + {&grpc_static_metadata_refcounts[83], {{19, g_bytes + 1004}}}, + {&grpc_static_metadata_refcounts[84], {{5, g_bytes + 1023}}}, + {&grpc_static_metadata_refcounts[85], {{7, g_bytes + 1028}}}, + {&grpc_static_metadata_refcounts[86], {{7, g_bytes + 1035}}}, + {&grpc_static_metadata_refcounts[87], {{11, g_bytes + 1042}}}, + {&grpc_static_metadata_refcounts[88], {{6, g_bytes + 1053}}}, + {&grpc_static_metadata_refcounts[89], {{10, g_bytes + 1059}}}, + {&grpc_static_metadata_refcounts[90], {{25, g_bytes + 1069}}}, + {&grpc_static_metadata_refcounts[91], {{17, g_bytes + 1094}}}, + {&grpc_static_metadata_refcounts[92], {{4, g_bytes + 1111}}}, + {&grpc_static_metadata_refcounts[93], {{3, g_bytes + 1115}}}, + {&grpc_static_metadata_refcounts[94], {{16, g_bytes + 1118}}}, + {&grpc_static_metadata_refcounts[95], {{1, g_bytes + 1134}}}, + {&grpc_static_metadata_refcounts[96], {{8, g_bytes + 1135}}}, {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}, - {&grpc_static_metadata_refcounts[98], {{8, g_bytes + 1151}}}, - {&grpc_static_metadata_refcounts[99], {{16, g_bytes + 1159}}}, - {&grpc_static_metadata_refcounts[100], {{4, g_bytes + 1175}}}, - {&grpc_static_metadata_refcounts[101], {{3, g_bytes + 1179}}}, - {&grpc_static_metadata_refcounts[102], {{11, g_bytes + 1182}}}, - {&grpc_static_metadata_refcounts[103], {{16, g_bytes + 1193}}}, - {&grpc_static_metadata_refcounts[104], {{13, g_bytes + 1209}}}, - {&grpc_static_metadata_refcounts[105], {{12, g_bytes + 1222}}}, - {&grpc_static_metadata_refcounts[106], {{21, g_bytes + 1234}}}, + {&grpc_static_metadata_refcounts[98], {{16, g_bytes + 1151}}}, + {&grpc_static_metadata_refcounts[99], {{4, g_bytes + 1167}}}, + {&grpc_static_metadata_refcounts[100], {{3, g_bytes + 1171}}}, + {&grpc_static_metadata_refcounts[101], {{11, g_bytes + 1174}}}, + {&grpc_static_metadata_refcounts[102], {{16, g_bytes + 1185}}}, + {&grpc_static_metadata_refcounts[103], {{13, g_bytes + 1201}}}, + {&grpc_static_metadata_refcounts[104], {{12, g_bytes + 1214}}}, + {&grpc_static_metadata_refcounts[105], {{21, g_bytes + 1226}}}, }; /* Warning: the core static metadata currently operates under the soft @@ -716,65 +714,60 @@ grpc_mdelem grpc_static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT] = { GRPC_MAKE_MDELEM( &grpc_static_mdelem_table[73].data(), GRPC_MDELEM_STORAGE_STATIC), - /* GRPC_MDELEM_LB_TOKEN_EMPTY: - "lb-token": "" */ - GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[74].data(), - GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_LB_COST_BIN_EMPTY: "lb-cost-bin": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[75].data(), + &grpc_static_mdelem_table[74].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY: "grpc-accept-encoding": "identity" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[76].data(), + &grpc_static_mdelem_table[75].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE: "grpc-accept-encoding": "deflate" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[77].data(), + &grpc_static_mdelem_table[76].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE: "grpc-accept-encoding": "identity,deflate" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[78].data(), + &grpc_static_mdelem_table[77].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP: "grpc-accept-encoding": "gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[79].data(), + &grpc_static_mdelem_table[78].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP: "grpc-accept-encoding": "identity,gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[80].data(), + &grpc_static_mdelem_table[79].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP: "grpc-accept-encoding": "deflate,gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[81].data(), + &grpc_static_mdelem_table[80].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP: "grpc-accept-encoding": "identity,deflate,gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[82].data(), + &grpc_static_mdelem_table[81].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY: "accept-encoding": "identity" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[83].data(), + &grpc_static_mdelem_table[82].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_ENCODING_GZIP: "accept-encoding": "gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[84].data(), + &grpc_static_mdelem_table[83].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP: "accept-encoding": "identity,gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[85].data(), + &grpc_static_mdelem_table[84].data(), GRPC_MDELEM_STORAGE_STATIC) // clang-format on }; @@ -782,20 +775,20 @@ uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8, 2, 4, 4}; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8, 2, 4, 4}; static const int8_t elems_r[] = { - 15, 10, -8, 0, 2, -42, -81, -43, 0, 6, -8, 0, 0, 0, 2, - -3, -10, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -64, 0, -67, -68, -69, -70, 0, - 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, - 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, - 5, 4, 5, 4, 4, 8, 8, 0, 0, 0, 0, 0, 0, -5, 0}; + 15, 10, -8, 0, 2, -42, -80, -43, 0, 6, -8, 0, 0, 0, 2, + -3, -10, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -63, 0, -47, -68, -69, -70, -52, 0, + 31, 30, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, + 18, 17, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, + 4, 3, 4, 3, 3, 7, 0, 0, 0, 0, 0, 0, -5, 0}; static uint32_t elems_phash(uint32_t i) { - i -= 42; - uint32_t x = i % 105; - uint32_t y = i / 105; + i -= 41; + uint32_t x = i % 104; + uint32_t y = i / 104; uint32_t h = x; if (y < GPR_ARRAY_SIZE(elems_r)) { uint32_t delta = (uint32_t)elems_r[y]; @@ -805,29 +798,28 @@ static uint32_t elems_phash(uint32_t i) { } static const uint16_t elem_keys[] = { - 260, 261, 262, 263, 264, 265, 266, 1107, 1108, 1741, 147, 148, - 472, 473, 1634, 42, 43, 1527, 1750, 1000, 1001, 774, 775, 1643, - 633, 845, 2062, 2169, 2276, 5700, 5914, 6021, 6128, 6235, 1766, 6342, - 6449, 6556, 6663, 6770, 6877, 6984, 7091, 7198, 7305, 7412, 7519, 7626, - 7733, 7840, 7947, 8054, 8161, 8268, 8375, 8482, 8589, 8696, 8803, 8910, - 9017, 9124, 9231, 9338, 9445, 9552, 9659, 1167, 528, 9766, 9873, 208, - 9980, 1173, 1174, 1175, 1176, 1809, 10087, 1060, 10194, 10943, 1702, 0, - 1816, 0, 0, 1597, 0, 0, 350, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0}; + 257, 258, 259, 260, 261, 262, 263, 1096, 1097, 1724, 145, 146, + 467, 468, 1618, 41, 42, 1512, 1733, 990, 991, 766, 767, 1627, + 627, 837, 2042, 2148, 5540, 5858, 5964, 6070, 6282, 6388, 1749, 6494, + 6600, 6706, 6812, 6918, 7024, 7130, 7236, 7342, 7448, 7554, 7660, 7766, + 5752, 7872, 7978, 6176, 8084, 8190, 8296, 8402, 8508, 8614, 8720, 8826, + 8932, 9038, 9144, 9250, 9356, 9462, 9568, 1156, 523, 9674, 9780, 206, + 9886, 1162, 1163, 1164, 1165, 1792, 9992, 1050, 10734, 0, 1686, 0, + 1799, 0, 0, 1582, 0, 346, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0}; static const uint8_t elem_idxs[] = { - 7, 8, 9, 10, 11, 12, 13, 77, 79, 71, 1, 2, 5, 6, 25, 3, - 4, 30, 84, 66, 65, 62, 63, 73, 67, 61, 57, 37, 74, 14, 16, 17, - 18, 19, 15, 20, 21, 22, 23, 24, 26, 27, 28, 29, 31, 32, 33, 34, - 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 76, 69, 55, 56, 70, 58, 78, 80, 81, 82, 83, 59, 64, - 60, 75, 72, 255, 85, 255, 255, 68, 255, 255, 0}; + 7, 8, 9, 10, 11, 12, 13, 76, 78, 71, 1, 2, 5, 6, 25, 3, 4, 30, + 83, 66, 65, 62, 63, 73, 67, 61, 57, 37, 14, 17, 18, 19, 21, 22, 15, 23, + 24, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 38, 16, 39, 40, 20, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 75, 69, 56, 58, 70, + 59, 77, 79, 80, 81, 82, 60, 64, 74, 255, 72, 255, 84, 255, 255, 68, 255, 0}; grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b) { if (a == -1 || b == -1) return GRPC_MDNULL; - uint32_t k = static_cast(a * 107 + b); + uint32_t k = static_cast(a * 106 + b); uint32_t h = elems_phash(k); return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k && elem_idxs[h] != 255 @@ -839,264 +831,261 @@ grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b) { grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[3], {{10, g_bytes + 19}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 0), + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 0), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}}, - {&grpc_static_metadata_refcounts[40], {{3, g_bytes + 612}}}, 1), + {&grpc_static_metadata_refcounts[39], {{3, g_bytes + 604}}}, 1), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}}, - {&grpc_static_metadata_refcounts[41], {{4, g_bytes + 615}}}, 2), + {&grpc_static_metadata_refcounts[40], {{4, g_bytes + 607}}}, 2), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[0], {{5, g_bytes + 0}}}, - {&grpc_static_metadata_refcounts[42], {{1, g_bytes + 619}}}, 3), + {&grpc_static_metadata_refcounts[41], {{1, g_bytes + 611}}}, 3), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[0], {{5, g_bytes + 0}}}, - {&grpc_static_metadata_refcounts[43], {{11, g_bytes + 620}}}, 4), + {&grpc_static_metadata_refcounts[42], {{11, g_bytes + 612}}}, 4), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}}, - {&grpc_static_metadata_refcounts[44], {{4, g_bytes + 631}}}, 5), + {&grpc_static_metadata_refcounts[43], {{4, g_bytes + 623}}}, 5), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}}, - {&grpc_static_metadata_refcounts[45], {{5, g_bytes + 635}}}, 6), + {&grpc_static_metadata_refcounts[44], {{5, g_bytes + 627}}}, 6), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[46], {{3, g_bytes + 640}}}, 7), + {&grpc_static_metadata_refcounts[45], {{3, g_bytes + 632}}}, 7), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[47], {{3, g_bytes + 643}}}, 8), + {&grpc_static_metadata_refcounts[46], {{3, g_bytes + 635}}}, 8), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[48], {{3, g_bytes + 646}}}, 9), + {&grpc_static_metadata_refcounts[47], {{3, g_bytes + 638}}}, 9), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[49], {{3, g_bytes + 649}}}, 10), + {&grpc_static_metadata_refcounts[48], {{3, g_bytes + 641}}}, 10), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[50], {{3, g_bytes + 652}}}, 11), + {&grpc_static_metadata_refcounts[49], {{3, g_bytes + 644}}}, 11), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[51], {{3, g_bytes + 655}}}, 12), + {&grpc_static_metadata_refcounts[50], {{3, g_bytes + 647}}}, 12), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[52], {{3, g_bytes + 658}}}, 13), + {&grpc_static_metadata_refcounts[51], {{3, g_bytes + 650}}}, 13), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[53], {{14, g_bytes + 661}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 14), + {&grpc_static_metadata_refcounts[52], {{14, g_bytes + 653}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 14), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[54], {{13, g_bytes + 675}}}, 15), + {&grpc_static_metadata_refcounts[53], {{13, g_bytes + 667}}}, 15), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[55], {{15, g_bytes + 688}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 16), + {&grpc_static_metadata_refcounts[54], {{15, g_bytes + 680}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 16), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[56], {{13, g_bytes + 703}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 17), + {&grpc_static_metadata_refcounts[55], {{13, g_bytes + 695}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 17), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[57], {{6, g_bytes + 716}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 18), + {&grpc_static_metadata_refcounts[56], {{6, g_bytes + 708}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 18), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[58], {{27, g_bytes + 722}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 19), + {&grpc_static_metadata_refcounts[57], {{27, g_bytes + 714}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 19), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[59], {{3, g_bytes + 749}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 20), + {&grpc_static_metadata_refcounts[58], {{3, g_bytes + 741}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 20), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[60], {{5, g_bytes + 752}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 21), + {&grpc_static_metadata_refcounts[59], {{5, g_bytes + 744}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 21), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[61], {{13, g_bytes + 757}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 22), + {&grpc_static_metadata_refcounts[60], {{13, g_bytes + 749}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 22), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[62], {{13, g_bytes + 770}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 23), + {&grpc_static_metadata_refcounts[61], {{13, g_bytes + 762}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 23), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[63], {{19, g_bytes + 783}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 24), + {&grpc_static_metadata_refcounts[62], {{19, g_bytes + 775}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 24), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 25), + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 25), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[64], {{16, g_bytes + 802}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 26), + {&grpc_static_metadata_refcounts[63], {{16, g_bytes + 794}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 26), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[65], {{14, g_bytes + 818}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 27), + {&grpc_static_metadata_refcounts[64], {{14, g_bytes + 810}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 27), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[66], {{16, g_bytes + 832}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 28), + {&grpc_static_metadata_refcounts[65], {{16, g_bytes + 824}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 28), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[67], {{13, g_bytes + 848}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 29), + {&grpc_static_metadata_refcounts[66], {{13, g_bytes + 840}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 29), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[14], {{12, g_bytes + 158}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 30), + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 30), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[68], {{6, g_bytes + 861}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 31), + {&grpc_static_metadata_refcounts[67], {{6, g_bytes + 853}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 31), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[69], {{4, g_bytes + 867}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 32), + {&grpc_static_metadata_refcounts[68], {{4, g_bytes + 859}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 32), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[70], {{4, g_bytes + 871}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 33), + {&grpc_static_metadata_refcounts[69], {{4, g_bytes + 863}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 33), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[71], {{6, g_bytes + 875}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 34), + {&grpc_static_metadata_refcounts[70], {{6, g_bytes + 867}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 34), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[72], {{7, g_bytes + 881}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 35), + {&grpc_static_metadata_refcounts[71], {{7, g_bytes + 873}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 35), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[73], {{4, g_bytes + 888}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 36), + {&grpc_static_metadata_refcounts[72], {{4, g_bytes + 880}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 36), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[20], {{4, g_bytes + 278}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 37), + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 37), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[74], {{8, g_bytes + 892}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 38), + {&grpc_static_metadata_refcounts[73], {{8, g_bytes + 884}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 38), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[75], {{17, g_bytes + 900}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 39), + {&grpc_static_metadata_refcounts[74], {{17, g_bytes + 892}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 39), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[76], {{13, g_bytes + 917}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 40), + {&grpc_static_metadata_refcounts[75], {{13, g_bytes + 909}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 40), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[77], {{8, g_bytes + 930}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 41), + {&grpc_static_metadata_refcounts[76], {{8, g_bytes + 922}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 41), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[78], {{19, g_bytes + 938}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 42), + {&grpc_static_metadata_refcounts[77], {{19, g_bytes + 930}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 42), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[79], {{13, g_bytes + 957}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 43), + {&grpc_static_metadata_refcounts[78], {{13, g_bytes + 949}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 43), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[80], {{4, g_bytes + 970}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 44), + {&grpc_static_metadata_refcounts[79], {{4, g_bytes + 962}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 44), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[81], {{8, g_bytes + 974}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 45), + {&grpc_static_metadata_refcounts[80], {{8, g_bytes + 966}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 45), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[82], {{12, g_bytes + 982}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 46), + {&grpc_static_metadata_refcounts[81], {{12, g_bytes + 974}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 46), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[83], {{18, g_bytes + 994}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 47), + {&grpc_static_metadata_refcounts[82], {{18, g_bytes + 986}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 47), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[84], {{19, g_bytes + 1012}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 48), + {&grpc_static_metadata_refcounts[83], {{19, g_bytes + 1004}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 48), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[85], {{5, g_bytes + 1031}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 49), + {&grpc_static_metadata_refcounts[84], {{5, g_bytes + 1023}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 49), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[86], {{7, g_bytes + 1036}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 50), + {&grpc_static_metadata_refcounts[85], {{7, g_bytes + 1028}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 50), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[87], {{7, g_bytes + 1043}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 51), + {&grpc_static_metadata_refcounts[86], {{7, g_bytes + 1035}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 51), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[88], {{11, g_bytes + 1050}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 52), + {&grpc_static_metadata_refcounts[87], {{11, g_bytes + 1042}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 52), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[89], {{6, g_bytes + 1061}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 53), + {&grpc_static_metadata_refcounts[88], {{6, g_bytes + 1053}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 53), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[90], {{10, g_bytes + 1067}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 54), + {&grpc_static_metadata_refcounts[89], {{10, g_bytes + 1059}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 54), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[91], {{25, g_bytes + 1077}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 55), + {&grpc_static_metadata_refcounts[90], {{25, g_bytes + 1069}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 55), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[92], {{17, g_bytes + 1102}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 56), + {&grpc_static_metadata_refcounts[91], {{17, g_bytes + 1094}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 56), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[19], {{10, g_bytes + 268}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 57), + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 57), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[93], {{4, g_bytes + 1119}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 58), + {&grpc_static_metadata_refcounts[92], {{4, g_bytes + 1111}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 58), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[94], {{3, g_bytes + 1123}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 59), + {&grpc_static_metadata_refcounts[93], {{3, g_bytes + 1115}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 59), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[95], {{16, g_bytes + 1126}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 60), + {&grpc_static_metadata_refcounts[94], {{16, g_bytes + 1118}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 60), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}}, - {&grpc_static_metadata_refcounts[96], {{1, g_bytes + 1142}}}, 61), + {&grpc_static_metadata_refcounts[95], {{1, g_bytes + 1134}}}, 61), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}}, - {&grpc_static_metadata_refcounts[25], {{1, g_bytes + 350}}}, 62), + {&grpc_static_metadata_refcounts[24], {{1, g_bytes + 342}}}, 62), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}}, - {&grpc_static_metadata_refcounts[26], {{1, g_bytes + 351}}}, 63), + {&grpc_static_metadata_refcounts[25], {{1, g_bytes + 343}}}, 63), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}}, - {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}, 64), + {&grpc_static_metadata_refcounts[96], {{8, g_bytes + 1135}}}, 64), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}}, - {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}, 65), + {&grpc_static_metadata_refcounts[37], {{4, g_bytes + 589}}}, 65), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}}, - {&grpc_static_metadata_refcounts[37], {{7, g_bytes + 590}}}, 66), + {&grpc_static_metadata_refcounts[36], {{7, g_bytes + 582}}}, 66), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[5], {{2, g_bytes + 36}}}, - {&grpc_static_metadata_refcounts[98], {{8, g_bytes + 1151}}}, 67), + {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}, 67), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[14], {{12, g_bytes + 158}}}, - {&grpc_static_metadata_refcounts[99], {{16, g_bytes + 1159}}}, 68), + {&grpc_static_metadata_refcounts[98], {{16, g_bytes + 1151}}}, 68), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}}, - {&grpc_static_metadata_refcounts[100], {{4, g_bytes + 1175}}}, 69), + {&grpc_static_metadata_refcounts[99], {{4, g_bytes + 1167}}}, 69), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}}, - {&grpc_static_metadata_refcounts[101], {{3, g_bytes + 1179}}}, 70), + {&grpc_static_metadata_refcounts[100], {{3, g_bytes + 1171}}}, 70), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 71), + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 71), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}}, - {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}, 72), + {&grpc_static_metadata_refcounts[96], {{8, g_bytes + 1135}}}, 72), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}}, - {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}, 73), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[21], {{8, g_bytes + 282}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 74), + {&grpc_static_metadata_refcounts[37], {{4, g_bytes + 589}}}, 73), grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[102], {{11, g_bytes + 1182}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 75), + {&grpc_static_metadata_refcounts[101], {{11, g_bytes + 1174}}}, + {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 74), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}, 76), + {&grpc_static_metadata_refcounts[96], {{8, g_bytes + 1135}}}, 75), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[37], {{7, g_bytes + 590}}}, 77), + {&grpc_static_metadata_refcounts[36], {{7, g_bytes + 582}}}, 76), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[103], {{16, g_bytes + 1193}}}, 78), + {&grpc_static_metadata_refcounts[102], {{16, g_bytes + 1185}}}, 77), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}, 79), + {&grpc_static_metadata_refcounts[37], {{4, g_bytes + 589}}}, 78), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[104], {{13, g_bytes + 1209}}}, 80), + {&grpc_static_metadata_refcounts[103], {{13, g_bytes + 1201}}}, 79), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[105], {{12, g_bytes + 1222}}}, 81), + {&grpc_static_metadata_refcounts[104], {{12, g_bytes + 1214}}}, 80), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[106], {{21, g_bytes + 1234}}}, 82), + {&grpc_static_metadata_refcounts[105], {{21, g_bytes + 1226}}}, 81), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}, 83), + {&grpc_static_metadata_refcounts[96], {{8, g_bytes + 1135}}}, 82), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}, 84), + {&grpc_static_metadata_refcounts[37], {{4, g_bytes + 589}}}, 83), grpc_core::StaticMetadata( {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[104], {{13, g_bytes + 1209}}}, 85), + {&grpc_static_metadata_refcounts[103], {{13, g_bytes + 1201}}}, 84), }; -const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 76, 77, 78, - 79, 80, 81, 82}; +const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 75, 76, 77, + 78, 79, 80, 81}; -const uint8_t grpc_static_accept_stream_encoding_metadata[4] = {0, 83, 84, 85}; +const uint8_t grpc_static_accept_stream_encoding_metadata[4] = {0, 82, 83, 84}; diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index 458e87d30a7..991a7970cb6 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -33,7 +33,7 @@ #include "src/core/lib/transport/metadata.h" -#define GRPC_STATIC_MDSTR_COUNT 107 +#define GRPC_STATIC_MDSTR_COUNT 106 extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; /* ":path" */ #define GRPC_MDSTR_PATH (grpc_static_slice_table[0]) @@ -78,185 +78,183 @@ extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; #define GRPC_MDSTR_USER_AGENT (grpc_static_slice_table[19]) /* "host" */ #define GRPC_MDSTR_HOST (grpc_static_slice_table[20]) -/* "lb-token" */ -#define GRPC_MDSTR_LB_TOKEN (grpc_static_slice_table[21]) /* "grpc-previous-rpc-attempts" */ -#define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS (grpc_static_slice_table[22]) +#define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS (grpc_static_slice_table[21]) /* "grpc-retry-pushback-ms" */ -#define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS (grpc_static_slice_table[23]) +#define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS (grpc_static_slice_table[22]) /* "grpc-timeout" */ -#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table[24]) +#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table[23]) /* "1" */ -#define GRPC_MDSTR_1 (grpc_static_slice_table[25]) +#define GRPC_MDSTR_1 (grpc_static_slice_table[24]) /* "2" */ -#define GRPC_MDSTR_2 (grpc_static_slice_table[26]) +#define GRPC_MDSTR_2 (grpc_static_slice_table[25]) /* "3" */ -#define GRPC_MDSTR_3 (grpc_static_slice_table[27]) +#define GRPC_MDSTR_3 (grpc_static_slice_table[26]) /* "4" */ -#define GRPC_MDSTR_4 (grpc_static_slice_table[28]) +#define GRPC_MDSTR_4 (grpc_static_slice_table[27]) /* "" */ -#define GRPC_MDSTR_EMPTY (grpc_static_slice_table[29]) +#define GRPC_MDSTR_EMPTY (grpc_static_slice_table[28]) /* "grpc.wait_for_ready" */ -#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table[30]) +#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table[29]) /* "grpc.timeout" */ -#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table[31]) +#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table[30]) /* "grpc.max_request_message_bytes" */ #define GRPC_MDSTR_GRPC_DOT_MAX_REQUEST_MESSAGE_BYTES \ - (grpc_static_slice_table[32]) + (grpc_static_slice_table[31]) /* "grpc.max_response_message_bytes" */ #define GRPC_MDSTR_GRPC_DOT_MAX_RESPONSE_MESSAGE_BYTES \ - (grpc_static_slice_table[33]) + (grpc_static_slice_table[32]) /* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \ - (grpc_static_slice_table[34]) + (grpc_static_slice_table[33]) /* "/grpc.health.v1.Health/Watch" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH \ - (grpc_static_slice_table[35]) + (grpc_static_slice_table[34]) /* "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources" */ #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \ - (grpc_static_slice_table[36]) + (grpc_static_slice_table[35]) /* "deflate" */ -#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[37]) +#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[36]) /* "gzip" */ -#define GRPC_MDSTR_GZIP (grpc_static_slice_table[38]) +#define GRPC_MDSTR_GZIP (grpc_static_slice_table[37]) /* "stream/gzip" */ -#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[39]) +#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[38]) /* "GET" */ -#define GRPC_MDSTR_GET (grpc_static_slice_table[40]) +#define GRPC_MDSTR_GET (grpc_static_slice_table[39]) /* "POST" */ -#define GRPC_MDSTR_POST (grpc_static_slice_table[41]) +#define GRPC_MDSTR_POST (grpc_static_slice_table[40]) /* "/" */ -#define GRPC_MDSTR_SLASH (grpc_static_slice_table[42]) +#define GRPC_MDSTR_SLASH (grpc_static_slice_table[41]) /* "/index.html" */ -#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[43]) +#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[42]) /* "http" */ -#define GRPC_MDSTR_HTTP (grpc_static_slice_table[44]) +#define GRPC_MDSTR_HTTP (grpc_static_slice_table[43]) /* "https" */ -#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[45]) +#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[44]) /* "200" */ -#define GRPC_MDSTR_200 (grpc_static_slice_table[46]) +#define GRPC_MDSTR_200 (grpc_static_slice_table[45]) /* "204" */ -#define GRPC_MDSTR_204 (grpc_static_slice_table[47]) +#define GRPC_MDSTR_204 (grpc_static_slice_table[46]) /* "206" */ -#define GRPC_MDSTR_206 (grpc_static_slice_table[48]) +#define GRPC_MDSTR_206 (grpc_static_slice_table[47]) /* "304" */ -#define GRPC_MDSTR_304 (grpc_static_slice_table[49]) +#define GRPC_MDSTR_304 (grpc_static_slice_table[48]) /* "400" */ -#define GRPC_MDSTR_400 (grpc_static_slice_table[50]) +#define GRPC_MDSTR_400 (grpc_static_slice_table[49]) /* "404" */ -#define GRPC_MDSTR_404 (grpc_static_slice_table[51]) +#define GRPC_MDSTR_404 (grpc_static_slice_table[50]) /* "500" */ -#define GRPC_MDSTR_500 (grpc_static_slice_table[52]) +#define GRPC_MDSTR_500 (grpc_static_slice_table[51]) /* "accept-charset" */ -#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[53]) +#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[52]) /* "gzip, deflate" */ -#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[54]) +#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[53]) /* "accept-language" */ -#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[55]) +#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[54]) /* "accept-ranges" */ -#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[56]) +#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[55]) /* "accept" */ -#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[57]) +#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[56]) /* "access-control-allow-origin" */ -#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[58]) +#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[57]) /* "age" */ -#define GRPC_MDSTR_AGE (grpc_static_slice_table[59]) +#define GRPC_MDSTR_AGE (grpc_static_slice_table[58]) /* "allow" */ -#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[60]) +#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[59]) /* "authorization" */ -#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[61]) +#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[60]) /* "cache-control" */ -#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[62]) +#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[61]) /* "content-disposition" */ -#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[63]) +#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[62]) /* "content-language" */ -#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[64]) +#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[63]) /* "content-length" */ -#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[65]) +#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[64]) /* "content-location" */ -#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[66]) +#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[65]) /* "content-range" */ -#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[67]) +#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[66]) /* "cookie" */ -#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[68]) +#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[67]) /* "date" */ -#define GRPC_MDSTR_DATE (grpc_static_slice_table[69]) +#define GRPC_MDSTR_DATE (grpc_static_slice_table[68]) /* "etag" */ -#define GRPC_MDSTR_ETAG (grpc_static_slice_table[70]) +#define GRPC_MDSTR_ETAG (grpc_static_slice_table[69]) /* "expect" */ -#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[71]) +#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[70]) /* "expires" */ -#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[72]) +#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[71]) /* "from" */ -#define GRPC_MDSTR_FROM (grpc_static_slice_table[73]) +#define GRPC_MDSTR_FROM (grpc_static_slice_table[72]) /* "if-match" */ -#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[74]) +#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[73]) /* "if-modified-since" */ -#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[75]) +#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[74]) /* "if-none-match" */ -#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[76]) +#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[75]) /* "if-range" */ -#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[77]) +#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[76]) /* "if-unmodified-since" */ -#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[78]) +#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[77]) /* "last-modified" */ -#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[79]) +#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[78]) /* "link" */ -#define GRPC_MDSTR_LINK (grpc_static_slice_table[80]) +#define GRPC_MDSTR_LINK (grpc_static_slice_table[79]) /* "location" */ -#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[81]) +#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[80]) /* "max-forwards" */ -#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[82]) +#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[81]) /* "proxy-authenticate" */ -#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[83]) +#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[82]) /* "proxy-authorization" */ -#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[84]) +#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[83]) /* "range" */ -#define GRPC_MDSTR_RANGE (grpc_static_slice_table[85]) +#define GRPC_MDSTR_RANGE (grpc_static_slice_table[84]) /* "referer" */ -#define GRPC_MDSTR_REFERER (grpc_static_slice_table[86]) +#define GRPC_MDSTR_REFERER (grpc_static_slice_table[85]) /* "refresh" */ -#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[87]) +#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[86]) /* "retry-after" */ -#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[88]) +#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[87]) /* "server" */ -#define GRPC_MDSTR_SERVER (grpc_static_slice_table[89]) +#define GRPC_MDSTR_SERVER (grpc_static_slice_table[88]) /* "set-cookie" */ -#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[90]) +#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[89]) /* "strict-transport-security" */ -#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[91]) +#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[90]) /* "transfer-encoding" */ -#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[92]) +#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[91]) /* "vary" */ -#define GRPC_MDSTR_VARY (grpc_static_slice_table[93]) +#define GRPC_MDSTR_VARY (grpc_static_slice_table[92]) /* "via" */ -#define GRPC_MDSTR_VIA (grpc_static_slice_table[94]) +#define GRPC_MDSTR_VIA (grpc_static_slice_table[93]) /* "www-authenticate" */ -#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[95]) +#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[94]) /* "0" */ -#define GRPC_MDSTR_0 (grpc_static_slice_table[96]) +#define GRPC_MDSTR_0 (grpc_static_slice_table[95]) /* "identity" */ -#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[97]) +#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[96]) /* "trailers" */ -#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[98]) +#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[97]) /* "application/grpc" */ -#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[99]) +#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[98]) /* "grpc" */ -#define GRPC_MDSTR_GRPC (grpc_static_slice_table[100]) +#define GRPC_MDSTR_GRPC (grpc_static_slice_table[99]) /* "PUT" */ -#define GRPC_MDSTR_PUT (grpc_static_slice_table[101]) +#define GRPC_MDSTR_PUT (grpc_static_slice_table[100]) /* "lb-cost-bin" */ -#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[102]) +#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[101]) /* "identity,deflate" */ -#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[103]) +#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[102]) /* "identity,gzip" */ -#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[104]) +#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[103]) /* "deflate,gzip" */ -#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[105]) +#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[104]) /* "identity,deflate,gzip" */ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (grpc_static_slice_table[106]) + (grpc_static_slice_table[105]) extern grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT]; @@ -268,7 +266,7 @@ extern grpc_slice_refcount (static_cast( \ ((static_slice).refcount - grpc_static_metadata_refcounts))) -#define GRPC_STATIC_MDELEM_COUNT 86 +#define GRPC_STATIC_MDELEM_COUNT 85 extern grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT]; @@ -429,38 +427,36 @@ extern grpc_mdelem grpc_static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT]; (grpc_static_mdelem_manifested[72]) /* "content-encoding": "gzip" */ #define GRPC_MDELEM_CONTENT_ENCODING_GZIP (grpc_static_mdelem_manifested[73]) -/* "lb-token": "" */ -#define GRPC_MDELEM_LB_TOKEN_EMPTY (grpc_static_mdelem_manifested[74]) /* "lb-cost-bin": "" */ -#define GRPC_MDELEM_LB_COST_BIN_EMPTY (grpc_static_mdelem_manifested[75]) +#define GRPC_MDELEM_LB_COST_BIN_EMPTY (grpc_static_mdelem_manifested[74]) /* "grpc-accept-encoding": "identity" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \ - (grpc_static_mdelem_manifested[76]) + (grpc_static_mdelem_manifested[75]) /* "grpc-accept-encoding": "deflate" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \ - (grpc_static_mdelem_manifested[77]) + (grpc_static_mdelem_manifested[76]) /* "grpc-accept-encoding": "identity,deflate" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE \ - (grpc_static_mdelem_manifested[78]) + (grpc_static_mdelem_manifested[77]) /* "grpc-accept-encoding": "gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \ - (grpc_static_mdelem_manifested[79]) + (grpc_static_mdelem_manifested[78]) /* "grpc-accept-encoding": "identity,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \ - (grpc_static_mdelem_manifested[80]) + (grpc_static_mdelem_manifested[79]) /* "grpc-accept-encoding": "deflate,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP \ - (grpc_static_mdelem_manifested[81]) + (grpc_static_mdelem_manifested[80]) /* "grpc-accept-encoding": "identity,deflate,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (grpc_static_mdelem_manifested[82]) + (grpc_static_mdelem_manifested[81]) /* "accept-encoding": "identity" */ -#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY (grpc_static_mdelem_manifested[83]) +#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY (grpc_static_mdelem_manifested[82]) /* "accept-encoding": "gzip" */ -#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP (grpc_static_mdelem_manifested[84]) +#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP (grpc_static_mdelem_manifested[83]) /* "accept-encoding": "identity,gzip" */ #define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \ - (grpc_static_mdelem_manifested[85]) + (grpc_static_mdelem_manifested[84]) grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b); typedef enum { @@ -485,7 +481,6 @@ typedef enum { GRPC_BATCH_GRPC_INTERNAL_STREAM_ENCODING_REQUEST, GRPC_BATCH_USER_AGENT, GRPC_BATCH_HOST, - GRPC_BATCH_LB_TOKEN, GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS, GRPC_BATCH_GRPC_RETRY_PUSHBACK_MS, GRPC_BATCH_CALLOUTS_COUNT @@ -515,7 +510,6 @@ typedef union { struct grpc_linked_mdelem* grpc_internal_stream_encoding_request; struct grpc_linked_mdelem* user_agent; struct grpc_linked_mdelem* host; - struct grpc_linked_mdelem* lb_token; struct grpc_linked_mdelem* grpc_previous_rpc_attempts; struct grpc_linked_mdelem* grpc_retry_pushback_ms; } named; diff --git a/test/core/end2end/fuzzers/hpack.dictionary b/test/core/end2end/fuzzers/hpack.dictionary index 0469421c975..abad1720ee8 100644 --- a/test/core/end2end/fuzzers/hpack.dictionary +++ b/test/core/end2end/fuzzers/hpack.dictionary @@ -20,7 +20,6 @@ "%grpc-internal-stream-encoding-request" "\x0Auser-agent" "\x04host" -"\x08lb-token" "\x1Agrpc-previous-rpc-attempts" "\x16grpc-retry-pushback-ms" "\x0Cgrpc-timeout" @@ -180,7 +179,6 @@ "\x00\x0Faccept-encoding\x00" "\x00\x10content-encoding\x08identity" "\x00\x10content-encoding\x04gzip" -"\x00\x08lb-token\x00" "\x00\x0Blb-cost-bin\x00" "\x00\x14grpc-accept-encoding\x08identity" "\x00\x14grpc-accept-encoding\x07deflate" diff --git a/test/core/util/test_lb_policies.cc b/test/core/util/test_lb_policies.cc index 041ce1f45a1..12a042ab827 100644 --- a/test/core/util/test_lb_policies.cc +++ b/test/core/util/test_lb_policies.cc @@ -20,6 +20,8 @@ #include +#include + #include "src/core/ext/filters/client_channel/lb_policy.h" #include "src/core/ext/filters/client_channel/lb_policy_registry.h" #include "src/core/lib/channel/channel_args.h" @@ -115,7 +117,13 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy user_data_(user_data) {} PickResult Pick(PickArgs args) override { + // Check that we can read initial metadata. + gpr_log(GPR_INFO, "initial metadata:"); + InterceptRecvTrailingMetadataLoadBalancingPolicy::LogMetadata( + args.initial_metadata); + // Do pick. PickResult result = delegate_picker_->Pick(args); + // Intercept trailing metadata. if (result.type == PickResult::PICK_COMPLETE && result.subchannel != nullptr) { new (args.call_state->Alloc(sizeof(TrailingMetadataHandler))) @@ -180,11 +188,14 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy private: static void RecordRecvTrailingMetadata( - void* arg, grpc_metadata_batch* recv_trailing_metadata, + void* arg, MetadataInterface* recv_trailing_metadata, CallState* call_state) { TrailingMetadataHandler* self = static_cast(arg); GPR_ASSERT(recv_trailing_metadata != nullptr); + gpr_log(GPR_INFO, "trailing metadata:"); + InterceptRecvTrailingMetadataLoadBalancingPolicy::LogMetadata( + recv_trailing_metadata); self->cb_(self->user_data_); self->~TrailingMetadataHandler(); } @@ -192,6 +203,17 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy InterceptRecvTrailingMetadataCallback cb_; void* user_data_; }; + + static void LogMetadata(MetadataInterface* metadata) { + for (MetadataInterface::Iterator it = metadata->Begin(); + !metadata->IsEnd(it); metadata->Next(&it)) { + gpr_log(GPR_INFO, " \"%.*s\"=>\"%.*s\"", + static_cast(metadata->Key(it).size()), + metadata->Key(it).data(), + static_cast(metadata->Value(it).size()), + metadata->Value(it).data()); + } + } }; class InterceptTrailingFactory : public LoadBalancingPolicyFactory { diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index 95a545f5542..6b034347bf8 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -146,38 +146,35 @@ CONFIG = [ ('accept-encoding', ''), ('content-encoding', 'identity'), ('content-encoding', 'gzip'), - ('lb-token', ''), ('lb-cost-bin', ''), ] # All entries here are ignored when counting non-default initial metadata that # prevents the chttp2 server from sending a Trailers-Only response. METADATA_BATCH_CALLOUTS = [ - # (name) - (':path'), - (':method'), - (':status'), - (':authority'), - (':scheme'), - ('te'), - ('grpc-message'), - ('grpc-status'), - ('grpc-payload-bin'), - ('grpc-encoding'), - ('grpc-accept-encoding'), - ('grpc-server-stats-bin'), - ('grpc-tags-bin'), - ('grpc-trace-bin'), - ('content-type'), - ('content-encoding'), - ('accept-encoding'), - ('grpc-internal-encoding-request'), - ('grpc-internal-stream-encoding-request'), - ('user-agent'), - ('host'), - ('lb-token'), - ('grpc-previous-rpc-attempts'), - ('grpc-retry-pushback-ms'), + ':path', + ':method', + ':status', + ':authority', + ':scheme', + 'te', + 'grpc-message', + 'grpc-status', + 'grpc-payload-bin', + 'grpc-encoding', + 'grpc-accept-encoding', + 'grpc-server-stats-bin', + 'grpc-tags-bin', + 'grpc-trace-bin', + 'content-type', + 'content-encoding', + 'accept-encoding', + 'grpc-internal-encoding-request', + 'grpc-internal-stream-encoding-request', + 'user-agent', + 'host', + 'grpc-previous-rpc-attempts', + 'grpc-retry-pushback-ms', ] COMPRESSION_ALGORITHMS = [ From f00dd31ace908df44c1cf6d80bb971830d0473bd Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Sat, 27 Jul 2019 17:52:15 -0700 Subject: [PATCH 109/661] Upgrade Cocoapods to the second latest version Reverting build_one_sample --- src/objective-c/tests/build_one_example.sh | 1 - tools/internal_ci/helper_scripts/prepare_build_macos_rc | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/objective-c/tests/build_one_example.sh b/src/objective-c/tests/build_one_example.sh index a7d1eef7b30..084147f1d46 100755 --- a/src/objective-c/tests/build_one_example.sh +++ b/src/objective-c/tests/build_one_example.sh @@ -30,7 +30,6 @@ cd `dirname $0`/../../.. cd $EXAMPLE_PATH # clean the directory -rm -rf Build/* rm -rf Pods rm -rf $SCHEME.xcworkspace rm -f Podfile.lock diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index e2f52e73117..009cc067578 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -37,7 +37,7 @@ set -e # rvm commands are very verbose time rvm install 2.5.0 rvm use 2.5.0 --default time gem install bundler -v 1.17.3 --no-ri --no-doc -time gem install cocoapods --version 1.3.1 --no-ri --no-doc +time gem install cocoapods --version 1.6.1 --no-ri --no-doc time gem install rake-compiler --no-ri --no-doc rvm osx-ssl-certs status all rvm osx-ssl-certs update all From f9d9fbd36bfdd3d89a1622adee238d2d7fd65c32 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Sat, 27 Jul 2019 18:51:52 -0700 Subject: [PATCH 110/661] Only include src/objective-c/examples/RemoteTestClient/.. stubs Reverting other files & removing redundant spaces --- .../RemoteTestClient/RemoteTest.podspec | 6 ++-- .../AppIcon.appiconset/Contents.json | 30 ------------------- .../tests/RemoteTestClient/RemoteTest.podspec | 4 +-- .../helper_scripts/prepare_build_macos_rc | 2 +- 4 files changed, 6 insertions(+), 36 deletions(-) diff --git a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec index fbc37317ba1..747df63ac5b 100644 --- a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec @@ -45,20 +45,20 @@ Pod::Spec.new do |s| end s.subspec 'Messages' do |ms| - ms.source_files = '**/*.pbobjc.{h,m}' + ms.source_files = 'src/objective-c/examples/RemoteTestClient/*.pbobjc.{h,m}' ms.header_mappings_dir = '.' ms.requires_arc = false ms.dependency 'Protobuf' end s.subspec 'Services' do |ss| - ss.source_files = '**/*.pbrpc.{h,m}' + ss.source_files = 'src/objective-c/examples/RemoteTestClient/*.pbrpc.{h,m}' ss.header_mappings_dir = '.' ss.requires_arc = true ss.dependency 'gRPC-ProtoRPC' ss.dependency "#{s.name}/Messages" end - + s.pod_target_xcconfig = { # This is needed by all pods that depend on Protobuf: 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', diff --git a/src/objective-c/examples/SwiftSample/Images.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/examples/SwiftSample/Images.xcassets/AppIcon.appiconset/Contents.json index d8db8d65fd7..36d2c80d889 100644 --- a/src/objective-c/examples/SwiftSample/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/src/objective-c/examples/SwiftSample/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,15 +1,5 @@ { "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, { "idiom" : "iphone", "size" : "29x29", @@ -40,16 +30,6 @@ "size" : "60x60", "scale" : "3x" }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "2x" - }, { "idiom" : "ipad", "size" : "29x29", @@ -79,16 +59,6 @@ "idiom" : "ipad", "size" : "76x76", "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "83.5x83.5", - "scale" : "2x" - }, - { - "idiom" : "ios-marketing", - "size" : "1024x1024", - "scale" : "1x" } ], "info" : { diff --git a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec index 60727d4d94e..27b7fab069f 100644 --- a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec @@ -45,14 +45,14 @@ Pod::Spec.new do |s| CMD s.subspec "Messages" do |ms| - ms.source_files = "**/*.pbobjc.{h,m}" + ms.source_files = "src/objective-c/tests/RemoteTestClient/*.pbobjc.{h,m}" ms.header_mappings_dir = "." ms.requires_arc = false ms.dependency "Protobuf" end s.subspec "Services" do |ss| - ss.source_files = "**/*.pbrpc.{h,m}" + ss.source_files = "src/objective-c/tests/RemoteTestClient/*.pbrpc.{h,m}" ss.header_mappings_dir = "." ss.requires_arc = true ss.dependency "gRPC-ProtoRPC" diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index 009cc067578..e2f52e73117 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -37,7 +37,7 @@ set -e # rvm commands are very verbose time rvm install 2.5.0 rvm use 2.5.0 --default time gem install bundler -v 1.17.3 --no-ri --no-doc -time gem install cocoapods --version 1.6.1 --no-ri --no-doc +time gem install cocoapods --version 1.3.1 --no-ri --no-doc time gem install rake-compiler --no-ri --no-doc rvm osx-ssl-certs status all rvm osx-ssl-certs update all From 8f3b487838ebb50543185ddef22692d761422e7f Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Sun, 28 Jul 2019 13:49:26 -0700 Subject: [PATCH 111/661] Added some edge case checks --- src/compiler/objective_c_generator_helpers.h | 7 ++++--- src/compiler/objective_c_plugin.cc | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/compiler/objective_c_generator_helpers.h b/src/compiler/objective_c_generator_helpers.h index b5262fcdd6f..d686014faa5 100644 --- a/src/compiler/objective_c_generator_helpers.h +++ b/src/compiler/objective_c_generator_helpers.h @@ -50,10 +50,11 @@ inline ::grpc::string LocalImport(const ::grpc::string& import) { inline ::grpc::string FrameworkImport(const ::grpc::string& import, const ::grpc::string& framework) { - // Flattens the directory structure + // Flattens the directory structure: grab the file name only std::size_t pos = import.rfind("/"); - ::grpc::string filename = import.substr(pos + 1, import.size() - pos); - cerr << filename << endl; + // If pos is npos, pos + 1 is 0, which gives us the entire string, + // so there's no need to check that + ::grpc::string filename = import.substr(pos + 1, import.size() - (pos + 1)); return ::grpc::string("#import <" + framework + "/" + filename + ">\n"); } diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index 4a452a8265c..7d6af7cdbec 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -42,7 +42,6 @@ inline ::grpc::string ImportProtoHeaders( const ::grpc::string& framework) { ::grpc::string header = grpc_objective_c_generator::MessageHeaderName(dep); - // cerr << header << endl; if (!IsProtobufLibraryBundledProtoFile(dep)) { if (framework.empty()) { return indent + LocalImport(header); @@ -89,6 +88,10 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { std::vector<::grpc::string> param = grpc_generator::tokenize(*param_str, "="); if (param[0] == "generate_for_named_framework") { + if (param[1].empty()) { + *error = grpc::string("Name of framework cannot be empty for parameter: ") + param[0]; + return false; + } framework = param[1]; } } From 6172ef8bd6a0b70dd53a521a02a9123e2c73f5c8 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Sun, 28 Jul 2019 14:03:29 -0700 Subject: [PATCH 112/661] Fixed clang_format_code --- src/compiler/objective_c_plugin.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index 7d6af7cdbec..feebe12797e 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -89,7 +89,9 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { grpc_generator::tokenize(*param_str, "="); if (param[0] == "generate_for_named_framework") { if (param[1].empty()) { - *error = grpc::string("Name of framework cannot be empty for parameter: ") + param[0]; + *error = grpc::string( + "Name of framework cannot be empty for parameter: ") + + param[0]; return false; } framework = param[1]; From d9cb5718aec1b00041b9cbc71b85b59be3bfa243 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 29 Jul 2019 10:01:57 -0700 Subject: [PATCH 113/661] nit comment --- src/objective-c/GRPCClient/private/GRPCTransport+Private.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h index dd826a8fc1a..2dc7357c363 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h @@ -28,7 +28,8 @@ NS_ASSUME_NONNULL_BEGIN /** * Get a transport implementation's factory by its transport id. If the transport id was not - * registered with the registry, nil is returned. + * registered with the registry, the default transport factory (core + secure) is returned. If the + * default transport does not exist, an exception is thrown. */ - (id)getTransportFactoryWithId:(GRPCTransportId)transportId; From e45c5f021be938fca5e1fe53a6aa780e1df1a121 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Mon, 29 Jul 2019 10:03:38 -0700 Subject: [PATCH 114/661] Add check_upb_output to sanity test --- tools/codegen/core/gen_upb_api.sh | 12 ++++++++---- tools/distrib/check_upb_output.sh | 23 +++++++++++++++++++++++ tools/run_tests/sanity/sanity_tests.yaml | 15 ++++++++------- 3 files changed, 39 insertions(+), 11 deletions(-) create mode 100755 tools/distrib/check_upb_output.sh diff --git a/tools/codegen/core/gen_upb_api.sh b/tools/codegen/core/gen_upb_api.sh index 710039b0157..d7871d88671 100755 --- a/tools/codegen/core/gen_upb_api.sh +++ b/tools/codegen/core/gen_upb_api.sh @@ -17,6 +17,14 @@ # REQUIRES: Bazel set -ex +if [ $# -eq 0 ]; then + UPB_OUTPUT_DIR=$PWD/src/core/ext/upb-generated + rm -rf $UPB_OUTPUT_DIR + mkdir $UPB_OUTPUT_DIR +else + UPB_OUTPUT_DIR=$1 +fi + pushd third_party/protobuf bazel build :protoc PROTOC=$PWD/bazel-bin/protoc @@ -27,10 +35,6 @@ bazel build :protoc-gen-upb UPB_PLUGIN=$PWD/bazel-bin/protoc-gen-upb popd -UPB_OUTPUT_DIR=$PWD/src/core/ext/upb-generated -rm -rf $UPB_OUTPUT_DIR -mkdir $UPB_OUTPUT_DIR - proto_files=( \ "envoy/api/v2/auth/cert.proto" \ "envoy/api/v2/cds.proto" \ diff --git a/tools/distrib/check_upb_output.sh b/tools/distrib/check_upb_output.sh new file mode 100755 index 00000000000..6febd0e9835 --- /dev/null +++ b/tools/distrib/check_upb_output.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -ex + +readonly UPB_GENERATED_SRC=src/core/ext/upb-generated +readonly UPB_TMP_OUTPUT="$(mktemp -d)" + +tools/codegen/core/gen_upb_api.sh "$UPB_TMP_OUTPUT" + +diff -rq "$UPB_GENERATED_SRC" "$UPB_TMP_OUTPUT" diff --git a/tools/run_tests/sanity/sanity_tests.yaml b/tools/run_tests/sanity/sanity_tests.yaml index 1c5dc5d4312..e9459911a1e 100644 --- a/tools/run_tests/sanity/sanity_tests.yaml +++ b/tools/run_tests/sanity/sanity_tests.yaml @@ -2,7 +2,9 @@ - script: tools/run_tests/sanity/check_bad_dependencies.sh - script: tools/run_tests/sanity/check_bazel_workspace.py - script: tools/run_tests/sanity/check_cache_mk.sh +- script: tools/run_tests/sanity/check_deprecated_grpc++.py - script: tools/run_tests/sanity/check_owners.sh +- script: tools/run_tests/sanity/check_port_platform.py - script: tools/run_tests/sanity/check_qps_scenario_changes.py - script: tools/run_tests/sanity/check_shellcheck.sh - script: tools/run_tests/sanity/check_submodules.sh @@ -10,19 +12,18 @@ - script: tools/run_tests/sanity/check_tracer_sanity.py - script: tools/run_tests/sanity/core_banned_functions.py - script: tools/run_tests/sanity/core_untyped_structs.sh -- script: tools/run_tests/sanity/check_deprecated_grpc++.py -- script: tools/run_tests/sanity/check_port_platform.py - script: tools/buildgen/generate_projects.sh -j 3 cpu_cost: 3 - script: tools/distrib/check_copyright.py +- script: tools/distrib/check_include_guards.py +- script: tools/distrib/check_nanopb_output.sh +- script: tools/distrib/check_trailing_newlines.sh +- script: tools/distrib/check_upb_output.sh - script: tools/distrib/clang_format_code.sh - script: tools/distrib/clang_tidy_code.sh -- script: tools/distrib/check_trailing_newlines.sh -- script: tools/distrib/check_nanopb_output.sh -- script: tools/distrib/check_include_guards.py - script: tools/distrib/pylint_code.sh -- script: tools/distrib/yapf_code.sh - script: tools/distrib/python/check_grpcio_tools.py +- script: tools/distrib/yapf_code.sh cpu_cost: 1000 -- script: tools/distrib/check_shadow_boringssl_symbol_list.sh - script: tools/distrib/check_protobuf_pod_version.sh +- script: tools/distrib/check_shadow_boringssl_symbol_list.sh From c7c74bc41dea7c1f0107fb5fe7e874280d12599c Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 29 Jul 2019 10:21:15 -0700 Subject: [PATCH 115/661] comments and clang format --- src/objective-c/GRPCClient/GRPCTransport.m | 18 ++++++++++++ src/objective-c/GRPCClient/GRPCTypes.h | 28 ++++++++++++++++--- .../private/GRPCCore/GRPCCoreFactory.m | 18 ++++++++++++ .../private/GRPCTransport+Private.m | 18 ++++++++++++ src/objective-c/ProtoRPC/ProtoRPCLegacy.h | 18 ++++++++++++ src/objective-c/ProtoRPC/ProtoRPCLegacy.m | 18 ++++++++++++ src/objective-c/ProtoRPC/ProtoServiceLegacy.h | 18 ++++++++++++ src/objective-c/ProtoRPC/ProtoServiceLegacy.m | 18 ++++++++++++ .../InteropTestsMultipleChannels.m | 2 +- 9 files changed, 151 insertions(+), 5 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCTransport.m b/src/objective-c/GRPCClient/GRPCTransport.m index edb973a8f62..439acfb9cc2 100644 --- a/src/objective-c/GRPCClient/GRPCTransport.m +++ b/src/objective-c/GRPCClient/GRPCTransport.m @@ -1,3 +1,21 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + #import "GRPCTransport.h" static const GRPCTransportId gGRPCCoreSecureId = "io.grpc.transport.core.secure"; diff --git a/src/objective-c/GRPCClient/GRPCTypes.h b/src/objective-c/GRPCClient/GRPCTypes.h index 45fbe219a91..332b6e86a2b 100644 --- a/src/objective-c/GRPCClient/GRPCTypes.h +++ b/src/objective-c/GRPCClient/GRPCTypes.h @@ -1,14 +1,35 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + /** * Safety remark of a gRPC method as defined in RFC 2616 Section 9.1 */ typedef NS_ENUM(NSUInteger, GRPCCallSafety) { - /** Signal that there is no guarantees on how the call affects the server state. */ + /** + * Signal that there is no guarantees on how the call affects the server + * state. + */ GRPCCallSafetyDefault = 0, /** Signal that the call is idempotent. gRPC is free to use PUT verb. */ GRPCCallSafetyIdempotentRequest = 1, /** - * Signal that the call is cacheable and will not affect server state. gRPC is free to use GET - * verb. + * Signal that the call is cacheable and will not affect server state. gRPC is + * free to use GET verb. */ GRPCCallSafetyCacheableRequest = 2, }; @@ -34,4 +55,3 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) { /** Insecure channel. FOR TEST ONLY! */ GRPCTransportTypeInsecure, }; - diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m index f5d6276a570..19d7231a203 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m @@ -1,3 +1,21 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + #import "GRPCCoreFactory.h" #import diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m index c8198462bd4..2482ff86e6a 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m @@ -1,3 +1,21 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + #import "GRPCTransport+Private.h" #import diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h index 2ceb4339bd1..7b9658d5b94 100644 --- a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h @@ -1,3 +1,21 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + #import @class GRPCProtoMethod; diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m index b5c0c847c66..4ba93674063 100644 --- a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m @@ -1,3 +1,21 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + #import "ProtoRPCLegacy.h" #import "ProtoMethod.h" diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.h b/src/objective-c/ProtoRPC/ProtoServiceLegacy.h index dd5e533379c..28686f51e37 100644 --- a/src/objective-c/ProtoRPC/ProtoServiceLegacy.h +++ b/src/objective-c/ProtoRPC/ProtoServiceLegacy.h @@ -1,3 +1,21 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + #import "ProtoService.h" @class GRPCProtoCall; diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m index 9484f432216..3f1cb278723 100644 --- a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m +++ b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m @@ -1,3 +1,21 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + #import "ProtoServiceLegacy.h" #import "ProtoMethod.h" #import "ProtoRPCLegacy.h" diff --git a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m index 4a3c2b955ac..94820553d24 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m +++ b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m @@ -19,11 +19,11 @@ #import #import +#import #import #import #import #import -#import #import "../ConfigureCronet.h" #import "InteropTestsBlockCallbacks.h" From c3c24d089dda2ea09fb9f637a79ffca8750649d9 Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Mon, 29 Jul 2019 10:30:09 -0700 Subject: [PATCH 116/661] Use Template --- test/cpp/microbenchmarks/bm_threadpool.cc | 139 ++++++---------------- 1 file changed, 38 insertions(+), 101 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_threadpool.cc b/test/cpp/microbenchmarks/bm_threadpool.cc index 8b83aa2ed28..d3d25074460 100644 --- a/test/cpp/microbenchmarks/bm_threadpool.cc +++ b/test/cpp/microbenchmarks/bm_threadpool.cc @@ -90,16 +90,16 @@ class AddAnotherFunctor : public grpc_experimental_completion_queue_functor { int num_add_; }; -void ThreadPoolAddAnotherHelper(benchmark::State& state, - int concurrent_functor) { +template +static void ThreadPoolAddAnother(benchmark::State& state) { const int num_iterations = state.range(0); const int num_threads = state.range(1); // Number of adds done by each closure. - const int num_add = num_iterations / concurrent_functor; + const int num_add = num_iterations / kConcurrentFunctor; grpc_core::ThreadPool pool(num_threads); while (state.KeepRunningBatch(num_iterations)) { - BlockingCounter counter(concurrent_functor); - for (int i = 0; i < concurrent_functor; ++i) { + BlockingCounter counter(kConcurrentFunctor); + for (int i = 0; i < kConcurrentFunctor; ++i) { pool.Add(new AddAnotherFunctor(&pool, &counter, num_add)); } counter.Wait(); @@ -107,52 +107,23 @@ void ThreadPoolAddAnotherHelper(benchmark::State& state, state.SetItemsProcessed(state.iterations()); } -static void BM_ThreadPool1AddAnother(benchmark::State& state) { - ThreadPoolAddAnotherHelper(state, 1); -} -// First pair is range for number of iterations (num_iterations). -// Second pair is range for thread pool size (num_threads). -BENCHMARK(BM_ThreadPool1AddAnother)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool4AddAnother(benchmark::State& state) { - ThreadPoolAddAnotherHelper(state, 4); -} -BENCHMARK(BM_ThreadPool4AddAnother)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool8AddAnother(benchmark::State& state) { - ThreadPoolAddAnotherHelper(state, 8); -} -BENCHMARK(BM_ThreadPool8AddAnother)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool16AddAnother(benchmark::State& state) { - ThreadPoolAddAnotherHelper(state, 16); -} -BENCHMARK(BM_ThreadPool16AddAnother)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool32AddAnother(benchmark::State& state) { - ThreadPoolAddAnotherHelper(state, 32); -} -BENCHMARK(BM_ThreadPool32AddAnother)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool64AddAnother(benchmark::State& state) { - ThreadPoolAddAnotherHelper(state, 64); -} -BENCHMARK(BM_ThreadPool64AddAnother)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool128AddAnother(benchmark::State& state) { - ThreadPoolAddAnotherHelper(state, 128); -} -BENCHMARK(BM_ThreadPool128AddAnother)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool512AddAnother(benchmark::State& state) { - ThreadPoolAddAnotherHelper(state, 512); -} -BENCHMARK(BM_ThreadPool512AddAnother)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool2048AddAnother(benchmark::State& state) { - ThreadPoolAddAnotherHelper(state, 2048); -} -BENCHMARK(BM_ThreadPool2048AddAnother)->RangePair(524288, 524288, 1, 1024); +// First pair of arguments is range for number of iterations (num_iterations). +// Second pair of arguments is range for thread pool size (num_threads). +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 1)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 4)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 8)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 16) + ->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 32) + ->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 64) + ->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 128) + ->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 512) + ->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 2048) + ->RangePair(524288, 524288, 1, 1024); // A functor class that will delete self on end of running. class SuicideFunctorForAdd : public grpc_experimental_completion_queue_functor { @@ -233,15 +204,16 @@ class AddSelfFunctor : public grpc_experimental_completion_queue_functor { int num_add_; }; -void ThreadPoolAddSelfHelper(benchmark::State& state, int concurrent_functor) { +template +static void ThreadPoolAddSelf(benchmark::State& state) { const int num_iterations = state.range(0); const int num_threads = state.range(1); // Number of adds done by each closure. - const int num_add = num_iterations / concurrent_functor; + const int num_add = num_iterations / kConcurrentFunctor; grpc_core::ThreadPool pool(num_threads); while (state.KeepRunningBatch(num_iterations)) { - BlockingCounter counter(concurrent_functor); - for (int i = 0; i < concurrent_functor; ++i) { + BlockingCounter counter(kConcurrentFunctor); + for (int i = 0; i < kConcurrentFunctor; ++i) { pool.Add(new AddSelfFunctor(&pool, &counter, num_add)); } counter.Wait(); @@ -249,52 +221,17 @@ void ThreadPoolAddSelfHelper(benchmark::State& state, int concurrent_functor) { state.SetItemsProcessed(state.iterations()); } -static void BM_ThreadPool1AddSelf(benchmark::State& state) { - ThreadPoolAddSelfHelper(state, 1); -} -// First pair is range for number of iterations (num_iterations). -// Second pair is range for thread pool size (num_threads). -BENCHMARK(BM_ThreadPool1AddSelf)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool4AddSelf(benchmark::State& state) { - ThreadPoolAddSelfHelper(state, 4); -} -BENCHMARK(BM_ThreadPool4AddSelf)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool8AddSelf(benchmark::State& state) { - ThreadPoolAddSelfHelper(state, 8); -} -BENCHMARK(BM_ThreadPool8AddSelf)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool16AddSelf(benchmark::State& state) { - ThreadPoolAddSelfHelper(state, 16); -} -BENCHMARK(BM_ThreadPool16AddSelf)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool32AddSelf(benchmark::State& state) { - ThreadPoolAddSelfHelper(state, 32); -} -BENCHMARK(BM_ThreadPool32AddSelf)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool64AddSelf(benchmark::State& state) { - ThreadPoolAddSelfHelper(state, 64); -} -BENCHMARK(BM_ThreadPool64AddSelf)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool128AddSelf(benchmark::State& state) { - ThreadPoolAddSelfHelper(state, 128); -} -BENCHMARK(BM_ThreadPool128AddSelf)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool512AddSelf(benchmark::State& state) { - ThreadPoolAddSelfHelper(state, 512); -} -BENCHMARK(BM_ThreadPool512AddSelf)->RangePair(524288, 524288, 1, 1024); - -static void BM_ThreadPool2048AddSelf(benchmark::State& state) { - ThreadPoolAddSelfHelper(state, 2048); -} -BENCHMARK(BM_ThreadPool2048AddSelf)->RangePair(524288, 524288, 1, 1024); +// First pair of arguments is range for number of iterations (num_iterations). +// Second pair of arguments is range for thread pool size (num_threads). +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 1)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 4)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 8)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 16)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 32)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 64)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 128)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 512)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 2048)->RangePair(524288, 524288, 1, 1024); #if defined(__GNUC__) && !defined(SWIG) #if defined(__i386__) || defined(__x86_64__) From 232725b99aa715c901da828061edc05d3dd6a066 Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Wed, 24 Jul 2019 00:53:23 -0700 Subject: [PATCH 117/661] Add C++ Cronet end2end tests --- src/cpp/Protobuf-C++.podspec | 42 ++ .../!ProtoCompiler-gRPCCppPlugin.podspec | 125 ++++ ...otoCompiler-gRPCCppPlugin.podspec.template | 127 ++++ .../ios/CronetTests/CppCronetEnd2EndTests.mm | 569 +++++++++++++++++ test/cpp/ios/CronetTests/TestHelper.h | 81 +++ test/cpp/ios/CronetTests/TestHelper.mm | 198 ++++++ test/cpp/ios/Info.plist | 24 + test/cpp/ios/Podfile | 102 +++ .../RemoteTestClientCpp/RemoteTestCpp.podspec | 98 +++ test/cpp/ios/Tests.xcodeproj/project.pbxproj | 594 ++++++++++++++++++ .../xcschemes/CronetTests.xcscheme | 95 +++ test/cpp/ios/build_tests.sh | 40 ++ test/cpp/ios/run_tests.sh | 34 + .../macos/grpc_basictests_cpp_ios.cfg | 31 + tools/run_tests/run_tests.py | 8 + 15 files changed, 2168 insertions(+) create mode 100644 src/cpp/Protobuf-C++.podspec create mode 100644 src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec create mode 100644 templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template create mode 100644 test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm create mode 100644 test/cpp/ios/CronetTests/TestHelper.h create mode 100644 test/cpp/ios/CronetTests/TestHelper.mm create mode 100644 test/cpp/ios/Info.plist create mode 100644 test/cpp/ios/Podfile create mode 100644 test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec create mode 100644 test/cpp/ios/Tests.xcodeproj/project.pbxproj create mode 100644 test/cpp/ios/Tests.xcodeproj/xcshareddata/xcschemes/CronetTests.xcscheme create mode 100755 test/cpp/ios/build_tests.sh create mode 100755 test/cpp/ios/run_tests.sh create mode 100644 tools/internal_ci/macos/grpc_basictests_cpp_ios.cfg diff --git a/src/cpp/Protobuf-C++.podspec b/src/cpp/Protobuf-C++.podspec new file mode 100644 index 00000000000..f6a488dc350 --- /dev/null +++ b/src/cpp/Protobuf-C++.podspec @@ -0,0 +1,42 @@ +Pod::Spec.new do |s| + s.name = 'Protobuf-C++' + s.version = '3.8.0' + s.summary = 'Protocol Buffers v3 runtime library for C++.' + s.homepage = 'https://github.com/google/protobuf' + s.license = '3-Clause BSD License' + s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' } + s.cocoapods_version = '>= 1.0' + + s.source = { :git => 'https://github.com/google/protobuf.git', + :tag => "v#{s.version}" } + + s.source_files = 'src/google/protobuf/*.{h,cc,inc}', + 'src/google/protobuf/stubs/*.{h,cc}', + 'src/google/protobuf/io/*.{h,cc}', + 'src/google/protobuf/util/*.{h,cc}', + 'src/google/protobuf/util/internal/*.{h,cc}' + + # Excluding all the tests in the directories above + s.exclude_files = 'src/google/**/*_test.{h,cc,inc}', + 'src/google/**/*_unittest.{h,cc}', + 'src/google/protobuf/test_util*.{h,cc}', + 'src/google/protobuf/map_lite_test_util.{h,cc}', + 'src/google/protobuf/map_test_util*.{h,cc,inc}' + + s.header_mappings_dir = 'src' + + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.9' + s.tvos.deployment_target = '9.0' + s.watchos.deployment_target = '2.0' + + s.pod_target_xcconfig = { + # Do not let src/google/protobuf/stubs/time.h override system API + 'USE_HEADERMAP' => 'NO', + 'ALWAYS_SEARCH_USER_PATHS' => 'NO', + + # Configure tool is not being used for Xcode. When building, assume pthread is supported. + 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "HAVE_PTHREAD=1"', + } + +end diff --git a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec new file mode 100644 index 00000000000..dc1f8b2c090 --- /dev/null +++ b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec @@ -0,0 +1,125 @@ +# This file has been automatically generated from a template file. +# Please make modifications to +# `templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template` +# instead. This file can be regenerated from the template by running +# `tools/buildgen/generate_projects.sh`. + +# CocoaPods podspec for the gRPC Proto Compiler Plugin +# +# Copyright 2019, 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. + +Pod::Spec.new do |s| + # This pod is only a utility that will be used by other pods _at install time_ (not at compile + # time). Other pods can access it in their `prepare_command` script, under /. + # Because CocoaPods installs pods in alphabetical order, beginning this pod's name with an + # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed + # before them. + s.name = '!ProtoCompiler-gRPCCppPlugin' + v = '1.23.0-dev' + s.version = v + s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.' + s.description = <<-DESC + This podspec only downloads the gRPC protoc plugin so that local pods generating protos can use + it in their invocation of protoc, as part of their prepare_command. + DESC + s.homepage = 'https://grpc.io' + s.license = { + :type => 'Apache License, Version 2.0', + :text => <<-LICENSE + Copyright 2019, 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. + LICENSE + } + s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } + + repo = 'grpc/grpc' + file = "grpc_cpp_plugin-#{v}-macos-x86_64.zip" + s.source = { + :http => "https://github.com/#{repo}/releases/download/v#{v}/#{file}", + # TODO(jcanizales): Add sha1 or sha256 + # :sha1 => '??', + } + + repo_root = '../..' + plugin = 'grpc_cpp_plugin' + + s.preserve_paths = plugin + + # Restrict the protoc version to the one supported by this plugin. + s.dependency '!ProtoCompiler', '3.8.0' + # For the Protobuf dependency not to complain: + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.9' + s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '2.0' + + # This is only for local development of the plugin: If the Podfile brings this pod from a local + # directory using `:path`, CocoaPods won't download the zip file and so the plugin won't be + # present in this pod's directory. We use that knowledge to check for the existence of the file + # and, if absent, compile the plugin from the local sources. + s.prepare_command = <<-CMD + if [ ! -f #{plugin} ]; then + cd #{repo_root} + # This will build the plugin and put it in #{repo_root}/bins/opt. + # + # TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and + # library binary) if found, which _we do not want_. Find a way for this to always use the + # sources in the repo. + make #{plugin} + cd - + fi + CMD +end diff --git a/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template b/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template new file mode 100644 index 00000000000..259a5c54f24 --- /dev/null +++ b/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template @@ -0,0 +1,127 @@ +%YAML 1.2 +--- | + # This file has been automatically generated from a template file. + # Please make modifications to + # `templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template` + # instead. This file can be regenerated from the template by running + # `tools/buildgen/generate_projects.sh`. + + # CocoaPods podspec for the gRPC Proto Compiler Plugin + # + # Copyright 2019, 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. + + Pod::Spec.new do |s| + # This pod is only a utility that will be used by other pods _at install time_ (not at compile + # time). Other pods can access it in their `prepare_command` script, under /. + # Because CocoaPods installs pods in alphabetical order, beginning this pod's name with an + # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed + # before them. + s.name = '!ProtoCompiler-gRPCCppPlugin' + v = '${settings.version}' + s.version = v + s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.' + s.description = <<-DESC + This podspec only downloads the gRPC protoc plugin so that local pods generating protos can use + it in their invocation of protoc, as part of their prepare_command. + DESC + s.homepage = 'https://grpc.io' + s.license = { + :type => 'Apache License, Version 2.0', + :text => <<-LICENSE + Copyright 2019, 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. + LICENSE + } + s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } + + repo = 'grpc/grpc' + file = "grpc_cpp_plugin-#{v}-macos-x86_64.zip" + s.source = { + :http => "https://github.com/#{repo}/releases/download/v#{v}/#{file}", + # TODO(jcanizales): Add sha1 or sha256 + # :sha1 => '??', + } + + repo_root = '../..' + plugin = 'grpc_cpp_plugin' + + s.preserve_paths = plugin + + # Restrict the protoc version to the one supported by this plugin. + s.dependency '!ProtoCompiler', '3.8.0' + # For the Protobuf dependency not to complain: + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.9' + s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '2.0' + + # This is only for local development of the plugin: If the Podfile brings this pod from a local + # directory using `:path`, CocoaPods won't download the zip file and so the plugin won't be + # present in this pod's directory. We use that knowledge to check for the existence of the file + # and, if absent, compile the plugin from the local sources. + s.prepare_command = <<-CMD + if [ ! -f #{plugin} ]; then + cd #{repo_root} + # This will build the plugin and put it in #{repo_root}/bins/opt. + # + # TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and + # library binary) if found, which _we do not want_. Find a way for this to always use the + # sources in the repo. + make #{plugin} + cd - + fi + CMD + end diff --git a/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm b/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm new file mode 100644 index 00000000000..07b514f6c65 --- /dev/null +++ b/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm @@ -0,0 +1,569 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#import "TestHelper.h" +#import "test/core/end2end/data/ssl_test_data.h" + +#import +#import +#import +#import + +using namespace grpc::testing; +using std::chrono::system_clock; +using grpc::Status; +using grpc::ServerContext; +using grpc::ClientContext; + +@interface CppCronetEnd2EndTests : XCTestCase + +@end + +@implementation CppCronetEnd2EndTests { + std::unique_ptr _server; + TestServiceImpl _service; + TestServiceImpl _foo_service; +} + +// The setUp() function is run before the test cases run and only run once ++ (void)setUp { + [super setUp]; + configureCronet(); +} + +- (void)startServer { + if (_server) { + // server is already running + return; + } + + grpc::ServerBuilder builder; + grpc::SslServerCredentialsOptions ssl_opts; + + ssl_opts.pem_root_certs = ""; + grpc::SslServerCredentialsOptions::PemKeyCertPair pkcp = {test_server1_key, test_server1_cert}; + ssl_opts.pem_key_cert_pairs.push_back(pkcp); + auto server_creds = SslServerCredentials(ssl_opts); + builder.AddListeningPort("localhost:5000", server_creds); + builder.RegisterService(&_service); + builder.RegisterService("foo.test.youtube.com", &_foo_service); + _server = builder.BuildAndStart(); +} + +- (void)stopServer { + _server.reset(); +} + +- (void)restartServer { + [self stopServer]; + [self startServer]; +} + +- (void)setUp { + [self startServer]; +} + +- (void)sendRPCWithStub:(EchoTestService::Stub*)stub + numRPCs:(int)num_rpcs + withBinaryMetadata:(BOOL)with_binary_metadata { + EchoRequest request; + EchoResponse response; + request.set_message("Hello hello hello hello"); + + for (int i = 0; i < num_rpcs; ++i) { + ClientContext context; + if (with_binary_metadata) { + char bytes[8] = {'\0', '\1', '\2', '\3', '\4', '\5', '\6', static_cast(i)}; + context.AddMetadata("custom-bin", grpc::string(bytes, 8)); + } + context.set_compression_algorithm(GRPC_COMPRESS_GZIP); + Status s = stub->Echo(&context, request, &response); + XCTAssertEqual(response.message(), request.message()); + XCTAssertTrue(s.ok()); + } +} + +- (std::shared_ptr<::grpc::Channel>)getChannel { + stream_engine* cronetEngine = [Cronet getGlobalEngine]; + auto cronetChannelCredentials = grpc::CronetChannelCredentials(cronetEngine); + grpc::ChannelArguments args; + args.SetSslTargetNameOverride("foo.test.google.fr"); + args.SetUserAgentPrefix("custom_prefix"); + args.SetString(GRPC_ARG_SECONDARY_USER_AGENT_STRING, "end2end_test"); + auto channel = grpc::CreateCustomChannel("127.0.0.1:5000", cronetChannelCredentials, args); + return channel; +} + +- (std::shared_ptr<::grpc::Channel>)getChannelWithInterceptors: + (std::vector>)creators { + stream_engine* cronetEngine = [Cronet getGlobalEngine]; + auto cronetChannelCredentials = grpc::CronetChannelCredentials(cronetEngine); + grpc::ChannelArguments args; + args.SetSslTargetNameOverride("foo.test.google.fr"); + args.SetUserAgentPrefix("custom_prefix"); + args.SetString(GRPC_ARG_SECONDARY_USER_AGENT_STRING, "end2end_test"); + auto channel = grpc::experimental::CreateCustomChannelWithInterceptors( + "127.0.01:5000", cronetChannelCredentials, args, std::move(creators)); + return channel; +} + +- (std::unique_ptr)getStub { + auto channel = [self getChannel]; + auto stub = EchoTestService::NewStub(channel); + return stub; +} + +- (void)testUserAgent { + ClientContext context; + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + request.mutable_param()->set_echo_metadata(true); + auto stub = [self getStub]; + Status s = stub->Echo(&context, request, &response); + XCTAssertTrue(s.ok()); + const auto& trailing_metadata = context.GetServerTrailingMetadata(); + auto iter = trailing_metadata.find("user-agent"); + XCTAssert(iter->second.starts_with("custom_prefix grpc-c++")); +} + +- (void)testMultipleRPCs { + auto stub = [self getStub]; + std::vector threads; + threads.reserve(10); + for (int i = 0; i < 10; ++i) { + threads.emplace_back( + [self, &stub]() { [self sendRPCWithStub:stub.get() numRPCs:10 withBinaryMetadata:NO]; }); + } + for (int i = 0; i < 10; ++i) { + threads[i].join(); + } +} + +- (void)testMultipleRPCsWithBinaryMetadata { + auto stub = [self getStub]; + std::vector threads; + threads.reserve(10); + for (int i = 0; i < 10; ++i) { + threads.emplace_back( + [self, &stub]() { [self sendRPCWithStub:stub.get() numRPCs:10 withBinaryMetadata:YES]; }); + } + for (int i = 0; i < 10; ++i) { + threads[i].join(); + } +} + +- (void)testEmptyBinaryMetadata { + EchoRequest request; + EchoResponse response; + request.set_message("Hello hello hello hello"); + ClientContext context; + context.AddMetadata("custom-bin", ""); + auto stub = [self getStub]; + Status s = stub->Echo(&context, request, &response); + XCTAssertEqual(response.message(), request.message()); + XCTAssertTrue(s.ok()); +} + +- (void)testReconnectChannel { + auto stub = [self getStub]; + [self sendRPCWithStub:stub.get() numRPCs:1 withBinaryMetadata:NO]; + + [self restartServer]; + [self sendRPCWithStub:stub.get() numRPCs:1 withBinaryMetadata:NO]; +} + +- (void)testRequestStreamOneRequest { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + auto stream = stub->RequestStream(&context, &response); + request.set_message("hello"); + XCTAssertTrue(stream->Write(request)); + stream->WritesDone(); + Status s = stream->Finish(); + XCTAssertEqual(response.message(), request.message()); + XCTAssertTrue(s.ok()); + XCTAssertTrue(context.debug_error_string().empty()); +} + +- (void)testRequestStreamOneRequestWithCoalescingApi { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + context.set_initial_metadata_corked(true); + auto stream = stub->RequestStream(&context, &response); + request.set_message("hello"); + XCTAssertTrue(stream->Write(request)); + stream->WritesDone(); + Status s = stream->Finish(); + XCTAssertEqual(response.message(), request.message()); + XCTAssertTrue(s.ok()); +} + +- (void)testRequestStreamTwoRequests { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + auto stream = stub->RequestStream(&context, &response); + request.set_message("hello"); + XCTAssertTrue(stream->Write(request)); + XCTAssertTrue(stream->Write(request)); + stream->WritesDone(); + Status s = stream->Finish(); + XCTAssertEqual(response.message(), "hellohello"); + XCTAssertTrue(s.ok()); +} + +- (void)testResponseStream { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + request.set_message("hello"); + + auto stream = stub->ResponseStream(&context, request); + for (int i = 0; i < kServerDefaultResponseStreamsToSend; ++i) { + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message() + grpc::to_string(i)); + } + XCTAssertFalse(stream->Read(&response)); + + Status s = stream->Finish(); + XCTAssertTrue(s.ok()); +} + +- (void)testBidiStream { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + grpc::string msg("hello"); + + auto stream = stub->BidiStream(&context); + + for (int i = 0; i < kServerDefaultResponseStreamsToSend; ++i) { + request.set_message(msg + grpc::to_string(i)); + XCTAssertTrue(stream->Write(request)); + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message()); + } + + stream->WritesDone(); + XCTAssertFalse(stream->Read(&response)); + XCTAssertFalse(stream->Read(&response)); + + Status s = stream->Finish(); + XCTAssertTrue(s.ok()); +} + +- (void)testBidiStreamWithCoalescingApi { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + context.AddMetadata(kServerFinishAfterNReads, "3"); + context.set_initial_metadata_corked(true); + grpc::string msg("hello"); + + auto stream = stub->BidiStream(&context); + + request.set_message(msg + "0"); + XCTAssertTrue(stream->Write(request)); + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message()); + + request.set_message(msg + "1"); + XCTAssertTrue(stream->Write(request)); + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message()); + + request.set_message(msg + "2"); + stream->WriteLast(request, grpc::WriteOptions()); + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message()); + + XCTAssertFalse(stream->Read(&response)); + XCTAssertFalse(stream->Read(&response)); + + Status s = stream->Finish(); + XCTAssertTrue(s.ok()); +} + +- (void)testCancelBeforeStart { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + request.set_message("hello"); + context.TryCancel(); + Status s = stub->Echo(&context, request, &response); + XCTAssertEqual("", response.message()); + XCTAssertEqual(grpc::StatusCode::CANCELLED, s.error_code()); +} + +- (void)testClientCancelsRequestStream { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + request.set_message("hello"); + + auto stream = stub->RequestStream(&context, &response); + XCTAssertTrue(stream->Write(request)); + XCTAssertTrue(stream->Write(request)); + + context.TryCancel(); + + Status s = stream->Finish(); + XCTAssertEqual(grpc::StatusCode::CANCELLED, s.error_code()); + XCTAssertEqual(response.message(), ""); +} + +- (void)testClientCancelsResponseStream { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + request.set_message("hello"); + + auto stream = stub->ResponseStream(&context, request); + + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message() + "0"); + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message() + "1"); + + context.TryCancel(); + + // The cancellation races with responses, so there might be zero or + // one responses pending, read till failure + + if (stream->Read(&response)) { + XCTAssertEqual(response.message(), request.message() + "2"); + // Since we have cancelled, we expect the next attempt to read to fail + XCTAssertFalse(stream->Read(&response)); + } +} + +- (void)testlClientCancelsBidiStream { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + grpc::string msg("hello"); + + auto stream = stub->BidiStream(&context); + + request.set_message(msg + "0"); + XCTAssertTrue(stream->Write(request)); + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message()); + + request.set_message(msg + "1"); + XCTAssertTrue(stream->Write(request)); + + context.TryCancel(); + + // The cancellation races with responses, so there might be zero or + // one responses pending, read till failure + + if (stream->Read(&response)) { + XCTAssertEqual(response.message(), request.message()); + // Since we have cancelled, we expect the next attempt to read to fail + XCTAssertFalse(stream->Read(&response)); + } + + Status s = stream->Finish(); + XCTAssertEqual(grpc::StatusCode::CANCELLED, s.error_code()); +} + +- (void)testNonExistingService { + auto channel = [self getChannel]; + auto stub = grpc::testing::UnimplementedEchoService::NewStub(channel); + + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + + ClientContext context; + Status s = stub->Unimplemented(&context, request, &response); + XCTAssertEqual(grpc::StatusCode::UNIMPLEMENTED, s.error_code()); + XCTAssertEqual("", s.error_message()); +} + +- (void)testBinaryTrailer { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + + request.mutable_param()->set_echo_metadata(true); + DebugInfo* info = request.mutable_param()->mutable_debug_info(); + info->add_stack_entries("stack_entry_1"); + info->add_stack_entries("stack_entry_2"); + info->add_stack_entries("stack_entry_3"); + info->set_detail("detailed debug info"); + grpc::string expected_string = info->SerializeAsString(); + request.set_message("Hello"); + + Status s = stub->Echo(&context, request, &response); + XCTAssertFalse(s.ok()); + auto trailers = context.GetServerTrailingMetadata(); + XCTAssertEqual(1u, trailers.count(kDebugInfoTrailerKey)); + auto iter = trailers.find(kDebugInfoTrailerKey); + XCTAssertEqual(expected_string, iter->second); + // Parse the returned trailer into a DebugInfo proto. + DebugInfo returned_info; + XCTAssertTrue(returned_info.ParseFromString(ToString(iter->second))); +} + +- (void)testExpectError { + auto stub = [self getStub]; + std::vector expected_status; + expected_status.emplace_back(); + expected_status.back().set_code(13); // INTERNAL + // No Error message or details + + expected_status.emplace_back(); + expected_status.back().set_code(13); // INTERNAL + expected_status.back().set_error_message("text error message"); + expected_status.back().set_binary_error_details("text error details"); + + expected_status.emplace_back(); + expected_status.back().set_code(13); // INTERNAL + expected_status.back().set_error_message("text error message"); + expected_status.back().set_binary_error_details("\x0\x1\x2\x3\x4\x5\x6\x8\x9\xA\xB"); + + for (auto iter = expected_status.begin(); iter != expected_status.end(); ++iter) { + EchoRequest request; + EchoResponse response; + ClientContext context; + request.set_message("Hello"); + auto* error = request.mutable_param()->mutable_expected_error(); + error->set_code(iter->code()); + error->set_error_message(iter->error_message()); + error->set_binary_error_details(iter->binary_error_details()); + + Status s = stub->Echo(&context, request, &response); + XCTAssertFalse(s.ok()); + XCTAssertEqual(iter->code(), s.error_code()); + XCTAssertEqual(iter->error_message(), s.error_message()); + XCTAssertEqual(iter->binary_error_details(), s.error_details()); + XCTAssertTrue(context.debug_error_string().find("created") != std::string::npos); + XCTAssertTrue(context.debug_error_string().find("file") != std::string::npos); + XCTAssertTrue(context.debug_error_string().find("line") != std::string::npos); + XCTAssertTrue(context.debug_error_string().find("status") != std::string::npos); + XCTAssertTrue(context.debug_error_string().find("13") != std::string::npos); + } +} + +- (void)testRpcDeadlineExpires { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + request.mutable_param()->set_skip_cancelled_check(true); + // Let server sleep for 40 ms first to guarantee expiry. + request.mutable_param()->set_server_sleep_us(40 * 1000); + + ClientContext context; + std::chrono::system_clock::time_point deadline = + std::chrono::system_clock::now() + std::chrono::milliseconds(1); + context.set_deadline(deadline); + Status s = stub->Echo(&context, request, &response); + XCTAssertEqual(grpc::StatusCode::DEADLINE_EXCEEDED, s.error_code()); +} + +- (void)testRpcLongDeadline { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + + ClientContext context; + std::chrono::system_clock::time_point deadline = + std::chrono::system_clock::now() + std::chrono::hours(1); + context.set_deadline(deadline); + Status s = stub->Echo(&context, request, &response); + XCTAssertEqual(response.message(), request.message()); + XCTAssertTrue(s.ok()); +} + +- (void)testEchoDeadlineForNoDeadlineRpc { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + request.mutable_param()->set_echo_deadline(true); + + ClientContext context; + Status s = stub->Echo(&context, request, &response); + XCTAssertEqual(response.message(), request.message()); + XCTAssertTrue(s.ok()); + XCTAssertEqual(response.param().request_deadline(), gpr_inf_future(GPR_CLOCK_REALTIME).tv_sec); +} + +- (void)testPeer { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + ClientContext context; + Status s = stub->Echo(&context, request, &response); + XCTAssertTrue(s.ok()); + XCTAssertTrue(CheckIsLocalhost(context.peer())); +} + +- (void)testClientInterceptor { + DummyInterceptor::Reset(); + std::vector> creators; + // Add 20 dummy interceptors + for (auto i = 0; i < 20; i++) { + creators.push_back(std::unique_ptr(new DummyInterceptorFactory())); + } + auto channel = [self getChannelWithInterceptors:std::move(creators)]; + auto stub = EchoTestService::NewStub(channel); + + EchoRequest request; + EchoResponse response; + ClientContext context; + request.set_message("Hello"); + Status s = stub->Echo(&context, request, &response); + XCTAssertTrue(s.ok()); + XCTAssertEqual(DummyInterceptor::GetNumTimesRun(), 20); +} + +@end diff --git a/test/cpp/ios/CronetTests/TestHelper.h b/test/cpp/ios/CronetTests/TestHelper.h new file mode 100644 index 00000000000..fb8a42d459a --- /dev/null +++ b/test/cpp/ios/CronetTests/TestHelper.h @@ -0,0 +1,81 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef TESTHELPER_H +#define TESTHELPER_H + +#import +#import +#import + +#import +#import +#import +#import +#import + +const char* const kServerFinishAfterNReads = "server_finish_after_n_reads"; +const char* const kServerResponseStreamsToSend = "server_responses_to_send"; +const int kServerDefaultResponseStreamsToSend = 3; +const char* const kDebugInfoTrailerKey = "debug-info-bin"; + +grpc::string ToString(const grpc::string_ref& r); +void configureCronet(void); +bool CheckIsLocalhost(const grpc::string& addr); + +class DummyInterceptor : public grpc::experimental::Interceptor { + public: + DummyInterceptor() {} + virtual void Intercept(grpc::experimental::InterceptorBatchMethods* methods); + static void Reset(); + static int GetNumTimesRun(); + + private: + static std::atomic num_times_run_; + static std::atomic num_times_run_reverse_; +}; + +class DummyInterceptorFactory + : public grpc::experimental::ClientInterceptorFactoryInterface { + public: + virtual grpc::experimental::Interceptor* CreateClientInterceptor( + grpc::experimental::ClientRpcInfo* info) override { + return new DummyInterceptor(); + } +}; + +class TestServiceImpl : public grpc::testing::EchoTestService::Service { + public: + grpc::Status Echo(grpc::ServerContext* context, + const grpc::testing::EchoRequest* request, + grpc::testing::EchoResponse* response); + grpc::Status RequestStream( + grpc::ServerContext* context, + grpc::ServerReader* reader, + grpc::testing::EchoResponse* response); + grpc::Status ResponseStream( + grpc::ServerContext* context, const grpc::testing::EchoRequest* request, + grpc::ServerWriter* writer); + + grpc::Status BidiStream( + grpc::ServerContext* context, + grpc::ServerReaderWriter* stream); +}; + +#endif /* TESTHELPER_H */ diff --git a/test/cpp/ios/CronetTests/TestHelper.mm b/test/cpp/ios/CronetTests/TestHelper.mm new file mode 100644 index 00000000000..3b2d1803960 --- /dev/null +++ b/test/cpp/ios/CronetTests/TestHelper.mm @@ -0,0 +1,198 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "TestHelper.h" +#import +#import +#import + +using std::chrono::system_clock; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; +using grpc::testing::EchoTestService; +using grpc::ServerContext; +using grpc::Status; + +std::atomic DummyInterceptor::num_times_run_; +std::atomic DummyInterceptor::num_times_run_reverse_; + +grpc::string ToString(const grpc::string_ref& r) { return grpc::string(r.data(), r.size()); } + +void configureCronet(void) { + static dispatch_once_t configureCronet; + dispatch_once(&configureCronet, ^{ + [Cronet setHttp2Enabled:YES]; + [Cronet setSslKeyLogFileName:@"Documents/key"]; + [Cronet enableTestCertVerifierForTesting]; + NSURL* url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory + inDomains:NSUserDomainMask] lastObject]; + [Cronet start]; + [Cronet startNetLogToFile:@"cronet_netlog.json" logBytes:YES]; + }); +} + +bool CheckIsLocalhost(const grpc::string& addr) { + const grpc::string kIpv6("[::1]:"); + const grpc::string kIpv4MappedIpv6("[::ffff:127.0.0.1]:"); + const grpc::string kIpv4("127.0.0.1:"); + return addr.substr(0, kIpv4.size()) == kIpv4 || + addr.substr(0, kIpv4MappedIpv6.size()) == kIpv4MappedIpv6 || + addr.substr(0, kIpv6.size()) == kIpv6; +} + +int GetIntValueFromMetadataHelper(const char* key, + const std::multimap& metadata, + int default_value) { + if (metadata.find(key) != metadata.end()) { + std::istringstream iss(ToString(metadata.find(key)->second)); + iss >> default_value; + } + + return default_value; +} + +int GetIntValueFromMetadata(const char* key, + const std::multimap& metadata, + int default_value) { + return GetIntValueFromMetadataHelper(key, metadata, default_value); +} + +// When echo_deadline is requested, deadline seen in the ServerContext is set in +// the response in seconds. +void MaybeEchoDeadline(ServerContext* context, const EchoRequest* request, EchoResponse* response) { + if (request->has_param() && request->param().echo_deadline()) { + gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_REALTIME); + if (context->deadline() != system_clock::time_point::max()) { + grpc::Timepoint2Timespec(context->deadline(), &deadline); + } + response->mutable_param()->set_request_deadline(deadline.tv_sec); + } +} + +Status TestServiceImpl::Echo(ServerContext* context, const EchoRequest* request, + EchoResponse* response) { + // A bit of sleep to make sure that short deadline tests fail + if (request->has_param() && request->param().server_sleep_us() > 0) { + gpr_sleep_until( + gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_micros(request->param().server_sleep_us(), GPR_TIMESPAN))); + } + + if (request->has_param() && request->param().has_expected_error()) { + const auto& error = request->param().expected_error(); + return Status(static_cast(error.code()), error.error_message(), + error.binary_error_details()); + } + + if (request->has_param() && request->param().echo_metadata()) { + const std::multimap& client_metadata = + context->client_metadata(); + for (std::multimap::const_iterator iter = + client_metadata.begin(); + iter != client_metadata.end(); ++iter) { + context->AddTrailingMetadata(ToString(iter->first), ToString(iter->second)); + } + // Terminate rpc with error and debug info in trailer. + if (request->param().debug_info().stack_entries_size() || + !request->param().debug_info().detail().empty()) { + grpc::string serialized_debug_info = request->param().debug_info().SerializeAsString(); + context->AddTrailingMetadata(kDebugInfoTrailerKey, serialized_debug_info); + return Status::CANCELLED; + } + } + + response->set_message(request->message()); + MaybeEchoDeadline(context, request, response); + return Status::OK; +} + +Status TestServiceImpl::RequestStream(ServerContext* context, + grpc::ServerReader* reader, + EchoResponse* response) { + EchoRequest request; + response->set_message(""); + int num_msgs_read = 0; + while (reader->Read(&request)) { + response->mutable_message()->append(request.message()); + ++num_msgs_read; + } + return Status::OK; +} + +Status TestServiceImpl::ResponseStream(ServerContext* context, const EchoRequest* request, + grpc::ServerWriter* writer) { + EchoResponse response; + int server_responses_to_send = + GetIntValueFromMetadata(kServerResponseStreamsToSend, context->client_metadata(), + kServerDefaultResponseStreamsToSend); + for (int i = 0; i < server_responses_to_send; i++) { + response.set_message(request->message() + grpc::to_string(i)); + if (i == server_responses_to_send - 1) { + writer->WriteLast(response, grpc::WriteOptions()); + } else { + writer->Write(response); + } + } + return Status::OK; +} + +Status TestServiceImpl::BidiStream(ServerContext* context, + grpc::ServerReaderWriter* stream) { + EchoRequest request; + EchoResponse response; + + // kServerFinishAfterNReads suggests after how many reads, the server should + // write the last message and send status (coalesced using WriteLast) + int server_write_last = + GetIntValueFromMetadata(kServerFinishAfterNReads, context->client_metadata(), 0); + + int read_counts = 0; + while (stream->Read(&request)) { + read_counts++; + response.set_message(request.message()); + if (read_counts == server_write_last) { + stream->WriteLast(response, grpc::WriteOptions()); + } else { + stream->Write(response); + } + } + + return Status::OK; +} + +void DummyInterceptor::Intercept(grpc::experimental::InterceptorBatchMethods* methods) { + if (methods->QueryInterceptionHookPoint( + grpc::experimental::InterceptionHookPoints::PRE_SEND_INITIAL_METADATA)) { + num_times_run_++; + } else if (methods->QueryInterceptionHookPoint( + grpc::experimental::InterceptionHookPoints::POST_RECV_INITIAL_METADATA)) { + num_times_run_reverse_++; + } + methods->Proceed(); +} + +void DummyInterceptor::Reset() { + num_times_run_.store(0); + num_times_run_reverse_.store(0); +} + +int DummyInterceptor::GetNumTimesRun() { + NSCAssert(num_times_run_.load() == num_times_run_reverse_.load(), + @"Interceptor must run same number of times in both directions"); + return num_times_run_.load(); +} diff --git a/test/cpp/ios/Info.plist b/test/cpp/ios/Info.plist new file mode 100644 index 00000000000..fbeeb96ba6c --- /dev/null +++ b/test/cpp/ios/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + gRPC.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/test/cpp/ios/Podfile b/test/cpp/ios/Podfile new file mode 100644 index 00000000000..49044d2a050 --- /dev/null +++ b/test/cpp/ios/Podfile @@ -0,0 +1,102 @@ +source 'https://github.com/CocoaPods/Specs.git' + +install! 'cocoapods', :deterministic_uuids => false + +# Location of gRPC's repo root relative to this file. +GRPC_LOCAL_SRC = '../../..' + + +target 'CronetTests' do + platform :ios, '8.0' + pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf", :inhibit_warnings => true + + pod '!ProtoCompiler', :path => "#{GRPC_LOCAL_SRC}/src/objective-c" + pod '!ProtoCompiler-gRPCCppPlugin', :path => "#{GRPC_LOCAL_SRC}/src/objective-c" + pod 'Protobuf-C++', :podspec => "#{GRPC_LOCAL_SRC}/src/cpp", :inhibit_warnings => true + + pod 'BoringSSL-GRPC', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true + + pod 'gRPC-Core', :path => GRPC_LOCAL_SRC + pod 'gRPC-C++', :path => GRPC_LOCAL_SRC + pod 'gRPC-C++/Protobuf', :path => GRPC_LOCAL_SRC + pod 'RemoteTestCpp', :path => "RemoteTestClientCpp", :inhibit_warnings => true + + pod 'gRPC-Core/Cronet-Implementation', :path => GRPC_LOCAL_SRC + pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c" + pod 'gRPC-Core/Tests', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true +end + +# gRPC-Core.podspec needs to be modified to be successfully used for local development. A Podfile's +# pre_install hook lets us do that. The block passed to it runs after the podspecs are downloaded +# and before they are installed in the user project. +# +# This podspec searches for the gRPC core library headers under "$(PODS_ROOT)/gRPC-Core", where +# Cocoapods normally places the downloaded sources. When doing local development of the libraries, +# though, Cocoapods just takes the sources from whatever directory was specified using `:path`, and +# doesn't copy them under $(PODS_ROOT). When using static libraries, one can sometimes rely on the +# symbolic links to the pods headers that Cocoapods creates under "$(PODS_ROOT)/Headers". But those +# aren't created when using dynamic frameworks. So our solution is to modify the podspec on the fly +# to point at the local directory where the sources are. +# +# TODO(jcanizales): Send a PR to Cocoapods to get rid of this need. +pre_install do |installer| + # This is the gRPC-Core podspec object, as initialized by its podspec file. + grpc_core_spec = installer.pod_targets.find{|t| t.name.start_with?('gRPC-Core')}.root_spec + + # Copied from gRPC-Core.podspec, except for the adjusted src_root: + src_root = "$(PODS_ROOT)/../#{GRPC_LOCAL_SRC}" + grpc_core_spec.pod_target_xcconfig = { + 'GRPC_SRC_ROOT' => src_root, + 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', + 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"', + # If we don't set these two settings, `include/grpc/support/time.h` and + # `src/core/lib/gpr/string.h` shadow the system `` and ``, breaking the + # build. + 'USE_HEADERMAP' => 'NO', + 'ALWAYS_SEARCH_USER_PATHS' => 'NO', + } +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES' + end + + # CocoaPods creates duplicated library targets of gRPC-Core when the test targets include + # non-default subspecs of gRPC-Core. All of these library targets start with prefix 'gRPC-Core' + # and require the same error suppresion. + if target.name.start_with?('gRPC-Core') + target.build_configurations.each do |config| + # TODO(zyc): Remove this setting after the issue is resolved + # GPR_UNREACHABLE_CODE causes "Control may reach end of non-void + # function" warning + config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO' + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_CRONET_WITH_PACKET_COALESCING=1 GRPC_CFSTREAM=1' + end + end + + # Activate Cronet for the dedicated build configuration 'Cronet', which will be used solely by + # the test target 'InteropTestsRemoteWithCronet' + # Activate GRPCCall+InternalTests functions for the dedicated build configuration 'Test', which will + # be used by all test targets using it. + if /gRPC-(mac|i)OS/.match(target.name) + target.build_configurations.each do |config| + if config.name == 'Cronet' + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_COMPILE_WITH_CRONET=1 GRPC_TEST_OBJC=1' + elsif config.name == 'Test' + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_TEST_OBJC=1' + end + end + end + + # Enable NSAssert on gRPC + if /(gRPC|ProtoRPC|RxLibrary)-(mac|i)OS/.match(target.name) + target.build_configurations.each do |config| + if config.name != 'Release' + config.build_settings['ENABLE_NS_ASSERTIONS'] = 'YES' + end + end + end + end +end diff --git a/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec b/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec new file mode 100644 index 00000000000..0d51fdab31e --- /dev/null +++ b/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec @@ -0,0 +1,98 @@ +Pod::Spec.new do |s| + s.name = "RemoteTestCpp" + s.version = "0.0.1" + s.license = "Apache License, Version 2.0" + s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' } + s.homepage = "https://grpc.io/" + s.summary = "RemoteTest example" + s.source = { :git => 'https://github.com/grpc/grpc.git' } + + s.ios.deployment_target = '7.1' + s.osx.deployment_target = '10.9' + + # Run protoc with the C++ and gRPC plugins to generate protocol messages and gRPC clients. + s.dependency "!ProtoCompiler-gRPCCppPlugin" + s.dependency "Protobuf-C++" + s.dependency "gRPC-C++" + s.source_files = "src/proto/grpc/testing/*.pb.{h,cc}" + s.header_mappings_dir = "RemoteTestCpp" + s.requires_arc = false + + repo_root = '../../../..' + config = ENV['CONFIG'] || 'opt' + bin_dir = "#{repo_root}/bins/#{config}" + + protoc = "#{bin_dir}/protobuf/protoc" + well_known_types_dir = "#{repo_root}/third_party/protobuf/src" + plugin = "#{bin_dir}/grpc_cpp_plugin" + proto_dir = "#{repo_root}/src/proto/grpc/testing" + + s.prepare_command = <<-CMD + if [ -f #{protoc} ]; then + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{proto_dir} \ + -I #{well_known_types_dir} \ + #{proto_dir}/echo.proto + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{proto_dir} \ + -I #{well_known_types_dir} \ + #{proto_dir}/echo_messages.proto + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{proto_dir} \ + -I #{well_known_types_dir} \ + #{proto_dir}/simple_messages.proto + else + # protoc was not found bin_dir, use installed version instead + + if ! [ -x "$(command -v protoc)" ]; then + (>&2 echo "\nERROR: protoc not found") + exit 1 + fi + (>&2 echo "\nWARNING: Using installed version of protoc. It might be incompatible with gRPC") + + protoc \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{proto_dir} \ + -I #{well_known_types_dir} \ + #{proto_dir}/echo.proto + protoc \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{proto_dir} \ + -I #{well_known_types_dir} \ + #{proto_dir}/echo_messages.proto + protoc \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{proto_dir} \ + -I #{well_known_types_dir} \ + #{proto_dir}/simple_messages.proto + fi + CMD + + s.pod_target_xcconfig = { + # This is needed by all pods that depend on Protobuf: + 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO=1', + # This is needed by all pods that depend on gRPC-RxLibrary: + 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', + } +end diff --git a/test/cpp/ios/Tests.xcodeproj/project.pbxproj b/test/cpp/ios/Tests.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..865fc6636ff --- /dev/null +++ b/test/cpp/ios/Tests.xcodeproj/project.pbxproj @@ -0,0 +1,594 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + B02C351522E8E5FE00708B55 /* TestHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = B02C351322E8E5FE00708B55 /* TestHelper.mm */; }; + B0B151E622D7DFCA00C4BFE0 /* CppCronetEnd2EndTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = B0B151E522D7DFCA00C4BFE0 /* CppCronetEnd2EndTests.mm */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 00DA7762CD572056A66501B3 /* Pods-CronetTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.cronet.xcconfig"; sourceTree = ""; }; + 5E7F485922775B15006656AD /* CronetTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CronetTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 5E7F486622776AD8006656AD /* Cronet.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cronet.framework; path = Pods/CronetFramework/Cronet.framework; sourceTree = ""; }; + 635697D81B14FC11007A7283 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 7B0DE0EC5EB517A302CD4698 /* Pods-CronetTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.release.xcconfig"; sourceTree = ""; }; + B02C351322E8E5FE00708B55 /* TestHelper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TestHelper.mm; sourceTree = ""; }; + B02C351422E8E5FE00708B55 /* TestHelper.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = TestHelper.h; sourceTree = ""; }; + B0B151E522D7DFCA00C4BFE0 /* CppCronetEnd2EndTests.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = CppCronetEnd2EndTests.mm; sourceTree = ""; }; + CDB4E9D8890B97B6FAF35A4F /* Pods-CronetTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.debug.xcconfig"; sourceTree = ""; }; + ED8BB10304E81C38CAE911C2 /* Pods-CronetTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.test.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 5E7F485622775B15006656AD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 136D535E19727099B941D7B1 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 5E7F486622776AD8006656AD /* Cronet.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 51E4650F34F854F41FF053B3 /* Pods */ = { + isa = PBXGroup; + children = ( + CDB4E9D8890B97B6FAF35A4F /* Pods-CronetTests.debug.xcconfig */, + ED8BB10304E81C38CAE911C2 /* Pods-CronetTests.test.xcconfig */, + 00DA7762CD572056A66501B3 /* Pods-CronetTests.cronet.xcconfig */, + 7B0DE0EC5EB517A302CD4698 /* Pods-CronetTests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 5E7F485A22775B15006656AD /* CronetTests */ = { + isa = PBXGroup; + children = ( + B0B151E522D7DFCA00C4BFE0 /* CppCronetEnd2EndTests.mm */, + B02C351322E8E5FE00708B55 /* TestHelper.mm */, + B02C351422E8E5FE00708B55 /* TestHelper.h */, + ); + path = CronetTests; + sourceTree = ""; + }; + 635697BE1B14FC11007A7283 = { + isa = PBXGroup; + children = ( + 635697C91B14FC11007A7283 /* Tests */, + 5E7F485A22775B15006656AD /* CronetTests */, + 635697C81B14FC11007A7283 /* Products */, + 51E4650F34F854F41FF053B3 /* Pods */, + 136D535E19727099B941D7B1 /* Frameworks */, + ); + sourceTree = ""; + }; + 635697C81B14FC11007A7283 /* Products */ = { + isa = PBXGroup; + children = ( + 5E7F485922775B15006656AD /* CronetTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 635697C91B14FC11007A7283 /* Tests */ = { + isa = PBXGroup; + children = ( + 635697D71B14FC11007A7283 /* Supporting Files */, + ); + name = Tests; + sourceTree = SOURCE_ROOT; + }; + 635697D71B14FC11007A7283 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 635697D81B14FC11007A7283 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 5E7F485822775B15006656AD /* CronetTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5E7F485E22775B15006656AD /* Build configuration list for PBXNativeTarget "CronetTests" */; + buildPhases = ( + CCAEC0F23E05489651A07D53 /* [CP] Check Pods Manifest.lock */, + 5E7F485522775B15006656AD /* Sources */, + 5E7F485622775B15006656AD /* Frameworks */, + 5E7F485722775B15006656AD /* Resources */, + 292EA42A76AC7933A37235FD /* [CP] Embed Pods Frameworks */, + 30AFD6F6FC40B9923632A866 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CronetTests; + productName = CronetTests; + productReference = 5E7F485922775B15006656AD /* CronetTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 635697BF1B14FC11007A7283 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0630; + ORGANIZATIONNAME = gRPC; + TargetAttributes = { + 5E7F485822775B15006656AD = { + CreatedOnToolsVersion = 10.1; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 635697C21B14FC11007A7283 /* Build configuration list for PBXProject "Tests" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + English, + en, + ); + mainGroup = 635697BE1B14FC11007A7283; + productRefGroup = 635697C81B14FC11007A7283 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 5E7F485822775B15006656AD /* CronetTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 5E7F485722775B15006656AD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 292EA42A76AC7933A37235FD /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests-frameworks.sh", + "${PODS_ROOT}/CronetFramework/Cronet.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 30AFD6F6FC40B9923632A866 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-C++/gRPCCertificates-Cpp.bundle", + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates-Cpp.bundle", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + CCAEC0F23E05489651A07D53 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-CronetTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 5E7F485522775B15006656AD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B0B151E622D7DFCA00C4BFE0 /* CppCronetEnd2EndTests.mm in Sources */, + B02C351522E8E5FE00708B55 /* TestHelper.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 5E1228981E4D400F00E8504F /* Test */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + "GRPC_TEST_OBJC=1", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Test; + }; + 5E7F485F22775B15006656AD /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CDB4E9D8890B97B6FAF35A4F /* Pods-CronetTests.debug.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Pods/CronetFramework", + ); + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.CronetTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ../../..; + }; + name = Debug; + }; + 5E7F486022775B15006656AD /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = ED8BB10304E81C38CAE911C2 /* Pods-CronetTests.test.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Pods/CronetFramework", + ); + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.CronetTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ../../..; + }; + name = Test; + }; + 5E7F486122775B15006656AD /* Cronet */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 00DA7762CD572056A66501B3 /* Pods-CronetTests.cronet.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Pods/CronetFramework", + ); + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.CronetTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ../../..; + }; + name = Cronet; + }; + 5E7F486222775B15006656AD /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7B0DE0EC5EB517A302CD4698 /* Pods-CronetTests.release.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Pods/CronetFramework", + ); + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.CronetTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ../../..; + }; + name = Release; + }; + 5EC3C7A01D4FC18C000330E2 /* Cronet */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + "GRPC_TEST_OBJC=1", + "GRPC_COMPILE_WITH_CRONET=1", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Cronet; + }; + 635697D91B14FC11007A7283 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 635697DA1B14FC11007A7283 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 5E7F485E22775B15006656AD /* Build configuration list for PBXNativeTarget "CronetTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5E7F485F22775B15006656AD /* Debug */, + 5E7F486022775B15006656AD /* Test */, + 5E7F486122775B15006656AD /* Cronet */, + 5E7F486222775B15006656AD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 635697C21B14FC11007A7283 /* Build configuration list for PBXProject "Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 635697D91B14FC11007A7283 /* Debug */, + 5E1228981E4D400F00E8504F /* Test */, + 5EC3C7A01D4FC18C000330E2 /* Cronet */, + 635697DA1B14FC11007A7283 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 635697BF1B14FC11007A7283 /* Project object */; +} diff --git a/test/cpp/ios/Tests.xcodeproj/xcshareddata/xcschemes/CronetTests.xcscheme b/test/cpp/ios/Tests.xcodeproj/xcshareddata/xcschemes/CronetTests.xcscheme new file mode 100644 index 00000000000..0156c906971 --- /dev/null +++ b/test/cpp/ios/Tests.xcodeproj/xcshareddata/xcschemes/CronetTests.xcscheme @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/cpp/ios/build_tests.sh b/test/cpp/ios/build_tests.sh new file mode 100755 index 00000000000..ead0159dcc9 --- /dev/null +++ b/test/cpp/ios/build_tests.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Don't run this script standalone. Instead, run from the repository root: +# ./tools/run_tests/run_tests.py -l objc + +set -e + +# CocoaPods requires the terminal to be using UTF-8 encoding. +export LANG=en_US.UTF-8 + +cd "$(dirname "$0")" + +hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; } +hash xcodebuild 2>/dev/null || { + echo >&2 "XCode command-line tools need to be installed." + exit 1 +} + +# clean the directory +rm -rf Pods +rm -rf Tests.xcworkspace +rm -f Podfile.lock +rm -rf RemoteTestClientCpp/src + +echo "TIME: $(date)" +pod install + diff --git a/test/cpp/ios/run_tests.sh b/test/cpp/ios/run_tests.sh new file mode 100755 index 00000000000..9eee0cd28ca --- /dev/null +++ b/test/cpp/ios/run_tests.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Don't run this script standalone. Instead, run from the repository root: +# ./tools/run_tests/run_tests.py -l c++ + +set -ev + +cd "$(dirname "$0")" + + +set -o pipefail + +XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' + +xcodebuild \ + -workspace Tests.xcworkspace \ + -scheme CronetTests \ + -destination name="iPhone 8" \ + test \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v '^$' - diff --git a/tools/internal_ci/macos/grpc_basictests_cpp_ios.cfg b/tools/internal_ci/macos/grpc_basictests_cpp_ios.cfg new file mode 100644 index 00000000000..3c8e402d3fc --- /dev/null +++ b/tools/internal_ci/macos/grpc_basictests_cpp_ios.cfg @@ -0,0 +1,31 @@ +# Copyright 2019 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/macos/grpc_run_tests_matrix.sh" +gfile_resources: "/bigstore/grpc-testing-secrets/gcp_credentials/GrpcTesting-d0eeee2db331.json" +timeout_mins: 120 +action { + define_artifacts { + regex: "**/*sponge_log.*" + regex: "github/grpc/reports/**" + } +} + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-f basictests macos objc opt --internal_ci -j 1 --inner_jobs 4 --bq_result_table aggregate_results --extra_args -r ios-cpp-test-.*" +} diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index f11927bd5d6..082ca6dd64e 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1130,6 +1130,13 @@ class ObjCLanguage(object): environ={ 'SCHEME': 'CronetTests' })) + out.append( + self.config.job_spec( + ['test/cpp/ios/run_tests.sh'], + timeout_seconds=20 * 60, + shortname='ios-cpp-test-cronet', + cpu_cost=1e6, + environ=_FORCE_ENVIRON_FOR_WRAPPERS)) out.append( self.config.job_spec( ['src/objective-c/tests/run_one_test.sh'], @@ -1156,6 +1163,7 @@ class ObjCLanguage(object): return [ ['src/objective-c/tests/build_tests.sh'], ['test/core/iomgr/ios/CFStreamTests/build_tests.sh'], + ['test/cpp/ios/build_tests.sh'], ] def post_tests_steps(self): From 8318e578db62a999b8c03d6a47c12fe4c1d9e92d Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Mon, 29 Jul 2019 10:52:32 -0700 Subject: [PATCH 118/661] SpikyLoad: construct outside --- test/cpp/microbenchmarks/bm_threadpool.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/microbenchmarks/bm_threadpool.cc b/test/cpp/microbenchmarks/bm_threadpool.cc index d3d25074460..55c8772e5b5 100644 --- a/test/cpp/microbenchmarks/bm_threadpool.cc +++ b/test/cpp/microbenchmarks/bm_threadpool.cc @@ -291,8 +291,8 @@ static void BM_SpikyLoad(benchmark::State& state) { const int kNumSpikes = 1000; const int batch_size = 3 * num_threads; std::vector work_vector(batch_size); + grpc_core::ThreadPool pool(num_threads); while (state.KeepRunningBatch(kNumSpikes * batch_size)) { - grpc_core::ThreadPool pool(num_threads); for (int i = 0; i != kNumSpikes; ++i) { BlockingCounter counter(batch_size); for (auto& w : work_vector) { From 6b24df29454cb9048d48f86dcb91a036da199da2 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Mon, 29 Jul 2019 10:41:55 -0700 Subject: [PATCH 119/661] Refined edge case checks + added comments --- src/compiler/objective_c_generator_helpers.h | 3 --- src/compiler/objective_c_plugin.cc | 6 +++++- src/objective-c/examples/InterceptorSample/Podfile | 3 +++ .../examples/RemoteTestClient/RemoteTest.podspec | 5 ++++- src/objective-c/examples/Sample/Podfile | 3 +++ 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/compiler/objective_c_generator_helpers.h b/src/compiler/objective_c_generator_helpers.h index d686014faa5..0ed27738c2e 100644 --- a/src/compiler/objective_c_generator_helpers.h +++ b/src/compiler/objective_c_generator_helpers.h @@ -19,9 +19,6 @@ #ifndef GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H #define GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H -#include -using namespace std; - #include #include "src/compiler/config.h" #include "src/compiler/generator_helpers.h" diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index feebe12797e..f398033f6db 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -88,7 +88,11 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { std::vector<::grpc::string> param = grpc_generator::tokenize(*param_str, "="); if (param[0] == "generate_for_named_framework") { - if (param[1].empty()) { + if (param.size() != 2) { + *error = + grpc::string("Format: generate_for_named_framework="); + return false; + } else if (param[1].empty()) { *error = grpc::string( "Name of framework cannot be empty for parameter: ") + param[0]; diff --git a/src/objective-c/examples/InterceptorSample/Podfile b/src/objective-c/examples/InterceptorSample/Podfile index 6df6c962148..0252451eff9 100644 --- a/src/objective-c/examples/InterceptorSample/Podfile +++ b/src/objective-c/examples/InterceptorSample/Podfile @@ -2,6 +2,9 @@ platform :ios, '8.0' install! 'cocoapods', :deterministic_uuids => false +# Default to use framework, so that providing no 'FRAMEWORK' env parameter works consistently +# for all Samples, specifically because Swift only supports framework. +# Only effective for examples/ use_frameworks! if ENV['FRAMEWORKS'] != 'NO' ROOT_DIR = '../../../..' diff --git a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec index 747df63ac5b..93ba46fcb6d 100644 --- a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec @@ -19,10 +19,13 @@ Pod::Spec.new do |s| protoc = "#{bin_dir}/protobuf/protoc" well_known_types_dir = "#{repo_root}/third_party/protobuf/src" plugin = "#{bin_dir}/grpc_objective_c_plugin" - + + # Since we switched to importing full path, -I needs to be set to the directory + # from which the imported file can be found, which is the grpc's root here if ENV['FRAMEWORKS'] != 'NO' then s.user_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'USE_FRAMEWORKS=1' } s.prepare_command = <<-CMD + # Cannot find file if using *.proto. Maybe files' paths must match the -I flags #{protoc} \ --plugin=protoc-gen-grpc=#{plugin} \ --objc_out=. \ diff --git a/src/objective-c/examples/Sample/Podfile b/src/objective-c/examples/Sample/Podfile index 741a199602e..e7ee700cb17 100644 --- a/src/objective-c/examples/Sample/Podfile +++ b/src/objective-c/examples/Sample/Podfile @@ -3,6 +3,9 @@ platform :ios, '8.0' install! 'cocoapods', :deterministic_uuids => false +# Default to use framework, so that providing no 'FRAMEWORK' env parameter works consistently +# for all Samples, specifically because Swift only supports framework. +# Only effective for examples/ use_frameworks! if ENV['FRAMEWORKS'] != 'NO' # Location of gRPC's repo root relative to this file. From b02ac1be1d1416cae0cbe8968939d2b441b230d4 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Mon, 29 Jul 2019 14:44:37 -0700 Subject: [PATCH 120/661] Avoid copybara import error --- src/proto/gen_build_yaml.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/proto/gen_build_yaml.py b/src/proto/gen_build_yaml.py index 1a935b56d89..fc1b5f7986e 100755 --- a/src/proto/gen_build_yaml.py +++ b/src/proto/gen_build_yaml.py @@ -15,6 +15,7 @@ """Generates the appropriate build.json data for all the proto files.""" +from __future__ import print_function import yaml import collections import os @@ -36,6 +37,10 @@ def update_deps(key, proto_filename, deps, deps_external, is_trans, visited): deps_external[key] = [] deps_external[key].append(imp_proto[:-6]) continue + # In case that the path is changed by copybara, + # revert the change to avoid file error. + if imp_proto.startswith('third_party/grpc'): + imp_proto = imp_proto[17:] if key not in deps: deps[key] = [] deps[key].append(imp_proto[:-6]) if is_trans: @@ -66,7 +71,7 @@ def main(): 'proto_transitive_external_deps': deps_external_trans } - print yaml.dump(json) + print(yaml.dump(json)) if __name__ == '__main__': main() From 65b28a29b23d40ffbe6c8eb7655d5265edabc8ee Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Thu, 9 May 2019 10:50:57 -0400 Subject: [PATCH 121/661] Initialize compression state only if they are used. Add a lazy initialization path, so that we do not have to initialize/access the state that's only used when we compress. Move the frequently access fields to the front so we are more cache friendly. --- .../message_compress_filter.cc | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.cc b/src/core/ext/filters/http/message_compress/message_compress_filter.cc index 3ce79b305df..0e0be6e9cff 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.cc +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.cc @@ -72,29 +72,31 @@ struct call_data { GRPC_CLOSURE_INIT(&start_send_message_batch_in_call_combiner, start_send_message_batch, elem, grpc_schedule_on_exec_ctx); - grpc_slice_buffer_init(&slices); - GRPC_CLOSURE_INIT(&send_message_on_complete, ::send_message_on_complete, - elem, grpc_schedule_on_exec_ctx); - GRPC_CLOSURE_INIT(&on_send_message_next_done, ::on_send_message_next_done, - elem, grpc_schedule_on_exec_ctx); } ~call_data() { - grpc_slice_buffer_destroy_internal(&slices); + if (state_initialized) { + grpc_slice_buffer_destroy_internal(&slices); + } GRPC_ERROR_UNREF(cancel_error); } grpc_core::CallCombiner* call_combiner; - grpc_linked_mdelem message_compression_algorithm_storage; - grpc_linked_mdelem stream_compression_algorithm_storage; - grpc_linked_mdelem accept_encoding_storage; - grpc_linked_mdelem accept_stream_encoding_storage; grpc_message_compression_algorithm message_compression_algorithm = GRPC_MESSAGE_COMPRESS_NONE; - bool seen_initial_metadata = false; grpc_error* cancel_error = GRPC_ERROR_NONE; - grpc_closure start_send_message_batch_in_call_combiner; grpc_transport_stream_op_batch* send_message_batch = nullptr; + bool seen_initial_metadata = false; + /* Set to true, if the fields below are initialized. */ + bool state_initialized = false; + grpc_closure start_send_message_batch_in_call_combiner; + /* The fields below are only initialized when we compress the payload. + * Keep them at the bottom of the struct, so they don't pollute the + * cache-lines. */ + grpc_linked_mdelem message_compression_algorithm_storage; + grpc_linked_mdelem stream_compression_algorithm_storage; + grpc_linked_mdelem accept_encoding_storage; + grpc_linked_mdelem accept_stream_encoding_storage; grpc_slice_buffer slices; /**< Buffers up input slices to be compressed */ grpc_core::ManualConstructor replacement_stream; @@ -157,6 +159,18 @@ static grpc_compression_algorithm find_compression_algorithm( return GRPC_COMPRESS_NONE; } +static void initialize_state(grpc_call_element* elem, call_data* calld) { + GPR_DEBUG_ASSERT(!calld->state_initialized); + calld->state_initialized = true; + grpc_slice_buffer_init(&calld->slices); + GRPC_CLOSURE_INIT(&calld->send_message_on_complete, + ::send_message_on_complete, elem, + grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&calld->on_send_message_next_done, + ::on_send_message_next_done, elem, + grpc_schedule_on_exec_ctx); +} + static grpc_error* process_send_initial_metadata( grpc_call_element* elem, grpc_metadata_batch* initial_metadata) GRPC_MUST_USE_RESULT; @@ -177,11 +191,13 @@ static grpc_error* process_send_initial_metadata( // Hint compression algorithm. grpc_error* error = GRPC_ERROR_NONE; if (calld->message_compression_algorithm != GRPC_MESSAGE_COMPRESS_NONE) { + initialize_state(elem, calld); error = grpc_metadata_batch_add_tail( initial_metadata, &calld->message_compression_algorithm_storage, grpc_message_compression_encoding_mdelem( calld->message_compression_algorithm)); } else if (stream_compression_algorithm != GRPC_STREAM_COMPRESS_NONE) { + initialize_state(elem, calld); error = grpc_metadata_batch_add_tail( initial_metadata, &calld->stream_compression_algorithm_storage, grpc_stream_compression_encoding_mdelem(stream_compression_algorithm)); @@ -225,6 +241,8 @@ static void send_message_batch_continue(grpc_call_element* elem) { static void finish_send_message(grpc_call_element* elem) { call_data* calld = static_cast(elem->call_data); + GPR_DEBUG_ASSERT(calld->message_compression_algorithm != + GRPC_MESSAGE_COMPRESS_NONE); // Compress the data if appropriate. grpc_slice_buffer tmp; grpc_slice_buffer_init(&tmp); From d88ee54854a2f5d6f53578fe724a6d90b462b178 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Mon, 29 Jul 2019 16:23:11 -0700 Subject: [PATCH 122/661] Added missing dependency to channelz_proto_descriptors --- src/proto/grpc/channelz/BUILD | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/proto/grpc/channelz/BUILD b/src/proto/grpc/channelz/BUILD index 1d80ec23af1..cfc8531de1b 100644 --- a/src/proto/grpc/channelz/BUILD +++ b/src/proto/grpc/channelz/BUILD @@ -28,6 +28,12 @@ grpc_proto_library( proto_library( name = "channelz_proto_descriptors", srcs = ["channelz.proto"], + deps = [ + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:timestamp_proto", + "@com_google_protobuf//:wrappers_proto", + ], ) filegroup( From 96742f41ff19d2aa36adfa37bdff26f89041ccb4 Mon Sep 17 00:00:00 2001 From: Ryo Murakami Date: Tue, 30 Jul 2019 08:04:02 +0900 Subject: [PATCH 123/661] update Scripting Runtime Version empty commit empty commit --- src/csharp/experimental/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csharp/experimental/README.md b/src/csharp/experimental/README.md index b5c106e320c..cfa9c4b0324 100644 --- a/src/csharp/experimental/README.md +++ b/src/csharp/experimental/README.md @@ -23,7 +23,7 @@ Unity and provide feedback! How to test gRPC in a Unity project -1. Create a Unity project that targets .NET 4.x (Edit -> Project Settings -> Editor -> Scripting Runtime Version). gRPC uses APIs that are only available in .NET4.5+ so this is a requirement. +1. Create a Unity project that targets .NET 4.x Equivalent (Edit -> Project Settings -> Player -> Configuration -> Scripting Runtime Version). gRPC uses APIs that are only available in .NET4.5+ so this is a requirement. 2. Download the latest development build of `grpc_unity_package.VERSION.zip` from [daily builds](https://packages.grpc.io/) From d38178a27db894afe46baf23e188682117ff8434 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 30 Jul 2019 02:52:24 +0200 Subject: [PATCH 124/661] Few fixes to the gen_upb_api.sh script. --- tools/codegen/core/gen_upb_api.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/codegen/core/gen_upb_api.sh b/tools/codegen/core/gen_upb_api.sh index d7871d88671..3b8e072d9f3 100755 --- a/tools/codegen/core/gen_upb_api.sh +++ b/tools/codegen/core/gen_upb_api.sh @@ -14,24 +14,26 @@ # See the License for the specific language governing permissions and # limitations under the License. -# REQUIRES: Bazel set -ex +cd $(dirname $0)/../../.. +bazel=`pwd`/tools/bazel + if [ $# -eq 0 ]; then UPB_OUTPUT_DIR=$PWD/src/core/ext/upb-generated rm -rf $UPB_OUTPUT_DIR - mkdir $UPB_OUTPUT_DIR + mkdir -p $UPB_OUTPUT_DIR else UPB_OUTPUT_DIR=$1 fi pushd third_party/protobuf -bazel build :protoc +$bazel build :protoc PROTOC=$PWD/bazel-bin/protoc popd pushd third_party/upb -bazel build :protoc-gen-upb +$bazel build :protoc-gen-upb UPB_PLUGIN=$PWD/bazel-bin/protoc-gen-upb popd From 20f1ea44b0d2d11f85cd36a5f50e956d152a1b65 Mon Sep 17 00:00:00 2001 From: Dalei Li Date: Tue, 30 Jul 2019 10:51:57 +0200 Subject: [PATCH 125/661] update grpc and protobuf compatibility table The compatible protobuf version in newer grpc releases has to be manually inspected. This PR updates it. --- src/php/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/php/README.md b/src/php/README.md index dde6152cfce..0b8727ca864 100644 --- a/src/php/README.md +++ b/src/php/README.md @@ -174,6 +174,16 @@ v1.4.0 | 3.3.0 v1.6.0 | 3.4.0 v1.8.0 | 3.5.0 v1.12.0 | 3.5.2 +v1.13.1 | 3.5.2 +v1.14.2 | 3.5.2 +v1.15.1 | 3.6.1 +v1.16.1 | 3.6.1 +v1.17.2 | 3.6.1 +v1.18.0 | 3.6.1 +v1.19.1 | 3.6.1 +v1.20.1 | 3.7.0 +v1.21.3 | 3.7.0 +v1.22.0 | 3.8.0 If `protoc` hasn't been installed, you can download the `protoc` binaries from [the protocol buffers Github repository](https://github.com/google/protobuf/releases). From f0b53e1f1bb59a26efc1da4ba98b52232a9ee6de Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 30 Jul 2019 10:33:34 -0700 Subject: [PATCH 126/661] set C# major version to 2, adjust expand_version.py --- build.yaml | 1 + .../Grpc.Core.Api/VersionInfo.cs.template | 4 ++-- tools/buildgen/plugins/expand_version.py | 24 +++++++++++-------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/build.yaml b/build.yaml index e6d9ccac886..999c761056f 100644 --- a/build.yaml +++ b/build.yaml @@ -13,6 +13,7 @@ settings: '#09': Per-language overrides are possible with (eg) ruby_version tag here '#10': See the expand_version.py for all the quirks here core_version: 7.0.0 + csharp_major_version: 2 g_stands_for: gangnam version: 1.23.0-dev filegroups: diff --git a/templates/src/csharp/Grpc.Core.Api/VersionInfo.cs.template b/templates/src/csharp/Grpc.Core.Api/VersionInfo.cs.template index e94f8c296b6..a9b59a227fe 100644 --- a/templates/src/csharp/Grpc.Core.Api/VersionInfo.cs.template +++ b/templates/src/csharp/Grpc.Core.Api/VersionInfo.cs.template @@ -30,12 +30,12 @@ /// /// Current AssemblyVersion attribute of gRPC C# assemblies /// - public const string CurrentAssemblyVersion = "1.0.0.0"; + public const string CurrentAssemblyVersion = "${settings.csharp_version.major}.0.0.0"; /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "${settings.version.major}.${settings.version.minor}.${settings.version.patch}.0"; + public const string CurrentAssemblyFileVersion = "${settings.csharp_version.major}.${settings.csharp_version.minor}.${settings.csharp_version.patch}.0"; /// /// Current version of gRPC C# diff --git a/tools/buildgen/plugins/expand_version.py b/tools/buildgen/plugins/expand_version.py index a73446940da..02615f841fe 100755 --- a/tools/buildgen/plugins/expand_version.py +++ b/tools/buildgen/plugins/expand_version.py @@ -34,18 +34,20 @@ LANGUAGES = [ class Version: - def __init__(self, s): + def __init__(self, version_str, override_major=None): self.tag = None - if '-' in s: - s, self.tag = s.split('-') - self.major, self.minor, self.patch = [int(x) for x in s.split('.')] + if '-' in version_str: + version_str, self.tag = version_str.split('-') + self.major, self.minor, self.patch = [int(x) for x in version_str.split('.')] + if override_major: + self.major = override_major def __str__(self): """Version string in a somewhat idiomatic style for most languages""" - s = '%d.%d.%d' % (self.major, self.minor, self.patch) + version_str = '%d.%d.%d' % (self.major, self.minor, self.patch) if self.tag: - s += '-%s' % self.tag - return s + version_str += '-%s' % self.tag + return version_str def pep440(self): """Version string in Python PEP440 style""" @@ -105,11 +107,13 @@ def mako_plugin(dictionary): """ settings = dictionary['settings'] - master_version = Version(settings['version']) + version_str = settings['version'] + master_version = Version(version_str) settings['version'] = master_version for language in LANGUAGES: version_tag = '%s_version' % language + override_major = settings.get('%s_major_version' % language, None) if version_tag in settings: - settings[version_tag] = Version(settings[version_tag]) + settings[version_tag] = Version(settings[version_tag], override_major=override_major) else: - settings[version_tag] = master_version + settings[version_tag] = Version(version_str, override_major=override_major) From 2b0ff8619cb1cdd1def687c4e3713caa5480b52d Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 30 Jul 2019 10:35:19 -0700 Subject: [PATCH 127/661] regenerate projects --- Makefile | 10 +++++----- src/csharp/Grpc.Core.Api/VersionInfo.cs | 6 +++--- src/csharp/build/dependencies.props | 2 +- src/csharp/build_unitypackage.bat | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 5457f698a64..0107f145204 100644 --- a/Makefile +++ b/Makefile @@ -462,7 +462,7 @@ endif CORE_VERSION = 7.0.0 CPP_VERSION = 1.23.0-dev -CSHARP_VERSION = 1.23.0-dev +CSHARP_VERSION = 2.23.0-dev CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) @@ -512,7 +512,7 @@ SHARED_EXT_CSHARP = dll SHARED_PREFIX = SHARED_VERSION_CORE = -7 SHARED_VERSION_CPP = -1 -SHARED_VERSION_CSHARP = -1 +SHARED_VERSION_CSHARP = -2 else ifeq ($(SYSTEM),Darwin) EXECUTABLE_SUFFIX = SHARED_EXT_CORE = dylib @@ -3200,7 +3200,7 @@ install-shared_csharp: shared_csharp strip-shared_csharp ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP)-dll.a $(prefix)/lib/libgrpc_csharp_ext.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so.1 + $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so endif ifneq ($(SYSTEM),MINGW32) @@ -7502,8 +7502,8 @@ $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHA ifeq ($(SYSTEM),Darwin) $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.1 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) - $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so.1 + $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so endif endif diff --git a/src/csharp/Grpc.Core.Api/VersionInfo.cs b/src/csharp/Grpc.Core.Api/VersionInfo.cs index 6469aeb3f4b..d84da7c9e2f 100644 --- a/src/csharp/Grpc.Core.Api/VersionInfo.cs +++ b/src/csharp/Grpc.Core.Api/VersionInfo.cs @@ -28,16 +28,16 @@ namespace Grpc.Core /// /// Current AssemblyVersion attribute of gRPC C# assemblies /// - public const string CurrentAssemblyVersion = "1.0.0.0"; + public const string CurrentAssemblyVersion = "2.0.0.0"; /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "1.23.0.0"; + public const string CurrentAssemblyFileVersion = "2.23.0.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.23.0-dev"; + public const string CurrentVersion = "2.23.0-dev"; } } diff --git a/src/csharp/build/dependencies.props b/src/csharp/build/dependencies.props index a91b5e19414..4f100873bc7 100644 --- a/src/csharp/build/dependencies.props +++ b/src/csharp/build/dependencies.props @@ -1,7 +1,7 @@ - 1.23.0-dev + 2.23.0-dev 3.8.0 diff --git a/src/csharp/build_unitypackage.bat b/src/csharp/build_unitypackage.bat index 06552e8464b..a40eddddf2e 100644 --- a/src/csharp/build_unitypackage.bat +++ b/src/csharp/build_unitypackage.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.23.0-dev +set VERSION=2.23.0-dev @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe From 47a14ba3948d53993ad2120077e60efb703da43a Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 22 Jul 2019 13:34:50 +0200 Subject: [PATCH 128/661] move ChannelCredentials to Grpc.Core.Api --- src/csharp/Grpc.Core.Api/CallCredentials.cs | 4 +- .../ChannelCredentials.cs | 128 +++++------------ .../ChannelCredentialsConfiguratorBase.cs | 44 ++++++ .../KeyCertificatePair.cs | 0 .../VerifyPeerContext.cs | 0 .../Grpc.Core.Tests/ChannelCredentialsTest.cs | 14 +- src/csharp/Grpc.Core.Tests/FakeCredentials.cs | 4 +- src/csharp/Grpc.Core/Channel.cs | 2 +- src/csharp/Grpc.Core/ForwardedTypes.cs | 4 + .../DefaultChannelCredentialsConfigurator.cs | 130 ++++++++++++++++++ 10 files changed, 227 insertions(+), 103 deletions(-) rename src/csharp/{Grpc.Core => Grpc.Core.Api}/ChannelCredentials.cs (64%) create mode 100644 src/csharp/Grpc.Core.Api/ChannelCredentialsConfiguratorBase.cs rename src/csharp/{Grpc.Core => Grpc.Core.Api}/KeyCertificatePair.cs (100%) rename src/csharp/{Grpc.Core => Grpc.Core.Api}/VerifyPeerContext.cs (100%) create mode 100644 src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs diff --git a/src/csharp/Grpc.Core.Api/CallCredentials.cs b/src/csharp/Grpc.Core.Api/CallCredentials.cs index 6344a881070..3b150a211c2 100644 --- a/src/csharp/Grpc.Core.Api/CallCredentials.cs +++ b/src/csharp/Grpc.Core.Api/CallCredentials.cs @@ -51,8 +51,8 @@ namespace Grpc.Core } /// - /// Populates this call credential instances. - /// You never need to invoke this, part of internal implementation. + /// Populates call credentials configurator with this instance's configuration. + /// End users never need to invoke this method as it is part of internal implementation. /// public abstract void InternalPopulateConfiguration(CallCredentialsConfiguratorBase configurator, object state); diff --git a/src/csharp/Grpc.Core/ChannelCredentials.cs b/src/csharp/Grpc.Core.Api/ChannelCredentials.cs similarity index 64% rename from src/csharp/Grpc.Core/ChannelCredentials.cs rename to src/csharp/Grpc.Core.Api/ChannelCredentials.cs index dcbe9f3599b..10020a3d8d4 100644 --- a/src/csharp/Grpc.Core/ChannelCredentials.cs +++ b/src/csharp/Grpc.Core.Api/ChannelCredentials.cs @@ -18,11 +18,9 @@ using System; using System.Collections.Generic; -using System.Runtime.InteropServices; using System.Threading.Tasks; using Grpc.Core.Internal; -using Grpc.Core.Logging; using Grpc.Core.Utils; namespace Grpc.Core @@ -33,7 +31,9 @@ namespace Grpc.Core public abstract class ChannelCredentials { static readonly ChannelCredentials InsecureInstance = new InsecureCredentialsImpl(); - readonly Lazy cachedNativeCredentials; + + // TODO: caching the instance!!!! + //readonly Lazy cachedNativeCredentials; /// /// Creates a new instance of channel credentials @@ -44,7 +44,7 @@ namespace Grpc.Core // with secure connections. See https://github.com/grpc/grpc/issues/15207. // We rely on finalizer to clean up the native portion of ChannelCredentialsSafeHandle after the ChannelCredentials // instance becomes unused. - this.cachedNativeCredentials = new Lazy(() => CreateNativeCredentials()); + //this.cachedNativeCredentials = new Lazy(() => CreateNativeCredentials()); } /// @@ -72,36 +72,39 @@ namespace Grpc.Core } /// - /// Gets native object for the credentials, creating one if it already doesn't exist. May return null if insecure channel - /// should be created. Caller must not call Dispose() on the returned native credentials as their lifetime - /// is managed by this class (and instances of native credentials are cached). + /// Populates channel credentials configurator with this instance's configuration. + /// End users never need to invoke this method as it is part of internal implementation. /// - /// The native credentials. - internal ChannelCredentialsSafeHandle GetNativeCredentials() - { - return cachedNativeCredentials.Value; - } - - /// - /// Creates a new native object for the credentials. May return null if insecure channel - /// should be created. For internal use only, use instead. - /// - /// The native credentials. - internal abstract ChannelCredentialsSafeHandle CreateNativeCredentials(); + public abstract void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state); + + // / + // / Gets native object for the credentials, creating one if it already doesn't exist. May return null if insecure channel + // / should be created. Caller must not call Dispose() on the returned native credentials as their lifetime + // / is managed by this class (and instances of native credentials are cached). + // / + // / The native credentials. + //internal ChannelCredentialsSafeHandle GetNativeCredentials() + //{ + // return cachedNativeCredentials.Value; + //} + + // / + // / Creates a new native object for the credentials. May return null if insecure channel + // / should be created. For internal use only, use instead. + // / + // / The native credentials. + //internal abstract ChannelCredentialsSafeHandle CreateNativeCredentials(); /// /// Returns true if this credential type allows being composed by CompositeCredentials. /// - internal virtual bool IsComposable - { - get { return false; } - } + internal virtual bool IsComposable => false; private sealed class InsecureCredentialsImpl : ChannelCredentials { - internal override ChannelCredentialsSafeHandle CreateNativeCredentials() + public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) { - return null; + configurator.SetInsecureCredentials(state); } } } @@ -126,8 +129,6 @@ namespace Grpc.Core /// public sealed class SslCredentials : ChannelCredentials { - static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); - readonly string rootCertificates; readonly KeyCertificatePair keyCertificatePair; readonly VerifyPeerCallback verifyPeerCallback; @@ -196,63 +197,16 @@ namespace Grpc.Core } } - // Composing composite makes no sense. - internal override bool IsComposable - { - get { return true; } - } - - internal override ChannelCredentialsSafeHandle CreateNativeCredentials() + /// + /// Populates channel credentials configurator with this instance's configuration. + /// End users never need to invoke this method as it is part of internal implementation. + /// + public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) { - IntPtr verifyPeerCallbackTag = IntPtr.Zero; - if (verifyPeerCallback != null) - { - verifyPeerCallbackTag = new VerifyPeerCallbackRegistration(verifyPeerCallback).CallbackRegistration.Tag; - } - return ChannelCredentialsSafeHandle.CreateSslCredentials(rootCertificates, keyCertificatePair, verifyPeerCallbackTag); + configurator.SetSslCredentials(state, rootCertificates, keyCertificatePair, verifyPeerCallback); } - private class VerifyPeerCallbackRegistration - { - readonly VerifyPeerCallback verifyPeerCallback; - readonly NativeCallbackRegistration callbackRegistration; - - public VerifyPeerCallbackRegistration(VerifyPeerCallback verifyPeerCallback) - { - this.verifyPeerCallback = verifyPeerCallback; - this.callbackRegistration = NativeCallbackDispatcher.RegisterCallback(HandleUniversalCallback); - } - - public NativeCallbackRegistration CallbackRegistration => callbackRegistration; - - private int HandleUniversalCallback(IntPtr arg0, IntPtr arg1, IntPtr arg2, IntPtr arg3, IntPtr arg4, IntPtr arg5) - { - return VerifyPeerCallbackHandler(arg0, arg1, arg2 != IntPtr.Zero); - } - - private int VerifyPeerCallbackHandler(IntPtr targetName, IntPtr peerPem, bool isDestroy) - { - if (isDestroy) - { - this.callbackRegistration.Dispose(); - return 0; - } - - try - { - var context = new VerifyPeerContext(Marshal.PtrToStringAnsi(targetName), Marshal.PtrToStringAnsi(peerPem)); - - return this.verifyPeerCallback(context) ? 0 : 1; - } - catch (Exception e) - { - // eat the exception, we must not throw when inside callback from native code. - Logger.Error(e, "Exception occurred while invoking verify peer callback handler."); - // Return validation failure in case of exception. - return 1; - } - } - } + internal override bool IsComposable => true; } /// @@ -277,17 +231,9 @@ namespace Grpc.Core GrpcPreconditions.CheckArgument(channelCredentials.IsComposable, "Supplied channel credentials do not allow composition."); } - internal override ChannelCredentialsSafeHandle CreateNativeCredentials() + public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) { - using (var callCreds = callCredentials.ToNativeCredentials()) - { - var nativeComposite = ChannelCredentialsSafeHandle.CreateComposite(channelCredentials.GetNativeCredentials(), callCreds); - if (nativeComposite.IsInvalid) - { - throw new ArgumentException("Error creating native composite credentials. Likely, this is because you are trying to compose incompatible credentials."); - } - return nativeComposite; - } + configurator.SetCompositeCredentials(state, channelCredentials, callCredentials); } } } diff --git a/src/csharp/Grpc.Core.Api/ChannelCredentialsConfiguratorBase.cs b/src/csharp/Grpc.Core.Api/ChannelCredentialsConfiguratorBase.cs new file mode 100644 index 00000000000..5c779bc66b4 --- /dev/null +++ b/src/csharp/Grpc.Core.Api/ChannelCredentialsConfiguratorBase.cs @@ -0,0 +1,44 @@ +#region Copyright notice and license + +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System.Collections.Generic; + +namespace Grpc.Core +{ + /// + /// Base class for objects that can consume configuration from CallCredentials objects. + /// Note: experimental API that can change or be removed without any prior notice. + /// + public abstract class ChannelCredentialsConfiguratorBase + { + /// + /// Configures the credentials to use insecure credentials. + /// + public abstract void SetInsecureCredentials(object state); + + /// + /// Configures the credentials to use SslCredentials. + /// + public abstract void SetSslCredentials(object state, string rootCertificates, KeyCertificatePair keyCertificatePair, VerifyPeerCallback verifyPeerCallback); + + /// + /// Configures the credentials to use composite channel credentials (a composite of channel credentials and call credentials). + /// + public abstract void SetCompositeCredentials(object state, ChannelCredentials channelCredentials, CallCredentials callCredentials); + } +} diff --git a/src/csharp/Grpc.Core/KeyCertificatePair.cs b/src/csharp/Grpc.Core.Api/KeyCertificatePair.cs similarity index 100% rename from src/csharp/Grpc.Core/KeyCertificatePair.cs rename to src/csharp/Grpc.Core.Api/KeyCertificatePair.cs diff --git a/src/csharp/Grpc.Core/VerifyPeerContext.cs b/src/csharp/Grpc.Core.Api/VerifyPeerContext.cs similarity index 100% rename from src/csharp/Grpc.Core/VerifyPeerContext.cs rename to src/csharp/Grpc.Core.Api/VerifyPeerContext.cs diff --git a/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs b/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs index 843d88bfb6a..fd50ce4f064 100644 --- a/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs +++ b/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs @@ -48,25 +48,25 @@ namespace Grpc.Core.Tests { // always returning the same native object is critical for subchannel sharing to work with secure channels var creds = new SslCredentials(); - var nativeCreds1 = creds.GetNativeCredentials(); - var nativeCreds2 = creds.GetNativeCredentials(); + var nativeCreds1 = creds.ToNativeCredentials(); + var nativeCreds2 = creds.ToNativeCredentials(); Assert.AreSame(nativeCreds1, nativeCreds2); } [Test] public void ChannelCredentials_CreateExceptionIsCached() { - var creds = new ChannelCredentialsWithCreateNativeThrows(); - var ex1 = Assert.Throws(typeof(Exception), () => creds.GetNativeCredentials()); - var ex2 = Assert.Throws(typeof(Exception), () => creds.GetNativeCredentials()); + var creds = new ChannelCredentialsWithPopulateConfigurationThrows(); + var ex1 = Assert.Throws(typeof(Exception), () => creds.ToNativeCredentials()); + var ex2 = Assert.Throws(typeof(Exception), () => creds.ToNativeCredentials()); Assert.AreSame(ex1, ex2); } - internal class ChannelCredentialsWithCreateNativeThrows : ChannelCredentials + internal class ChannelCredentialsWithPopulateConfigurationThrows : ChannelCredentials { internal override bool IsComposable => false; - internal override ChannelCredentialsSafeHandle CreateNativeCredentials() + public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) { throw new Exception("Creation of native credentials has failed on purpose."); } diff --git a/src/csharp/Grpc.Core.Tests/FakeCredentials.cs b/src/csharp/Grpc.Core.Tests/FakeCredentials.cs index 59587b9a510..e38e0e136cc 100644 --- a/src/csharp/Grpc.Core.Tests/FakeCredentials.cs +++ b/src/csharp/Grpc.Core.Tests/FakeCredentials.cs @@ -34,9 +34,9 @@ namespace Grpc.Core.Tests get { return composable; } } - internal override ChannelCredentialsSafeHandle CreateNativeCredentials() + public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) { - return null; + // not invoking configuration on purpose } } diff --git a/src/csharp/Grpc.Core/Channel.cs b/src/csharp/Grpc.Core/Channel.cs index fb58c077c70..8d1fb921ff4 100644 --- a/src/csharp/Grpc.Core/Channel.cs +++ b/src/csharp/Grpc.Core/Channel.cs @@ -72,7 +72,7 @@ namespace Grpc.Core this.completionQueue = this.environment.PickCompletionQueue(); using (var nativeChannelArgs = ChannelOptions.CreateChannelArgs(this.options.Values)) { - var nativeCredentials = credentials.GetNativeCredentials(); + var nativeCredentials = credentials.ToNativeCredentials(); if (nativeCredentials != null) { this.handle = ChannelSafeHandle.CreateSecure(nativeCredentials, target, nativeChannelArgs); diff --git a/src/csharp/Grpc.Core/ForwardedTypes.cs b/src/csharp/Grpc.Core/ForwardedTypes.cs index ad30814eb70..f860545a9a2 100644 --- a/src/csharp/Grpc.Core/ForwardedTypes.cs +++ b/src/csharp/Grpc.Core/ForwardedTypes.cs @@ -40,6 +40,7 @@ using Grpc.Core.Utils; [assembly:TypeForwardedToAttribute(typeof(CallOptions))] [assembly:TypeForwardedToAttribute(typeof(ClientBase))] [assembly:TypeForwardedToAttribute(typeof(ClientBase<>))] +[assembly:TypeForwardedToAttribute(typeof(ChannelCredentials))] [assembly:TypeForwardedToAttribute(typeof(ClientInterceptorContext<,>))] [assembly:TypeForwardedToAttribute(typeof(ContextPropagationOptions))] [assembly:TypeForwardedToAttribute(typeof(ContextPropagationToken))] @@ -50,6 +51,7 @@ using Grpc.Core.Utils; [assembly:TypeForwardedToAttribute(typeof(Interceptor))] [assembly:TypeForwardedToAttribute(typeof(InterceptingCallInvoker))] [assembly:TypeForwardedToAttribute(typeof(IServerStreamWriter<>))] +[assembly:TypeForwardedToAttribute(typeof(KeyCertificatePair))] [assembly:TypeForwardedToAttribute(typeof(Marshaller<>))] [assembly:TypeForwardedToAttribute(typeof(Marshallers))] [assembly:TypeForwardedToAttribute(typeof(Metadata))] @@ -65,8 +67,10 @@ using Grpc.Core.Utils; [assembly:TypeForwardedToAttribute(typeof(DuplexStreamingServerMethod<,>))] [assembly:TypeForwardedToAttribute(typeof(ServerServiceDefinition))] [assembly:TypeForwardedToAttribute(typeof(ServiceBinderBase))] +[assembly:TypeForwardedToAttribute(typeof(SslCredentials))] [assembly:TypeForwardedToAttribute(typeof(Status))] [assembly:TypeForwardedToAttribute(typeof(StatusCode))] +[assembly:TypeForwardedToAttribute(typeof(VerifyPeerContext))] [assembly:TypeForwardedToAttribute(typeof(VersionInfo))] [assembly:TypeForwardedToAttribute(typeof(WriteOptions))] [assembly:TypeForwardedToAttribute(typeof(WriteFlags))] diff --git a/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs b/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs new file mode 100644 index 00000000000..8b9e1758598 --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs @@ -0,0 +1,130 @@ +#region Copyright notice and license + +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using Grpc.Core.Utils; +using Grpc.Core.Logging; + +namespace Grpc.Core.Internal +{ + /// + /// Creates native call credential objects from instances of ChannelCredentials. + /// + internal class DefaultChannelCredentialsConfigurator : ChannelCredentialsConfiguratorBase + { + static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); + + bool configured; + ChannelCredentialsSafeHandle nativeCredentials; + + public ChannelCredentialsSafeHandle NativeCredentials => nativeCredentials; + + public override void SetInsecureCredentials(object state) + { + GrpcPreconditions.CheckState(!configured); + // null corresponds to insecure credentials. + configured = true; + nativeCredentials = null; + } + + public override void SetSslCredentials(object state, string rootCertificates, KeyCertificatePair keyCertificatePair, VerifyPeerCallback verifyPeerCallback) + { + GrpcPreconditions.CheckState(!configured); + configured = true; + IntPtr verifyPeerCallbackTag = IntPtr.Zero; + if (verifyPeerCallback != null) + { + verifyPeerCallbackTag = new VerifyPeerCallbackRegistration(verifyPeerCallback).CallbackRegistration.Tag; + } + nativeCredentials = ChannelCredentialsSafeHandle.CreateSslCredentials(rootCertificates, keyCertificatePair, verifyPeerCallbackTag); + } + + public override void SetCompositeCredentials(object state, ChannelCredentials channelCredentials, CallCredentials callCredentials) + { + GrpcPreconditions.CheckState(!configured); + configured = true; + using (var callCreds = callCredentials.ToNativeCredentials()) + { + var nativeComposite = ChannelCredentialsSafeHandle.CreateComposite(channelCredentials.ToNativeCredentials(), callCreds); + if (nativeComposite.IsInvalid) + { + throw new ArgumentException("Error creating native composite credentials. Likely, this is because you are trying to compose incompatible credentials."); + } + nativeCredentials = nativeComposite; + } + } + + private class VerifyPeerCallbackRegistration + { + readonly VerifyPeerCallback verifyPeerCallback; + readonly NativeCallbackRegistration callbackRegistration; + + public VerifyPeerCallbackRegistration(VerifyPeerCallback verifyPeerCallback) + { + this.verifyPeerCallback = verifyPeerCallback; + this.callbackRegistration = NativeCallbackDispatcher.RegisterCallback(HandleUniversalCallback); + } + + public NativeCallbackRegistration CallbackRegistration => callbackRegistration; + + private int HandleUniversalCallback(IntPtr arg0, IntPtr arg1, IntPtr arg2, IntPtr arg3, IntPtr arg4, IntPtr arg5) + { + return VerifyPeerCallbackHandler(arg0, arg1, arg2 != IntPtr.Zero); + } + + private int VerifyPeerCallbackHandler(IntPtr targetName, IntPtr peerPem, bool isDestroy) + { + if (isDestroy) + { + this.callbackRegistration.Dispose(); + return 0; + } + + try + { + var context = new VerifyPeerContext(Marshal.PtrToStringAnsi(targetName), Marshal.PtrToStringAnsi(peerPem)); + + return this.verifyPeerCallback(context) ? 0 : 1; + } + catch (Exception e) + { + // eat the exception, we must not throw when inside callback from native code. + Logger.Error(e, "Exception occurred while invoking verify peer callback handler."); + // Return validation failure in case of exception. + return 1; + } + } + } + } + + internal static class ChannelCredentialsExtensions + { + /// + /// Creates native object for the credentials. + /// + /// The native credentials. + public static ChannelCredentialsSafeHandle ToNativeCredentials(this ChannelCredentials credentials) + { + var configurator = new DefaultChannelCredentialsConfigurator(); + credentials.InternalPopulateConfiguration(configurator, credentials); + return configurator.NativeCredentials; + } + } +} From 1a34d0c12890f0b08fc3b0cc86781c28856b91de Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 22 Jul 2019 13:47:26 +0200 Subject: [PATCH 129/661] more forwards --- src/csharp/Grpc.Core/ForwardedTypes.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/csharp/Grpc.Core/ForwardedTypes.cs b/src/csharp/Grpc.Core/ForwardedTypes.cs index f860545a9a2..4394a7c907c 100644 --- a/src/csharp/Grpc.Core/ForwardedTypes.cs +++ b/src/csharp/Grpc.Core/ForwardedTypes.cs @@ -70,6 +70,7 @@ using Grpc.Core.Utils; [assembly:TypeForwardedToAttribute(typeof(SslCredentials))] [assembly:TypeForwardedToAttribute(typeof(Status))] [assembly:TypeForwardedToAttribute(typeof(StatusCode))] +[assembly:TypeForwardedToAttribute(typeof(VerifyPeerCallback))] [assembly:TypeForwardedToAttribute(typeof(VerifyPeerContext))] [assembly:TypeForwardedToAttribute(typeof(VersionInfo))] [assembly:TypeForwardedToAttribute(typeof(WriteOptions))] From 606a0a0ad3006c97fa0330dfef1cb726735ad285 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 22 Jul 2019 13:48:18 +0200 Subject: [PATCH 130/661] split up ChannelCredentials.cs --- .../Grpc.Core.Api/ChannelCredentials.cs | 136 +++--------------- src/csharp/Grpc.Core.Api/SslCredentials.cs | 122 ++++++++++++++++ 2 files changed, 140 insertions(+), 118 deletions(-) create mode 100644 src/csharp/Grpc.Core.Api/SslCredentials.cs diff --git a/src/csharp/Grpc.Core.Api/ChannelCredentials.cs b/src/csharp/Grpc.Core.Api/ChannelCredentials.cs index 10020a3d8d4..fae390ce109 100644 --- a/src/csharp/Grpc.Core.Api/ChannelCredentials.cs +++ b/src/csharp/Grpc.Core.Api/ChannelCredentials.cs @@ -107,133 +107,33 @@ namespace Grpc.Core configurator.SetInsecureCredentials(state); } } - } - - /// - /// Callback invoked with the expected targetHost and the peer's certificate. - /// If false is returned by this callback then it is treated as a - /// verification failure and the attempted connection will fail. - /// Invocation of the callback is blocking, so any - /// implementation should be light-weight. - /// Note that the callback can potentially be invoked multiple times, - /// concurrently from different threads (e.g. when multiple connections - /// are being created for the same credentials). - /// - /// The associated with the callback - /// true if verification succeeded, false otherwise. - /// Note: experimental API that can change or be removed without any prior notice. - public delegate bool VerifyPeerCallback(VerifyPeerContext context); - - /// - /// Client-side SSL credentials. - /// - public sealed class SslCredentials : ChannelCredentials - { - readonly string rootCertificates; - readonly KeyCertificatePair keyCertificatePair; - readonly VerifyPeerCallback verifyPeerCallback; - - /// - /// Creates client-side SSL credentials loaded from - /// disk file pointed to by the GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable. - /// If that fails, gets the roots certificates from a well known place on disk. - /// - public SslCredentials() : this(null, null, null) - { - } - - /// - /// Creates client-side SSL credentials from - /// a string containing PEM encoded root certificates. - /// - public SslCredentials(string rootCertificates) : this(rootCertificates, null, null) - { - } - - /// - /// Creates client-side SSL credentials. - /// - /// string containing PEM encoded server root certificates. - /// a key certificate pair. - public SslCredentials(string rootCertificates, KeyCertificatePair keyCertificatePair) : - this(rootCertificates, keyCertificatePair, null) - { - } - - /// - /// Creates client-side SSL credentials. - /// - /// string containing PEM encoded server root certificates. - /// a key certificate pair. - /// a callback to verify peer's target name and certificate. - /// Note: experimental API that can change or be removed without any prior notice. - public SslCredentials(string rootCertificates, KeyCertificatePair keyCertificatePair, VerifyPeerCallback verifyPeerCallback) - { - this.rootCertificates = rootCertificates; - this.keyCertificatePair = keyCertificatePair; - this.verifyPeerCallback = verifyPeerCallback; - } /// - /// PEM encoding of the server root certificates. + /// Credentials that allow composing one object and + /// one or more objects into a single . /// - public string RootCertificates + private sealed class CompositeChannelCredentials : ChannelCredentials { - get + readonly ChannelCredentials channelCredentials; + readonly CallCredentials callCredentials; + + /// + /// Initializes a new instance of CompositeChannelCredentials class. + /// The resulting credentials object will be composite of all the credentials specified as parameters. + /// + /// channelCredentials to compose + /// channelCredentials to compose + public CompositeChannelCredentials(ChannelCredentials channelCredentials, CallCredentials callCredentials) { - return this.rootCertificates; + this.channelCredentials = GrpcPreconditions.CheckNotNull(channelCredentials); + this.callCredentials = GrpcPreconditions.CheckNotNull(callCredentials); + GrpcPreconditions.CheckArgument(channelCredentials.IsComposable, "Supplied channel credentials do not allow composition."); } - } - /// - /// Client side key and certificate pair. - /// If null, client will not use key and certificate pair. - /// - public KeyCertificatePair KeyCertificatePair - { - get + public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) { - return this.keyCertificatePair; + configurator.SetCompositeCredentials(state, channelCredentials, callCredentials); } } - - /// - /// Populates channel credentials configurator with this instance's configuration. - /// End users never need to invoke this method as it is part of internal implementation. - /// - public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) - { - configurator.SetSslCredentials(state, rootCertificates, keyCertificatePair, verifyPeerCallback); - } - - internal override bool IsComposable => true; - } - - /// - /// Credentials that allow composing one object and - /// one or more objects into a single . - /// - internal sealed class CompositeChannelCredentials : ChannelCredentials - { - readonly ChannelCredentials channelCredentials; - readonly CallCredentials callCredentials; - - /// - /// Initializes a new instance of CompositeChannelCredentials class. - /// The resulting credentials object will be composite of all the credentials specified as parameters. - /// - /// channelCredentials to compose - /// channelCredentials to compose - public CompositeChannelCredentials(ChannelCredentials channelCredentials, CallCredentials callCredentials) - { - this.channelCredentials = GrpcPreconditions.CheckNotNull(channelCredentials); - this.callCredentials = GrpcPreconditions.CheckNotNull(callCredentials); - GrpcPreconditions.CheckArgument(channelCredentials.IsComposable, "Supplied channel credentials do not allow composition."); - } - - public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) - { - configurator.SetCompositeCredentials(state, channelCredentials, callCredentials); - } } } diff --git a/src/csharp/Grpc.Core.Api/SslCredentials.cs b/src/csharp/Grpc.Core.Api/SslCredentials.cs new file mode 100644 index 00000000000..21db7cdfb66 --- /dev/null +++ b/src/csharp/Grpc.Core.Api/SslCredentials.cs @@ -0,0 +1,122 @@ +#region Copyright notice and license + +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +namespace Grpc.Core +{ + /// + /// Callback invoked with the expected targetHost and the peer's certificate. + /// If false is returned by this callback then it is treated as a + /// verification failure and the attempted connection will fail. + /// Invocation of the callback is blocking, so any + /// implementation should be light-weight. + /// Note that the callback can potentially be invoked multiple times, + /// concurrently from different threads (e.g. when multiple connections + /// are being created for the same credentials). + /// + /// The associated with the callback + /// true if verification succeeded, false otherwise. + /// Note: experimental API that can change or be removed without any prior notice. + public delegate bool VerifyPeerCallback(VerifyPeerContext context); + + /// + /// Client-side SSL credentials. + /// + public sealed class SslCredentials : ChannelCredentials + { + readonly string rootCertificates; + readonly KeyCertificatePair keyCertificatePair; + readonly VerifyPeerCallback verifyPeerCallback; + + /// + /// Creates client-side SSL credentials loaded from + /// disk file pointed to by the GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable. + /// If that fails, gets the roots certificates from a well known place on disk. + /// + public SslCredentials() : this(null, null, null) + { + } + + /// + /// Creates client-side SSL credentials from + /// a string containing PEM encoded root certificates. + /// + public SslCredentials(string rootCertificates) : this(rootCertificates, null, null) + { + } + + /// + /// Creates client-side SSL credentials. + /// + /// string containing PEM encoded server root certificates. + /// a key certificate pair. + public SslCredentials(string rootCertificates, KeyCertificatePair keyCertificatePair) : + this(rootCertificates, keyCertificatePair, null) + { + } + + /// + /// Creates client-side SSL credentials. + /// + /// string containing PEM encoded server root certificates. + /// a key certificate pair. + /// a callback to verify peer's target name and certificate. + /// Note: experimental API that can change or be removed without any prior notice. + public SslCredentials(string rootCertificates, KeyCertificatePair keyCertificatePair, VerifyPeerCallback verifyPeerCallback) + { + this.rootCertificates = rootCertificates; + this.keyCertificatePair = keyCertificatePair; + this.verifyPeerCallback = verifyPeerCallback; + } + + /// + /// PEM encoding of the server root certificates. + /// + public string RootCertificates + { + get + { + return this.rootCertificates; + } + } + + /// + /// Client side key and certificate pair. + /// If null, client will not use key and certificate pair. + /// + public KeyCertificatePair KeyCertificatePair + { + get + { + return this.keyCertificatePair; + } + } + + /// + /// Populates channel credentials configurator with this instance's configuration. + /// End users never need to invoke this method as it is part of internal implementation. + /// + public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) + { + configurator.SetSslCredentials(state, rootCertificates, keyCertificatePair, verifyPeerCallback); + } + + internal override bool IsComposable => true; + } + + +} From b46ac4ae21e3affc4a2cf92ca78308a5a6f696bb Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 22 Jul 2019 11:53:37 -0400 Subject: [PATCH 131/661] implement caching of native channel credentials --- .../Grpc.Core.Api/ChannelCredentials.cs | 26 --------- .../DefaultChannelCredentialsConfigurator.cs | 53 +++++++++++++++++-- 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/src/csharp/Grpc.Core.Api/ChannelCredentials.cs b/src/csharp/Grpc.Core.Api/ChannelCredentials.cs index fae390ce109..23ede0a512e 100644 --- a/src/csharp/Grpc.Core.Api/ChannelCredentials.cs +++ b/src/csharp/Grpc.Core.Api/ChannelCredentials.cs @@ -31,20 +31,12 @@ namespace Grpc.Core public abstract class ChannelCredentials { static readonly ChannelCredentials InsecureInstance = new InsecureCredentialsImpl(); - - // TODO: caching the instance!!!! - //readonly Lazy cachedNativeCredentials; /// /// Creates a new instance of channel credentials /// public ChannelCredentials() { - // Native credentials object need to be kept alive once initialized for subchannel sharing to work correctly - // with secure connections. See https://github.com/grpc/grpc/issues/15207. - // We rely on finalizer to clean up the native portion of ChannelCredentialsSafeHandle after the ChannelCredentials - // instance becomes unused. - //this.cachedNativeCredentials = new Lazy(() => CreateNativeCredentials()); } /// @@ -77,24 +69,6 @@ namespace Grpc.Core /// public abstract void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state); - // / - // / Gets native object for the credentials, creating one if it already doesn't exist. May return null if insecure channel - // / should be created. Caller must not call Dispose() on the returned native credentials as their lifetime - // / is managed by this class (and instances of native credentials are cached). - // / - // / The native credentials. - //internal ChannelCredentialsSafeHandle GetNativeCredentials() - //{ - // return cachedNativeCredentials.Value; - //} - - // / - // / Creates a new native object for the credentials. May return null if insecure channel - // / should be created. For internal use only, use instead. - // / - // / The native credentials. - //internal abstract ChannelCredentialsSafeHandle CreateNativeCredentials(); - /// /// Returns true if this credential type allows being composed by CompositeCredentials. /// diff --git a/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs b/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs index 8b9e1758598..aaccbdfe6f7 100644 --- a/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs +++ b/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; using Grpc.Core.Utils; using Grpc.Core.Logging; @@ -31,6 +32,12 @@ namespace Grpc.Core.Internal { static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); + // Native credentials object need to be kept alive once initialized for subchannel sharing to work correctly + // with secure connections. See https://github.com/grpc/grpc/issues/15207. + // We rely on finalizer to clean up the native portion of ChannelCredentialsSafeHandle after the ChannelCredentials + // instance becomes unused. + static readonly ConditionalWeakTable> CachedNativeCredentials = new ConditionalWeakTable>(); + bool configured; ChannelCredentialsSafeHandle nativeCredentials; @@ -48,18 +55,30 @@ namespace Grpc.Core.Internal { GrpcPreconditions.CheckState(!configured); configured = true; + nativeCredentials = GetOrCreateNativeCredentials((ChannelCredentials) state, + () => CreateNativeSslCredentials(rootCertificates, keyCertificatePair, verifyPeerCallback)); + } + + public override void SetCompositeCredentials(object state, ChannelCredentials channelCredentials, CallCredentials callCredentials) + { + GrpcPreconditions.CheckState(!configured); + configured = true; + nativeCredentials = GetOrCreateNativeCredentials((ChannelCredentials) state, + () => CreateNativeCompositeCredentials(channelCredentials, callCredentials)); + } + + private ChannelCredentialsSafeHandle CreateNativeSslCredentials(string rootCertificates, KeyCertificatePair keyCertificatePair, VerifyPeerCallback verifyPeerCallback) + { IntPtr verifyPeerCallbackTag = IntPtr.Zero; if (verifyPeerCallback != null) { verifyPeerCallbackTag = new VerifyPeerCallbackRegistration(verifyPeerCallback).CallbackRegistration.Tag; } - nativeCredentials = ChannelCredentialsSafeHandle.CreateSslCredentials(rootCertificates, keyCertificatePair, verifyPeerCallbackTag); + return ChannelCredentialsSafeHandle.CreateSslCredentials(rootCertificates, keyCertificatePair, verifyPeerCallbackTag); } - public override void SetCompositeCredentials(object state, ChannelCredentials channelCredentials, CallCredentials callCredentials) + private ChannelCredentialsSafeHandle CreateNativeCompositeCredentials(ChannelCredentials channelCredentials, CallCredentials callCredentials) { - GrpcPreconditions.CheckState(!configured); - configured = true; using (var callCreds = callCredentials.ToNativeCredentials()) { var nativeComposite = ChannelCredentialsSafeHandle.CreateComposite(channelCredentials.ToNativeCredentials(), callCreds); @@ -67,8 +86,32 @@ namespace Grpc.Core.Internal { throw new ArgumentException("Error creating native composite credentials. Likely, this is because you are trying to compose incompatible credentials."); } - nativeCredentials = nativeComposite; + return nativeComposite; + } + } + + private ChannelCredentialsSafeHandle GetOrCreateNativeCredentials(ChannelCredentials key, Func nativeCredentialsFactory) + { + Lazy lazyValue; + while (true) + { + if (CachedNativeCredentials.TryGetValue(key, out lazyValue)) + { + break; + } + + lazyValue = new Lazy(nativeCredentialsFactory); + try + { + CachedNativeCredentials.Add(key, lazyValue); + break; + } + catch (ArgumentException) + { + // key exists, next TryGetValue should fetch the value + } } + return lazyValue.Value; } private class VerifyPeerCallbackRegistration From a1030e23b0c3684e51b502e9637c4d61a72f5881 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 22 Jul 2019 13:15:22 -0400 Subject: [PATCH 132/661] remove unnecessary test --- .../Grpc.Core.Tests/ChannelCredentialsTest.cs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs b/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs index fd50ce4f064..57acfc0bab5 100644 --- a/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs +++ b/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs @@ -52,24 +52,5 @@ namespace Grpc.Core.Tests var nativeCreds2 = creds.ToNativeCredentials(); Assert.AreSame(nativeCreds1, nativeCreds2); } - - [Test] - public void ChannelCredentials_CreateExceptionIsCached() - { - var creds = new ChannelCredentialsWithPopulateConfigurationThrows(); - var ex1 = Assert.Throws(typeof(Exception), () => creds.ToNativeCredentials()); - var ex2 = Assert.Throws(typeof(Exception), () => creds.ToNativeCredentials()); - Assert.AreSame(ex1, ex2); - } - - internal class ChannelCredentialsWithPopulateConfigurationThrows : ChannelCredentials - { - internal override bool IsComposable => false; - - public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) - { - throw new Exception("Creation of native credentials has failed on purpose."); - } - } } } From 11bf6dbad650add92f160a41ca9677564004c10c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 30 Jul 2019 10:59:59 -0700 Subject: [PATCH 133/661] simplify CachedNativeCredentials --- .../DefaultChannelCredentialsConfigurator.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs b/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs index aaccbdfe6f7..c4c044cd577 100644 --- a/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs +++ b/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs @@ -37,6 +37,7 @@ namespace Grpc.Core.Internal // We rely on finalizer to clean up the native portion of ChannelCredentialsSafeHandle after the ChannelCredentials // instance becomes unused. static readonly ConditionalWeakTable> CachedNativeCredentials = new ConditionalWeakTable>(); + static readonly object StaticLock = new object(); bool configured; ChannelCredentialsSafeHandle nativeCredentials; @@ -93,22 +94,11 @@ namespace Grpc.Core.Internal private ChannelCredentialsSafeHandle GetOrCreateNativeCredentials(ChannelCredentials key, Func nativeCredentialsFactory) { Lazy lazyValue; - while (true) - { - if (CachedNativeCredentials.TryGetValue(key, out lazyValue)) - { - break; - } - - lazyValue = new Lazy(nativeCredentialsFactory); - try + lock (StaticLock) { + if (!CachedNativeCredentials.TryGetValue(key, out lazyValue)) { + lazyValue = new Lazy(nativeCredentialsFactory); CachedNativeCredentials.Add(key, lazyValue); - break; - } - catch (ArgumentException) - { - // key exists, next TryGetValue should fetch the value } } return lazyValue.Value; From d4e778ca2fbaa7296270906a5809258462e9cae5 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 30 Jul 2019 11:01:07 -0700 Subject: [PATCH 134/661] make Grpc.Auth only depend on Grpc.Core.Api --- src/csharp/Grpc.Auth/Grpc.Auth.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Auth/Grpc.Auth.csproj b/src/csharp/Grpc.Auth/Grpc.Auth.csproj index 298b721409e..1e559c19872 100755 --- a/src/csharp/Grpc.Auth/Grpc.Auth.csproj +++ b/src/csharp/Grpc.Auth/Grpc.Auth.csproj @@ -27,7 +27,7 @@ - + None From fb85fb8c19a2de21a503aea037682eff00a01977 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 30 Jul 2019 11:44:02 -0700 Subject: [PATCH 135/661] make Grpc.Auth build again --- src/csharp/Grpc.Auth/GoogleAuthInterceptors.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Auth/GoogleAuthInterceptors.cs b/src/csharp/Grpc.Auth/GoogleAuthInterceptors.cs index d859075c3bd..e6c973431d7 100644 --- a/src/csharp/Grpc.Auth/GoogleAuthInterceptors.cs +++ b/src/csharp/Grpc.Auth/GoogleAuthInterceptors.cs @@ -61,7 +61,7 @@ namespace Grpc.Auth return new AsyncAuthInterceptor((context, metadata) => { metadata.Add(CreateBearerTokenHeader(accessToken)); - return TaskUtils.CompletedTask; + return GetCompletedTask(); }); } @@ -69,5 +69,17 @@ namespace Grpc.Auth { return new Metadata.Entry(AuthorizationHeader, Schema + " " + accessToken); } + + /// + /// Framework independent equivalent of Task.CompletedTask. + /// + private static Task GetCompletedTask() + { +#if NETSTANDARD1_5 || NETSTANDARD2_0 + return Task.CompletedTask; +#else + return Task.FromResult(null); // for .NET45, emulate the functionality +#endif + } } } From 6b86d4706b3fb752ee27a56f5369b1a04d86d7b3 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 30 Jul 2019 11:54:55 -0700 Subject: [PATCH 136/661] yapf code --- tools/buildgen/plugins/expand_version.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/buildgen/plugins/expand_version.py b/tools/buildgen/plugins/expand_version.py index 02615f841fe..08cc10b3c60 100755 --- a/tools/buildgen/plugins/expand_version.py +++ b/tools/buildgen/plugins/expand_version.py @@ -38,7 +38,9 @@ class Version: self.tag = None if '-' in version_str: version_str, self.tag = version_str.split('-') - self.major, self.minor, self.patch = [int(x) for x in version_str.split('.')] + self.major, self.minor, self.patch = [ + int(x) for x in version_str.split('.') + ] if override_major: self.major = override_major @@ -114,6 +116,8 @@ def mako_plugin(dictionary): version_tag = '%s_version' % language override_major = settings.get('%s_major_version' % language, None) if version_tag in settings: - settings[version_tag] = Version(settings[version_tag], override_major=override_major) + settings[version_tag] = Version( + settings[version_tag], override_major=override_major) else: - settings[version_tag] = Version(version_str, override_major=override_major) + settings[version_tag] = Version( + version_str, override_major=override_major) From 40ab822fea5e594af0fc7541da9a51072ffad889 Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 30 Jul 2019 12:58:46 -0700 Subject: [PATCH 137/661] Let CFStreamHandle be covered by grpc_init/shutdown --- src/core/lib/iomgr/cfstream_handle.cc | 5 +++++ src/core/lib/iomgr/cfstream_handle.h | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/core/lib/iomgr/cfstream_handle.cc b/src/core/lib/iomgr/cfstream_handle.cc index ea28e620695..c1e7d67e568 100644 --- a/src/core/lib/iomgr/cfstream_handle.cc +++ b/src/core/lib/iomgr/cfstream_handle.cc @@ -25,6 +25,7 @@ #import #import "src/core/lib/iomgr/cfstream_handle.h" +#include #include #include @@ -35,6 +36,10 @@ extern grpc_core::TraceFlag grpc_tcp_trace; +GrpcLibraryInitHolder::GrpcLibraryInitHolder() { grpc_init(); } + +GrpcLibraryInitHolder::~GrpcLibraryInitHolder() { grpc_shutdown(); } + void* CFStreamHandle::Retain(void* info) { CFStreamHandle* handle = static_cast(info); CFSTREAM_HANDLE_REF(handle, "retain"); diff --git a/src/core/lib/iomgr/cfstream_handle.h b/src/core/lib/iomgr/cfstream_handle.h index 05f45ed6251..5f3a525930c 100644 --- a/src/core/lib/iomgr/cfstream_handle.h +++ b/src/core/lib/iomgr/cfstream_handle.h @@ -33,11 +33,17 @@ #include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/lockfree_event.h" -class CFStreamHandle final { +class GrpcLibraryInitHolder { + public: + GrpcLibraryInitHolder(); + virtual ~GrpcLibraryInitHolder(); +}; + +class CFStreamHandle : public GrpcLibraryInitHolder { public: static CFStreamHandle* CreateStreamHandle(CFReadStreamRef read_stream, CFWriteStreamRef write_stream); - ~CFStreamHandle(); + ~CFStreamHandle() override; CFStreamHandle(const CFStreamHandle& ref) = delete; CFStreamHandle(CFStreamHandle&& ref) = delete; CFStreamHandle& operator=(const CFStreamHandle& rhs) = delete; From cb6e5481cc2640d19b654bd5da925f9c8a35ed96 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 30 Jul 2019 14:19:26 -0700 Subject: [PATCH 138/661] remove System.Interactive.Async dependency from the Unity package --- src/csharp/build_unitypackage.bat | 1 - src/csharp/experimental/build_unitypackage.sh | 32 ------------------- .../Plugins/System.Interactive.Async.meta | 10 ------ .../Plugins/System.Interactive.Async/lib.meta | 10 ------ .../System.Interactive.Async/lib/net45.meta | 10 ------ .../net45/System.Interactive.Async.dll.meta | 32 ------------------- .../net45/System.Interactive.Async.xml.meta | 9 ------ .../csharp/build_unitypackage.bat.template | 1 - 8 files changed, 105 deletions(-) delete mode 100755 src/csharp/experimental/build_unitypackage.sh delete mode 100644 src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async.meta delete mode 100644 src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib.meta delete mode 100644 src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45.meta delete mode 100644 src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.dll.meta delete mode 100644 src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.xml.meta diff --git a/src/csharp/build_unitypackage.bat b/src/csharp/build_unitypackage.bat index a40eddddf2e..f29bd98b5a2 100644 --- a/src/csharp/build_unitypackage.bat +++ b/src/csharp/build_unitypackage.bat @@ -64,7 +64,6 @@ copy /Y nativelibs\csharp_ext_macos_ios\libgrpc.a unitypackage\unitypackage_skel @rem add gRPC dependencies @rem TODO(jtattermusch): also include XMLdoc -copy /Y Grpc.Core\bin\Release\net45\System.Interactive.Async.dll unitypackage\unitypackage_skeleton\Plugins\System.Interactive.Async\lib\net45\System.Interactive.Async.dll || goto :error copy /Y Grpc.Core\bin\Release\net45\System.Runtime.CompilerServices.Unsafe.dll unitypackage\unitypackage_skeleton\Plugins\System.Runtime.CompilerServices.Unsafe\lib\net45\System.Runtime.CompilerServices.Unsafe.dll || goto :error copy /Y Grpc.Core\bin\Release\net45\System.Buffers.dll unitypackage\unitypackage_skeleton\Plugins\System.Buffers\lib\net45\System.Buffers.dll || goto :error copy /Y Grpc.Core\bin\Release\net45\System.Memory.dll unitypackage\unitypackage_skeleton\Plugins\System.Memory\lib\net45\System.Memory.dll || goto :error diff --git a/src/csharp/experimental/build_unitypackage.sh b/src/csharp/experimental/build_unitypackage.sh deleted file mode 100755 index cca52658e85..00000000000 --- a/src/csharp/experimental/build_unitypackage.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# Copyright 2018 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Builds an experimental .unitypackage file to be imported into Unity projects. - -set -ex - -cd "$(dirname "$0")/.." - -dotnet restore Grpc.sln - -mkdir -p GrpcUnity -dotnet build --configuration Release --framework net45 Grpc.Core --output ../GrpcUnity - -#TODO: add ThirdParty/Grpc.Core: -# - assembly -# - native libraries (mac dylib need to be renamed to grpc_csharp_ext.bundle) - -#TODO: add ThirdParty/Grpc.Tools: -# - protoc and grpc plugin diff --git a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async.meta b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async.meta deleted file mode 100644 index 6f1b910534d..00000000000 --- a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: b2ba2199282e9c641bc2e611f1e776a0 -folderAsset: yes -timeCreated: 1531219385 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib.meta b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib.meta deleted file mode 100644 index d7ae012a397..00000000000 --- a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: bd5ddd2522dc301488ffe002106fe0ab -folderAsset: yes -timeCreated: 1531219385 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45.meta b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45.meta deleted file mode 100644 index 9b1748d3e76..00000000000 --- a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: a68443518bcd1d44ba88a871dcab0c83 -folderAsset: yes -timeCreated: 1531219385 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.dll.meta b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.dll.meta deleted file mode 100644 index bb910fe9229..00000000000 --- a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.dll.meta +++ /dev/null @@ -1,32 +0,0 @@ -fileFormatVersion: 2 -guid: 4c05e46cbf00c68408f5ddc1eef9ae3b -timeCreated: 1531219386 -licenseType: Free -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - isOverridable: 0 - platformData: - - first: - Any: - second: - enabled: 1 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Windows Store Apps: WindowsStoreApps - second: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.xml.meta b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.xml.meta deleted file mode 100644 index 53f91502bd6..00000000000 --- a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.xml.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6fc38864f2d3dde46b3833c62c91a008 -timeCreated: 1531219386 -licenseType: Free -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/templates/src/csharp/build_unitypackage.bat.template b/templates/src/csharp/build_unitypackage.bat.template index 07f19c2af3e..2dbb22a0d17 100755 --- a/templates/src/csharp/build_unitypackage.bat.template +++ b/templates/src/csharp/build_unitypackage.bat.template @@ -66,7 +66,6 @@ @rem add gRPC dependencies @rem TODO(jtattermusch): also include XMLdoc - copy /Y Grpc.Core\bin\Release\net45\System.Interactive.Async.dll unitypackage\unitypackage_skeleton\Plugins\System.Interactive.Async\lib\net45\System.Interactive.Async.dll || goto :error copy /Y Grpc.Core\bin\Release\net45\System.Runtime.CompilerServices.Unsafe.dll unitypackage\unitypackage_skeleton\Plugins\System.Runtime.CompilerServices.Unsafe\lib\net45\System.Runtime.CompilerServices.Unsafe.dll || goto :error copy /Y Grpc.Core\bin\Release\net45\System.Buffers.dll unitypackage\unitypackage_skeleton\Plugins\System.Buffers\lib\net45\System.Buffers.dll || goto :error copy /Y Grpc.Core\bin\Release\net45\System.Memory.dll unitypackage\unitypackage_skeleton\Plugins\System.Memory\lib\net45\System.Memory.dll || goto :error From bd8a04a6e92645a56cf12318bd8f7e5759343aeb Mon Sep 17 00:00:00 2001 From: Hope Casey-Allen Date: Mon, 29 Jul 2019 16:06:06 -0700 Subject: [PATCH 139/661] Add human-readable names for channelz sockets and listen sockets --- .../client_channel/client_channel_channelz.cc | 22 ++++++++---- .../client_channel/client_channel_channelz.h | 12 +++---- .../ext/filters/client_channel/connector.h | 12 +++++-- .../ext/filters/client_channel/subchannel.cc | 9 ++--- .../chttp2/client/chttp2_connector.cc | 7 ++-- .../transport/chttp2/server/chttp2_server.cc | 12 ++++--- .../chttp2/transport/chttp2_transport.cc | 5 ++- src/core/lib/channel/channelz.cc | 36 ++++++++++++------- src/core/lib/channel/channelz.h | 27 +++++++------- src/core/lib/surface/server.cc | 24 +++++++------ src/core/lib/surface/server.h | 13 ++++--- test/core/channel/channelz_registry_test.cc | 26 +++++++------- test/cpp/end2end/channelz_service_test.cc | 7 ++++ 13 files changed, 127 insertions(+), 85 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel_channelz.cc b/src/core/ext/filters/client_channel/client_channel_channelz.cc index a489685df40..87a76601f02 100644 --- a/src/core/ext/filters/client_channel/client_channel_channelz.cc +++ b/src/core/ext/filters/client_channel/client_channel_channelz.cc @@ -32,7 +32,8 @@ namespace channelz { SubchannelNode::SubchannelNode(const char* target_address, size_t channel_tracer_max_nodes) - : BaseNode(EntityType::kSubchannel), + : BaseNode(EntityType::kSubchannel, + UniquePtr(gpr_strdup(target_address))), target_(UniquePtr(gpr_strdup(target_address))), trace_(channel_tracer_max_nodes) {} @@ -42,8 +43,9 @@ void SubchannelNode::UpdateConnectivityState(grpc_connectivity_state state) { connectivity_state_.Store(state, MemoryOrder::RELAXED); } -void SubchannelNode::SetChildSocketUuid(intptr_t uuid) { - child_socket_uuid_.Store(uuid, MemoryOrder::RELAXED); +void SubchannelNode::SetChildSocket(RefCountedPtr socket) { + MutexLock lock(&socket_mu_); + child_socket_ = std::move(socket); } void SubchannelNode::PopulateConnectivityState(grpc_json* json) { @@ -88,14 +90,20 @@ grpc_json* SubchannelNode::RenderJson() { call_counter_.PopulateCallCounts(json); json = top_level_json; // populate the child socket. - intptr_t socket_uuid = child_socket_uuid_.Load(MemoryOrder::RELAXED); - if (socket_uuid != 0) { + RefCountedPtr child_socket; + { + MutexLock lock(&socket_mu_); + child_socket = child_socket_; + } + if (child_socket != nullptr && child_socket->uuid() != 0) { grpc_json* array_parent = grpc_json_create_child( nullptr, json, "socketRef", nullptr, GRPC_JSON_ARRAY, false); json_iterator = grpc_json_create_child(json_iterator, array_parent, nullptr, nullptr, GRPC_JSON_OBJECT, false); - grpc_json_add_number_string_child(json_iterator, nullptr, "socketId", - socket_uuid); + grpc_json* sibling_iterator = grpc_json_add_number_string_child( + json_iterator, nullptr, "socketId", child_socket->uuid()); + grpc_json_create_child(sibling_iterator, json_iterator, "name", + child_socket->name(), GRPC_JSON_STRING, false); } return top_level_json; } diff --git a/src/core/ext/filters/client_channel/client_channel_channelz.h b/src/core/ext/filters/client_channel/client_channel_channelz.h index 80a6fd230c8..5a1a1adcd1b 100644 --- a/src/core/ext/filters/client_channel/client_channel_channelz.h +++ b/src/core/ext/filters/client_channel/client_channel_channelz.h @@ -40,11 +40,10 @@ class SubchannelNode : public BaseNode { // Sets the subchannel's connectivity state without health checking. void UpdateConnectivityState(grpc_connectivity_state state); - // Used when the subchannel's child socket uuid changes. This should be set - // when the subchannel's transport is created and set to 0 when the subchannel - // unrefs the transport. A uuid of 0 indicates that the child socket is no - // longer associated with this subchannel. - void SetChildSocketUuid(intptr_t uuid); + // Used when the subchannel's child socket changes. This should be set when + // the subchannel's transport is created and set to nullptr when the + // subchannel unrefs the transport. + void SetChildSocket(RefCountedPtr socket); grpc_json* RenderJson() override; @@ -66,7 +65,8 @@ class SubchannelNode : public BaseNode { void PopulateConnectivityState(grpc_json* json); Atomic connectivity_state_{GRPC_CHANNEL_IDLE}; - Atomic child_socket_uuid_{0}; + Mutex socket_mu_; + RefCountedPtr child_socket_; UniquePtr target_; CallCountingHelper call_counter_; ChannelTrace trace_; diff --git a/src/core/ext/filters/client_channel/connector.h b/src/core/ext/filters/client_channel/connector.h index ea34dcdab57..2bd5ff26e3e 100644 --- a/src/core/ext/filters/client_channel/connector.h +++ b/src/core/ext/filters/client_channel/connector.h @@ -22,6 +22,7 @@ #include #include "src/core/lib/channel/channel_stack.h" +#include "src/core/lib/channel/channelz.h" #include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/transport/transport.h" @@ -48,8 +49,15 @@ typedef struct { /** channel arguments (to be passed to the filters) */ grpc_channel_args* channel_args; - /** socket uuid of the connected transport. 0 if not available */ - intptr_t socket_uuid; + /** channelz socket node of the connected transport. nullptr if not available + */ + grpc_core::RefCountedPtr socket; + + void reset() { + transport = nullptr; + channel_args = nullptr; + socket = nullptr; + } } grpc_connect_out_args; struct grpc_connector_vtable { diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc index e248cc6b5fc..e30d915d03c 100644 --- a/src/core/ext/filters/client_channel/subchannel.cc +++ b/src/core/ext/filters/client_channel/subchannel.cc @@ -349,7 +349,7 @@ class Subchannel::ConnectedSubchannelStateWatcher { } c->connected_subchannel_.reset(); if (c->channelz_node() != nullptr) { - c->channelz_node()->SetChildSocketUuid(0); + c->channelz_node()->SetChildSocket(nullptr); } c->SetConnectivityStateLocked(GRPC_CHANNEL_TRANSIENT_FAILURE); c->backoff_begun_ = false; @@ -1072,8 +1072,9 @@ bool Subchannel::PublishTransportLocked() { GRPC_ERROR_UNREF(error); return false; } - intptr_t socket_uuid = connecting_result_.socket_uuid; - memset(&connecting_result_, 0, sizeof(connecting_result_)); + RefCountedPtr socket = + std::move(connecting_result_.socket); + connecting_result_.reset(); if (disconnected_) { grpc_channel_stack_destroy(stk); gpr_free(stk); @@ -1085,7 +1086,7 @@ bool Subchannel::PublishTransportLocked() { gpr_log(GPR_INFO, "New connected subchannel at %p for subchannel %p", connected_subchannel_.get(), this); if (channelz_node_ != nullptr) { - channelz_node_->SetChildSocketUuid(socket_uuid); + channelz_node_->SetChildSocket(std::move(socket)); } // Instantiate state watcher. Will clean itself up. New(this); diff --git a/src/core/ext/transport/chttp2/client/chttp2_connector.cc b/src/core/ext/transport/chttp2/client/chttp2_connector.cc index c324c2c9243..6b6d299b6e2 100644 --- a/src/core/ext/transport/chttp2/client/chttp2_connector.cc +++ b/src/core/ext/transport/chttp2/client/chttp2_connector.cc @@ -111,15 +111,14 @@ static void on_handshake_done(void* arg, grpc_error* error) { } else { error = GRPC_ERROR_REF(error); } - memset(c->result, 0, sizeof(*c->result)); + c->result->reset(); } else { grpc_endpoint_delete_from_pollset_set(args->endpoint, c->args.interested_parties); c->result->transport = grpc_create_chttp2_transport(args->args, args->endpoint, true); - grpc_core::RefCountedPtr socket_node = + c->result->socket = grpc_chttp2_transport_get_socket_node(c->result->transport); - c->result->socket_uuid = socket_node == nullptr ? 0 : socket_node->uuid(); GPR_ASSERT(c->result->transport); // TODO(roth): We ideally want to wait until we receive HTTP/2 // settings from the server before we consider the connection @@ -180,7 +179,7 @@ static void connected(void* arg, grpc_error* error) { } else { error = GRPC_ERROR_REF(error); } - memset(c->result, 0, sizeof(*c->result)); + c->result->reset(); grpc_closure* notify = c->notify; c->notify = nullptr; GRPC_CLOSURE_SCHED(notify, error); diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc index dc60ec2487b..5e9cd77d18a 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.cc +++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc @@ -317,7 +317,7 @@ static grpc_error* chttp2_server_add_acceptor(grpc_server* server, *arg_val = grpc_tcp_server_create_fd_handler(tcp_server); grpc_server_add_listener(server, state, server_start_listener, - server_destroy_listener, /* socket_uuid */ 0); + server_destroy_listener, /* node */ nullptr); return err; /* Error path: cleanup and return */ @@ -345,7 +345,6 @@ grpc_error* grpc_chttp2_server_add_port(grpc_server* server, const char* addr, grpc_error** errors = nullptr; size_t naddrs = 0; const grpc_arg* arg = nullptr; - intptr_t socket_uuid = 0; *port_num = -1; @@ -413,15 +412,18 @@ grpc_error* grpc_chttp2_server_add_port(grpc_server* server, const char* addr, arg = grpc_channel_args_find(args, GRPC_ARG_ENABLE_CHANNELZ); if (grpc_channel_arg_get_bool(arg, GRPC_ENABLE_CHANNELZ_DEFAULT)) { + char* socket_name = nullptr; + gpr_asprintf(&socket_name, "chttp2 listener %s", addr); state->channelz_listen_socket = grpc_core::MakeRefCounted( - grpc_core::UniquePtr(gpr_strdup(addr))); - socket_uuid = state->channelz_listen_socket->uuid(); + grpc_core::UniquePtr(gpr_strdup(addr)), + grpc_core::UniquePtr(socket_name)); } /* Register with the server only upon success */ grpc_server_add_listener(server, state, server_start_listener, - server_destroy_listener, socket_uuid); + server_destroy_listener, + state->channelz_listen_socket); goto done; /* Error path: cleanup and return */ diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 43f2db1309f..67b6e18bcff 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -378,10 +378,13 @@ static bool read_channel_args(grpc_chttp2_transport* t, if (channelz_enabled) { // TODO(ncteisen): add an API to endpoint to query for local addr, and pass // it in here, so SocketNode knows its own address. + char* socket_name = nullptr; + gpr_asprintf(&socket_name, "%s %s", get_vtable()->name, t->peer_string); t->channelz_socket = grpc_core::MakeRefCounted( grpc_core::UniquePtr(), - grpc_core::UniquePtr(gpr_strdup(t->peer_string))); + grpc_core::UniquePtr(gpr_strdup(t->peer_string)), + grpc_core::UniquePtr(socket_name)); } return enable_bdp; } diff --git a/src/core/lib/channel/channelz.cc b/src/core/lib/channel/channelz.cc index f03c9adba26..325131b8439 100644 --- a/src/core/lib/channel/channelz.cc +++ b/src/core/lib/channel/channelz.cc @@ -85,7 +85,8 @@ intptr_t GetParentUuidFromArgs(const grpc_channel_args& args) { // BaseNode // -BaseNode::BaseNode(EntityType type) : type_(type), uuid_(-1) { +BaseNode::BaseNode(EntityType type, UniquePtr name) + : type_(type), uuid_(-1), name_(std::move(name)) { // The registry will set uuid_ under its lock. ChannelzRegistry::Register(this); } @@ -187,7 +188,8 @@ void CallCountingHelper::PopulateCallCounts(grpc_json* json) { ChannelNode::ChannelNode(UniquePtr target, size_t channel_tracer_max_nodes, intptr_t parent_uuid) : BaseNode(parent_uuid == 0 ? EntityType::kTopLevelChannel - : EntityType::kInternalChannel), + : EntityType::kInternalChannel, + UniquePtr(gpr_strdup(target.get()))), target_(std::move(target)), trace_(channel_tracer_max_nodes), parent_uuid_(parent_uuid) {} @@ -320,7 +322,8 @@ void ChannelNode::RemoveChildSubchannel(intptr_t child_uuid) { // ServerNode::ServerNode(grpc_server* server, size_t channel_tracer_max_nodes) - : BaseNode(EntityType::kServer), trace_(channel_tracer_max_nodes) {} + : BaseNode(EntityType::kServer, /* name */ nullptr), + trace_(channel_tracer_max_nodes) {} ServerNode::~ServerNode() {} @@ -334,9 +337,9 @@ void ServerNode::RemoveChildSocket(intptr_t child_uuid) { child_sockets_.erase(child_uuid); } -void ServerNode::AddChildListenSocket(intptr_t child_uuid) { +void ServerNode::AddChildListenSocket(RefCountedPtr node) { MutexLock lock(&child_mu_); - child_listen_sockets_.insert(MakePair(child_uuid, true)); + child_listen_sockets_.insert(MakePair(node->uuid(), std::move(node))); } void ServerNode::RemoveChildListenSocket(intptr_t child_uuid) { @@ -366,7 +369,7 @@ char* ServerNode::RenderServerSockets(intptr_t start_socket_id, json_iterator = grpc_json_add_number_string_child( socket_ref_json, nullptr, "socketId", it->first); grpc_json_create_child(json_iterator, socket_ref_json, "name", - it->second->remote(), GRPC_JSON_STRING, false); + it->second->name(), GRPC_JSON_STRING, false); } } if (sockets_rendered == child_sockets_.size()) { @@ -416,8 +419,10 @@ grpc_json* ServerNode::RenderJson() { json_iterator = grpc_json_create_child(json_iterator, array_parent, nullptr, nullptr, GRPC_JSON_OBJECT, false); - grpc_json_add_number_string_child(json_iterator, nullptr, "socketId", - it.first); + grpc_json* sibling_iterator = grpc_json_add_number_string_child( + json_iterator, nullptr, "socketId", it.first); + grpc_json_create_child(sibling_iterator, json_iterator, "name", + it.second->name(), GRPC_JSON_STRING, false); } } return top_level_json; @@ -480,8 +485,9 @@ void PopulateSocketAddressJson(grpc_json* json, const char* name, } // namespace -SocketNode::SocketNode(UniquePtr local, UniquePtr remote) - : BaseNode(EntityType::kSocket), +SocketNode::SocketNode(UniquePtr local, UniquePtr remote, + UniquePtr name) + : BaseNode(EntityType::kSocket, std::move(name)), local_(std::move(local)), remote_(std::move(remote)) {} @@ -521,6 +527,8 @@ grpc_json* SocketNode::RenderJson() { json_iterator = nullptr; json_iterator = grpc_json_add_number_string_child(json, json_iterator, "socketId", uuid()); + json_iterator = grpc_json_create_child(json_iterator, json, "name", name(), + GRPC_JSON_STRING, false); json = top_level_json; PopulateSocketAddressJson(json, "remote", remote_.get()); PopulateSocketAddressJson(json, "local", local_.get()); @@ -600,8 +608,10 @@ grpc_json* SocketNode::RenderJson() { // ListenSocketNode // -ListenSocketNode::ListenSocketNode(UniquePtr local_addr) - : BaseNode(EntityType::kSocket), local_addr_(std::move(local_addr)) {} +ListenSocketNode::ListenSocketNode(UniquePtr local_addr, + UniquePtr name) + : BaseNode(EntityType::kSocket, std::move(name)), + local_addr_(std::move(local_addr)) {} grpc_json* ListenSocketNode::RenderJson() { // We need to track these three json objects to build our object @@ -615,6 +625,8 @@ grpc_json* ListenSocketNode::RenderJson() { json_iterator = nullptr; json_iterator = grpc_json_add_number_string_child(json, json_iterator, "socketId", uuid()); + json_iterator = grpc_json_create_child(json_iterator, json, "name", name(), + GRPC_JSON_STRING, false); json = top_level_json; PopulateSocketAddressJson(json, "local", local_addr_.get()); diff --git a/src/core/lib/channel/channelz.h b/src/core/lib/channel/channelz.h index b0b137a1ec8..e1af701834d 100644 --- a/src/core/lib/channel/channelz.h +++ b/src/core/lib/channel/channelz.h @@ -59,6 +59,7 @@ grpc_arg MakeParentUuidArg(intptr_t parent_uuid); intptr_t GetParentUuidFromArgs(const grpc_channel_args& args); class SocketNode; +class ListenSocketNode; namespace testing { class CallCountingHelperPeer; @@ -79,7 +80,7 @@ class BaseNode : public RefCounted { kSocket, }; - explicit BaseNode(EntityType type); + BaseNode(EntityType type, UniquePtr name); virtual ~BaseNode(); // All children must implement this function. @@ -91,12 +92,14 @@ class BaseNode : public RefCounted { EntityType type() const { return type_; } intptr_t uuid() const { return uuid_; } + const char* name() const { return name_.get(); } private: // to allow the ChannelzRegistry to set uuid_ under its lock. friend class ChannelzRegistry; const EntityType type_; intptr_t uuid_; + UniquePtr name_; }; // This class is a helper class for channelz entities that deal with Channels, @@ -172,9 +175,13 @@ class ChannelNode : public BaseNode { void SetConnectivityState(grpc_connectivity_state state); + // TODO(roth): take in a RefCountedPtr to the child channel so we can retrieve + // the human-readable name. void AddChildChannel(intptr_t child_uuid); void RemoveChildChannel(intptr_t child_uuid); + // TODO(roth): take in a RefCountedPtr to the child subchannel so we can + // retrieve the human-readable name. void AddChildSubchannel(intptr_t child_uuid); void RemoveChildSubchannel(intptr_t child_uuid); @@ -212,14 +219,11 @@ class ServerNode : public BaseNode { char* RenderServerSockets(intptr_t start_socket_id, intptr_t max_results); - void AddChildSocket(RefCountedPtr); + void AddChildSocket(RefCountedPtr node); void RemoveChildSocket(intptr_t child_uuid); - // TODO(ncteisen): This only takes in the uuid of the child socket for now, - // since that is all that is strictly needed. In a future enhancement we will - // add human readable names as in the channelz.proto - void AddChildListenSocket(intptr_t child_uuid); + void AddChildListenSocket(RefCountedPtr node); void RemoveChildListenSocket(intptr_t child_uuid); @@ -242,16 +246,14 @@ class ServerNode : public BaseNode { ChannelTrace trace_; Mutex child_mu_; // Guards child maps below. Map> child_sockets_; - // TODO(roth): We don't actually use the values here, only the keys, so - // these should be sets instead of maps, but we don't currently have a set - // implementation. Change this if/when we have one. - Map child_listen_sockets_; + Map> child_listen_sockets_; }; // Handles channelz bookkeeping for sockets class SocketNode : public BaseNode { public: - SocketNode(UniquePtr local, UniquePtr remote); + SocketNode(UniquePtr local, UniquePtr remote, + UniquePtr name); ~SocketNode() override {} grpc_json* RenderJson() override; @@ -290,8 +292,7 @@ class SocketNode : public BaseNode { // Handles channelz bookkeeping for listen sockets class ListenSocketNode : public BaseNode { public: - // ListenSocketNode takes ownership of host. - explicit ListenSocketNode(UniquePtr local_addr); + ListenSocketNode(UniquePtr local_addr, UniquePtr name); ~ListenSocketNode() override {} grpc_json* RenderJson() override; diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index 702853e0afe..db2d291bc59 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -1395,20 +1395,22 @@ void grpc_server_destroy(grpc_server* server) { server_unref(server); } -void grpc_server_add_listener(grpc_server* server, void* arg, - void (*start)(grpc_server* server, void* arg, - grpc_pollset** pollsets, - size_t pollset_count), - void (*destroy)(grpc_server* server, void* arg, - grpc_closure* on_done), - intptr_t socket_uuid) { +void grpc_server_add_listener( + grpc_server* server, void* listener_arg, + void (*start)(grpc_server* server, void* arg, grpc_pollset** pollsets, + size_t pollset_count), + void (*destroy)(grpc_server* server, void* arg, grpc_closure* on_done), + grpc_core::RefCountedPtr node) { listener* l = static_cast(gpr_malloc(sizeof(listener))); - l->arg = arg; + l->arg = listener_arg; l->start = start; l->destroy = destroy; - l->socket_uuid = socket_uuid; - if (server->channelz_server != nullptr && socket_uuid != 0) { - server->channelz_server->AddChildListenSocket(socket_uuid); + l->socket_uuid = 0; + if (node != nullptr) { + l->socket_uuid = node->uuid(); + if (server->channelz_server != nullptr) { + server->channelz_server->AddChildListenSocket(std::move(node)); + } } l->next = server->listeners; server->listeners = l; diff --git a/src/core/lib/surface/server.h b/src/core/lib/surface/server.h index 67ad0310a96..2285821e11b 100644 --- a/src/core/lib/surface/server.h +++ b/src/core/lib/surface/server.h @@ -34,13 +34,12 @@ extern grpc_core::TraceFlag grpc_server_channel_trace; /* Add a listener to the server: when the server starts, it will call start, and when it shuts down, it will call destroy */ -void grpc_server_add_listener(grpc_server* server, void* listener, - void (*start)(grpc_server* server, void* arg, - grpc_pollset** pollsets, - size_t npollsets), - void (*destroy)(grpc_server* server, void* arg, - grpc_closure* on_done), - intptr_t socket_uuid); +void grpc_server_add_listener( + grpc_server* server, void* listener_arg, + void (*start)(grpc_server* server, void* arg, grpc_pollset** pollsets, + size_t npollsets), + void (*destroy)(grpc_server* server, void* arg, grpc_closure* on_done), + grpc_core::RefCountedPtr node); /* Setup a transport - creates a channel stack, binds the transport to the server */ diff --git a/test/core/channel/channelz_registry_test.cc b/test/core/channel/channelz_registry_test.cc index deb85d85624..995182da249 100644 --- a/test/core/channel/channelz_registry_test.cc +++ b/test/core/channel/channelz_registry_test.cc @@ -53,7 +53,7 @@ class ChannelzRegistryTest : public ::testing::Test { TEST_F(ChannelzRegistryTest, UuidStartsAboveZeroTest) { RefCountedPtr channelz_channel = - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel); + MakeRefCounted(BaseNode::EntityType::kTopLevelChannel, nullptr); intptr_t uuid = channelz_channel->uuid(); EXPECT_GT(uuid, 0) << "First uuid chose must be greater than zero. Zero if " "reserved according to " @@ -65,8 +65,8 @@ TEST_F(ChannelzRegistryTest, UuidsAreIncreasing) { std::vector> channelz_channels; channelz_channels.reserve(10); for (int i = 0; i < 10; ++i) { - channelz_channels.push_back( - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel)); + channelz_channels.push_back(MakeRefCounted( + BaseNode::EntityType::kTopLevelChannel, nullptr)); } for (size_t i = 1; i < channelz_channels.size(); ++i) { EXPECT_LT(channelz_channels[i - 1]->uuid(), channelz_channels[i]->uuid()) @@ -76,7 +76,7 @@ TEST_F(ChannelzRegistryTest, UuidsAreIncreasing) { TEST_F(ChannelzRegistryTest, RegisterGetTest) { RefCountedPtr channelz_channel = - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel); + MakeRefCounted(BaseNode::EntityType::kTopLevelChannel, nullptr); RefCountedPtr retrieved = ChannelzRegistry::Get(channelz_channel->uuid()); EXPECT_EQ(channelz_channel, retrieved); @@ -85,8 +85,8 @@ TEST_F(ChannelzRegistryTest, RegisterGetTest) { TEST_F(ChannelzRegistryTest, RegisterManyItems) { std::vector> channelz_channels; for (int i = 0; i < 100; i++) { - channelz_channels.push_back( - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel)); + channelz_channels.push_back(MakeRefCounted( + BaseNode::EntityType::kTopLevelChannel, nullptr)); RefCountedPtr retrieved = ChannelzRegistry::Get(channelz_channels[i]->uuid()); EXPECT_EQ(channelz_channels[i], retrieved); @@ -95,7 +95,7 @@ TEST_F(ChannelzRegistryTest, RegisterManyItems) { TEST_F(ChannelzRegistryTest, NullIfNotPresentTest) { RefCountedPtr channelz_channel = - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel); + MakeRefCounted(BaseNode::EntityType::kTopLevelChannel, nullptr); // try to pull out a uuid that does not exist. RefCountedPtr nonexistant = ChannelzRegistry::Get(channelz_channel->uuid() + 1); @@ -117,10 +117,10 @@ TEST_F(ChannelzRegistryTest, TestUnregistration) { std::vector> odd_channels; odd_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { - even_channels.push_back( - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel)); - odd_channels.push_back( - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel)); + even_channels.push_back(MakeRefCounted( + BaseNode::EntityType::kTopLevelChannel, nullptr)); + odd_channels.push_back(MakeRefCounted( + BaseNode::EntityType::kTopLevelChannel, nullptr)); odd_uuids.push_back(odd_channels[i]->uuid()); } } @@ -137,8 +137,8 @@ TEST_F(ChannelzRegistryTest, TestUnregistration) { std::vector> more_channels; more_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { - more_channels.push_back( - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel)); + more_channels.push_back(MakeRefCounted( + BaseNode::EntityType::kTopLevelChannel, nullptr)); RefCountedPtr retrieved = ChannelzRegistry::Get(more_channels[i]->uuid()); EXPECT_EQ(more_channels[i], retrieved); diff --git a/test/cpp/end2end/channelz_service_test.cc b/test/cpp/end2end/channelz_service_test.cc index 69c56c574f9..1ed2d8c65f2 100644 --- a/test/cpp/end2end/channelz_service_test.cc +++ b/test/cpp/end2end/channelz_service_test.cc @@ -571,6 +571,8 @@ TEST_F(ChannelzServerTest, ManySubchannelsAndSockets) { get_subchannel_resp.subchannel().socket_ref(0).socket_id()); s = channelz_stub_->GetSocket(&get_socket_ctx, get_socket_req, &get_socket_resp); + EXPECT_TRUE( + get_subchannel_resp.subchannel().socket_ref(0).name().find("http")); EXPECT_TRUE(s.ok()) << s.error_message(); // calls started == streams started AND stream succeeded. Since none of // these RPCs were canceled, all of the streams will succeeded even though @@ -626,6 +628,8 @@ TEST_F(ChannelzServerTest, StreamingRPC) { ClientContext get_socket_context; get_socket_request.set_socket_id( get_subchannel_response.subchannel().socket_ref(0).socket_id()); + EXPECT_TRUE( + get_subchannel_response.subchannel().socket_ref(0).name().find("http")); s = channelz_stub_->GetSocket(&get_socket_context, get_socket_request, &get_socket_response); EXPECT_TRUE(s.ok()) << "s.error_message() = " << s.error_message(); @@ -659,6 +663,7 @@ TEST_F(ChannelzServerTest, GetServerSocketsTest) { &get_server_sockets_response); EXPECT_TRUE(s.ok()) << "s.error_message() = " << s.error_message(); EXPECT_EQ(get_server_sockets_response.socket_ref_size(), 1); + EXPECT_TRUE(get_server_sockets_response.socket_ref(0).name().find("http")); } TEST_F(ChannelzServerTest, GetServerSocketsPaginationTest) { @@ -738,6 +743,8 @@ TEST_F(ChannelzServerTest, GetServerListenSocketsTest) { GetSocketResponse get_socket_response; get_socket_request.set_socket_id( get_server_response.server(0).listen_socket(0).socket_id()); + EXPECT_TRUE( + get_server_response.server(0).listen_socket(0).name().find("http")); ClientContext get_socket_context; s = channelz_stub_->GetSocket(&get_socket_context, get_socket_request, &get_socket_response); From 44868ae12ad93544bd483360fe6b2e49054caf5b Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 30 Jul 2019 16:28:14 -0700 Subject: [PATCH 140/661] Starting a new branch with same changes from https://github.com/grpc/grpc/pull/19621 --- WORKSPACE | 7 + bazel/generate_objc.bzl | 215 +++++++++ bazel/grpc_build_system.bzl | 50 +++ bazel/grpc_deps.bzl | 8 + bazel/grpc_util.bzl | 46 ++ bazel/objc_grpc_library.bzl | 68 +++ src/objective-c/BUILD | 96 ++++ src/objective-c/examples/BUILD | 69 +++ .../BazelBuildSamples/ios-sample/Podfile | 31 ++ .../ios-sample.xcodeproj/project.pbxproj | 413 ++++++++++++++++++ .../ios-sample/ios-sample/AppDelegate.h | 25 ++ .../ios-sample/ios-sample/AppDelegate.m | 63 +++ .../AppIcon.appiconset/Contents.json | 98 +++++ .../ios-sample/Assets.xcassets/Contents.json | 6 + .../Base.lproj/LaunchScreen.storyboard | 25 ++ .../ios-sample/Base.lproj/Main.storyboard | 38 ++ .../ios-sample/ios-sample/Info.plist | 45 ++ .../ios-sample/ios-sample/ViewController.h | 23 + .../ios-sample/ios-sample/ViewController.m | 86 ++++ .../ios-sample/ios-sample/main.m | 26 ++ .../examples/BazelBuildSamples/messages.proto | 118 +++++ .../examples/BazelBuildSamples/rmt/BUILD | 28 ++ .../examples/BazelBuildSamples/rmt/test.proto | 57 +++ 23 files changed, 1641 insertions(+) create mode 100644 bazel/generate_objc.bzl create mode 100644 bazel/grpc_util.bzl create mode 100644 bazel/objc_grpc_library.bzl create mode 100644 src/objective-c/BUILD create mode 100644 src/objective-c/examples/BUILD create mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/Podfile create mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample.xcodeproj/project.pbxproj create mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.h create mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.m create mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/Contents.json create mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/LaunchScreen.storyboard create mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/Main.storyboard create mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Info.plist create mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.h create mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.m create mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/main.m create mode 100644 src/objective-c/examples/BazelBuildSamples/messages.proto create mode 100644 src/objective-c/examples/BazelBuildSamples/rmt/BUILD create mode 100644 src/objective-c/examples/BazelBuildSamples/rmt/test.proto diff --git a/WORKSPACE b/WORKSPACE index e8ec470efec..6cfa9d67b75 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -76,3 +76,10 @@ api_dependencies() load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains") go_rules_dependencies() go_register_toolchains() + + +load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies") +apple_rules_dependencies() + +load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") +apple_support_dependencies() \ No newline at end of file diff --git a/bazel/generate_objc.bzl b/bazel/generate_objc.bzl new file mode 100644 index 00000000000..6140015a1fa --- /dev/null +++ b/bazel/generate_objc.bzl @@ -0,0 +1,215 @@ +load( + "//bazel:protobuf.bzl", + "get_include_protoc_args", + "get_plugin_args", + "proto_path_to_generated_filename", +) +load(":grpc_util.bzl", "to_upper_camel_with_extension",) + +_GRPC_PROTO_HEADER_FMT = "{}.pbrpc.h" +_GRPC_PROTO_SRC_FMT = "{}.pbrpc.m" +_PROTO_HEADER_FMT = "{}.pbobjc.h" +_PROTO_SRC_FMT = "{}.pbobjc.m" +_GENERATED_PROTOS_DIR = "_generated_protos" + +_GENERATE_HDRS = 1 +_GENERATE_SRCS = 2 +_GENERATE_NON_ARC_SRCS = 3 + +def _generate_objc_impl(ctx): + """Implementation of the generate_objc rule.""" + protos = [ + f + for src in ctx.attr.deps + for f in src[ProtoInfo].transitive_imports.to_list() + ] + + target_package = _join_directories([ctx.label.workspace_root, ctx.label.package]) + + files_with_rpc = [_label_to_full_file_path(f, target_package) for f in ctx.attr.srcs] + + outs = [] + for proto in protos: + outs += [_get_output_file_name_from_proto(proto, _PROTO_HEADER_FMT)] + outs += [_get_output_file_name_from_proto(proto, _PROTO_SRC_FMT)] + + file_path = _get_full_path_from_file(proto) + if file_path in files_with_rpc: + outs += [_get_output_file_name_from_proto(proto, _GRPC_PROTO_HEADER_FMT)] + outs += [_get_output_file_name_from_proto(proto, _GRPC_PROTO_SRC_FMT)] + + out_files = [ctx.actions.declare_file(out) for out in outs] + dir_out = _join_directories([ + str(ctx.genfiles_dir.path), target_package, _GENERATED_PROTOS_DIR + ]) + + arguments = [] + if ctx.executable.plugin: + arguments += get_plugin_args( + ctx.executable.plugin, + [], + dir_out, + False, + ) + tools = [ctx.executable.plugin] + arguments += ["--objc_out=" + dir_out] + + arguments += ["--proto_path=."] + arguments += get_include_protoc_args(protos) + # Include the output directory so that protoc puts the generated code in the + # right directory. + arguments += ["--proto_path={}".format(dir_out)] + arguments += ["--proto_path={}".format(_get_directory_from_proto(proto)) for proto in protos] + arguments += [_get_full_path_from_file(proto) for proto in protos] + + # create a list of well known proto files if the argument is non-None + well_known_proto_files = [] + if ctx.attr.use_well_known_protos: + f = ctx.attr.well_known_protos.files.to_list()[0].dirname + # go two levels up so that #import "google/protobuf/..." is correct + arguments += ["-I{0}".format(f + "/../..")] + well_known_proto_files = ctx.attr.well_known_protos.files.to_list() + ctx.actions.run( + inputs = protos + well_known_proto_files, + tools = tools, + outputs = out_files, + executable = ctx.executable._protoc, + arguments = arguments, + ) + + return struct(files = depset(out_files)) + +def _label_to_full_file_path(src, package): + if not src.startswith("//"): + # Relative from current package + if not src.startswith(":"): + # "a.proto" -> ":a.proto" + src = ":" + src + src = "//" + package + src + # Converts //path/to/package:File.ext to path/to/package/File.ext. + src = src.replace("//", "") + src = src.replace(":", "/") + if src.startswith("/"): + # "//:a.proto" -> "/a.proto" so remove the initial slash + return src[1:] + else: + return src + +def _get_output_file_name_from_proto(proto, fmt): + return proto_path_to_generated_filename( + _GENERATED_PROTOS_DIR + "/" + + _get_directory_from_proto(proto) + _get_slash_or_null_from_proto(proto) + + to_upper_camel_with_extension(_get_file_name_from_proto(proto), "proto"), + fmt, + ) + +def _get_file_name_from_proto(proto): + return proto.path.rpartition("/")[2] + +def _get_slash_or_null_from_proto(proto): + """Potentially returns empty (if the file is in the root directory)""" + return proto.path.rpartition("/")[1] + +def _get_directory_from_proto(proto): + return proto.path.rpartition("/")[0] + +def _get_full_path_from_file(file): + gen_dir_length = 0 + # if file is generated, then prepare to remote its root + # (including CPU architecture...) + if not file.is_source: + gen_dir_length = len(file.root.path) + 1 + + return file.path[gen_dir_length:] + +def _join_directories(directories): + massaged_directories = [directory for directory in directories if len(directory) != 0] + return "/".join(massaged_directories) + + +generate_objc = rule( + attrs = { + "deps": attr.label_list( + mandatory = True, + allow_empty = False, + providers = [ProtoInfo], + ), + "plugin": attr.label( + default = "@com_github_grpc_grpc//src/compiler:grpc_objective_c_plugin", + executable = True, + providers = ["files_to_run"], + cfg = "host", + ), + "srcs": attr.string_list( + mandatory = False, + allow_empty = True + ), + "use_well_known_protos": attr.bool( + mandatory = False, + default = False + ), + "well_known_protos": attr.label( + default = "@com_google_protobuf//:well_known_protos" + ), + "_protoc": attr.label( + default = Label("//external:protocol_compiler"), + executable = True, + cfg = "host", + ), + }, + output_to_genfiles = True, + implementation = _generate_objc_impl +) + +def _group_objc_files_impl(ctx): + suffix = "" + if ctx.attr.gen_mode == _GENERATE_HDRS: + suffix = "h" + elif ctx.attr.gen_mode == _GENERATE_SRCS: + suffix = "pbrpc.m" + elif ctx.attr.gen_mode == _GENERATE_NON_ARC_SRCS: + suffix = "pbobjc.m" + else: + fail("Undefined gen_mode") + out_files = [ + file + for file in ctx.attr.src.files.to_list() + if file.basename.endswith(suffix) + ] + return struct(files = depset(out_files)) + +generate_objc_hdrs = rule( + attrs = { + "src": attr.label( + mandatory = True, + ), + "gen_mode": attr.int( + default = _GENERATE_HDRS, + ) + }, + implementation = _group_objc_files_impl +) + +generate_objc_srcs = rule( + attrs = { + "src": attr.label( + mandatory = True, + ), + "gen_mode": attr.int( + default = _GENERATE_SRCS, + ) + }, + implementation = _group_objc_files_impl +) + +generate_objc_non_arc_srcs = rule( + attrs = { + "src": attr.label( + mandatory = True, + ), + "gen_mode": attr.int( + default = _GENERATE_NON_ARC_SRCS, + ) + }, + implementation = _group_objc_files_impl +) diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 9fc4b1a26db..9e967d8fa9a 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -24,6 +24,7 @@ # load("//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library") # The set of pollers to test against if a test exercises polling @@ -198,6 +199,19 @@ def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], da ) def grpc_generate_one_off_targets(): + apple_resource_bundle( + # The choice of name is signicant here, since it determines the bundle name. + name = "gRPCCertificates", + resources = ["etc/roots.pem"], + ) + + # In open-source, grpc_objc* libraries depend directly on //:grpc + native.alias( + name = "grpc_objc", + actual = "//:grpc", + ) + +def grpc_objc_use_cronet_config(): pass def grpc_sh_test(name, srcs, args = [], data = []): @@ -240,6 +254,42 @@ def grpc_package(name, visibility = "private", features = []): features = features, ) +def grpc_objc_library( + name, + srcs, + hdrs = [], + textual_hdrs = [], + data = [], + deps = [], + defines = [], + includes = [], + visibility = ["//visibility:public"]): + """The grpc version of objc_library, only used for the Objective-C library compilation + + Args: + name: name of target + hdrs: public headers + srcs: all source files (.m) + textual_hdrs: private headers + data: any other bundle resources + defines: preprocessors + includes: added to search path, always [the path to objc directory] + deps: dependencies + visibility: visibility, default to public + """ + + native.objc_library( + name = name, + hdrs = hdrs, + srcs = srcs, + textual_hdrs = textual_hdrs, + data = data, + deps = deps, + defines = defines, + includes = includes, + visibility = visibility, + ) + def grpc_upb_proto_library(name, deps): upb_proto_library(name = name, deps = deps) diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index b8df184f734..cce2f88fe87 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -224,6 +224,14 @@ def grpc_deps(): urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz"], sha256 = "a82a352bffae6bee4e95f68a8d80a70e87f42c4741e6a448bec11998fcc82329", ) + + if "build_bazel_rules_apple" not in native.existing_rules(): + git_repository( + name = "build_bazel_rules_apple", + remote = "https://github.com/bazelbuild/rules_apple.git", + tag = "0.17.2", + ) + # TODO: move some dependencies from "grpc_deps" here? def grpc_test_only_deps(): """Internal, not intended for use by packages that are consuming grpc. diff --git a/bazel/grpc_util.bzl b/bazel/grpc_util.bzl new file mode 100644 index 00000000000..779747c8719 --- /dev/null +++ b/bazel/grpc_util.bzl @@ -0,0 +1,46 @@ +# Follows convention set in objectivec_helpers.cc in the protobuf ObjC compiler. +_upper_segments_list = ["url", "http", "https"] + +def strip_extension(str): + return str.rpartition(".")[0] + +def capitalize(word): + if word in _upper_segments_list: + return word.upper() + else: + return word.capitalize() + +def lower_underscore_to_upper_camel(str): + str = strip_extension(str) + camel_case_str = "" + word = "" + for c in str.elems(): # NB: assumes ASCII! + if c.isalpha(): + word += c.lower() + else: + # Last word is finished. + if len(word): + camel_case_str += capitalize(word) + word = "" + if c.isdigit(): + camel_case_str += c + + # Otherwise, drop the character. See UnderscoresToCamelCase in: + # third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc + + if len(word): + camel_case_str += capitalize(word) + return camel_case_str + +def file_to_upper_camel(src): + elements = src.rpartition("/") + upper_camel = lower_underscore_to_upper_camel(elements[-1]) + return "".join(list(elements[:-1]) + [upper_camel]) + +def file_with_extension(src, ext): + elements = src.rpartition("/") + return "".join(list(elements[:-1]) + [elements[-1], "." + ext]) + +def to_upper_camel_with_extension(src, ext): + src = file_to_upper_camel(src) + return file_with_extension(src, ext) diff --git a/bazel/objc_grpc_library.bzl b/bazel/objc_grpc_library.bzl new file mode 100644 index 00000000000..7647ab08053 --- /dev/null +++ b/bazel/objc_grpc_library.bzl @@ -0,0 +1,68 @@ +load( + "//bazel:generate_objc.bzl", + "generate_objc", + "generate_objc_hdrs", + "generate_objc_srcs", + "generate_objc_non_arc_srcs" +) +load("//bazel:protobuf.bzl", "well_known_proto_libs") + +def objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kwargs): + """Generates messages and/or service stubs for given proto_library and all transitively dependent proto files + + Args: + name: name of target + deps: a list of proto_library targets that needs to be compiled + srcs: a list of labels to proto files with service stubs to be generated, + labels specified must include service stubs; otherwise Bazel will complain about srcs being empty + use_well_known_protos: whether to use the well known protos defined in + @com_google_protobuf//src/google/protobuf, default to false + **kwargs: other arguments + """ + objc_grpc_library_name = "_" + name + "_objc_grpc_library" + + generate_objc( + name = objc_grpc_library_name, + srcs = srcs, + deps = deps, + use_well_known_protos = use_well_known_protos, + **kwargs + ) + + generate_objc_hdrs( + name = objc_grpc_library_name + "_hdrs", + src = ":" + objc_grpc_library_name, + ) + + generate_objc_non_arc_srcs( + name = objc_grpc_library_name + "_non_arc_srcs", + src = ":" + objc_grpc_library_name, + ) + + arc_srcs = None + if len(srcs) > 0: + generate_objc_srcs( + name = objc_grpc_library_name + "_srcs", + src = ":" + objc_grpc_library_name, + ) + arc_srcs = [":" + objc_grpc_library_name + "_srcs"] + + native.objc_library( + name = name, + hdrs = [":" + objc_grpc_library_name + "_hdrs"], + non_arc_srcs = [":" + objc_grpc_library_name + "_non_arc_srcs"], + srcs = arc_srcs, + defines = [ + "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0", + "GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO=0", + ], + includes = [ + "_generated_protos", + "src/objective-c", + ], + deps = [ + "@com_github_grpc_grpc//src/objective-c:proto_objc_rpc", + "@com_google_protobuf//:protobuf_objc", + ], + ) + diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD new file mode 100644 index 00000000000..2492ce8a21f --- /dev/null +++ b/src/objective-c/BUILD @@ -0,0 +1,96 @@ +# gRPC Bazel BUILD file. +# +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +licenses(["notice"]) # Apache v2 + +package(default_visibility = ["//visibility:public"]) + +load("//bazel:grpc_build_system.bzl", "grpc_objc_library", "grpc_objc_use_cronet_config") + +exports_files(["LICENSE"]) + +grpc_objc_use_cronet_config() + +grpc_objc_library( + name = "rx_library", + srcs = glob([ + "RxLibrary/*.m", + "RxLibrary/transformations/*.m", + ]), + hdrs = glob([ + "RxLibrary/*.h", + "RxLibrary/transformations/*.h", + ]), + includes = ["."], + deps = [":rx_library_private"], +) + +grpc_objc_library( + name = "rx_library_private", + srcs = glob([ + "RxLibrary/private/*.m", + ]), + textual_hdrs = glob([ + "RxLibrary/private/*.h", + ]), + visibility = ["//visibility:private"], +) + +grpc_objc_library( + name = "grpc_objc_client", + srcs = glob( + [ + "GRPCClient/*.m", + "GRPCClient/private/*.m", + ], + exclude = ["GRPCClient/GRPCCall+GID.m"], + ), + hdrs = glob( + [ + "GRPCClient/*.h", + "GRPCClient/internal/*.h", + ], + exclude = ["GRPCClient/GRPCCall+GID.h"], + ), + data = ["//:gRPCCertificates"], + includes = ["."], + textual_hdrs = glob([ + "GRPCClient/private/*.h", + ]), + deps = [ + ":rx_library", + "//:grpc_objc", + ], +) + +grpc_objc_library( + name = "proto_objc_rpc", + srcs = glob( + ["ProtoRPC/*.m"], + ), + hdrs = glob( + ["ProtoRPC/*.h"], + ), + # Different from Cocoapods, do not import as if @com_google_protobuf//:protobuf_objc is a framework, + # use the real paths of @com_google_protobuf//:protobuf_objc instead + defines = ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0"], + includes = ["src/objective-c"], + deps = [ + ":grpc_objc_client", + ":rx_library", + "@com_google_protobuf//:protobuf_objc", + ], +) diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD new file mode 100644 index 00000000000..27ddfcd6031 --- /dev/null +++ b/src/objective-c/examples/BUILD @@ -0,0 +1,69 @@ +# gRPC Bazel BUILD file. +# +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") +load( + "@com_github_grpc_grpc//bazel:objc_grpc_library.bzl", + "objc_grpc_library", +) + +proto_library( + name = "messages_proto", + srcs = ["BazelBuildSamples/messages.proto"], + visibility = ["//visibility:public"], +) + +objc_grpc_library( + name = "test_grpc_objc", + srcs = ["BazelBuildSamples/rmt/test.proto"], + use_well_known_protos = True, + deps = [ + "//src/objective-c/examples/BazelBuildSamples/rmt:test_proto", + ], +) + +# Proof that without this works without srcs +objc_grpc_library( + name = "test_objc", + use_well_known_protos = True, + deps = [ + "//src/objective-c/examples/BazelBuildSamples/rmt:test_proto", + ] +) + +objc_library( + name = "ios-sample-lib", + srcs = glob(["BazelBuildSamples/ios-sample/ios-sample/**/*.m"]), + hdrs = glob(["BazelBuildSamples/ios-sample/ios-sample/**/*.h"]), + data = glob([ + "BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/**/*", + "BazelBuildSamples/ios-sample/ios-sample/Base.lproj/**/*" + ]), + deps = [ + ":test_grpc_objc", + ] +) + +ios_application( + name = "ios-sample", + bundle_id = "com.google.ios-sample-objc-bazel", + families = ["iphone"], + minimum_os_version = "9.0", + infoplists = ["BazelBuildSamples/ios-sample/ios-sample/Info.plist"], + visibility = ["//visibility:public"], + deps = [":ios-sample-lib"], +) \ No newline at end of file diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/Podfile b/src/objective-c/examples/BazelBuildSamples/ios-sample/Podfile new file mode 100644 index 00000000000..8648992d84f --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/ios-sample/Podfile @@ -0,0 +1,31 @@ +platform :ios, '8.0' + +install! 'cocoapods', :deterministic_uuids => false + +ROOT_DIR = '../../../../..' + +target 'ios-sample' do + pod 'gRPC-ProtoRPC', :path => ROOT_DIR + pod 'gRPC', :path => ROOT_DIR + pod 'gRPC-Core', :path => ROOT_DIR + pod 'gRPC-RxLibrary', :path => ROOT_DIR + pod 'RemoteTest', :path => "../../RemoteTestClient" + pod '!ProtoCompiler-gRPCPlugin', :path => "#{ROOT_DIR}/src/objective-c" +end + +pre_install do |installer| + grpc_core_spec = installer.pod_targets.find{|t| t.name.start_with?('gRPC-Core')}.root_spec + + src_root = "$(PODS_TARGET_SRCROOT)" + grpc_core_spec.pod_target_xcconfig = { + 'GRPC_SRC_ROOT' => src_root, + 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', + 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"', + # If we don't set these two settings, `include/grpc/support/time.h` and + # `src/core/lib/gpr/string.h` shadow the system `` and ``, breaking the + # build. + 'USE_HEADERMAP' => 'NO', + 'ALWAYS_SEARCH_USER_PATHS' => 'NO', + } +end + diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..05344a69bfc --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample.xcodeproj/project.pbxproj @@ -0,0 +1,413 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + AB433CC922D7E38000D579CC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AB433CC822D7E38000D579CC /* AppDelegate.m */; }; + AB433CCC22D7E38000D579CC /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB433CCB22D7E38000D579CC /* ViewController.m */; }; + AB433CCF22D7E38000D579CC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB433CCD22D7E38000D579CC /* Main.storyboard */; }; + AB433CD122D7E38100D579CC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AB433CD022D7E38100D579CC /* Assets.xcassets */; }; + AB433CD422D7E38100D579CC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB433CD222D7E38100D579CC /* LaunchScreen.storyboard */; }; + AB433CD722D7E38100D579CC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AB433CD622D7E38100D579CC /* main.m */; }; + ED11F6CDF54788FC7CFD87B1 /* libPods-ios-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AF80A181E30BD84FA56BE33 /* libPods-ios-sample.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 112D4595FA3E81552DA9E877 /* Pods-ios-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios-sample.release.xcconfig"; path = "Target Support Files/Pods-ios-sample/Pods-ios-sample.release.xcconfig"; sourceTree = ""; }; + 5AF80A181E30BD84FA56BE33 /* libPods-ios-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ios-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 72599BE4AC5785D3368D40DD /* Pods-ios-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios-sample.debug.xcconfig"; path = "Target Support Files/Pods-ios-sample/Pods-ios-sample.debug.xcconfig"; sourceTree = ""; }; + AB433CC422D7E38000D579CC /* ios-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ios-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + AB433CC722D7E38000D579CC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + AB433CC822D7E38000D579CC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + AB433CCA22D7E38000D579CC /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + AB433CCB22D7E38000D579CC /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + AB433CCE22D7E38000D579CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + AB433CD022D7E38100D579CC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + AB433CD322D7E38100D579CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + AB433CD522D7E38100D579CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + AB433CD622D7E38100D579CC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + AB433CC122D7E38000D579CC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ED11F6CDF54788FC7CFD87B1 /* libPods-ios-sample.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2A170580B60E92B1A65525D4 /* Pods */ = { + isa = PBXGroup; + children = ( + 72599BE4AC5785D3368D40DD /* Pods-ios-sample.debug.xcconfig */, + 112D4595FA3E81552DA9E877 /* Pods-ios-sample.release.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + AB433CBB22D7E38000D579CC = { + isa = PBXGroup; + children = ( + AB433CC622D7E38000D579CC /* ios-sample */, + AB433CC522D7E38000D579CC /* Products */, + 2A170580B60E92B1A65525D4 /* Pods */, + FD148AE940967C50DB2C12CB /* Frameworks */, + ); + sourceTree = ""; + }; + AB433CC522D7E38000D579CC /* Products */ = { + isa = PBXGroup; + children = ( + AB433CC422D7E38000D579CC /* ios-sample.app */, + ); + name = Products; + sourceTree = ""; + }; + AB433CC622D7E38000D579CC /* ios-sample */ = { + isa = PBXGroup; + children = ( + AB433CC722D7E38000D579CC /* AppDelegate.h */, + AB433CC822D7E38000D579CC /* AppDelegate.m */, + AB433CCA22D7E38000D579CC /* ViewController.h */, + AB433CCB22D7E38000D579CC /* ViewController.m */, + AB433CCD22D7E38000D579CC /* Main.storyboard */, + AB433CD022D7E38100D579CC /* Assets.xcassets */, + AB433CD222D7E38100D579CC /* LaunchScreen.storyboard */, + AB433CD522D7E38100D579CC /* Info.plist */, + AB433CD622D7E38100D579CC /* main.m */, + ); + path = "ios-sample"; + sourceTree = ""; + }; + FD148AE940967C50DB2C12CB /* Frameworks */ = { + isa = PBXGroup; + children = ( + 5AF80A181E30BD84FA56BE33 /* libPods-ios-sample.a */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + AB433CC322D7E38000D579CC /* ios-sample */ = { + isa = PBXNativeTarget; + buildConfigurationList = AB433CDA22D7E38100D579CC /* Build configuration list for PBXNativeTarget "ios-sample" */; + buildPhases = ( + 9DD34A50D448CD3F464D4A3C /* [CP] Check Pods Manifest.lock */, + AB433CC022D7E38000D579CC /* Sources */, + AB433CC122D7E38000D579CC /* Frameworks */, + AB433CC222D7E38000D579CC /* Resources */, + 630985F7228D41528084692C /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "ios-sample"; + productName = "ios-sample"; + productReference = AB433CC422D7E38000D579CC /* ios-sample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + AB433CBC22D7E38000D579CC /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = "Tony Lu"; + TargetAttributes = { + AB433CC322D7E38000D579CC = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = AB433CBF22D7E38000D579CC /* Build configuration list for PBXProject "ios-sample" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = AB433CBB22D7E38000D579CC; + productRefGroup = AB433CC522D7E38000D579CC /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + AB433CC322D7E38000D579CC /* ios-sample */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + AB433CC222D7E38000D579CC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + AB433CD422D7E38100D579CC /* LaunchScreen.storyboard in Resources */, + AB433CD122D7E38100D579CC /* Assets.xcassets in Resources */, + AB433CCF22D7E38000D579CC /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 630985F7228D41528084692C /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-ios-sample/Pods-ios-sample-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-ios-sample/Pods-ios-sample-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ios-sample/Pods-ios-sample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 9DD34A50D448CD3F464D4A3C /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-ios-sample-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + AB433CC022D7E38000D579CC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + AB433CCC22D7E38000D579CC /* ViewController.m in Sources */, + AB433CD722D7E38100D579CC /* main.m in Sources */, + AB433CC922D7E38000D579CC /* AppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + AB433CCD22D7E38000D579CC /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + AB433CCE22D7E38000D579CC /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + AB433CD222D7E38100D579CC /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + AB433CD322D7E38100D579CC /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + AB433CD822D7E38100D579CC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + AB433CD922D7E38100D579CC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + AB433CDB22D7E38100D579CC /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 72599BE4AC5785D3368D40DD /* Pods-ios-sample.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + INFOPLIST_FILE = "ios-sample/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.google.ios-sample-objc-bazel"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + AB433CDC22D7E38100D579CC /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 112D4595FA3E81552DA9E877 /* Pods-ios-sample.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + INFOPLIST_FILE = "ios-sample/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.google.ios-sample-objc-bazel"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + AB433CBF22D7E38000D579CC /* Build configuration list for PBXProject "ios-sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + AB433CD822D7E38100D579CC /* Debug */, + AB433CD922D7E38100D579CC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + AB433CDA22D7E38100D579CC /* Build configuration list for PBXNativeTarget "ios-sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + AB433CDB22D7E38100D579CC /* Debug */, + AB433CDC22D7E38100D579CC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = AB433CBC22D7E38000D579CC /* Project object */; +} diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.h b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.h new file mode 100644 index 00000000000..183abcf4ec8 --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.h @@ -0,0 +1,25 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +@interface AppDelegate : UIResponder + +@property(strong, nonatomic) UIWindow* window; + +@end diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.m b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.m new file mode 100644 index 00000000000..d78f5f2175c --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.m @@ -0,0 +1,63 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for + // certain types of temporary interruptions (such as an incoming phone call or SMS message) or + // when the user quits the application and it begins the transition to the background state. Use + // this method to pause ongoing tasks, disable timers, and invalidate graphics rendering + // callbacks. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store + // enough application state information to restore your application to its current state in case + // it is terminated later. If your application supports background execution, this method is + // called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the active state; here you can undo + // many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If + // the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also + // applicationDidEnterBackground:. +} + +@end diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000000..d8db8d65fd7 --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/Contents.json b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/Contents.json new file mode 100644 index 00000000000..da4a164c918 --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/LaunchScreen.storyboard b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000000..bfa36129419 --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/Main.storyboard b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/Main.storyboard new file mode 100644 index 00000000000..5e257390b33 --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/Main.storyboard @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Info.plist b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Info.plist new file mode 100644 index 00000000000..e5d82108923 --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + en_US + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.h b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.h new file mode 100644 index 00000000000..0aa0b2a73a7 --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.h @@ -0,0 +1,23 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +@interface ViewController : UIViewController + +@end diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.m b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.m new file mode 100644 index 00000000000..6cb5a0be9df --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.m @@ -0,0 +1,86 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "ViewController.h" + +#import +#if COCOAPODS +#import +#import +#else +#import "src/objective-c/examples/BazelBuildSamples/Messages.pbobjc.h" +#import "src/objective-c/examples/BazelBuildSamples/rmt/Test.pbrpc.h" +#endif + +static NSString *const kPackage = @"grpc.testing"; +static NSString *const kService = @"TestService"; + +@interface ViewController () + +@end + +@implementation ViewController { + GRPCCallOptions *_options; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // optionally modify options + _options = options; +} + +- (IBAction)tapCall:(id)sender { + GRPCProtoMethod *kUnaryCallMethod = + [[GRPCProtoMethod alloc] initWithPackage:kPackage service:kService method:@"UnaryCall"]; + + GRPCRequestOptions *requestOptions = + [[GRPCRequestOptions alloc] initWithHost:@"grpc-test.sandbox.googleapis.com" + path:kUnaryCallMethod.HTTPPath + safety:GRPCCallSafetyCacheableRequest]; + + GRPCCall2 *call = [[GRPCCall2 alloc] initWithRequestOptions:requestOptions + responseHandler:self + callOptions:_options]; + + RMTSimpleRequest *request = [RMTSimpleRequest message]; + request.responseSize = 100; + + [call start]; + [call writeData:[request data]]; + [call finish]; +} + +- (dispatch_queue_t)dispatchQueue { + return dispatch_get_main_queue(); +} + +- (void)didReceiveInitialMetadata:(NSDictionary *)initialMetadata { + NSLog(@"Header: %@", initialMetadata); +} + +- (void)didReceiveData:(id)data { + NSLog(@"Message: %@", data); +} + +- (void)didCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { + NSLog(@"Trailer: %@\nError: %@", trailingMetadata, error); +} + +@end diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/main.m b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/main.m new file mode 100644 index 00000000000..2797c6f17f2 --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/main.m @@ -0,0 +1,26 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import "AppDelegate.h" + +int main(int argc, char* argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/src/objective-c/examples/BazelBuildSamples/messages.proto b/src/objective-c/examples/BazelBuildSamples/messages.proto new file mode 100644 index 00000000000..128efd9337e --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/messages.proto @@ -0,0 +1,118 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Message definitions to be used by integration test service definitions. + +syntax = "proto3"; + +package grpc.testing; + +option objc_class_prefix = "RMT"; + +// The type of payload that should be returned. +enum PayloadType { + // Compressable text format. + COMPRESSABLE = 0; + + // Uncompressable binary format. + UNCOMPRESSABLE = 1; + + // Randomly chosen from all other formats defined in this enum. + RANDOM = 2; +} + +// A block of data, to simply increase gRPC message size. +message Payload { + // The type of data in body. + PayloadType type = 1; + // Primary contents of payload. + bytes body = 2; +} + +// Unary request. +message SimpleRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, server randomly chooses one from other formats. + PayloadType response_type = 1; + + // Desired payload size in the response from the server. + // If response_type is COMPRESSABLE, this denotes the size before compression. + int32 response_size = 2; + + // Optional input payload sent along with the request. + Payload payload = 3; + + // Whether SimpleResponse should include username. + bool fill_username = 4; + + // Whether SimpleResponse should include OAuth scope. + bool fill_oauth_scope = 5; +} + +// Unary response, as configured by the request. +message SimpleResponse { + // Payload to increase message size. + Payload payload = 1; + // The user the request came from, for verifying authentication was + // successful when the client expected it. + string username = 2; + // OAuth scope. + string oauth_scope = 3; +} + +// Client-streaming request. +message StreamingInputCallRequest { + // Optional input payload sent along with the request. + Payload payload = 1; + + // Not expecting any payload from the response. +} + +// Client-streaming response. +message StreamingInputCallResponse { + // Aggregated size of payloads received from the client. + int32 aggregated_payload_size = 1; +} + +// Configuration for a particular response. +message ResponseParameters { + // Desired payload sizes in responses from the server. + // If response_type is COMPRESSABLE, this denotes the size before compression. + int32 size = 1; + + // Desired interval between consecutive responses in the response stream in + // microseconds. + int32 interval_us = 2; +} + +// Server-streaming request. +message StreamingOutputCallRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, the payload from each response in the stream + // might be of different types. This is to simulate a mixed type of payload + // stream. + PayloadType response_type = 1; + + // Configuration for each expected response message. + repeated ResponseParameters response_parameters = 2; + + // Optional input payload sent along with the request. + Payload payload = 3; +} + +// Server-streaming response, as configured by the request and parameters. +message StreamingOutputCallResponse { + // Payload to increase response size. + Payload payload = 1; +} diff --git a/src/objective-c/examples/BazelBuildSamples/rmt/BUILD b/src/objective-c/examples/BazelBuildSamples/rmt/BUILD new file mode 100644 index 00000000000..5264196c08e --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/rmt/BUILD @@ -0,0 +1,28 @@ +# gRPC Bazel BUILD file. +# +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +licenses(["notice"]) # Apache v2 + +package(default_visibility = ["//visibility:public"]) + +exports_files(["LICENSE"]) + +proto_library( + name = "test_proto", + srcs = ["test.proto"], + deps = ["//src/objective-c/examples:messages_proto"], + visibility = ["//visibility:public"], +) \ No newline at end of file diff --git a/src/objective-c/examples/BazelBuildSamples/rmt/test.proto b/src/objective-c/examples/BazelBuildSamples/rmt/test.proto new file mode 100644 index 00000000000..ddc511e1428 --- /dev/null +++ b/src/objective-c/examples/BazelBuildSamples/rmt/test.proto @@ -0,0 +1,57 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +syntax = "proto3"; + +import "google/protobuf/empty.proto"; +import "src/objective-c/examples/BazelBuildSamples/messages.proto"; + +package grpc.testing; + +option objc_class_prefix = "RMT"; + +// A simple service to test the various types of RPCs and experiment with +// performance with various types of payload. +service TestService { + // One empty request followed by one empty response. + rpc EmptyCall(google.protobuf.Empty) returns (google.protobuf.Empty); + + // One request followed by one response. + rpc UnaryCall(SimpleRequest) returns (SimpleResponse); + + // One request followed by a sequence of responses (streamed download). + // The server returns the payload with client desired type and sizes. + rpc StreamingOutputCall(StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); + + // A sequence of requests followed by one response (streamed upload). + // The server returns the aggregated size of client payload as the result. + rpc StreamingInputCall(stream StreamingInputCallRequest) + returns (StreamingInputCallResponse); + + // A sequence of requests with each request served by the server immediately. + // As one request could lead to multiple responses, this interface + // demonstrates the idea of full duplexing. + rpc FullDuplexCall(stream StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); + + // A sequence of requests followed by a sequence of responses. + // The server buffers all the client requests and then serves them in order. A + // stream of responses are returned to the client when the server starts with + // first request. + rpc HalfDuplexCall(stream StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); +} From 557446a11e6679d1eb800c549d40e2fc2898fda0 Mon Sep 17 00:00:00 2001 From: Arjun Roy Date: Mon, 24 Jun 2019 17:59:26 -0700 Subject: [PATCH 141/661] Added specializations for grpc_mdelem_create. In several cases, we create grpc mdelem structures using known-static metadata inputs. Furthermore, in several cases we create a slice on the heap (e.g. grpc_slice_from_copied_buffer) where we know we are transferring refcount ownership. In several cases, then, we can: 1) Avoid unnecessary ref/unref operations that are no-ops (for static slices) or superfluous (if we're transferring ownership). 2) Avoid unnecessarily comprehensive calls to grpc_slice_eq (since they'd only be called with static or interned slice arguments, which by construction would have equal refcounts if they were in fact equal. 3) Avoid unnecessary checks to see if a slice is interned (when we know that they are). To avoid polluting the internal API, we introduce the notion of strongly-typed grpc_slice objects. We draw a distinction between Internal (interned and static-storage) slices and Extern (inline and non-statically allocated). We introduce overloads to grpc_mdelem_create() and grpc_mdelem_from_slices() for the fastpath cases identified above based on these slice types. From the programmer's point of view, though, nothing changes - they need only use grpc_mdelem_create() and grpc_mdelem_from_slices() as before, and the appropriate fastpath will be picked based on type inference. If no special knowledge exists for the slice type (i.e. we pass in generic grpc_slice objects), the slowpath method will still always return correct behaviour. This is good for: - Roughly 1-3% reduction in CPU time for several unary/streaming ping pong fullstack microbenchmarks. - Reduction of about 15-20% in CPU time for some hpack parser microbenchmarks. - 10-12% reduction of CPU time for metadata microbenchmarks involving interned slice comparisons. --- .../filters/client_channel/client_channel.cc | 4 +- .../filters/http/client/http_client_filter.cc | 9 +- .../filters/http/client_authority_filter.cc | 6 +- .../chttp2/transport/chttp2_transport.cc | 2 +- .../chttp2/transport/hpack_encoder.cc | 4 +- .../chttp2/transport/hpack_parser.cc | 73 +- .../ext/transport/inproc/inproc_transport.cc | 2 +- .../credentials/oauth2/oauth2_credentials.cc | 8 +- src/core/lib/slice/slice.cc | 74 +- src/core/lib/slice/slice_intern.cc | 169 ++- src/core/lib/slice/slice_internal.h | 17 +- src/core/lib/slice/slice_utils.h | 120 ++ src/core/lib/surface/channel.cc | 12 +- src/core/lib/surface/lame_client.cc | 4 +- src/core/lib/transport/error_utils.cc | 2 +- src/core/lib/transport/metadata.cc | 232 +++- src/core/lib/transport/metadata.h | 78 +- src/core/lib/transport/static_metadata.cc | 1084 +++++++++++------ src/core/lib/transport/static_metadata.h | 6 +- src/cpp/ext/filters/census/client_filter.cc | 2 +- src/cpp/ext/filters/census/server_filter.cc | 2 +- test/cpp/microbenchmarks/bm_metadata.cc | 76 +- tools/codegen/core/gen_static_metadata.py | 18 +- 23 files changed, 1422 insertions(+), 582 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 8234237cc19..7aafca6f8ae 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -329,8 +329,8 @@ class CallData { grpc_linked_mdelem* linked_mdelem = static_cast( calld_->arena_->Alloc(sizeof(grpc_linked_mdelem))); linked_mdelem->md = grpc_mdelem_from_slices( - grpc_slice_from_static_buffer_internal(key.data(), key.size()), - grpc_slice_from_static_buffer_internal(value.data(), value.size())); + grpc_core::ExternallyManagedSlice(key.data(), key.size()), + grpc_core::ExternallyManagedSlice(value.data(), value.size())); GPR_ASSERT(grpc_metadata_batch_link_tail(batch_, linked_mdelem) == GRPC_ERROR_NONE); } diff --git a/src/core/ext/filters/http/client/http_client_filter.cc b/src/core/ext/filters/http/client/http_client_filter.cc index d014460b34e..9ec7aaf4ec8 100644 --- a/src/core/ext/filters/http/client/http_client_filter.cc +++ b/src/core/ext/filters/http/client/http_client_filter.cc @@ -304,7 +304,7 @@ static grpc_error* update_path_for_get(grpc_call_element* elem, estimated_len += grpc_base64_estimate_encoded_size( batch->payload->send_message.send_message->length(), true /* url_safe */, false /* multi_line */); - grpc_slice path_with_query_slice = GRPC_SLICE_MALLOC(estimated_len); + grpc_core::UnmanagedMemorySlice path_with_query_slice(estimated_len); /* memcopy individual pieces into this slice */ char* write_ptr = reinterpret_cast GRPC_SLICE_START_PTR(path_with_query_slice); @@ -514,13 +514,12 @@ static size_t max_payload_size_from_args(const grpc_channel_args* args) { return kMaxPayloadSizeForGet; } -static grpc_slice user_agent_from_args(const grpc_channel_args* args, - const char* transport_name) { +static grpc_core::ManagedMemorySlice user_agent_from_args( + const grpc_channel_args* args, const char* transport_name) { gpr_strvec v; size_t i; int is_first = 1; char* tmp; - grpc_slice result; gpr_strvec_init(&v); @@ -558,7 +557,7 @@ static grpc_slice user_agent_from_args(const grpc_channel_args* args, tmp = gpr_strvec_flatten(&v, nullptr); gpr_strvec_destroy(&v); - result = grpc_slice_intern(grpc_slice_from_static_string_internal(tmp)); + grpc_core::ManagedMemorySlice result(tmp); gpr_free(tmp); return result; diff --git a/src/core/ext/filters/http/client_authority_filter.cc b/src/core/ext/filters/http/client_authority_filter.cc index 4bd666ecfee..13c6ce58fec 100644 --- a/src/core/ext/filters/http/client_authority_filter.cc +++ b/src/core/ext/filters/http/client_authority_filter.cc @@ -44,7 +44,7 @@ struct call_data { }; struct channel_data { - grpc_slice default_authority; + grpc_core::ManagedMemorySlice default_authority; grpc_mdelem default_authority_mdelem; }; @@ -101,8 +101,8 @@ grpc_error* init_channel_elem(grpc_channel_element* elem, return GRPC_ERROR_CREATE_FROM_STATIC_STRING( "GRPC_ARG_DEFAULT_AUTHORITY channel arg. must be a string"); } - chand->default_authority = grpc_slice_intern( - grpc_slice_from_static_string_internal(default_authority_str)); + chand->default_authority = + grpc_core::ManagedMemorySlice(default_authority_str); chand->default_authority_mdelem = grpc_mdelem_create( GRPC_MDSTR_AUTHORITY, chand->default_authority, nullptr); GPR_ASSERT(!args->is_last); diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 43f2db1309f..92762ef859b 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -2152,7 +2152,7 @@ void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s, &s->metadata_buffer[1], grpc_mdelem_from_slices( GRPC_MDSTR_GRPC_STATUS, - grpc_slice_from_copied_string(status_string)))); + grpc_core::UnmanagedMemorySlice(status_string)))); if (!GRPC_SLICE_IS_EMPTY(slice)) { GRPC_LOG_IF_ERROR( "add_status_message", diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc index 2b40b7b03ed..e46504d9b30 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc @@ -604,8 +604,8 @@ static void deadline_enc(grpc_chttp2_hpack_compressor* c, grpc_millis deadline, grpc_mdelem mdelem; grpc_http2_encode_timeout(deadline - grpc_core::ExecCtx::Get()->Now(), timeout_str); - mdelem = grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_TIMEOUT, - grpc_slice_from_copied_string(timeout_str)); + mdelem = grpc_mdelem_from_slices( + GRPC_MDSTR_GRPC_TIMEOUT, grpc_core::UnmanagedMemorySlice(timeout_str)); hpack_enc(c, mdelem, st); GRPC_MDELEM_UNREF(mdelem); } diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc index 32848929363..724c6c1bffc 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc @@ -660,24 +660,32 @@ static grpc_error* on_hdr(grpc_chttp2_hpack_parser* p, grpc_mdelem md) { return GRPC_ERROR_NONE; } -static grpc_slice take_string(grpc_chttp2_hpack_parser* p, - grpc_chttp2_hpack_parser_string* str, - bool intern) { - grpc_slice s; +static grpc_core::UnmanagedMemorySlice take_string_extern( + grpc_chttp2_hpack_parser* p, grpc_chttp2_hpack_parser_string* str) { + grpc_core::UnmanagedMemorySlice s; if (!str->copied) { - if (intern) { - s = grpc_slice_intern(str->data.referenced); - grpc_slice_unref_internal(str->data.referenced); - } else { - s = str->data.referenced; - } + GPR_DEBUG_ASSERT(!grpc_slice_is_interned(str->data.referenced)); + s = static_cast(str->data.referenced); + str->copied = true; + str->data.referenced = grpc_core::UnmanagedMemorySlice(); + } else { + s = grpc_core::UnmanagedMemorySlice(str->data.copied.str, + str->data.copied.length); + } + str->data.copied.length = 0; + return s; +} + +static grpc_core::ManagedMemorySlice take_string_intern( + grpc_chttp2_hpack_parser* p, grpc_chttp2_hpack_parser_string* str) { + grpc_core::ManagedMemorySlice s; + if (!str->copied) { + s = grpc_core::ManagedMemorySlice(&str->data.referenced); + grpc_slice_unref_internal(str->data.referenced); str->copied = true; str->data.referenced = grpc_empty_slice(); - } else if (intern) { - s = grpc_slice_intern(grpc_slice_from_static_buffer_internal( - str->data.copied.str, str->data.copied.length)); } else { - s = grpc_slice_from_copied_buffer(str->data.copied.str, + s = grpc_core::ManagedMemorySlice(str->data.copied.str, str->data.copied.length); } str->data.copied.length = 0; @@ -812,6 +820,12 @@ static grpc_mdelem get_precomputed_md_for_idx(grpc_chttp2_hpack_parser* p) { return md; } +static const grpc_core::ManagedMemorySlice& get_indexed_key(grpc_mdelem md) { + GPR_DEBUG_ASSERT(GRPC_MDELEM_IS_INTERNED(md)); + return static_cast( + grpc_slice_ref_internal(GRPC_MDKEY(md))); +} + /* finish a literal header with incremental indexing */ static grpc_error* finish_lithdr_incidx(grpc_chttp2_hpack_parser* p, const uint8_t* cur, @@ -819,8 +833,8 @@ static grpc_error* finish_lithdr_incidx(grpc_chttp2_hpack_parser* p, GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX(); grpc_mdelem md = get_precomputed_md_for_idx(p); grpc_error* err = on_hdr( - p, grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)), - take_string(p, &p->value, true))); + p, grpc_mdelem_from_slices(get_indexed_key(md), + take_string_intern(p, &p->value))); if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err); return parse_begin(p, cur, end); } @@ -830,9 +844,9 @@ static grpc_error* finish_lithdr_incidx_v(grpc_chttp2_hpack_parser* p, const uint8_t* cur, const uint8_t* end) { GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX_V(); - grpc_error* err = - on_hdr(p, grpc_mdelem_from_slices(take_string(p, &p->key, true), - take_string(p, &p->value, true))); + grpc_error* err = on_hdr( + p, grpc_mdelem_from_slices(take_string_intern(p, &p->key), + take_string_intern(p, &p->value))); if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err); return parse_begin(p, cur, end); } @@ -883,8 +897,8 @@ static grpc_error* finish_lithdr_notidx(grpc_chttp2_hpack_parser* p, GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX(); grpc_mdelem md = get_precomputed_md_for_idx(p); grpc_error* err = on_hdr( - p, grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)), - take_string(p, &p->value, false))); + p, grpc_mdelem_from_slices(get_indexed_key(md), + take_string_extern(p, &p->value))); if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err); return parse_begin(p, cur, end); } @@ -895,8 +909,8 @@ static grpc_error* finish_lithdr_notidx_v(grpc_chttp2_hpack_parser* p, const uint8_t* end) { GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX_V(); grpc_error* err = on_hdr( - p, grpc_mdelem_from_slices(take_string(p, &p->key, true), - take_string(p, &p->value, false))); + p, grpc_mdelem_from_slices(take_string_intern(p, &p->key), + take_string_extern(p, &p->value))); if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err); return parse_begin(p, cur, end); } @@ -947,8 +961,8 @@ static grpc_error* finish_lithdr_nvridx(grpc_chttp2_hpack_parser* p, GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX(); grpc_mdelem md = get_precomputed_md_for_idx(p); grpc_error* err = on_hdr( - p, grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)), - take_string(p, &p->value, false))); + p, grpc_mdelem_from_slices(get_indexed_key(md), + take_string_extern(p, &p->value))); if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err); return parse_begin(p, cur, end); } @@ -959,8 +973,8 @@ static grpc_error* finish_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p, const uint8_t* end) { GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX_V(); grpc_error* err = on_hdr( - p, grpc_mdelem_from_slices(take_string(p, &p->key, true), - take_string(p, &p->value, false))); + p, grpc_mdelem_from_slices(take_string_intern(p, &p->key), + take_string_extern(p, &p->value))); if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err); return parse_begin(p, cur, end); } @@ -1510,13 +1524,12 @@ static grpc_error* parse_key_string(grpc_chttp2_hpack_parser* p, static bool is_binary_literal_header(grpc_chttp2_hpack_parser* p) { /* We know that either argument here is a reference counter slice. - * 1. If a result of grpc_slice_from_static_buffer_internal, the refcount is - * set to kNoopRefcount. + * 1. If it is a grpc_core::StaticSlice, the refcount is set to kNoopRefcount. * 2. If it's p->key.data.referenced, then p->key.copied was set to false, * which occurs in begin_parse_string() - where the refcount is set to * p->current_slice_refcount, which is not null. */ return grpc_is_refcounted_slice_binary_header( - p->key.copied ? grpc_slice_from_static_buffer_internal( + p->key.copied ? grpc_core::ExternallyManagedSlice( p->key.data.copied.str, p->key.data.copied.length) : p->key.data.referenced); } diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc index 8cb9ac4a2fd..a7f67879287 100644 --- a/src/core/ext/transport/inproc/inproc_transport.cc +++ b/src/core/ext/transport/inproc/inproc_transport.cc @@ -1203,7 +1203,7 @@ void inproc_transports_create(grpc_transport** server_transport, */ void grpc_inproc_transport_init(void) { grpc_core::ExecCtx exec_ctx; - g_empty_slice = grpc_slice_from_static_buffer_internal(nullptr, 0); + g_empty_slice = grpc_core::ExternallyManagedSlice(); grpc_slice key_tmp = grpc_slice_from_static_string(":path"); g_fake_path_key = grpc_slice_intern(key_tmp); diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc index 7a584835b96..87aa0357be7 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc @@ -199,8 +199,8 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response( *token_lifetime = strtol(expires_in->value, nullptr, 10) * GPR_MS_PER_SEC; if (!GRPC_MDISNULL(*token_md)) GRPC_MDELEM_UNREF(*token_md); *token_md = grpc_mdelem_from_slices( - grpc_slice_from_static_string(GRPC_AUTHORIZATION_METADATA_KEY), - grpc_slice_from_copied_string(new_access_token)); + grpc_core::ExternallyManagedSlice(GRPC_AUTHORIZATION_METADATA_KEY), + grpc_core::UnmanagedMemorySlice(new_access_token)); status = GRPC_CREDENTIALS_OK; } @@ -721,8 +721,8 @@ grpc_access_token_credentials::grpc_access_token_credentials( gpr_asprintf(&token_md_value, "Bearer %s", access_token); grpc_core::ExecCtx exec_ctx; access_token_md_ = grpc_mdelem_from_slices( - grpc_slice_from_static_string(GRPC_AUTHORIZATION_METADATA_KEY), - grpc_slice_from_copied_string(token_md_value)); + grpc_core::ExternallyManagedSlice(GRPC_AUTHORIZATION_METADATA_KEY), + grpc_core::UnmanagedMemorySlice(token_md_value)); gpr_free(token_md_value); } diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc index 57862518feb..d3480abaa87 100644 --- a/src/core/lib/slice/slice.cc +++ b/src/core/lib/slice/slice.cc @@ -37,12 +37,7 @@ char* grpc_slice_to_c_string(grpc_slice slice) { return out; } -grpc_slice grpc_empty_slice(void) { - grpc_slice out; - out.refcount = nullptr; - out.data.inlined.length = 0; - return out; -} +grpc_slice grpc_empty_slice(void) { return grpc_core::UnmanagedMemorySlice(); } grpc_slice grpc_slice_copy(grpc_slice s) { grpc_slice out = GRPC_SLICE_MALLOC(GRPC_SLICE_LENGTH(s)); @@ -112,11 +107,11 @@ size_t grpc_slice_memory_usage(grpc_slice s) { } grpc_slice grpc_slice_from_static_buffer(const void* s, size_t len) { - return grpc_slice_from_static_buffer_internal(s, len); + return grpc_core::ExternallyManagedSlice(s, len); } grpc_slice grpc_slice_from_static_string(const char* s) { - return grpc_slice_from_static_buffer_internal(s, strlen(s)); + return grpc_core::ExternallyManagedSlice(s, strlen(s)); } grpc_slice grpc_slice_new_with_user_data(void* p, size_t len, @@ -202,15 +197,29 @@ grpc_slice grpc_slice_new_with_len(void* p, size_t len, return slice; } +grpc_core::UnmanagedMemorySlice::UnmanagedMemorySlice(const char* source, + size_t length) { + if (length <= sizeof(data.inlined.bytes)) { + refcount = nullptr; + data.inlined.length = static_cast(length); + } else { + HeapInit(length); + } + if (length > 0) { + memcpy(GRPC_SLICE_START_PTR(*this), source, length); + } +} + +grpc_core::UnmanagedMemorySlice::UnmanagedMemorySlice(const char* source) + : grpc_core::UnmanagedMemorySlice::UnmanagedMemorySlice(source, + strlen(source)) {} + grpc_slice grpc_slice_from_copied_buffer(const char* source, size_t length) { - if (length == 0) return grpc_empty_slice(); - grpc_slice slice = GRPC_SLICE_MALLOC(length); - memcpy(GRPC_SLICE_START_PTR(slice), source, length); - return slice; + return grpc_core::UnmanagedMemorySlice(source, length); } grpc_slice grpc_slice_from_copied_string(const char* source) { - return grpc_slice_from_copied_buffer(source, strlen(source)); + return grpc_core::UnmanagedMemorySlice(source, strlen(source)); } grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr p, @@ -261,8 +270,11 @@ class MallocRefCount { } // namespace grpc_slice grpc_slice_malloc_large(size_t length) { - grpc_slice slice; + return grpc_core::UnmanagedMemorySlice( + length, grpc_core::UnmanagedMemorySlice::ForceHeapAllocation()); +} +void grpc_core::UnmanagedMemorySlice::HeapInit(size_t length) { /* Memory layout used by the slice created here: +-----------+----------------------------------------------------------+ @@ -281,29 +293,30 @@ grpc_slice grpc_slice_malloc_large(size_t length) { /* Build up the slice to be returned. */ /* The slices refcount points back to the allocated block. */ - slice.refcount = rc->base_refcount(); + refcount = rc->base_refcount(); /* The data bytes are placed immediately after the refcount struct */ - slice.data.refcounted.bytes = reinterpret_cast(rc + 1); + data.refcounted.bytes = reinterpret_cast(rc + 1); /* And the length of the block is set to the requested length */ - slice.data.refcounted.length = length; - return slice; + data.refcounted.length = length; } grpc_slice grpc_slice_malloc(size_t length) { - grpc_slice slice; + return grpc_core::UnmanagedMemorySlice(length); +} - if (length > sizeof(slice.data.inlined.bytes)) { - return grpc_slice_malloc_large(length); +grpc_core::UnmanagedMemorySlice::UnmanagedMemorySlice(size_t length) { + if (length > sizeof(data.inlined.bytes)) { + HeapInit(length); } else { /* small slice: just inline the data */ - slice.refcount = nullptr; - slice.data.inlined.length = static_cast(length); + refcount = nullptr; + data.inlined.length = static_cast(length); } - return slice; } -grpc_slice grpc_slice_sub_no_ref(grpc_slice source, size_t begin, size_t end) { - grpc_slice subset; +template +static Slice sub_no_ref(const Slice& source, size_t begin, size_t end) { + Slice subset; GPR_ASSERT(end >= begin); @@ -327,6 +340,15 @@ grpc_slice grpc_slice_sub_no_ref(grpc_slice source, size_t begin, size_t end) { return subset; } +grpc_slice grpc_slice_sub_no_ref(grpc_slice source, size_t begin, size_t end) { + return sub_no_ref(source, begin, end); +} + +grpc_core::UnmanagedMemorySlice grpc_slice_sub_no_ref( + const grpc_core::UnmanagedMemorySlice& source, size_t begin, size_t end) { + return sub_no_ref(source, begin, end); +} + grpc_slice grpc_slice_sub(grpc_slice source, size_t begin, size_t end) { grpc_slice subset; diff --git a/src/core/lib/slice/slice_intern.cc b/src/core/lib/slice/slice_intern.cc index 81d34ddce25..13fe1ab40e9 100644 --- a/src/core/lib/slice/slice_intern.cc +++ b/src/core/lib/slice/slice_intern.cc @@ -107,12 +107,10 @@ static void grow_shard(slice_shard* shard) { shard->capacity = capacity; } -static grpc_slice materialize(InternedSliceRefcount* s) { - grpc_slice slice; - slice.refcount = &s->base; - slice.data.refcounted.bytes = reinterpret_cast(s + 1); - slice.data.refcounted.length = s->length; - return slice; +grpc_core::InternedSlice::InternedSlice(InternedSliceRefcount* s) { + refcount = &s->base; + data.refcounted.bytes = reinterpret_cast(s + 1); + data.refcounted.length = s->length; } uint32_t grpc_slice_default_hash_impl(grpc_slice s) { @@ -152,57 +150,150 @@ grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice, } grpc_slice grpc_slice_intern(grpc_slice slice) { - GPR_TIMER_SCOPE("grpc_slice_intern", 0); - if (GRPC_IS_STATIC_METADATA_STRING(slice)) { - return slice; - } - - uint32_t hash = grpc_slice_hash_internal(slice); + /* TODO(arjunroy): At present, this is capable of returning either a static or + an interned slice. This yields weirdness like the constructor for + ManagedMemorySlice instantiating itself as an instance of a derived type + (StaticMetadataSlice or InternedSlice). Should reexamine. */ + return grpc_core::ManagedMemorySlice(&slice); +} +// Attempt to see if the provided slice or string matches a static slice. +// SliceArgs... is either a const grpc_slice& or a string and length. In either +// case, hash is the pre-computed hash value. +// +// Returns: a matching static slice, or null. +template +static const grpc_core::StaticMetadataSlice* MatchStaticSlice( + uint32_t hash, SliceArgs&&... args) { for (uint32_t i = 0; i <= max_static_metadata_hash_probe; i++) { static_metadata_hash_ent ent = static_metadata_hash[(hash + i) % GPR_ARRAY_SIZE(static_metadata_hash)]; if (ent.hash == hash && ent.idx < GRPC_STATIC_MDSTR_COUNT && - grpc_slice_eq_static_interned(slice, - grpc_static_slice_table[ent.idx])) { - return grpc_static_slice_table[ent.idx]; + grpc_static_slice_table[ent.idx].Equals( + std::forward(args)...)) { + return &grpc_static_slice_table[ent.idx]; } } + return nullptr; +} - InternedSliceRefcount* s; - slice_shard* shard = &g_shards[SHARD_IDX(hash)]; +// Helper methods to enable us to select appropriately overloaded slice methods +// whether we're dealing with a slice, or a buffer with length, when interning +// strings. Helpers for FindOrCreateInternedSlice(). +static const void* GetBuffer(const void* buf, size_t len) { return buf; } +static size_t GetLength(const void* buf, size_t len) { return len; } +static const void* GetBuffer(const grpc_slice& slice) { + return GRPC_SLICE_START_PTR(slice); +} +static size_t GetLength(const grpc_slice& slice) { + return GRPC_SLICE_LENGTH(slice); +} - gpr_mu_lock(&shard->mu); +// Creates an interned slice for a string that does not currently exist in the +// intern table. SliceArgs... is either a const grpc_slice& or a string and +// length. In either case, hash is the pre-computed hash value. We must already +// hold the shard lock. Helper for FindOrCreateInternedSlice(). +// +// Returns: a newly interned slice. +template +static InternedSliceRefcount* InternNewStringLocked(slice_shard* shard, + size_t shard_idx, + uint32_t hash, + SliceArgs&&... args) { + /* string data goes after the internal_string header */ + size_t len = GetLength(std::forward(args)...); + const void* buffer = GetBuffer(std::forward(args)...); + InternedSliceRefcount* s = + static_cast(gpr_malloc(sizeof(*s) + len)); + new (s) grpc_core::InternedSliceRefcount(len, hash, shard->strs[shard_idx]); + memcpy(reinterpret_cast(s + 1), buffer, len); + shard->strs[shard_idx] = s; + shard->count++; + if (shard->count > shard->capacity * 2) { + grow_shard(shard); + } + return s; +} +// Attempt to see if the provided slice or string matches an existing interned +// slice. SliceArgs... is either a const grpc_slice& or a string and length. In +// either case, hash is the pre-computed hash value. We must already hold the +// shard lock. Helper for FindOrCreateInternedSlice(). +// +// Returns: a pre-existing matching static slice, or null. +template +static InternedSliceRefcount* MatchInternedSliceLocked(uint32_t hash, + size_t idx, + SliceArgs&&... args) { + InternedSliceRefcount* s; + slice_shard* shard = &g_shards[SHARD_IDX(hash)]; /* search for an existing string */ - size_t idx = TABLE_IDX(hash, shard->capacity); for (s = shard->strs[idx]; s; s = s->bucket_next) { if (s->hash == hash && - grpc_slice_eq_static_interned(slice, materialize(s))) { + grpc_core::InternedSlice(s).Equals(std::forward(args)...)) { if (s->refcnt.RefIfNonZero()) { - gpr_mu_unlock(&shard->mu); - return materialize(s); + return s; } } } + return nullptr; +} - /* not found: create a new string */ - /* string data goes after the internal_string header */ - s = static_cast( - gpr_malloc(sizeof(*s) + GRPC_SLICE_LENGTH(slice))); - - new (s) grpc_core::InternedSliceRefcount(GRPC_SLICE_LENGTH(slice), hash, - shard->strs[idx]); - memcpy(reinterpret_cast(s + 1), GRPC_SLICE_START_PTR(slice), - GRPC_SLICE_LENGTH(slice)); - shard->strs[idx] = s; - shard->count++; - if (shard->count > shard->capacity * 2) { - grow_shard(shard); +// Attempt to see if the provided slice or string matches an existing interned +// slice, and failing that, create an interned slice with its contents. Returns +// either the existing matching interned slice or the newly created one. +// SliceArgs... is either a const grpc_slice& or a string and length. In either +// case, hash is the pre-computed hash value. We do not hold the shard lock +// here, but do take it. +// +// Returns: an interned slice, either pre-existing/matched or newly created. +template +static InternedSliceRefcount* FindOrCreateInternedSlice(uint32_t hash, + SliceArgs&&... args) { + slice_shard* shard = &g_shards[SHARD_IDX(hash)]; + gpr_mu_lock(&shard->mu); + const size_t idx = TABLE_IDX(hash, shard->capacity); + InternedSliceRefcount* s = + MatchInternedSliceLocked(hash, idx, std::forward(args)...); + if (s == nullptr) { + s = InternNewStringLocked(shard, idx, hash, + std::forward(args)...); } - gpr_mu_unlock(&shard->mu); - return materialize(s); + return s; +} + +grpc_core::ManagedMemorySlice::ManagedMemorySlice(const char* string) + : grpc_core::ManagedMemorySlice::ManagedMemorySlice(string, + strlen(string)) {} + +grpc_core::ManagedMemorySlice::ManagedMemorySlice(const char* string, + size_t len) { + GPR_TIMER_SCOPE("grpc_slice_intern", 0); + const uint32_t hash = gpr_murmur_hash3(string, len, g_hash_seed); + const StaticMetadataSlice* static_slice = MatchStaticSlice(hash, string, len); + if (static_slice) { + *this = *static_slice; + } else { + *this = + grpc_core::InternedSlice(FindOrCreateInternedSlice(hash, string, len)); + } +} + +grpc_core::ManagedMemorySlice::ManagedMemorySlice(const grpc_slice* slice_ptr) { + GPR_TIMER_SCOPE("grpc_slice_intern", 0); + const grpc_slice& slice = *slice_ptr; + if (GRPC_IS_STATIC_METADATA_STRING(slice)) { + *this = static_cast(slice); + return; + } + const uint32_t hash = grpc_slice_hash_internal(slice); + const StaticMetadataSlice* static_slice = MatchStaticSlice(hash, slice); + if (static_slice) { + *this = *static_slice; + } else { + *this = grpc_core::InternedSlice(FindOrCreateInternedSlice(hash, slice)); + } } void grpc_test_only_set_slice_hash_seed(uint32_t seed) { @@ -259,8 +350,8 @@ void grpc_slice_intern_shutdown(void) { shard->count); for (size_t j = 0; j < shard->capacity; j++) { for (InternedSliceRefcount* s = shard->strs[j]; s; s = s->bucket_next) { - char* text = - grpc_dump_slice(materialize(s), GPR_DUMP_HEX | GPR_DUMP_ASCII); + char* text = grpc_dump_slice(grpc_core::InternedSlice(s), + GPR_DUMP_HEX | GPR_DUMP_ASCII); gpr_log(GPR_DEBUG, "LEAKED: %s", text); gpr_free(text); } diff --git a/src/core/lib/slice/slice_internal.h b/src/core/lib/slice/slice_internal.h index 54badeb9ab9..219266c3941 100644 --- a/src/core/lib/slice/slice_internal.h +++ b/src/core/lib/slice/slice_internal.h @@ -30,6 +30,7 @@ #include "src/core/lib/gpr/murmur_hash.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/ref_counted.h" +#include "src/core/lib/slice/slice_utils.h" #include "src/core/lib/transport/static_metadata.h" // Interned slices have specific fast-path operations for hashing. To inline @@ -95,6 +96,8 @@ extern uint32_t g_hash_seed; // In total, this saves us roughly 1-2% latency for unary calls, with smaller // calls benefitting. The effect is present, but not as useful, for larger calls // where the cost of sending the data dominates. +// TODO(arjunroy): Investigate if this can be removed with strongly typed +// grpc_slices. struct grpc_slice_refcount { public: enum class Type { @@ -314,17 +317,7 @@ grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr p); // 0. All other slices will return the size of the allocated chars. size_t grpc_slice_memory_usage(grpc_slice s); -inline grpc_slice grpc_slice_from_static_buffer_internal(const void* s, - size_t len) { - grpc_slice slice; - slice.refcount = &grpc_core::kNoopRefcount; - slice.data.refcounted.bytes = (uint8_t*)s; - slice.data.refcounted.length = len; - return slice; -} - -inline grpc_slice grpc_slice_from_static_string_internal(const char* s) { - return grpc_slice_from_static_buffer_internal(s, strlen(s)); -} +grpc_core::UnmanagedMemorySlice grpc_slice_sub_no_ref( + const grpc_core::UnmanagedMemorySlice& source, size_t begin, size_t end); #endif /* GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H */ diff --git a/src/core/lib/slice/slice_utils.h b/src/core/lib/slice/slice_utils.h index 7589bf8f0f7..161300abe1e 100644 --- a/src/core/lib/slice/slice_utils.h +++ b/src/core/lib/slice/slice_utils.h @@ -21,6 +21,8 @@ #include +#include + #include // When we compare two slices, and we know the latter is not inlined, we can @@ -36,6 +38,7 @@ // x86-64/clang with differs(). int grpc_slice_differs_refcounted(const grpc_slice& a, const grpc_slice& b_not_inline); + // When we compare two slices, and we *know* that one of them is static or // interned, we can short circuit our slice equality function. The second slice // here must be static or interned; slice a can be any slice, inlined or not. @@ -47,4 +50,121 @@ inline bool grpc_slice_eq_static_interned(const grpc_slice& a, return !grpc_slice_differs_refcounted(a, b_static_interned); } +// TODO(arjunroy): These type declarations ought to be in +// src/core/lib/slice/slice_internal.h instead; they are here due to a circular +// header depedency between slice_internal.h and +// src/core/lib/transport/metadata.h. We need to fix this circular reference and +// when we do, move these type declarations. +// +// Internal slice type declarations. +// Externally, a grpc_slice is a grpc_slice is a grpc_slice. +// Internally, we may have heap allocated slices, static slices, interned +// slices, and inlined slices. If we know the specific type of slice +// we're dealing with, we can save cycles (e.g. fast-paths when we know we don't +// need to take a reference on a slice). Rather than introducing new methods +// ad-hoc in these cases, we rely on type-system backed overloads to keep +// internal APIs clean. +// +// For each overload, the definition and layout of the underlying slice does not +// change; this is purely type-system information. +namespace grpc_core { + +// There are two main types of slices: those that have their memory +// managed by the slice library and those that do not. +// +// The following types of slices are not managed: +// - inlined slices (i.e., refcount is null) +// - slices that have a custom refcount type (i.e., not STATIC or INTERNED) +// - slices where the memory is managed by some external agent. The slice is not +// ref-counted by grpc, and the programmer is responsible for ensuring the +// data is valid for the duration of the period that grpc may access it. +// +// The following types of slices are managed: +// - static metadata slices (i.e., refcount type is STATIC) +// - interned slices (i.e., refcount type is INTERNED) +// +// This categorization is reflected in the following hierarchy: +// +// - grpc_slice +// > - UnmanagedMemorySlice +// > - ExternallyManagedSlice +// - ManagedMemorySlice +// > - InternedSlice +// - StaticMetadataSlice +// +struct ManagedMemorySlice : public grpc_slice { + ManagedMemorySlice() { + refcount = nullptr; + data.refcounted.bytes = nullptr; + data.refcounted.length = 0; + } + explicit ManagedMemorySlice(const char* string); + ManagedMemorySlice(const char* buf, size_t len); + explicit ManagedMemorySlice(const grpc_slice* slice); + bool Equals(const grpc_slice& other) const { + if (refcount == other.refcount) { + return true; + } + return !grpc_slice_differs_refcounted(other, *this); + } + bool Equals(const char* buf, const size_t len) const { + return data.refcounted.length == len && + memcmp(buf, data.refcounted.bytes, len) == 0; + } +}; +struct UnmanagedMemorySlice : public grpc_slice { + // TODO(arjunroy): Can we use a default=false param instead of this enum? + enum class ForceHeapAllocation {}; + UnmanagedMemorySlice() { + refcount = nullptr; + data.inlined.length = 0; + } + explicit UnmanagedMemorySlice(const char* source); + UnmanagedMemorySlice(const char* source, size_t length); + // The first constructor creates a slice that may be heap allocated, or + // inlined in the slice structure if length is small enough + // (< GRPC_SLICE_INLINED_SIZE). The second constructor forces heap alloc. + explicit UnmanagedMemorySlice(size_t length); + explicit UnmanagedMemorySlice(size_t length, const ForceHeapAllocation&) { + HeapInit(length); + } + + private: + void HeapInit(size_t length); +}; + +extern grpc_slice_refcount kNoopRefcount; + +struct ExternallyManagedSlice : public UnmanagedMemorySlice { + ExternallyManagedSlice() + : ExternallyManagedSlice(&kNoopRefcount, 0, nullptr) {} + explicit ExternallyManagedSlice(const char* s) + : ExternallyManagedSlice(s, strlen(s)) {} + ExternallyManagedSlice(const void* s, size_t len) + : ExternallyManagedSlice( + &kNoopRefcount, len, + reinterpret_cast(const_cast(s))) {} + ExternallyManagedSlice(grpc_slice_refcount* ref, size_t length, + uint8_t* bytes) { + refcount = ref; + data.refcounted.length = length; + data.refcounted.bytes = bytes; + } +}; + +struct StaticMetadataSlice : public ManagedMemorySlice { + StaticMetadataSlice(grpc_slice_refcount* ref, size_t length, uint8_t* bytes) { + refcount = ref; + data.refcounted.length = length; + data.refcounted.bytes = bytes; + } +}; + +struct InternedSliceRefcount; +struct InternedSlice : public ManagedMemorySlice { + explicit InternedSlice(InternedSliceRefcount* s); +}; + +} // namespace grpc_core + #endif /* GRPC_CORE_LIB_SLICE_SLICE_UTILS_H */ diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index aadb3f5fae3..942af37a830 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -416,13 +416,11 @@ void* grpc_channel_register_call(grpc_channel* channel, const char* method, GPR_ASSERT(!reserved); grpc_core::ExecCtx exec_ctx; - rc->path = grpc_mdelem_from_slices( - GRPC_MDSTR_PATH, - grpc_slice_intern(grpc_slice_from_static_string(method))); + rc->path = grpc_mdelem_from_slices(GRPC_MDSTR_PATH, + grpc_core::ManagedMemorySlice(method)); rc->authority = - host ? grpc_mdelem_from_slices( - GRPC_MDSTR_AUTHORITY, - grpc_slice_intern(grpc_slice_from_static_string(host))) + host ? grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY, + grpc_core::ManagedMemorySlice(host)) : GRPC_MDNULL; gpr_mu_lock(&channel->registered_call_mu); rc->next = channel->registered_calls; @@ -513,5 +511,5 @@ grpc_mdelem grpc_channel_get_reffed_status_elem_slowpath(grpc_channel* channel, char tmp[GPR_LTOA_MIN_BUFSIZE]; gpr_ltoa(i, tmp); return grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_STATUS, - grpc_slice_from_copied_string(tmp)); + grpc_core::UnmanagedMemorySlice(tmp)); } diff --git a/src/core/lib/surface/lame_client.cc b/src/core/lib/surface/lame_client.cc index dde39b8c681..10a27924073 100644 --- a/src/core/lib/surface/lame_client.cc +++ b/src/core/lib/surface/lame_client.cc @@ -61,10 +61,10 @@ static void fill_metadata(grpc_call_element* elem, grpc_metadata_batch* mdb) { char tmp[GPR_LTOA_MIN_BUFSIZE]; gpr_ltoa(chand->error_code, tmp); calld->status.md = grpc_mdelem_from_slices( - GRPC_MDSTR_GRPC_STATUS, grpc_slice_from_copied_string(tmp)); + GRPC_MDSTR_GRPC_STATUS, grpc_core::UnmanagedMemorySlice(tmp)); calld->details.md = grpc_mdelem_from_slices( GRPC_MDSTR_GRPC_MESSAGE, - grpc_slice_from_copied_string(chand->error_message)); + grpc_core::UnmanagedMemorySlice(chand->error_message)); calld->status.prev = calld->details.next = nullptr; calld->status.next = &calld->details; calld->details.prev = &calld->status; diff --git a/src/core/lib/transport/error_utils.cc b/src/core/lib/transport/error_utils.cc index 5be98c9f04f..78a324b2d7f 100644 --- a/src/core/lib/transport/error_utils.cc +++ b/src/core/lib/transport/error_utils.cc @@ -61,7 +61,7 @@ void grpc_error_get_status(grpc_error* error, grpc_millis deadline, // 3) The resulting slice is statically known. // 4) Said resulting slice is of length 0 (""). // This means 3 movs, instead of 10s of instructions and a strlen. - *slice = grpc_slice_from_static_string_internal(""); + *slice = grpc_core::ExternallyManagedSlice(""); } if (http_error != nullptr) { *http_error = GRPC_HTTP2_NO_ERROR; diff --git a/src/core/lib/transport/metadata.cc b/src/core/lib/transport/metadata.cc index 7766ee186c6..4242923283e 100644 --- a/src/core/lib/transport/metadata.cc +++ b/src/core/lib/transport/metadata.cc @@ -68,8 +68,8 @@ void grpc_mdelem_trace_ref(void* md, const grpc_slice& key, char* key_str = grpc_slice_to_c_string(key); char* value_str = grpc_slice_to_c_string(value); gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", md, refcnt, - refcnt + 1, key_str, value_str); + "mdelem REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", md, + refcnt, refcnt + 1, key_str, value_str); gpr_free(key_str); gpr_free(value_str); } @@ -82,7 +82,7 @@ void grpc_mdelem_trace_unref(void* md, const grpc_slice& key, char* key_str = grpc_slice_to_c_string(key); char* value_str = grpc_slice_to_c_string(value); gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM UNREF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", md, + "mdelem UNREF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", md, refcnt, refcnt - 1, key_str, value_str); gpr_free(key_str); gpr_free(value_str); @@ -112,14 +112,33 @@ AllocatedMetadata::AllocatedMetadata(const grpc_slice& key, : RefcountedMdBase(grpc_slice_ref_internal(key), grpc_slice_ref_internal(value)) { #ifndef NDEBUG - if (grpc_trace_metadata.enabled()) { - char* key_str = grpc_slice_to_c_string(key); - char* value_str = grpc_slice_to_c_string(value); - gpr_log(GPR_DEBUG, "ELM ALLOC:%p:%" PRIdPTR ": '%s' = '%s'", this, - RefValue(), key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); - } + TraceAtStart("ALLOC_MD"); +#endif +} + +AllocatedMetadata::AllocatedMetadata(const grpc_slice& key, + const grpc_slice& value, const NoRefKey*) + : RefcountedMdBase(key, grpc_slice_ref_internal(value)) { +#ifndef NDEBUG + TraceAtStart("ALLOC_MD_NOREF_KEY"); +#endif +} + +AllocatedMetadata::AllocatedMetadata( + const grpc_core::ManagedMemorySlice& key, + const grpc_core::UnmanagedMemorySlice& value) + : RefcountedMdBase(key, value) { +#ifndef NDEBUG + TraceAtStart("ALLOC_MD_NOREF_KEY_VAL"); +#endif +} + +AllocatedMetadata::AllocatedMetadata( + const grpc_core::ExternallyManagedSlice& key, + const grpc_core::UnmanagedMemorySlice& value) + : RefcountedMdBase(key, value) { +#ifndef NDEBUG + TraceAtStart("ALLOC_MD_NOREF_KEY_VAL"); #endif } @@ -134,6 +153,19 @@ AllocatedMetadata::~AllocatedMetadata() { } } +#ifndef NDEBUG +void grpc_core::RefcountedMdBase::TraceAtStart(const char* tag) { + if (grpc_trace_metadata.enabled()) { + char* key_str = grpc_slice_to_c_string(key()); + char* value_str = grpc_slice_to_c_string(value()); + gpr_log(GPR_DEBUG, "mdelem %s:%p:%" PRIdPTR ": '%s' = '%s'", tag, this, + RefValue(), key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } +} +#endif + InternedMetadata::InternedMetadata(const grpc_slice& key, const grpc_slice& value, uint32_t hash, InternedMetadata* next) @@ -141,14 +173,16 @@ InternedMetadata::InternedMetadata(const grpc_slice& key, grpc_slice_ref_internal(value), hash), link_(next) { #ifndef NDEBUG - if (grpc_trace_metadata.enabled()) { - char* key_str = grpc_slice_to_c_string(key); - char* value_str = grpc_slice_to_c_string(value); - gpr_log(GPR_DEBUG, "ELM NEW:%p:%" PRIdPTR ": '%s' = '%s'", this, - RefValue(), key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); - } + TraceAtStart("INTERNED_MD"); +#endif +} + +InternedMetadata::InternedMetadata(const grpc_slice& key, + const grpc_slice& value, uint32_t hash, + InternedMetadata* next, const NoRefKey*) + : RefcountedMdBase(key, grpc_slice_ref_internal(value), hash), link_(next) { +#ifndef NDEBUG + TraceAtStart("INTERNED_MD_NOREF_KEY"); #endif } @@ -248,8 +282,8 @@ void InternedMetadata::RefWithShardLocked(mdtab_shard* shard) { char* value_str = grpc_slice_to_c_string(value()); intptr_t value = RefValue(); gpr_log(__FILE__, __LINE__, GPR_LOG_SEVERITY_DEBUG, - "ELM REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", this, value, - value + 1, key_str, value_str); + "mdelem REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", this, + value, value + 1, key_str, value_str); gpr_free(key_str); gpr_free(value_str); } @@ -307,36 +341,100 @@ static void rehash_mdtab(mdtab_shard* shard) { } } -grpc_mdelem grpc_mdelem_create( +template +static grpc_mdelem md_create_maybe_static(const grpc_slice& key, + const grpc_slice& value); +template +static grpc_mdelem md_create_must_intern(const grpc_slice& key, + const grpc_slice& value, + uint32_t hash); + +template +static grpc_mdelem md_create( const grpc_slice& key, const grpc_slice& value, grpc_mdelem_data* compatible_external_backing_store) { + // Ensure slices are, in fact, static if we claimed they were. + GPR_DEBUG_ASSERT(!key_definitely_static || + GRPC_IS_STATIC_METADATA_STRING(key)); + GPR_DEBUG_ASSERT(!value_definitely_static || + GRPC_IS_STATIC_METADATA_STRING(value)); + const bool key_is_interned = + key_definitely_static || grpc_slice_is_interned(key); + const bool value_is_interned = + value_definitely_static || grpc_slice_is_interned(value); // External storage if either slice is not interned and the caller already // created a backing store. If no backing store, we allocate one. - if (!grpc_slice_is_interned(key) || !grpc_slice_is_interned(value)) { + if (!key_is_interned || !value_is_interned) { if (compatible_external_backing_store != nullptr) { // Caller provided backing store. return GRPC_MAKE_MDELEM(compatible_external_backing_store, GRPC_MDELEM_STORAGE_EXTERNAL); } else { // We allocate backing store. - return GRPC_MAKE_MDELEM(grpc_core::New(key, value), - GRPC_MDELEM_STORAGE_ALLOCATED); + return key_definitely_static + ? GRPC_MAKE_MDELEM( + grpc_core::New( + key, value, + static_cast( + nullptr)), + GRPC_MDELEM_STORAGE_ALLOCATED) + : GRPC_MAKE_MDELEM( + grpc_core::New(key, value), + GRPC_MDELEM_STORAGE_ALLOCATED); } } + return md_create_maybe_static( + key, value); +} + +template +static grpc_mdelem md_create_maybe_static(const grpc_slice& key, + const grpc_slice& value) { + // Ensure slices are, in fact, static if we claimed they were. + GPR_DEBUG_ASSERT(!key_definitely_static || + GRPC_IS_STATIC_METADATA_STRING(key)); + GPR_DEBUG_ASSERT(!value_definitely_static || + GRPC_IS_STATIC_METADATA_STRING(value)); + GPR_DEBUG_ASSERT(key.refcount != nullptr); + GPR_DEBUG_ASSERT(value.refcount != nullptr); + + const bool key_is_static_mdstr = + key_definitely_static || + key.refcount->GetType() == grpc_slice_refcount::Type::STATIC; + const bool value_is_static_mdstr = + value_definitely_static || + value.refcount->GetType() == grpc_slice_refcount::Type::STATIC; + + const intptr_t kidx = GRPC_STATIC_METADATA_INDEX(key); // Not all static slice input yields a statically stored metadata element. - // It may be worth documenting why. - if (GRPC_IS_STATIC_METADATA_STRING(key) && - GRPC_IS_STATIC_METADATA_STRING(value)) { + if (key_is_static_mdstr && value_is_static_mdstr) { grpc_mdelem static_elem = grpc_static_mdelem_for_static_strings( - GRPC_STATIC_METADATA_INDEX(key), GRPC_STATIC_METADATA_INDEX(value)); + kidx, GRPC_STATIC_METADATA_INDEX(value)); if (!GRPC_MDISNULL(static_elem)) { return static_elem; } } - uint32_t hash = GRPC_MDSTR_KV_HASH(grpc_slice_hash_refcounted(key), - grpc_slice_hash_refcounted(value)); + uint32_t khash = key_definitely_static + ? grpc_static_metadata_hash_values[kidx] + : grpc_slice_hash_refcounted(key); + + uint32_t hash = GRPC_MDSTR_KV_HASH(khash, grpc_slice_hash_refcounted(value)); + return md_create_must_intern(key, value, hash); +} + +template +static grpc_mdelem md_create_must_intern(const grpc_slice& key, + const grpc_slice& value, + uint32_t hash) { + // Here, we know both key and value are both at least interned, and both + // possibly static. We know that anything inside the shared interned table is + // also at least interned (and maybe static). Note that equality for a static + // and interned slice implies that they are both the same exact slice. + // The same applies to a pair of interned slices, or a pair of static slices. + // Rather than run the full equality check, we can therefore just do a pointer + // comparison of the refcounts. InternedMetadata* md; mdtab_shard* shard = &g_shards[SHARD_IDX(hash)]; size_t idx; @@ -348,7 +446,8 @@ grpc_mdelem grpc_mdelem_create( idx = TABLE_IDX(hash, shard->capacity); /* search for an existing pair */ for (md = shard->elems[idx].next; md; md = md->bucket_next()) { - if (grpc_slice_eq(key, md->key()) && grpc_slice_eq(value, md->value())) { + if (grpc_slice_static_interned_equal(key, md->key()) && + grpc_slice_static_interned_equal(value, md->value())) { md->RefWithShardLocked(shard); gpr_mu_unlock(&shard->mu); return GRPC_MAKE_MDELEM(md, GRPC_MDELEM_STORAGE_INTERNED); @@ -356,8 +455,12 @@ grpc_mdelem grpc_mdelem_create( } /* not found: create a new pair */ - md = grpc_core::New(key, value, hash, - shard->elems[idx].next); + md = key_definitely_static + ? grpc_core::New( + key, value, hash, shard->elems[idx].next, + static_cast(nullptr)) + : grpc_core::New(key, value, hash, + shard->elems[idx].next); shard->elems[idx].next = md; shard->count++; @@ -370,9 +473,68 @@ grpc_mdelem grpc_mdelem_create( return GRPC_MAKE_MDELEM(md, GRPC_MDELEM_STORAGE_INTERNED); } +grpc_mdelem grpc_mdelem_create( + const grpc_slice& key, const grpc_slice& value, + grpc_mdelem_data* compatible_external_backing_store) { + return md_create(key, value, compatible_external_backing_store); +} + +grpc_mdelem grpc_mdelem_create( + const grpc_core::StaticMetadataSlice& key, const grpc_slice& value, + grpc_mdelem_data* compatible_external_backing_store) { + return md_create(key, value, compatible_external_backing_store); +} + +/* Create grpc_mdelem from provided slices. We specify via template parameter + whether we know that the input key is static or not. If it is, we short + circuit various comparisons and a no-op unref. */ +template +static grpc_mdelem md_from_slices(const grpc_slice& key, + const grpc_slice& value) { + // Ensure key is, in fact, static if we claimed it was. + GPR_DEBUG_ASSERT(!key_definitely_static || + GRPC_IS_STATIC_METADATA_STRING(key)); + grpc_mdelem out = md_create(key, value, nullptr); + if (!key_definitely_static) { + grpc_slice_unref_internal(key); + } + grpc_slice_unref_internal(value); + return out; +} + grpc_mdelem grpc_mdelem_from_slices(const grpc_slice& key, const grpc_slice& value) { - grpc_mdelem out = grpc_mdelem_create(key, value, nullptr); + return md_from_slices(key, value); +} + +grpc_mdelem grpc_mdelem_from_slices(const grpc_core::StaticMetadataSlice& key, + const grpc_slice& value) { + return md_from_slices(key, value); +} + +grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::StaticMetadataSlice& key, + const grpc_core::StaticMetadataSlice& value) { + grpc_mdelem out = md_create_maybe_static(key, value); + return out; +} + +grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::StaticMetadataSlice& key, + const grpc_core::ManagedMemorySlice& value) { + // TODO(arjunroy): We can save the unref if md_create_maybe_static ended up + // creating a new interned metadata. But otherwise - we need this here. + grpc_mdelem out = md_create_maybe_static(key, value); + grpc_slice_unref_internal(value); + return out; +} + +grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::ManagedMemorySlice& key, + const grpc_core::ManagedMemorySlice& value) { + grpc_mdelem out = md_create_maybe_static(key, value); + // TODO(arjunroy): We can save the unref if md_create_maybe_static ended up + // creating a new interned metadata. But otherwise - we need this here. grpc_slice_unref_internal(key); grpc_slice_unref_internal(value); return out; diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h index 4621433bf01..3d3a68119f2 100644 --- a/src/core/lib/transport/metadata.h +++ b/src/core/lib/transport/metadata.h @@ -118,10 +118,31 @@ struct grpc_mdelem { ((grpc_mdelem_data_storage)((md).payload & \ (uintptr_t)GRPC_MDELEM_STORAGE_INTERNED_BIT)) -/* Unrefs the slices. */ +/* Given arbitrary input slices, create a grpc_mdelem object. The caller refs + * the input slices; we unref them. This method is always safe to call; however, + * if we know data about the slices in question (e.g. if we knew our key was + * static) we can call specializations that save on cycle count. */ grpc_mdelem grpc_mdelem_from_slices(const grpc_slice& key, const grpc_slice& value); +/* Like grpc_mdelem_from_slices, but we know that key is a static slice. This + saves us a few branches and a no-op call to md_unref() for the key. */ +grpc_mdelem grpc_mdelem_from_slices(const grpc_core::StaticMetadataSlice& key, + const grpc_slice& value); + +/* Like grpc_mdelem_from_slices, but key is static and val is static. */ +grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::StaticMetadataSlice& key, + const grpc_core::StaticMetadataSlice& value); + +/* Like grpc_mdelem_from_slices, but key is static and val is interned. */ +grpc_mdelem grpc_mdelem_from_slices(const grpc_core::StaticMetadataSlice& key, + const grpc_core::ManagedMemorySlice& value); + +/* Like grpc_mdelem_from_slices, but key and val are interned. */ +grpc_mdelem grpc_mdelem_from_slices(const grpc_core::ManagedMemorySlice& key, + const grpc_core::ManagedMemorySlice& value); + /* Cheaply convert a grpc_metadata to a grpc_mdelem; may use the grpc_metadata object as backing storage (so lifetimes should align) */ grpc_mdelem grpc_mdelem_from_grpc_metadata(grpc_metadata* metadata); @@ -134,6 +155,11 @@ grpc_mdelem grpc_mdelem_create( const grpc_slice& key, const grpc_slice& value, grpc_mdelem_data* compatible_external_backing_store); +/* Like grpc_mdelem_create, but we know that key is static. */ +grpc_mdelem grpc_mdelem_create( + const grpc_core::StaticMetadataSlice& key, const grpc_slice& value, + grpc_mdelem_data* compatible_external_backing_store); + #define GRPC_MDKEY(md) (GRPC_MDELEM_DATA(md)->key) #define GRPC_MDVALUE(md) (GRPC_MDELEM_DATA(md)->value) @@ -239,6 +265,10 @@ class RefcountedMdBase { } protected: +#ifndef NDEBUG + void TraceAtStart(const char* tag); +#endif + intptr_t RefValue() { return refcnt_.Load(MemoryOrder::RELAXED); } bool AllRefsDropped() { return refcnt_.Load(MemoryOrder::ACQUIRE) == 0; } bool FirstRef() { return refcnt_.FetchAdd(1, MemoryOrder::RELAXED) == 0; } @@ -253,16 +283,19 @@ class RefcountedMdBase { class InternedMetadata : public RefcountedMdBase { public: + // TODO(arjunroy): Change to use strongly typed slices instead. + struct NoRefKey {}; struct BucketLink { explicit BucketLink(InternedMetadata* md) : next(md) {} InternedMetadata* next = nullptr; }; - InternedMetadata(const grpc_slice& key, const grpc_slice& value, uint32_t hash, InternedMetadata* next); - ~InternedMetadata(); + InternedMetadata(const grpc_slice& key, const grpc_slice& value, + uint32_t hash, InternedMetadata* next, const NoRefKey*); + ~InternedMetadata(); void RefWithShardLocked(mdtab_shard* shard); UserData* user_data() { return &user_data_; } InternedMetadata* bucket_next() { return link_.next; } @@ -278,7 +311,15 @@ class InternedMetadata : public RefcountedMdBase { /* Shadow structure for grpc_mdelem_data for allocated elements */ class AllocatedMetadata : public RefcountedMdBase { public: + // TODO(arjunroy): Change to use strongly typed slices instead. + struct NoRefKey {}; AllocatedMetadata(const grpc_slice& key, const grpc_slice& value); + AllocatedMetadata(const grpc_core::ManagedMemorySlice& key, + const grpc_core::UnmanagedMemorySlice& value); + AllocatedMetadata(const grpc_core::ExternallyManagedSlice& key, + const grpc_core::UnmanagedMemorySlice& value); + AllocatedMetadata(const grpc_slice& key, const grpc_slice& value, + const NoRefKey*); ~AllocatedMetadata(); UserData* user_data() { return &user_data_; } @@ -374,4 +415,35 @@ inline void grpc_mdelem_unref(grpc_mdelem gmd) { void grpc_mdctx_global_init(void); void grpc_mdctx_global_shutdown(); +/* Like grpc_mdelem_from_slices, but we know that key is a static or interned + slice and value is not static or interned. This gives us an inlinable + fastpath - we know we must allocate metadata now, and that we do not need to + unref the value (rather, we just transfer the ref). We can avoid a ref since: + 1) the key slice is passed in already ref'd + 2) We're guaranteed to create a new Allocated slice, thus meaning the + ref can be considered 'transferred'.*/ +inline grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::ManagedMemorySlice& key, + const grpc_core::UnmanagedMemorySlice& value) { + using grpc_core::AllocatedMetadata; + return GRPC_MAKE_MDELEM(grpc_core::New(key, value), + GRPC_MDELEM_STORAGE_ALLOCATED); +} + +inline grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::ExternallyManagedSlice& key, + const grpc_core::UnmanagedMemorySlice& value) { + using grpc_core::AllocatedMetadata; + return GRPC_MAKE_MDELEM(grpc_core::New(key, value), + GRPC_MDELEM_STORAGE_ALLOCATED); +} + +inline grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::StaticMetadataSlice& key, + const grpc_core::UnmanagedMemorySlice& value) { + using grpc_core::AllocatedMetadata; + return GRPC_MAKE_MDELEM(grpc_core::New(key, value), + GRPC_MDELEM_STORAGE_ALLOCATED); +} + #endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_H */ diff --git a/src/core/lib/transport/static_metadata.cc b/src/core/lib/transport/static_metadata.cc index c83d1e59491..ec5db5515a7 100644 --- a/src/core/lib/transport/static_metadata.cc +++ b/src/core/lib/transport/static_metadata.cc @@ -226,113 +226,220 @@ grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = { grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), }; -const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { - {&grpc_static_metadata_refcounts[0], {{5, g_bytes + 0}}}, - {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}}, - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[3], {{10, g_bytes + 19}}}, - {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}}, - {&grpc_static_metadata_refcounts[5], {{2, g_bytes + 36}}}, - {&grpc_static_metadata_refcounts[6], {{12, g_bytes + 38}}}, - {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}}, - {&grpc_static_metadata_refcounts[8], {{16, g_bytes + 61}}}, - {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}}, - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[11], {{21, g_bytes + 110}}}, - {&grpc_static_metadata_refcounts[12], {{13, g_bytes + 131}}}, - {&grpc_static_metadata_refcounts[13], {{14, g_bytes + 144}}}, - {&grpc_static_metadata_refcounts[14], {{12, g_bytes + 158}}}, - {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}}, - {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[17], {{30, g_bytes + 201}}}, - {&grpc_static_metadata_refcounts[18], {{37, g_bytes + 231}}}, - {&grpc_static_metadata_refcounts[19], {{10, g_bytes + 268}}}, - {&grpc_static_metadata_refcounts[20], {{4, g_bytes + 278}}}, - {&grpc_static_metadata_refcounts[21], {{26, g_bytes + 282}}}, - {&grpc_static_metadata_refcounts[22], {{22, g_bytes + 308}}}, - {&grpc_static_metadata_refcounts[23], {{12, g_bytes + 330}}}, - {&grpc_static_metadata_refcounts[24], {{1, g_bytes + 342}}}, - {&grpc_static_metadata_refcounts[25], {{1, g_bytes + 343}}}, - {&grpc_static_metadata_refcounts[26], {{1, g_bytes + 344}}}, - {&grpc_static_metadata_refcounts[27], {{1, g_bytes + 345}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, - {&grpc_static_metadata_refcounts[29], {{19, g_bytes + 346}}}, - {&grpc_static_metadata_refcounts[30], {{12, g_bytes + 365}}}, - {&grpc_static_metadata_refcounts[31], {{30, g_bytes + 377}}}, - {&grpc_static_metadata_refcounts[32], {{31, g_bytes + 407}}}, - {&grpc_static_metadata_refcounts[33], {{36, g_bytes + 438}}}, - {&grpc_static_metadata_refcounts[34], {{28, g_bytes + 474}}}, - {&grpc_static_metadata_refcounts[35], {{80, g_bytes + 502}}}, - {&grpc_static_metadata_refcounts[36], {{7, g_bytes + 582}}}, - {&grpc_static_metadata_refcounts[37], {{4, g_bytes + 589}}}, - {&grpc_static_metadata_refcounts[38], {{11, g_bytes + 593}}}, - {&grpc_static_metadata_refcounts[39], {{3, g_bytes + 604}}}, - {&grpc_static_metadata_refcounts[40], {{4, g_bytes + 607}}}, - {&grpc_static_metadata_refcounts[41], {{1, g_bytes + 611}}}, - {&grpc_static_metadata_refcounts[42], {{11, g_bytes + 612}}}, - {&grpc_static_metadata_refcounts[43], {{4, g_bytes + 623}}}, - {&grpc_static_metadata_refcounts[44], {{5, g_bytes + 627}}}, - {&grpc_static_metadata_refcounts[45], {{3, g_bytes + 632}}}, - {&grpc_static_metadata_refcounts[46], {{3, g_bytes + 635}}}, - {&grpc_static_metadata_refcounts[47], {{3, g_bytes + 638}}}, - {&grpc_static_metadata_refcounts[48], {{3, g_bytes + 641}}}, - {&grpc_static_metadata_refcounts[49], {{3, g_bytes + 644}}}, - {&grpc_static_metadata_refcounts[50], {{3, g_bytes + 647}}}, - {&grpc_static_metadata_refcounts[51], {{3, g_bytes + 650}}}, - {&grpc_static_metadata_refcounts[52], {{14, g_bytes + 653}}}, - {&grpc_static_metadata_refcounts[53], {{13, g_bytes + 667}}}, - {&grpc_static_metadata_refcounts[54], {{15, g_bytes + 680}}}, - {&grpc_static_metadata_refcounts[55], {{13, g_bytes + 695}}}, - {&grpc_static_metadata_refcounts[56], {{6, g_bytes + 708}}}, - {&grpc_static_metadata_refcounts[57], {{27, g_bytes + 714}}}, - {&grpc_static_metadata_refcounts[58], {{3, g_bytes + 741}}}, - {&grpc_static_metadata_refcounts[59], {{5, g_bytes + 744}}}, - {&grpc_static_metadata_refcounts[60], {{13, g_bytes + 749}}}, - {&grpc_static_metadata_refcounts[61], {{13, g_bytes + 762}}}, - {&grpc_static_metadata_refcounts[62], {{19, g_bytes + 775}}}, - {&grpc_static_metadata_refcounts[63], {{16, g_bytes + 794}}}, - {&grpc_static_metadata_refcounts[64], {{14, g_bytes + 810}}}, - {&grpc_static_metadata_refcounts[65], {{16, g_bytes + 824}}}, - {&grpc_static_metadata_refcounts[66], {{13, g_bytes + 840}}}, - {&grpc_static_metadata_refcounts[67], {{6, g_bytes + 853}}}, - {&grpc_static_metadata_refcounts[68], {{4, g_bytes + 859}}}, - {&grpc_static_metadata_refcounts[69], {{4, g_bytes + 863}}}, - {&grpc_static_metadata_refcounts[70], {{6, g_bytes + 867}}}, - {&grpc_static_metadata_refcounts[71], {{7, g_bytes + 873}}}, - {&grpc_static_metadata_refcounts[72], {{4, g_bytes + 880}}}, - {&grpc_static_metadata_refcounts[73], {{8, g_bytes + 884}}}, - {&grpc_static_metadata_refcounts[74], {{17, g_bytes + 892}}}, - {&grpc_static_metadata_refcounts[75], {{13, g_bytes + 909}}}, - {&grpc_static_metadata_refcounts[76], {{8, g_bytes + 922}}}, - {&grpc_static_metadata_refcounts[77], {{19, g_bytes + 930}}}, - {&grpc_static_metadata_refcounts[78], {{13, g_bytes + 949}}}, - {&grpc_static_metadata_refcounts[79], {{4, g_bytes + 962}}}, - {&grpc_static_metadata_refcounts[80], {{8, g_bytes + 966}}}, - {&grpc_static_metadata_refcounts[81], {{12, g_bytes + 974}}}, - {&grpc_static_metadata_refcounts[82], {{18, g_bytes + 986}}}, - {&grpc_static_metadata_refcounts[83], {{19, g_bytes + 1004}}}, - {&grpc_static_metadata_refcounts[84], {{5, g_bytes + 1023}}}, - {&grpc_static_metadata_refcounts[85], {{7, g_bytes + 1028}}}, - {&grpc_static_metadata_refcounts[86], {{7, g_bytes + 1035}}}, - {&grpc_static_metadata_refcounts[87], {{11, g_bytes + 1042}}}, - {&grpc_static_metadata_refcounts[88], {{6, g_bytes + 1053}}}, - {&grpc_static_metadata_refcounts[89], {{10, g_bytes + 1059}}}, - {&grpc_static_metadata_refcounts[90], {{25, g_bytes + 1069}}}, - {&grpc_static_metadata_refcounts[91], {{17, g_bytes + 1094}}}, - {&grpc_static_metadata_refcounts[92], {{4, g_bytes + 1111}}}, - {&grpc_static_metadata_refcounts[93], {{3, g_bytes + 1115}}}, - {&grpc_static_metadata_refcounts[94], {{16, g_bytes + 1118}}}, - {&grpc_static_metadata_refcounts[95], {{1, g_bytes + 1134}}}, - {&grpc_static_metadata_refcounts[96], {{8, g_bytes + 1135}}}, - {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}, - {&grpc_static_metadata_refcounts[98], {{16, g_bytes + 1151}}}, - {&grpc_static_metadata_refcounts[99], {{4, g_bytes + 1167}}}, - {&grpc_static_metadata_refcounts[100], {{3, g_bytes + 1171}}}, - {&grpc_static_metadata_refcounts[101], {{11, g_bytes + 1174}}}, - {&grpc_static_metadata_refcounts[102], {{16, g_bytes + 1185}}}, - {&grpc_static_metadata_refcounts[103], {{13, g_bytes + 1201}}}, - {&grpc_static_metadata_refcounts[104], {{12, g_bytes + 1214}}}, - {&grpc_static_metadata_refcounts[105], {{21, g_bytes + 1226}}}, +const grpc_core::StaticMetadataSlice + grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0], 5, + g_bytes + 0), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1], 7, + g_bytes + 5), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[3], 10, + g_bytes + 19), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4], 7, + g_bytes + 29), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[5], 2, + g_bytes + 36), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[6], 12, + g_bytes + 38), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7], 11, + g_bytes + 50), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[8], 16, + g_bytes + 61), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9], 13, + g_bytes + 77), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[11], 21, + g_bytes + 110), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[12], 13, + g_bytes + 131), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[13], 14, + g_bytes + 144), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14], 12, + g_bytes + 158), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15], 16, + g_bytes + 170), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[17], 30, + g_bytes + 201), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[18], 37, + g_bytes + 231), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[19], 10, + g_bytes + 268), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[20], 4, + g_bytes + 278), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[21], 26, + g_bytes + 282), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[22], 22, + g_bytes + 308), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[23], 12, + g_bytes + 330), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[24], 1, + g_bytes + 342), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[25], 1, + g_bytes + 343), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[26], 1, + g_bytes + 344), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[27], 1, + g_bytes + 345), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[29], 19, + g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[30], 12, + g_bytes + 365), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[31], 30, + g_bytes + 377), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[32], 31, + g_bytes + 407), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[33], 36, + g_bytes + 438), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[34], 28, + g_bytes + 474), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[35], 80, + g_bytes + 502), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36], 7, + g_bytes + 582), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, + g_bytes + 589), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38], 11, + g_bytes + 593), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39], 3, + g_bytes + 604), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40], 4, + g_bytes + 607), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41], 1, + g_bytes + 611), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42], 11, + g_bytes + 612), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43], 4, + g_bytes + 623), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44], 5, + g_bytes + 627), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45], 3, + g_bytes + 632), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46], 3, + g_bytes + 635), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47], 3, + g_bytes + 638), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48], 3, + g_bytes + 641), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49], 3, + g_bytes + 644), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50], 3, + g_bytes + 647), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51], 3, + g_bytes + 650), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52], 14, + g_bytes + 653), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53], 13, + g_bytes + 667), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54], 15, + g_bytes + 680), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55], 13, + g_bytes + 695), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56], 6, + g_bytes + 708), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57], 27, + g_bytes + 714), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58], 3, + g_bytes + 741), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59], 5, + g_bytes + 744), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60], 13, + g_bytes + 749), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61], 13, + g_bytes + 762), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62], 19, + g_bytes + 775), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63], 16, + g_bytes + 794), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64], 14, + g_bytes + 810), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65], 16, + g_bytes + 824), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66], 13, + g_bytes + 840), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67], 6, + g_bytes + 853), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68], 4, + g_bytes + 859), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69], 4, + g_bytes + 863), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70], 6, + g_bytes + 867), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71], 7, + g_bytes + 873), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72], 4, + g_bytes + 880), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73], 8, + g_bytes + 884), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74], 17, + g_bytes + 892), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75], 13, + g_bytes + 909), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76], 8, + g_bytes + 922), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77], 19, + g_bytes + 930), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78], 13, + g_bytes + 949), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79], 4, + g_bytes + 962), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80], 8, + g_bytes + 966), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81], 12, + g_bytes + 974), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82], 18, + g_bytes + 986), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83], 19, + g_bytes + 1004), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84], 5, + g_bytes + 1023), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85], 7, + g_bytes + 1028), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86], 7, + g_bytes + 1035), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87], 11, + g_bytes + 1042), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88], 6, + g_bytes + 1053), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89], 10, + g_bytes + 1059), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90], 25, + g_bytes + 1069), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91], 17, + g_bytes + 1094), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92], 4, + g_bytes + 1111), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93], 3, + g_bytes + 1115), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94], 16, + g_bytes + 1118), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95], 1, + g_bytes + 1134), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, + g_bytes + 1135), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97], 8, + g_bytes + 1143), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98], 16, + g_bytes + 1151), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99], 4, + g_bytes + 1167), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[100], 3, + g_bytes + 1171), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[101], 11, + g_bytes + 1174), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[102], 16, + g_bytes + 1185), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[103], 13, + g_bytes + 1201), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[104], 12, + g_bytes + 1214), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[105], 21, + g_bytes + 1226), }; /* Warning: the core static metadata currently operates under the soft @@ -830,260 +937,515 @@ grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b) { grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[3], {{10, g_bytes + 19}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 0), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}}, - {&grpc_static_metadata_refcounts[39], {{3, g_bytes + 604}}}, 1), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}}, - {&grpc_static_metadata_refcounts[40], {{4, g_bytes + 607}}}, 2), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[0], {{5, g_bytes + 0}}}, - {&grpc_static_metadata_refcounts[41], {{1, g_bytes + 611}}}, 3), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[0], {{5, g_bytes + 0}}}, - {&grpc_static_metadata_refcounts[42], {{11, g_bytes + 612}}}, 4), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}}, - {&grpc_static_metadata_refcounts[43], {{4, g_bytes + 623}}}, 5), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}}, - {&grpc_static_metadata_refcounts[44], {{5, g_bytes + 627}}}, 6), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[45], {{3, g_bytes + 632}}}, 7), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[46], {{3, g_bytes + 635}}}, 8), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[47], {{3, g_bytes + 638}}}, 9), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[48], {{3, g_bytes + 641}}}, 10), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[49], {{3, g_bytes + 644}}}, 11), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[50], {{3, g_bytes + 647}}}, 12), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[51], {{3, g_bytes + 650}}}, 13), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[52], {{14, g_bytes + 653}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 14), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[53], {{13, g_bytes + 667}}}, 15), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[54], {{15, g_bytes + 680}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 16), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[55], {{13, g_bytes + 695}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 17), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[56], {{6, g_bytes + 708}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 18), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[57], {{27, g_bytes + 714}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 19), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[58], {{3, g_bytes + 741}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 20), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[59], {{5, g_bytes + 744}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 21), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[60], {{13, g_bytes + 749}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 22), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[61], {{13, g_bytes + 762}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 23), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[62], {{19, g_bytes + 775}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 24), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 25), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[63], {{16, g_bytes + 794}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 26), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[64], {{14, g_bytes + 810}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 27), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[65], {{16, g_bytes + 824}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 28), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[66], {{13, g_bytes + 840}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 29), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[14], {{12, g_bytes + 158}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 30), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[67], {{6, g_bytes + 853}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 31), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[68], {{4, g_bytes + 859}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 32), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[69], {{4, g_bytes + 863}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 33), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[70], {{6, g_bytes + 867}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 34), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[71], {{7, g_bytes + 873}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 35), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[72], {{4, g_bytes + 880}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 36), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[20], {{4, g_bytes + 278}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 37), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[73], {{8, g_bytes + 884}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 38), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[74], {{17, g_bytes + 892}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 39), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[75], {{13, g_bytes + 909}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 40), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[76], {{8, g_bytes + 922}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 41), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[77], {{19, g_bytes + 930}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 42), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[78], {{13, g_bytes + 949}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 43), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[79], {{4, g_bytes + 962}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 44), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[80], {{8, g_bytes + 966}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 45), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[81], {{12, g_bytes + 974}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 46), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[82], {{18, g_bytes + 986}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 47), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[83], {{19, g_bytes + 1004}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 48), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[84], {{5, g_bytes + 1023}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 49), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[85], {{7, g_bytes + 1028}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 50), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[86], {{7, g_bytes + 1035}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 51), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[87], {{11, g_bytes + 1042}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 52), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[88], {{6, g_bytes + 1053}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 53), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[89], {{10, g_bytes + 1059}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 54), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[90], {{25, g_bytes + 1069}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 55), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[91], {{17, g_bytes + 1094}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 56), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[19], {{10, g_bytes + 268}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 57), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[92], {{4, g_bytes + 1111}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 58), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[93], {{3, g_bytes + 1115}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 59), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[94], {{16, g_bytes + 1118}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 60), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}}, - {&grpc_static_metadata_refcounts[95], {{1, g_bytes + 1134}}}, 61), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}}, - {&grpc_static_metadata_refcounts[24], {{1, g_bytes + 342}}}, 62), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}}, - {&grpc_static_metadata_refcounts[25], {{1, g_bytes + 343}}}, 63), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}}, - {&grpc_static_metadata_refcounts[96], {{8, g_bytes + 1135}}}, 64), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}}, - {&grpc_static_metadata_refcounts[37], {{4, g_bytes + 589}}}, 65), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}}, - {&grpc_static_metadata_refcounts[36], {{7, g_bytes + 582}}}, 66), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[5], {{2, g_bytes + 36}}}, - {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}, 67), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[14], {{12, g_bytes + 158}}}, - {&grpc_static_metadata_refcounts[98], {{16, g_bytes + 1151}}}, 68), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}}, - {&grpc_static_metadata_refcounts[99], {{4, g_bytes + 1167}}}, 69), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}}, - {&grpc_static_metadata_refcounts[100], {{3, g_bytes + 1171}}}, 70), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 71), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}}, - {&grpc_static_metadata_refcounts[96], {{8, g_bytes + 1135}}}, 72), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}}, - {&grpc_static_metadata_refcounts[37], {{4, g_bytes + 589}}}, 73), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[101], {{11, g_bytes + 1174}}}, - {&grpc_static_metadata_refcounts[28], {{0, g_bytes + 346}}}, 74), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[96], {{8, g_bytes + 1135}}}, 75), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[36], {{7, g_bytes + 582}}}, 76), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[102], {{16, g_bytes + 1185}}}, 77), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[37], {{4, g_bytes + 589}}}, 78), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[103], {{13, g_bytes + 1201}}}, 79), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[104], {{12, g_bytes + 1214}}}, 80), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[105], {{21, g_bytes + 1226}}}, 81), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[96], {{8, g_bytes + 1135}}}, 82), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[37], {{4, g_bytes + 589}}}, 83), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[103], {{13, g_bytes + 1201}}}, 84), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[3], 10, + g_bytes + 19), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 0), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1], 7, + g_bytes + 5), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39], 3, + g_bytes + 604), + 1), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1], 7, + g_bytes + 5), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40], 4, + g_bytes + 607), + 2), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0], 5, + g_bytes + 0), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41], 1, + g_bytes + 611), + 3), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0], 5, + g_bytes + 0), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42], 11, + g_bytes + 612), + 4), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4], 7, + g_bytes + 29), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43], 4, + g_bytes + 623), + 5), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4], 7, + g_bytes + 29), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44], 5, + g_bytes + 627), + 6), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45], 3, + g_bytes + 632), + 7), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46], 3, + g_bytes + 635), + 8), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47], 3, + g_bytes + 638), + 9), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48], 3, + g_bytes + 641), + 10), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49], 3, + g_bytes + 644), + 11), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50], 3, + g_bytes + 647), + 12), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51], 3, + g_bytes + 650), + 13), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52], 14, + g_bytes + 653), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 14), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53], 13, + g_bytes + 667), + 15), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54], 15, + g_bytes + 680), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 16), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55], 13, + g_bytes + 695), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 17), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56], 6, + g_bytes + 708), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 18), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57], 27, + g_bytes + 714), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 19), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58], 3, + g_bytes + 741), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 20), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59], 5, + g_bytes + 744), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 21), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60], 13, + g_bytes + 749), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 22), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61], 13, + g_bytes + 762), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 23), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62], 19, + g_bytes + 775), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 24), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15], 16, + g_bytes + 170), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 25), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63], 16, + g_bytes + 794), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 26), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64], 14, + g_bytes + 810), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 27), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65], 16, + g_bytes + 824), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 28), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66], 13, + g_bytes + 840), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 29), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14], 12, + g_bytes + 158), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 30), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67], 6, + g_bytes + 853), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 31), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68], 4, + g_bytes + 859), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 32), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69], 4, + g_bytes + 863), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 33), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70], 6, + g_bytes + 867), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 34), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71], 7, + g_bytes + 873), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 35), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72], 4, + g_bytes + 880), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 36), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[20], 4, + g_bytes + 278), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 37), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73], 8, + g_bytes + 884), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 38), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74], 17, + g_bytes + 892), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 39), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75], 13, + g_bytes + 909), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 40), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76], 8, + g_bytes + 922), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 41), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77], 19, + g_bytes + 930), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 42), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78], 13, + g_bytes + 949), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 43), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79], 4, + g_bytes + 962), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 44), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80], 8, + g_bytes + 966), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 45), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81], 12, + g_bytes + 974), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 46), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82], 18, + g_bytes + 986), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 47), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83], 19, + g_bytes + 1004), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 48), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84], 5, + g_bytes + 1023), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 49), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85], 7, + g_bytes + 1028), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 50), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86], 7, + g_bytes + 1035), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 51), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87], 11, + g_bytes + 1042), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 52), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88], 6, + g_bytes + 1053), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 53), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89], 10, + g_bytes + 1059), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 54), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90], 25, + g_bytes + 1069), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 55), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91], 17, + g_bytes + 1094), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 56), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[19], 10, + g_bytes + 268), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 57), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92], 4, + g_bytes + 1111), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 58), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93], 3, + g_bytes + 1115), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 59), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94], 16, + g_bytes + 1118), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 60), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7], 11, + g_bytes + 50), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95], 1, + g_bytes + 1134), + 61), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7], 11, + g_bytes + 50), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[24], 1, + g_bytes + 342), + 62), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7], 11, + g_bytes + 50), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[25], 1, + g_bytes + 343), + 63), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9], 13, + g_bytes + 77), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, + g_bytes + 1135), + 64), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9], 13, + g_bytes + 77), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, + g_bytes + 589), + 65), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9], 13, + g_bytes + 77), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36], 7, + g_bytes + 582), + 66), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[5], 2, + g_bytes + 36), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97], 8, + g_bytes + 1143), + 67), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14], 12, + g_bytes + 158), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98], 16, + g_bytes + 1151), + 68), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4], 7, + g_bytes + 29), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99], 4, + g_bytes + 1167), + 69), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1], 7, + g_bytes + 5), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[100], 3, + g_bytes + 1171), + 70), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 71), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15], 16, + g_bytes + 170), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, + g_bytes + 1135), + 72), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15], 16, + g_bytes + 170), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, + g_bytes + 589), + 73), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[101], 11, + g_bytes + 1174), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 74), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, + g_bytes + 1135), + 75), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36], 7, + g_bytes + 582), + 76), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[102], 16, + g_bytes + 1185), + 77), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, + g_bytes + 589), + 78), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[103], 13, + g_bytes + 1201), + 79), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[104], 12, + g_bytes + 1214), + 80), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[105], 21, + g_bytes + 1226), + 81), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, + g_bytes + 1135), + 82), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, + g_bytes + 589), + 83), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[103], 13, + g_bytes + 1201), + 84), }; const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 75, 76, 77, 78, 79, 80, 81}; diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index 991a7970cb6..7c05b27cc07 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -33,8 +33,12 @@ #include "src/core/lib/transport/metadata.h" +static_assert( + std::is_trivially_destructible::value, + "grpc_core::StaticMetadataSlice must be trivially destructible."); #define GRPC_STATIC_MDSTR_COUNT 106 -extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; +extern const grpc_core::StaticMetadataSlice + grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; /* ":path" */ #define GRPC_MDSTR_PATH (grpc_static_slice_table[0]) /* ":method" */ diff --git a/src/cpp/ext/filters/census/client_filter.cc b/src/cpp/ext/filters/census/client_filter.cc index 940d42d1000..0f69e793551 100644 --- a/src/cpp/ext/filters/census/client_filter.cc +++ b/src/cpp/ext/filters/census/client_filter.cc @@ -94,7 +94,7 @@ void CensusClientCallData::StartTransportStreamOpBatch( op->send_initial_metadata()->batch(), &tracing_bin_, grpc_mdelem_from_slices( GRPC_MDSTR_GRPC_TRACE_BIN, - grpc_slice_from_copied_buffer(tracing_buf_, tracing_len)))); + grpc_core::UnmanagedMemorySlice(tracing_buf_, tracing_len)))); } grpc_slice tags = grpc_empty_slice(); // TODO: Add in tagging serialization. diff --git a/src/cpp/ext/filters/census/server_filter.cc b/src/cpp/ext/filters/census/server_filter.cc index b5f3d5a13a7..603d1f90bbb 100644 --- a/src/cpp/ext/filters/census/server_filter.cc +++ b/src/cpp/ext/filters/census/server_filter.cc @@ -155,7 +155,7 @@ void CensusServerCallData::StartTransportStreamOpBatch( op->send_trailing_metadata()->batch(), &census_bin_, grpc_mdelem_from_slices( GRPC_MDSTR_GRPC_SERVER_STATS_BIN, - grpc_slice_from_copied_buffer(stats_buf_, len)))); + grpc_core::UnmanagedMemorySlice(stats_buf_, len)))); } } // Call next op. diff --git a/test/cpp/microbenchmarks/bm_metadata.cc b/test/cpp/microbenchmarks/bm_metadata.cc index ff8fe541dfc..d472363eb87 100644 --- a/test/cpp/microbenchmarks/bm_metadata.cc +++ b/test/cpp/microbenchmarks/bm_metadata.cc @@ -21,6 +21,7 @@ #include #include +#include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/transport/metadata.h" #include "src/core/lib/transport/static_metadata.h" @@ -30,7 +31,7 @@ static void BM_SliceFromStatic(benchmark::State& state) { TrackCounters track_counters; while (state.KeepRunning()) { - benchmark::DoNotOptimize(grpc_slice_from_static_string("abc")); + benchmark::DoNotOptimize(grpc_core::ExternallyManagedSlice("abc")); } track_counters.Finish(state); } @@ -39,7 +40,7 @@ BENCHMARK(BM_SliceFromStatic); static void BM_SliceFromCopied(benchmark::State& state) { TrackCounters track_counters; while (state.KeepRunning()) { - grpc_slice_unref(grpc_slice_from_copied_string("abc")); + grpc_slice_unref(grpc_core::UnmanagedMemorySlice("abc")); } track_counters.Finish(state); } @@ -47,9 +48,9 @@ BENCHMARK(BM_SliceFromCopied); static void BM_SliceIntern(benchmark::State& state) { TrackCounters track_counters; - gpr_slice slice = grpc_slice_from_static_string("abc"); + grpc_core::ExternallyManagedSlice slice("abc"); while (state.KeepRunning()) { - grpc_slice_unref(grpc_slice_intern(slice)); + grpc_slice_unref(grpc_core::ManagedMemorySlice(&slice)); } track_counters.Finish(state); } @@ -57,11 +58,11 @@ BENCHMARK(BM_SliceIntern); static void BM_SliceReIntern(benchmark::State& state) { TrackCounters track_counters; - gpr_slice slice = grpc_slice_intern(grpc_slice_from_static_string("abc")); + grpc_core::ExternallyManagedSlice static_slice("abc"); + grpc_core::ManagedMemorySlice slice(&static_slice); while (state.KeepRunning()) { - grpc_slice_unref(grpc_slice_intern(slice)); + grpc_slice_unref(grpc_core::ManagedMemorySlice(&slice)); } - grpc_slice_unref(slice); track_counters.Finish(state); } BENCHMARK(BM_SliceReIntern); @@ -69,7 +70,7 @@ BENCHMARK(BM_SliceReIntern); static void BM_SliceInternStaticMetadata(benchmark::State& state) { TrackCounters track_counters; while (state.KeepRunning()) { - grpc_slice_intern(GRPC_MDSTR_GZIP); + benchmark::DoNotOptimize(grpc_core::ManagedMemorySlice(&GRPC_MDSTR_GZIP)); } track_counters.Finish(state); } @@ -77,9 +78,9 @@ BENCHMARK(BM_SliceInternStaticMetadata); static void BM_SliceInternEqualToStaticMetadata(benchmark::State& state) { TrackCounters track_counters; - gpr_slice slice = grpc_slice_from_static_string("gzip"); + grpc_core::ExternallyManagedSlice slice("gzip"); while (state.KeepRunning()) { - grpc_slice_intern(slice); + benchmark::DoNotOptimize(grpc_core::ManagedMemorySlice(&slice)); } track_counters.Finish(state); } @@ -87,8 +88,8 @@ BENCHMARK(BM_SliceInternEqualToStaticMetadata); static void BM_MetadataFromNonInternedSlices(benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_from_static_string("key"); - gpr_slice v = grpc_slice_from_static_string("value"); + grpc_core::ExternallyManagedSlice k("key"); + grpc_core::ExternallyManagedSlice v("value"); grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); @@ -100,8 +101,8 @@ BENCHMARK(BM_MetadataFromNonInternedSlices); static void BM_MetadataFromInternedSlices(benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); - gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); + grpc_core::ManagedMemorySlice k("key"); + grpc_core::ManagedMemorySlice v("value"); grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); @@ -116,8 +117,8 @@ BENCHMARK(BM_MetadataFromInternedSlices); static void BM_MetadataFromInternedSlicesAlreadyInIndex( benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); - gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); + grpc_core::ManagedMemorySlice k("key"); + grpc_core::ManagedMemorySlice v("value"); grpc_core::ExecCtx exec_ctx; grpc_mdelem seed = grpc_mdelem_create(k, v, nullptr); while (state.KeepRunning()) { @@ -133,8 +134,8 @@ BENCHMARK(BM_MetadataFromInternedSlicesAlreadyInIndex); static void BM_MetadataFromInternedKey(benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); - gpr_slice v = grpc_slice_from_static_string("value"); + grpc_core::ManagedMemorySlice k("key"); + grpc_core::ExternallyManagedSlice v("value"); grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); @@ -148,8 +149,8 @@ BENCHMARK(BM_MetadataFromInternedKey); static void BM_MetadataFromNonInternedSlicesWithBackingStore( benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_from_static_string("key"); - gpr_slice v = grpc_slice_from_static_string("value"); + grpc_core::ExternallyManagedSlice k("key"); + grpc_core::ExternallyManagedSlice v("value"); char backing_store[sizeof(grpc_mdelem_data)]; grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { @@ -164,8 +165,8 @@ BENCHMARK(BM_MetadataFromNonInternedSlicesWithBackingStore); static void BM_MetadataFromInternedSlicesWithBackingStore( benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); - gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); + grpc_core::ManagedMemorySlice k("key"); + grpc_core::ManagedMemorySlice v("value"); char backing_store[sizeof(grpc_mdelem_data)]; grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { @@ -182,8 +183,8 @@ BENCHMARK(BM_MetadataFromInternedSlicesWithBackingStore); static void BM_MetadataFromInternedKeyWithBackingStore( benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); - gpr_slice v = grpc_slice_from_static_string("value"); + grpc_core::ManagedMemorySlice k("key"); + grpc_core::ExternallyManagedSlice v("value"); char backing_store[sizeof(grpc_mdelem_data)]; grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { @@ -198,14 +199,12 @@ BENCHMARK(BM_MetadataFromInternedKeyWithBackingStore); static void BM_MetadataFromStaticMetadataStrings(benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = GRPC_MDSTR_STATUS; - gpr_slice v = GRPC_MDSTR_200; grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); + GRPC_MDELEM_UNREF( + grpc_mdelem_create(GRPC_MDSTR_STATUS, GRPC_MDSTR_200, nullptr)); } - grpc_slice_unref(k); track_counters.Finish(state); } BENCHMARK(BM_MetadataFromStaticMetadataStrings); @@ -213,14 +212,12 @@ BENCHMARK(BM_MetadataFromStaticMetadataStrings); static void BM_MetadataFromStaticMetadataStringsNotIndexed( benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = GRPC_MDSTR_STATUS; - gpr_slice v = GRPC_MDSTR_GZIP; grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); + GRPC_MDELEM_UNREF( + grpc_mdelem_create(GRPC_MDSTR_STATUS, GRPC_MDSTR_GZIP, nullptr)); } - grpc_slice_unref(k); track_counters.Finish(state); } BENCHMARK(BM_MetadataFromStaticMetadataStringsNotIndexed); @@ -229,9 +226,10 @@ static void BM_MetadataRefUnrefExternal(benchmark::State& state) { TrackCounters track_counters; char backing_store[sizeof(grpc_mdelem_data)]; grpc_core::ExecCtx exec_ctx; - grpc_mdelem el = grpc_mdelem_create( - grpc_slice_from_static_string("a"), grpc_slice_from_static_string("b"), - reinterpret_cast(backing_store)); + grpc_mdelem el = + grpc_mdelem_create(grpc_core::ExternallyManagedSlice("a"), + grpc_core::ExternallyManagedSlice("b"), + reinterpret_cast(backing_store)); while (state.KeepRunning()) { GRPC_MDELEM_UNREF(GRPC_MDELEM_REF(el)); } @@ -245,8 +243,8 @@ static void BM_MetadataRefUnrefInterned(benchmark::State& state) { TrackCounters track_counters; char backing_store[sizeof(grpc_mdelem_data)]; grpc_core::ExecCtx exec_ctx; - gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); - gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); + grpc_core::ManagedMemorySlice k("key"); + grpc_core::ManagedMemorySlice v("value"); grpc_mdelem el = grpc_mdelem_create( k, v, reinterpret_cast(backing_store)); grpc_slice_unref(k); @@ -264,8 +262,8 @@ static void BM_MetadataRefUnrefAllocated(benchmark::State& state) { TrackCounters track_counters; grpc_core::ExecCtx exec_ctx; grpc_mdelem el = - grpc_mdelem_create(grpc_slice_from_static_string("a"), - grpc_slice_from_static_string("b"), nullptr); + grpc_mdelem_create(grpc_core::ExternallyManagedSlice("a"), + grpc_core::ExternallyManagedSlice("b"), nullptr); while (state.KeepRunning()) { GRPC_MDELEM_UNREF(GRPC_MDELEM_REF(el)); } diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index 6b034347bf8..213efd22346 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -392,16 +392,21 @@ for i, elem in enumerate(all_strs): def slice_def(i): - return ('{&grpc_static_metadata_refcounts[%d],' - ' {{%d, g_bytes+%d}}}') % (i, len(all_strs[i]), id2strofs[i]) + return ( + 'grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[%d], %d, g_bytes+%d)' + ) % (i, len(all_strs[i]), id2strofs[i]) # validate configuration for elem in METADATA_BATCH_CALLOUTS: assert elem in all_strs - +static_slice_dest_assert = ( + 'static_assert(std::is_trivially_destructible' + + '::value, ' + '"grpc_core::StaticMetadataSlice must be trivially destructible.");') +print >> H, static_slice_dest_assert print >> H, '#define GRPC_STATIC_MDSTR_COUNT %d' % len(all_strs) -print >> H, ('extern const grpc_slice ' +print >> H, ('extern const grpc_core::StaticMetadataSlice ' 'grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];') for i, elem in enumerate(all_strs): print >> H, '/* "%s" */' % elem @@ -425,8 +430,9 @@ print >> H, '#define GRPC_IS_STATIC_METADATA_STRING(slice) \\' print >> H, (' ((slice).refcount != NULL && (slice).refcount->GetType() == ' 'grpc_slice_refcount::Type::STATIC)') print >> H -print >> C, ('const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]' - ' = {') +print >> C, ( + 'const grpc_core::StaticMetadataSlice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]' + ' = {') for i, elem in enumerate(all_strs): print >> C, slice_def(i) + ',' print >> C, '};' From f4ff1a12d0431736dc369e181f89c4f9cc5e57a9 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 30 Jul 2019 19:09:30 -0700 Subject: [PATCH 142/661] Whitelisted build_bazel_rules_apple --- tools/run_tests/sanity/check_bazel_workspace.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/run_tests/sanity/check_bazel_workspace.py b/tools/run_tests/sanity/check_bazel_workspace.py index 10fb0ccf6a8..4ddbc74646f 100755 --- a/tools/run_tests/sanity/check_bazel_workspace.py +++ b/tools/run_tests/sanity/check_bazel_workspace.py @@ -63,6 +63,7 @@ _GRPC_DEP_NAMES = [ _ZOPEFOUNDATION_ZOPE_INTERFACE_DEP_NAME, _TWISTED_CONSTANTLY_DEP_NAME, 'io_bazel_rules_go', + 'build_bazel_rules_apple', ] _GRPC_BAZEL_ONLY_DEPS = [ @@ -76,6 +77,7 @@ _GRPC_BAZEL_ONLY_DEPS = [ _ZOPEFOUNDATION_ZOPE_INTERFACE_DEP_NAME, _TWISTED_CONSTANTLY_DEP_NAME, 'io_bazel_rules_go', + 'build_bazel_rules_apple', ] @@ -106,6 +108,13 @@ class BazelEvalState(object): return self.names_and_urls[args['name']] = args['url'] + def git_repository(self, **args): + assert self.names_and_urls.get(args['name']) is None + if args['name'] in _GRPC_BAZEL_ONLY_DEPS: + self.names_and_urls[args['name']] = 'dont care' + return + self.names_and_urls[args['name']] = args['remote'] + # Parse git hashes from bazel/grpc_deps.bzl {new_}http_archive rules with open(os.path.join('bazel', 'grpc_deps.bzl'), 'r') as f: @@ -121,6 +130,7 @@ build_rules = { 'native': eval_state, 'http_archive': lambda **args: eval_state.http_archive(**args), 'load': lambda a, b: None, + 'git_repository': lambda **args: eval_state.git_repository(**args), } exec bazel_file in build_rules for name in _GRPC_DEP_NAMES: @@ -162,6 +172,7 @@ for name in _GRPC_DEP_NAMES: 'native': state, 'http_archive': lambda **args: state.http_archive(**args), 'load': lambda a, b: None, + 'git_repository': lambda **args: state.git_repository(**args), } exec bazel_file in rules assert name not in names_and_urls_with_overridden_name.keys() From b2cda1e1853bcf17cf3fc0449f9065698e6f60cb Mon Sep 17 00:00:00 2001 From: Arjun Roy Date: Wed, 17 Jul 2019 11:17:54 -0700 Subject: [PATCH 143/661] Reduced ops for grpc_chttp2_stream_map_find(). Several asserts in grpc_chttp2_stream_map_find() can be converted to debug asserts. This PR also templatizes the internal find() method to have it be strict in the delete case (which saves some branches). --- .../chttp2/transport/chttp2_transport.cc | 8 +--- .../ext/transport/chttp2/transport/internal.h | 7 ++- .../transport/chttp2/transport/stream_map.cc | 46 +++++++++++-------- test/core/transport/chttp2/stream_map_test.cc | 24 ---------- 4 files changed, 34 insertions(+), 51 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index aff4506577e..16146569886 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -785,12 +785,6 @@ static void destroy_stream(grpc_transport* gt, grpc_stream* gs, GRPC_ERROR_NONE); } -grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(grpc_chttp2_transport* t, - uint32_t id) { - return static_cast( - grpc_chttp2_stream_map_find(&t->stream_map, id)); -} - grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t, uint32_t id) { if (t->channel_callback.accept_stream == nullptr) { @@ -2069,7 +2063,7 @@ static void remove_stream(grpc_chttp2_transport* t, uint32_t id, grpc_error* error) { grpc_chttp2_stream* s = static_cast( grpc_chttp2_stream_map_delete(&t->stream_map, id)); - GPR_ASSERT(s); + GPR_DEBUG_ASSERT(s); if (t->incoming_stream == s) { t->incoming_stream = nullptr; grpc_chttp2_parsing_become_skip_parser(t); diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 732bc38a0ac..643cd25b8bd 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -745,8 +745,11 @@ void grpc_chttp2_act_on_flowctl_action( /********* End of Flow Control ***************/ -grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(grpc_chttp2_transport* t, - uint32_t id); +inline grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream( + grpc_chttp2_transport* t, uint32_t id) { + return static_cast( + grpc_chttp2_stream_map_find(&t->stream_map, id)); +} grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t, uint32_t id); diff --git a/src/core/ext/transport/chttp2/transport/stream_map.cc b/src/core/ext/transport/chttp2/transport/stream_map.cc index f300e2356c9..647214b94a0 100644 --- a/src/core/ext/transport/chttp2/transport/stream_map.cc +++ b/src/core/ext/transport/chttp2/transport/stream_map.cc @@ -27,7 +27,7 @@ void grpc_chttp2_stream_map_init(grpc_chttp2_stream_map* map, size_t initial_capacity) { - GPR_ASSERT(initial_capacity > 1); + GPR_DEBUG_ASSERT(initial_capacity > 1); map->keys = static_cast(gpr_malloc(sizeof(uint32_t) * initial_capacity)); map->values = @@ -63,9 +63,17 @@ void grpc_chttp2_stream_map_add(grpc_chttp2_stream_map* map, uint32_t key, uint32_t* keys = map->keys; void** values = map->values; + // The first assertion ensures that the table is monotonically increasing. GPR_ASSERT(count == 0 || keys[count - 1] < key); - GPR_ASSERT(value); - GPR_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr); + GPR_DEBUG_ASSERT(value); + // Asserting that the key is not already in the map can be a debug assertion. + // Why: we're already checking that the map elements are monotonically + // increasing. If we re-add a key, i.e. if the key is already present, then + // either it is the most recently added key in the map (in which case the + // first assertion fails due to key == last_key) or there is a more recently + // added (larger) key at the end of the map: in which case the first assertion + // still fails due to key < last_key. + GPR_DEBUG_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr); if (count == capacity) { if (map->free > capacity / 4) { @@ -74,7 +82,7 @@ void grpc_chttp2_stream_map_add(grpc_chttp2_stream_map* map, uint32_t key, } else { /* resize when less than 25% of the table is free, because compaction won't help much */ - map->capacity = capacity = 3 * capacity / 2; + map->capacity = capacity = 2 * capacity; map->keys = keys = static_cast( gpr_realloc(keys, capacity * sizeof(uint32_t))); map->values = values = @@ -87,6 +95,7 @@ void grpc_chttp2_stream_map_add(grpc_chttp2_stream_map* map, uint32_t key, map->count = count + 1; } +template static void** find(grpc_chttp2_stream_map* map, uint32_t key) { size_t min_idx = 0; size_t max_idx = map->count; @@ -95,7 +104,8 @@ static void** find(grpc_chttp2_stream_map* map, uint32_t key) { void** values = map->values; uint32_t mid_key; - if (max_idx == 0) return nullptr; + GPR_DEBUG_ASSERT(!strict_find || max_idx > 0); + if (!strict_find && max_idx == 0) return nullptr; while (min_idx < max_idx) { /* find the midpoint, avoiding overflow */ @@ -112,28 +122,28 @@ static void** find(grpc_chttp2_stream_map* map, uint32_t key) { } } + GPR_DEBUG_ASSERT(!strict_find); return nullptr; } void* grpc_chttp2_stream_map_delete(grpc_chttp2_stream_map* map, uint32_t key) { - void** pvalue = find(map, key); - void* out = nullptr; - if (pvalue != nullptr) { - out = *pvalue; - *pvalue = nullptr; - map->free += (out != nullptr); - /* recognize complete emptyness and ensure we can skip - * defragmentation later */ - if (map->free == map->count) { - map->free = map->count = 0; - } - GPR_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr); + void** pvalue = find(map, key); + GPR_DEBUG_ASSERT(pvalue != nullptr); + void* out = *pvalue; + GPR_DEBUG_ASSERT(out != nullptr); + *pvalue = nullptr; + map->free++; + /* recognize complete emptyness and ensure we can skip + defragmentation later */ + if (map->free == map->count) { + map->free = map->count = 0; } + GPR_DEBUG_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr); return out; } void* grpc_chttp2_stream_map_find(grpc_chttp2_stream_map* map, uint32_t key) { - void** pvalue = find(map, key); + void** pvalue = find(map, key); return pvalue != nullptr ? *pvalue : nullptr; } diff --git a/test/core/transport/chttp2/stream_map_test.cc b/test/core/transport/chttp2/stream_map_test.cc index a36c496eb1e..3452c86cdc9 100644 --- a/test/core/transport/chttp2/stream_map_test.cc +++ b/test/core/transport/chttp2/stream_map_test.cc @@ -43,29 +43,6 @@ static void test_empty_find(void) { grpc_chttp2_stream_map_destroy(&map); } -/* test it's safe to delete twice */ -static void test_double_deletion(void) { - grpc_chttp2_stream_map map; - - LOG_TEST("test_double_deletion"); - - grpc_chttp2_stream_map_init(&map, 8); - GPR_ASSERT(0 == grpc_chttp2_stream_map_size(&map)); - grpc_chttp2_stream_map_add(&map, 1, (void*)1); - GPR_ASSERT((void*)1 == grpc_chttp2_stream_map_find(&map, 1)); - GPR_ASSERT(1 == grpc_chttp2_stream_map_size(&map)); - GPR_ASSERT((void*)1 == grpc_chttp2_stream_map_delete(&map, 1)); - GPR_ASSERT(0 == grpc_chttp2_stream_map_size(&map)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 1)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_delete(&map, 1)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 1)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_delete(&map, 1)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 1)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_delete(&map, 1)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 1)); - grpc_chttp2_stream_map_destroy(&map); -} - /* test add & lookup */ static void test_basic_add_find(uint32_t n) { grpc_chttp2_stream_map map; @@ -197,7 +174,6 @@ int main(int argc, char** argv) { test_no_op(); test_empty_find(); - test_double_deletion(); while (n < 100000) { test_basic_add_find(n); From ec181d96957fc150d8c8545752a2ca483741d738 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 31 Jul 2019 14:15:50 -0700 Subject: [PATCH 144/661] Added TvTests target with Xcode 9.2 --- src/objective-c/tests/Podfile | 45 ++- .../tests/RemoteTestClient/RemoteTest.podspec | 2 + .../tests/Tests.xcodeproj/project.pbxproj | 267 +++++++++++++++++- .../xcshareddata/xcschemes/TvTests.xcscheme | 95 +++++++ src/objective-c/tests/TvTests/Info.plist | 22 ++ 5 files changed, 390 insertions(+), 41 deletions(-) create mode 100644 src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/TvTests.xcscheme create mode 100644 src/objective-c/tests/TvTests/Info.plist diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index 60d2a98fba2..442f3599bb1 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -5,15 +5,14 @@ install! 'cocoapods', :deterministic_uuids => false # Location of gRPC's repo root relative to this file. GRPC_LOCAL_SRC = '../../..' -target 'MacTests' do - platform :osx, '10.13' +def grpc_deps pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf", :inhibit_warnings => true - + pod '!ProtoCompiler', :path => "#{GRPC_LOCAL_SRC}/src/objective-c" pod '!ProtoCompiler-gRPCPlugin', :path => "#{GRPC_LOCAL_SRC}/src/objective-c" - + pod 'BoringSSL-GRPC', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true - + pod 'gRPC', :path => GRPC_LOCAL_SRC pod 'gRPC-Core', :path => GRPC_LOCAL_SRC pod 'gRPC-RxLibrary', :path => GRPC_LOCAL_SRC @@ -21,20 +20,19 @@ target 'MacTests' do pod 'RemoteTest', :path => "RemoteTestClient", :inhibit_warnings => true end -target 'UnitTests' do - platform :ios, '8.0' - pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf", :inhibit_warnings => true - - pod '!ProtoCompiler', :path => "#{GRPC_LOCAL_SRC}/src/objective-c" - pod '!ProtoCompiler-gRPCPlugin', :path => "#{GRPC_LOCAL_SRC}/src/objective-c" +target 'TvTests' do + platform :tvos, '10.0' + grpc_deps +end - pod 'BoringSSL-GRPC', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true +target 'MacTests' do + platform :osx, '10.13' + grpc_deps +end - pod 'gRPC', :path => GRPC_LOCAL_SRC - pod 'gRPC-Core', :path => GRPC_LOCAL_SRC - pod 'gRPC-RxLibrary', :path => GRPC_LOCAL_SRC - pod 'gRPC-ProtoRPC', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true - pod 'RemoteTest', :path => "RemoteTestClient", :inhibit_warnings => true +target 'UnitTests' do + platform :ios, '8.0' + grpc_deps end %w( @@ -43,18 +41,7 @@ end ).each do |target_name| target target_name do platform :ios, '8.0' - pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf", :inhibit_warnings => true - - pod '!ProtoCompiler', :path => "#{GRPC_LOCAL_SRC}/src/objective-c" - pod '!ProtoCompiler-gRPCPlugin', :path => "#{GRPC_LOCAL_SRC}/src/objective-c" - - pod 'BoringSSL-GRPC', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true - - pod 'gRPC', :path => GRPC_LOCAL_SRC - pod 'gRPC-Core', :path => GRPC_LOCAL_SRC - pod 'gRPC-RxLibrary', :path => GRPC_LOCAL_SRC - pod 'gRPC-ProtoRPC', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true - pod 'RemoteTest', :path => "RemoteTestClient", :inhibit_warnings => true + grpc_deps pod 'gRPC-Core/Cronet-Implementation', :path => GRPC_LOCAL_SRC pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c" diff --git a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec index 93b56d56059..be8fce9993b 100644 --- a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec @@ -9,6 +9,8 @@ Pod::Spec.new do |s| s.ios.deployment_target = '7.1' s.osx.deployment_target = '10.9' + s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. s.dependency "!ProtoCompiler-gRPCPlugin" diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 737d52b547d..8548620522d 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -37,16 +37,26 @@ 65EB19E418B39A8374D407BB /* libPods-CronetTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B1511C20E16A8422B58D61A /* libPods-CronetTests.a */; }; 903163C7FE885838580AEC7A /* libPods-InteropTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D457AD9797664CFA191C3280 /* libPods-InteropTests.a */; }; 953CD2942A3A6D6CE695BE87 /* libPods-MacTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 276873A05AC5479B60DF6079 /* libPods-MacTests.a */; }; + ABCB3EE422F23BEF00F0FECE /* InteropTestsRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F488822778B04006656AD /* InteropTestsRemote.m */; }; + ABCB3EE522F23BEF00F0FECE /* InteropTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F488222778A88006656AD /* InteropTests.m */; }; + ABCB3EE622F23BEF00F0FECE /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; }; + ABCB3EE722F23BEF00F0FECE /* InteropTestsLocalCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */; }; + ABCB3EE822F23BEF00F0FECE /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; + ABCB3EE922F23BF500F0FECE /* RxLibraryUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F488A22778B5D006656AD /* RxLibraryUnitTests.m */; }; + ABCB3EEA22F23BF500F0FECE /* APIv2Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487F227782C1006656AD /* APIv2Tests.m */; }; + ABCB3EEB22F23BF500F0FECE /* NSErrorUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0282E8215AA697007AC99D /* NSErrorUnitTests.m */; }; B071230B22669EED004B64A1 /* StressTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B071230A22669EED004B64A1 /* StressTests.m */; }; B0BB3F08225E7ABA008DA580 /* NSErrorUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0282E8215AA697007AC99D /* NSErrorUnitTests.m */; }; B0BB3F0A225EA511008DA580 /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; B0D39B9A2266F3CB00A4078D /* StressTestsSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = B0D39B992266F3CB00A4078D /* StressTestsSSL.m */; }; B0D39B9C2266FF9800A4078D /* StressTestsCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = B0D39B9B2266FF9800A4078D /* StressTestsCleartext.m */; }; CCF5C0719EF608276AE16374 /* libPods-UnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22A3EBB488699C8CEA19707B /* libPods-UnitTests.a */; }; + F4E21D69D650D61FE8F02696 /* libPods-TvTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A0A5455106001F60357A4B6 /* libPods-TvTests.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 02192CF1FF9534E3D18C65FC /* Pods-CronetUnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetUnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests.release.xcconfig"; sourceTree = ""; }; + 038286E5BBEC3F03D4701CCC /* Pods-TvTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TvTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-TvTests/Pods-TvTests.cronet.xcconfig"; sourceTree = ""; }; 070266E2626EB997B54880A3 /* Pods-InteropTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTests/Pods-InteropTests.test.xcconfig"; sourceTree = ""; }; 07D10A965323BEA7FE59A74B /* Pods-RxLibraryUnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.debug.xcconfig"; sourceTree = ""; }; 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; @@ -67,6 +77,7 @@ 22A3EBB488699C8CEA19707B /* libPods-UnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-UnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 2650FEF00956E7924772F9D9 /* Pods-InteropTestsMultipleChannels.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsMultipleChannels.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsMultipleChannels/Pods-InteropTestsMultipleChannels.release.xcconfig"; sourceTree = ""; }; 276873A05AC5479B60DF6079 /* libPods-MacTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MacTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 2A0A5455106001F60357A4B6 /* libPods-TvTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-TvTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 2B89F3037963E6EDDD48D8C3 /* Pods-InteropTestsRemoteWithCronet.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.test.xcconfig"; sourceTree = ""; }; 303F4A17EB1650FC44603D17 /* Pods-InteropTestsRemoteCFStream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.release.xcconfig"; sourceTree = ""; }; 32748C4078AEB05F8F954361 /* Pods-InteropTestsRemoteCFStream.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.debug.xcconfig"; sourceTree = ""; }; @@ -78,6 +89,7 @@ 3CADF86203B9D03EA96C359D /* Pods-InteropTestsMultipleChannels.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsMultipleChannels.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsMultipleChannels/Pods-InteropTestsMultipleChannels.debug.xcconfig"; sourceTree = ""; }; 3EB55EF291706E3DDE23C3B7 /* Pods-InteropTestsLocalSSLCFStream.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.debug.xcconfig"; sourceTree = ""; }; 3F27B2E744482771EB93C394 /* Pods-InteropTestsRemoteWithCronet.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.cronet.xcconfig"; sourceTree = ""; }; + 4151F1CACF6F364277DA312F /* Pods-TvTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TvTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-TvTests/Pods-TvTests.debug.xcconfig"; sourceTree = ""; }; 41AA59529240A6BBBD3DB904 /* Pods-InteropTestsLocalSSLCFStream.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.test.xcconfig"; sourceTree = ""; }; 48F1841C9A920626995DC28C /* libPods-ChannelTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ChannelTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 4A1A42B2E941CCD453489E5B /* Pods-InteropTestsRemoteCFStream.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.cronet.xcconfig"; sourceTree = ""; }; @@ -126,6 +138,7 @@ 7A2E97E3F469CC2A758D77DE /* Pods-InteropTestsLocalSSL.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.release.xcconfig"; sourceTree = ""; }; 7BA53C6D224288D5870FE6F3 /* Pods-InteropTestsLocalCleartextCFStream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.release.xcconfig"; sourceTree = ""; }; 7F4F42EBAF311E9F84FCA32E /* Pods-CronetTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.release.xcconfig"; sourceTree = ""; }; + 8809F3EB70C19F2CFA1F4CA6 /* Pods-TvTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TvTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-TvTests/Pods-TvTests.release.xcconfig"; sourceTree = ""; }; 8B498B05C6DA0818B2FA91D4 /* Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig"; sourceTree = ""; }; 8C233E85C3EB45B3CAE52EDF /* Pods-APIv2Tests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-APIv2Tests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-APIv2Tests/Pods-APIv2Tests.cronet.xcconfig"; sourceTree = ""; }; 90E63AD3C4A1E3E6BC745096 /* Pods-ChannelTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ChannelTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-ChannelTests/Pods-ChannelTests.cronet.xcconfig"; sourceTree = ""; }; @@ -134,9 +147,12 @@ 9E9444C764F0FFF64A7EB58E /* libPods-InteropTestsRemoteWithCronet.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsRemoteWithCronet.a"; sourceTree = BUILT_PRODUCTS_DIR; }; A25967A0D40ED14B3287AD81 /* Pods-InteropTestsCallOptions.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsCallOptions.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsCallOptions/Pods-InteropTestsCallOptions.test.xcconfig"; sourceTree = ""; }; A2DCF2570BE515B62CB924CA /* Pods-UnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests.debug.xcconfig"; sourceTree = ""; }; + A52BDBDE1F6643E6FD1F3CBA /* Pods-TvTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TvTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-TvTests/Pods-TvTests.test.xcconfig"; sourceTree = ""; }; A58BE6DF1C62D1739EBB2C78 /* libPods-RxLibraryUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RxLibraryUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; A6F832FCEFA6F6881E620F12 /* Pods-InteropTestsRemote.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.test.xcconfig"; sourceTree = ""; }; AA7CB64B4DD9915AE7C03163 /* Pods-InteropTestsLocalCleartext.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.cronet.xcconfig"; sourceTree = ""; }; + ABCB3EDA22F23B9700F0FECE /* TvTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TvTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + ABCB3EDE22F23B9700F0FECE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; AC414EF7A6BF76ED02B6E480 /* Pods-InteropTestsRemoteWithCronet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.release.xcconfig"; sourceTree = ""; }; AF3FC2CFFE7B0961823BC740 /* libPods-InteropTestsCallOptions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsCallOptions.a"; sourceTree = BUILT_PRODUCTS_DIR; }; B071230A22669EED004B64A1 /* StressTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StressTests.m; sourceTree = ""; }; @@ -204,6 +220,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + ABCB3ED722F23B9700F0FECE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F4E21D69D650D61FE8F02696 /* libPods-TvTests.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; B0BB3EF4225E795F008DA580 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -240,6 +264,7 @@ 276873A05AC5479B60DF6079 /* libPods-MacTests.a */, D457AD9797664CFA191C3280 /* libPods-InteropTests.a */, 1B1511C20E16A8422B58D61A /* libPods-CronetTests.a */, + 2A0A5455106001F60357A4B6 /* libPods-TvTests.a */, ); name = Frameworks; sourceTree = ""; @@ -325,6 +350,10 @@ 5AB9A82F289D548D6B8816F9 /* Pods-CronetTests.test.xcconfig */, 20F6A3D59D0EE091E2D43953 /* Pods-CronetTests.cronet.xcconfig */, 7F4F42EBAF311E9F84FCA32E /* Pods-CronetTests.release.xcconfig */, + 4151F1CACF6F364277DA312F /* Pods-TvTests.debug.xcconfig */, + A52BDBDE1F6643E6FD1F3CBA /* Pods-TvTests.test.xcconfig */, + 038286E5BBEC3F03D4701CCC /* Pods-TvTests.cronet.xcconfig */, + 8809F3EB70C19F2CFA1F4CA6 /* Pods-TvTests.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -376,6 +405,7 @@ 5E0282E7215AA697007AC99D /* UnitTests */, B0BB3EF8225E795F008DA580 /* MacTests */, 5E7F485A22775B15006656AD /* CronetTests */, + ABCB3EDB22F23B9700F0FECE /* TvTests */, 635697C81B14FC11007A7283 /* Products */, 51E4650F34F854F41FF053B3 /* Pods */, 136D535E19727099B941D7B1 /* Frameworks */, @@ -389,6 +419,7 @@ B0BB3EF7225E795F008DA580 /* MacTests.xctest */, 5EA476F42272816A000F72FC /* InteropTests.xctest */, 5E7F485922775B15006656AD /* CronetTests.xctest */, + ABCB3EDA22F23B9700F0FECE /* TvTests.xctest */, ); name = Products; sourceTree = ""; @@ -412,6 +443,14 @@ name = "Supporting Files"; sourceTree = ""; }; + ABCB3EDB22F23B9700F0FECE /* TvTests */ = { + isa = PBXGroup; + children = ( + ABCB3EDE22F23B9700F0FECE /* Info.plist */, + ); + path = TvTests; + sourceTree = ""; + }; B0BB3EF8225E795F008DA580 /* MacTests */ = { isa = PBXGroup; children = ( @@ -486,6 +525,25 @@ productReference = 5EA476F42272816A000F72FC /* InteropTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + ABCB3ED922F23B9700F0FECE /* TvTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = ABCB3EE322F23B9700F0FECE /* Build configuration list for PBXNativeTarget "TvTests" */; + buildPhases = ( + 03423EFD6B98B0F3DD4C2E0D /* [CP] Check Pods Manifest.lock */, + ABCB3ED622F23B9700F0FECE /* Sources */, + ABCB3ED722F23B9700F0FECE /* Frameworks */, + ABCB3ED822F23B9700F0FECE /* Resources */, + 88CEEDBB95DA992ABDDE8B7E /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TvTests; + productName = TvTests; + productReference = ABCB3EDA22F23B9700F0FECE /* TvTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; B0BB3EF6225E795F008DA580 /* MacTests */ = { isa = PBXNativeTarget; buildConfigurationList = B0BB3EFC225E795F008DA580 /* Build configuration list for PBXNativeTarget "MacTests" */; @@ -526,6 +584,11 @@ CreatedOnToolsVersion = 10.1; ProvisioningStyle = Automatic; }; + ABCB3ED922F23B9700F0FECE = { + CreatedOnToolsVersion = 9.2; + DevelopmentTeam = 6T98ZJNPG5; + ProvisioningStyle = Automatic; + }; B0BB3EF6225E795F008DA580 = { CreatedOnToolsVersion = 10.1; ProvisioningStyle = Automatic; @@ -549,6 +612,7 @@ B0BB3EF6225E795F008DA580 /* MacTests */, 5EA476F32272816A000F72FC /* InteropTests */, 5E7F485822775B15006656AD /* CronetTests */, + ABCB3ED922F23B9700F0FECE /* TvTests */, ); }; /* End PBXProject section */ @@ -576,6 +640,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + ABCB3ED822F23B9700F0FECE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; B0BB3EF5225E795F008DA580 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -587,6 +658,24 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 03423EFD6B98B0F3DD4C2E0D /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-TvTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 0FEFD5FC6B323AC95549AE4A /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -646,15 +735,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-InteropTests-checkManifestLockResult.txt", ); @@ -681,6 +766,24 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MacTests/Pods-MacTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; + 88CEEDBB95DA992ABDDE8B7E /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-TvTests/Pods-TvTests-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-tvOS/gRPCCertificates.bundle", + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-TvTests/Pods-TvTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; 9AD0B5E94F2AA5962EA6AA36 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -704,15 +807,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-CronetTests-checkManifestLockResult.txt", ); @@ -744,15 +843,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-MacTests-checkManifestLockResult.txt", ); @@ -822,6 +917,21 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + ABCB3ED622F23B9700F0FECE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ABCB3EEA22F23BF500F0FECE /* APIv2Tests.m in Sources */, + ABCB3EE822F23BEF00F0FECE /* InteropTestsBlockCallbacks.m in Sources */, + ABCB3EE422F23BEF00F0FECE /* InteropTestsRemote.m in Sources */, + ABCB3EEB22F23BF500F0FECE /* NSErrorUnitTests.m in Sources */, + ABCB3EE522F23BEF00F0FECE /* InteropTests.m in Sources */, + ABCB3EE722F23BEF00F0FECE /* InteropTestsLocalCleartext.m in Sources */, + ABCB3EE622F23BEF00F0FECE /* InteropTestsLocalSSL.m in Sources */, + ABCB3EE922F23BF500F0FECE /* RxLibraryUnitTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; B0BB3EF3225E795F008DA580 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1422,6 +1532,128 @@ }; name = Release; }; + ABCB3EDF22F23B9700F0FECE /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4151F1CACF6F364277DA312F /* Pods-TvTests.debug.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = TvTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.google.TvTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 10.0; + }; + name = Debug; + }; + ABCB3EE022F23B9700F0FECE /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = A52BDBDE1F6643E6FD1F3CBA /* Pods-TvTests.test.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = TvTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.google.TvTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 10.0; + }; + name = Test; + }; + ABCB3EE122F23B9700F0FECE /* Cronet */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 038286E5BBEC3F03D4701CCC /* Pods-TvTests.cronet.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = TvTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.google.TvTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 10.0; + }; + name = Cronet; + }; + ABCB3EE222F23B9700F0FECE /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 8809F3EB70C19F2CFA1F4CA6 /* Pods-TvTests.release.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6T98ZJNPG5; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = TvTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.google.TvTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 10.0; + }; + name = Release; + }; B0BB3EFD225E795F008DA580 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = E3ACD4D5902745976D9C2229 /* Pods-MacTests.debug.xcconfig */; @@ -1617,6 +1849,17 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + ABCB3EE322F23B9700F0FECE /* Build configuration list for PBXNativeTarget "TvTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ABCB3EDF22F23B9700F0FECE /* Debug */, + ABCB3EE022F23B9700F0FECE /* Test */, + ABCB3EE122F23B9700F0FECE /* Cronet */, + ABCB3EE222F23B9700F0FECE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; B0BB3EFC225E795F008DA580 /* Build configuration list for PBXNativeTarget "MacTests" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/TvTests.xcscheme b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/TvTests.xcscheme new file mode 100644 index 00000000000..cc6823528b5 --- /dev/null +++ b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/TvTests.xcscheme @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/objective-c/tests/TvTests/Info.plist b/src/objective-c/tests/TvTests/Info.plist new file mode 100644 index 00000000000..6c40a6cd0c4 --- /dev/null +++ b/src/objective-c/tests/TvTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + From 63e6329c65dbe72993dfb4f26a4c6fe9bc324cff Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 31 Jul 2019 16:47:34 -0700 Subject: [PATCH 145/661] Added Kokoro jobs for tvos unit tests --- .../macos/grpc_basictests_objc_tvos.cfg | 32 +++++++++++++++++++ .../grpc_basictests_objc_tvos.cfg | 31 ++++++++++++++++++ tools/run_tests/run_tests.py | 10 ++++++ 3 files changed, 73 insertions(+) create mode 100644 tools/internal_ci/macos/grpc_basictests_objc_tvos.cfg create mode 100644 tools/internal_ci/macos/pull_request/grpc_basictests_objc_tvos.cfg diff --git a/tools/internal_ci/macos/grpc_basictests_objc_tvos.cfg b/tools/internal_ci/macos/grpc_basictests_objc_tvos.cfg new file mode 100644 index 00000000000..a3f3935b5d6 --- /dev/null +++ b/tools/internal_ci/macos/grpc_basictests_objc_tvos.cfg @@ -0,0 +1,32 @@ +# Copyright 2019 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/macos/grpc_run_tests_matrix.sh" +gfile_resources: "/bigstore/grpc-testing-secrets/gcp_credentials/GrpcTesting-d0eeee2db331.json" +timeout_mins: 120 +action { + define_artifacts { + regex: "**/*sponge_log.*" + regex: "github/grpc/reports/**" + } +} + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-f basictests macos objc opt --internal_ci -j 1 --inner_jobs 4 --bq_result_table aggregate_results --extra_args -r tvos-test-.*" +} + diff --git a/tools/internal_ci/macos/pull_request/grpc_basictests_objc_tvos.cfg b/tools/internal_ci/macos/pull_request/grpc_basictests_objc_tvos.cfg new file mode 100644 index 00000000000..ec776def565 --- /dev/null +++ b/tools/internal_ci/macos/pull_request/grpc_basictests_objc_tvos.cfg @@ -0,0 +1,31 @@ +# Copyright 2018 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/macos/grpc_run_tests_matrix.sh" +gfile_resources: "/bigstore/grpc-testing-secrets/gcp_credentials/GrpcTesting-d0eeee2db331.json" +timeout_mins: 120 +action { + define_artifacts { + regex: "**/*sponge_log.*" + regex: "github/grpc/reports/**" + } +} + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-f basictests macos objc opt --internal_ci -j 1 --inner_jobs 4 --extra_args -r tvos-test-.*" +} diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index f11927bd5d6..06991365136 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1140,6 +1140,16 @@ class ObjCLanguage(object): 'SCHEME': 'MacTests', 'PLATFORM': 'macos' })) + out.append( + self.config.job_spec( + ['src/objective-c/tests/run_one_test.sh'], + timeout_seconds=30 * 60, + shortname='tvos-test-basictests', + cpu_cost=1e6, + environ={ + 'SCHEME': 'TvTests', + 'PLATFORM': 'tvos' + })) return sorted(out) From efe9fd0d60e49bb6ec8f01f73879b9c2d020ddf9 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 26 Jul 2019 17:08:45 +0200 Subject: [PATCH 146/661] scalable benchmarks --- .../CommonThreadedBase.cs | 71 +++++++++++++++++-- .../ScalabityExampleBenchmark.cs | 56 +++++++++++++++ 2 files changed, 123 insertions(+), 4 deletions(-) create mode 100644 src/csharp/Grpc.Microbenchmarks/ScalabityExampleBenchmark.cs diff --git a/src/csharp/Grpc.Microbenchmarks/CommonThreadedBase.cs b/src/csharp/Grpc.Microbenchmarks/CommonThreadedBase.cs index c6bdf471b8a..c42c6481ffb 100644 --- a/src/csharp/Grpc.Microbenchmarks/CommonThreadedBase.cs +++ b/src/csharp/Grpc.Microbenchmarks/CommonThreadedBase.cs @@ -17,6 +17,8 @@ #endregion using System; +using System.Collections.Concurrent; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; @@ -35,22 +37,42 @@ namespace Grpc.Microbenchmarks { protected virtual bool NeedsEnvironment => true; - [Params(1, 2, 4, 8, 12)] + [Params(1, 2, 4, 6)] public int ThreadCount { get; set; } protected GrpcEnvironment Environment { get; private set; } + private List workers; + + private List> dispatchQueues; + [GlobalSetup] public virtual void Setup() { - ThreadPool.GetMinThreads(out var workers, out var iocp); - if (workers <= ThreadCount) ThreadPool.SetMinThreads(ThreadCount + 1, iocp); + dispatchQueues = new List>(); + workers = new List(); + for (int i = 0; i < ThreadCount; i++) + { + var dispatchQueue = new BlockingCollection(); + var thread = new Thread(new ThreadStart(() => WorkerThreadBody(dispatchQueue))); + thread.Name = string.Format("threaded benchmark worker {0}", i); + thread.Start(); + workers.Add(thread); + dispatchQueues.Add(dispatchQueue); + } + if (NeedsEnvironment) Environment = GrpcEnvironment.AddRef(); } [GlobalCleanup] public virtual void Cleanup() { + for (int i = 0; i < ThreadCount; i++) + { + dispatchQueues[i].Add(null); // null action request termination of the worker thread. + workers[i].Join(); + } + if (Environment != null) { Environment = null; @@ -58,9 +80,50 @@ namespace Grpc.Microbenchmarks } } + /// + /// Runs the operation in parallel (once on each worker thread). + /// This method tries to incur as little + /// overhead as possible, but there is some inherent overhead + /// that is hard to avoid (thread hop etc.). Therefore it is strongly + /// recommended that the benchmarked operation runs long enough to + /// make this overhead negligible. + /// protected void RunConcurrent(Action operation) { - Parallel.For(0, ThreadCount, _ => operation()); + var workItemTasks = new Task[ThreadCount]; + for (int i = 0; i < ThreadCount; i++) + { + var tcs = new TaskCompletionSource(); + var workItem = new Action(() => + { + try + { + operation(); + tcs.SetResult(null); + } + catch (Exception e) + { + tcs.SetException(e); + } + }); + workItemTasks[i] = tcs.Task; + dispatchQueues[i].Add(workItem); + } + Task.WaitAll(workItemTasks); + } + + private void WorkerThreadBody(BlockingCollection dispatchQueue) + { + while(true) + { + var workItem = dispatchQueue.Take(); + if (workItem == null) + { + // stop the worker if null action was provided + break; + } + workItem(); + } } } } diff --git a/src/csharp/Grpc.Microbenchmarks/ScalabityExampleBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/ScalabityExampleBenchmark.cs new file mode 100644 index 00000000000..1ef117c83e7 --- /dev/null +++ b/src/csharp/Grpc.Microbenchmarks/ScalabityExampleBenchmark.cs @@ -0,0 +1,56 @@ +#region Copyright notice and license + +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Runtime.InteropServices; +using BenchmarkDotNet.Attributes; +using Grpc.Core.Internal; + +namespace Grpc.Microbenchmarks +{ + public class ScalabilityExampleBenchmark : CommonThreadedBase + { + protected override bool NeedsEnvironment => false; + + // An example of testing scalability of a method that scales perfectly. + // This method provides a baseline for how well can CommonThreadedBase + // measure scalability. + const int Iterations = 50 * 1000 * 1000; // High number to make the overhead of RunConcurrent negligible. + [Benchmark(OperationsPerInvoke = Iterations)] + public void PerfectScalingExample() + { + RunConcurrent(() => { RunBody(); }); + } + + private int RunBody() + { + int result = 0; + for (int i = 0; i < Iterations; i++) + { + // perform some operation that is completely independent from + // other threads and therefore should scale perfectly if given + // a dedicated thread. + for (int j = 0; j < 100; j++) + { + result = result ^ i ^ j ; + } + } + return result; + } + } +} From 7372c195e717e65c1a60e7b07165d0eaf89b7509 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 1 Aug 2019 04:00:23 +0200 Subject: [PATCH 147/661] adjust iteration count in scalability benchmarks --- src/csharp/Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs | 2 +- src/csharp/Grpc.Microbenchmarks/PInvokeByteArrayBenchmark.cs | 2 +- src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/csharp/Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs index e4cd7eeb1f6..2374148bfe0 100644 --- a/src/csharp/Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs +++ b/src/csharp/Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs @@ -27,7 +27,7 @@ namespace Grpc.Microbenchmarks [Params(false, true)] public bool UseSharedRegistry { get; set; } - const int Iterations = 1000000; // High number to make the overhead of RunConcurrent negligible. + const int Iterations = 5 * 1000 * 1000; // High number to make the overhead of RunConcurrent negligible. [Benchmark(OperationsPerInvoke = Iterations)] public void RegisterExtract() { diff --git a/src/csharp/Grpc.Microbenchmarks/PInvokeByteArrayBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/PInvokeByteArrayBenchmark.cs index de4e635580f..1ede7453db6 100644 --- a/src/csharp/Grpc.Microbenchmarks/PInvokeByteArrayBenchmark.cs +++ b/src/csharp/Grpc.Microbenchmarks/PInvokeByteArrayBenchmark.cs @@ -32,7 +32,7 @@ namespace Grpc.Microbenchmarks [Params(0)] public int PayloadSize { get; set; } - const int Iterations = 1000000; // High number to make the overhead of RunConcurrent negligible. + const int Iterations = 5 * 1000 * 1000; // High number to make the overhead of RunConcurrent negligible. [Benchmark(OperationsPerInvoke = Iterations)] public void AllocFree() { diff --git a/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs index d9554db00db..8496813efb0 100644 --- a/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs +++ b/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs @@ -36,7 +36,7 @@ namespace Grpc.Microbenchmarks [Params(0)] public int PayloadSize { get; set; } - const int Iterations = 1000000; // High number to make the overhead of RunConcurrent negligible. + const int Iterations = 5 * 1000 * 1000; // High number to make the overhead of RunConcurrent negligible. [Benchmark(OperationsPerInvoke = Iterations)] public void SendMessage() { From a16a43945889870438cd6217574861e1276aff04 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 1 Aug 2019 04:53:35 +0200 Subject: [PATCH 148/661] fix CompletionRegistryBenchmark for UseSharedRegistry=true --- .../Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/csharp/Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs index 2374148bfe0..9426882b54b 100644 --- a/src/csharp/Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs +++ b/src/csharp/Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs @@ -31,8 +31,9 @@ namespace Grpc.Microbenchmarks [Benchmark(OperationsPerInvoke = Iterations)] public void RegisterExtract() { - RunConcurrent(() => { - CompletionRegistry sharedRegistry = UseSharedRegistry ? new CompletionRegistry(Environment, () => BatchContextSafeHandle.Create(), () => RequestCallContextSafeHandle.Create()) : null; + CompletionRegistry sharedRegistry = UseSharedRegistry ? new CompletionRegistry(Environment, () => BatchContextSafeHandle.Create(), () => RequestCallContextSafeHandle.Create()) : null; + RunConcurrent(() => + { RunBody(sharedRegistry); }); } From 46253995bb5ac760f20e47bb88a2aeb809d47a76 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 1 Aug 2019 04:55:04 +0200 Subject: [PATCH 149/661] add AtomicCounterBenchmark --- .../AtomicCounterBenchmark.cs | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/csharp/Grpc.Microbenchmarks/AtomicCounterBenchmark.cs diff --git a/src/csharp/Grpc.Microbenchmarks/AtomicCounterBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/AtomicCounterBenchmark.cs new file mode 100644 index 00000000000..03984f40728 --- /dev/null +++ b/src/csharp/Grpc.Microbenchmarks/AtomicCounterBenchmark.cs @@ -0,0 +1,52 @@ +#region Copyright notice and license + +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Runtime.InteropServices; +using BenchmarkDotNet.Attributes; +using Grpc.Core.Internal; + +namespace Grpc.Microbenchmarks +{ + public class AtomicCounterBenchmark : CommonThreadedBase + { + protected override bool NeedsEnvironment => false; + + // An example of testing scalability of a method that scales perfectly. + // This method provides a baseline for how well can CommonThreadedBase + // measure scalability. + const int Iterations = 20 * 1000 * 1000; // High number to make the overhead of RunConcurrent negligible. + [Benchmark(OperationsPerInvoke = Iterations)] + + public void SharedAtomicCounterIncrement() + { + RunConcurrent(() => { RunBody(); }); + } + + readonly AtomicCounter sharedCounter = new AtomicCounter(); + + private int RunBody() + { + for (int i = 0; i < Iterations; i++) + { + sharedCounter.Increment(); + } + return (int) sharedCounter.Count; + } + } +} From af8637661e28f57414d70741bd3626ee3f69aaa6 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 1 Aug 2019 10:33:20 -0700 Subject: [PATCH 150/661] Made compatible with back to Xcode 8.0. Shortened file paths (removed some) --- .../tvOS-sample.xcodeproj/project.pbxproj | 32 +++------ .../Content.imageset/Contents.json | 11 --- .../Contents.json | 17 ----- .../Content.imageset/Contents.json | 11 --- .../Content.imageset/Contents.json | 11 --- .../Middle.imagestacklayer/Contents.json | 6 -- .../Content.imageset/Contents.json | 16 ----- .../Back.imagestacklayer/Contents.json | 6 -- .../App Icon.imagestack/Contents.json | 17 ----- .../Content.imageset/Contents.json | 16 ----- .../Front.imagestacklayer/Contents.json | 6 -- .../Content.imageset/Contents.json | 16 ----- .../Middle.imagestacklayer/Contents.json | 6 -- .../Contents.json | 32 --------- .../Contents.json | 24 ------- .../Top Shelf Image.imageset/Contents.json | 24 ------- .../tvOS-sample/Assets.xcassets/Contents.json | 6 -- .../Launch Image.launchimage/Contents.json | 22 ------ .../AppIcon.appiconset/Contents.json | 0 .../Assets.xcassets}/Contents.json | 0 .../Base.lproj/Interface.storyboard | 0 .../Info.plist | 0 .../Circular.imageset/Contents.json | 0 .../Contents.json | 0 .../Extra Large.imageset/Contents.json | 0 .../Graphic Bezel.imageset/Contents.json | 0 .../Graphic Circular.imageset/Contents.json | 0 .../Graphic Corner.imageset/Contents.json | 0 .../Contents.json | 0 .../Modular.imageset/Contents.json | 0 .../Utilitarian.imageset/Contents.json | 0 .../Assets.xcassets}/Contents.json | 0 .../ExtensionDelegate.h | 0 .../ExtensionDelegate.m | 0 .../Info.plist | 0 .../InterfaceController.h | 0 .../InterfaceController.m | 0 .../Assets.xcassets/Contents.json | 6 -- .../Assets.xcassets/Contents.json | 6 -- .../watchOS-sample.xcodeproj/project.pbxproj | 71 +++++++------------ 40 files changed, 37 insertions(+), 325 deletions(-) delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Contents.json delete mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Launch Image.launchimage/Contents.json rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit App => WatchKit-App}/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename src/objective-c/examples/{tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer => watchOS-sample/WatchKit-App/Assets.xcassets}/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit App => WatchKit-App}/Base.lproj/Interface.storyboard (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample WatchKit App => WatchKit-App}/Info.plist (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json (100%) rename src/objective-c/examples/{tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer => watchOS-sample/WatchKit-Extension/Assets.xcassets}/Contents.json (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/ExtensionDelegate.h (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/ExtensionDelegate.m (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/Info.plist (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/InterfaceController.h (100%) rename src/objective-c/examples/watchOS-sample/{watchOS-sample-WatchKit-Extension => WatchKit-Extension}/InterfaceController.m (100%) delete mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/Contents.json delete mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Contents.json diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj index a19281242bd..f9acf7fe186 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj @@ -3,14 +3,13 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 48; objects = { /* Begin PBXBuildFile section */ ABB17D3A22D8FB8B00C26D6E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D3922D8FB8B00C26D6E /* AppDelegate.m */; }; ABB17D3D22D8FB8B00C26D6E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D3C22D8FB8B00C26D6E /* ViewController.m */; }; ABB17D4022D8FB8B00C26D6E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D3E22D8FB8B00C26D6E /* Main.storyboard */; }; - ABB17D4222D8FB8D00C26D6E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D4122D8FB8D00C26D6E /* Assets.xcassets */; }; ABB17D4522D8FB8D00C26D6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D4422D8FB8D00C26D6E /* main.m */; }; F9B775DB1DDCBD39DF92BFA8 /* libPods-tvOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40071025CBF9E79B9522398F /* libPods-tvOS-sample.a */; }; /* End PBXBuildFile section */ @@ -24,7 +23,6 @@ ABB17D3B22D8FB8B00C26D6E /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; ABB17D3C22D8FB8B00C26D6E /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; ABB17D3F22D8FB8B00C26D6E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - ABB17D4122D8FB8D00C26D6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; ABB17D4322D8FB8D00C26D6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; ABB17D4422D8FB8D00C26D6E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; D2D1C60CE9BD00C1371BC913 /* Pods-tvOS-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS-sample.debug.xcconfig"; path = "Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample.debug.xcconfig"; sourceTree = ""; }; @@ -77,7 +75,6 @@ ABB17D3B22D8FB8B00C26D6E /* ViewController.h */, ABB17D3C22D8FB8B00C26D6E /* ViewController.m */, ABB17D3E22D8FB8B00C26D6E /* Main.storyboard */, - ABB17D4122D8FB8D00C26D6E /* Assets.xcassets */, ABB17D4322D8FB8D00C26D6E /* Info.plist */, ABB17D4422D8FB8D00C26D6E /* main.m */, ); @@ -125,11 +122,12 @@ TargetAttributes = { ABB17D3422D8FB8B00C26D6E = { CreatedOnToolsVersion = 10.1; + ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = ABB17D3022D8FB8B00C26D6E /* Build configuration list for PBXProject "tvOS-sample" */; - compatibilityVersion = "Xcode 9.3"; + compatibilityVersion = "Xcode 8.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -151,7 +149,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - ABB17D4222D8FB8D00C26D6E /* Assets.xcassets in Resources */, ABB17D4022D8FB8B00C26D6E /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -164,12 +161,13 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources-${CONFIGURATION}-input-files.xcfilelist", + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources-${CONFIGURATION}-output-files.xcfilelist", + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -181,15 +179,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-tvOS-sample-checkManifestLockResult.txt", ); @@ -344,10 +338,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "tvOS-sample/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-grpc-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = 3; @@ -364,10 +355,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "tvOS-sample/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-grpc-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = 3; diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json deleted file mode 100644 index 48ecb4fa43e..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "images" : [ - { - "idiom" : "tv" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json deleted file mode 100644 index d29f024ed5c..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "layers" : [ - { - "filename" : "Front.imagestacklayer" - }, - { - "filename" : "Middle.imagestacklayer" - }, - { - "filename" : "Back.imagestacklayer" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json deleted file mode 100644 index 48ecb4fa43e..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "images" : [ - { - "idiom" : "tv" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json deleted file mode 100644 index 48ecb4fa43e..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "images" : [ - { - "idiom" : "tv" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json deleted file mode 100644 index da4a164c918..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json deleted file mode 100644 index 16a370df014..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "images" : [ - { - "idiom" : "tv", - "scale" : "1x" - }, - { - "idiom" : "tv", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json deleted file mode 100644 index da4a164c918..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json deleted file mode 100644 index d29f024ed5c..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "layers" : [ - { - "filename" : "Front.imagestacklayer" - }, - { - "filename" : "Middle.imagestacklayer" - }, - { - "filename" : "Back.imagestacklayer" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json deleted file mode 100644 index 16a370df014..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "images" : [ - { - "idiom" : "tv", - "scale" : "1x" - }, - { - "idiom" : "tv", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json deleted file mode 100644 index da4a164c918..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json deleted file mode 100644 index 16a370df014..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "images" : [ - { - "idiom" : "tv", - "scale" : "1x" - }, - { - "idiom" : "tv", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json deleted file mode 100644 index da4a164c918..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json deleted file mode 100644 index db288f368f1..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "assets" : [ - { - "size" : "1280x768", - "idiom" : "tv", - "filename" : "App Icon - App Store.imagestack", - "role" : "primary-app-icon" - }, - { - "size" : "400x240", - "idiom" : "tv", - "filename" : "App Icon.imagestack", - "role" : "primary-app-icon" - }, - { - "size" : "2320x720", - "idiom" : "tv", - "filename" : "Top Shelf Image Wide.imageset", - "role" : "top-shelf-image-wide" - }, - { - "size" : "1920x720", - "idiom" : "tv", - "filename" : "Top Shelf Image.imageset", - "role" : "top-shelf-image" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json deleted file mode 100644 index 7dc95020229..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "images" : [ - { - "idiom" : "tv", - "scale" : "1x" - }, - { - "idiom" : "tv", - "scale" : "2x" - }, - { - "idiom" : "tv-marketing", - "scale" : "1x" - }, - { - "idiom" : "tv-marketing", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json deleted file mode 100644 index 7dc95020229..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "images" : [ - { - "idiom" : "tv", - "scale" : "1x" - }, - { - "idiom" : "tv", - "scale" : "2x" - }, - { - "idiom" : "tv-marketing", - "scale" : "1x" - }, - { - "idiom" : "tv-marketing", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c918..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Launch Image.launchimage/Contents.json b/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Launch Image.launchimage/Contents.json deleted file mode 100644 index d746a609003..00000000000 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/Launch Image.launchimage/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "orientation" : "landscape", - "idiom" : "tv", - "extent" : "full-screen", - "minimum-system-version" : "11.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "tv", - "extent" : "full-screen", - "minimum-system-version" : "9.0", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/AppIcon.appiconset/Contents.json rename to src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/Contents.json similarity index 100% rename from src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json rename to src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Base.lproj/Interface.storyboard b/src/objective-c/examples/watchOS-sample/WatchKit-App/Base.lproj/Interface.storyboard similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Base.lproj/Interface.storyboard rename to src/objective-c/examples/watchOS-sample/WatchKit-App/Base.lproj/Interface.storyboard diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Info.plist rename to src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Contents.json rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Contents.json similarity index 100% rename from src/objective-c/examples/tvOS-sample/tvOS-sample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Contents.json diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.h b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.h similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.h rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.h diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.m b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.m similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/ExtensionDelegate.m rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.m diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Info.plist rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.h b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.h similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.h rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.h diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.m b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m similarity index 100% rename from src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/InterfaceController.m rename to src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c918..00000000000 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample WatchKit App/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c918..00000000000 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample-WatchKit-Extension/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj index 9d40fc4b0cf..5494aee418c 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 48; objects = { /* Begin PBXBuildFile section */ @@ -138,8 +138,8 @@ isa = PBXGroup; children = ( ABB17D5622D93BAB00C26D6E /* watchOS-sample */, - ABB17D6E22D93BAC00C26D6E /* watchOS-sample WatchKit App */, - ABB17D7D22D93BAC00C26D6E /* watchOS-sample-WatchKit-Extension */, + ABB17D6E22D93BAC00C26D6E /* WatchKit-App */, + ABB17D7D22D93BAC00C26D6E /* WatchKit-Extension */, ABB17D5522D93BAB00C26D6E /* Products */, 2C4A0708747AAA7298F757DA /* Pods */, FDB2CA47351660A961DBE458 /* Frameworks */, @@ -172,17 +172,17 @@ path = "watchOS-sample"; sourceTree = ""; }; - ABB17D6E22D93BAC00C26D6E /* watchOS-sample WatchKit App */ = { + ABB17D6E22D93BAC00C26D6E /* WatchKit-App */ = { isa = PBXGroup; children = ( ABB17D6F22D93BAC00C26D6E /* Interface.storyboard */, ABB17D7222D93BAC00C26D6E /* Assets.xcassets */, ABB17D7422D93BAC00C26D6E /* Info.plist */, ); - path = "watchOS-sample WatchKit App"; + path = "WatchKit-App"; sourceTree = ""; }; - ABB17D7D22D93BAC00C26D6E /* watchOS-sample-WatchKit-Extension */ = { + ABB17D7D22D93BAC00C26D6E /* WatchKit-Extension */ = { isa = PBXGroup; children = ( ABB17D7E22D93BAC00C26D6E /* InterfaceController.h */, @@ -192,7 +192,7 @@ ABB17D8422D93BAD00C26D6E /* Assets.xcassets */, ABB17D8622D93BAD00C26D6E /* Info.plist */, ); - path = "watchOS-sample-WatchKit-Extension"; + path = "WatchKit-Extension"; sourceTree = ""; }; FDB2CA47351660A961DBE458 /* Frameworks */ = { @@ -276,17 +276,20 @@ TargetAttributes = { ABB17D5322D93BAB00C26D6E = { CreatedOnToolsVersion = 10.1; + ProvisioningStyle = Automatic; }; ABB17D6922D93BAC00C26D6E = { CreatedOnToolsVersion = 10.1; + ProvisioningStyle = Automatic; }; ABB17D7822D93BAC00C26D6E = { CreatedOnToolsVersion = 10.1; + ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = ABB17D4F22D93BAB00C26D6E /* Build configuration list for PBXProject "watchOS-sample" */; - compatibilityVersion = "Xcode 9.3"; + compatibilityVersion = "Xcode 8.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -341,15 +344,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-watchOS-sample WatchKit Extension-checkManifestLockResult.txt", ); @@ -363,15 +362,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-watchOS-sample-checkManifestLockResult.txt", ); @@ -385,12 +380,13 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources-${CONFIGURATION}-input-files.xcfilelist", + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-watchOS/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources-${CONFIGURATION}-output-files.xcfilelist", + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -402,12 +398,13 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources-${CONFIGURATION}-input-files.xcfilelist", + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources-${CONFIGURATION}-output-files.xcfilelist", + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -530,7 +527,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -583,7 +580,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -599,11 +596,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "$(SRCROOT)/watchOS-sample-WatchKit-Extension/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp.watchkitextension"; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; @@ -621,11 +614,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "$(SRCROOT)/watchOS-sample-WatchKit-Extension/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp.watchkitextension"; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; @@ -677,10 +666,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "watchOS-sample/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; @@ -695,10 +681,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "watchOS-sample/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; From 6c7184a36010f1b315998db5ca35da158d62095e Mon Sep 17 00:00:00 2001 From: Qiancheng Zhao Date: Thu, 1 Aug 2019 10:54:21 -0700 Subject: [PATCH 151/661] fix memory_usage_test failure --- src/core/ext/filters/client_channel/client_channel.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 7aafca6f8ae..ac79ae92d5a 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -1510,7 +1510,7 @@ void ChannelData::CreateResolvingLoadBalancingPolicyLocked() { UniquePtr( New(this)); lb_args.args = channel_args_; - UniquePtr target_uri(strdup(target_uri_.get())); + UniquePtr target_uri(gpr_strdup(target_uri_.get())); resolving_lb_policy_.reset(New( std::move(lb_args), &grpc_client_channel_routing_trace, std::move(target_uri), ProcessResolverResultLocked, this)); From 0d6eec8b8f46f52d9e5e2062b7e596d8b0425fe8 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 1 Aug 2019 20:26:58 +0200 Subject: [PATCH 152/661] a few fixes for run_performance_tests.py flame graph generators --- .../run_tests/performance/process_local_perf_flamegraphs.sh | 3 +++ .../performance/process_remote_perf_flamegraphs.sh | 3 +++ tools/run_tests/run_performance_tests.py | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/run_tests/performance/process_local_perf_flamegraphs.sh b/tools/run_tests/performance/process_local_perf_flamegraphs.sh index ccb5b19f2a8..b7b05fde3d9 100755 --- a/tools/run_tests/performance/process_local_perf_flamegraphs.sh +++ b/tools/run_tests/performance/process_local_perf_flamegraphs.sh @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +set -ex + mkdir -p "$OUTPUT_DIR" PERF_DATA_FILE="${PERF_BASE_NAME}-perf.data" @@ -22,4 +24,5 @@ PERF_SCRIPT_OUTPUT="${PERF_BASE_NAME}-out.perf" echo "running perf script on $PERF_DATA_FILE" perf script -i "$PERF_DATA_FILE" > "$PERF_SCRIPT_OUTPUT" +# use https://github.com/brendangregg/FlameGraph ~/FlameGraph/stackcollapse-perf.pl "$PERF_SCRIPT_OUTPUT" | ~/FlameGraph/flamegraph.pl > "${OUTPUT_DIR}/${OUTPUT_FILENAME}.svg" diff --git a/tools/run_tests/performance/process_remote_perf_flamegraphs.sh b/tools/run_tests/performance/process_remote_perf_flamegraphs.sh index 2ea6b4f2a6c..6e42564d5f4 100755 --- a/tools/run_tests/performance/process_remote_perf_flamegraphs.sh +++ b/tools/run_tests/performance/process_remote_perf_flamegraphs.sh @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +set -ex + mkdir -p "$OUTPUT_DIR" PERF_DATA_FILE="${PERF_BASE_NAME}-perf.data" @@ -27,4 +29,5 @@ scp "$USER_AT_HOST:~/performance_workspace/grpc/$PERF_SCRIPT_OUTPUT.gz" . gzip -d -f "$PERF_SCRIPT_OUTPUT.gz" +# use https://github.com/brendangregg/FlameGraph ~/FlameGraph/stackcollapse-perf.pl --kernel "$PERF_SCRIPT_OUTPUT" | ~/FlameGraph/flamegraph.pl --color=java --hash > "${OUTPUT_DIR}/${OUTPUT_FILENAME}.svg" diff --git a/tools/run_tests/run_performance_tests.py b/tools/run_tests/run_performance_tests.py index c6e67eaf563..4ecd6d6efd1 100755 --- a/tools/run_tests/run_performance_tests.py +++ b/tools/run_tests/run_performance_tests.py @@ -328,10 +328,10 @@ def perf_report_processor_job(worker_host, perf_base_name, output_filename, cmd = '' if worker_host != 'localhost': user_at_host = "%s@%s" % (_REMOTE_HOST_USERNAME, worker_host) - cmd = "USER_AT_HOST=%s OUTPUT_FILENAME=%s OUTPUT_DIR=%s PERF_BASE_NAME=%stools/run_tests/performance/process_remote_perf_flamegraphs.sh" % ( + cmd = "USER_AT_HOST=%s OUTPUT_FILENAME=%s OUTPUT_DIR=%s PERF_BASE_NAME=%s tools/run_tests/performance/process_remote_perf_flamegraphs.sh" % ( user_at_host, output_filename, flame_graph_reports, perf_base_name) else: - cmd = "OUTPUT_FILENAME=%s OUTPUT_DIR=%s PERF_BASE_NAME=%stools/run_tests/performance/process_local_perf_flamegraphs.sh" % ( + cmd = "OUTPUT_FILENAME=%s OUTPUT_DIR=%s PERF_BASE_NAME=%s tools/run_tests/performance/process_local_perf_flamegraphs.sh" % ( output_filename, flame_graph_reports, perf_base_name) return jobset.JobSpec( @@ -484,7 +484,7 @@ def run_collect_perf_profile_jobs(hosts_and_base_names, scenario_name, failures, _ = jobset.run( perf_report_jobs, newline_on_success=True, maxjobs=1) jobset.message( - 'END', 'Collecting perf reports from qps workers', do_newline=True) + 'SUCCESS', 'Collecting perf reports from qps workers', do_newline=True) return failures From 5be988f41215e84c315d3f31dc358166480501c4 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 1 Aug 2019 11:46:48 -0700 Subject: [PATCH 153/661] Adapted samples to new imports & added experimental kokoro jobs --- src/objective-c/examples/tvOS-sample/Podfile | 2 + .../tvOS-sample.xcodeproj/project.pbxproj | 16 +++-- .../tvOS-sample/tvOS-sample/ViewController.m | 5 ++ .../examples/watchOS-sample/Podfile | 2 + .../watchOS-sample/WatchKit-App/Info.plist | 2 +- .../WatchKit-Extension/Info.plist | 2 +- .../WatchKit-Extension/InterfaceController.m | 5 ++ .../watchOS-sample.xcodeproj/project.pbxproj | 60 +++++++++---------- .../watchOS-sample/ViewController.m | 2 - tools/run_tests/run_tests.py | 44 ++++++++++++++ 10 files changed, 100 insertions(+), 40 deletions(-) diff --git a/src/objective-c/examples/tvOS-sample/Podfile b/src/objective-c/examples/tvOS-sample/Podfile index 20d20e27bdf..79427b98b90 100644 --- a/src/objective-c/examples/tvOS-sample/Podfile +++ b/src/objective-c/examples/tvOS-sample/Podfile @@ -2,6 +2,8 @@ platform :tvos, '10.0' install! 'cocoapods', :deterministic_uuids => false +use_frameworks! if ENV['FRAMEWORKS'] != 'NO' + ROOT_DIR = '../../../..' target 'tvOS-sample' do diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj index f9acf7fe186..7f8198aa320 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj @@ -7,15 +7,15 @@ objects = { /* Begin PBXBuildFile section */ + 8E4F1CA090367C7618548546 /* libPods-tvOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 65430D45E5C272C975E4CCCA /* libPods-tvOS-sample.a */; }; ABB17D3A22D8FB8B00C26D6E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D3922D8FB8B00C26D6E /* AppDelegate.m */; }; ABB17D3D22D8FB8B00C26D6E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D3C22D8FB8B00C26D6E /* ViewController.m */; }; ABB17D4022D8FB8B00C26D6E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D3E22D8FB8B00C26D6E /* Main.storyboard */; }; ABB17D4522D8FB8D00C26D6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D4422D8FB8D00C26D6E /* main.m */; }; - F9B775DB1DDCBD39DF92BFA8 /* libPods-tvOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40071025CBF9E79B9522398F /* libPods-tvOS-sample.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 40071025CBF9E79B9522398F /* libPods-tvOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-tvOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 65430D45E5C272C975E4CCCA /* libPods-tvOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-tvOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 93F3CF0DB110860F8E180685 /* Pods-tvOS-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS-sample.release.xcconfig"; path = "Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample.release.xcconfig"; sourceTree = ""; }; ABB17D3522D8FB8B00C26D6E /* tvOS-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "tvOS-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; ABB17D3822D8FB8B00C26D6E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -33,7 +33,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F9B775DB1DDCBD39DF92BFA8 /* libPods-tvOS-sample.a in Frameworks */, + 8E4F1CA090367C7618548546 /* libPods-tvOS-sample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -84,7 +84,7 @@ D280E557B55AAB044C083DB5 /* Frameworks */ = { isa = PBXGroup; children = ( - 40071025CBF9E79B9522398F /* libPods-tvOS-sample.a */, + 65430D45E5C272C975E4CCCA /* libPods-tvOS-sample.a */, ); name = Frameworks; sourceTree = ""; @@ -100,7 +100,7 @@ ABB17D3122D8FB8B00C26D6E /* Sources */, ABB17D3222D8FB8B00C26D6E /* Frameworks */, ABB17D3322D8FB8B00C26D6E /* Resources */, - 340B0470EBFB87C5242C058E /* [CP] Copy Pods Resources */, + 53B9CBB782EEE8A7572F10EC /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -156,16 +156,20 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 340B0470EBFB87C5242C058E /* [CP] Copy Pods Resources */ = { + 53B9CBB782EEE8A7572F10EC /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources.sh", "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + ); outputPaths = ( "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", ); diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m index 0d291e44842..c94ee8c2569 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m @@ -18,8 +18,13 @@ #import "ViewController.h" +#if USE_FRAMEWORKS #import #import +#else +#import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" +#endif @interface ViewController () diff --git a/src/objective-c/examples/watchOS-sample/Podfile b/src/objective-c/examples/watchOS-sample/Podfile index a0f93bef730..59d30ab86c0 100644 --- a/src/objective-c/examples/watchOS-sample/Podfile +++ b/src/objective-c/examples/watchOS-sample/Podfile @@ -1,5 +1,7 @@ install! 'cocoapods', :deterministic_uuids => false +use_frameworks! if ENV['FRAMEWORKS'] != 'NO' + ROOT_DIR = '../../../..' def grpc_deps diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist index 68081b1f6e0..f0396b31ef7 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist +++ b/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist @@ -5,7 +5,7 @@ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName - watchOS-sample WatchKit App + WatchKit-App CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist index 457a48af2d8..fcbeef72a4d 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist @@ -5,7 +5,7 @@ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName - watchOS-sample WatchKit Extension + WatchKit-Extension CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m index d7f0c94adc9..3e97767cf0c 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m @@ -17,8 +17,13 @@ */ #import "InterfaceController.h" +#if USE_FRAMEWORKS #import #import +#else +#import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" +#endif @interface InterfaceController () diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj index 5494aee418c..7f57c514775 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj @@ -7,7 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - 6CD34817C1124B7090EFB679 /* libPods-watchOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 81BB6B1D8754281EF32EB3F2 /* libPods-watchOS-sample.a */; }; + 26FD050F4CCE95ED8CB98A62 /* libPods-watchOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CD8313B9B59F6F095035EF8 /* libPods-watchOS-sample.a */; }; + A82AA8DDE95C58A13334A932 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E347FF230AC1FAC0C374BE0C /* libPods-watchOS-sample WatchKit Extension.a */; }; ABB17D5922D93BAB00C26D6E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D5822D93BAB00C26D6E /* AppDelegate.m */; }; ABB17D5C22D93BAB00C26D6E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D5B22D93BAB00C26D6E /* ViewController.m */; }; ABB17D5F22D93BAB00C26D6E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D5D22D93BAB00C26D6E /* Main.storyboard */; }; @@ -21,7 +22,6 @@ ABB17D8022D93BAC00C26D6E /* InterfaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D7F22D93BAC00C26D6E /* InterfaceController.m */; }; ABB17D8322D93BAC00C26D6E /* ExtensionDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D8222D93BAC00C26D6E /* ExtensionDelegate.m */; }; ABB17D8522D93BAD00C26D6E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D8422D93BAD00C26D6E /* Assets.xcassets */; }; - CCC7943770AD2447C8F33431 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B9B6F1C6465A4AAC45CAF14 /* libPods-watchOS-sample WatchKit Extension.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -68,8 +68,7 @@ /* Begin PBXFileReference section */ 574DCD2DDCABCC45B2308601 /* Pods-watchOS-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample.debug.xcconfig"; path = "Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample.debug.xcconfig"; sourceTree = ""; }; - 5B9B6F1C6465A4AAC45CAF14 /* libPods-watchOS-sample WatchKit Extension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample WatchKit Extension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 81BB6B1D8754281EF32EB3F2 /* libPods-watchOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 7CD8313B9B59F6F095035EF8 /* libPods-watchOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 957B59E3DE8281B41B6DB3FD /* Pods-watchOS-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample.release.xcconfig"; path = "Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample.release.xcconfig"; sourceTree = ""; }; ABB17D5422D93BAB00C26D6E /* watchOS-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "watchOS-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; ABB17D5722D93BAB00C26D6E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -92,6 +91,7 @@ ABB17D8222D93BAC00C26D6E /* ExtensionDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExtensionDelegate.m; sourceTree = ""; }; ABB17D8422D93BAD00C26D6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; ABB17D8622D93BAD00C26D6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E347FF230AC1FAC0C374BE0C /* libPods-watchOS-sample WatchKit Extension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample WatchKit Extension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; EDC6FF21CD9F393E8FDF02F6 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample WatchKit Extension.release.xcconfig"; path = "Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension.release.xcconfig"; sourceTree = ""; }; FBBABD10A996E7CCA4B2F937 /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample WatchKit Extension.debug.xcconfig"; path = "Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -101,7 +101,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 6CD34817C1124B7090EFB679 /* libPods-watchOS-sample.a in Frameworks */, + 26FD050F4CCE95ED8CB98A62 /* libPods-watchOS-sample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -109,7 +109,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - CCC7943770AD2447C8F33431 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */, + A82AA8DDE95C58A13334A932 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -198,8 +198,8 @@ FDB2CA47351660A961DBE458 /* Frameworks */ = { isa = PBXGroup; children = ( - 81BB6B1D8754281EF32EB3F2 /* libPods-watchOS-sample.a */, - 5B9B6F1C6465A4AAC45CAF14 /* libPods-watchOS-sample WatchKit Extension.a */, + 7CD8313B9B59F6F095035EF8 /* libPods-watchOS-sample.a */, + E347FF230AC1FAC0C374BE0C /* libPods-watchOS-sample WatchKit Extension.a */, ); name = Frameworks; sourceTree = ""; @@ -216,7 +216,7 @@ ABB17D5122D93BAB00C26D6E /* Frameworks */, ABB17D5222D93BAB00C26D6E /* Resources */, ABB17D9022D93BAD00C26D6E /* Embed Watch Content */, - E8B22C16C7C7397CEC79CCF6 /* [CP] Copy Pods Resources */, + 9A5D1B4A7574524FF0BB9310 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -254,7 +254,7 @@ ABB17D7522D93BAC00C26D6E /* Sources */, ABB17D7622D93BAC00C26D6E /* Frameworks */, ABB17D7722D93BAC00C26D6E /* Resources */, - DB65546E9DFC6EADD365E270 /* [CP] Copy Pods Resources */, + 7246FFBCAD3F9270364EFC9E /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -357,32 +357,32 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - C094DF31B83C380F13D80132 /* [CP] Check Pods Manifest.lock */ = { + 7246FFBCAD3F9270364EFC9E /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", + "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-watchOS/gRPCCertificates.bundle", ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-watchOS-sample-checkManifestLockResult.txt", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources.sh\"\n"; showEnvVarsInLog = 0; }; - DB65546E9DFC6EADD365E270 /* [CP] Copy Pods Resources */ = { + 9A5D1B4A7574524FF0BB9310 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-watchOS/gRPCCertificates.bundle", + "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( @@ -390,25 +390,25 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh\"\n"; showEnvVarsInLog = 0; }; - E8B22C16C7C7397CEC79CCF6 /* [CP] Copy Pods Resources */ = { + C094DF31B83C380F13D80132 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); - name = "[CP] Copy Pods Resources"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", + "$(DERIVED_FILE_DIR)/Pods-watchOS-sample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -595,7 +595,7 @@ ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; - INFOPLIST_FILE = "$(SRCROOT)/watchOS-sample-WatchKit-Extension/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/WatchKit-Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp.watchkitextension"; PRODUCT_NAME = "${TARGET_NAME}"; @@ -613,7 +613,7 @@ ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; - INFOPLIST_FILE = "$(SRCROOT)/watchOS-sample-WatchKit-Extension/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/WatchKit-Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp.watchkitextension"; PRODUCT_NAME = "${TARGET_NAME}"; @@ -631,7 +631,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; IBSC_MODULE = watchOS_sample_WatchKit_Extension; - INFOPLIST_FILE = "watchOS-sample WatchKit App/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/WatchKit-App/Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; @@ -648,7 +648,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; IBSC_MODULE = watchOS_sample_WatchKit_Extension; - INFOPLIST_FILE = "watchOS-sample WatchKit App/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/WatchKit-App/Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m index d15c78482bb..4bc98912bf9 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m @@ -18,8 +18,6 @@ #import "ViewController.h" -#import - @interface ViewController () @end diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index dad570ee0ca..a4e647a7833 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1090,6 +1090,50 @@ class ObjCLanguage(object): 'SCHEME': 'SwiftSample', 'EXAMPLE_PATH': 'src/objective-c/examples/SwiftSample' })) + out.append( + self.config.job_spec( + ['src/objective-c/tests/build_one_example.sh'], + timeout_seconds=10 * 60, + shortname='ios-buildtest-example-tvOS-sample', + cpu_cost=1e6, + environ={ + 'SCHEME': 'tvOS-sample', + 'EXAMPLE_PATH': 'src/objective-c/examples/tvOS-sample', + 'FRAMEWORKS': 'NO' + })) + out.append( + self.config.job_spec( + ['src/objective-c/tests/build_one_example.sh'], + timeout_seconds=10 * 60, + shortname='ios-buildtest-example-tvOS-sample-framework', + cpu_cost=1e6, + environ={ + 'SCHEME': 'tvOS-sample', + 'EXAMPLE_PATH': 'src/objective-c/examples/tvOS-sample', + 'FRAMEWORKS': 'YES' + })) + out.append( + self.config.job_spec( + ['src/objective-c/tests/build_one_example.sh'], + timeout_seconds=10 * 60, + shortname='ios-buildtest-example-watchOS-sample', + cpu_cost=1e6, + environ={ + 'SCHEME': 'watchOS-sample', + 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', + 'FRAMEWORKS': 'NO' + })) + out.append( + self.config.job_spec( + ['src/objective-c/tests/build_one_example.sh'], + timeout_seconds=10 * 60, + shortname='ios-buildtest-example-watchOS-sample-framework', + cpu_cost=1e6, + environ={ + 'SCHEME': 'watchOS-sample', + 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', + 'FRAMEWORKS': 'YES' + })) out.append( self.config.job_spec( ['src/objective-c/tests/run_plugin_tests.sh'], From b437dc0c6804132396fb5efff7f3ade399772611 Mon Sep 17 00:00:00 2001 From: Arjun Roy Date: Tue, 16 Jul 2019 14:11:21 -0700 Subject: [PATCH 154/661] Reduce instruction count for CH2 metadata ops. 1) Statically pre-compute static slice indices to save some ALU ops when linking batched metadata. 2) Change some asserts to debug_asserts since they can provably not be triggered with the current implementation. 3) Save some slice comparison cycles inside CH2 parsing. --- .../chttp2/transport/incoming_metadata.cc | 3 +- .../ext/transport/chttp2/transport/parsing.cc | 28 +- src/core/lib/slice/slice_internal.h | 11 + src/core/lib/transport/metadata_batch.cc | 2 +- src/core/lib/transport/static_metadata.cc | 1321 +++++++++-------- src/core/lib/transport/static_metadata.h | 24 +- tools/codegen/core/gen_static_metadata.py | 37 +- 7 files changed, 731 insertions(+), 695 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/incoming_metadata.cc b/src/core/ext/transport/chttp2/transport/incoming_metadata.cc index 02623c978d7..d04630d726b 100644 --- a/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +++ b/src/core/ext/transport/chttp2/transport/incoming_metadata.cc @@ -38,7 +38,8 @@ grpc_error* grpc_chttp2_incoming_metadata_buffer_add( storage = static_cast( buffer->arena->Alloc(sizeof(grpc_linked_mdelem))); } - return grpc_metadata_batch_add_tail(&buffer->batch, storage, elem); + storage->md = elem; + return grpc_metadata_batch_link_tail(&buffer->batch, storage); } grpc_error* grpc_chttp2_incoming_metadata_buffer_replace_or_add( diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc index 4e6ff60caf8..796f63573c0 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.cc +++ b/src/core/ext/transport/chttp2/transport/parsing.cc @@ -108,7 +108,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t, /* fallthrough */ dts_fh_0: case GRPC_DTS_FH_0: - GPR_ASSERT(cur < end); + GPR_DEBUG_ASSERT(cur < end); t->incoming_frame_size = (static_cast(*cur)) << 16; if (++cur == end) { t->deframe_state = GRPC_DTS_FH_1; @@ -116,7 +116,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t, } /* fallthrough */ case GRPC_DTS_FH_1: - GPR_ASSERT(cur < end); + GPR_DEBUG_ASSERT(cur < end); t->incoming_frame_size |= (static_cast(*cur)) << 8; if (++cur == end) { t->deframe_state = GRPC_DTS_FH_2; @@ -124,7 +124,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t, } /* fallthrough */ case GRPC_DTS_FH_2: - GPR_ASSERT(cur < end); + GPR_DEBUG_ASSERT(cur < end); t->incoming_frame_size |= *cur; if (++cur == end) { t->deframe_state = GRPC_DTS_FH_3; @@ -132,7 +132,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t, } /* fallthrough */ case GRPC_DTS_FH_3: - GPR_ASSERT(cur < end); + GPR_DEBUG_ASSERT(cur < end); t->incoming_frame_type = *cur; if (++cur == end) { t->deframe_state = GRPC_DTS_FH_4; @@ -140,7 +140,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t, } /* fallthrough */ case GRPC_DTS_FH_4: - GPR_ASSERT(cur < end); + GPR_DEBUG_ASSERT(cur < end); t->incoming_frame_flags = *cur; if (++cur == end) { t->deframe_state = GRPC_DTS_FH_5; @@ -148,7 +148,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t, } /* fallthrough */ case GRPC_DTS_FH_5: - GPR_ASSERT(cur < end); + GPR_DEBUG_ASSERT(cur < end); t->incoming_stream_id = ((static_cast(*cur)) & 0x7f) << 24; if (++cur == end) { t->deframe_state = GRPC_DTS_FH_6; @@ -156,7 +156,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t, } /* fallthrough */ case GRPC_DTS_FH_6: - GPR_ASSERT(cur < end); + GPR_DEBUG_ASSERT(cur < end); t->incoming_stream_id |= (static_cast(*cur)) << 16; if (++cur == end) { t->deframe_state = GRPC_DTS_FH_7; @@ -164,7 +164,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t, } /* fallthrough */ case GRPC_DTS_FH_7: - GPR_ASSERT(cur < end); + GPR_DEBUG_ASSERT(cur < end); t->incoming_stream_id |= (static_cast(*cur)) << 8; if (++cur == end) { t->deframe_state = GRPC_DTS_FH_8; @@ -172,7 +172,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t, } /* fallthrough */ case GRPC_DTS_FH_8: - GPR_ASSERT(cur < end); + GPR_DEBUG_ASSERT(cur < end); t->incoming_stream_id |= (static_cast(*cur)); t->deframe_state = GRPC_DTS_FRAME; err = init_frame_parser(t); @@ -208,7 +208,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t, } /* fallthrough */ case GRPC_DTS_FRAME: - GPR_ASSERT(cur < end); + GPR_DEBUG_ASSERT(cur < end); if (static_cast(end - cur) == t->incoming_frame_size) { err = parse_frame_slice( t, @@ -425,7 +425,7 @@ static void on_initial_header(void* tp, grpc_mdelem md) { grpc_chttp2_transport* t = static_cast(tp); grpc_chttp2_stream* s = t->incoming_stream; - GPR_ASSERT(s != nullptr); + GPR_DEBUG_ASSERT(s != nullptr); if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) { char* key = grpc_slice_to_c_string(GRPC_MDKEY(md)); @@ -473,7 +473,7 @@ static void on_initial_header(void* tp, grpc_mdelem md) { const size_t metadata_size_limit = t->settings[GRPC_ACKED_SETTINGS] [GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE]; - if (new_size > metadata_size_limit) { + if (GPR_UNLIKELY(new_size > metadata_size_limit)) { gpr_log(GPR_DEBUG, "received initial metadata size exceeds limit (%" PRIuPTR " vs. %" PRIuPTR ")", @@ -504,7 +504,7 @@ static void on_trailing_header(void* tp, grpc_mdelem md) { grpc_chttp2_transport* t = static_cast(tp); grpc_chttp2_stream* s = t->incoming_stream; - GPR_ASSERT(s != nullptr); + GPR_DEBUG_ASSERT(s != nullptr); if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) { char* key = grpc_slice_to_c_string(GRPC_MDKEY(md)); @@ -627,7 +627,7 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t, } else { t->incoming_stream = s; } - GPR_ASSERT(s != nullptr); + GPR_DEBUG_ASSERT(s != nullptr); s->stats.incoming.framing_bytes += 9; if (GPR_UNLIKELY(s->read_closed)) { GRPC_CHTTP2_IF_TRACING(gpr_log( diff --git a/src/core/lib/slice/slice_internal.h b/src/core/lib/slice/slice_internal.h index 219266c3941..e61f57c01ab 100644 --- a/src/core/lib/slice/slice_internal.h +++ b/src/core/lib/slice/slice_internal.h @@ -174,6 +174,17 @@ struct grpc_slice_refcount { namespace grpc_core { +struct StaticSliceRefcount { + static grpc_slice_refcount kStaticSubRefcount; + + StaticSliceRefcount(uint32_t index) + : base(&kStaticSubRefcount, grpc_slice_refcount::Type::STATIC), + index(index) {} + + grpc_slice_refcount base; + uint32_t index; +}; + extern grpc_slice_refcount kNoopRefcount; struct InternedSliceRefcount { diff --git a/src/core/lib/transport/metadata_batch.cc b/src/core/lib/transport/metadata_batch.cc index 49a56e709d5..74356b2caf2 100644 --- a/src/core/lib/transport/metadata_batch.cc +++ b/src/core/lib/transport/metadata_batch.cc @@ -104,7 +104,7 @@ static grpc_error* maybe_link_callout(grpc_metadata_batch* batch, if (idx == GRPC_BATCH_CALLOUTS_COUNT) { return GRPC_ERROR_NONE; } - if (batch->idx.array[idx] == nullptr) { + if (GPR_LIKELY(batch->idx.array[idx] == nullptr)) { ++batch->list.default_count; batch->idx.array[idx] = storage; return GRPC_ERROR_NONE; diff --git a/src/core/lib/transport/static_metadata.cc b/src/core/lib/transport/static_metadata.cc index ec5db5515a7..3085348d9e5 100644 --- a/src/core/lib/transport/static_metadata.cc +++ b/src/core/lib/transport/static_metadata.cc @@ -116,330 +116,331 @@ static uint8_t g_bytes[] = { 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112}; -static grpc_slice_refcount static_sub_refcnt; -grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = { - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), +grpc_slice_refcount grpc_core::StaticSliceRefcount::kStaticSubRefcount; +grpc_core::StaticSliceRefcount + grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = { + grpc_core::StaticSliceRefcount(0), + grpc_core::StaticSliceRefcount(1), + grpc_core::StaticSliceRefcount(2), + grpc_core::StaticSliceRefcount(3), + grpc_core::StaticSliceRefcount(4), + grpc_core::StaticSliceRefcount(5), + grpc_core::StaticSliceRefcount(6), + grpc_core::StaticSliceRefcount(7), + grpc_core::StaticSliceRefcount(8), + grpc_core::StaticSliceRefcount(9), + grpc_core::StaticSliceRefcount(10), + grpc_core::StaticSliceRefcount(11), + grpc_core::StaticSliceRefcount(12), + grpc_core::StaticSliceRefcount(13), + grpc_core::StaticSliceRefcount(14), + grpc_core::StaticSliceRefcount(15), + grpc_core::StaticSliceRefcount(16), + grpc_core::StaticSliceRefcount(17), + grpc_core::StaticSliceRefcount(18), + grpc_core::StaticSliceRefcount(19), + grpc_core::StaticSliceRefcount(20), + grpc_core::StaticSliceRefcount(21), + grpc_core::StaticSliceRefcount(22), + grpc_core::StaticSliceRefcount(23), + grpc_core::StaticSliceRefcount(24), + grpc_core::StaticSliceRefcount(25), + grpc_core::StaticSliceRefcount(26), + grpc_core::StaticSliceRefcount(27), + grpc_core::StaticSliceRefcount(28), + grpc_core::StaticSliceRefcount(29), + grpc_core::StaticSliceRefcount(30), + grpc_core::StaticSliceRefcount(31), + grpc_core::StaticSliceRefcount(32), + grpc_core::StaticSliceRefcount(33), + grpc_core::StaticSliceRefcount(34), + grpc_core::StaticSliceRefcount(35), + grpc_core::StaticSliceRefcount(36), + grpc_core::StaticSliceRefcount(37), + grpc_core::StaticSliceRefcount(38), + grpc_core::StaticSliceRefcount(39), + grpc_core::StaticSliceRefcount(40), + grpc_core::StaticSliceRefcount(41), + grpc_core::StaticSliceRefcount(42), + grpc_core::StaticSliceRefcount(43), + grpc_core::StaticSliceRefcount(44), + grpc_core::StaticSliceRefcount(45), + grpc_core::StaticSliceRefcount(46), + grpc_core::StaticSliceRefcount(47), + grpc_core::StaticSliceRefcount(48), + grpc_core::StaticSliceRefcount(49), + grpc_core::StaticSliceRefcount(50), + grpc_core::StaticSliceRefcount(51), + grpc_core::StaticSliceRefcount(52), + grpc_core::StaticSliceRefcount(53), + grpc_core::StaticSliceRefcount(54), + grpc_core::StaticSliceRefcount(55), + grpc_core::StaticSliceRefcount(56), + grpc_core::StaticSliceRefcount(57), + grpc_core::StaticSliceRefcount(58), + grpc_core::StaticSliceRefcount(59), + grpc_core::StaticSliceRefcount(60), + grpc_core::StaticSliceRefcount(61), + grpc_core::StaticSliceRefcount(62), + grpc_core::StaticSliceRefcount(63), + grpc_core::StaticSliceRefcount(64), + grpc_core::StaticSliceRefcount(65), + grpc_core::StaticSliceRefcount(66), + grpc_core::StaticSliceRefcount(67), + grpc_core::StaticSliceRefcount(68), + grpc_core::StaticSliceRefcount(69), + grpc_core::StaticSliceRefcount(70), + grpc_core::StaticSliceRefcount(71), + grpc_core::StaticSliceRefcount(72), + grpc_core::StaticSliceRefcount(73), + grpc_core::StaticSliceRefcount(74), + grpc_core::StaticSliceRefcount(75), + grpc_core::StaticSliceRefcount(76), + grpc_core::StaticSliceRefcount(77), + grpc_core::StaticSliceRefcount(78), + grpc_core::StaticSliceRefcount(79), + grpc_core::StaticSliceRefcount(80), + grpc_core::StaticSliceRefcount(81), + grpc_core::StaticSliceRefcount(82), + grpc_core::StaticSliceRefcount(83), + grpc_core::StaticSliceRefcount(84), + grpc_core::StaticSliceRefcount(85), + grpc_core::StaticSliceRefcount(86), + grpc_core::StaticSliceRefcount(87), + grpc_core::StaticSliceRefcount(88), + grpc_core::StaticSliceRefcount(89), + grpc_core::StaticSliceRefcount(90), + grpc_core::StaticSliceRefcount(91), + grpc_core::StaticSliceRefcount(92), + grpc_core::StaticSliceRefcount(93), + grpc_core::StaticSliceRefcount(94), + grpc_core::StaticSliceRefcount(95), + grpc_core::StaticSliceRefcount(96), + grpc_core::StaticSliceRefcount(97), + grpc_core::StaticSliceRefcount(98), + grpc_core::StaticSliceRefcount(99), + grpc_core::StaticSliceRefcount(100), + grpc_core::StaticSliceRefcount(101), + grpc_core::StaticSliceRefcount(102), + grpc_core::StaticSliceRefcount(103), + grpc_core::StaticSliceRefcount(104), + grpc_core::StaticSliceRefcount(105), }; const grpc_core::StaticMetadataSlice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0], 5, - g_bytes + 0), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1], 7, - g_bytes + 5), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, - g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[3], 10, - g_bytes + 19), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4], 7, - g_bytes + 29), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[5], 2, - g_bytes + 36), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[6], 12, - g_bytes + 38), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7], 11, - g_bytes + 50), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[8], 16, - g_bytes + 61), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9], 13, - g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, - g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[11], 21, - g_bytes + 110), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[12], 13, - g_bytes + 131), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[13], 14, - g_bytes + 144), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14], 12, - g_bytes + 158), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15], 16, - g_bytes + 170), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, - g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[17], 30, - g_bytes + 201), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[18], 37, - g_bytes + 231), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[19], 10, - g_bytes + 268), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[20], 4, - g_bytes + 278), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[21], 26, - g_bytes + 282), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[22], 22, - g_bytes + 308), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[23], 12, - g_bytes + 330), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[24], 1, - g_bytes + 342), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[25], 1, - g_bytes + 343), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[26], 1, - g_bytes + 344), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[27], 1, - g_bytes + 345), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[29], 19, - g_bytes + 346), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[30], 12, - g_bytes + 365), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[31], 30, - g_bytes + 377), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[32], 31, - g_bytes + 407), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[33], 36, - g_bytes + 438), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[34], 28, - g_bytes + 474), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[35], 80, - g_bytes + 502), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36], 7, - g_bytes + 582), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, - g_bytes + 589), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38], 11, - g_bytes + 593), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39], 3, - g_bytes + 604), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40], 4, - g_bytes + 607), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41], 1, - g_bytes + 611), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42], 11, - g_bytes + 612), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43], 4, - g_bytes + 623), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44], 5, - g_bytes + 627), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45], 3, - g_bytes + 632), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46], 3, - g_bytes + 635), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47], 3, - g_bytes + 638), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48], 3, - g_bytes + 641), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49], 3, - g_bytes + 644), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50], 3, - g_bytes + 647), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51], 3, - g_bytes + 650), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52], 14, - g_bytes + 653), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53], 13, - g_bytes + 667), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54], 15, - g_bytes + 680), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55], 13, - g_bytes + 695), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56], 6, - g_bytes + 708), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57], 27, - g_bytes + 714), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58], 3, - g_bytes + 741), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59], 5, - g_bytes + 744), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60], 13, - g_bytes + 749), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61], 13, - g_bytes + 762), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62], 19, - g_bytes + 775), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63], 16, - g_bytes + 794), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64], 14, - g_bytes + 810), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65], 16, - g_bytes + 824), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66], 13, - g_bytes + 840), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67], 6, - g_bytes + 853), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68], 4, - g_bytes + 859), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69], 4, - g_bytes + 863), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70], 6, - g_bytes + 867), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71], 7, - g_bytes + 873), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72], 4, - g_bytes + 880), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73], 8, - g_bytes + 884), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74], 17, - g_bytes + 892), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75], 13, - g_bytes + 909), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76], 8, - g_bytes + 922), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77], 19, - g_bytes + 930), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78], 13, - g_bytes + 949), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79], 4, - g_bytes + 962), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80], 8, - g_bytes + 966), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81], 12, - g_bytes + 974), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82], 18, - g_bytes + 986), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83], 19, - g_bytes + 1004), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84], 5, - g_bytes + 1023), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85], 7, - g_bytes + 1028), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86], 7, - g_bytes + 1035), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87], 11, - g_bytes + 1042), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88], 6, - g_bytes + 1053), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89], 10, - g_bytes + 1059), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90], 25, - g_bytes + 1069), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91], 17, - g_bytes + 1094), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92], 4, - g_bytes + 1111), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93], 3, - g_bytes + 1115), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94], 16, - g_bytes + 1118), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95], 1, - g_bytes + 1134), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, - g_bytes + 1135), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97], 8, - g_bytes + 1143), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98], 16, - g_bytes + 1151), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99], 4, - g_bytes + 1167), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[100], 3, - g_bytes + 1171), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[101], 11, - g_bytes + 1174), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[102], 16, - g_bytes + 1185), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[103], 13, - g_bytes + 1201), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[104], 12, - g_bytes + 1214), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[105], 21, - g_bytes + 1226), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0].base, + 5, g_bytes + 0), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, + 7, g_bytes + 5), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, + 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[3].base, + 10, g_bytes + 19), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, + 7, g_bytes + 29), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[5].base, + 2, g_bytes + 36), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[6].base, + 12, g_bytes + 38), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7].base, + 11, g_bytes + 50), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[8].base, + 16, g_bytes + 61), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, + 13, g_bytes + 77), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, + 20, g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[11].base, + 21, g_bytes + 110), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[12].base, + 13, g_bytes + 131), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[13].base, + 14, g_bytes + 144), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14].base, + 12, g_bytes + 158), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15].base, + 16, g_bytes + 170), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, + 15, g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[17].base, + 30, g_bytes + 201), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[18].base, + 37, g_bytes + 231), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[19].base, + 10, g_bytes + 268), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[20].base, + 4, g_bytes + 278), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[21].base, + 26, g_bytes + 282), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[22].base, + 22, g_bytes + 308), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[23].base, + 12, g_bytes + 330), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[24].base, + 1, g_bytes + 342), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[25].base, + 1, g_bytes + 343), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[26].base, + 1, g_bytes + 344), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[27].base, + 1, g_bytes + 345), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[29].base, + 19, g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[30].base, + 12, g_bytes + 365), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[31].base, + 30, g_bytes + 377), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[32].base, + 31, g_bytes + 407), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[33].base, + 36, g_bytes + 438), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[34].base, + 28, g_bytes + 474), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[35].base, + 80, g_bytes + 502), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36].base, + 7, g_bytes + 582), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, + 4, g_bytes + 589), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, + 11, g_bytes + 593), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, + 3, g_bytes + 604), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40].base, + 4, g_bytes + 607), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41].base, + 1, g_bytes + 611), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42].base, + 11, g_bytes + 612), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43].base, + 4, g_bytes + 623), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44].base, + 5, g_bytes + 627), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45].base, + 3, g_bytes + 632), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46].base, + 3, g_bytes + 635), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47].base, + 3, g_bytes + 638), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48].base, + 3, g_bytes + 641), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49].base, + 3, g_bytes + 644), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50].base, + 3, g_bytes + 647), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51].base, + 3, g_bytes + 650), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52].base, + 14, g_bytes + 653), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53].base, + 13, g_bytes + 667), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54].base, + 15, g_bytes + 680), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55].base, + 13, g_bytes + 695), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56].base, + 6, g_bytes + 708), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57].base, + 27, g_bytes + 714), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58].base, + 3, g_bytes + 741), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59].base, + 5, g_bytes + 744), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60].base, + 13, g_bytes + 749), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61].base, + 13, g_bytes + 762), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62].base, + 19, g_bytes + 775), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63].base, + 16, g_bytes + 794), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64].base, + 14, g_bytes + 810), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65].base, + 16, g_bytes + 824), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66].base, + 13, g_bytes + 840), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67].base, + 6, g_bytes + 853), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68].base, + 4, g_bytes + 859), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69].base, + 4, g_bytes + 863), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70].base, + 6, g_bytes + 867), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71].base, + 7, g_bytes + 873), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72].base, + 4, g_bytes + 880), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73].base, + 8, g_bytes + 884), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74].base, + 17, g_bytes + 892), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75].base, + 13, g_bytes + 909), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76].base, + 8, g_bytes + 922), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77].base, + 19, g_bytes + 930), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78].base, + 13, g_bytes + 949), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79].base, + 4, g_bytes + 962), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80].base, + 8, g_bytes + 966), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81].base, + 12, g_bytes + 974), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82].base, + 18, g_bytes + 986), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83].base, + 19, g_bytes + 1004), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84].base, + 5, g_bytes + 1023), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85].base, + 7, g_bytes + 1028), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86].base, + 7, g_bytes + 1035), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87].base, + 11, g_bytes + 1042), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88].base, + 6, g_bytes + 1053), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89].base, + 10, g_bytes + 1059), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90].base, + 25, g_bytes + 1069), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91].base, + 17, g_bytes + 1094), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92].base, + 4, g_bytes + 1111), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93].base, + 3, g_bytes + 1115), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94].base, + 16, g_bytes + 1118), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95].base, + 1, g_bytes + 1134), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, + 8, g_bytes + 1135), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, + 8, g_bytes + 1143), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, + 16, g_bytes + 1151), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99].base, + 4, g_bytes + 1167), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[100].base, 3, g_bytes + 1171), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[101].base, 11, g_bytes + 1174), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[102].base, 16, g_bytes + 1185), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[103].base, 13, g_bytes + 1201), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[104].base, 12, g_bytes + 1214), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[105].base, 21, g_bytes + 1226), }; /* Warning: the core static metadata currently operates under the soft @@ -937,514 +938,514 @@ grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b) { grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[3], 10, - g_bytes + 19), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[3].base, + 10, g_bytes + 19), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 0), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1], 7, - g_bytes + 5), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39], 3, - g_bytes + 604), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, + 7, g_bytes + 5), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, + 3, g_bytes + 604), 1), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1], 7, - g_bytes + 5), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40], 4, - g_bytes + 607), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, + 7, g_bytes + 5), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40].base, + 4, g_bytes + 607), 2), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0], 5, - g_bytes + 0), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41], 1, - g_bytes + 611), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0].base, + 5, g_bytes + 0), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41].base, + 1, g_bytes + 611), 3), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0], 5, - g_bytes + 0), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42], 11, - g_bytes + 612), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0].base, + 5, g_bytes + 0), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42].base, + 11, g_bytes + 612), 4), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4], 7, - g_bytes + 29), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43], 4, - g_bytes + 623), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, + 7, g_bytes + 29), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43].base, + 4, g_bytes + 623), 5), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4], 7, - g_bytes + 29), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44], 5, - g_bytes + 627), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, + 7, g_bytes + 29), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44].base, + 5, g_bytes + 627), 6), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, - g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45], 3, - g_bytes + 632), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, + 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45].base, + 3, g_bytes + 632), 7), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, - g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46], 3, - g_bytes + 635), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, + 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46].base, + 3, g_bytes + 635), 8), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, - g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47], 3, - g_bytes + 638), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, + 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47].base, + 3, g_bytes + 638), 9), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, - g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48], 3, - g_bytes + 641), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, + 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48].base, + 3, g_bytes + 641), 10), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, - g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49], 3, - g_bytes + 644), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, + 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49].base, + 3, g_bytes + 644), 11), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, - g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50], 3, - g_bytes + 647), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, + 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50].base, + 3, g_bytes + 647), 12), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, - g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51], 3, - g_bytes + 650), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, + 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51].base, + 3, g_bytes + 650), 13), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52], 14, - g_bytes + 653), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52].base, + 14, g_bytes + 653), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 14), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, - g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53], 13, - g_bytes + 667), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, + 15, g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53].base, + 13, g_bytes + 667), 15), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54], 15, - g_bytes + 680), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54].base, + 15, g_bytes + 680), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 16), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55], 13, - g_bytes + 695), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55].base, + 13, g_bytes + 695), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 17), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56], 6, - g_bytes + 708), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56].base, + 6, g_bytes + 708), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 18), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57], 27, - g_bytes + 714), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57].base, + 27, g_bytes + 714), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 19), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58], 3, - g_bytes + 741), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58].base, + 3, g_bytes + 741), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 20), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59], 5, - g_bytes + 744), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59].base, + 5, g_bytes + 744), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 21), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60], 13, - g_bytes + 749), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60].base, + 13, g_bytes + 749), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 22), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61], 13, - g_bytes + 762), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61].base, + 13, g_bytes + 762), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 23), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62], 19, - g_bytes + 775), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62].base, + 19, g_bytes + 775), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 24), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15], 16, - g_bytes + 170), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15].base, + 16, g_bytes + 170), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 25), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63], 16, - g_bytes + 794), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63].base, + 16, g_bytes + 794), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 26), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64], 14, - g_bytes + 810), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64].base, + 14, g_bytes + 810), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 27), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65], 16, - g_bytes + 824), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65].base, + 16, g_bytes + 824), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 28), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66], 13, - g_bytes + 840), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66].base, + 13, g_bytes + 840), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 29), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14], 12, - g_bytes + 158), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14].base, + 12, g_bytes + 158), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 30), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67], 6, - g_bytes + 853), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67].base, + 6, g_bytes + 853), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 31), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68], 4, - g_bytes + 859), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68].base, + 4, g_bytes + 859), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 32), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69], 4, - g_bytes + 863), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69].base, + 4, g_bytes + 863), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 33), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70], 6, - g_bytes + 867), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70].base, + 6, g_bytes + 867), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 34), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71], 7, - g_bytes + 873), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71].base, + 7, g_bytes + 873), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 35), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72], 4, - g_bytes + 880), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72].base, + 4, g_bytes + 880), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 36), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[20], 4, - g_bytes + 278), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[20].base, + 4, g_bytes + 278), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 37), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73], 8, - g_bytes + 884), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73].base, + 8, g_bytes + 884), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 38), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74], 17, - g_bytes + 892), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74].base, + 17, g_bytes + 892), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 39), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75], 13, - g_bytes + 909), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75].base, + 13, g_bytes + 909), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 40), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76], 8, - g_bytes + 922), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76].base, + 8, g_bytes + 922), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 41), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77], 19, - g_bytes + 930), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77].base, + 19, g_bytes + 930), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 42), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78], 13, - g_bytes + 949), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78].base, + 13, g_bytes + 949), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 43), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79], 4, - g_bytes + 962), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79].base, + 4, g_bytes + 962), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 44), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80], 8, - g_bytes + 966), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80].base, + 8, g_bytes + 966), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 45), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81], 12, - g_bytes + 974), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81].base, + 12, g_bytes + 974), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 46), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82], 18, - g_bytes + 986), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82].base, + 18, g_bytes + 986), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 47), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83], 19, - g_bytes + 1004), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83].base, + 19, g_bytes + 1004), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 48), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84], 5, - g_bytes + 1023), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84].base, + 5, g_bytes + 1023), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 49), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85], 7, - g_bytes + 1028), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85].base, + 7, g_bytes + 1028), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 50), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86], 7, - g_bytes + 1035), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86].base, + 7, g_bytes + 1035), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 51), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87], 11, - g_bytes + 1042), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87].base, + 11, g_bytes + 1042), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 52), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88], 6, - g_bytes + 1053), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88].base, + 6, g_bytes + 1053), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 53), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89], 10, - g_bytes + 1059), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89].base, + 10, g_bytes + 1059), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 54), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90], 25, - g_bytes + 1069), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90].base, + 25, g_bytes + 1069), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 55), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91], 17, - g_bytes + 1094), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91].base, + 17, g_bytes + 1094), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 56), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[19], 10, - g_bytes + 268), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[19].base, + 10, g_bytes + 268), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 57), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92], 4, - g_bytes + 1111), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92].base, + 4, g_bytes + 1111), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 58), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93], 3, - g_bytes + 1115), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93].base, + 3, g_bytes + 1115), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 59), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94], 16, - g_bytes + 1118), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94].base, + 16, g_bytes + 1118), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 60), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7], 11, - g_bytes + 50), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95], 1, - g_bytes + 1134), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7].base, + 11, g_bytes + 50), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95].base, + 1, g_bytes + 1134), 61), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7], 11, - g_bytes + 50), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[24], 1, - g_bytes + 342), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7].base, + 11, g_bytes + 50), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[24].base, + 1, g_bytes + 342), 62), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7], 11, - g_bytes + 50), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[25], 1, - g_bytes + 343), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7].base, + 11, g_bytes + 50), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[25].base, + 1, g_bytes + 343), 63), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9], 13, - g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, - g_bytes + 1135), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, + 13, g_bytes + 77), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, + 8, g_bytes + 1135), 64), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9], 13, - g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, - g_bytes + 589), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, + 13, g_bytes + 77), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, + 4, g_bytes + 589), 65), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9], 13, - g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36], 7, - g_bytes + 582), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, + 13, g_bytes + 77), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36].base, + 7, g_bytes + 582), 66), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[5], 2, - g_bytes + 36), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97], 8, - g_bytes + 1143), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[5].base, + 2, g_bytes + 36), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, + 8, g_bytes + 1143), 67), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14], 12, - g_bytes + 158), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98], 16, - g_bytes + 1151), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14].base, + 12, g_bytes + 158), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, + 16, g_bytes + 1151), 68), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4], 7, - g_bytes + 29), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99], 4, - g_bytes + 1167), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, + 7, g_bytes + 29), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99].base, + 4, g_bytes + 1167), 69), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1], 7, - g_bytes + 5), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[100], 3, - g_bytes + 1171), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, + 7, g_bytes + 5), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[100].base, 3, g_bytes + 1171), 70), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, - g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, + 15, g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 71), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15], 16, - g_bytes + 170), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, - g_bytes + 1135), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15].base, + 16, g_bytes + 170), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, + 8, g_bytes + 1135), 72), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15], 16, - g_bytes + 170), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, - g_bytes + 589), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15].base, + 16, g_bytes + 170), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, + 4, g_bytes + 589), 73), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[101], 11, - g_bytes + 1174), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, - g_bytes + 346), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[101].base, 11, g_bytes + 1174), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, + 0, g_bytes + 346), 74), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, - g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, - g_bytes + 1135), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, + 20, g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, + 8, g_bytes + 1135), 75), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, - g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36], 7, - g_bytes + 582), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, + 20, g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36].base, + 7, g_bytes + 582), 76), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, - g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[102], 16, - g_bytes + 1185), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, + 20, g_bytes + 90), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[102].base, 16, g_bytes + 1185), 77), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, - g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, - g_bytes + 589), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, + 20, g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, + 4, g_bytes + 589), 78), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, - g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[103], 13, - g_bytes + 1201), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, + 20, g_bytes + 90), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[103].base, 13, g_bytes + 1201), 79), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, - g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[104], 12, - g_bytes + 1214), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, + 20, g_bytes + 90), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[104].base, 12, g_bytes + 1214), 80), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, - g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[105], 21, - g_bytes + 1226), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, + 20, g_bytes + 90), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[105].base, 21, g_bytes + 1226), 81), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, - g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, - g_bytes + 1135), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, + 15, g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, + 8, g_bytes + 1135), 82), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, - g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, - g_bytes + 589), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, + 15, g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, + 4, g_bytes + 589), 83), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, - g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[103], 13, - g_bytes + 1201), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, + 15, g_bytes + 186), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[103].base, 13, g_bytes + 1201), 84), }; const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 75, 76, 77, diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index 7c05b27cc07..30082985b5c 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -260,15 +260,18 @@ extern const grpc_core::StaticMetadataSlice #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ (grpc_static_slice_table[105]) -extern grpc_slice_refcount +namespace grpc_core { +struct StaticSliceRefcount; +} +extern grpc_core::StaticSliceRefcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT]; #define GRPC_IS_STATIC_METADATA_STRING(slice) \ ((slice).refcount != NULL && \ (slice).refcount->GetType() == grpc_slice_refcount::Type::STATIC) -#define GRPC_STATIC_METADATA_INDEX(static_slice) \ - (static_cast( \ - ((static_slice).refcount - grpc_static_metadata_refcounts))) +#define GRPC_STATIC_METADATA_INDEX(static_slice) \ + (reinterpret_cast((static_slice).refcount) \ + ->index) #define GRPC_STATIC_MDELEM_COUNT 85 extern grpc_core::StaticMetadata @@ -519,11 +522,14 @@ typedef union { } named; } grpc_metadata_batch_callouts; -#define GRPC_BATCH_INDEX_OF(slice) \ - (GRPC_IS_STATIC_METADATA_STRING((slice)) \ - ? static_cast( \ - GPR_CLAMP(GRPC_STATIC_METADATA_INDEX((slice)), 0, \ - static_cast(GRPC_BATCH_CALLOUTS_COUNT))) \ +#define GRPC_BATCH_INDEX_OF(slice) \ + (GRPC_IS_STATIC_METADATA_STRING((slice)) && \ + reinterpret_cast((slice).refcount) \ + ->index <= static_cast(GRPC_BATCH_CALLOUTS_COUNT) \ + ? static_cast( \ + reinterpret_cast( \ + (slice).refcount) \ + ->index) \ : GRPC_BATCH_CALLOUTS_COUNT) extern const uint8_t grpc_static_accept_encoding_metadata[8]; diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index 213efd22346..fd1d9cbfb49 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -393,7 +393,7 @@ for i, elem in enumerate(all_strs): def slice_def(i): return ( - 'grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[%d], %d, g_bytes+%d)' + 'grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[%d].base, %d, g_bytes+%d)' ) % (i, len(all_strs[i]), id2strofs[i]) @@ -416,14 +416,14 @@ print >> H print >> C, 'static uint8_t g_bytes[] = {%s};' % (','.join( '%d' % ord(c) for c in ''.join(all_strs))) print >> C -print >> C, ('static grpc_slice_refcount static_sub_refcnt;') -print >> H, ('extern grpc_slice_refcount ' +print >> H, ('namespace grpc_core { struct StaticSliceRefcount; }') +print >> H, ('extern grpc_core::StaticSliceRefcount ' 'grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT];') -print >> C, ('grpc_slice_refcount ' +print >> C, 'grpc_slice_refcount grpc_core::StaticSliceRefcount::kStaticSubRefcount;' +print >> C, ('grpc_core::StaticSliceRefcount ' 'grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = {') for i, elem in enumerate(all_strs): - print >> C, (' grpc_slice_refcount(&static_sub_refcnt, ' - 'grpc_slice_refcount::Type::STATIC), ') + print >> C, ' grpc_core::StaticSliceRefcount(%d), ' % i print >> C, '};' print >> C print >> H, '#define GRPC_IS_STATIC_METADATA_STRING(slice) \\' @@ -438,8 +438,7 @@ for i, elem in enumerate(all_strs): print >> C, '};' print >> C print >> H, '#define GRPC_STATIC_METADATA_INDEX(static_slice) \\' -print >> H, (' (static_cast(((static_slice).refcount - ' - 'grpc_static_metadata_refcounts)))') +print >> H, '(reinterpret_cast((static_slice).refcount)->index)' print >> H print >> D, '# hpack fuzzing dictionary' @@ -598,8 +597,26 @@ for elem in METADATA_BATCH_CALLOUTS: print >> H, ' } named;' print >> H, '} grpc_metadata_batch_callouts;' print >> H -print >> H, '#define GRPC_BATCH_INDEX_OF(slice) \\' -print >> H, ' (GRPC_IS_STATIC_METADATA_STRING((slice)) ? static_cast(GPR_CLAMP(GRPC_STATIC_METADATA_INDEX((slice)), 0, static_cast(GRPC_BATCH_CALLOUTS_COUNT))) : GRPC_BATCH_CALLOUTS_COUNT)' + +batch_idx_of_hdr = '#define GRPC_BATCH_INDEX_OF(slice) \\' +static_slice = 'GRPC_IS_STATIC_METADATA_STRING((slice))' +slice_to_slice_ref = '(slice).refcount' +static_slice_ref_type = 'grpc_core::StaticSliceRefcount*' +slice_ref_as_static = ('reinterpret_cast<' + static_slice_ref_type + '>(' + + slice_to_slice_ref + ')') +slice_ref_idx = slice_ref_as_static + '->index' +batch_idx_type = 'grpc_metadata_batch_callouts_index' +slice_ref_idx_to_batch_idx = ( + 'static_cast<' + batch_idx_type + '>(' + slice_ref_idx + ')') +batch_invalid_idx = 'GRPC_BATCH_CALLOUTS_COUNT' +batch_invalid_u32 = 'static_cast(' + batch_invalid_idx + ')' +# Assemble GRPC_BATCH_INDEX_OF(slice) macro as a join for ease of reading. +batch_idx_of_pieces = [ + batch_idx_of_hdr, '\n', '(', static_slice, '&&', slice_ref_idx, '<=', + batch_invalid_u32, '?', slice_ref_idx_to_batch_idx, ':', batch_invalid_idx, + ')' +] +print >> H, ''.join(batch_idx_of_pieces) print >> H print >> H, 'extern const uint8_t grpc_static_accept_encoding_metadata[%d];' % ( From 732f55ac2288d74e988043a62b50b7493c31c5aa Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Thu, 1 Aug 2019 15:01:11 -0700 Subject: [PATCH 155/661] iOS UI test: fix path to generated code --- src/objective-c/manual_tests/ViewController.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/objective-c/manual_tests/ViewController.m b/src/objective-c/manual_tests/ViewController.m index 50a729e4d6a..30181c9d67e 100644 --- a/src/objective-c/manual_tests/ViewController.m +++ b/src/objective-c/manual_tests/ViewController.m @@ -20,8 +20,8 @@ #import #import -#import -#import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" NSString *const kRemoteHost = @"grpc-test.sandbox.googleapis.com"; const int32_t kMessageSize = 100; From e9d81fb0f22691f69c6b42d1967eb3ba440de194 Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Thu, 1 Aug 2019 13:33:50 -0700 Subject: [PATCH 156/661] Send RPC deadline to server in cronet header --- .../cronet/transport/cronet_transport.cc | 31 ++++++++++++++----- .../ios/CronetTests/CppCronetEnd2EndTests.mm | 26 ++++++++++++++++ 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc index 28e6c04869e..19477bf9485 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.cc +++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc @@ -40,6 +40,7 @@ #include "src/core/lib/surface/validate_metadata.h" #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/static_metadata.h" +#include "src/core/lib/transport/timeout_encoding.h" #include "src/core/lib/transport/transport_impl.h" #include "third_party/objective_c/Cronet/bidirectional_stream_c.h" @@ -718,16 +719,20 @@ static void create_grpc_frame(grpc_slice_buffer* write_slice_buffer, Convert metadata in a format that Cronet can consume */ static void convert_metadata_to_cronet_headers( - grpc_linked_mdelem* head, const char* host, char** pp_url, + grpc_metadata_batch* metadata, const char* host, char** pp_url, bidirectional_stream_header** pp_headers, size_t* p_num_headers, const char** method) { - grpc_linked_mdelem* curr = head; + grpc_linked_mdelem* curr = metadata->list.head; /* Walk the linked list and get number of header fields */ size_t num_headers_available = 0; while (curr != nullptr) { curr = curr->next; num_headers_available++; } + grpc_millis deadline = metadata->deadline; + if (deadline != GRPC_MILLIS_INF_FUTURE) { + num_headers_available++; + } /* Allocate enough memory. It is freed in the on_stream_ready callback */ bidirectional_stream_header* headers = @@ -740,7 +745,7 @@ static void convert_metadata_to_cronet_headers( are not used for cronet. TODO (makdharma): Eliminate need to traverse the LL second time for perf. */ - curr = head; + curr = metadata->list.head; size_t num_headers = 0; while (num_headers < num_headers_available) { grpc_mdelem mdelem = curr->md; @@ -788,6 +793,18 @@ static void convert_metadata_to_cronet_headers( break; } } + if (deadline != GRPC_MILLIS_INF_FUTURE) { + char* key = grpc_slice_to_c_string(GRPC_MDSTR_GRPC_TIMEOUT); + char* value = + static_cast(gpr_malloc(GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE)); + grpc_http2_encode_timeout(deadline - grpc_core::ExecCtx::Get()->Now(), + value); + headers[num_headers].key = key; + headers[num_headers].value = value; + + num_headers++; + } + *p_num_headers = num_headers; } @@ -1028,10 +1045,10 @@ static enum e_op_result execute_stream_op(struct op_and_state* oas) { char* url = nullptr; const char* method = "POST"; s->header_array.headers = nullptr; - convert_metadata_to_cronet_headers(stream_op->payload->send_initial_metadata - .send_initial_metadata->list.head, - t->host, &url, &s->header_array.headers, - &s->header_array.count, &method); + convert_metadata_to_cronet_headers( + stream_op->payload->send_initial_metadata.send_initial_metadata, + t->host, &url, &s->header_array.headers, &s->header_array.count, + &method); s->header_array.capacity = s->header_array.count; CRONET_LOG(GPR_DEBUG, "bidirectional_stream_start(%p, %s)", s->cbs, url); bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, false); diff --git a/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm b/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm index 07b514f6c65..c6c3e3f345b 100644 --- a/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm +++ b/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm @@ -536,6 +536,32 @@ using grpc::ClientContext; XCTAssertEqual(response.param().request_deadline(), gpr_inf_future(GPR_CLOCK_REALTIME).tv_sec); } +- (void)testEchoDeadline { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + request.mutable_param()->set_echo_deadline(true); + + ClientContext context; + std::chrono::system_clock::time_point deadline = + std::chrono::system_clock::now() + std::chrono::seconds(100); + context.set_deadline(deadline); + Status s = stub->Echo(&context, request, &response); + XCTAssertEqual(response.message(), request.message()); + XCTAssertTrue(s.ok()); + gpr_timespec sent_deadline; + grpc::Timepoint2Timespec(deadline, &sent_deadline); + // We want to allow some reasonable error given: + // - request_deadline() only has 1sec resolution so the best we can do is +-1 + // - if sent_deadline.tv_nsec is very close to the next second's boundary we + // can end up being off by 2 in one direction. + XCTAssertLessThanOrEqual(response.param().request_deadline() - sent_deadline.tv_sec, 2); + XCTAssertGreaterThanOrEqual(response.param().request_deadline() - sent_deadline.tv_sec, -1); + NSLog(@"request deadline: %d sent_deadline: %d", response.param().request_deadline(), + sent_deadline.tv_sec); +} + - (void)testPeer { auto stub = [self getStub]; EchoRequest request; From 7b2c8c27b06f92b7d3594ec4f2863e5d759f1760 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 16 Jul 2019 15:20:56 -0700 Subject: [PATCH 157/661] Separate py_grpc_library and py_proto_library. By popular demand, we'll now be offering separate py_grpc_library and py_proto_library targets sharing the same interface as within google3. This change necessitated some modifications to how we pull in our own Python-level dependencies and how we make those available to those pulling in our project via Bazel. There is now a grpc_python_deps() Bazel workspace rule that pulls in the appropriate dependencies, which should be called from the client project's WORKSPACE file. A test has been added to the bazel/test/ directory to verify that this behavior works as intended. It's worth noting that the protobuf repository's usage of Starlark bind() caused a great deal of trouble in ensuring that we could also pull in six. This change also required a change in the way generated proto code is imported in the channelz and health-check modules, as well as in their associated tests. We were importing them two different ways, each relative. This resulted in two different module objects being imported into the process, which were incompatible. I am not sure exactly what caused this behavior to begin, as this should have been possible before this PR. As a workaround, I am simply trying two different absolute imports and using the one that works. This should function both inside and outside of Bazel environments. --- WORKSPACE | 43 ++-- bazel/grpc_python_deps.bzl | 69 +++++- bazel/python_rules.bzl | 218 ++++++++++-------- bazel/test/python_test_repo/.gitignore | 2 + bazel/test/python_test_repo/BUILD | 46 ++++ bazel/test/python_test_repo/WORKSPACE | 10 + bazel/test/python_test_repo/helloworld.proto | 43 ++++ bazel/test/python_test_repo/helloworld.py | 73 ++++++ bazel/test/python_test_repo/tools/bazel | 1 + examples/BUILD | 16 +- examples/python/multiprocessing/BUILD | 18 +- examples/python/wait_for_ready/BUILD.bazel | 3 +- src/proto/grpc/channelz/BUILD | 10 +- src/proto/grpc/testing/BUILD | 31 ++- src/proto/grpc/testing/proto2/BUILD.bazel | 8 +- src/python/grpcio/grpc/BUILD.bazel | 6 +- .../grpcio/grpc/experimental/BUILD.bazel | 1 - .../grpcio/grpc/framework/common/BUILD.bazel | 5 +- .../grpc/framework/foundation/BUILD.bazel | 11 +- .../framework/interfaces/base/BUILD.bazel | 7 +- .../framework/interfaces/face/BUILD.bazel | 5 +- .../grpc_channelz/v1/BUILD.bazel | 16 +- .../grpc_channelz/v1/channelz.py | 8 +- .../grpc_health/v1/BUILD.bazel | 15 +- .../grpc_health/v1/health.py | 9 +- .../grpc_reflection/v1alpha/BUILD.bazel | 17 +- .../grpc_reflection/v1alpha/reflection.py | 8 +- .../grpcio_status/grpc_status/BUILD.bazel | 2 +- .../tests/channelz/_channelz_servicer_test.py | 11 +- .../health_check/_health_servicer_test.py | 15 +- .../grpcio_tests/tests/interop/BUILD.bazel | 7 +- .../grpcio_tests/tests/reflection/BUILD.bazel | 2 +- .../reflection/_reflection_servicer_test.py | 11 +- .../grpcio_tests/tests/unit/BUILD.bazel | 4 +- third_party/BUILD | 3 + third_party/enum34.BUILD | 6 + third_party/futures.BUILD | 6 + third_party/six.BUILD | 6 + .../linux/grpc_python_bazel_test_in_docker.sh | 3 + 39 files changed, 571 insertions(+), 204 deletions(-) create mode 100644 bazel/test/python_test_repo/.gitignore create mode 100644 bazel/test/python_test_repo/BUILD create mode 100644 bazel/test/python_test_repo/WORKSPACE create mode 100644 bazel/test/python_test_repo/helloworld.proto create mode 100644 bazel/test/python_test_repo/helloworld.py create mode 120000 bazel/test/python_test_repo/tools/bazel create mode 100644 third_party/enum34.BUILD create mode 100644 third_party/futures.BUILD create mode 100644 third_party/six.BUILD diff --git a/WORKSPACE b/WORKSPACE index 60582d1a0f5..a9a8cfbba1b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -18,33 +18,6 @@ register_toolchains( "//third_party/toolchains/bazel_0.23.2_rbe_windows:cc-toolchain-x64_windows", ) -git_repository( - name = "io_bazel_rules_python", - commit = "fdbb17a4118a1728d19e638a5291b4c4266ea5b8", - remote = "https://github.com/bazelbuild/rules_python.git", -) - -load("@io_bazel_rules_python//python:pip.bzl", "pip_repositories", "pip_import") - -pip_import( - name = "grpc_python_dependencies", - requirements = "//:requirements.bazel.txt", -) - -http_archive( - name = "cython", - build_file = "//third_party:cython.BUILD", - sha256 = "d68138a2381afbdd0876c3cb2a22389043fa01c4badede1228ee073032b07a27", - strip_prefix = "cython-c2b80d87658a8525ce091cbe146cb7eaa29fed5c", - urls = [ - "https://github.com/cython/cython/archive/c2b80d87658a8525ce091cbe146cb7eaa29fed5c.tar.gz", - ], -) - -load("//bazel:grpc_python_deps.bzl", "grpc_python_deps") - -grpc_python_deps() - load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig") # Create toolchain configuration for remote execution. @@ -65,3 +38,19 @@ rbe_autoconfig( }, ), ) + +load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps") +grpc_python_deps() + + +load("@io_bazel_rules_python//python:pip.bzl", "pip_repositories", "pip_import") + +pip_import( + name = "grpc_python_dependencies", + requirements = "@com_github_grpc_grpc//:requirements.bazel.txt", +) + +load("@io_bazel_rules_python//python:pip.bzl", "pip_repositories") +load("@grpc_python_dependencies//:requirements.bzl", "pip_install") +pip_repositories() +pip_install() diff --git a/bazel/grpc_python_deps.bzl b/bazel/grpc_python_deps.bzl index 91438f3927b..4e7cc1537fa 100644 --- a/bazel/grpc_python_deps.bzl +++ b/bazel/grpc_python_deps.bzl @@ -1,8 +1,67 @@ -load("//third_party/py:python_configure.bzl", "python_configure") -load("@io_bazel_rules_python//python:pip.bzl", "pip_repositories") -load("@grpc_python_dependencies//:requirements.bzl", "pip_install") +"""Load dependencies needed to compile and test the grpc python library as a 3rd-party consumer.""" + +load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@com_github_grpc_grpc//third_party/py:python_configure.bzl", "python_configure") def grpc_python_deps(): + native.bind( + name = "six", + actual = "@six_archive//:six", + ) + + # protobuf binds to the name "six", so we can't use it here. + # See https://github.com/bazelbuild/bazel/issues/1952 for why bind is + # horrible. + if "six_archive" not in native.existing_rules(): + http_archive( + name = "six_archive", + strip_prefix = "six-1.12.0", + build_file = "@com_github_grpc_grpc//third_party:six.BUILD", + sha256 = "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73", + urls = ["https://files.pythonhosted.org/packages/dd/bf/4138e7bfb757de47d1f4b6994648ec67a51efe58fa907c1e11e350cddfca/six-1.12.0.tar.gz"], + ) + + if "enum34" not in native.existing_rules(): + http_archive( + name = "enum34", + build_file = "@com_github_grpc_grpc//third_party:enum34.BUILD", + strip_prefix = "enum34-1.1.6", + sha256 = "8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1", + urls = ["https://files.pythonhosted.org/packages/bf/3e/31d502c25302814a7c2f1d3959d2a3b3f78e509002ba91aea64993936876/enum34-1.1.6.tar.gz"], + ) + + if "futures" not in native.existing_rules(): + http_archive( + name = "futures", + build_file = "@com_github_grpc_grpc//third_party:futures.BUILD", + strip_prefix = "futures-3.3.0", + sha256 = "7e033af76a5e35f58e56da7a91e687706faf4e7bdfb2cbc3f2cca6b9bcda9794", + urls = ["https://files.pythonhosted.org/packages/47/04/5fc6c74ad114032cd2c544c575bffc17582295e9cd6a851d6026ab4b2c00/futures-3.3.0.tar.gz"], + ) + + if "io_bazel_rules_python" not in native.existing_rules(): + git_repository( + name = "io_bazel_rules_python", + commit = "fdbb17a4118a1728d19e638a5291b4c4266ea5b8", + remote = "https://github.com/bazelbuild/rules_python.git", + ) + python_configure(name = "local_config_python") - pip_repositories() - pip_install() + + native.bind( + name = "python_headers", + actual = "@local_config_python//:python_headers", + ) + + if "cython" not in native.existing_rules(): + http_archive( + name = "cython", + build_file = "@com_github_grpc_grpc//third_party:cython.BUILD", + sha256 = "d68138a2381afbdd0876c3cb2a22389043fa01c4badede1228ee073032b07a27", + strip_prefix = "cython-c2b80d87658a8525ce091cbe146cb7eaa29fed5c", + urls = [ + "https://github.com/cython/cython/archive/c2b80d87658a8525ce091cbe146cb7eaa29fed5c.tar.gz", + ], + ) + diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl index 14550852a4a..eb4ac9c9721 100644 --- a/bazel/python_rules.bzl +++ b/bazel/python_rules.bzl @@ -1,6 +1,5 @@ """Generates and compiles Python gRPC stubs from proto_library rules.""" -load("@grpc_python_dependencies//:requirements.bzl", "requirement") load( "//bazel:protobuf.bzl", "get_include_protoc_args", @@ -36,56 +35,33 @@ def _generate_py_impl(context): for file in src[ProtoInfo].transitive_imports.to_list() ] proto_root = get_proto_root(context.label.workspace_root) - format_str = (_GENERATED_GRPC_PROTO_FORMAT if context.executable.plugin else _GENERATED_PROTO_FORMAT) out_files = [ context.actions.declare_file( proto_path_to_generated_filename( proto.basename, - format_str, + _GENERATED_PROTO_FORMAT, ), ) for proto in protos ] - arguments = [] tools = [context.executable._protoc] - if context.executable.plugin: - arguments += get_plugin_args( - context.executable.plugin, - context.attr.flags, + arguments = ([ + "--python_out={}".format( context.genfiles_dir.path, - False, - ) - tools += [context.executable.plugin] - else: - arguments += [ - "--python_out={}:{}".format( - ",".join(context.attr.flags), - context.genfiles_dir.path, - ), - ] - - arguments += get_include_protoc_args(includes) - arguments += [ + ), + ] + get_include_protoc_args(includes) + [ "--proto_path={}".format(context.genfiles_dir.path) for proto in protos - ] + ]) for proto in protos: massaged_path = proto.path if massaged_path.startswith(context.genfiles_dir.path): massaged_path = proto.path[len(context.genfiles_dir.path) + 1:] arguments.append(massaged_path) - well_known_proto_files = [] - if context.attr.well_known_protos: - well_known_proto_directory = context.attr.well_known_protos.files.to_list( - )[0].dirname - - arguments += ["-I{}".format(well_known_proto_directory + "/../..")] - well_known_proto_files = context.attr.well_known_protos.files.to_list() - context.actions.run( - inputs = protos + includes + well_known_proto_files, + inputs = protos + includes, tools = tools, outputs = out_files, executable = context.executable._protoc, @@ -94,93 +70,155 @@ def _generate_py_impl(context): ) return struct(files = depset(out_files)) -__generate_py = rule( +_generate_pb2_src = rule( attrs = { "deps": attr.label_list( mandatory = True, allow_empty = False, providers = [ProtoInfo], ), - "plugin": attr.label( - executable = True, - providers = ["files_to_run"], - cfg = "host", - ), - "flags": attr.string_list( - mandatory = False, - allow_empty = True, - ), - "well_known_protos": attr.label(mandatory = False), "_protoc": attr.label( default = Label("//external:protocol_compiler"), + providers = ["files_to_run"], executable = True, cfg = "host", ), }, - output_to_genfiles = True, implementation = _generate_py_impl, ) -def _generate_py(well_known_protos, **kwargs): - if well_known_protos: - __generate_py( - well_known_protos = "@com_google_protobuf//:well_known_protos", - **kwargs - ) - else: - __generate_py(**kwargs) - def py_proto_library( name, - deps, - well_known_protos = True, - proto_only = False, + srcs, **kwargs): """Generate python code for a protobuf. Args: name: The name of the target. - deps: A list of dependencies. Must contain a single element. - well_known_protos: A bool indicating whether or not to include well-known - protos. - proto_only: A bool indicating whether to generate vanilla protobuf code - or to also generate gRPC code. + srcs: A list of proto_library dependencies. Must contain a single element. """ - if len(deps) > 1: - fail("The supported length of 'deps' is 1.") - codegen_target = "_{}_codegen".format(name) - codegen_grpc_target = "_{}_grpc_codegen".format(name) + if len(srcs) > 1: + fail("Can only compile a single proto at a time.") - _generate_py( + + _generate_pb2_src( name = codegen_target, - deps = deps, - well_known_protos = well_known_protos, + deps = srcs, **kwargs ) - if not proto_only: - _generate_py( - name = codegen_grpc_target, - deps = deps, - plugin = "//src/compiler:grpc_python_plugin", - well_known_protos = well_known_protos, - **kwargs - ) + native.py_library( + name = name, + srcs = [":{}".format(codegen_target)], + deps = ["@com_google_protobuf//:protobuf_python"], + **kwargs + ) - native.py_library( - name = name, - srcs = [ - ":{}".format(codegen_grpc_target), - ":{}".format(codegen_target), - ], - deps = [requirement("protobuf")], - **kwargs - ) - else: - native.py_library( - name = name, - srcs = [":{}".format(codegen_target), ":{}".format(codegen_target)], - deps = [requirement("protobuf")], - **kwargs +def _generate_pb2_grpc_src_impl(context): + protos = [] + for src in context.attr.deps: + for file in src[ProtoInfo].direct_sources: + protos.append(_get_staged_proto_file(context, file)) + includes = [ + file + for src in context.attr.deps + for file in src[ProtoInfo].transitive_imports.to_list() + ] + proto_root = get_proto_root(context.label.workspace_root) + out_files = [ + context.actions.declare_file( + proto_path_to_generated_filename( + proto.basename, + _GENERATED_GRPC_PROTO_FORMAT, + ), ) + for proto in protos + ] + + arguments = [] + tools = [context.executable._protoc, context.executable._plugin] + arguments += get_plugin_args( + context.executable._plugin, + [], + context.genfiles_dir.path, + False, + ) + + arguments += get_include_protoc_args(includes) + arguments += [ + "--proto_path={}".format(context.genfiles_dir.path) + for proto in protos + ] + for proto in protos: + massaged_path = proto.path + if massaged_path.startswith(context.genfiles_dir.path): + massaged_path = proto.path[len(context.genfiles_dir.path) + 1:] + arguments.append(massaged_path) + + context.actions.run( + inputs = protos + includes, + tools = tools, + outputs = out_files, + executable = context.executable._protoc, + arguments = arguments, + mnemonic = "ProtocInvocation", + ) + return struct(files = depset(out_files)) + + +_generate_pb2_grpc_src = rule( + attrs = { + "deps": attr.label_list( + mandatory = True, + allow_empty = False, + providers = [ProtoInfo], + ), + "_plugin": attr.label( + executable = True, + providers = ["files_to_run"], + cfg = "host", + default = Label("//src/compiler:grpc_python_plugin"), + ), + "_protoc": attr.label( + executable = True, + providers = ["files_to_run"], + cfg = "host", + default = Label("//external:protocol_compiler"), + ), + }, + implementation = _generate_pb2_grpc_src_impl, +) + +def py_grpc_library( + name, + srcs, + deps, + **kwargs): + """Generate python code for gRPC services defined in a protobuf. + + Args: + name: The name of the target. + srcs: (List of `labels`) a single proto_library target containing the + schema of the service. + deps: (List of `labels`) a single py_proto_library target for the + proto_library in `srcs`. + """ + codegen_grpc_target = "_{}_grpc_codegen".format(name) + if len(srcs) > 1: + fail("Can only compile a single proto at a time.") + + _generate_pb2_grpc_src( + name = codegen_grpc_target, + deps = srcs, + **kwargs + ) + + native.py_library( + name = name, + srcs = [ + ":{}".format(codegen_grpc_target), + ], + deps = [Label("//src/python/grpcio/grpc:grpcio")] + deps, + **kwargs + ) diff --git a/bazel/test/python_test_repo/.gitignore b/bazel/test/python_test_repo/.gitignore new file mode 100644 index 00000000000..7146a250705 --- /dev/null +++ b/bazel/test/python_test_repo/.gitignore @@ -0,0 +1,2 @@ +bazel-* +tools/bazel-* diff --git a/bazel/test/python_test_repo/BUILD b/bazel/test/python_test_repo/BUILD new file mode 100644 index 00000000000..ed4ffd3b74f --- /dev/null +++ b/bazel/test/python_test_repo/BUILD @@ -0,0 +1,46 @@ +load("@com_github_grpc_grpc//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library") + +package(default_testonly = 1) + +proto_library( + name = "helloworld_proto", + srcs = ["helloworld.proto"], + deps = [ + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:timestamp_proto", + ], +) + +py_proto_library( + name = "helloworld_py_pb2", + srcs = [":helloworld_proto"], +) + +py_grpc_library( + name = "helloworld_py_pb2_grpc", + srcs = [":helloworld_proto"], + deps = [":helloworld_py_pb2"], +) + +py_proto_library( + name = "duration_py_pb2", + srcs = ["@com_google_protobuf//:duration_proto"], +) + +py_proto_library( + name = "timestamp_py_pb2", + srcs = ["@com_google_protobuf//:timestamp_proto"], +) + +py_test( + name = "import_test", + main = "helloworld.py", + srcs = ["helloworld.py"], + deps = [ + ":helloworld_py_pb2", + ":helloworld_py_pb2_grpc", + ":duration_py_pb2", + ":timestamp_py_pb2", + ], + python_version = "PY3", +) diff --git a/bazel/test/python_test_repo/WORKSPACE b/bazel/test/python_test_repo/WORKSPACE new file mode 100644 index 00000000000..69d34ac933c --- /dev/null +++ b/bazel/test/python_test_repo/WORKSPACE @@ -0,0 +1,10 @@ +local_repository( + name = "com_github_grpc_grpc", + path = "../../..", +) + +load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") +grpc_deps() + +load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps") +grpc_python_deps() diff --git a/bazel/test/python_test_repo/helloworld.proto b/bazel/test/python_test_repo/helloworld.proto new file mode 100644 index 00000000000..b333a7409b8 --- /dev/null +++ b/bazel/test/python_test_repo/helloworld.proto @@ -0,0 +1,43 @@ +// Copyright 2019 The gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +option java_multiple_files = true; +option java_package = "io.grpc.examples.helloworld"; +option java_outer_classname = "HelloWorldProto"; +option objc_class_prefix = "HLW"; + +package helloworld; + +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; + +// The greeting service definition. +service Greeter { + // Sends a greeting + rpc SayHello (HelloRequest) returns (HelloReply) {} +} + +// The request message containing the user's name. +message HelloRequest { + string name = 1; + google.protobuf.Timestamp request_initiation = 2; +} + +// The response message containing the greetings +message HelloReply { + string message = 1; + google.protobuf.Duration request_duration = 2; +} diff --git a/bazel/test/python_test_repo/helloworld.py b/bazel/test/python_test_repo/helloworld.py new file mode 100644 index 00000000000..deee36a8f71 --- /dev/null +++ b/bazel/test/python_test_repo/helloworld.py @@ -0,0 +1,73 @@ +# Copyright 2019 the gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""The Python implementation of the GRPC helloworld.Greeter client.""" + +import contextlib +import datetime +import logging +import unittest + +import grpc + +import duration_pb2 +import helloworld_pb2 +import helloworld_pb2_grpc + +_HOST = 'localhost' +_SERVER_ADDRESS = '{}:0'.format(_HOST) + + +class Greeter(helloworld_pb2_grpc.GreeterServicer): + + def SayHello(self, request, context): + request_in_flight = datetime.now() - request.request_initation.ToDatetime() + request_duration = duration_pb2.Duration() + request_duration.FromTimedelta(request_in_flight) + return helloworld_pb2.HelloReply( + message='Hello, %s!' % request.name, + request_duration=request_duration, + ) + + +@contextlib.contextmanager +def _listening_server(): + server = grpc.server(futures.ThreadPoolExecutor()) + helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server) + port = server.add_insecure_port(_SERVER_ADDRESS) + server.start() + try: + yield port + finally: + server.stop(0) + + +class ImportTest(unittest.TestCase): + def run(): + with _listening_server() as port: + with grpc.insecure_channel('{}:{}'.format(_HOST, port)) as channel: + stub = helloworld_pb2_grpc.GreeterStub(channel) + request_timestamp = timestamp_pb2.Timestamp() + request_timestamp.GetCurrentTime() + response = stub.SayHello(helloworld_pb2.HelloRequest( + name='you', + request_initiation=request_timestamp, + ), + wait_for_ready=True) + self.assertEqual(response.message, "Hello, you!") + self.assertGreater(response.request_duration.microseconds, 0) + + +if __name__ == '__main__': + logging.basicConfig() + unittest.main() diff --git a/bazel/test/python_test_repo/tools/bazel b/bazel/test/python_test_repo/tools/bazel new file mode 120000 index 00000000000..ad4a1267bcd --- /dev/null +++ b/bazel/test/python_test_repo/tools/bazel @@ -0,0 +1 @@ +../../../../tools/bazel \ No newline at end of file diff --git a/examples/BUILD b/examples/BUILD index a9dd94902a4..b3c5d0a825c 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -18,7 +18,8 @@ package(default_visibility = ["//visibility:public"]) load("//bazel:grpc_build_system.bzl", "grpc_proto_library") load("//bazel:cc_grpc_library.bzl", "cc_grpc_library") -load("//bazel:python_rules.bzl", "py_proto_library") +load("//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library") +load("@grpc_python_dependencies//:requirements.bzl", "requirement") grpc_proto_library( name = "auth_sample", @@ -60,13 +61,20 @@ grpc_proto_library( ) proto_library( - name = "helloworld_proto_descriptor", + name = "protos/helloworld_proto", srcs = ["protos/helloworld.proto"], ) py_proto_library( - name = "py_helloworld", - deps = [":helloworld_proto_descriptor"], + name = "helloworld_py_pb2", + srcs = [":protos/helloworld_proto"], + deps = [requirement('protobuf')], +) + +py_grpc_library( + name = "helloworld_py_pb2_grpc", + srcs = [":protos/helloworld_proto"], + deps = [":helloworld_py_pb2"], ) cc_binary( diff --git a/examples/python/multiprocessing/BUILD b/examples/python/multiprocessing/BUILD index f9fa6598068..257523f14bb 100644 --- a/examples/python/multiprocessing/BUILD +++ b/examples/python/multiprocessing/BUILD @@ -14,8 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@grpc_python_dependencies//:requirements.bzl", "requirement") -load("//bazel:python_rules.bzl", "py_proto_library") +load("//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library") proto_library( name = "prime_proto", @@ -24,8 +23,13 @@ proto_library( py_proto_library( name = "prime_proto_pb2", - deps = [":prime_proto"], - well_known_protos = False, + srcs = [":prime_proto"], +) + +py_grpc_library( + name = "prime_proto_pb2_grpc", + srcs = [":prime_proto"], + deps = [":prime_proto_pb2"], ) py_binary( @@ -35,6 +39,7 @@ py_binary( deps = [ "//src/python/grpcio/grpc:grpcio", ":prime_proto_pb2", + ":prime_proto_pb2_grpc", ], srcs_version = "PY3", ) @@ -45,9 +50,10 @@ py_binary( srcs = ["server.py"], deps = [ "//src/python/grpcio/grpc:grpcio", - ":prime_proto_pb2" + ":prime_proto_pb2", + ":prime_proto_pb2_grpc", ] + select({ - "//conditions:default": [requirement("futures")], + "//conditions:default": ["@futures//:futures"], "//:python3": [], }), srcs_version = "PY3", diff --git a/examples/python/wait_for_ready/BUILD.bazel b/examples/python/wait_for_ready/BUILD.bazel index 70daf83d334..f074ae7bb7f 100644 --- a/examples/python/wait_for_ready/BUILD.bazel +++ b/examples/python/wait_for_ready/BUILD.bazel @@ -20,7 +20,8 @@ py_library( srcs = ["wait_for_ready_example.py"], deps = [ "//src/python/grpcio/grpc:grpcio", - "//examples:py_helloworld", + "//examples:helloworld_py_pb2", + "//examples:helloworld_py_pb2_grpc", ], ) diff --git a/src/proto/grpc/channelz/BUILD b/src/proto/grpc/channelz/BUILD index 1d80ec23af1..5d1ec5a60cb 100644 --- a/src/proto/grpc/channelz/BUILD +++ b/src/proto/grpc/channelz/BUILD @@ -27,7 +27,15 @@ grpc_proto_library( proto_library( name = "channelz_proto_descriptors", - srcs = ["channelz.proto"], + srcs = [ + "channelz.proto", + ], + deps = [ + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:timestamp_proto", + "@com_google_protobuf//:wrappers_proto", + ], ) filegroup( diff --git a/src/proto/grpc/testing/BUILD b/src/proto/grpc/testing/BUILD index 212f0f3cca7..15be8227de1 100644 --- a/src/proto/grpc/testing/BUILD +++ b/src/proto/grpc/testing/BUILD @@ -16,7 +16,7 @@ licenses(["notice"]) # Apache v2 load("//bazel:grpc_build_system.bzl", "grpc_proto_library", "grpc_package") load("@grpc_python_dependencies//:requirements.bzl", "requirement") -load("//bazel:python_rules.bzl", "py_proto_library") +load("//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library") grpc_package( name = "testing", @@ -75,8 +75,14 @@ proto_library( ) py_proto_library( - name = "py_empty_proto", - deps = [":empty_proto_descriptor"], + name = "empty_py_pb2", + srcs = [":empty_proto_descriptor"], +) + +py_grpc_library( + name = "empty_py_pb2_grpc", + srcs = [":empty_proto_descriptor"], + deps = [":empty_py_pb2"], ) grpc_proto_library( @@ -92,7 +98,13 @@ proto_library( py_proto_library( name = "py_messages_proto", - deps = [":messages_proto_descriptor"], + srcs = [":messages_proto_descriptor"], +) + +py_grpc_library( + name = "messages_py_pb2_grpc", + srcs = [":messages_proto_descriptor"], + deps = [":py_messages_proto"], ) grpc_proto_library( @@ -196,7 +208,12 @@ proto_library( py_proto_library( name = "py_test_proto", - deps = [ - ":test_proto_descriptor", - ], + srcs = [":test_proto_descriptor"], +) + +py_grpc_library( + name = "test_py_pb2_grpc", + srcs = [":test_proto_descriptor"], + deps = [":py_test_proto"], ) + diff --git a/src/proto/grpc/testing/proto2/BUILD.bazel b/src/proto/grpc/testing/proto2/BUILD.bazel index e939c523a64..668d0a484ea 100644 --- a/src/proto/grpc/testing/proto2/BUILD.bazel +++ b/src/proto/grpc/testing/proto2/BUILD.bazel @@ -10,9 +10,7 @@ proto_library( py_proto_library( name = "empty2_proto", - deps = [ - ":empty2_proto_descriptor", - ], + srcs = [":empty2_proto_descriptor"], ) proto_library( @@ -25,8 +23,6 @@ proto_library( py_proto_library( name = "empty2_extensions_proto", - deps = [ - ":empty2_extensions_proto_descriptor", - ], + srcs = [":empty2_extensions_proto_descriptor"], ) diff --git a/src/python/grpcio/grpc/BUILD.bazel b/src/python/grpcio/grpc/BUILD.bazel index a2bedae4bea..1b5a018249a 100644 --- a/src/python/grpcio/grpc/BUILD.bazel +++ b/src/python/grpcio/grpc/BUILD.bazel @@ -1,5 +1,3 @@ -load("@grpc_python_dependencies//:requirements.bzl", "requirement") - package(default_visibility = ["//visibility:public"]) py_library( @@ -16,9 +14,9 @@ py_library( "//src/python/grpcio/grpc/_cython:cygrpc", "//src/python/grpcio/grpc/experimental", "//src/python/grpcio/grpc/framework", - requirement('six'), + "@six_archive//:six", ] + select({ - "//conditions:default": [requirement('enum34'),], + "//conditions:default": ["@enum34//:enum34",], "//:python3": [], }), data = [ diff --git a/src/python/grpcio/grpc/experimental/BUILD.bazel b/src/python/grpcio/grpc/experimental/BUILD.bazel index 6598d02747b..cd8afe533b6 100644 --- a/src/python/grpcio/grpc/experimental/BUILD.bazel +++ b/src/python/grpcio/grpc/experimental/BUILD.bazel @@ -1,4 +1,3 @@ -load("@grpc_python_dependencies//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) py_library( diff --git a/src/python/grpcio/grpc/framework/common/BUILD.bazel b/src/python/grpcio/grpc/framework/common/BUILD.bazel index 52fbb2b516c..c0d1486d537 100644 --- a/src/python/grpcio/grpc/framework/common/BUILD.bazel +++ b/src/python/grpcio/grpc/framework/common/BUILD.bazel @@ -1,4 +1,3 @@ -load("@grpc_python_dependencies//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) py_library( @@ -14,7 +13,7 @@ py_library( name = "cardinality", srcs = ["cardinality.py"], deps = select({ - "//conditions:default": [requirement('enum34'),], + "//conditions:default": ["@enum34//:enum34",], "//:python3": [], }), ) @@ -23,7 +22,7 @@ py_library( name = "style", srcs = ["style.py"], deps = select({ - "//conditions:default": [requirement('enum34'),], + "//conditions:default": ["@enum34//:enum34",], "//:python3": [], }), ) diff --git a/src/python/grpcio/grpc/framework/foundation/BUILD.bazel b/src/python/grpcio/grpc/framework/foundation/BUILD.bazel index a447ecded49..b539fa46da7 100644 --- a/src/python/grpcio/grpc/framework/foundation/BUILD.bazel +++ b/src/python/grpcio/grpc/framework/foundation/BUILD.bazel @@ -1,4 +1,3 @@ -load("@grpc_python_dependencies//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) py_library( @@ -23,9 +22,9 @@ py_library( name = "callable_util", srcs = ["callable_util.py"], deps = [ - requirement("six"), + "//external:six", ] + select({ - "//conditions:default": [requirement('enum34'),], + "//conditions:default": ["@enum34//:enum34",], "//:python3": [], }), ) @@ -34,7 +33,7 @@ py_library( name = "future", srcs = ["future.py"], deps = [ - requirement("six"), + "//external:six", ], ) @@ -42,7 +41,7 @@ py_library( name = "logging_pool", srcs = ["logging_pool.py"], deps = select({ - "//conditions:default": [requirement('futures'),], + "//conditions:default": ["@futures//:futures",], "//:python3": [], }), ) @@ -59,6 +58,6 @@ py_library( name = "stream", srcs = ["stream.py"], deps = [ - requirement("six"), + "//external:six", ], ) diff --git a/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel b/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel index 35cfe877f34..5d0c06950a8 100644 --- a/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel +++ b/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel @@ -1,4 +1,3 @@ -load("@grpc_python_dependencies//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) py_library( @@ -15,9 +14,9 @@ py_library( srcs = ["base.py"], deps = [ "//src/python/grpcio/grpc/framework/foundation:abandonment", - requirement("six"), + "//external:six", ] + select({ - "//conditions:default": [requirement('enum34'),], + "//conditions:default": ["@enum34//:enum34",], "//:python3": [], }), ) @@ -26,7 +25,7 @@ py_library( name = "utilities", srcs = ["utilities.py"], deps = select({ - "//conditions:default": [requirement('enum34'),], + "//conditions:default": ["@enum34//:enum34",], "//:python3": [], }), ) diff --git a/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel b/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel index 83fadb6372e..3af1404eade 100644 --- a/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel +++ b/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel @@ -1,4 +1,3 @@ -load("@grpc_python_dependencies//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) py_library( @@ -16,9 +15,9 @@ py_library( deps = [ "//src/python/grpcio/grpc/framework/foundation", "//src/python/grpcio/grpc/framework/common", - requirement("six"), + "//external:six", ] + select({ - "//conditions:default": [requirement('enum34'),], + "//conditions:default": ["@enum34//:enum34",], "//:python3": [], }), ) diff --git a/src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel b/src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel index eccc166577d..c0a7e3d3026 100644 --- a/src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel +++ b/src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel @@ -1,17 +1,23 @@ -load("//bazel:python_rules.bzl", "py_proto_library") +load("//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library") package(default_visibility = ["//visibility:public"]) py_proto_library( - name = "py_channelz_proto", - well_known_protos = True, - deps = ["//src/proto/grpc/channelz:channelz_proto_descriptors"], + name = "channelz_py_pb2", + srcs = ["//src/proto/grpc/channelz:channelz_proto_descriptors"], +) + +py_grpc_library( + name = "channelz_py_pb2_grpc", + srcs = ["//src/proto/grpc/channelz:channelz_proto_descriptors"], + deps = [":channelz_py_pb2"], ) py_library( name = "grpc_channelz", srcs = ["channelz.py",], deps = [ - ":py_channelz_proto", + ":channelz_py_pb2", + ":channelz_py_pb2_grpc", "//src/python/grpcio/grpc:grpcio", ], imports=["../../",], diff --git a/src/python/grpcio_channelz/grpc_channelz/v1/channelz.py b/src/python/grpcio_channelz/grpc_channelz/v1/channelz.py index 00eca311dc1..18810cab290 100644 --- a/src/python/grpcio_channelz/grpc_channelz/v1/channelz.py +++ b/src/python/grpcio_channelz/grpc_channelz/v1/channelz.py @@ -16,8 +16,12 @@ import grpc from grpc._cython import cygrpc -import grpc_channelz.v1.channelz_pb2 as _channelz_pb2 -import grpc_channelz.v1.channelz_pb2_grpc as _channelz_pb2_grpc +try: + from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2 as _channelz_pb2 + from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2_grpc as _channelz_pb2_grpc +except ImportError: + import grpc_channelz.v1.channelz_pb2 as _channelz_pb2 + import grpc_channelz.v1.channelz_pb2_grpc as _channelz_pb2_grpc from google.protobuf import json_format diff --git a/src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel b/src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel index 9e4fff34581..0ee176f0506 100644 --- a/src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel +++ b/src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel @@ -1,16 +1,23 @@ -load("//bazel:python_rules.bzl", "py_proto_library") +load("//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library") package(default_visibility = ["//visibility:public"]) py_proto_library( - name = "py_health_proto", - deps = ["//src/proto/grpc/health/v1:health_proto_descriptor",], + name = "health_py_pb2", + srcs = ["//src/proto/grpc/health/v1:health_proto_descriptor",], +) + +py_grpc_library( + name = "health_py_pb2_grpc", + srcs = ["//src/proto/grpc/health/v1:health_proto_descriptor",], + deps = [":health_py_pb2"], ) py_library( name = "grpc_health", srcs = ["health.py",], deps = [ - ":py_health_proto", + ":health_py_pb2", + ":health_py_pb2_grpc", "//src/python/grpcio/grpc:grpcio", ], imports=["../../",], diff --git a/src/python/grpcio_health_checking/grpc_health/v1/health.py b/src/python/grpcio_health_checking/grpc_health/v1/health.py index 15494fafdbc..93c1895df4c 100644 --- a/src/python/grpcio_health_checking/grpc_health/v1/health.py +++ b/src/python/grpcio_health_checking/grpc_health/v1/health.py @@ -18,8 +18,13 @@ import threading import grpc -from grpc_health.v1 import health_pb2 as _health_pb2 -from grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc +# Import using an absolute path to ensure no duplicate loaded modules. +try: + from src.python.grpcio_health_checking.grpc_health.v1 import health_pb2 as _health_pb2 + from src.python.grpcio_health_checking.grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc +except ImportError: + from grpc_health.v1 import health_pb2 as _health_pb2 + from grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc SERVICE_NAME = _health_pb2.DESCRIPTOR.services_by_name['Health'].full_name diff --git a/src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel b/src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel index 6aaa4dd3bdd..49bc517caf1 100644 --- a/src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel +++ b/src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel @@ -1,20 +1,27 @@ -load("//bazel:python_rules.bzl", "py_proto_library") +load("//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library") load("@grpc_python_dependencies//:requirements.bzl", "requirement") package(default_visibility = ["//visibility:public"]) py_proto_library( - name = "py_reflection_proto", - deps = ["//src/proto/grpc/reflection/v1alpha:reflection_proto_descriptor",], + name = "reflection_py_pb2", + srcs = ["//src/proto/grpc/reflection/v1alpha:reflection_proto_descriptor",], +) + +py_grpc_library( + name = "reflection_py_pb2_grpc", + srcs = ["//src/proto/grpc/reflection/v1alpha:reflection_proto_descriptor",], + deps = ["reflection_py_pb2"], ) py_library( name = "grpc_reflection", srcs = ["reflection.py",], deps = [ - ":py_reflection_proto", + ":reflection_py_pb2", + ":reflection_py_pb2_grpc", "//src/python/grpcio/grpc:grpcio", - requirement('protobuf'), + "@com_google_protobuf//:protobuf_python", ], imports=["../../",], ) diff --git a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py index 6df1a364269..70c506c1c7d 100644 --- a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py +++ b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py @@ -17,8 +17,12 @@ import grpc from google.protobuf import descriptor_pb2 from google.protobuf import descriptor_pool -from grpc_reflection.v1alpha import reflection_pb2 as _reflection_pb2 -from grpc_reflection.v1alpha import reflection_pb2_grpc as _reflection_pb2_grpc +try: + from src.python.grpcio_reflection.grpc_reflection.v1alpha import reflection_pb2 as _reflection_pb2 + from src.python.grpcio_reflection.grpc_reflection.v1alpha import reflection_pb2_grpc as _reflection_pb2_grpc +except ImportError: + from grpc_reflection.v1alpha import reflection_pb2 as _reflection_pb2 + from grpc_reflection.v1alpha import reflection_pb2_grpc as _reflection_pb2_grpc _POOL = descriptor_pool.Default() SERVICE_NAME = _reflection_pb2.DESCRIPTOR.services_by_name[ diff --git a/src/python/grpcio_status/grpc_status/BUILD.bazel b/src/python/grpcio_status/grpc_status/BUILD.bazel index 223a077c3f2..a7d47c9f34e 100644 --- a/src/python/grpcio_status/grpc_status/BUILD.bazel +++ b/src/python/grpcio_status/grpc_status/BUILD.bazel @@ -7,7 +7,7 @@ py_library( srcs = ["rpc_status.py",], deps = [ "//src/python/grpcio/grpc:grpcio", - requirement('protobuf'), + "@com_google_protobuf//:protobuf_python", requirement('googleapis-common-protos'), ], imports=["../",], diff --git a/src/python/grpcio_tests/tests/channelz/_channelz_servicer_test.py b/src/python/grpcio_tests/tests/channelz/_channelz_servicer_test.py index 5265911a0be..bfe184107ec 100644 --- a/src/python/grpcio_tests/tests/channelz/_channelz_servicer_test.py +++ b/src/python/grpcio_tests/tests/channelz/_channelz_servicer_test.py @@ -18,9 +18,14 @@ import unittest from concurrent import futures import grpc -from grpc_channelz.v1 import channelz -from grpc_channelz.v1 import channelz_pb2 -from grpc_channelz.v1 import channelz_pb2_grpc +try: + from src.python.grpcio_channelz.grpc_channelz.v1 import channelz + from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2 + from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2_grpc +except ImportError: + from grpc_channelz.v1 import channelz + from grpc_channelz.v1 import channelz_pb2 + from grpc_channelz.v1 import channelz_pb2_grpc from tests.unit import test_common from tests.unit.framework.common import test_constants diff --git a/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py b/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py index 7a332b8390f..91e841a4d60 100644 --- a/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py +++ b/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py @@ -13,14 +13,22 @@ # limitations under the License. """Tests of grpc_health.v1.health.""" +import logging import threading import time import unittest import grpc -from grpc_health.v1 import health -from grpc_health.v1 import health_pb2 -from grpc_health.v1 import health_pb2_grpc + +# Import using an absolute path to ensure no duplicate loaded modules. +try: + from src.python.grpcio_health_checking.grpc_health.v1 import health + from src.python.grpcio_health_checking.grpc_health.v1 import health_pb2 + from src.python.grpcio_health_checking.grpc_health.v1 import health_pb2_grpc +except ImportError: + from grpc_health.v1 import health + from grpc_health.v1 import health_pb2 + from grpc_health.v1 import health_pb2_grpc from tests.unit import test_common from tests.unit import thread_pool @@ -276,4 +284,5 @@ class HealthServicerBackwardsCompatibleWatchTest(BaseWatchTests.WatchTests): if __name__ == '__main__': + logging.basicConfig() unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/interop/BUILD.bazel b/src/python/grpcio_tests/tests/interop/BUILD.bazel index fd636556074..43fdc7ab462 100644 --- a/src/python/grpcio_tests/tests/interop/BUILD.bazel +++ b/src/python/grpcio_tests/tests/interop/BUILD.bazel @@ -31,9 +31,12 @@ py_library( deps = [ "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_tests/tests:bazel_namespace_package_hack", - "//src/proto/grpc/testing:py_empty_proto", + "//src/proto/grpc/testing:empty_py_pb2", + "//src/proto/grpc/testing:empty_py_pb2_grpc", "//src/proto/grpc/testing:py_messages_proto", + "//src/proto/grpc/testing:messages_py_pb2_grpc", "//src/proto/grpc/testing:py_test_proto", + "//src/proto/grpc/testing:test_py_pb2_grpc", requirement("google-auth"), requirement("requests"), requirement("urllib3"), @@ -59,7 +62,7 @@ py_library( srcs = ["service.py"], imports = ["../../"], deps = [ - "//src/proto/grpc/testing:py_empty_proto", + "//src/proto/grpc/testing:empty_py_pb2", "//src/proto/grpc/testing:py_messages_proto", "//src/proto/grpc/testing:py_test_proto", "//src/python/grpcio/grpc:grpcio", diff --git a/src/python/grpcio_tests/tests/reflection/BUILD.bazel b/src/python/grpcio_tests/tests/reflection/BUILD.bazel index b635b721631..e9b56191df8 100644 --- a/src/python/grpcio_tests/tests/reflection/BUILD.bazel +++ b/src/python/grpcio_tests/tests/reflection/BUILD.bazel @@ -12,7 +12,7 @@ py_test( "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_reflection/grpc_reflection/v1alpha:grpc_reflection", "//src/python/grpcio_tests/tests/unit:test_common", - "//src/proto/grpc/testing:py_empty_proto", + "//src/proto/grpc/testing:empty_py_pb2", "//src/proto/grpc/testing/proto2:empty2_extensions_proto", "//src/proto/grpc/testing/proto2:empty2_proto", requirement('protobuf'), diff --git a/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py b/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py index 29bb292c913..1a1fdc83163 100644 --- a/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py +++ b/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py @@ -16,9 +16,14 @@ import unittest import grpc -from grpc_reflection.v1alpha import reflection -from grpc_reflection.v1alpha import reflection_pb2 -from grpc_reflection.v1alpha import reflection_pb2_grpc +try: + from src.python.grpcio_reflection.grpc_reflection.v1alpha import reflection + from src.python.grpcio_reflection.grpc_reflection.v1alpha import reflection_pb2 + from src.python.grpcio_reflection.grpc_reflection.v1alpha import reflection_pb2_grpc +except ImportError: + from grpc_reflection.v1alpha import reflection + from grpc_reflection.v1alpha import reflection_pb2 + from grpc_reflection.v1alpha import reflection_pb2_grpc from google.protobuf import descriptor_pool from google.protobuf import descriptor_pb2 diff --git a/src/python/grpcio_tests/tests/unit/BUILD.bazel b/src/python/grpcio_tests/tests/unit/BUILD.bazel index a161794f8be..cf4350a6beb 100644 --- a/src/python/grpcio_tests/tests/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/BUILD.bazel @@ -1,5 +1,3 @@ -load("@grpc_python_dependencies//:requirements.bzl", "requirement") - package(default_visibility = ["//visibility:public"]) GRPCIO_TESTS_UNIT = [ @@ -89,7 +87,7 @@ py_library( ":_tcp_proxy", "//src/python/grpcio_tests/tests/unit/framework/common", "//src/python/grpcio_tests/tests/testing", - requirement('six'), + "//external:six" ], imports=["../../",], data=[ diff --git a/third_party/BUILD b/third_party/BUILD index 8b43d6b8300..cd4a6dad72b 100644 --- a/third_party/BUILD +++ b/third_party/BUILD @@ -8,4 +8,7 @@ exports_files([ "zope_interface.BUILD", "constantly.BUILD", "cython.BUILD", + "six.BUILD", + "enum34.BUILD", + "futures.BUILD", ]) diff --git a/third_party/enum34.BUILD b/third_party/enum34.BUILD new file mode 100644 index 00000000000..3fc2b3de571 --- /dev/null +++ b/third_party/enum34.BUILD @@ -0,0 +1,6 @@ +py_library( + name = "enum34", + srcs = ["enum/__init__.py"], + srcs_version = "PY2AND3", + visibility = ["//visibility:public"], +) diff --git a/third_party/futures.BUILD b/third_party/futures.BUILD new file mode 100644 index 00000000000..c280e1edfd7 --- /dev/null +++ b/third_party/futures.BUILD @@ -0,0 +1,6 @@ +py_library( + name = "futures", + srcs = glob(["concurrent/**/*.py"]), + srcs_version = "PY2AND3", + visibility = ["//visibility:public"], +) diff --git a/third_party/six.BUILD b/third_party/six.BUILD new file mode 100644 index 00000000000..60dc7811492 --- /dev/null +++ b/third_party/six.BUILD @@ -0,0 +1,6 @@ +py_library( + name = "six", + srcs = ["six.py"], + srcs_version = "PY2AND3", + visibility = ["//visibility:public"], +) diff --git a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh index d844cff7f9a..f33fd0f4f55 100755 --- a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh +++ b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh @@ -29,3 +29,6 @@ bazel test --spawn_strategy=standalone --genrule_strategy=standalone --test_outp bazel clean --expunge bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //src/python/... bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //examples/python/... +(cd bazel/test/python_test_repo; + bazel test --test_output=errors //... +) From 2b7ec3ad2300266c05a50786486003eb5afba9c7 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 1 Aug 2019 16:09:25 -0700 Subject: [PATCH 158/661] Fix up examples. --- examples/BUILD | 1 - examples/python/auth/BUILD.bazel | 9 +++++---- examples/python/compression/BUILD.bazel | 6 ++++-- examples/python/debug/BUILD.bazel | 11 +++++++---- examples/python/debug/get_stats.py | 9 +++++++-- examples/python/errors/BUILD.bazel | 6 ++++-- 6 files changed, 27 insertions(+), 15 deletions(-) diff --git a/examples/BUILD b/examples/BUILD index b3c5d0a825c..aa9ed945849 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -68,7 +68,6 @@ proto_library( py_proto_library( name = "helloworld_py_pb2", srcs = [":protos/helloworld_proto"], - deps = [requirement('protobuf')], ) py_grpc_library( diff --git a/examples/python/auth/BUILD.bazel b/examples/python/auth/BUILD.bazel index 7bb4203f93f..cc454fdfdfe 100644 --- a/examples/python/auth/BUILD.bazel +++ b/examples/python/auth/BUILD.bazel @@ -36,7 +36,8 @@ py_binary( deps = [ ":_credentials", "//src/python/grpcio/grpc:grpcio", - "//examples:py_helloworld", + "//examples:helloworld_py_pb2", + "//examples:helloworld_py_pb2_grpc", ], ) @@ -47,8 +48,8 @@ py_binary( deps = [ ":_credentials", "//src/python/grpcio/grpc:grpcio", - "//examples:py_helloworld", - + "//examples:helloworld_py_pb2", + "//examples:helloworld_py_pb2_grpc", ], ) @@ -57,7 +58,7 @@ py_test( srcs = ["test/_auth_example_test.py"], deps = [ "//src/python/grpcio/grpc:grpcio", - "//examples:py_helloworld", + "//examples:helloworld_py_pb2", ":customized_auth_client", ":customized_auth_server", ":_credentials", diff --git a/examples/python/compression/BUILD.bazel b/examples/python/compression/BUILD.bazel index b95d7cccc77..9d5f6bb83ed 100644 --- a/examples/python/compression/BUILD.bazel +++ b/examples/python/compression/BUILD.bazel @@ -17,7 +17,8 @@ py_binary( srcs = ["server.py"], deps = [ "//src/python/grpcio/grpc:grpcio", - "//examples:py_helloworld", + "//examples:helloworld_py_pb2", + "//examples:helloworld_py_pb2_grpc", ], srcs_version = "PY2AND3", ) @@ -27,7 +28,8 @@ py_binary( srcs = ["client.py"], deps = [ "//src/python/grpcio/grpc:grpcio", - "//examples:py_helloworld", + "//examples:helloworld_py_pb2", + "//examples:helloworld_py_pb2_grpc", ], srcs_version = "PY2AND3", ) diff --git a/examples/python/debug/BUILD.bazel b/examples/python/debug/BUILD.bazel index 0134d8675ed..657ae860ae3 100644 --- a/examples/python/debug/BUILD.bazel +++ b/examples/python/debug/BUILD.bazel @@ -21,7 +21,8 @@ py_binary( deps = [ "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_channelz/grpc_channelz/v1:grpc_channelz", - "//examples:py_helloworld", + "//examples:helloworld_py_pb2", + "//examples:helloworld_py_pb2_grpc", ], ) @@ -31,7 +32,8 @@ py_binary( srcs = ["send_message.py"], deps = [ "//src/python/grpcio/grpc:grpcio", - "//examples:py_helloworld", + "//examples:helloworld_py_pb2", + "//examples:helloworld_py_pb2_grpc", ], ) @@ -51,9 +53,10 @@ py_test( deps = [ "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_channelz/grpc_channelz/v1:grpc_channelz", - "//examples:py_helloworld", + "//examples:helloworld_py_pb2", + "//examples:helloworld_py_pb2_grpc", ":debug_server", ":send_message", ":get_stats", ], -) \ No newline at end of file +) diff --git a/examples/python/debug/get_stats.py b/examples/python/debug/get_stats.py index d0b7061c54f..6eb593deb22 100644 --- a/examples/python/debug/get_stats.py +++ b/examples/python/debug/get_stats.py @@ -20,8 +20,13 @@ from __future__ import print_function import logging import argparse import grpc -from grpc_channelz.v1 import channelz_pb2 -from grpc_channelz.v1 import channelz_pb2_grpc + +try: + from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2 + from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2_grpc +except ImportError: + from grpc_channelz.v1 import channelz_pb2 + from grpc_channelz.v1 import channelz_pb2_grpc def run(addr): diff --git a/examples/python/errors/BUILD.bazel b/examples/python/errors/BUILD.bazel index b07dd12ebd3..4b779ddfcf1 100644 --- a/examples/python/errors/BUILD.bazel +++ b/examples/python/errors/BUILD.bazel @@ -21,7 +21,8 @@ py_library( deps = [ "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_status/grpc_status:grpc_status", - "//examples:py_helloworld", + "//examples:helloworld_py_pb2", + "//examples:helloworld_py_pb2_grpc", requirement('googleapis-common-protos'), ], ) @@ -33,7 +34,8 @@ py_library( deps = [ "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_status/grpc_status:grpc_status", - "//examples:py_helloworld", + "//examples:helloworld_py_pb2", + "//examples:helloworld_py_pb2_grpc", ] + select({ "//conditions:default": [requirement("futures")], "//:python3": [], From e64961d658d9e0de870ce37fed7154d35d57f5c1 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 1 Aug 2019 16:22:02 -0700 Subject: [PATCH 159/661] Shorten long lines. --- .../grpcio_reflection/grpc_reflection/v1alpha/reflection.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py index 70c506c1c7d..bc76136cc5a 100644 --- a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py +++ b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py @@ -18,8 +18,10 @@ from google.protobuf import descriptor_pb2 from google.protobuf import descriptor_pool try: - from src.python.grpcio_reflection.grpc_reflection.v1alpha import reflection_pb2 as _reflection_pb2 - from src.python.grpcio_reflection.grpc_reflection.v1alpha import reflection_pb2_grpc as _reflection_pb2_grpc + from src.python.grpcio_reflection.grpc_reflection.v1alpha \ + import reflection_pb2 as _reflection_pb2 + from src.python.grpcio_reflection.grpc_reflection.v1alpha \ + import reflection_pb2_grpc as _reflection_pb2_grpc except ImportError: from grpc_reflection.v1alpha import reflection_pb2 as _reflection_pb2 from grpc_reflection.v1alpha import reflection_pb2_grpc as _reflection_pb2_grpc From 01ec8299457e8deeda68439c6012846d5cca645e Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 1 Aug 2019 16:25:11 -0700 Subject: [PATCH 160/661] Mark private methods of DelegatingChannel final (other than WaitForStateChangeImpl and NotifyOnStateChangeImpl) --- include/grpcpp/impl/codegen/delegating_channel.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/grpcpp/impl/codegen/delegating_channel.h b/include/grpcpp/impl/codegen/delegating_channel.h index eb2802c68c9..a18622235f9 100644 --- a/include/grpcpp/impl/codegen/delegating_channel.h +++ b/include/grpcpp/impl/codegen/delegating_channel.h @@ -40,16 +40,16 @@ class DelegatingChannel : public ::grpc::ChannelInterface { private: internal::Call CreateCall(const internal::RpcMethod& method, ClientContext* context, - ::grpc_impl::CompletionQueue* cq) override { + ::grpc_impl::CompletionQueue* cq) final { return delegate_channel()->CreateCall(method, context, cq); } void PerformOpsOnCall(internal::CallOpSetInterface* ops, - internal::Call* call) override { + internal::Call* call) final { delegate_channel()->PerformOpsOnCall(ops, call); } - void* RegisterMethod(const char* method) override { + void* RegisterMethod(const char* method) final { return delegate_channel()->RegisterMethod(method); } @@ -69,12 +69,12 @@ class DelegatingChannel : public ::grpc::ChannelInterface { internal::Call CreateCallInternal(const internal::RpcMethod& method, ClientContext* context, ::grpc_impl::CompletionQueue* cq, - size_t interceptor_pos) override { + size_t interceptor_pos) final { return delegate_channel()->CreateCallInternal(method, context, cq, interceptor_pos); } - ::grpc_impl::CompletionQueue* CallbackCQ() override { + ::grpc_impl::CompletionQueue* CallbackCQ() final { return delegate_channel()->CallbackCQ(); } From 6954030175eab57951b721ffbf2bebaf94dbc9b1 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 1 Aug 2019 16:40:26 -0700 Subject: [PATCH 161/661] Cd to an absolute path. --- tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh index f33fd0f4f55..eda730d3a54 100755 --- a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh +++ b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh @@ -29,6 +29,6 @@ bazel test --spawn_strategy=standalone --genrule_strategy=standalone --test_outp bazel clean --expunge bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //src/python/... bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //examples/python/... -(cd bazel/test/python_test_repo; +(cd /var/local/git/grpc/bazel/test/python_test_repo; bazel test --test_output=errors //... ) From 835b3d32930cd6e179b8c244837d2b49477cce01 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 1 Aug 2019 17:11:56 -0700 Subject: [PATCH 162/661] Copyright. --- bazel/test/python_test_repo/BUILD | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bazel/test/python_test_repo/BUILD b/bazel/test/python_test_repo/BUILD index ed4ffd3b74f..0df3700ec93 100644 --- a/bazel/test/python_test_repo/BUILD +++ b/bazel/test/python_test_repo/BUILD @@ -1,3 +1,19 @@ +# gRPC Bazel BUILD file. +# +# Copyright 2019 The gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + load("@com_github_grpc_grpc//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library") package(default_testonly = 1) From 3eb376c911c010d243e82a146d8a9082e5ab08ad Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 1 Aug 2019 17:18:18 -0700 Subject: [PATCH 163/661] Make py3 syntax check happy --- tools/run_tests/sanity/check_bazel_workspace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/sanity/check_bazel_workspace.py b/tools/run_tests/sanity/check_bazel_workspace.py index 4ddbc74646f..81fee5aa536 100755 --- a/tools/run_tests/sanity/check_bazel_workspace.py +++ b/tools/run_tests/sanity/check_bazel_workspace.py @@ -132,7 +132,7 @@ build_rules = { 'load': lambda a, b: None, 'git_repository': lambda **args: eval_state.git_repository(**args), } -exec bazel_file in build_rules +exec(bazel_file in build_rules) for name in _GRPC_DEP_NAMES: assert name in names_and_urls.keys() assert len(_GRPC_DEP_NAMES) == len(names_and_urls.keys()) From f20171f28bdcde810bf2c02b3d10d5a22d724f13 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 1 Aug 2019 17:27:27 -0700 Subject: [PATCH 164/661] Found another breakage --- tools/run_tests/sanity/check_bazel_workspace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/sanity/check_bazel_workspace.py b/tools/run_tests/sanity/check_bazel_workspace.py index 81fee5aa536..612f908bbfe 100755 --- a/tools/run_tests/sanity/check_bazel_workspace.py +++ b/tools/run_tests/sanity/check_bazel_workspace.py @@ -174,7 +174,7 @@ for name in _GRPC_DEP_NAMES: 'load': lambda a, b: None, 'git_repository': lambda **args: state.git_repository(**args), } - exec bazel_file in rules + exec(bazel_file in rules) assert name not in names_and_urls_with_overridden_name.keys() sys.exit(0) From 48516216307a262cf028759156ff1c8f99568d09 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Thu, 1 Aug 2019 17:30:47 -0700 Subject: [PATCH 165/661] Bump version to v1.24.x --- BUILD | 4 ++-- build.yaml | 4 ++-- doc/g_stands_for.md | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/BUILD b/BUILD index 6b51f07b82f..89e2cda3fdc 100644 --- a/BUILD +++ b/BUILD @@ -74,11 +74,11 @@ config_setting( ) # This should be updated along with build.yaml -g_stands_for = "gangnam" +g_stands_for = "ganges" core_version = "7.0.0" -version = "1.23.0-dev" +version = "1.24.0-dev" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/build.yaml b/build.yaml index 999c761056f..7f123dae740 100644 --- a/build.yaml +++ b/build.yaml @@ -14,8 +14,8 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 7.0.0 csharp_major_version: 2 - g_stands_for: gangnam - version: 1.23.0-dev + g_stands_for: ganges + version: 1.24.0-dev filegroups: - name: alts_proto headers: diff --git a/doc/g_stands_for.md b/doc/g_stands_for.md index fe1cbc90005..413ddcb341d 100644 --- a/doc/g_stands_for.md +++ b/doc/g_stands_for.md @@ -22,4 +22,5 @@ - 1.20 'g' stands for ['godric'](https://github.com/grpc/grpc/tree/v1.20.x) - 1.21 'g' stands for ['gandalf'](https://github.com/grpc/grpc/tree/v1.21.x) - 1.22 'g' stands for ['gale'](https://github.com/grpc/grpc/tree/v1.22.x) -- 1.23 'g' stands for ['gangnam'](https://github.com/grpc/grpc/tree/master) +- 1.23 'g' stands for ['gangnam'](https://github.com/grpc/grpc/tree/v1.23.x) +- 1.24 'g' stands for ['ganges'](https://github.com/grpc/grpc/tree/master) From fcb43f9deeeaf545085130087a923c963377bdda Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Thu, 1 Aug 2019 17:34:02 -0700 Subject: [PATCH 166/661] Regenerate projects --- CMakeLists.txt | 2 +- Makefile | 4 ++-- gRPC-C++.podspec | 4 ++-- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.xml | 4 ++-- src/core/lib/surface/version.cc | 2 +- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core.Api/VersionInfo.cs | 4 ++-- src/csharp/build/dependencies.props | 2 +- src/csharp/build_unitypackage.bat | 2 +- src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/objective-c/tests/version.h | 2 +- src/php/composer.json | 2 +- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_channelz/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_status/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 32 files changed, 36 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 12b2707f951..f2363910cc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 3.5.1) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.23.0-dev") +set(PACKAGE_VERSION "1.24.0-dev") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 0107f145204..c22b2d2ef4b 100644 --- a/Makefile +++ b/Makefile @@ -461,8 +461,8 @@ Q = @ endif CORE_VERSION = 7.0.0 -CPP_VERSION = 1.23.0-dev -CSHARP_VERSION = 2.23.0-dev +CPP_VERSION = 1.24.0-dev +CSHARP_VERSION = 2.24.0-dev CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 56d6f5b3edb..16ca8088f72 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - # version = '1.23.0-dev' + # version = '1.24.0-dev' version = '0.0.9-dev' s.version = version s.summary = 'gRPC C++ library' @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.license = 'Apache License, Version 2.0' s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - grpc_version = '1.23.0-dev' + grpc_version = '1.24.0-dev' s.source = { :git => 'https://github.com/grpc/grpc.git', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 6325348602e..a08b3cc680f 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.23.0-dev' + version = '1.24.0-dev' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 2c0441ba95c..3163c031ab8 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.23.0-dev' + version = '1.24.0-dev' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 12a8728ac34..8505bba9fcf 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.23.0-dev' + version = '1.24.0-dev' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index bbfd08f9774..fcdd4968f04 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.23.0-dev' + version = '1.24.0-dev' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.xml b/package.xml index cb221ff932d..af06829c733 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2018-01-19 - 1.23.0dev - 1.23.0dev + 1.24.0dev + 1.24.0dev beta diff --git a/src/core/lib/surface/version.cc b/src/core/lib/surface/version.cc index 848a49d1eff..182eed2ced2 100644 --- a/src/core/lib/surface/version.cc +++ b/src/core/lib/surface/version.cc @@ -25,4 +25,4 @@ const char* grpc_version_string(void) { return "7.0.0"; } -const char* grpc_g_stands_for(void) { return "gangnam"; } +const char* grpc_g_stands_for(void) { return "ganges"; } diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 7fb7823c9f2..71ddc6e5d71 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.23.0-dev"; } +grpc::string Version() { return "1.24.0-dev"; } } // namespace grpc diff --git a/src/csharp/Grpc.Core.Api/VersionInfo.cs b/src/csharp/Grpc.Core.Api/VersionInfo.cs index d84da7c9e2f..f732af32ec3 100644 --- a/src/csharp/Grpc.Core.Api/VersionInfo.cs +++ b/src/csharp/Grpc.Core.Api/VersionInfo.cs @@ -33,11 +33,11 @@ namespace Grpc.Core /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "2.23.0.0"; + public const string CurrentAssemblyFileVersion = "2.24.0.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "2.23.0-dev"; + public const string CurrentVersion = "2.24.0-dev"; } } diff --git a/src/csharp/build/dependencies.props b/src/csharp/build/dependencies.props index 4f100873bc7..d45d3b1b0eb 100644 --- a/src/csharp/build/dependencies.props +++ b/src/csharp/build/dependencies.props @@ -1,7 +1,7 @@ - 2.23.0-dev + 2.24.0-dev 3.8.0 diff --git a/src/csharp/build_unitypackage.bat b/src/csharp/build_unitypackage.bat index f29bd98b5a2..9fade5c1dd0 100644 --- a/src/csharp/build_unitypackage.bat +++ b/src/csharp/build_unitypackage.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=2.23.0-dev +set VERSION=2.24.0-dev @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec index dc1f8b2c090..56ca7ce6ae4 100644 --- a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCCppPlugin' - v = '1.23.0-dev' + v = '1.24.0-dev' s.version = v s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 939078def22..c98aed5bc55 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.23.0-dev' + v = '1.24.0-dev' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index 3b248db0148..fc6982c55d6 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.23.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.24.0-dev" diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index 231ba1a9a9f..d724fdd8e07 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -22,5 +22,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.23.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.24.0-dev" #define GRPC_C_VERSION_STRING @"7.0.0" diff --git a/src/php/composer.json b/src/php/composer.json index e29c9c33fde..6da1fd77d65 100644 --- a/src/php/composer.json +++ b/src/php/composer.json @@ -2,7 +2,7 @@ "name": "grpc/grpc-dev", "description": "gRPC library for PHP - for Developement use only", "license": "Apache-2.0", - "version": "1.23.0", + "version": "1.24.0", "require": { "php": ">=5.5.0", "google/protobuf": "^v3.3.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index bb707f50a9f..000508dd3f8 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.23.0dev" +#define PHP_GRPC_VERSION "1.24.0dev" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index d2f8be43f34..ff1b1a17d25 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.23.0.dev0""" +__version__ = """1.24.0.dev0""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 548d2810b5b..e0280abaa7c 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.24.0.dev0' diff --git a/src/python/grpcio_channelz/grpc_version.py b/src/python/grpcio_channelz/grpc_version.py index f7029fff484..93a448ecb64 100644 --- a/src/python/grpcio_channelz/grpc_version.py +++ b/src/python/grpcio_channelz/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.24.0.dev0' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index d66daa473ed..2a1aa0c9359 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.24.0.dev0' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 97213872a91..93c28ba9fac 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.24.0.dev0' diff --git a/src/python/grpcio_status/grpc_version.py b/src/python/grpcio_status/grpc_version.py index 31921b4cc90..a2b5a814b52 100644 --- a/src/python/grpcio_status/grpc_version.py +++ b/src/python/grpcio_status/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_status/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.24.0.dev0' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index 5c8926cb6c8..937e57da02f 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.24.0.dev0' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index a1fc87448a1..a1e43215b09 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.24.0.dev0' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 051bc067e55..43f08a0c87b 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.23.0.dev' + VERSION = '1.24.0.dev' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index e66a4a799fd..b08edb08478 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.23.0.dev' + VERSION = '1.24.0.dev' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index 127d3c1f9bc..184a0a9dda6 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.24.0.dev0' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index e85ae495546..15eedc7a888 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.23.0-dev +PROJECT_NUMBER = 1.24.0-dev # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 96da09eefc6..61b858b1952 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.23.0-dev +PROJECT_NUMBER = 1.24.0-dev # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From 07c4b1e0bb3726ae0d22ded27aaefe82060195bf Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Thu, 1 Aug 2019 17:48:31 -0700 Subject: [PATCH 167/661] Bump version to v1.23.0-pre1 --- BUILD | 2 +- build.yaml | 2 +- doc/g_stands_for.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BUILD b/BUILD index 6b51f07b82f..c708318ecbf 100644 --- a/BUILD +++ b/BUILD @@ -78,7 +78,7 @@ g_stands_for = "gangnam" core_version = "7.0.0" -version = "1.23.0-dev" +version = "1.23.0-pre1" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/build.yaml b/build.yaml index 999c761056f..1ba055c65dd 100644 --- a/build.yaml +++ b/build.yaml @@ -15,7 +15,7 @@ settings: core_version: 7.0.0 csharp_major_version: 2 g_stands_for: gangnam - version: 1.23.0-dev + version: 1.23.0-pre1 filegroups: - name: alts_proto headers: diff --git a/doc/g_stands_for.md b/doc/g_stands_for.md index fe1cbc90005..373357ab8a6 100644 --- a/doc/g_stands_for.md +++ b/doc/g_stands_for.md @@ -22,4 +22,4 @@ - 1.20 'g' stands for ['godric'](https://github.com/grpc/grpc/tree/v1.20.x) - 1.21 'g' stands for ['gandalf'](https://github.com/grpc/grpc/tree/v1.21.x) - 1.22 'g' stands for ['gale'](https://github.com/grpc/grpc/tree/v1.22.x) -- 1.23 'g' stands for ['gangnam'](https://github.com/grpc/grpc/tree/master) +- 1.23 'g' stands for ['gangnam'](https://github.com/grpc/grpc/tree/v1.23.x) From d030df29518fe15d8b247aa7ce248b0bef77d631 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Thu, 1 Aug 2019 17:48:59 -0700 Subject: [PATCH 168/661] Regenerate projects --- CMakeLists.txt | 2 +- Makefile | 4 ++-- gRPC-C++.podspec | 6 +++--- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.xml | 4 ++-- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core.Api/VersionInfo.cs | 2 +- src/csharp/build/dependencies.props | 2 +- src/csharp/build_unitypackage.bat | 2 +- src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/objective-c/tests/version.h | 2 +- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_channelz/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_status/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 30 files changed, 34 insertions(+), 34 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 12b2707f951..6a5b4b5cd8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 3.5.1) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.23.0-dev") +set(PACKAGE_VERSION "1.23.0-pre1") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 0107f145204..d4d82581cef 100644 --- a/Makefile +++ b/Makefile @@ -461,8 +461,8 @@ Q = @ endif CORE_VERSION = 7.0.0 -CPP_VERSION = 1.23.0-dev -CSHARP_VERSION = 2.23.0-dev +CPP_VERSION = 1.23.0-pre1 +CSHARP_VERSION = 2.23.0-pre1 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 56d6f5b3edb..304ae372101 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -23,15 +23,15 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - # version = '1.23.0-dev' - version = '0.0.9-dev' + # version = '1.23.0-pre1' + version = '0.0.9-pre1' s.version = version s.summary = 'gRPC C++ library' s.homepage = 'https://grpc.io' s.license = 'Apache License, Version 2.0' s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - grpc_version = '1.23.0-dev' + grpc_version = '1.23.0-pre1' s.source = { :git => 'https://github.com/grpc/grpc.git', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 6325348602e..d3a82b572dc 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.23.0-dev' + version = '1.23.0-pre1' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 2c0441ba95c..c90445baae2 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.23.0-dev' + version = '1.23.0-pre1' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 12a8728ac34..87bd9e7c481 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.23.0-dev' + version = '1.23.0-pre1' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index bbfd08f9774..dc05dc86ba2 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.23.0-dev' + version = '1.23.0-pre1' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.xml b/package.xml index cb221ff932d..7d2cb708925 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2018-01-19 - 1.23.0dev - 1.23.0dev + 1.23.0RC1 + 1.23.0RC1 beta diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 7fb7823c9f2..751cbfa1c22 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.23.0-dev"; } +grpc::string Version() { return "1.23.0-pre1"; } } // namespace grpc diff --git a/src/csharp/Grpc.Core.Api/VersionInfo.cs b/src/csharp/Grpc.Core.Api/VersionInfo.cs index d84da7c9e2f..ca9e88f268d 100644 --- a/src/csharp/Grpc.Core.Api/VersionInfo.cs +++ b/src/csharp/Grpc.Core.Api/VersionInfo.cs @@ -38,6 +38,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "2.23.0-dev"; + public const string CurrentVersion = "2.23.0-pre1"; } } diff --git a/src/csharp/build/dependencies.props b/src/csharp/build/dependencies.props index 4f100873bc7..00ff3ccb780 100644 --- a/src/csharp/build/dependencies.props +++ b/src/csharp/build/dependencies.props @@ -1,7 +1,7 @@ - 2.23.0-dev + 2.23.0-pre1 3.8.0 diff --git a/src/csharp/build_unitypackage.bat b/src/csharp/build_unitypackage.bat index f29bd98b5a2..1906f266e20 100644 --- a/src/csharp/build_unitypackage.bat +++ b/src/csharp/build_unitypackage.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=2.23.0-dev +set VERSION=2.23.0-pre1 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec index dc1f8b2c090..6dc9d4a3f13 100644 --- a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCCppPlugin' - v = '1.23.0-dev' + v = '1.23.0-pre1' s.version = v s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 939078def22..98b4ef0dc12 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.23.0-dev' + v = '1.23.0-pre1' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index 3b248db0148..bf467558d31 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.23.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.23.0-pre1" diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index 231ba1a9a9f..f5d7ec747af 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -22,5 +22,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.23.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.23.0-pre1" #define GRPC_C_VERSION_STRING @"7.0.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index bb707f50a9f..038ca5c1b25 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.23.0dev" +#define PHP_GRPC_VERSION "1.23.0RC1" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index d2f8be43f34..d8f04ec88f3 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.23.0.dev0""" +__version__ = """1.23.0rc1""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 548d2810b5b..2215172be39 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.23.0rc1' diff --git a/src/python/grpcio_channelz/grpc_version.py b/src/python/grpcio_channelz/grpc_version.py index f7029fff484..d7b9e92800b 100644 --- a/src/python/grpcio_channelz/grpc_version.py +++ b/src/python/grpcio_channelz/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.23.0rc1' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index d66daa473ed..04a5cd79401 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.23.0rc1' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 97213872a91..8f47ca23c9b 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.23.0rc1' diff --git a/src/python/grpcio_status/grpc_version.py b/src/python/grpcio_status/grpc_version.py index 31921b4cc90..42aad42fa57 100644 --- a/src/python/grpcio_status/grpc_version.py +++ b/src/python/grpcio_status/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_status/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.23.0rc1' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index 5c8926cb6c8..71930c6730f 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.23.0rc1' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index a1fc87448a1..aab9f1b57ab 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.23.0rc1' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 051bc067e55..fa31c144282 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.23.0.dev' + VERSION = '1.23.0.pre1' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index e66a4a799fd..e5e7a16717c 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.23.0.dev' + VERSION = '1.23.0.pre1' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index 127d3c1f9bc..2b4e8218b50 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION = '1.23.0.dev0' +VERSION = '1.23.0rc1' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index e85ae495546..d508459f0fd 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.23.0-dev +PROJECT_NUMBER = 1.23.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 96da09eefc6..ec0c30b0e79 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.23.0-dev +PROJECT_NUMBER = 1.23.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From efa43e1bb3b5cb77abece370321c036a487aefe2 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 1 Aug 2019 17:56:59 -0700 Subject: [PATCH 169/661] Modified scripts to run builds correct schemes on correct platforms --- src/objective-c/tests/build_one_example.sh | 18 ++++++++++++++++-- tools/run_tests/run_tests.py | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/objective-c/tests/build_one_example.sh b/src/objective-c/tests/build_one_example.sh index 084147f1d46..caa048e258b 100755 --- a/src/objective-c/tests/build_one_example.sh +++ b/src/objective-c/tests/build_one_example.sh @@ -31,14 +31,26 @@ cd $EXAMPLE_PATH # clean the directory rm -rf Pods -rm -rf $SCHEME.xcworkspace +rm -rf *.xcworkspace rm -f Podfile.lock pod install set -o pipefail XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )' -xcodebuild \ +if [ "$SCHEME" == "tvOS-sample" ]; then + xcodebuild \ + build \ + -workspace *.xcworkspace \ + -scheme $SCHEME \ + -destination generic/platform=tvOS \ + -derivedDataPath Build/Build \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v "^$" - +else + xcodebuild \ build \ -workspace *.xcworkspace \ -scheme $SCHEME \ @@ -48,3 +60,5 @@ xcodebuild \ CODE_SIGNING_REQUIRED=NO \ | egrep -v "$XCODEBUILD_FILTER" \ | egrep -v "^$" - +fi + diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index a4e647a7833..db75d884aa9 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1119,7 +1119,7 @@ class ObjCLanguage(object): shortname='ios-buildtest-example-watchOS-sample', cpu_cost=1e6, environ={ - 'SCHEME': 'watchOS-sample', + 'SCHEME': 'watchOS-sample-WatchKit-App', 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', 'FRAMEWORKS': 'NO' })) @@ -1130,7 +1130,7 @@ class ObjCLanguage(object): shortname='ios-buildtest-example-watchOS-sample-framework', cpu_cost=1e6, environ={ - 'SCHEME': 'watchOS-sample', + 'SCHEME': 'watchOS-sample-WatchKit-App', 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', 'FRAMEWORKS': 'YES' })) From a0ba0b1ff235ed9378898f9402d64aa9b839fb7d Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 1 Aug 2019 17:59:27 -0700 Subject: [PATCH 170/661] Change format --- tools/run_tests/sanity/check_bazel_workspace.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/run_tests/sanity/check_bazel_workspace.py b/tools/run_tests/sanity/check_bazel_workspace.py index 612f908bbfe..fa1ae2574fb 100755 --- a/tools/run_tests/sanity/check_bazel_workspace.py +++ b/tools/run_tests/sanity/check_bazel_workspace.py @@ -132,7 +132,7 @@ build_rules = { 'load': lambda a, b: None, 'git_repository': lambda **args: eval_state.git_repository(**args), } -exec(bazel_file in build_rules) +exec (bazel_file) in build_rules for name in _GRPC_DEP_NAMES: assert name in names_and_urls.keys() assert len(_GRPC_DEP_NAMES) == len(names_and_urls.keys()) @@ -174,7 +174,7 @@ for name in _GRPC_DEP_NAMES: 'load': lambda a, b: None, 'git_repository': lambda **args: state.git_repository(**args), } - exec(bazel_file in rules) + exec (bazel_file) in rules assert name not in names_and_urls_with_overridden_name.keys() sys.exit(0) From 5476b0512dcd5eab4771d222bd43c943ee1004d1 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 1 Aug 2019 18:01:23 -0700 Subject: [PATCH 171/661] Remade projects for backwards compatibility --- .../tvOS-sample.xcodeproj/project.pbxproj | 235 ++++---- .../tvOS-sample/tvOS-sample/AppDelegate.m | 1 + .../tvOS-sample/Base.lproj/Main.storyboard | 8 +- .../tvOS-sample/tvOS-sample/ViewController.m | 7 +- .../examples/tvOS-sample/tvOS-sample/main.m | 1 + .../AppIcon.appiconset/Contents.json | 21 - .../Assets.xcassets/Contents.json | 6 - .../Base.lproj/Interface.storyboard | 10 +- .../watchOS-sample/WatchKit-App/Info.plist | 2 +- .../Circular.imageset/Contents.json | 18 - .../Contents.json | 48 -- .../Extra Large.imageset/Contents.json | 18 - .../Graphic Bezel.imageset/Contents.json | 18 - .../Graphic Circular.imageset/Contents.json | 18 - .../Graphic Corner.imageset/Contents.json | 18 - .../Contents.json | 18 - .../Modular.imageset/Contents.json | 18 - .../Utilitarian.imageset/Contents.json | 18 - .../Assets.xcassets/Contents.json | 6 - .../WatchKit-Extension/ExtensionDelegate.h | 1 + .../WatchKit-Extension/ExtensionDelegate.m | 1 + .../WatchKit-Extension/Info.plist | 4 +- .../WatchKit-Extension/InterfaceController.h | 1 + .../WatchKit-Extension/InterfaceController.m | 8 +- .../watchOS-sample.xcodeproj/project.pbxproj | 540 ++++++++++-------- .../watchOS-sample WatchKit App.xcscheme | 127 ---- .../xcschemes/watchOS-sample.xcscheme | 91 --- .../watchOS-sample/AppDelegate.m | 1 + .../AppIcon.appiconset/Contents.json | 5 - .../Assets.xcassets/Contents.json | 6 - .../Base.lproj/LaunchScreen.storyboard | 2 +- .../watchOS-sample/Base.lproj/Main.storyboard | 2 +- .../watchOS-sample/ViewController.m | 1 + .../watchOS-sample/watchOS-sample/main.m | 1 + 34 files changed, 469 insertions(+), 811 deletions(-) delete mode 100644 src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/Contents.json delete mode 100644 src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json delete mode 100644 src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Contents.json delete mode 100644 src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json delete mode 100644 src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json delete mode 100644 src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json delete mode 100644 src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json delete mode 100644 src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json delete mode 100644 src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json delete mode 100644 src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json delete mode 100644 src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Contents.json delete mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample WatchKit App.xcscheme delete mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample.xcscheme delete mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/Contents.json diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj index 7f8198aa320..84eafed2608 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj @@ -7,100 +7,101 @@ objects = { /* Begin PBXBuildFile section */ - 8E4F1CA090367C7618548546 /* libPods-tvOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 65430D45E5C272C975E4CCCA /* libPods-tvOS-sample.a */; }; - ABB17D3A22D8FB8B00C26D6E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D3922D8FB8B00C26D6E /* AppDelegate.m */; }; - ABB17D3D22D8FB8B00C26D6E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D3C22D8FB8B00C26D6E /* ViewController.m */; }; - ABB17D4022D8FB8B00C26D6E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D3E22D8FB8B00C26D6E /* Main.storyboard */; }; - ABB17D4522D8FB8D00C26D6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D4422D8FB8D00C26D6E /* main.m */; }; + 02EBA696CC670AE7C839A074 /* libPods-tvOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E06AA8437E1C07D35F65494 /* libPods-tvOS-sample.a */; }; + AB065AFB22F3A66000418B42 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AB065AFA22F3A66000418B42 /* AppDelegate.m */; }; + AB065AFE22F3A66000418B42 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB065AFD22F3A66000418B42 /* ViewController.m */; }; + AB065B0122F3A66000418B42 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB065AFF22F3A66000418B42 /* Main.storyboard */; }; + AB065B0622F3A66000418B42 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AB065B0522F3A66000418B42 /* main.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 65430D45E5C272C975E4CCCA /* libPods-tvOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-tvOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 93F3CF0DB110860F8E180685 /* Pods-tvOS-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS-sample.release.xcconfig"; path = "Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample.release.xcconfig"; sourceTree = ""; }; - ABB17D3522D8FB8B00C26D6E /* tvOS-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "tvOS-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - ABB17D3822D8FB8B00C26D6E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - ABB17D3922D8FB8B00C26D6E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - ABB17D3B22D8FB8B00C26D6E /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - ABB17D3C22D8FB8B00C26D6E /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - ABB17D3F22D8FB8B00C26D6E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - ABB17D4322D8FB8D00C26D6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - ABB17D4422D8FB8D00C26D6E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - D2D1C60CE9BD00C1371BC913 /* Pods-tvOS-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS-sample.debug.xcconfig"; path = "Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample.debug.xcconfig"; sourceTree = ""; }; + 48F25040998C073D575D8368 /* Pods-tvOS-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS-sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample.debug.xcconfig"; sourceTree = ""; }; + 4E06AA8437E1C07D35F65494 /* libPods-tvOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-tvOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 6DEA6A97511C324413DA4309 /* Pods-tvOS-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS-sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample.release.xcconfig"; sourceTree = ""; }; + AB065AF622F3A66000418B42 /* tvOS-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "tvOS-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + AB065AF922F3A66000418B42 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + AB065AFA22F3A66000418B42 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + AB065AFC22F3A66000418B42 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + AB065AFD22F3A66000418B42 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + AB065B0022F3A66000418B42 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + AB065B0422F3A66000418B42 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + AB065B0522F3A66000418B42 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - ABB17D3222D8FB8B00C26D6E /* Frameworks */ = { + AB065AF322F3A66000418B42 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 8E4F1CA090367C7618548546 /* libPods-tvOS-sample.a in Frameworks */, + 02EBA696CC670AE7C839A074 /* libPods-tvOS-sample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 28FD2EFD84992131D85ADAE6 /* Pods */ = { + 0BEC1FEC387B8EE89F6F099A /* Frameworks */ = { isa = PBXGroup; children = ( - D2D1C60CE9BD00C1371BC913 /* Pods-tvOS-sample.debug.xcconfig */, - 93F3CF0DB110860F8E180685 /* Pods-tvOS-sample.release.xcconfig */, + 4E06AA8437E1C07D35F65494 /* libPods-tvOS-sample.a */, ); - path = Pods; + name = Frameworks; sourceTree = ""; }; - ABB17D2C22D8FB8B00C26D6E = { + 3FED17B5BF1125421CC89007 /* Pods */ = { isa = PBXGroup; children = ( - ABB17D3722D8FB8B00C26D6E /* tvOS-sample */, - ABB17D3622D8FB8B00C26D6E /* Products */, - 28FD2EFD84992131D85ADAE6 /* Pods */, - D280E557B55AAB044C083DB5 /* Frameworks */, + 48F25040998C073D575D8368 /* Pods-tvOS-sample.debug.xcconfig */, + 6DEA6A97511C324413DA4309 /* Pods-tvOS-sample.release.xcconfig */, ); + name = Pods; sourceTree = ""; }; - ABB17D3622D8FB8B00C26D6E /* Products */ = { + AB065AED22F3A66000418B42 = { isa = PBXGroup; children = ( - ABB17D3522D8FB8B00C26D6E /* tvOS-sample.app */, + AB065AF822F3A66000418B42 /* tvOS-sample */, + AB065AF722F3A66000418B42 /* Products */, + 3FED17B5BF1125421CC89007 /* Pods */, + 0BEC1FEC387B8EE89F6F099A /* Frameworks */, ); - name = Products; sourceTree = ""; }; - ABB17D3722D8FB8B00C26D6E /* tvOS-sample */ = { + AB065AF722F3A66000418B42 /* Products */ = { isa = PBXGroup; children = ( - ABB17D3822D8FB8B00C26D6E /* AppDelegate.h */, - ABB17D3922D8FB8B00C26D6E /* AppDelegate.m */, - ABB17D3B22D8FB8B00C26D6E /* ViewController.h */, - ABB17D3C22D8FB8B00C26D6E /* ViewController.m */, - ABB17D3E22D8FB8B00C26D6E /* Main.storyboard */, - ABB17D4322D8FB8D00C26D6E /* Info.plist */, - ABB17D4422D8FB8D00C26D6E /* main.m */, + AB065AF622F3A66000418B42 /* tvOS-sample.app */, ); - path = "tvOS-sample"; + name = Products; sourceTree = ""; }; - D280E557B55AAB044C083DB5 /* Frameworks */ = { + AB065AF822F3A66000418B42 /* tvOS-sample */ = { isa = PBXGroup; children = ( - 65430D45E5C272C975E4CCCA /* libPods-tvOS-sample.a */, + AB065AF922F3A66000418B42 /* AppDelegate.h */, + AB065AFA22F3A66000418B42 /* AppDelegate.m */, + AB065AFC22F3A66000418B42 /* ViewController.h */, + AB065AFD22F3A66000418B42 /* ViewController.m */, + AB065AFF22F3A66000418B42 /* Main.storyboard */, + AB065B0422F3A66000418B42 /* Info.plist */, + AB065B0522F3A66000418B42 /* main.m */, ); - name = Frameworks; + path = "tvOS-sample"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - ABB17D3422D8FB8B00C26D6E /* tvOS-sample */ = { + AB065AF522F3A66000418B42 /* tvOS-sample */ = { isa = PBXNativeTarget; - buildConfigurationList = ABB17D4822D8FB8D00C26D6E /* Build configuration list for PBXNativeTarget "tvOS-sample" */; + buildConfigurationList = AB065B0922F3A66000418B42 /* Build configuration list for PBXNativeTarget "tvOS-sample" */; buildPhases = ( - BCFBD1317F97D9F34D9AFD4A /* [CP] Check Pods Manifest.lock */, - ABB17D3122D8FB8B00C26D6E /* Sources */, - ABB17D3222D8FB8B00C26D6E /* Frameworks */, - ABB17D3322D8FB8B00C26D6E /* Resources */, - 53B9CBB782EEE8A7572F10EC /* [CP] Copy Pods Resources */, + 2C94076AB2C1F2771A45E0FF /* [CP] Check Pods Manifest.lock */, + AB065AF222F3A66000418B42 /* Sources */, + AB065AF322F3A66000418B42 /* Frameworks */, + AB065AF422F3A66000418B42 /* Resources */, + 000AD98AD507990B4381492E /* [CP] Embed Pods Frameworks */, + EC4FC44DCB7C66394A17FCF9 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -108,25 +109,25 @@ ); name = "tvOS-sample"; productName = "tvOS-sample"; - productReference = ABB17D3522D8FB8B00C26D6E /* tvOS-sample.app */; + productReference = AB065AF622F3A66000418B42 /* tvOS-sample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - ABB17D2D22D8FB8B00C26D6E /* Project object */ = { + AB065AEE22F3A66000418B42 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1010; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = "Tony Lu"; TargetAttributes = { - ABB17D3422D8FB8B00C26D6E = { - CreatedOnToolsVersion = 10.1; + AB065AF522F3A66000418B42 = { + CreatedOnToolsVersion = 9.2; ProvisioningStyle = Automatic; }; }; }; - buildConfigurationList = ABB17D3022D8FB8B00C26D6E /* Build configuration list for PBXProject "tvOS-sample" */; + buildConfigurationList = AB065AF122F3A66000418B42 /* Build configuration list for PBXProject "tvOS-sample" */; compatibilityVersion = "Xcode 8.0"; developmentRegion = en; hasScannedForEncodings = 0; @@ -134,51 +135,61 @@ en, Base, ); - mainGroup = ABB17D2C22D8FB8B00C26D6E; - productRefGroup = ABB17D3622D8FB8B00C26D6E /* Products */; + mainGroup = AB065AED22F3A66000418B42; + productRefGroup = AB065AF722F3A66000418B42 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - ABB17D3422D8FB8B00C26D6E /* tvOS-sample */, + AB065AF522F3A66000418B42 /* tvOS-sample */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - ABB17D3322D8FB8B00C26D6E /* Resources */ = { + AB065AF422F3A66000418B42 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - ABB17D4022D8FB8B00C26D6E /* Main.storyboard in Resources */, + AB065B0122F3A66000418B42 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 53B9CBB782EEE8A7572F10EC /* [CP] Copy Pods Resources */ = { + 000AD98AD507990B4381492E /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC/openssl_grpc.framework", + "${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework", + "${BUILT_PRODUCTS_DIR}/RemoteTest/RemoteTest.framework", + "${BUILT_PRODUCTS_DIR}/gRPC/GRPCClient.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-Core/grpc.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-ProtoRPC/ProtoRPC.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-RxLibrary/RxLibrary.framework", + "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", ); + name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RemoteTest.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRPCClient.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/grpc.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ProtoRPC.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxLibrary.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - BCFBD1317F97D9F34D9AFD4A /* [CP] Check Pods Manifest.lock */ = { + 2C94076AB2C1F2771A45E0FF /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -196,26 +207,44 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + EC4FC44DCB7C66394A17FCF9 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources.sh", + "$PODS_CONFIGURATION_BUILD_DIR/gRPC/gRPCCertificates.bundle", + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - ABB17D3122D8FB8B00C26D6E /* Sources */ = { + AB065AF222F3A66000418B42 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - ABB17D3D22D8FB8B00C26D6E /* ViewController.m in Sources */, - ABB17D4522D8FB8D00C26D6E /* main.m in Sources */, - ABB17D3A22D8FB8B00C26D6E /* AppDelegate.m in Sources */, + AB065AFE22F3A66000418B42 /* ViewController.m in Sources */, + AB065B0622F3A66000418B42 /* main.m in Sources */, + AB065AFB22F3A66000418B42 /* AppDelegate.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ - ABB17D3E22D8FB8B00C26D6E /* Main.storyboard */ = { + AB065AFF22F3A66000418B42 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( - ABB17D3F22D8FB8B00C26D6E /* Base */, + AB065B0022F3A66000418B42 /* Base */, ); name = Main.storyboard; sourceTree = ""; @@ -223,7 +252,7 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - ABB17D4622D8FB8D00C26D6E /* Debug */ = { + AB065B0722F3A66000418B42 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -233,12 +262,10 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -246,7 +273,6 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -273,15 +299,14 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; + MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 12.1; + TVOS_DEPLOYMENT_TARGET = 11.2; }; name = Debug; }; - ABB17D4722D8FB8D00C26D6E /* Release */ = { + AB065B0822F3A66000418B42 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -291,12 +316,10 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -304,7 +327,6 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -326,42 +348,45 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 12.1; + TVOS_DEPLOYMENT_TARGET = 11.2; VALIDATE_PRODUCT = YES; }; name = Release; }; - ABB17D4922D8FB8D00C26D6E /* Debug */ = { + AB065B0A22F3A66000418B42 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D2D1C60CE9BD00C1371BC913 /* Pods-tvOS-sample.debug.xcconfig */; + baseConfigurationReference = 48F25040998C073D575D8368 /* Pods-tvOS-sample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 6T98ZJNPG5; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "tvOS-sample/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-grpc-sample"; + PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 10.0; }; name = Debug; }; - ABB17D4A22D8FB8D00C26D6E /* Release */ = { + AB065B0B22F3A66000418B42 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 93F3CF0DB110860F8E180685 /* Pods-tvOS-sample.release.xcconfig */; + baseConfigurationReference = 6DEA6A97511C324413DA4309 /* Pods-tvOS-sample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 6T98ZJNPG5; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "tvOS-sample/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-grpc-sample"; + PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 10.0; }; @@ -370,25 +395,25 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - ABB17D3022D8FB8B00C26D6E /* Build configuration list for PBXProject "tvOS-sample" */ = { + AB065AF122F3A66000418B42 /* Build configuration list for PBXProject "tvOS-sample" */ = { isa = XCConfigurationList; buildConfigurations = ( - ABB17D4622D8FB8D00C26D6E /* Debug */, - ABB17D4722D8FB8D00C26D6E /* Release */, + AB065B0722F3A66000418B42 /* Debug */, + AB065B0822F3A66000418B42 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - ABB17D4822D8FB8D00C26D6E /* Build configuration list for PBXNativeTarget "tvOS-sample" */ = { + AB065B0922F3A66000418B42 /* Build configuration list for PBXNativeTarget "tvOS-sample" */ = { isa = XCConfigurationList; buildConfigurations = ( - ABB17D4922D8FB8D00C26D6E /* Debug */, - ABB17D4A22D8FB8D00C26D6E /* Release */, + AB065B0A22F3A66000418B42 /* Debug */, + AB065B0B22F3A66000418B42 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; - rootObject = ABB17D2D22D8FB8B00C26D6E /* Project object */; + rootObject = AB065AEE22F3A66000418B42 /* Project object */; } diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m index 4a76f4c488c..2a0849df3d4 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m @@ -25,3 +25,4 @@ @implementation AppDelegate @end + diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Base.lproj/Main.storyboard b/src/objective-c/examples/tvOS-sample/tvOS-sample/Base.lproj/Main.storyboard index 783cc4062b3..0f2fc518164 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Base.lproj/Main.storyboard +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -22,13 +22,13 @@ - diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m index c94ee8c2569..76f172bef0c 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m @@ -37,10 +37,10 @@ - (void)viewDidLoad { [super viewDidLoad]; - + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; _options = options; - + _service = [[RMTTestService alloc] initWithHost:@"grpc-test.sandbox.googleapis.com" callOptions:_options]; } @@ -49,7 +49,7 @@ RMTSimpleRequest *request = [RMTSimpleRequest message]; request.responseSize = 100; GRPCUnaryProtoCall *call = - [_service unaryCallWithMessage:request responseHandler:self callOptions:nil]; + [_service unaryCallWithMessage:request responseHandler:self callOptions:nil]; [call start]; } @@ -62,3 +62,4 @@ } @end + diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m index 2797c6f17f2..38ec506adc3 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m @@ -24,3 +24,4 @@ int main(int argc, char* argv[]) { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } + diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json index 6c0f2b4204b..215c1ddfee9 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -33,20 +33,6 @@ "role" : "appLauncher", "subtype" : "38mm" }, - { - "size" : "44x44", - "idiom" : "watch", - "scale" : "2x", - "role" : "appLauncher", - "subtype" : "40mm" - }, - { - "size" : "50x50", - "idiom" : "watch", - "scale" : "2x", - "role" : "appLauncher", - "subtype" : "44mm" - }, { "size" : "86x86", "idiom" : "watch", @@ -61,13 +47,6 @@ "role" : "quickLook", "subtype" : "42mm" }, - { - "size" : "108x108", - "idiom" : "watch", - "scale" : "2x", - "role" : "quickLook", - "subtype" : "44mm" - }, { "idiom" : "watch-marketing", "size" : "1024x1024", diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c918..00000000000 --- a/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-App/Base.lproj/Interface.storyboard b/src/objective-c/examples/watchOS-sample/WatchKit-App/Base.lproj/Interface.storyboard index 6c4d9248113..b261f45f206 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-App/Base.lproj/Interface.storyboard +++ b/src/objective-c/examples/watchOS-sample/WatchKit-App/Base.lproj/Interface.storyboard @@ -1,12 +1,12 @@ - + - - + + @@ -14,9 +14,9 @@ - diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist index f0396b31ef7..309d7867639 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist +++ b/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist @@ -26,7 +26,7 @@ UIInterfaceOrientationPortraitUpsideDown WKCompanionAppBundleIdentifier - com.google.watchOS-grpc-sample + com.google.watchOS-sample WKWatchKitApp diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json deleted file mode 100644 index f84499ba516..00000000000 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "images" : [ - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : "<=145" - }, - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : ">145" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Contents.json deleted file mode 100644 index 1571c7e531b..00000000000 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Contents.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "assets" : [ - { - "idiom" : "watch", - "filename" : "Circular.imageset", - "role" : "circular" - }, - { - "idiom" : "watch", - "filename" : "Extra Large.imageset", - "role" : "extra-large" - }, - { - "idiom" : "watch", - "filename" : "Graphic Bezel.imageset", - "role" : "graphic-bezel" - }, - { - "idiom" : "watch", - "filename" : "Graphic Circular.imageset", - "role" : "graphic-circular" - }, - { - "idiom" : "watch", - "filename" : "Graphic Corner.imageset", - "role" : "graphic-corner" - }, - { - "idiom" : "watch", - "filename" : "Graphic Large Rectangular.imageset", - "role" : "graphic-large-rectangular" - }, - { - "idiom" : "watch", - "filename" : "Modular.imageset", - "role" : "modular" - }, - { - "idiom" : "watch", - "filename" : "Utilitarian.imageset", - "role" : "utilitarian" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json deleted file mode 100644 index f84499ba516..00000000000 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "images" : [ - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : "<=145" - }, - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : ">145" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json deleted file mode 100644 index f84499ba516..00000000000 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "images" : [ - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : "<=145" - }, - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : ">145" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json deleted file mode 100644 index f84499ba516..00000000000 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "images" : [ - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : "<=145" - }, - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : ">145" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json deleted file mode 100644 index f84499ba516..00000000000 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "images" : [ - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : "<=145" - }, - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : ">145" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json deleted file mode 100644 index f84499ba516..00000000000 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "images" : [ - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : "<=145" - }, - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : ">145" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json deleted file mode 100644 index f84499ba516..00000000000 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "images" : [ - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : "<=145" - }, - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : ">145" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json deleted file mode 100644 index f84499ba516..00000000000 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "images" : [ - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : "<=145" - }, - { - "idiom" : "watch", - "scale" : "2x", - "screen-width" : ">145" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c918..00000000000 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.h b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.h index fbf67335f7d..df3ac1dbe2e 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.h +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.h @@ -21,3 +21,4 @@ @interface ExtensionDelegate : NSObject @end + diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.m b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.m index b64d60256de..d9c9951f264 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.m +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.m @@ -21,3 +21,4 @@ @implementation ExtensionDelegate @end + diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist index fcbeef72a4d..bc09fa0f786 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist @@ -5,7 +5,7 @@ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName - WatchKit-Extension + watchOS-sample WatchKit Extension CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -25,7 +25,7 @@ NSExtensionAttributes WKAppBundleIdentifier - com.google.watchOS-grpc-sample.watchkitapp + com.google.watchOS-sample.watchkitapp NSExtensionPointIdentifier com.apple.watchkit diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.h b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.h index edcc75d5530..24390ac4693 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.h +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.h @@ -22,3 +22,4 @@ @interface InterfaceController : WKInterfaceController @end + diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m index 3e97767cf0c..7ed3a1a0004 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m @@ -36,12 +36,12 @@ - (void)awakeWithContext:(id)context { [super awakeWithContext:context]; - + // Configure interface objects here. - + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; _options = options; - + _service = [[RMTTestService alloc] initWithHost:@"grpc-test.sandbox.googleapis.com" callOptions:_options]; } @@ -50,7 +50,7 @@ RMTSimpleRequest *request = [RMTSimpleRequest message]; request.responseSize = 100; GRPCUnaryProtoCall *call = - [_service unaryCallWithMessage:request responseHandler:self callOptions:nil]; + [_service unaryCallWithMessage:request responseHandler:self callOptions:nil]; [call start]; } diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj index 7f57c514775..ddd91170243 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj @@ -7,59 +7,58 @@ objects = { /* Begin PBXBuildFile section */ - 26FD050F4CCE95ED8CB98A62 /* libPods-watchOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CD8313B9B59F6F095035EF8 /* libPods-watchOS-sample.a */; }; - A82AA8DDE95C58A13334A932 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E347FF230AC1FAC0C374BE0C /* libPods-watchOS-sample WatchKit Extension.a */; }; - ABB17D5922D93BAB00C26D6E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D5822D93BAB00C26D6E /* AppDelegate.m */; }; - ABB17D5C22D93BAB00C26D6E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D5B22D93BAB00C26D6E /* ViewController.m */; }; - ABB17D5F22D93BAB00C26D6E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D5D22D93BAB00C26D6E /* Main.storyboard */; }; - ABB17D6122D93BAC00C26D6E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D6022D93BAC00C26D6E /* Assets.xcassets */; }; - ABB17D6422D93BAC00C26D6E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D6222D93BAC00C26D6E /* LaunchScreen.storyboard */; }; - ABB17D6722D93BAC00C26D6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D6622D93BAC00C26D6E /* main.m */; }; - ABB17D6B22D93BAC00C26D6E /* watchOS-sample WatchKit App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = ABB17D6A22D93BAC00C26D6E /* watchOS-sample WatchKit App.app */; }; - ABB17D7122D93BAC00C26D6E /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D6F22D93BAC00C26D6E /* Interface.storyboard */; }; - ABB17D7322D93BAC00C26D6E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D7222D93BAC00C26D6E /* Assets.xcassets */; }; - ABB17D7A22D93BAC00C26D6E /* watchOS-sample WatchKit Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = ABB17D7922D93BAC00C26D6E /* watchOS-sample WatchKit Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; - ABB17D8022D93BAC00C26D6E /* InterfaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D7F22D93BAC00C26D6E /* InterfaceController.m */; }; - ABB17D8322D93BAC00C26D6E /* ExtensionDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB17D8222D93BAC00C26D6E /* ExtensionDelegate.m */; }; - ABB17D8522D93BAD00C26D6E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABB17D8422D93BAD00C26D6E /* Assets.xcassets */; }; + 6DC02D8E4E24CB3EAAA9C0F7 /* libPods-watchOS-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D836D6D1793B03D9D9A05E4 /* libPods-watchOS-sample.a */; }; + AB35433822F3A88000C1B2E9 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AB35433722F3A88000C1B2E9 /* AppDelegate.m */; }; + AB35433B22F3A88000C1B2E9 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB35433A22F3A88000C1B2E9 /* ViewController.m */; }; + AB35433E22F3A88000C1B2E9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB35433C22F3A88000C1B2E9 /* Main.storyboard */; }; + AB35434022F3A88000C1B2E9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AB35433F22F3A88000C1B2E9 /* Assets.xcassets */; }; + AB35434322F3A88000C1B2E9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB35434122F3A88000C1B2E9 /* LaunchScreen.storyboard */; }; + AB35434622F3A88000C1B2E9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AB35434522F3A88000C1B2E9 /* main.m */; }; + AB35434A22F3A88000C1B2E9 /* watchOS-sample WatchKit App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = AB35434922F3A88000C1B2E9 /* watchOS-sample WatchKit App.app */; }; + AB35435022F3A88000C1B2E9 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB35434E22F3A88000C1B2E9 /* Interface.storyboard */; }; + AB35435222F3A88000C1B2E9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AB35435122F3A88000C1B2E9 /* Assets.xcassets */; }; + AB35435922F3A88000C1B2E9 /* watchOS-sample WatchKit Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = AB35435822F3A88000C1B2E9 /* watchOS-sample WatchKit Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + AB35435F22F3A88000C1B2E9 /* InterfaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB35435E22F3A88000C1B2E9 /* InterfaceController.m */; }; + AB35436222F3A88000C1B2E9 /* ExtensionDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AB35436122F3A88000C1B2E9 /* ExtensionDelegate.m */; }; + FF523208A6A52E881C6C4CA2 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C68E1F9D1CE4435317B0009 /* libPods-watchOS-sample WatchKit Extension.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - ABB17D6C22D93BAC00C26D6E /* PBXContainerItemProxy */ = { + AB35434B22F3A88000C1B2E9 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = ABB17D4C22D93BAB00C26D6E /* Project object */; + containerPortal = AB35432B22F3A88000C1B2E9 /* Project object */; proxyType = 1; - remoteGlobalIDString = ABB17D6922D93BAC00C26D6E; + remoteGlobalIDString = AB35434822F3A88000C1B2E9; remoteInfo = "watchOS-sample WatchKit App"; }; - ABB17D7B22D93BAC00C26D6E /* PBXContainerItemProxy */ = { + AB35435A22F3A88000C1B2E9 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = ABB17D4C22D93BAB00C26D6E /* Project object */; + containerPortal = AB35432B22F3A88000C1B2E9 /* Project object */; proxyType = 1; - remoteGlobalIDString = ABB17D7822D93BAC00C26D6E; + remoteGlobalIDString = AB35435722F3A88000C1B2E9; remoteInfo = "watchOS-sample WatchKit Extension"; }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - ABB17D8C22D93BAD00C26D6E /* Embed App Extensions */ = { + AB35436B22F3A88000C1B2E9 /* Embed App Extensions */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 13; files = ( - ABB17D7A22D93BAC00C26D6E /* watchOS-sample WatchKit Extension.appex in Embed App Extensions */, + AB35435922F3A88000C1B2E9 /* watchOS-sample WatchKit Extension.appex in Embed App Extensions */, ); name = "Embed App Extensions"; runOnlyForDeploymentPostprocessing = 0; }; - ABB17D9022D93BAD00C26D6E /* Embed Watch Content */ = { + AB35436F22F3A88000C1B2E9 /* Embed Watch Content */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = "$(CONTENTS_FOLDER_PATH)/Watch"; dstSubfolderSpec = 16; files = ( - ABB17D6B22D93BAC00C26D6E /* watchOS-sample WatchKit App.app in Embed Watch Content */, + AB35434A22F3A88000C1B2E9 /* watchOS-sample WatchKit App.app in Embed Watch Content */, ); name = "Embed Watch Content"; runOnlyForDeploymentPostprocessing = 0; @@ -67,194 +66,194 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 574DCD2DDCABCC45B2308601 /* Pods-watchOS-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample.debug.xcconfig"; path = "Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample.debug.xcconfig"; sourceTree = ""; }; - 7CD8313B9B59F6F095035EF8 /* libPods-watchOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 957B59E3DE8281B41B6DB3FD /* Pods-watchOS-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample.release.xcconfig"; path = "Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample.release.xcconfig"; sourceTree = ""; }; - ABB17D5422D93BAB00C26D6E /* watchOS-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "watchOS-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - ABB17D5722D93BAB00C26D6E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - ABB17D5822D93BAB00C26D6E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - ABB17D5A22D93BAB00C26D6E /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - ABB17D5B22D93BAB00C26D6E /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - ABB17D5E22D93BAB00C26D6E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - ABB17D6022D93BAC00C26D6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - ABB17D6322D93BAC00C26D6E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - ABB17D6522D93BAC00C26D6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - ABB17D6622D93BAC00C26D6E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - ABB17D6A22D93BAC00C26D6E /* watchOS-sample WatchKit App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "watchOS-sample WatchKit App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - ABB17D7022D93BAC00C26D6E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Interface.storyboard; sourceTree = ""; }; - ABB17D7222D93BAC00C26D6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - ABB17D7422D93BAC00C26D6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - ABB17D7922D93BAC00C26D6E /* watchOS-sample WatchKit Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "watchOS-sample WatchKit Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; - ABB17D7E22D93BAC00C26D6E /* InterfaceController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InterfaceController.h; sourceTree = ""; }; - ABB17D7F22D93BAC00C26D6E /* InterfaceController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InterfaceController.m; sourceTree = ""; }; - ABB17D8122D93BAC00C26D6E /* ExtensionDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExtensionDelegate.h; sourceTree = ""; }; - ABB17D8222D93BAC00C26D6E /* ExtensionDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExtensionDelegate.m; sourceTree = ""; }; - ABB17D8422D93BAD00C26D6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - ABB17D8622D93BAD00C26D6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - E347FF230AC1FAC0C374BE0C /* libPods-watchOS-sample WatchKit Extension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample WatchKit Extension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - EDC6FF21CD9F393E8FDF02F6 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample WatchKit Extension.release.xcconfig"; path = "Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension.release.xcconfig"; sourceTree = ""; }; - FBBABD10A996E7CCA4B2F937 /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample WatchKit Extension.debug.xcconfig"; path = "Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension.debug.xcconfig"; sourceTree = ""; }; + 0980DE37FA805E61D7665FC3 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample WatchKit Extension.release.xcconfig"; path = "Pods/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension.release.xcconfig"; sourceTree = ""; }; + 0E281AAFDD87686AFF4DA811 /* Pods-watchOS-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample.release.xcconfig"; sourceTree = ""; }; + 2D836D6D1793B03D9D9A05E4 /* libPods-watchOS-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 4C68E1F9D1CE4435317B0009 /* libPods-watchOS-sample WatchKit Extension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-watchOS-sample WatchKit Extension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 9760150292F726236301FFB4 /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample WatchKit Extension.debug.xcconfig"; path = "Pods/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension.debug.xcconfig"; sourceTree = ""; }; + AB35433322F3A88000C1B2E9 /* watchOS-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "watchOS-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + AB35433622F3A88000C1B2E9 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + AB35433722F3A88000C1B2E9 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + AB35433922F3A88000C1B2E9 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + AB35433A22F3A88000C1B2E9 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + AB35433D22F3A88000C1B2E9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + AB35433F22F3A88000C1B2E9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + AB35434222F3A88000C1B2E9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + AB35434422F3A88000C1B2E9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + AB35434522F3A88000C1B2E9 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + AB35434922F3A88000C1B2E9 /* watchOS-sample WatchKit App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "watchOS-sample WatchKit App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + AB35434F22F3A88000C1B2E9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Interface.storyboard; sourceTree = ""; }; + AB35435122F3A88000C1B2E9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + AB35435322F3A88000C1B2E9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + AB35435822F3A88000C1B2E9 /* watchOS-sample WatchKit Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "watchOS-sample WatchKit Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; + AB35435D22F3A88000C1B2E9 /* InterfaceController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InterfaceController.h; sourceTree = ""; }; + AB35435E22F3A88000C1B2E9 /* InterfaceController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InterfaceController.m; sourceTree = ""; }; + AB35436022F3A88000C1B2E9 /* ExtensionDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExtensionDelegate.h; sourceTree = ""; }; + AB35436122F3A88000C1B2E9 /* ExtensionDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExtensionDelegate.m; sourceTree = ""; }; + AB35436522F3A88000C1B2E9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B04FF36D5367E20E26B17EE8 /* Pods-watchOS-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-watchOS-sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - ABB17D5122D93BAB00C26D6E /* Frameworks */ = { + 23B5B63423F9068CAAF8C6A8 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 26FD050F4CCE95ED8CB98A62 /* libPods-watchOS-sample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - ABB17D7622D93BAC00C26D6E /* Frameworks */ = { + AB35433022F3A88000C1B2E9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - A82AA8DDE95C58A13334A932 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */, + 6DC02D8E4E24CB3EAAA9C0F7 /* libPods-watchOS-sample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - F374C9EC9D24282B20A64719 /* Frameworks */ = { + AB35435522F3A88000C1B2E9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FF523208A6A52E881C6C4CA2 /* libPods-watchOS-sample WatchKit Extension.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 2C4A0708747AAA7298F757DA /* Pods */ = { + 38A0EA6120D821E9244482B4 /* Frameworks */ = { isa = PBXGroup; children = ( - 574DCD2DDCABCC45B2308601 /* Pods-watchOS-sample.debug.xcconfig */, - 957B59E3DE8281B41B6DB3FD /* Pods-watchOS-sample.release.xcconfig */, - FBBABD10A996E7CCA4B2F937 /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */, - EDC6FF21CD9F393E8FDF02F6 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */, + 2D836D6D1793B03D9D9A05E4 /* libPods-watchOS-sample.a */, + 4C68E1F9D1CE4435317B0009 /* libPods-watchOS-sample WatchKit Extension.a */, ); - path = Pods; + name = Frameworks; sourceTree = ""; }; - ABB17D4B22D93BAB00C26D6E = { + 93EDCC6DB32E10D3C92C69E5 /* Pods */ = { isa = PBXGroup; children = ( - ABB17D5622D93BAB00C26D6E /* watchOS-sample */, - ABB17D6E22D93BAC00C26D6E /* WatchKit-App */, - ABB17D7D22D93BAC00C26D6E /* WatchKit-Extension */, - ABB17D5522D93BAB00C26D6E /* Products */, - 2C4A0708747AAA7298F757DA /* Pods */, - FDB2CA47351660A961DBE458 /* Frameworks */, + B04FF36D5367E20E26B17EE8 /* Pods-watchOS-sample.debug.xcconfig */, + 0E281AAFDD87686AFF4DA811 /* Pods-watchOS-sample.release.xcconfig */, + 9760150292F726236301FFB4 /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */, + 0980DE37FA805E61D7665FC3 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */, ); + name = Pods; sourceTree = ""; }; - ABB17D5522D93BAB00C26D6E /* Products */ = { + AB35432A22F3A88000C1B2E9 = { isa = PBXGroup; children = ( - ABB17D5422D93BAB00C26D6E /* watchOS-sample.app */, - ABB17D6A22D93BAC00C26D6E /* watchOS-sample WatchKit App.app */, - ABB17D7922D93BAC00C26D6E /* watchOS-sample WatchKit Extension.appex */, + AB35433522F3A88000C1B2E9 /* watchOS-sample */, + AB35434D22F3A88000C1B2E9 /* WatchKit-App */, + AB35435C22F3A88000C1B2E9 /* WatchKit-Extension */, + AB35433422F3A88000C1B2E9 /* Products */, + 93EDCC6DB32E10D3C92C69E5 /* Pods */, + 38A0EA6120D821E9244482B4 /* Frameworks */, ); - name = Products; sourceTree = ""; }; - ABB17D5622D93BAB00C26D6E /* watchOS-sample */ = { + AB35433422F3A88000C1B2E9 /* Products */ = { isa = PBXGroup; children = ( - ABB17D5722D93BAB00C26D6E /* AppDelegate.h */, - ABB17D5822D93BAB00C26D6E /* AppDelegate.m */, - ABB17D5A22D93BAB00C26D6E /* ViewController.h */, - ABB17D5B22D93BAB00C26D6E /* ViewController.m */, - ABB17D5D22D93BAB00C26D6E /* Main.storyboard */, - ABB17D6022D93BAC00C26D6E /* Assets.xcassets */, - ABB17D6222D93BAC00C26D6E /* LaunchScreen.storyboard */, - ABB17D6522D93BAC00C26D6E /* Info.plist */, - ABB17D6622D93BAC00C26D6E /* main.m */, + AB35433322F3A88000C1B2E9 /* watchOS-sample.app */, + AB35434922F3A88000C1B2E9 /* watchOS-sample WatchKit App.app */, + AB35435822F3A88000C1B2E9 /* watchOS-sample WatchKit Extension.appex */, ); - path = "watchOS-sample"; + name = Products; sourceTree = ""; }; - ABB17D6E22D93BAC00C26D6E /* WatchKit-App */ = { + AB35433522F3A88000C1B2E9 /* watchOS-sample */ = { isa = PBXGroup; children = ( - ABB17D6F22D93BAC00C26D6E /* Interface.storyboard */, - ABB17D7222D93BAC00C26D6E /* Assets.xcassets */, - ABB17D7422D93BAC00C26D6E /* Info.plist */, + AB35433622F3A88000C1B2E9 /* AppDelegate.h */, + AB35433722F3A88000C1B2E9 /* AppDelegate.m */, + AB35433922F3A88000C1B2E9 /* ViewController.h */, + AB35433A22F3A88000C1B2E9 /* ViewController.m */, + AB35433C22F3A88000C1B2E9 /* Main.storyboard */, + AB35433F22F3A88000C1B2E9 /* Assets.xcassets */, + AB35434122F3A88000C1B2E9 /* LaunchScreen.storyboard */, + AB35434422F3A88000C1B2E9 /* Info.plist */, + AB35434522F3A88000C1B2E9 /* main.m */, ); - path = "WatchKit-App"; + path = "watchOS-sample"; sourceTree = ""; }; - ABB17D7D22D93BAC00C26D6E /* WatchKit-Extension */ = { + AB35434D22F3A88000C1B2E9 /* WatchKit-App */ = { isa = PBXGroup; children = ( - ABB17D7E22D93BAC00C26D6E /* InterfaceController.h */, - ABB17D7F22D93BAC00C26D6E /* InterfaceController.m */, - ABB17D8122D93BAC00C26D6E /* ExtensionDelegate.h */, - ABB17D8222D93BAC00C26D6E /* ExtensionDelegate.m */, - ABB17D8422D93BAD00C26D6E /* Assets.xcassets */, - ABB17D8622D93BAD00C26D6E /* Info.plist */, + AB35434E22F3A88000C1B2E9 /* Interface.storyboard */, + AB35435122F3A88000C1B2E9 /* Assets.xcassets */, + AB35435322F3A88000C1B2E9 /* Info.plist */, ); - path = "WatchKit-Extension"; + path = "WatchKit-App"; sourceTree = ""; }; - FDB2CA47351660A961DBE458 /* Frameworks */ = { + AB35435C22F3A88000C1B2E9 /* WatchKit-Extension */ = { isa = PBXGroup; children = ( - 7CD8313B9B59F6F095035EF8 /* libPods-watchOS-sample.a */, - E347FF230AC1FAC0C374BE0C /* libPods-watchOS-sample WatchKit Extension.a */, + AB35435D22F3A88000C1B2E9 /* InterfaceController.h */, + AB35435E22F3A88000C1B2E9 /* InterfaceController.m */, + AB35436022F3A88000C1B2E9 /* ExtensionDelegate.h */, + AB35436122F3A88000C1B2E9 /* ExtensionDelegate.m */, + AB35436522F3A88000C1B2E9 /* Info.plist */, ); - name = Frameworks; + path = "WatchKit-Extension"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - ABB17D5322D93BAB00C26D6E /* watchOS-sample */ = { + AB35433222F3A88000C1B2E9 /* watchOS-sample */ = { isa = PBXNativeTarget; - buildConfigurationList = ABB17D9122D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample" */; + buildConfigurationList = AB35437022F3A88000C1B2E9 /* Build configuration list for PBXNativeTarget "watchOS-sample" */; buildPhases = ( - C094DF31B83C380F13D80132 /* [CP] Check Pods Manifest.lock */, - ABB17D5022D93BAB00C26D6E /* Sources */, - ABB17D5122D93BAB00C26D6E /* Frameworks */, - ABB17D5222D93BAB00C26D6E /* Resources */, - ABB17D9022D93BAD00C26D6E /* Embed Watch Content */, - 9A5D1B4A7574524FF0BB9310 /* [CP] Copy Pods Resources */, + 7CBBF7FBEB5B8AB30A349E22 /* [CP] Check Pods Manifest.lock */, + AB35432F22F3A88000C1B2E9 /* Sources */, + AB35433022F3A88000C1B2E9 /* Frameworks */, + AB35433122F3A88000C1B2E9 /* Resources */, + AB35436F22F3A88000C1B2E9 /* Embed Watch Content */, + 5644E359E6C67CF9FD7B659D /* [CP] Embed Pods Frameworks */, + 42609F71FF3FEF23C402967B /* [CP] Copy Pods Resources */, ); buildRules = ( ); dependencies = ( - ABB17D6D22D93BAC00C26D6E /* PBXTargetDependency */, + AB35434C22F3A88000C1B2E9 /* PBXTargetDependency */, ); name = "watchOS-sample"; productName = "watchOS-sample"; - productReference = ABB17D5422D93BAB00C26D6E /* watchOS-sample.app */; + productReference = AB35433322F3A88000C1B2E9 /* watchOS-sample.app */; productType = "com.apple.product-type.application"; }; - ABB17D6922D93BAC00C26D6E /* watchOS-sample WatchKit App */ = { + AB35434822F3A88000C1B2E9 /* watchOS-sample WatchKit App */ = { isa = PBXNativeTarget; - buildConfigurationList = ABB17D8D22D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample WatchKit App" */; + buildConfigurationList = AB35436C22F3A88000C1B2E9 /* Build configuration list for PBXNativeTarget "watchOS-sample WatchKit App" */; buildPhases = ( - ABB17D6822D93BAC00C26D6E /* Resources */, - ABB17D8C22D93BAD00C26D6E /* Embed App Extensions */, - F374C9EC9D24282B20A64719 /* Frameworks */, + AB35434722F3A88000C1B2E9 /* Resources */, + AB35436B22F3A88000C1B2E9 /* Embed App Extensions */, + 23B5B63423F9068CAAF8C6A8 /* Frameworks */, ); buildRules = ( ); dependencies = ( - ABB17D7C22D93BAC00C26D6E /* PBXTargetDependency */, + AB35435B22F3A88000C1B2E9 /* PBXTargetDependency */, ); name = "watchOS-sample WatchKit App"; productName = "watchOS-sample WatchKit App"; - productReference = ABB17D6A22D93BAC00C26D6E /* watchOS-sample WatchKit App.app */; + productReference = AB35434922F3A88000C1B2E9 /* watchOS-sample WatchKit App.app */; productType = "com.apple.product-type.application.watchapp2"; }; - ABB17D7822D93BAC00C26D6E /* watchOS-sample WatchKit Extension */ = { + AB35435722F3A88000C1B2E9 /* watchOS-sample WatchKit Extension */ = { isa = PBXNativeTarget; - buildConfigurationList = ABB17D8922D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample WatchKit Extension" */; + buildConfigurationList = AB35436822F3A88000C1B2E9 /* Build configuration list for PBXNativeTarget "watchOS-sample WatchKit Extension" */; buildPhases = ( - 370B91D5CA71A3A771721814 /* [CP] Check Pods Manifest.lock */, - ABB17D7522D93BAC00C26D6E /* Sources */, - ABB17D7622D93BAC00C26D6E /* Frameworks */, - ABB17D7722D93BAC00C26D6E /* Resources */, - 7246FFBCAD3F9270364EFC9E /* [CP] Copy Pods Resources */, + C80BFB1E1525B018E6C87AF0 /* [CP] Check Pods Manifest.lock */, + AB35435422F3A88000C1B2E9 /* Sources */, + AB35435522F3A88000C1B2E9 /* Frameworks */, + AB35435622F3A88000C1B2E9 /* Resources */, + E0C622F545CB8A6103793708 /* [CP] Embed Pods Frameworks */, + D202361DA337959ACDB8D358 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -262,33 +261,33 @@ ); name = "watchOS-sample WatchKit Extension"; productName = "watchOS-sample WatchKit Extension"; - productReference = ABB17D7922D93BAC00C26D6E /* watchOS-sample WatchKit Extension.appex */; + productReference = AB35435822F3A88000C1B2E9 /* watchOS-sample WatchKit Extension.appex */; productType = "com.apple.product-type.watchkit2-extension"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - ABB17D4C22D93BAB00C26D6E /* Project object */ = { + AB35432B22F3A88000C1B2E9 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1010; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = "Tony Lu"; TargetAttributes = { - ABB17D5322D93BAB00C26D6E = { - CreatedOnToolsVersion = 10.1; + AB35433222F3A88000C1B2E9 = { + CreatedOnToolsVersion = 9.2; ProvisioningStyle = Automatic; }; - ABB17D6922D93BAC00C26D6E = { - CreatedOnToolsVersion = 10.1; + AB35434822F3A88000C1B2E9 = { + CreatedOnToolsVersion = 9.2; ProvisioningStyle = Automatic; }; - ABB17D7822D93BAC00C26D6E = { - CreatedOnToolsVersion = 10.1; + AB35435722F3A88000C1B2E9 = { + CreatedOnToolsVersion = 9.2; ProvisioningStyle = Automatic; }; }; }; - buildConfigurationList = ABB17D4F22D93BAB00C26D6E /* Build configuration list for PBXProject "watchOS-sample" */; + buildConfigurationList = AB35432E22F3A88000C1B2E9 /* Build configuration list for PBXProject "watchOS-sample" */; compatibilityVersion = "Xcode 8.0"; developmentRegion = en; hasScannedForEncodings = 0; @@ -296,179 +295,266 @@ en, Base, ); - mainGroup = ABB17D4B22D93BAB00C26D6E; - productRefGroup = ABB17D5522D93BAB00C26D6E /* Products */; + mainGroup = AB35432A22F3A88000C1B2E9; + productRefGroup = AB35433422F3A88000C1B2E9 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - ABB17D5322D93BAB00C26D6E /* watchOS-sample */, - ABB17D6922D93BAC00C26D6E /* watchOS-sample WatchKit App */, - ABB17D7822D93BAC00C26D6E /* watchOS-sample WatchKit Extension */, + AB35433222F3A88000C1B2E9 /* watchOS-sample */, + AB35434822F3A88000C1B2E9 /* watchOS-sample WatchKit App */, + AB35435722F3A88000C1B2E9 /* watchOS-sample WatchKit Extension */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - ABB17D5222D93BAB00C26D6E /* Resources */ = { + AB35433122F3A88000C1B2E9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - ABB17D6422D93BAC00C26D6E /* LaunchScreen.storyboard in Resources */, - ABB17D6122D93BAC00C26D6E /* Assets.xcassets in Resources */, - ABB17D5F22D93BAB00C26D6E /* Main.storyboard in Resources */, + AB35434322F3A88000C1B2E9 /* LaunchScreen.storyboard in Resources */, + AB35434022F3A88000C1B2E9 /* Assets.xcassets in Resources */, + AB35433E22F3A88000C1B2E9 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - ABB17D6822D93BAC00C26D6E /* Resources */ = { + AB35434722F3A88000C1B2E9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - ABB17D7322D93BAC00C26D6E /* Assets.xcassets in Resources */, - ABB17D7122D93BAC00C26D6E /* Interface.storyboard in Resources */, + AB35435222F3A88000C1B2E9 /* Assets.xcassets in Resources */, + AB35435022F3A88000C1B2E9 /* Interface.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - ABB17D7722D93BAC00C26D6E /* Resources */ = { + AB35435622F3A88000C1B2E9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - ABB17D8522D93BAD00C26D6E /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 370B91D5CA71A3A771721814 /* [CP] Check Pods Manifest.lock */ = { + 42609F71FF3FEF23C402967B /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh", + "$PODS_CONFIGURATION_BUILD_DIR/gRPC-iOS/gRPCCertificates.bundle", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + ); + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 5644E359E6C67CF9FD7B659D /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC-iOS/openssl_grpc.framework", + "${BUILT_PRODUCTS_DIR}/Protobuf-iOS/Protobuf.framework", + "${BUILT_PRODUCTS_DIR}/RemoteTest-iOS/RemoteTest.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-iOS/GRPCClient.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-Core-iOS/grpc.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-ProtoRPC-iOS/ProtoRPC.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-RxLibrary-iOS/RxLibrary.framework", + "${BUILT_PRODUCTS_DIR}/nanopb-iOS/nanopb.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + ); + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RemoteTest.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRPCClient.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/grpc.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ProtoRPC.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxLibrary.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 7CBBF7FBEB5B8AB30A349E22 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-watchOS-sample WatchKit Extension-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-watchOS-sample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 7246FFBCAD3F9270364EFC9E /* [CP] Copy Pods Resources */ = { + C80BFB1E1525B018E6C87AF0 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-watchOS/gRPCCertificates.bundle", + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( ); - name = "[CP] Copy Pods Resources"; outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", + "$(DERIVED_FILE_DIR)/Pods-watchOS-sample WatchKit Extension-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 9A5D1B4A7574524FF0BB9310 /* [CP] Copy Pods Resources */ = { + D202361DA337959ACDB8D358 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", + "${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources.sh", + "$PODS_CONFIGURATION_BUILD_DIR/gRPC-watchOS/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + ); outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources.sh\"\n"; showEnvVarsInLog = 0; }; - C094DF31B83C380F13D80132 /* [CP] Check Pods Manifest.lock */ = { + E0C622F545CB8A6103793708 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", + "${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC-watchOS/openssl_grpc.framework", + "${BUILT_PRODUCTS_DIR}/Protobuf-watchOS/Protobuf.framework", + "${BUILT_PRODUCTS_DIR}/RemoteTest-watchOS/RemoteTest.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-watchOS/GRPCClient.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-Core-watchOS/grpc.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-ProtoRPC-watchOS/ProtoRPC.framework", + "${BUILT_PRODUCTS_DIR}/gRPC-RxLibrary-watchOS/RxLibrary.framework", + "${BUILT_PRODUCTS_DIR}/nanopb-watchOS/nanopb.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( ); - name = "[CP] Check Pods Manifest.lock"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-watchOS-sample-checkManifestLockResult.txt", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RemoteTest.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRPCClient.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/grpc.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ProtoRPC.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxLibrary.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - ABB17D5022D93BAB00C26D6E /* Sources */ = { + AB35432F22F3A88000C1B2E9 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - ABB17D5C22D93BAB00C26D6E /* ViewController.m in Sources */, - ABB17D6722D93BAC00C26D6E /* main.m in Sources */, - ABB17D5922D93BAB00C26D6E /* AppDelegate.m in Sources */, + AB35433B22F3A88000C1B2E9 /* ViewController.m in Sources */, + AB35434622F3A88000C1B2E9 /* main.m in Sources */, + AB35433822F3A88000C1B2E9 /* AppDelegate.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - ABB17D7522D93BAC00C26D6E /* Sources */ = { + AB35435422F3A88000C1B2E9 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - ABB17D8322D93BAC00C26D6E /* ExtensionDelegate.m in Sources */, - ABB17D8022D93BAC00C26D6E /* InterfaceController.m in Sources */, + AB35436222F3A88000C1B2E9 /* ExtensionDelegate.m in Sources */, + AB35435F22F3A88000C1B2E9 /* InterfaceController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - ABB17D6D22D93BAC00C26D6E /* PBXTargetDependency */ = { + AB35434C22F3A88000C1B2E9 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = ABB17D6922D93BAC00C26D6E /* watchOS-sample WatchKit App */; - targetProxy = ABB17D6C22D93BAC00C26D6E /* PBXContainerItemProxy */; + target = AB35434822F3A88000C1B2E9 /* watchOS-sample WatchKit App */; + targetProxy = AB35434B22F3A88000C1B2E9 /* PBXContainerItemProxy */; }; - ABB17D7C22D93BAC00C26D6E /* PBXTargetDependency */ = { + AB35435B22F3A88000C1B2E9 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = ABB17D7822D93BAC00C26D6E /* watchOS-sample WatchKit Extension */; - targetProxy = ABB17D7B22D93BAC00C26D6E /* PBXContainerItemProxy */; + target = AB35435722F3A88000C1B2E9 /* watchOS-sample WatchKit Extension */; + targetProxy = AB35435A22F3A88000C1B2E9 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ - ABB17D5D22D93BAB00C26D6E /* Main.storyboard */ = { + AB35433C22F3A88000C1B2E9 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( - ABB17D5E22D93BAB00C26D6E /* Base */, + AB35433D22F3A88000C1B2E9 /* Base */, ); name = Main.storyboard; sourceTree = ""; }; - ABB17D6222D93BAC00C26D6E /* LaunchScreen.storyboard */ = { + AB35434122F3A88000C1B2E9 /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( - ABB17D6322D93BAC00C26D6E /* Base */, + AB35434222F3A88000C1B2E9 /* Base */, ); name = LaunchScreen.storyboard; sourceTree = ""; }; - ABB17D6F22D93BAC00C26D6E /* Interface.storyboard */ = { + AB35434E22F3A88000C1B2E9 /* Interface.storyboard */ = { isa = PBXVariantGroup; children = ( - ABB17D7022D93BAC00C26D6E /* Base */, + AB35434F22F3A88000C1B2E9 /* Base */, ); name = Interface.storyboard; sourceTree = ""; @@ -476,7 +562,7 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - ABB17D8722D93BAD00C26D6E /* Debug */ = { + AB35436622F3A88000C1B2E9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -486,12 +572,10 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -499,7 +583,6 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -527,15 +610,14 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; - ABB17D8822D93BAD00C26D6E /* Release */ = { + AB35436722F3A88000C1B2E9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -545,12 +627,10 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -558,7 +638,6 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -580,24 +659,23 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; name = Release; }; - ABB17D8A22D93BAD00C26D6E /* Debug */ = { + AB35436922F3A88000C1B2E9 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FBBABD10A996E7CCA4B2F937 /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */; + baseConfigurationReference = 9760150292F726236301FFB4 /* Pods-watchOS-sample WatchKit Extension.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "$(SRCROOT)/WatchKit-Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp.watchkitextension"; + PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample.watchkitapp.watchkitextension"; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -606,16 +684,16 @@ }; name = Debug; }; - ABB17D8B22D93BAD00C26D6E /* Release */ = { + AB35436A22F3A88000C1B2E9 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = EDC6FF21CD9F393E8FDF02F6 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */; + baseConfigurationReference = 0980DE37FA805E61D7665FC3 /* Pods-watchOS-sample WatchKit Extension.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "$(SRCROOT)/WatchKit-Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp.watchkitextension"; + PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample.watchkitapp.watchkitextension"; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -624,7 +702,7 @@ }; name = Release; }; - ABB17D8E22D93BAD00C26D6E /* Debug */ = { + AB35436D22F3A88000C1B2E9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -632,7 +710,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; IBSC_MODULE = watchOS_sample_WatchKit_Extension; INFOPLIST_FILE = "$(SRCROOT)/WatchKit-App/Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp"; + PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample.watchkitapp"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -641,7 +719,7 @@ }; name = Debug; }; - ABB17D8F22D93BAD00C26D6E /* Release */ = { + AB35436E22F3A88000C1B2E9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -649,7 +727,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; IBSC_MODULE = watchOS_sample_WatchKit_Extension; INFOPLIST_FILE = "$(SRCROOT)/WatchKit-App/Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample.watchkitapp"; + PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample.watchkitapp"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -658,31 +736,31 @@ }; name = Release; }; - ABB17D9222D93BAD00C26D6E /* Debug */ = { + AB35437122F3A88000C1B2E9 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 574DCD2DDCABCC45B2308601 /* Pods-watchOS-sample.debug.xcconfig */; + baseConfigurationReference = B04FF36D5367E20E26B17EE8 /* Pods-watchOS-sample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "watchOS-sample/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample"; + PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; - ABB17D9322D93BAD00C26D6E /* Release */ = { + AB35437222F3A88000C1B2E9 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 957B59E3DE8281B41B6DB3FD /* Pods-watchOS-sample.release.xcconfig */; + baseConfigurationReference = 0E281AAFDD87686AFF4DA811 /* Pods-watchOS-sample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "watchOS-sample/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-grpc-sample"; + PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -691,43 +769,43 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - ABB17D4F22D93BAB00C26D6E /* Build configuration list for PBXProject "watchOS-sample" */ = { + AB35432E22F3A88000C1B2E9 /* Build configuration list for PBXProject "watchOS-sample" */ = { isa = XCConfigurationList; buildConfigurations = ( - ABB17D8722D93BAD00C26D6E /* Debug */, - ABB17D8822D93BAD00C26D6E /* Release */, + AB35436622F3A88000C1B2E9 /* Debug */, + AB35436722F3A88000C1B2E9 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - ABB17D8922D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample WatchKit Extension" */ = { + AB35436822F3A88000C1B2E9 /* Build configuration list for PBXNativeTarget "watchOS-sample WatchKit Extension" */ = { isa = XCConfigurationList; buildConfigurations = ( - ABB17D8A22D93BAD00C26D6E /* Debug */, - ABB17D8B22D93BAD00C26D6E /* Release */, + AB35436922F3A88000C1B2E9 /* Debug */, + AB35436A22F3A88000C1B2E9 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - ABB17D8D22D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample WatchKit App" */ = { + AB35436C22F3A88000C1B2E9 /* Build configuration list for PBXNativeTarget "watchOS-sample WatchKit App" */ = { isa = XCConfigurationList; buildConfigurations = ( - ABB17D8E22D93BAD00C26D6E /* Debug */, - ABB17D8F22D93BAD00C26D6E /* Release */, + AB35436D22F3A88000C1B2E9 /* Debug */, + AB35436E22F3A88000C1B2E9 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - ABB17D9122D93BAD00C26D6E /* Build configuration list for PBXNativeTarget "watchOS-sample" */ = { + AB35437022F3A88000C1B2E9 /* Build configuration list for PBXNativeTarget "watchOS-sample" */ = { isa = XCConfigurationList; buildConfigurations = ( - ABB17D9222D93BAD00C26D6E /* Debug */, - ABB17D9322D93BAD00C26D6E /* Release */, + AB35437122F3A88000C1B2E9 /* Debug */, + AB35437222F3A88000C1B2E9 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; - rootObject = ABB17D4C22D93BAB00C26D6E /* Project object */; + rootObject = AB35432B22F3A88000C1B2E9 /* Project object */; } diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample WatchKit App.xcscheme b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample WatchKit App.xcscheme deleted file mode 100644 index 7c7e35eea14..00000000000 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample WatchKit App.xcscheme +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample.xcscheme b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample.xcscheme deleted file mode 100644 index 51e4fa09792..00000000000 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m index 4a76f4c488c..2a0849df3d4 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m @@ -25,3 +25,4 @@ @implementation AppDelegate @end + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/AppIcon.appiconset/Contents.json index d8db8d65fd7..1d060ed2882 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -84,11 +84,6 @@ "idiom" : "ipad", "size" : "83.5x83.5", "scale" : "2x" - }, - { - "idiom" : "ios-marketing", - "size" : "1024x1024", - "scale" : "1x" } ], "info" : { diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/Contents.json b/src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c918..00000000000 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/LaunchScreen.storyboard b/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/LaunchScreen.storyboard index bfa36129419..f83f6fd5810 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/LaunchScreen.storyboard +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/LaunchScreen.storyboard @@ -1,5 +1,5 @@ - + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/Main.storyboard b/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/Main.storyboard index 123b8115aa4..06af18034ab 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/Main.storyboard +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m index 4bc98912bf9..49ffd668163 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m @@ -25,3 +25,4 @@ @implementation ViewController @end + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m index 2797c6f17f2..38ec506adc3 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m @@ -24,3 +24,4 @@ int main(int argc, char* argv[]) { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } + From 36af2bcce205691d87010967a4d18c3d5b000648 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Fri, 2 Aug 2019 10:12:40 -0700 Subject: [PATCH 172/661] Added build schemes --- .../xcschemes/tvOS-sample.xcscheme | 93 +++++++++++++ .../watchOS-sample-WatchKit-App.xcscheme | 129 ++++++++++++++++++ 2 files changed, 222 insertions(+) create mode 100644 src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/xcshareddata/xcschemes/tvOS-sample.xcscheme create mode 100644 src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample-WatchKit-App.xcscheme diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/xcshareddata/xcschemes/tvOS-sample.xcscheme b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/xcshareddata/xcschemes/tvOS-sample.xcscheme new file mode 100644 index 00000000000..1223d0933b4 --- /dev/null +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/xcshareddata/xcschemes/tvOS-sample.xcscheme @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample-WatchKit-App.xcscheme b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample-WatchKit-App.xcscheme new file mode 100644 index 00000000000..20a5f02ba8f --- /dev/null +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/xcshareddata/xcschemes/watchOS-sample-WatchKit-App.xcscheme @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 2aeb7dc28fa01dfbdde231c37333597782aa149a Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Fri, 2 Aug 2019 10:18:32 -0700 Subject: [PATCH 173/661] Fixed clang_format_code --- .../examples/tvOS-sample/tvOS-sample/AppDelegate.m | 1 - .../examples/tvOS-sample/tvOS-sample/ViewController.m | 7 +++---- src/objective-c/examples/tvOS-sample/tvOS-sample/main.m | 1 - .../watchOS-sample/WatchKit-Extension/ExtensionDelegate.h | 1 - .../watchOS-sample/WatchKit-Extension/ExtensionDelegate.m | 1 - .../WatchKit-Extension/InterfaceController.h | 1 - .../WatchKit-Extension/InterfaceController.m | 8 ++++---- .../examples/watchOS-sample/watchOS-sample/AppDelegate.m | 1 - .../watchOS-sample/watchOS-sample/ViewController.m | 1 - .../examples/watchOS-sample/watchOS-sample/main.m | 1 - 10 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m index 2a0849df3d4..4a76f4c488c 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/AppDelegate.m @@ -25,4 +25,3 @@ @implementation AppDelegate @end - diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m index 76f172bef0c..c94ee8c2569 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m @@ -37,10 +37,10 @@ - (void)viewDidLoad { [super viewDidLoad]; - + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; _options = options; - + _service = [[RMTTestService alloc] initWithHost:@"grpc-test.sandbox.googleapis.com" callOptions:_options]; } @@ -49,7 +49,7 @@ RMTSimpleRequest *request = [RMTSimpleRequest message]; request.responseSize = 100; GRPCUnaryProtoCall *call = - [_service unaryCallWithMessage:request responseHandler:self callOptions:nil]; + [_service unaryCallWithMessage:request responseHandler:self callOptions:nil]; [call start]; } @@ -62,4 +62,3 @@ } @end - diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m index 38ec506adc3..2797c6f17f2 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/main.m @@ -24,4 +24,3 @@ int main(int argc, char* argv[]) { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } - diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.h b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.h index df3ac1dbe2e..fbf67335f7d 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.h +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.h @@ -21,4 +21,3 @@ @interface ExtensionDelegate : NSObject @end - diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.m b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.m index d9c9951f264..b64d60256de 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.m +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/ExtensionDelegate.m @@ -21,4 +21,3 @@ @implementation ExtensionDelegate @end - diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.h b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.h index 24390ac4693..edcc75d5530 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.h +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.h @@ -22,4 +22,3 @@ @interface InterfaceController : WKInterfaceController @end - diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m index 7ed3a1a0004..3e97767cf0c 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m @@ -36,12 +36,12 @@ - (void)awakeWithContext:(id)context { [super awakeWithContext:context]; - + // Configure interface objects here. - + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; _options = options; - + _service = [[RMTTestService alloc] initWithHost:@"grpc-test.sandbox.googleapis.com" callOptions:_options]; } @@ -50,7 +50,7 @@ RMTSimpleRequest *request = [RMTSimpleRequest message]; request.responseSize = 100; GRPCUnaryProtoCall *call = - [_service unaryCallWithMessage:request responseHandler:self callOptions:nil]; + [_service unaryCallWithMessage:request responseHandler:self callOptions:nil]; [call start]; } diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m index 2a0849df3d4..4a76f4c488c 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/AppDelegate.m @@ -25,4 +25,3 @@ @implementation AppDelegate @end - diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m index 49ffd668163..4bc98912bf9 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/ViewController.m @@ -25,4 +25,3 @@ @implementation ViewController @end - diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m b/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m index 38ec506adc3..2797c6f17f2 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/main.m @@ -24,4 +24,3 @@ int main(int argc, char* argv[]) { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } - From f054bd73f48111536be316631cc7ef3d57b8c837 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Fri, 2 Aug 2019 14:47:18 -0700 Subject: [PATCH 174/661] Compensate for missing upb dependencies --- bazel/test/python_test_repo/WORKSPACE | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bazel/test/python_test_repo/WORKSPACE b/bazel/test/python_test_repo/WORKSPACE index 69d34ac933c..29bec643f96 100644 --- a/bazel/test/python_test_repo/WORKSPACE +++ b/bazel/test/python_test_repo/WORKSPACE @@ -8,3 +8,9 @@ grpc_deps() load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps") grpc_python_deps() + + +# TODO(https://github.com/grpc/grpc/issues/19835): Remove. +load("@upb//bazel:workspace_deps.bzl", "upb_deps") +upb_deps() + From 5ab60a849bbd16956df54578278a9304fd07b9c9 Mon Sep 17 00:00:00 2001 From: yang-g Date: Fri, 2 Aug 2019 14:55:11 -0700 Subject: [PATCH 175/661] dead code removal --- src/core/lib/iomgr/exec_ctx.cc | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/core/lib/iomgr/exec_ctx.cc b/src/core/lib/iomgr/exec_ctx.cc index f45def43397..a847b4dcefc 100644 --- a/src/core/lib/iomgr/exec_ctx.cc +++ b/src/core/lib/iomgr/exec_ctx.cc @@ -53,13 +53,6 @@ static void exec_ctx_sched(grpc_closure* closure, grpc_error* error) { static gpr_timespec g_start_time; -// For debug of the timer manager crash only. -// TODO (mxyan): remove after bug is fixed. -#ifdef GRPC_DEBUG_TIMER_MANAGER -extern int64_t g_start_time_sec; -extern int64_t g_start_time_nsec; -#endif // GRPC_DEBUG_TIMER_MANAGER - static grpc_millis timespec_to_millis_round_down(gpr_timespec ts) { ts = gpr_time_sub(ts, g_start_time); double x = GPR_MS_PER_SEC * static_cast(ts.tv_sec) + @@ -125,12 +118,6 @@ void ExecCtx::TestOnlyGlobalInit(gpr_timespec new_val) { void ExecCtx::GlobalInit(void) { g_start_time = gpr_now(GPR_CLOCK_MONOTONIC); - // For debug of the timer manager crash only. - // TODO (mxyan): remove after bug is fixed. -#ifdef GRPC_DEBUG_TIMER_MANAGER - g_start_time_sec = g_start_time.tv_sec; - g_start_time_nsec = g_start_time.tv_nsec; -#endif gpr_tls_init(&exec_ctx_); } From 9f6243e824247648534e05414e7253245ca135f2 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 7 Jun 2019 17:37:55 -0700 Subject: [PATCH 176/661] Add wait_for_termination method to grpc.Server --- src/python/grpcio/grpc/__init__.py | 14 ++++++++++++++ src/python/grpcio/grpc/_server.py | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index a1df5fb161c..814bfbac1bd 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -1444,6 +1444,20 @@ class Server(six.with_metaclass(abc.ABCMeta)): """ raise NotImplementedError() + def wait_for_termination(self, grace=None): + """Block current thread until the server stops. + + The wait will not consume computational resources during blocking, and it + will block indefinitely. There are two ways to unblock: + + 1) Calling `stop` on the server in another thread; + 2) The `__del__` of the server object is invoked. + + Args: + grace: A duration of time in seconds or None. + """ + raise NotImplementedError() + ################################# Functions ################################ diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index 370c81100af..70acbcd5068 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -959,6 +959,17 @@ class _Server(grpc.Server): def start(self): _start(self._state) + def wait_for_termination(self, grace=None): + termination_event = threading.Event() + + with self._state.lock: + if self._state.stage is _ServerStage.STOPPED: + raise ValueError('Failed to wait for a stopped server.') + else: + self._state.shutdown_events.append(termination_event) + + termination_event.wait() + def stop(self, grace): return _stop(self._state, grace) From 72575082947970d002f1c544470bc3ecf2899859 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Mon, 10 Jun 2019 17:41:36 -0700 Subject: [PATCH 177/661] Add a unit test for wait_for_termination --- src/python/grpcio/grpc/__init__.py | 5 +- src/python/grpcio/grpc/_server.py | 5 +- src/python/grpcio_tests/tests/tests.json | 1 + .../grpcio_tests/tests/unit/BUILD.bazel | 1 + .../unit/_server_wait_for_termination.py | 65 +++++++++++++++++++ 5 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 src/python/grpcio_tests/tests/unit/_server_wait_for_termination.py diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index 814bfbac1bd..e3f0762b77e 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -1444,7 +1444,7 @@ class Server(six.with_metaclass(abc.ABCMeta)): """ raise NotImplementedError() - def wait_for_termination(self, grace=None): + def wait_for_termination(self): """Block current thread until the server stops. The wait will not consume computational resources during blocking, and it @@ -1452,9 +1452,6 @@ class Server(six.with_metaclass(abc.ABCMeta)): 1) Calling `stop` on the server in another thread; 2) The `__del__` of the server object is invoked. - - Args: - grace: A duration of time in seconds or None. """ raise NotImplementedError() diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index 70acbcd5068..ee184adaf21 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -764,7 +764,7 @@ class _ServerState(object): self.interceptor_pipeline = interceptor_pipeline self.thread_pool = thread_pool self.stage = _ServerStage.STOPPED - self.shutdown_events = None + self.shutdown_events = [] self.maximum_concurrent_rpcs = maximum_concurrent_rpcs self.active_rpc_count = 0 @@ -876,7 +876,6 @@ def _begin_shutdown_once(state): if state.stage is _ServerStage.STARTED: state.server.shutdown(state.completion_queue, _SHUTDOWN_TAG) state.stage = _ServerStage.GRACE - state.shutdown_events = [] state.due.add(_SHUTDOWN_TAG) @@ -959,7 +958,7 @@ class _Server(grpc.Server): def start(self): _start(self._state) - def wait_for_termination(self, grace=None): + def wait_for_termination(self): termination_event = threading.Event() with self._state.lock: diff --git a/src/python/grpcio_tests/tests/tests.json b/src/python/grpcio_tests/tests/tests.json index 16ba4847bc0..7b977a42e20 100644 --- a/src/python/grpcio_tests/tests/tests.json +++ b/src/python/grpcio_tests/tests/tests.json @@ -66,6 +66,7 @@ "unit._server_ssl_cert_config_test.ServerSSLCertReloadTestWithClientAuth", "unit._server_ssl_cert_config_test.ServerSSLCertReloadTestWithoutClientAuth", "unit._server_test.ServerTest", + "unit._server_wait_for_termination.ServerWaitForTerminationTest", "unit._session_cache_test.SSLSessionCacheTest", "unit._signal_handling_test.SignalHandlingTest", "unit._version_test.VersionTest", diff --git a/src/python/grpcio_tests/tests/unit/BUILD.bazel b/src/python/grpcio_tests/tests/unit/BUILD.bazel index d21f5a59ad1..bd0826af902 100644 --- a/src/python/grpcio_tests/tests/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/BUILD.bazel @@ -33,6 +33,7 @@ GRPCIO_TESTS_UNIT = [ # "_server_ssl_cert_config_test.py", "_server_test.py", "_server_shutdown_test.py", + "_server_wait_for_termination.py", "_session_cache_test.py", ] diff --git a/src/python/grpcio_tests/tests/unit/_server_wait_for_termination.py b/src/python/grpcio_tests/tests/unit/_server_wait_for_termination.py new file mode 100644 index 00000000000..5f168c6843d --- /dev/null +++ b/src/python/grpcio_tests/tests/unit/_server_wait_for_termination.py @@ -0,0 +1,65 @@ +# Copyright 2019 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import datetime +from concurrent import futures +import unittest +import time +import threading +import six + +import grpc +from tests.unit.framework.common import test_constants + + +_WAIT_FOR_BLOCKING = datetime.timedelta(seconds=1) + + +def _block_on_waiting(server, termination_event): + server.start() + server.wait_for_termination() + termination_event.set() + +class ServerWaitForTerminationTest(unittest.TestCase): + + def test_unblock_by_invoking_stop(self): + termination_event = threading.Event() + server = grpc.server(futures.ThreadPoolExecutor()) + + wait_thread = threading.Thread(target=_block_on_waiting, args=(server, termination_event,)) + wait_thread.daemon = True + wait_thread.start() + time.sleep(_WAIT_FOR_BLOCKING.total_seconds()) + + server.stop(None) + termination_event.wait(timeout=test_constants.SHORT_TIMEOUT) + self.assertTrue(termination_event.is_set()) + + def test_unblock_by_del(self): + termination_event = threading.Event() + server = grpc.server(futures.ThreadPoolExecutor()) + + wait_thread = threading.Thread(target=_block_on_waiting, args=(server, termination_event,)) + wait_thread.daemon = True + wait_thread.start() + time.sleep(_WAIT_FOR_BLOCKING.total_seconds()) + + # Invoke manually here, in Python 2 it will be invoked by GC sometime. + server.__del__() + termination_event.wait(timeout=test_constants.SHORT_TIMEOUT) + self.assertTrue(termination_event.is_set()) + + +if __name__ == '__main__': + unittest.main(verbosity=2) From c4b7831f209071907fc640342630839eb804881e Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Tue, 11 Jun 2019 11:49:20 -0700 Subject: [PATCH 178/661] Make sanity test happy --- src/python/grpcio_tests/tests/tests.json | 2 +- src/python/grpcio_tests/tests/unit/BUILD.bazel | 2 +- ...ion.py => _server_wait_for_termination_test.py} | 14 +++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) rename src/python/grpcio_tests/tests/unit/{_server_wait_for_termination.py => _server_wait_for_termination_test.py} (86%) diff --git a/src/python/grpcio_tests/tests/tests.json b/src/python/grpcio_tests/tests/tests.json index 7b977a42e20..ab70943e5ed 100644 --- a/src/python/grpcio_tests/tests/tests.json +++ b/src/python/grpcio_tests/tests/tests.json @@ -66,7 +66,7 @@ "unit._server_ssl_cert_config_test.ServerSSLCertReloadTestWithClientAuth", "unit._server_ssl_cert_config_test.ServerSSLCertReloadTestWithoutClientAuth", "unit._server_test.ServerTest", - "unit._server_wait_for_termination.ServerWaitForTerminationTest", + "unit._server_wait_for_termination_test.ServerWaitForTerminationTest", "unit._session_cache_test.SSLSessionCacheTest", "unit._signal_handling_test.SignalHandlingTest", "unit._version_test.VersionTest", diff --git a/src/python/grpcio_tests/tests/unit/BUILD.bazel b/src/python/grpcio_tests/tests/unit/BUILD.bazel index bd0826af902..28336703845 100644 --- a/src/python/grpcio_tests/tests/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/BUILD.bazel @@ -33,7 +33,7 @@ GRPCIO_TESTS_UNIT = [ # "_server_ssl_cert_config_test.py", "_server_test.py", "_server_shutdown_test.py", - "_server_wait_for_termination.py", + "_server_wait_for_termination_test.py", "_session_cache_test.py", ] diff --git a/src/python/grpcio_tests/tests/unit/_server_wait_for_termination.py b/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py similarity index 86% rename from src/python/grpcio_tests/tests/unit/_server_wait_for_termination.py rename to src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py index 5f168c6843d..6a07dc7e3a4 100644 --- a/src/python/grpcio_tests/tests/unit/_server_wait_for_termination.py +++ b/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py @@ -22,7 +22,6 @@ import six import grpc from tests.unit.framework.common import test_constants - _WAIT_FOR_BLOCKING = datetime.timedelta(seconds=1) @@ -31,13 +30,18 @@ def _block_on_waiting(server, termination_event): server.wait_for_termination() termination_event.set() + class ServerWaitForTerminationTest(unittest.TestCase): def test_unblock_by_invoking_stop(self): termination_event = threading.Event() server = grpc.server(futures.ThreadPoolExecutor()) - wait_thread = threading.Thread(target=_block_on_waiting, args=(server, termination_event,)) + wait_thread = threading.Thread( + target=_block_on_waiting, args=( + server, + termination_event, + )) wait_thread.daemon = True wait_thread.start() time.sleep(_WAIT_FOR_BLOCKING.total_seconds()) @@ -50,7 +54,11 @@ class ServerWaitForTerminationTest(unittest.TestCase): termination_event = threading.Event() server = grpc.server(futures.ThreadPoolExecutor()) - wait_thread = threading.Thread(target=_block_on_waiting, args=(server, termination_event,)) + wait_thread = threading.Thread( + target=_block_on_waiting, args=( + server, + termination_event, + )) wait_thread.daemon = True wait_thread.start() time.sleep(_WAIT_FOR_BLOCKING.total_seconds()) From 8f6ee973451481d2eec87c01109e581c443f18eb Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 12 Jun 2019 15:34:30 -0700 Subject: [PATCH 179/661] "EXPERIMENTAL API" added in docstring --- src/python/grpcio/grpc/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index e3f0762b77e..d5fe01e4c88 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -1447,6 +1447,8 @@ class Server(six.with_metaclass(abc.ABCMeta)): def wait_for_termination(self): """Block current thread until the server stops. + This is an EXPERIMENTAL API. + The wait will not consume computational resources during blocking, and it will block indefinitely. There are two ways to unblock: From 59555d5b0ca4e1a46d6f087cac5a94e004b5df47 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 13 Jun 2019 15:48:30 -0700 Subject: [PATCH 180/661] Add timeout argument to wait_for_termination --- src/python/grpcio/grpc/__init__.py | 17 ++++++++++---- src/python/grpcio/grpc/_server.py | 6 ++--- .../unit/_server_wait_for_termination_test.py | 23 +++++++++++++++++-- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index d5fe01e4c88..e9622b4d44c 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -1444,16 +1444,23 @@ class Server(six.with_metaclass(abc.ABCMeta)): """ raise NotImplementedError() - def wait_for_termination(self): + def wait_for_termination(self, timeout=None): """Block current thread until the server stops. This is an EXPERIMENTAL API. - The wait will not consume computational resources during blocking, and it - will block indefinitely. There are two ways to unblock: + The wait will not consume computational resources during blocking, and + it will block until one of the two following conditions are met: - 1) Calling `stop` on the server in another thread; - 2) The `__del__` of the server object is invoked. + 1) The server is stopped or terminated; + 2) A timeout occurs if timeout is not `None`. + + The timeout argument works in the same way as `threading.Event.wait()`. + https://docs.python.org/3/library/threading.html#threading.Event.wait + + Args: + timeout: A floating point number specifying a timeout for the + operation in seconds. """ raise NotImplementedError() diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index ee184adaf21..063b16b4791 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -958,16 +958,16 @@ class _Server(grpc.Server): def start(self): _start(self._state) - def wait_for_termination(self): + def wait_for_termination(self, timeout=None): termination_event = threading.Event() with self._state.lock: if self._state.stage is _ServerStage.STOPPED: - raise ValueError('Failed to wait for a stopped server.') + return else: self._state.shutdown_events.append(termination_event) - termination_event.wait() + termination_event.wait(timeout=timeout) def stop(self, grace): return _stop(self._state, grace) diff --git a/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py b/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py index 6a07dc7e3a4..c5c1f6da38e 100644 --- a/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py +++ b/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import division + import datetime from concurrent import futures import unittest @@ -25,9 +27,9 @@ from tests.unit.framework.common import test_constants _WAIT_FOR_BLOCKING = datetime.timedelta(seconds=1) -def _block_on_waiting(server, termination_event): +def _block_on_waiting(server, termination_event, timeout=None): server.start() - server.wait_for_termination() + server.wait_for_termination(timeout=timeout) termination_event.set() @@ -68,6 +70,23 @@ class ServerWaitForTerminationTest(unittest.TestCase): termination_event.wait(timeout=test_constants.SHORT_TIMEOUT) self.assertTrue(termination_event.is_set()) + def test_unblock_by_timeout(self): + termination_event = threading.Event() + server = grpc.server(futures.ThreadPoolExecutor()) + + wait_thread = threading.Thread( + target=_block_on_waiting, + args=( + server, + termination_event, + test_constants.SHORT_TIMEOUT / 2, + )) + wait_thread.daemon = True + wait_thread.start() + + termination_event.wait(timeout=test_constants.SHORT_TIMEOUT) + self.assertTrue(termination_event.is_set()) + if __name__ == '__main__': unittest.main(verbosity=2) From 518b55a433d95e8955fd6149151ae538c1fd6364 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 13 Jun 2019 16:14:19 -0700 Subject: [PATCH 181/661] Simplify implementation --- examples/python/helloworld/greeter_server.py | 7 ++----- src/python/grpcio/grpc/__init__.py | 3 +++ src/python/grpcio/grpc/_server.py | 13 +++---------- .../tests/unit/_server_wait_for_termination_test.py | 5 +++++ 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/examples/python/helloworld/greeter_server.py b/examples/python/helloworld/greeter_server.py index e3b4f2c1ff9..a9f55e593c5 100644 --- a/examples/python/helloworld/greeter_server.py +++ b/examples/python/helloworld/greeter_server.py @@ -36,11 +36,8 @@ def serve(): helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server) server.add_insecure_port('[::]:50051') server.start() - try: - while True: - time.sleep(_ONE_DAY_IN_SECONDS) - except KeyboardInterrupt: - server.stop(0) + + server.wait_for_termination() if __name__ == '__main__': diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index e9622b4d44c..7dae90c89e8 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -1461,6 +1461,9 @@ class Server(six.with_metaclass(abc.ABCMeta)): Args: timeout: A floating point number specifying a timeout for the operation in seconds. + + Returns: + A bool indicates if the operation times out. """ raise NotImplementedError() diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index 063b16b4791..6320c4d8fef 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -764,7 +764,8 @@ class _ServerState(object): self.interceptor_pipeline = interceptor_pipeline self.thread_pool = thread_pool self.stage = _ServerStage.STOPPED - self.shutdown_events = [] + self.termination_event = threading.Event() + self.shutdown_events = [self.termination_event] self.maximum_concurrent_rpcs = maximum_concurrent_rpcs self.active_rpc_count = 0 @@ -959,15 +960,7 @@ class _Server(grpc.Server): _start(self._state) def wait_for_termination(self, timeout=None): - termination_event = threading.Event() - - with self._state.lock: - if self._state.stage is _ServerStage.STOPPED: - return - else: - self._state.shutdown_events.append(termination_event) - - termination_event.wait(timeout=timeout) + return self._state.termination_event.wait(timeout=timeout) def stop(self, grace): return _stop(self._state, grace) diff --git a/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py b/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py index c5c1f6da38e..cdd1067ee10 100644 --- a/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py +++ b/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py @@ -87,6 +87,11 @@ class ServerWaitForTerminationTest(unittest.TestCase): termination_event.wait(timeout=test_constants.SHORT_TIMEOUT) self.assertTrue(termination_event.is_set()) + def test_just_block(self): + server = grpc.server(futures.ThreadPoolExecutor()) + server.start() + server.wait_for_termination(timeout=-1) + if __name__ == '__main__': unittest.main(verbosity=2) From 42e8bd21b4c3ebd2bc39ba3f13d5578fd4c40a79 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 13 Jun 2019 17:19:33 -0700 Subject: [PATCH 182/661] Add a workaround for CPython issue 35935 --- src/python/grpcio/grpc/_server.py | 6 ++++++ .../tests/unit/_server_wait_for_termination_test.py | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index 6320c4d8fef..7fe1b23075b 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -50,6 +50,7 @@ _CANCELLED = 'cancelled' _EMPTY_FLAGS = 0 _DEALLOCATED_SERVER_CHECK_PERIOD_S = 1.0 +_INF_TIMEOUT = 1e9 def _serialized_request(request_event): @@ -960,6 +961,11 @@ class _Server(grpc.Server): _start(self._state) def wait_for_termination(self, timeout=None): + # TODO(https://bugs.python.org/issue35935) + # Remove this workaround once threading.Event.wait() is working with + # CTRL+C across platforms. + if timeout is None: + timeout = _INF_TIMEOUT return self._state.termination_event.wait(timeout=timeout) def stop(self, grace): diff --git a/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py b/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py index cdd1067ee10..c5c1f6da38e 100644 --- a/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py +++ b/src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py @@ -87,11 +87,6 @@ class ServerWaitForTerminationTest(unittest.TestCase): termination_event.wait(timeout=test_constants.SHORT_TIMEOUT) self.assertTrue(termination_event.is_set()) - def test_just_block(self): - server = grpc.server(futures.ThreadPoolExecutor()) - server.start() - server.wait_for_termination(timeout=-1) - if __name__ == '__main__': unittest.main(verbosity=2) From 1e62124cfb3b3c30cc10a9f8fb1ff25ee2e4aa56 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 26 Jun 2019 09:52:39 -0700 Subject: [PATCH 183/661] Revert changes to helloworld example --- examples/python/helloworld/greeter_server.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/python/helloworld/greeter_server.py b/examples/python/helloworld/greeter_server.py index a9f55e593c5..e3b4f2c1ff9 100644 --- a/examples/python/helloworld/greeter_server.py +++ b/examples/python/helloworld/greeter_server.py @@ -36,8 +36,11 @@ def serve(): helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server) server.add_insecure_port('[::]:50051') server.start() - - server.wait_for_termination() + try: + while True: + time.sleep(_ONE_DAY_IN_SECONDS) + except KeyboardInterrupt: + server.stop(0) if __name__ == '__main__': From e2ebdc794d409ff7eca9c0f158008e058390167a Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Thu, 25 Jul 2019 17:38:47 -0700 Subject: [PATCH 184/661] Fixed time_change_test flakes --- test/cpp/end2end/time_change_test.cc | 100 ++++++--------------------- 1 file changed, 21 insertions(+), 79 deletions(-) diff --git a/test/cpp/end2end/time_change_test.cc b/test/cpp/end2end/time_change_test.cc index 688549e5772..a42b7bf6498 100644 --- a/test/cpp/end2end/time_change_test.cc +++ b/test/cpp/end2end/time_change_test.cc @@ -129,25 +129,34 @@ class TimeChangeTest : public ::testing::Test { protected: TimeChangeTest() {} - void SetUp() { + static void SetUpTestCase() { auto port = grpc_pick_unused_port_or_die(); std::ostringstream addr_stream; addr_stream << "localhost:" << port; - auto addr = addr_stream.str(); + server_address_ = addr_stream.str(); server_.reset(new SubProcess({ g_root + "/client_crash_test_server", - "--address=" + addr, + "--address=" + server_address_, })); GPR_ASSERT(server_); - channel_ = grpc::CreateChannel(addr, InsecureChannelCredentials()); + // connect to server and make sure it's reachable. + auto channel = + grpc::CreateChannel(server_address_, InsecureChannelCredentials()); + GPR_ASSERT(channel); + EXPECT_TRUE(channel->WaitForConnected( + grpc_timeout_milliseconds_to_deadline(30000))); + } + + static void TearDownTestCase() { server_.reset(); } + + void SetUp() { + channel_ = + grpc::CreateChannel(server_address_, InsecureChannelCredentials()); GPR_ASSERT(channel_); stub_ = grpc::testing::EchoTestService::NewStub(channel_); } - void TearDown() { - server_.reset(); - reset_now_offset(); - } + void TearDown() { reset_now_offset(); } std::unique_ptr CreateStub() { return grpc::testing::EchoTestService::NewStub(channel_); @@ -159,10 +168,13 @@ class TimeChangeTest : public ::testing::Test { const int TIME_OFFSET2 = 5678; private: - std::unique_ptr server_; + static std::string server_address_; + static std::unique_ptr server_; std::shared_ptr channel_; std::unique_ptr stub_; }; +std::string TimeChangeTest::server_address_; +std::unique_ptr TimeChangeTest::server_; // Wall-clock time jumps forward on client before bidi stream is created TEST_F(TimeChangeTest, TimeJumpForwardBeforeStreamCreated) { @@ -283,76 +295,6 @@ TEST_F(TimeChangeTest, TimeJumpBackAfterStreamCreated) { EXPECT_TRUE(status.ok()); } -// Wall-clock time jumps forward on client before connection to server is up -TEST_F(TimeChangeTest, TimeJumpForwardBeforeServerConnect) { - EchoRequest request; - EchoResponse response; - ClientContext context; - context.set_deadline(grpc_timeout_milliseconds_to_deadline(5000)); - context.AddMetadata(kServerResponseStreamsToSend, "2"); - - auto channel = GetChannel(); - GPR_ASSERT(channel); - - // time jumps forward by TIME_OFFSET2 milliseconds - set_now_offset(TIME_OFFSET2); - - auto ret = - channel->WaitForConnected(grpc_timeout_milliseconds_to_deadline(5000)); - // We use monotonic clock for pthread_cond_timedwait() deadline on linux, and - // realtime clock on other platforms - see gpr_cv_wait() in sync_posix.cc. - // So changes in system clock affect deadlines on non-linux platforms -#ifdef GPR_LINUX - EXPECT_TRUE(ret); - auto stub = CreateStub(); - auto stream = stub->BidiStream(&context); - - request.set_message("Hello"); - EXPECT_TRUE(stream->Write(request)); - EXPECT_TRUE(stream->Read(&response)); - request.set_message("World"); - EXPECT_TRUE(stream->Write(request)); - EXPECT_TRUE(stream->WritesDone()); - EXPECT_TRUE(stream->Read(&response)); - - auto status = stream->Finish(); - EXPECT_TRUE(status.ok()); -#else - EXPECT_FALSE(ret); -#endif -} - -// Wall-clock time jumps back on client before connection to server is up -TEST_F(TimeChangeTest, TimeJumpBackBeforeServerConnect) { - EchoRequest request; - EchoResponse response; - ClientContext context; - context.set_deadline(grpc_timeout_milliseconds_to_deadline(5000)); - context.AddMetadata(kServerResponseStreamsToSend, "2"); - - auto channel = GetChannel(); - GPR_ASSERT(channel); - - // time jumps back by TIME_OFFSET2 milliseconds - set_now_offset(-TIME_OFFSET2); - - EXPECT_TRUE( - channel->WaitForConnected(grpc_timeout_milliseconds_to_deadline(5000))); - auto stub = CreateStub(); - auto stream = stub->BidiStream(&context); - - request.set_message("Hello"); - EXPECT_TRUE(stream->Write(request)); - EXPECT_TRUE(stream->Read(&response)); - request.set_message("World"); - EXPECT_TRUE(stream->Write(request)); - EXPECT_TRUE(stream->WritesDone()); - EXPECT_TRUE(stream->Read(&response)); - - auto status = stream->Finish(); - EXPECT_TRUE(status.ok()); -} - // Wall-clock time jumps forward and backwards during call TEST_F(TimeChangeTest, TimeJumpForwardAndBackDuringCall) { EchoRequest request; From 66114201b45f805278c632906c7bc0366482b07f Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Fri, 2 Aug 2019 15:11:06 -0700 Subject: [PATCH 185/661] Modernize cancellation example --- examples/python/cancellation/BUILD.bazel | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/examples/python/cancellation/BUILD.bazel b/examples/python/cancellation/BUILD.bazel index 81cd3a881b8..41b394a07a2 100644 --- a/examples/python/cancellation/BUILD.bazel +++ b/examples/python/cancellation/BUILD.bazel @@ -15,7 +15,7 @@ # limitations under the License. load("@grpc_python_dependencies//:requirements.bzl", "requirement") -load("//bazel:python_rules.bzl", "py_proto_library") +load("//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library") package(default_testonly = 1) @@ -25,9 +25,14 @@ proto_library( ) py_proto_library( - name = "hash_name_proto_pb2", - deps = [":hash_name_proto"], - well_known_protos = False, + name = "hash_name_py_pb2", + srcs = [":hash_name_proto"], +) + +py_grpc_library( + name = "hash_name_py_pb2_grpc", + srcs = [":hash_name_proto"], + deps = [":hash_name_py_pb2"], ) py_binary( @@ -35,8 +40,9 @@ py_binary( srcs = ["client.py"], deps = [ "//src/python/grpcio/grpc:grpcio", - ":hash_name_proto_pb2", - requirement("six"), + ":hash_name_py_pb2", + ":hash_name_py_pb2_grpc", + "//external:six" ], srcs_version = "PY2AND3", ) @@ -46,7 +52,7 @@ py_library( srcs = ["search.py"], srcs_version = "PY2AND3", deps = [ - ":hash_name_proto_pb2", + ":hash_name_py_pb2", ], ) @@ -55,10 +61,10 @@ py_binary( srcs = ["server.py"], deps = [ "//src/python/grpcio/grpc:grpcio", - ":hash_name_proto_pb2", + ":hash_name_py_pb2", ":search", ] + select({ - "//conditions:default": [requirement("futures")], + "//conditions:default": ["@futures//:futures"], "//:python3": [], }), srcs_version = "PY2AND3", From 3e84f47d3fbbc4042683adf7b5203d2a4be8a68a Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 2 Aug 2019 15:09:03 -0700 Subject: [PATCH 186/661] Apply the spin wait mechansim --- src/python/grpcio/grpc/_server.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index 7fe1b23075b..99255432eb4 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -961,12 +961,13 @@ class _Server(grpc.Server): _start(self._state) def wait_for_termination(self, timeout=None): - # TODO(https://bugs.python.org/issue35935) + # NOTE(https://bugs.python.org/issue35935) # Remove this workaround once threading.Event.wait() is working with # CTRL+C across platforms. - if timeout is None: - timeout = _INF_TIMEOUT - return self._state.termination_event.wait(timeout=timeout) + return _common.wait( + self._state.termination_event.wait, + self._state.termination_event.is_set, + timeout=timeout) def stop(self, grace): return _stop(self._state, grace) From 0c94e5b2f61e0728bde58c093f17f4797fe5d674 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Fri, 2 Aug 2019 15:52:42 -0700 Subject: [PATCH 187/661] Remove ref and unref on keep reading --- src/core/ext/transport/chttp2/transport/chttp2_transport.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 16146569886..633b35e7d61 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -2591,7 +2591,6 @@ static void read_action_locked(void* tp, grpc_error* error) { t->endpoint_reading = 0; } else if (t->closed_with_error == GRPC_ERROR_NONE) { keep_reading = true; - GRPC_CHTTP2_REF_TRANSPORT(t, "keep_reading"); /* Since we have read a byte, reset the keepalive timer */ if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) { grpc_timer_cancel(&t->keepalive_ping_timer); @@ -2604,7 +2603,6 @@ static void read_action_locked(void* tp, grpc_error* error) { grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent); grpc_chttp2_act_on_flowctl_action(t->flow_control->MakeAction(), t, nullptr); - GRPC_CHTTP2_UNREF_TRANSPORT(t, "keep_reading"); } else { GRPC_CHTTP2_UNREF_TRANSPORT(t, "reading_action"); } From e89096cdf2b6dab56f5c1e910ac3c38361886dcd Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Fri, 2 Aug 2019 16:04:59 -0700 Subject: [PATCH 188/661] AAAAAAAHHHHHH --- bazel/test/python_test_repo/WORKSPACE | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bazel/test/python_test_repo/WORKSPACE b/bazel/test/python_test_repo/WORKSPACE index 29bec643f96..0bc58045693 100644 --- a/bazel/test/python_test_repo/WORKSPACE +++ b/bazel/test/python_test_repo/WORKSPACE @@ -9,8 +9,12 @@ grpc_deps() load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps") grpc_python_deps() - # TODO(https://github.com/grpc/grpc/issues/19835): Remove. load("@upb//bazel:workspace_deps.bzl", "upb_deps") upb_deps() +load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies") +apple_rules_dependencies() + +load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") +apple_support_dependencies() From d5191a5f8bee46762285b2668c19890390351001 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Sat, 3 Aug 2019 01:44:02 +0200 Subject: [PATCH 189/661] Adding src/core/ext/upb-generated in our include path. This enables us to build both from Bazel and make. --- Makefile | 2 +- templates/Makefile.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3cef3bc5e10..fd9d5521a17 100644 --- a/Makefile +++ b/Makefile @@ -370,7 +370,7 @@ CPPFLAGS += -fPIC LDFLAGS += -fPIC endif -INCLUDES = . include $(GENDIR) third_party/upb third_party/upb/generated_for_cmake +INCLUDES = . include $(GENDIR) third_party/upb third_party/upb/generated_for_cmake src/core/ext/upb-generated LDFLAGS += -Llibs/$(CONFIG) ifeq ($(SYSTEM),Darwin) diff --git a/templates/Makefile.template b/templates/Makefile.template index a46a27061ab..21e1b6cd01c 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -240,7 +240,7 @@ LDFLAGS += -fPIC endif - INCLUDES = . include $(GENDIR) third_party/upb third_party/upb/generated_for_cmake + INCLUDES = . include $(GENDIR) third_party/upb third_party/upb/generated_for_cmake src/core/ext/upb-generated LDFLAGS += -Llibs/$(CONFIG) ifeq ($(SYSTEM),Darwin) From 28ed900adca35ca2583d1b4144cf9a5ff3105b9d Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Fri, 2 Aug 2019 17:41:35 -0700 Subject: [PATCH 190/661] Increased timeout limit --- tools/run_tests/run_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index db75d884aa9..2a4ec8ce156 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1115,7 +1115,7 @@ class ObjCLanguage(object): out.append( self.config.job_spec( ['src/objective-c/tests/build_one_example.sh'], - timeout_seconds=10 * 60, + timeout_seconds=20 * 60, shortname='ios-buildtest-example-watchOS-sample', cpu_cost=1e6, environ={ @@ -1126,7 +1126,7 @@ class ObjCLanguage(object): out.append( self.config.job_spec( ['src/objective-c/tests/build_one_example.sh'], - timeout_seconds=10 * 60, + timeout_seconds=20 * 60, shortname='ios-buildtest-example-watchOS-sample-framework', cpu_cost=1e6, environ={ From a1477e8b7e5e0141456d549888b1bf41911320e1 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 5 Aug 2019 10:14:30 -0700 Subject: [PATCH 191/661] Fix uninitialized memory in sockaddr utils --- src/core/lib/iomgr/sockaddr_utils.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/lib/iomgr/sockaddr_utils.cc b/src/core/lib/iomgr/sockaddr_utils.cc index baadf1da99e..2f8ed2225a6 100644 --- a/src/core/lib/iomgr/sockaddr_utils.cc +++ b/src/core/lib/iomgr/sockaddr_utils.cc @@ -201,13 +201,11 @@ int grpc_sockaddr_to_string(char** out, } void grpc_string_to_sockaddr(grpc_resolved_address* out, char* addr, int port) { + memset(out, 0, sizeof(grpc_resolved_address)); grpc_sockaddr_in6* addr6 = (grpc_sockaddr_in6*)out->addr; grpc_sockaddr_in* addr4 = (grpc_sockaddr_in*)out->addr; - if (grpc_inet_pton(GRPC_AF_INET6, addr, &addr6->sin6_addr) == 1) { addr6->sin6_family = GRPC_AF_INET6; - addr6->sin6_flowinfo = 0; - addr6->sin6_scope_id = 0; out->len = sizeof(grpc_sockaddr_in6); } else if (grpc_inet_pton(GRPC_AF_INET, addr, &addr4->sin_addr) == 1) { addr4->sin_family = GRPC_AF_INET; From 4c23c6f22a108cd7be029dfbe2eef92711833f65 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 5 Aug 2019 11:20:53 -0700 Subject: [PATCH 192/661] Fix ServerAddress move assignment --- src/core/ext/filters/client_channel/server_address.cc | 4 +--- src/core/ext/filters/client_channel/server_address.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/ext/filters/client_channel/server_address.cc b/src/core/ext/filters/client_channel/server_address.cc index 31c0edaca17..d46896b754b 100644 --- a/src/core/ext/filters/client_channel/server_address.cc +++ b/src/core/ext/filters/client_channel/server_address.cc @@ -20,8 +20,6 @@ #include "src/core/ext/filters/client_channel/server_address.h" -#include - namespace grpc_core { // @@ -39,7 +37,7 @@ ServerAddress::ServerAddress(const void* address, size_t address_len, address_.len = static_cast(address_len); } -bool ServerAddress::operator==(const grpc_core::ServerAddress& other) const { +bool ServerAddress::operator==(const ServerAddress& other) const { return address_.len == other.address_.len && memcmp(address_.addr, other.address_.addr, address_.len) == 0 && grpc_channel_args_compare(args_, other.args_) == 0; diff --git a/src/core/ext/filters/client_channel/server_address.h b/src/core/ext/filters/client_channel/server_address.h index 1b68a59ed85..acd71358810 100644 --- a/src/core/ext/filters/client_channel/server_address.h +++ b/src/core/ext/filters/client_channel/server_address.h @@ -24,7 +24,6 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/iomgr/resolve_address.h" -#include "src/core/lib/uri/uri_parser.h" // Channel arg key for a bool indicating whether an address is a grpclb // load balancer (as opposed to a backend). @@ -68,6 +67,7 @@ class ServerAddress { } ServerAddress& operator=(ServerAddress&& other) { address_ = other.address_; + grpc_channel_args_destroy(args_); args_ = other.args_; other.args_ = nullptr; return *this; From 3638167e4092cb72b45c07888fa81a6a2016ce90 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 5 Aug 2019 12:57:50 -0700 Subject: [PATCH 193/661] Call grpc_python_deps() from grpc_deps(). --- WORKSPACE | 6 +----- bazel/grpc_deps.bzl | 8 +++++++- bazel/test/python_test_repo/WORKSPACE | 3 --- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 3f7911b0a22..523b0153d7b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -39,10 +39,6 @@ rbe_autoconfig( ), ) -load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps") -grpc_python_deps() - - load("@io_bazel_rules_python//python:pip.bzl", "pip_repositories", "pip_import") pip_import( @@ -70,4 +66,4 @@ load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependenci apple_rules_dependencies() load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") -apple_support_dependencies() \ No newline at end of file +apple_support_dependencies() diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index cce2f88fe87..f9e84065b73 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -2,6 +2,8 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps") + def grpc_deps(): """Loads dependencies need to compile and test the grpc library.""" @@ -231,7 +233,10 @@ def grpc_deps(): remote = "https://github.com/bazelbuild/rules_apple.git", tag = "0.17.2", ) - + + grpc_python_deps() + + # TODO: move some dependencies from "grpc_deps" here? def grpc_test_only_deps(): """Internal, not intended for use by packages that are consuming grpc. @@ -290,3 +295,4 @@ def grpc_test_only_deps(): url = "https://github.com/twisted/constantly/archive/15.1.0.zip", build_file = "@com_github_grpc_grpc//third_party:constantly.BUILD", ) + diff --git a/bazel/test/python_test_repo/WORKSPACE b/bazel/test/python_test_repo/WORKSPACE index 0bc58045693..f8a00c88283 100644 --- a/bazel/test/python_test_repo/WORKSPACE +++ b/bazel/test/python_test_repo/WORKSPACE @@ -6,9 +6,6 @@ local_repository( load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") grpc_deps() -load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps") -grpc_python_deps() - # TODO(https://github.com/grpc/grpc/issues/19835): Remove. load("@upb//bazel:workspace_deps.bzl", "upb_deps") upb_deps() From 024a864209cc078f54d4f3d9ded91571a2e75767 Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Mon, 5 Aug 2019 14:11:03 -0700 Subject: [PATCH 194/661] Added kokoro config to run grpc_basictests_cpp_ios as part of presubmit --- .../pull_request/grpc_basictests_cpp_ios.cfg | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tools/internal_ci/macos/pull_request/grpc_basictests_cpp_ios.cfg diff --git a/tools/internal_ci/macos/pull_request/grpc_basictests_cpp_ios.cfg b/tools/internal_ci/macos/pull_request/grpc_basictests_cpp_ios.cfg new file mode 100644 index 00000000000..f831aba3b94 --- /dev/null +++ b/tools/internal_ci/macos/pull_request/grpc_basictests_cpp_ios.cfg @@ -0,0 +1,31 @@ +# Copyright 2019 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/macos/grpc_run_tests_matrix.sh" +gfile_resources: "/bigstore/grpc-testing-secrets/gcp_credentials/GrpcTesting-d0eeee2db331.json" +timeout_mins: 120 +action { + define_artifacts { + regex: "**/*sponge_log.*" + regex: "github/grpc/reports/**" + } +} + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-f basictests macos objc opt --internal_ci -j 1 --inner_jobs 4 --extra_args -r ios-cpp-test-.*" +} From 37b6c8cefd1e59fa700d7986456aa40d04e79677 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 5 Aug 2019 14:18:52 -0700 Subject: [PATCH 195/661] Fix sanity check --- tools/run_tests/sanity/check_bazel_workspace.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/run_tests/sanity/check_bazel_workspace.py b/tools/run_tests/sanity/check_bazel_workspace.py index 4ddbc74646f..40a4f5b4fd2 100755 --- a/tools/run_tests/sanity/check_bazel_workspace.py +++ b/tools/run_tests/sanity/check_bazel_workspace.py @@ -115,6 +115,9 @@ class BazelEvalState(object): return self.names_and_urls[args['name']] = args['remote'] + def grpc_python_deps(self): + pass + # Parse git hashes from bazel/grpc_deps.bzl {new_}http_archive rules with open(os.path.join('bazel', 'grpc_deps.bzl'), 'r') as f: @@ -131,6 +134,7 @@ build_rules = { 'http_archive': lambda **args: eval_state.http_archive(**args), 'load': lambda a, b: None, 'git_repository': lambda **args: eval_state.git_repository(**args), + 'grpc_python_deps': lambda: None, } exec bazel_file in build_rules for name in _GRPC_DEP_NAMES: @@ -173,6 +177,7 @@ for name in _GRPC_DEP_NAMES: 'http_archive': lambda **args: state.http_archive(**args), 'load': lambda a, b: None, 'git_repository': lambda **args: state.git_repository(**args), + 'grpc_python_deps': lambda *args, **kwargs: None, } exec bazel_file in rules assert name not in names_and_urls_with_overridden_name.keys() From dab3bdde61ab84c7ed6efc780477b4a2c76b9591 Mon Sep 17 00:00:00 2001 From: Yihua Zhang Date: Mon, 5 Aug 2019 14:42:50 -0700 Subject: [PATCH 196/661] recongize URI and email address SAN fields --- src/core/tsi/ssl_transport_security.cc | 18 +++++++++---- src/core/tsi/ssl_transport_security.h | 4 +++ src/core/tsi/test_creds/multi-domain.key | 27 ++++++++++++++++++++ src/core/tsi/test_creds/multi-domain.pem | 23 +++++++++++++++++ test/core/tsi/ssl_transport_security_test.cc | 21 +++++++++++++++ 5 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 src/core/tsi/test_creds/multi-domain.key create mode 100644 src/core/tsi/test_creds/multi-domain.pem diff --git a/src/core/tsi/ssl_transport_security.cc b/src/core/tsi/ssl_transport_security.cc index d3c8982c847..f3982fa1caa 100644 --- a/src/core/tsi/ssl_transport_security.cc +++ b/src/core/tsi/ssl_transport_security.cc @@ -350,11 +350,19 @@ static tsi_result add_subject_alt_names_properties_to_peer( for (i = 0; i < subject_alt_name_count; i++) { GENERAL_NAME* subject_alt_name = sk_GENERAL_NAME_value(subject_alt_names, TSI_SIZE_AS_SIZE(i)); - /* Filter out the non-dns entries names. */ - if (subject_alt_name->type == GEN_DNS) { + if (subject_alt_name->type == GEN_DNS || + subject_alt_name->type == GEN_EMAIL || + subject_alt_name->type == GEN_URI) { unsigned char* name = nullptr; int name_size; - name_size = ASN1_STRING_to_UTF8(&name, subject_alt_name->d.dNSName); + if (subject_alt_name->type == GEN_DNS) { + name_size = ASN1_STRING_to_UTF8(&name, subject_alt_name->d.dNSName); + } else if (subject_alt_name->type == GEN_EMAIL) { + name_size = ASN1_STRING_to_UTF8(&name, subject_alt_name->d.rfc822Name); + } else { + name_size = ASN1_STRING_to_UTF8( + &name, subject_alt_name->d.uniformResourceIdentifier); + } if (name_size < 0) { gpr_log(GPR_ERROR, "Could not get utf8 from asn1 string."); result = TSI_INTERNAL_ERROR; @@ -703,8 +711,8 @@ static tsi_result populate_ssl_context( } /* Extracts the CN and the SANs from an X509 cert as a peer object. */ -static tsi_result extract_x509_subject_names_from_pem_cert(const char* pem_cert, - tsi_peer* peer) { +tsi_result extract_x509_subject_names_from_pem_cert(const char* pem_cert, + tsi_peer* peer) { tsi_result result = TSI_OK; X509* cert = nullptr; BIO* pem; diff --git a/src/core/tsi/ssl_transport_security.h b/src/core/tsi/ssl_transport_security.h index 0203141e56e..638c088442c 100644 --- a/src/core/tsi/ssl_transport_security.h +++ b/src/core/tsi/ssl_transport_security.h @@ -332,4 +332,8 @@ const tsi_ssl_handshaker_factory_vtable* tsi_ssl_handshaker_factory_swap_vtable( tsi_ssl_handshaker_factory* factory, tsi_ssl_handshaker_factory_vtable* new_vtable); +/* Exposed for testing only. */ +tsi_result extract_x509_subject_names_from_pem_cert(const char* pem_cert, + tsi_peer* peer); + #endif /* GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/test_creds/multi-domain.key b/src/core/tsi/test_creds/multi-domain.key new file mode 100644 index 00000000000..59008191888 --- /dev/null +++ b/src/core/tsi/test_creds/multi-domain.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEA1e+GwyVNsoKu7PqvOf/EubN45rB5o5PQF9A5fBPpiBtKZdvb +bOouGlulRwaMQOLDZi9M6l/AhE1b207+iSBTn9jSQT0elaYwVtKgb/qoehQjFAG8 +BckPmA9E4SDx2Ug9AtV3rTVs4V2yaDHNSfDSXQ2PS9fuIx7FK5mMnUM2fjskcZqu +HV5f8McXEtvpuTktnb+KDgETO0Cdu3+rf/RtraTuKZb0kmAgf+KaNWDL2j5QsFKa +6sT4812Vfwaevm9qKOtzgAFobCwdVt+Ap/B0XWj4CmzJMPN/SXESluoBHszmTi6Q +mkTEzYbzmD/ObyTxXVKu46kRVmJKXh6BE1wk2QIDAQABAoIBAQDPpS8OFhT14LXc +Oez9xGyzOaltb3iA9qURl/9TmRggDS0G9IBjlGCvIKio6YgUKoUxl1N2YP3A7Dzt +/hw8CG5iRda9j48x/R4KB2HFjmscIpNxhcVzcBV8p8VZJdrX5K+jIoKIUcSecY0K +aNwymlX0D4c4PBtdZy5FBUJgGa64kPQqd+1Ha4cKgD9+oZzSo5Me04cGV7gWqBGt +qY9KL9j8RGA5m+CHu4Qi2ZXnFlkeH/teXuH5AhFzxeYZG4ZwtXCTjNXxQelVNbYw +mIOnADvd+RhJoeLZnGdM/gyFfLpJW6rtqva9l4h2qxKxnO3CcYHwac475wE49ukv +qx027fopAoGBAPTXRsXRHnK+ZZbj1mafFXeM4G+f8QMLxaSP/za6uYKd1BihXurr +NUhYCQ+d6E+HXnCsYQcfR4AMTSqZRA2XImW4ZW8HRog+OBOn9LDaRcvqlqenKs/Z +IoOUqaqVTqNF2ukkH4usnBugPvdxiqtIGXCBFlS0st+PwIoBtRYD0u6bAoGBAN+v +qElfO/LOjzYWsV6bUSxWRp1XFnfxujitkcYbai+AnBITvZ6BcPfcATQ9IIp42HKk +vQ5PVViN2eCzB0R4I09fSOk/1PPGQM/jzgDQ5Q7zy644ee/lPbryKeFbCOxQtQ50 +0ZRHmQmUW/L9FmNxW1Dx0wcicMC2Bq+VnXvkHVebAoGBAMChpxL4Boasee0PcJ3o +x9D5S5NHOS32Uxe4G0mJ+25ikn6WZ8FYMOGsMeTRjfcUQB9R4DzkRTLfes7rKvmu +UOfK/jMufDWxDhmY6RFDiep3tPROt4Y0Bc2UZzDIq8gVq7gGLbOMqH2rxB6WfE1q +Ommjhlg6mwj9ZrStxzV86LXFAoGAISX22miyiZjywCE8x7hcnyVp8YcmXUAFSMDw +CVumsMNuXX9vaj3kb9a6lvM4D005RkQDgEtham4bC6F8QjlLgkeslmRPOpD2qdgo +fxZ123Fljbvw1gwyybF5Y1wKRnrvWeUV6dNyamkB91BqMPJrheNQUo5YBzbyZrLV +U7bKYmECgYEAj7ekhtCiIUMih8noMfpHR0lJG4VhdfqiVL+w25CgnpZJDa6o7pYD +F5fMivdfdKaSAOA5mUGN5u6NrTpfFKhHDucpIOM2+WGOzbbWEc/gEDQ/xEyPEhxj +t4ErMTByrDGKtGuaolNYzAU0SSbCnAAH3L2MRChC9Qv7f5ZVOZX1GPQ= +-----END RSA PRIVATE KEY----- diff --git a/src/core/tsi/test_creds/multi-domain.pem b/src/core/tsi/test_creds/multi-domain.pem new file mode 100644 index 00000000000..c60d2baef6e --- /dev/null +++ b/src/core/tsi/test_creds/multi-domain.pem @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIIDwDCCAqigAwIBAgIUYSe4/8nE/RVUX7e7QeyCmqPWd6AwDQYJKoZIhvcNAQEL +BQAwODELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEPMA0G +A1UECwwGR29vZ2xlMB4XDTE5MDgwNTE4MDYwNVoXDTIwMDgwNDE4MDYwNVowODEL +MAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEPMA0GA1UECwwG +R29vZ2xlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1e+GwyVNsoKu +7PqvOf/EubN45rB5o5PQF9A5fBPpiBtKZdvbbOouGlulRwaMQOLDZi9M6l/AhE1b +207+iSBTn9jSQT0elaYwVtKgb/qoehQjFAG8BckPmA9E4SDx2Ug9AtV3rTVs4V2y +aDHNSfDSXQ2PS9fuIx7FK5mMnUM2fjskcZquHV5f8McXEtvpuTktnb+KDgETO0Cd +u3+rf/RtraTuKZb0kmAgf+KaNWDL2j5QsFKa6sT4812Vfwaevm9qKOtzgAFobCwd +Vt+Ap/B0XWj4CmzJMPN/SXESluoBHszmTi6QmkTEzYbzmD/ObyTxXVKu46kRVmJK +Xh6BE1wk2QIDAQABo4HBMIG+MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgXgMIGjBgNV +HREEgZswgZiCE2Zvby50ZXN0LmRvbWFpbi5jb22CE2Jhci50ZXN0LmRvbWFpbi5j +b22GIGh0dHBzOi8vZm9vLnRlc3QuZG9tYWluLmNvbS90ZXN0hiBodHRwczovL2Jh +ci50ZXN0LmRvbWFpbi5jb20vdGVzdIETZm9vQHRlc3QuZG9tYWluLmNvbYETYmFy +QHRlc3QuZG9tYWluLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAzBhVGeqIntQs9qpK +xGOjpFTBMzCjYORNAq09Otkc/IBwtPOq0K2as7fp6Vr5DRStN7hDSBrMjZh+XujY +3GNEv4pIR5fWwrZg/fnNyG5BIUhdq/qtC3JAMqBjno3OJjg1t4KzS4l+ozHeevJA +qT9t6aodsn1r7w89MfAVGPIw7D3n9n5N4z2b/co17W8B0RyMWX2PmQWkEqn7kId/ +Jj+hmw2n9UV1IU3xhcepxG+wzjFLIB9nsDwgtZogK6f5p9FFBG8raqk6QhVSlRgh +JmNqmK5+hyUy1zbjGqgfM5eVmQ/A3qWVQTrk3HeTr2hO9GoBHeXQfinjlIhnbbtJ +xouhvA== +-----END CERTIFICATE----- diff --git a/test/core/tsi/ssl_transport_security_test.cc b/test/core/tsi/ssl_transport_security_test.cc index 5985b0ecaa5..014127a3042 100644 --- a/test/core/tsi/ssl_transport_security_test.cc +++ b/test/core/tsi/ssl_transport_security_test.cc @@ -790,6 +790,26 @@ void ssl_tsi_test_duplicate_root_certificates() { gpr_free(dup_root_cert); } +void ssl_tsi_test_uri_email_subject_alt_names() { + char* cert = load_file(SSL_TSI_TEST_CREDENTIALS_DIR, "multi-domain.pem"); + tsi_peer peer; + GPR_ASSERT(extract_x509_subject_names_from_pem_cert(cert, &peer) == TSI_OK); + // One for common name, one for certificate, and six for SAN fields. + size_t expected_property_count = 8; + GPR_ASSERT(peer.property_count == expected_property_count); + // Check DNS + GPR_ASSERT(check_subject_alt_name(&peer, "foo.test.domain.com") == 1); + GPR_ASSERT(check_subject_alt_name(&peer, "bar.test.domain.com") == 1); + // Check URI + GPR_ASSERT( + check_subject_alt_name(&peer, "https://foo.test.domain.com/test") == 1); + GPR_ASSERT( + check_subject_alt_name(&peer, "https://bar.test.domain.com/test") == 1); + // Check email address + GPR_ASSERT(check_subject_alt_name(&peer, "foo@test.domain.com") == 1); + GPR_ASSERT(check_subject_alt_name(&peer, "bar@test.domain.com") == 1); +} + int main(int argc, char** argv) { grpc::testing::TestEnvironment env(argc, argv); grpc_init(); @@ -815,6 +835,7 @@ int main(int argc, char** argv) { ssl_tsi_test_do_round_trip_odd_buffer_size(); ssl_tsi_test_handshaker_factory_internals(); ssl_tsi_test_duplicate_root_certificates(); + ssl_tsi_test_uri_email_subject_alt_names(); grpc_shutdown(); return 0; } From 00793c1c786cfc3091f3ee1f382b5dd4a9087e93 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 5 Aug 2019 15:42:05 -0700 Subject: [PATCH 197/661] Don't use != in InlinedVector::== --- src/core/lib/gprpp/inlined_vector.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/lib/gprpp/inlined_vector.h b/src/core/lib/gprpp/inlined_vector.h index ffc37387ec3..f511d520f50 100644 --- a/src/core/lib/gprpp/inlined_vector.h +++ b/src/core/lib/gprpp/inlined_vector.h @@ -100,7 +100,9 @@ class InlinedVector { bool operator==(const InlinedVector& other) const { if (size_ != other.size_) return false; for (size_t i = 0; i < size_; ++i) { - if (data()[i] != other.data()[i]) return false; + // Note that this uses == instead of != so that the data class doesn't + // have to implement !=. + if (!(data()[i] == other.data()[i])) return false; } return true; } From e32980fba211022c632a4c7a0785198f3f73dee0 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 5 Aug 2019 16:19:49 -0700 Subject: [PATCH 198/661] Quit waiting for a day --- examples/python/auth/customized_auth_client.py | 2 -- examples/python/auth/customized_auth_server.py | 13 +++---------- examples/python/cancellation/server.py | 16 +++------------- examples/python/compression/server.py | 8 +------- examples/python/debug/debug_server.py | 8 +------- examples/python/errors/server.py | 9 +-------- examples/python/helloworld/greeter_server.py | 9 +-------- .../helloworld/greeter_server_with_reflection.py | 9 +-------- .../interceptors/headers/greeter_server.py | 9 +-------- examples/python/metadata/metadata_server.py | 9 +-------- examples/python/multiplex/multiplex_server.py | 8 +------- .../python/route_guide/route_guide_server.py | 8 +------- .../wait_for_ready/wait_for_ready_example.py | 2 -- src/python/grpcio_tests/tests/interop/server.py | 11 ++--------- 14 files changed, 17 insertions(+), 104 deletions(-) diff --git a/examples/python/auth/customized_auth_client.py b/examples/python/auth/customized_auth_client.py index 0236c07adb1..9bcf1b5085f 100644 --- a/examples/python/auth/customized_auth_client.py +++ b/examples/python/auth/customized_auth_client.py @@ -29,8 +29,6 @@ from examples.python.auth import _credentials _LOGGER = logging.getLogger(__name__) _LOGGER.setLevel(logging.INFO) -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 - _SERVER_ADDR_TEMPLATE = 'localhost:%d' _SIGNATURE_HEADER_KEY = 'x-signature' diff --git a/examples/python/auth/customized_auth_server.py b/examples/python/auth/customized_auth_server.py index 1debc6c3c5f..374537c64fc 100644 --- a/examples/python/auth/customized_auth_server.py +++ b/examples/python/auth/customized_auth_server.py @@ -20,7 +20,6 @@ from __future__ import print_function import argparse import contextlib import logging -import time from concurrent import futures import grpc @@ -31,8 +30,6 @@ from examples.python.auth import _credentials _LOGGER = logging.getLogger(__name__) _LOGGER.setLevel(logging.INFO) -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 - _LISTEN_ADDRESS_TEMPLATE = 'localhost:%d' _SIGNATURE_HEADER_KEY = 'x-signature' @@ -85,7 +82,7 @@ def run_server(port): server.start() try: - yield port + yield server, port, finally: server.stop(0) @@ -96,13 +93,9 @@ def main(): '--port', nargs='?', type=int, default=50051, help='the listening port') args = parser.parse_args() - with run_server(args.port) as port: + with run_server(args.port) as (server, port): logging.info('Server is listening at port :%d', port) - try: - while True: - time.sleep(_ONE_DAY_IN_SECONDS) - except KeyboardInterrupt: - pass + server.wait_for_termination() if __name__ == '__main__': diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index 9597e8941b4..f27825d68ed 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -19,9 +19,7 @@ from __future__ import print_function from concurrent import futures import argparse -import contextlib import logging -import time import threading import grpc @@ -32,7 +30,6 @@ from examples.python.cancellation import hash_name_pb2_grpc _LOGGER = logging.getLogger(__name__) _SERVER_HOST = 'localhost' -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 _DESCRIPTION = "A server for finding hashes similar to names." @@ -88,7 +85,6 @@ class HashFinder(hash_name_pb2_grpc.HashFinderServicer): _LOGGER.debug("Regained servicer thread.") -@contextlib.contextmanager def _running_server(port, maximum_hashes): # We use only a single servicer thread here to demonstrate that, if managed # carefully, cancelled RPCs can need not continue occupying servicers @@ -101,12 +97,7 @@ def _running_server(port, maximum_hashes): actual_port = server.add_insecure_port(address) server.start() print("Server listening at '{}'".format(address)) - try: - yield actual_port - except KeyboardInterrupt: - pass - finally: - server.stop(None) + return server def main(): @@ -124,9 +115,8 @@ def main(): nargs='?', help='The maximum number of hashes to search before cancelling.') args = parser.parse_args() - with _running_server(args.port, args.maximum_hashes): - while True: - time.sleep(_ONE_DAY_IN_SECONDS) + server = _running_server(args.port, args.maximum_hashes) + server.wait_for_termination() if __name__ == "__main__": diff --git a/examples/python/compression/server.py b/examples/python/compression/server.py index bc13e60cb5b..69411f10eb0 100644 --- a/examples/python/compression/server.py +++ b/examples/python/compression/server.py @@ -21,7 +21,6 @@ from concurrent import futures import argparse import logging import threading -import time import grpc from examples import helloworld_pb2 @@ -36,7 +35,6 @@ _COMPRESSION_OPTIONS = { _LOGGER = logging.getLogger(__name__) _SERVER_HOST = 'localhost' -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 class Greeter(helloworld_pb2_grpc.GreeterServicer): @@ -72,11 +70,7 @@ def run_server(server_compression, no_compress_every_n, port): server.add_insecure_port(address) server.start() print("Server listening at '{}'".format(address)) - try: - while True: - time.sleep(_ONE_DAY_IN_SECONDS) - except KeyboardInterrupt: - server.stop(None) + server.wait_for_termination() def main(): diff --git a/examples/python/debug/debug_server.py b/examples/python/debug/debug_server.py index 64926b53457..3bc52f7c3f4 100644 --- a/examples/python/debug/debug_server.py +++ b/examples/python/debug/debug_server.py @@ -19,7 +19,6 @@ from __future__ import print_function import argparse import logging -import time from concurrent import futures import random @@ -32,7 +31,6 @@ from examples import helloworld_pb2_grpc _LOGGER = logging.getLogger(__name__) _LOGGER.setLevel(logging.INFO) -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 _RANDOM_FAILURE_RATE = 0.3 @@ -78,11 +76,7 @@ def main(): server = create_server(addr=args.addr, failure_rate=args.failure_rate) server.start() - try: - while True: - time.sleep(_ONE_DAY_IN_SECONDS) - except KeyboardInterrupt: - server.stop(0) + server.wait_for_termination() if __name__ == '__main__': diff --git a/examples/python/errors/server.py b/examples/python/errors/server.py index 50d4a2ac671..a4a70e1e201 100644 --- a/examples/python/errors/server.py +++ b/examples/python/errors/server.py @@ -14,7 +14,6 @@ """This example sends out rich error status from server-side.""" from concurrent import futures -import time import logging import threading @@ -27,8 +26,6 @@ from google.rpc import code_pb2, status_pb2, error_details_pb2 from examples import helloworld_pb2 from examples import helloworld_pb2_grpc -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 - def create_greet_limit_exceed_error_status(name): detail = any_pb2.Any() @@ -73,11 +70,7 @@ def create_server(server_address): def serve(server): server.start() - try: - while True: - time.sleep(_ONE_DAY_IN_SECONDS) - except KeyboardInterrupt: - server.stop(None) + server.wait_for_termination() def main(): diff --git a/examples/python/helloworld/greeter_server.py b/examples/python/helloworld/greeter_server.py index e3b4f2c1ff9..7bc3f2f725c 100644 --- a/examples/python/helloworld/greeter_server.py +++ b/examples/python/helloworld/greeter_server.py @@ -14,7 +14,6 @@ """The Python implementation of the GRPC helloworld.Greeter server.""" from concurrent import futures -import time import logging import grpc @@ -22,8 +21,6 @@ import grpc import helloworld_pb2 import helloworld_pb2_grpc -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 - class Greeter(helloworld_pb2_grpc.GreeterServicer): @@ -36,11 +33,7 @@ def serve(): helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server) server.add_insecure_port('[::]:50051') server.start() - try: - while True: - time.sleep(_ONE_DAY_IN_SECONDS) - except KeyboardInterrupt: - server.stop(0) + server.wait_for_termination() if __name__ == '__main__': diff --git a/examples/python/helloworld/greeter_server_with_reflection.py b/examples/python/helloworld/greeter_server_with_reflection.py index 5acedbcb71f..7c73a42eb66 100644 --- a/examples/python/helloworld/greeter_server_with_reflection.py +++ b/examples/python/helloworld/greeter_server_with_reflection.py @@ -14,7 +14,6 @@ """The reflection-enabled version of gRPC helloworld.Greeter server.""" from concurrent import futures -import time import logging import grpc @@ -23,8 +22,6 @@ from grpc_reflection.v1alpha import reflection import helloworld_pb2 import helloworld_pb2_grpc -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 - class Greeter(helloworld_pb2_grpc.GreeterServicer): @@ -42,11 +39,7 @@ def serve(): reflection.enable_server_reflection(SERVICE_NAMES, server) server.add_insecure_port('[::]:50051') server.start() - try: - while True: - time.sleep(_ONE_DAY_IN_SECONDS) - except KeyboardInterrupt: - server.stop(0) + server.wait_for_termination() if __name__ == '__main__': diff --git a/examples/python/interceptors/headers/greeter_server.py b/examples/python/interceptors/headers/greeter_server.py index 6b0f4058bcd..32706ae7094 100644 --- a/examples/python/interceptors/headers/greeter_server.py +++ b/examples/python/interceptors/headers/greeter_server.py @@ -14,7 +14,6 @@ """The Python implementation of the GRPC helloworld.Greeter server.""" from concurrent import futures -import time import logging import grpc @@ -23,8 +22,6 @@ import helloworld_pb2 import helloworld_pb2_grpc from request_header_validator_interceptor import RequestHeaderValidatorInterceptor -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 - class Greeter(helloworld_pb2_grpc.GreeterServicer): @@ -42,11 +39,7 @@ def serve(): helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server) server.add_insecure_port('[::]:50051') server.start() - try: - while True: - time.sleep(_ONE_DAY_IN_SECONDS) - except KeyboardInterrupt: - server.stop(0) + server.wait_for_termination() if __name__ == '__main__': diff --git a/examples/python/metadata/metadata_server.py b/examples/python/metadata/metadata_server.py index a4329df79aa..79eb380092e 100644 --- a/examples/python/metadata/metadata_server.py +++ b/examples/python/metadata/metadata_server.py @@ -15,7 +15,6 @@ from __future__ import print_function from concurrent import futures -import time import logging import grpc @@ -23,8 +22,6 @@ import grpc import helloworld_pb2 import helloworld_pb2_grpc -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 - class Greeter(helloworld_pb2_grpc.GreeterServicer): @@ -44,11 +41,7 @@ def serve(): helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server) server.add_insecure_port('[::]:50051') server.start() - try: - while True: - time.sleep(_ONE_DAY_IN_SECONDS) - except KeyboardInterrupt: - server.stop(0) + server.wait_for_termination() if __name__ == '__main__': diff --git a/examples/python/multiplex/multiplex_server.py b/examples/python/multiplex/multiplex_server.py index c01824b3a97..f168fe7f1b3 100644 --- a/examples/python/multiplex/multiplex_server.py +++ b/examples/python/multiplex/multiplex_server.py @@ -26,8 +26,6 @@ import route_guide_pb2 import route_guide_pb2_grpc import route_guide_resources -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 - def _get_feature(feature_db, point): """Returns Feature at given location or None.""" @@ -129,11 +127,7 @@ def serve(): _RouteGuideServicer(), server) server.add_insecure_port('[::]:50051') server.start() - try: - while True: - time.sleep(_ONE_DAY_IN_SECONDS) - except KeyboardInterrupt: - server.stop(0) + server.wait_for_termination() if __name__ == '__main__': diff --git a/examples/python/route_guide/route_guide_server.py b/examples/python/route_guide/route_guide_server.py index e00cb699084..4ab33e68f28 100644 --- a/examples/python/route_guide/route_guide_server.py +++ b/examples/python/route_guide/route_guide_server.py @@ -24,8 +24,6 @@ import route_guide_pb2 import route_guide_pb2_grpc import route_guide_resources -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 - def get_feature(feature_db, point): """Returns Feature at given location or None.""" @@ -119,11 +117,7 @@ def serve(): RouteGuideServicer(), server) server.add_insecure_port('[::]:50051') server.start() - try: - while True: - time.sleep(_ONE_DAY_IN_SECONDS) - except KeyboardInterrupt: - server.stop(0) + server.wait_for_termination() if __name__ == '__main__': diff --git a/examples/python/wait_for_ready/wait_for_ready_example.py b/examples/python/wait_for_ready/wait_for_ready_example.py index a0f076e894a..8dd770d6a0e 100644 --- a/examples/python/wait_for_ready/wait_for_ready_example.py +++ b/examples/python/wait_for_ready/wait_for_ready_example.py @@ -28,8 +28,6 @@ from examples import helloworld_pb2_grpc _LOGGER = logging.getLogger(__name__) _LOGGER.setLevel(logging.INFO) -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 - @contextmanager def get_free_loopback_tcp_port(): diff --git a/src/python/grpcio_tests/tests/interop/server.py b/src/python/grpcio_tests/tests/interop/server.py index 3611ffdbb2f..aaeee52ed87 100644 --- a/src/python/grpcio_tests/tests/interop/server.py +++ b/src/python/grpcio_tests/tests/interop/server.py @@ -16,7 +16,6 @@ import argparse from concurrent import futures import logging -import time import grpc from src.proto.grpc.testing import test_pb2_grpc @@ -25,7 +24,6 @@ from tests.interop import service from tests.interop import resources from tests.unit import test_common -_ONE_DAY_IN_SECONDS = 60 * 60 * 24 logging.basicConfig() _LOGGER = logging.getLogger(__name__) @@ -55,13 +53,8 @@ def serve(): server.start() _LOGGER.info('Server serving.') - try: - while True: - time.sleep(_ONE_DAY_IN_SECONDS) - except BaseException as e: - _LOGGER.info('Caught exception "%s"; stopping server...', e) - server.stop(None) - _LOGGER.info('Server stopped; exiting.') + server.wait_for_termination() + _LOGGER.info('Server stopped; exiting.') if __name__ == '__main__': From 0aa30c6f239ded57cb191c1c18038dd5b293d091 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 5 Aug 2019 16:34:47 -0700 Subject: [PATCH 199/661] Remove unintentional dependencies --- src/python/grpcio_tests/tests/interop/BUILD.bazel | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/python/grpcio_tests/tests/interop/BUILD.bazel b/src/python/grpcio_tests/tests/interop/BUILD.bazel index 43fdc7ab462..8ac3f7d52d5 100644 --- a/src/python/grpcio_tests/tests/interop/BUILD.bazel +++ b/src/python/grpcio_tests/tests/interop/BUILD.bazel @@ -32,9 +32,7 @@ py_library( "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_tests/tests:bazel_namespace_package_hack", "//src/proto/grpc/testing:empty_py_pb2", - "//src/proto/grpc/testing:empty_py_pb2_grpc", "//src/proto/grpc/testing:py_messages_proto", - "//src/proto/grpc/testing:messages_py_pb2_grpc", "//src/proto/grpc/testing:py_test_proto", "//src/proto/grpc/testing:test_py_pb2_grpc", requirement("google-auth"), From 8c99479bc7bc90177357376207a9056857b4d7ce Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 5 Aug 2019 16:38:15 -0700 Subject: [PATCH 200/661] move ChannelExtensions to Grpc.Core.Api --- .../Interceptors/ChannelExtensions.cs | 12 ++++++------ src/csharp/Grpc.Core/ForwardedTypes.cs | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) rename src/csharp/{Grpc.Core => Grpc.Core.Api}/Interceptors/ChannelExtensions.cs (87%) diff --git a/src/csharp/Grpc.Core/Interceptors/ChannelExtensions.cs b/src/csharp/Grpc.Core.Api/Interceptors/ChannelExtensions.cs similarity index 87% rename from src/csharp/Grpc.Core/Interceptors/ChannelExtensions.cs rename to src/csharp/Grpc.Core.Api/Interceptors/ChannelExtensions.cs index c7d0c2472a1..fe3b516857e 100644 --- a/src/csharp/Grpc.Core/Interceptors/ChannelExtensions.cs +++ b/src/csharp/Grpc.Core.Api/Interceptors/ChannelExtensions.cs @@ -38,9 +38,9 @@ namespace Grpc.Core.Interceptors /// building a chain like "channel.Intercept(c).Intercept(b).Intercept(a)". Note that /// in this case, the last interceptor added will be the first to take control. /// - public static CallInvoker Intercept(this Channel channel, Interceptor interceptor) + public static CallInvoker Intercept(this ChannelBase channel, Interceptor interceptor) { - return new DefaultCallInvoker(channel).Intercept(interceptor); + return channel.CreateCallInvoker().Intercept(interceptor); } /// @@ -59,9 +59,9 @@ namespace Grpc.Core.Interceptors /// building a chain like "channel.Intercept(c).Intercept(b).Intercept(a)". Note that /// in this case, the last interceptor added will be the first to take control. /// - public static CallInvoker Intercept(this Channel channel, params Interceptor[] interceptors) + public static CallInvoker Intercept(this ChannelBase channel, params Interceptor[] interceptors) { - return new DefaultCallInvoker(channel).Intercept(interceptors); + return channel.CreateCallInvoker().Intercept(interceptors); } /// @@ -79,9 +79,9 @@ namespace Grpc.Core.Interceptors /// building a chain like "channel.Intercept(c).Intercept(b).Intercept(a)". Note that /// in this case, the last interceptor added will be the first to take control. /// - public static CallInvoker Intercept(this Channel channel, Func interceptor) + public static CallInvoker Intercept(this ChannelBase channel, Func interceptor) { - return new DefaultCallInvoker(channel).Intercept(interceptor); + return channel.CreateCallInvoker().Intercept(interceptor); } } } diff --git a/src/csharp/Grpc.Core/ForwardedTypes.cs b/src/csharp/Grpc.Core/ForwardedTypes.cs index 4394a7c907c..eaf974c3356 100644 --- a/src/csharp/Grpc.Core/ForwardedTypes.cs +++ b/src/csharp/Grpc.Core/ForwardedTypes.cs @@ -38,6 +38,7 @@ using Grpc.Core.Utils; [assembly:TypeForwardedToAttribute(typeof(CallInvoker))] [assembly:TypeForwardedToAttribute(typeof(CallInvokerExtensions))] [assembly:TypeForwardedToAttribute(typeof(CallOptions))] +[assembly:TypeForwardedToAttribute(typeof(ChannelExtensions))] [assembly:TypeForwardedToAttribute(typeof(ClientBase))] [assembly:TypeForwardedToAttribute(typeof(ClientBase<>))] [assembly:TypeForwardedToAttribute(typeof(ChannelCredentials))] From a77404ae6b8e286ccf0e5b61f7e3b1d3d3fafd3c Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 5 Aug 2019 16:38:41 -0700 Subject: [PATCH 201/661] Add README to bazel test --- bazel/test/python_test_repo/README.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 bazel/test/python_test_repo/README.md diff --git a/bazel/test/python_test_repo/README.md b/bazel/test/python_test_repo/README.md new file mode 100644 index 00000000000..d9dfd1d99b5 --- /dev/null +++ b/bazel/test/python_test_repo/README.md @@ -0,0 +1,5 @@ +## Bazel Workspace Test + +This directory houses a test ensuring that downstream projects can use +`@com_github_grpc_grpc//src/python/grpcio:grpcio`, `py_proto_library`, and +`py_grpc_library`. From b7eaa36a8cb9264cf8cc7dbc7248086805b066ec Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 5 Aug 2019 16:43:31 -0700 Subject: [PATCH 202/661] Add todo to create new kokoro job. --- tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh index eda730d3a54..00bf971a3e2 100755 --- a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh +++ b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh @@ -29,6 +29,9 @@ bazel test --spawn_strategy=standalone --genrule_strategy=standalone --test_outp bazel clean --expunge bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //src/python/... bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //examples/python/... + +# TODO(https://github.com/grpc/grpc/issues/19854): Move this to a new kokoro +# job. (cd /var/local/git/grpc/bazel/test/python_test_repo; bazel test --test_output=errors //... ) From 81719815927e4d8a0621ab97d5fde5a0af6c61f3 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Mon, 5 Aug 2019 16:37:33 -0700 Subject: [PATCH 203/661] Added Bazel BUILD for tests/ A few test failures to resolve --- src/objective-c/BUILD | 40 +++- .../GRPCClient/private/GRPCOpBatchLog.h | 1 + .../grpc_objc_internal_library.bzl | 174 +++++++++++++++ src/objective-c/tests/BUILD | 202 ++++++++++++++++++ .../tests/InteropTests/InteropTests.h | 6 + .../tests/InteropTests/InteropTests.m | 8 + .../InteropTestsMultipleChannels.m | 3 +- src/objective-c/tests/MacTests/StressTests.h | 6 + src/objective-c/tests/MacTests/StressTests.m | 8 + 9 files changed, 446 insertions(+), 2 deletions(-) create mode 100644 src/objective-c/grpc_objc_internal_library.bzl create mode 100644 src/objective-c/tests/BUILD diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index 2492ce8a21f..c3629d0ada4 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -87,10 +87,48 @@ grpc_objc_library( # Different from Cocoapods, do not import as if @com_google_protobuf//:protobuf_objc is a framework, # use the real paths of @com_google_protobuf//:protobuf_objc instead defines = ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0"], - includes = ["src/objective-c"], deps = [ ":grpc_objc_client", ":rx_library", "@com_google_protobuf//:protobuf_objc", ], ) + +grpc_objc_library( + name = "grpc_objc_client_internal_testing", + srcs = glob( + [ + "GRPCClient/*.m", + "GRPCClient/private/*.m", + "GRPCClient/internal_testing/*.m", + "ProtoRPC/*.m", + ], + exclude = ["GRPCClient/GRPCCall+GID.m"], + ), + hdrs = glob( + [ + "GRPCClient/*.h", + "GRPCClient/internal/*.h", + "GRPCClient/internal_testing/*.h", + "ProtoRPC/*.h", + ], + exclude = ["GRPCClient/GRPCCall+GID.h"], + ), + includes = ["."], + data = ["//:gRPCCertificates"], + defines = [ + "GRPC_TEST_OBJC=1", + "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0", + ], + textual_hdrs = glob( + [ + "GRPCClient/private/*.h", + ], + ), + deps = [ + ":rx_library", + "//:grpc_objc", + "@com_google_protobuf//:protobuf_objc", + ], + visibility = ["//visibility:public"], +) diff --git a/src/objective-c/GRPCClient/private/GRPCOpBatchLog.h b/src/objective-c/GRPCClient/private/GRPCOpBatchLog.h index 700d19a206b..1235a5e8d05 100644 --- a/src/objective-c/GRPCClient/private/GRPCOpBatchLog.h +++ b/src/objective-c/GRPCClient/private/GRPCOpBatchLog.h @@ -17,6 +17,7 @@ */ #ifdef GRPC_TEST_OBJC +#import /** * Logs the op batches of a client. Used for testing. diff --git a/src/objective-c/grpc_objc_internal_library.bzl b/src/objective-c/grpc_objc_internal_library.bzl new file mode 100644 index 00000000000..b043a0f6880 --- /dev/null +++ b/src/objective-c/grpc_objc_internal_library.bzl @@ -0,0 +1,174 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# This is for the gRPC build system. This isn't intended to be used outsite of +# the BUILD file for gRPC. It contains the mapping for the template system we +# use to generate other platform's build system files. +# +# Please consider that there should be a high bar for additions and changes to +# this file. +# Each rule listed must be re-written for Google's internal build system, and +# each change must be ported from one to the other. +# + +load( + "//bazel:generate_objc.bzl", + "generate_objc", + "generate_objc_hdrs", + "generate_objc_srcs", + "generate_objc_non_arc_srcs" +) +load("//bazel:protobuf.bzl", "well_known_proto_libs") + +def grpc_objc_testing_library( + name, + srcs = [], + hdrs = [], + textual_hdrs = [], + data = [], + deps = [], + defines = [], + includes = []): + """objc_library for testing, only works in //src/objective-c/tests + + Args: + name: name of target + hdrs: public headers + srcs: all source files (.m) + textual_hdrs: private headers + data: any other bundle resources + defines: preprocessors + includes: added to search path, always [the path to objc directory] + deps: dependencies + """ + + additional_deps = [ + ":RemoteTest", + "//src/objective-c:grpc_objc_client_internal_testing", + ] + + if not name == "TestConfigs": + additional_deps += [":TestConfigs"] + + native.objc_library( + name = name, + hdrs = hdrs, + srcs = srcs, + textual_hdrs = textual_hdrs, + data = data, + defines = defines, + includes = includes, + deps = deps + additional_deps, + ) + +def local_objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kwargs): + """!!For local targets within the gRPC repository only!! Will not work outside of the repo + """ + objc_grpc_library_name = "_" + name + "_objc_grpc_library" + + generate_objc( + name = objc_grpc_library_name, + srcs = srcs, + deps = deps, + use_well_known_protos = use_well_known_protos, + **kwargs + ) + + generate_objc_hdrs( + name = objc_grpc_library_name + "_hdrs", + src = ":" + objc_grpc_library_name, + ) + + generate_objc_non_arc_srcs( + name = objc_grpc_library_name + "_non_arc_srcs", + src = ":" + objc_grpc_library_name, + ) + + arc_srcs = None + if len(srcs) > 0: + generate_objc_srcs( + name = objc_grpc_library_name + "_srcs", + src = ":" + objc_grpc_library_name, + ) + arc_srcs = [":" + objc_grpc_library_name + "_srcs"] + + native.objc_library( + name = name, + hdrs = [":" + objc_grpc_library_name + "_hdrs"], + non_arc_srcs = [":" + objc_grpc_library_name + "_non_arc_srcs"], + srcs = arc_srcs, + defines = [ + "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0", + "GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO=0", + ], + includes = [ + "_generated_protos", + "src/objective-c", + ], + deps = [ + "//src/objective-c:proto_objc_rpc", + "@com_google_protobuf//:protobuf_objc", + ], + ) + +def testing_objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kwargs): + """!!For testing within the gRPC repository only!! Will not work outside of the repo + """ + objc_grpc_library_name = "_" + name + "_objc_grpc_library" + + generate_objc( + name = objc_grpc_library_name, + srcs = srcs, + deps = deps, + use_well_known_protos = use_well_known_protos, + **kwargs + ) + + generate_objc_hdrs( + name = objc_grpc_library_name + "_hdrs", + src = ":" + objc_grpc_library_name, + ) + + generate_objc_non_arc_srcs( + name = objc_grpc_library_name + "_non_arc_srcs", + src = ":" + objc_grpc_library_name, + ) + + arc_srcs = None + if len(srcs) > 0: + generate_objc_srcs( + name = objc_grpc_library_name + "_srcs", + src = ":" + objc_grpc_library_name, + ) + arc_srcs = [":" + objc_grpc_library_name + "_srcs"] + + native.objc_library( + name = name, + hdrs = [":" + objc_grpc_library_name + "_hdrs"], + non_arc_srcs = [":" + objc_grpc_library_name + "_non_arc_srcs"], + srcs = arc_srcs, + defines = [ + "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0", + "GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO=0", + ], + includes = [ + "_generated_protos", + "src/objective-c", + ], + deps = [ + "//src/objective-c:grpc_objc_client_internal_testing", + "@com_google_protobuf//:protobuf_objc", + ], + ) diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD new file mode 100644 index 00000000000..2718cca5880 --- /dev/null +++ b/src/objective-c/tests/BUILD @@ -0,0 +1,202 @@ +# gRPC Bazel BUILD file. +# +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +licenses(["notice"]) # Apache v2 + +package(default_visibility = ["//visibility:private"]) + +load( + "//src/objective-c:grpc_objc_internal_library.bzl", + "grpc_objc_testing_library", + "testing_objc_grpc_library" +) +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") +load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test") +load("@build_bazel_rules_apple//apple:macos.bzl", "macos_unit_test") +load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_unit_test") + +exports_files(["LICENSE"]) + +proto_library( + name = "messages_proto", + srcs = ["RemoteTestClient/messages.proto"], +) + +proto_library( + name = "test_proto", + srcs = ["RemoteTestClient/test.proto"], + deps = [":messages_proto"], +) + +testing_objc_grpc_library( + name = "RemoteTest", + srcs = ["RemoteTestClient/test.proto"], + use_well_known_protos = True, + deps = [":test_proto"], +) + +apple_resource_bundle( + name = "TestCertificates", + resources = ["TestCertificates.bundle/test-certificates.pem"], +) + +# TestConfigs is added to each grpc_objc_testing_library's deps +grpc_objc_testing_library( + name = "TestConfigs", + hdrs = ["version.h"], + data = [":TestCertificates"], + defines = [ + "HOST_PORT_LOCALSSL=localhost:5051", + "HOST_PORT_LOCAL=localhost:5050", + "HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com", + ], +) + +grpc_objc_testing_library( + name = "CronetConfig", + srcs = ["ConfigureCronet.m"], + hdrs = ["ConfigureCronet.h"], +) + +grpc_objc_testing_library( + name = "InteropTests-lib", + hdrs = ["InteropTests/InteropTests.h"], + srcs = ["InteropTests/InteropTests.m"], + deps = [ + ":InteropTestsBlockCallbacks-lib", + ":CronetConfig", + ], +) + +grpc_objc_testing_library( + name = "InteropTestsRemote-lib", + srcs = ["InteropTests/InteropTestsRemote.m"], + deps = [":InteropTests-lib"], +) + +grpc_objc_testing_library( + name = "InteropTestsBlockCallbacks-lib", + hdrs = ["InteropTests/InteropTestsBlockCallbacks.h"], + srcs = ["InteropTests/InteropTestsBlockCallbacks.m"], +) + +grpc_objc_testing_library( + name = "InteropTestsLocalSSL-lib", + srcs = ["InteropTests/InteropTestsLocalSSL.m"], + deps = [":InteropTests-lib"], +) + +grpc_objc_testing_library( + name = "InteropTestsLocalCleartext-lib", + srcs = ["InteropTests/InteropTestsLocalCleartext.m"], + deps = [":InteropTests-lib"], +) + +grpc_objc_testing_library( + name = "InteropTestsMultipleChannels-lib", + srcs = ["InteropTests/InteropTestsMultipleChannels.m"], + deps = [":InteropTests-lib"], +) + +grpc_objc_testing_library( + name = "RxLibraryUnitTests-lib", + srcs = ["UnitTests/RxLibraryUnitTests.m"], +) + +grpc_objc_testing_library( + name = "GRPCClientTests-lib", + srcs = ["UnitTests/GRPCClientTests.m"], +) + +grpc_objc_testing_library( + name = "APIv2Tests-lib", + srcs = ["UnitTests/APIv2Tests.m"], +) + +grpc_objc_testing_library( + name = "ChannelPoolTest-lib", + srcs = ["UnitTests/ChannelPoolTest.m"], +) + +grpc_objc_testing_library( + name = "ChannelTests-lib", + srcs = ["UnitTests/ChannelTests.m"], +) + +grpc_objc_testing_library( + name = "NSErrorUnitTests-lib", + srcs = ["UnitTests/NSErrorUnitTests.m"], +) + +grpc_objc_testing_library( + name = "MacStressTests-lib", + srcs = glob([ + "MacTests/*.m", + ]), + hdrs = ["MacTests/StressTests.h"], +) + +ios_unit_test( + name = "UnitTests", + minimum_os_version = "8.0", + deps = [ + ":RxLibraryUnitTests-lib", + ":GRPCClientTests-lib", + ":APIv2Tests-lib", + ":ChannelPoolTest-lib", + ":ChannelTests-lib", + ":NSErrorUnitTests-lib", + ] +) + +ios_unit_test( + name = "InteropTests", + minimum_os_version = "8.0", + deps = [ + ":InteropTestsRemote-lib", + ":InteropTestsLocalSSL-lib", + ":InteropTestsLocalCleartext-lib", + # ":InteropTestsMultipleChannels-lib", #??????? Cronet must be used? + ], +) + +macos_unit_test( + name = "MacTests", + minimum_os_version = "10.9", + deps = [ + ":APIv2Tests-lib", + ":RxLibraryUnitTests-lib", + ":NSErrorUnitTests-lib", + ":InteropTestsRemote-lib", + ":InteropTestsLocalSSL-lib", + ":InteropTestsLocalCleartext-lib", + ":MacStressTests-lib", + ] +) + +# cares does not support tvOS CPU architecture with Bazel yet +tvos_unit_test( + name = "TvTests", + minimum_os_version = "10.0", + deps = [ + ":APIv2Tests-lib", + ":RxLibraryUnitTests-lib", + ":NSErrorUnitTests-lib", + ":InteropTestsRemote-lib", + ":InteropTestsLocalSSL-lib", + ":InteropTestsLocalCleartext-lib", + ] +) \ No newline at end of file diff --git a/src/objective-c/tests/InteropTests/InteropTests.h b/src/objective-c/tests/InteropTests/InteropTests.h index cffa90ac497..28fcbff9695 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.h +++ b/src/objective-c/tests/InteropTests/InteropTests.h @@ -27,6 +27,12 @@ * This is an abstract class that needs to be subclassed. See |+host|. */ @interface InteropTests : XCTestCase +/** + * The test suite to run, checking if the current XCTestCase instance is the base class. + * If so, run no tests (disabled). Otherwise, proceed to normal execution. + */ +@property(class, readonly) XCTestSuite *defaultTestSuite; + /** * Host to send the RPCs to. The base implementation returns nil, which would make all tests to * fail. diff --git a/src/objective-c/tests/InteropTests/InteropTests.m b/src/objective-c/tests/InteropTests/InteropTests.m index c13dd1e2b35..a8f7db7ee93 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.m +++ b/src/objective-c/tests/InteropTests/InteropTests.m @@ -406,6 +406,14 @@ static dispatch_once_t initGlobalInterceptorFactory; RMTTestService *_service; } ++ (XCTestSuite *)defaultTestSuite { + if (self == [InteropTests class]) { + return [XCTestSuite testSuiteWithName:@"InteropTestsEmptySuite"]; + } else { + return super.defaultTestSuite; + } +} + + (NSString *)host { return nil; } diff --git a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m index a2a3e64b1b1..c363e523250 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m +++ b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m @@ -86,8 +86,9 @@ dispatch_once_t initCronet; self.continueAfterFailure = NO; _remoteService = [RMTTestService serviceWithHost:kRemoteSSLHost callOptions:nil]; - +#ifdef GRPC_COMPILE_WITH_CRONET configureCronet(); +#endif // Default stack with remote host GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; diff --git a/src/objective-c/tests/MacTests/StressTests.h b/src/objective-c/tests/MacTests/StressTests.h index 8bee0e66274..2608a710845 100644 --- a/src/objective-c/tests/MacTests/StressTests.h +++ b/src/objective-c/tests/MacTests/StressTests.h @@ -21,6 +21,12 @@ #import @interface StressTests : XCTestCase +/** + * The test suite to run, checking if the current XCTestCase instance is the base class. + * If so, run no tests (disabled). Otherwise, proceed to normal execution. + */ +@property(class, readonly) XCTestSuite *defaultTestSuite; + /** * Host to send the RPCs to. The base implementation returns nil, which would make all tests to * fail. diff --git a/src/objective-c/tests/MacTests/StressTests.m b/src/objective-c/tests/MacTests/StressTests.m index c7020740eac..622c80ea91a 100644 --- a/src/objective-c/tests/MacTests/StressTests.m +++ b/src/objective-c/tests/MacTests/StressTests.m @@ -89,6 +89,14 @@ extern const char *kCFStreamVarName; RMTTestService *_service; } ++ (XCTestSuite *)defaultTestSuite { + if (self == [StressTests class]) { + return [XCTestSuite testSuiteWithName:@"StressTestsEmptySuite"]; + } else { + return super.defaultTestSuite; + } +} + + (NSString *)host { return nil; } From 4f13303ec460b3550cac11e71a09cafa45920f86 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 5 Aug 2019 16:46:29 -0700 Subject: [PATCH 204/661] Validate length of deps in py_grpc_library --- bazel/python_rules.bzl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl index eb4ac9c9721..8f696b1022d 100644 --- a/bazel/python_rules.bzl +++ b/bazel/python_rules.bzl @@ -208,6 +208,9 @@ def py_grpc_library( if len(srcs) > 1: fail("Can only compile a single proto at a time.") + if len(deps) > 1: + fail("Deps must have length 1.") + _generate_pb2_grpc_src( name = codegen_grpc_target, deps = srcs, From 08795cd20632f1137c03aaff5abaf5c7d0a96eb4 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Mon, 5 Aug 2019 17:07:54 -0700 Subject: [PATCH 205/661] Removed framework tests for tv and watch examples --- tools/run_tests/run_tests.py | 44 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 2a4ec8ce156..d3b028d4590 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1101,17 +1101,17 @@ class ObjCLanguage(object): 'EXAMPLE_PATH': 'src/objective-c/examples/tvOS-sample', 'FRAMEWORKS': 'NO' })) - out.append( - self.config.job_spec( - ['src/objective-c/tests/build_one_example.sh'], - timeout_seconds=10 * 60, - shortname='ios-buildtest-example-tvOS-sample-framework', - cpu_cost=1e6, - environ={ - 'SCHEME': 'tvOS-sample', - 'EXAMPLE_PATH': 'src/objective-c/examples/tvOS-sample', - 'FRAMEWORKS': 'YES' - })) + # out.append( + # self.config.job_spec( + # ['src/objective-c/tests/build_one_example.sh'], + # timeout_seconds=10 * 60, + # shortname='ios-buildtest-example-tvOS-sample-framework', + # cpu_cost=1e6, + # environ={ + # 'SCHEME': 'tvOS-sample', + # 'EXAMPLE_PATH': 'src/objective-c/examples/tvOS-sample', + # 'FRAMEWORKS': 'YES' + # })) out.append( self.config.job_spec( ['src/objective-c/tests/build_one_example.sh'], @@ -1123,17 +1123,17 @@ class ObjCLanguage(object): 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', 'FRAMEWORKS': 'NO' })) - out.append( - self.config.job_spec( - ['src/objective-c/tests/build_one_example.sh'], - timeout_seconds=20 * 60, - shortname='ios-buildtest-example-watchOS-sample-framework', - cpu_cost=1e6, - environ={ - 'SCHEME': 'watchOS-sample-WatchKit-App', - 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', - 'FRAMEWORKS': 'YES' - })) + # out.append( + # self.config.job_spec( + # ['src/objective-c/tests/build_one_example.sh'], + # timeout_seconds=20 * 60, + # shortname='ios-buildtest-example-watchOS-sample-framework', + # cpu_cost=1e6, + # environ={ + # 'SCHEME': 'watchOS-sample-WatchKit-App', + # 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', + # 'FRAMEWORKS': 'YES' + # })) out.append( self.config.job_spec( ['src/objective-c/tests/run_plugin_tests.sh'], From 79611aca519183d9d8ec1d395c6e8cd98400e4d7 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 5 Aug 2019 17:22:43 -0700 Subject: [PATCH 206/661] Fix up unit test --- examples/python/auth/customized_auth_server.py | 2 +- examples/python/auth/test/_auth_example_test.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/python/auth/customized_auth_server.py b/examples/python/auth/customized_auth_server.py index 374537c64fc..4bb74d6a871 100644 --- a/examples/python/auth/customized_auth_server.py +++ b/examples/python/auth/customized_auth_server.py @@ -82,7 +82,7 @@ def run_server(port): server.start() try: - yield server, port, + yield server, port finally: server.stop(0) diff --git a/examples/python/auth/test/_auth_example_test.py b/examples/python/auth/test/_auth_example_test.py index e2214267212..8e1a3b2b359 100644 --- a/examples/python/auth/test/_auth_example_test.py +++ b/examples/python/auth/test/_auth_example_test.py @@ -30,20 +30,20 @@ _SERVER_ADDR_TEMPLATE = 'localhost:%d' class AuthExampleTest(unittest.TestCase): def test_successful_call(self): - with customized_auth_server.run_server(0) as port: + with customized_auth_server.run_server(0) as (_, port): with customized_auth_client.create_client_channel( _SERVER_ADDR_TEMPLATE % port) as channel: customized_auth_client.send_rpc(channel) # No unhandled exception raised, test passed! def test_no_channel_credential(self): - with customized_auth_server.run_server(0) as port: + with customized_auth_server.run_server(0) as (_, port): with grpc.insecure_channel(_SERVER_ADDR_TEMPLATE % port) as channel: resp = customized_auth_client.send_rpc(channel) self.assertEqual(resp.code(), grpc.StatusCode.UNAVAILABLE) def test_no_call_credential(self): - with customized_auth_server.run_server(0) as port: + with customized_auth_server.run_server(0) as (_, port): channel_credential = grpc.ssl_channel_credentials( _credentials.ROOT_CERTIFICATE) with grpc.secure_channel(_SERVER_ADDR_TEMPLATE % port, From 4c958e8745ba5d6715561bdcf16e15c23096fd65 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Mon, 5 Aug 2019 20:15:49 -0700 Subject: [PATCH 207/661] Modified BUILD for examples --- src/objective-c/examples/BUILD | 84 ++-- .../BazelBuildSamples/ios-sample/Podfile | 31 -- .../ios-sample.xcodeproj/project.pbxproj | 413 ------------------ .../ios-sample/ios-sample/AppDelegate.h | 25 -- .../ios-sample/ios-sample/AppDelegate.m | 63 --- .../AppIcon.appiconset/Contents.json | 98 ----- .../ios-sample/Assets.xcassets/Contents.json | 6 - .../Base.lproj/LaunchScreen.storyboard | 25 -- .../ios-sample/Base.lproj/Main.storyboard | 38 -- .../ios-sample/ios-sample/Info.plist | 45 -- .../ios-sample/ios-sample/ViewController.h | 23 - .../ios-sample/ios-sample/ViewController.m | 86 ---- .../ios-sample/ios-sample/main.m | 26 -- .../examples/BazelBuildSamples/messages.proto | 118 ----- .../examples/BazelBuildSamples/rmt/BUILD | 28 -- .../examples/BazelBuildSamples/rmt/test.proto | 57 --- .../InterceptorSample/Info.plist | 2 +- 17 files changed, 57 insertions(+), 1111 deletions(-) delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/Podfile delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample.xcodeproj/project.pbxproj delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.h delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.m delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/Contents.json delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/LaunchScreen.storyboard delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/Main.storyboard delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Info.plist delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.h delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.m delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/main.m delete mode 100644 src/objective-c/examples/BazelBuildSamples/messages.proto delete mode 100644 src/objective-c/examples/BazelBuildSamples/rmt/BUILD delete mode 100644 src/objective-c/examples/BazelBuildSamples/rmt/test.proto diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index 27ddfcd6031..d3a5a76b89a 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -15,55 +15,83 @@ # limitations under the License. +load("//src/objective-c:grpc_objc_internal_library.bzl", "local_objc_grpc_library") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") -load( - "@com_github_grpc_grpc//bazel:objc_grpc_library.bzl", - "objc_grpc_library", -) +load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application") +load("@build_bazel_rules_apple//apple:watchos.bzl", "watchos_application") proto_library( name = "messages_proto", - srcs = ["BazelBuildSamples/messages.proto"], - visibility = ["//visibility:public"], + srcs = ["RemoteTestClient/messages.proto"], ) -objc_grpc_library( +proto_library( + name = "test_proto", + srcs = ["RemoteTestClient/test.proto"], + deps = [":messages_proto"], +) + +# use objc_grpc_library in bazel:objc_grpc_library.bzl when developing outside the repo +local_objc_grpc_library( name = "test_grpc_objc", - srcs = ["BazelBuildSamples/rmt/test.proto"], + srcs = ["RemoteTestClient/test.proto"], use_well_known_protos = True, deps = [ - "//src/objective-c/examples/BazelBuildSamples/rmt:test_proto", + "//src/objective-c/examples:test_proto", ], ) # Proof that without this works without srcs -objc_grpc_library( +local_objc_grpc_library( name = "test_objc", use_well_known_protos = True, deps = [ - "//src/objective-c/examples/BazelBuildSamples/rmt:test_proto", - ] + "//src/objective-c/examples:test_proto", + ], ) objc_library( - name = "ios-sample-lib", - srcs = glob(["BazelBuildSamples/ios-sample/ios-sample/**/*.m"]), - hdrs = glob(["BazelBuildSamples/ios-sample/ios-sample/**/*.h"]), + name = "Sample-lib", + srcs = glob(["Sample/**/*.m"]), + hdrs = glob(["Sample/**/*.h"]), data = glob([ - "BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/**/*", - "BazelBuildSamples/ios-sample/ios-sample/Base.lproj/**/*" + "Sample/Sample/Base.lproj/**", + "Sample/Sample/Images.xcassets/**", ]), - deps = [ - ":test_grpc_objc", - ] + deps = [":test_grpc_objc"], ) ios_application( - name = "ios-sample", - bundle_id = "com.google.ios-sample-objc-bazel", - families = ["iphone"], - minimum_os_version = "9.0", - infoplists = ["BazelBuildSamples/ios-sample/ios-sample/Info.plist"], - visibility = ["//visibility:public"], - deps = [":ios-sample-lib"], -) \ No newline at end of file + name = "Sample", + bundle_id = "grpc.objc.examples.Sample", + minimum_os_version = "8.0", + infoplists = ["Sample/Sample/Info.plist"], + families = [ + "iphone", + "ipad", + ], + deps = ["Sample-lib"], +) + +objc_library( + name = "InterceptorSample-lib", + srcs = glob(["InterceptorSample/**/*.m"]), + hdrs = glob(["InterceptorSample/**/*.h"]), + data = glob([ + "InterceptorSample/InterceptorSample/Base.lproj/**", + "InterceptorSample/InterceptorSample/Images.xcassets/**", + ]), + deps = [":test_grpc_objc"], +) + +ios_application( + name = "InterceptorSample", + bundle_id = "grpc.objc.examples.InterceptorSample", + minimum_os_version = "9.0", # Safe Area Layout Guide used + infoplists = ["InterceptorSample/InterceptorSample/Info.plist"], + families = [ + "iphone", + "ipad", + ], + deps = ["InterceptorSample-lib"], +) diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/Podfile b/src/objective-c/examples/BazelBuildSamples/ios-sample/Podfile deleted file mode 100644 index 8648992d84f..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/Podfile +++ /dev/null @@ -1,31 +0,0 @@ -platform :ios, '8.0' - -install! 'cocoapods', :deterministic_uuids => false - -ROOT_DIR = '../../../../..' - -target 'ios-sample' do - pod 'gRPC-ProtoRPC', :path => ROOT_DIR - pod 'gRPC', :path => ROOT_DIR - pod 'gRPC-Core', :path => ROOT_DIR - pod 'gRPC-RxLibrary', :path => ROOT_DIR - pod 'RemoteTest', :path => "../../RemoteTestClient" - pod '!ProtoCompiler-gRPCPlugin', :path => "#{ROOT_DIR}/src/objective-c" -end - -pre_install do |installer| - grpc_core_spec = installer.pod_targets.find{|t| t.name.start_with?('gRPC-Core')}.root_spec - - src_root = "$(PODS_TARGET_SRCROOT)" - grpc_core_spec.pod_target_xcconfig = { - 'GRPC_SRC_ROOT' => src_root, - 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', - 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"', - # If we don't set these two settings, `include/grpc/support/time.h` and - # `src/core/lib/gpr/string.h` shadow the system `` and ``, breaking the - # build. - 'USE_HEADERMAP' => 'NO', - 'ALWAYS_SEARCH_USER_PATHS' => 'NO', - } -end - diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample.xcodeproj/project.pbxproj deleted file mode 100644 index 05344a69bfc..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample.xcodeproj/project.pbxproj +++ /dev/null @@ -1,413 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 50; - objects = { - -/* Begin PBXBuildFile section */ - AB433CC922D7E38000D579CC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AB433CC822D7E38000D579CC /* AppDelegate.m */; }; - AB433CCC22D7E38000D579CC /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB433CCB22D7E38000D579CC /* ViewController.m */; }; - AB433CCF22D7E38000D579CC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB433CCD22D7E38000D579CC /* Main.storyboard */; }; - AB433CD122D7E38100D579CC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AB433CD022D7E38100D579CC /* Assets.xcassets */; }; - AB433CD422D7E38100D579CC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB433CD222D7E38100D579CC /* LaunchScreen.storyboard */; }; - AB433CD722D7E38100D579CC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AB433CD622D7E38100D579CC /* main.m */; }; - ED11F6CDF54788FC7CFD87B1 /* libPods-ios-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AF80A181E30BD84FA56BE33 /* libPods-ios-sample.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 112D4595FA3E81552DA9E877 /* Pods-ios-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios-sample.release.xcconfig"; path = "Target Support Files/Pods-ios-sample/Pods-ios-sample.release.xcconfig"; sourceTree = ""; }; - 5AF80A181E30BD84FA56BE33 /* libPods-ios-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ios-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 72599BE4AC5785D3368D40DD /* Pods-ios-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios-sample.debug.xcconfig"; path = "Target Support Files/Pods-ios-sample/Pods-ios-sample.debug.xcconfig"; sourceTree = ""; }; - AB433CC422D7E38000D579CC /* ios-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ios-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - AB433CC722D7E38000D579CC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - AB433CC822D7E38000D579CC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - AB433CCA22D7E38000D579CC /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - AB433CCB22D7E38000D579CC /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - AB433CCE22D7E38000D579CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - AB433CD022D7E38100D579CC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - AB433CD322D7E38100D579CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - AB433CD522D7E38100D579CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - AB433CD622D7E38100D579CC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - AB433CC122D7E38000D579CC /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ED11F6CDF54788FC7CFD87B1 /* libPods-ios-sample.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 2A170580B60E92B1A65525D4 /* Pods */ = { - isa = PBXGroup; - children = ( - 72599BE4AC5785D3368D40DD /* Pods-ios-sample.debug.xcconfig */, - 112D4595FA3E81552DA9E877 /* Pods-ios-sample.release.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; - AB433CBB22D7E38000D579CC = { - isa = PBXGroup; - children = ( - AB433CC622D7E38000D579CC /* ios-sample */, - AB433CC522D7E38000D579CC /* Products */, - 2A170580B60E92B1A65525D4 /* Pods */, - FD148AE940967C50DB2C12CB /* Frameworks */, - ); - sourceTree = ""; - }; - AB433CC522D7E38000D579CC /* Products */ = { - isa = PBXGroup; - children = ( - AB433CC422D7E38000D579CC /* ios-sample.app */, - ); - name = Products; - sourceTree = ""; - }; - AB433CC622D7E38000D579CC /* ios-sample */ = { - isa = PBXGroup; - children = ( - AB433CC722D7E38000D579CC /* AppDelegate.h */, - AB433CC822D7E38000D579CC /* AppDelegate.m */, - AB433CCA22D7E38000D579CC /* ViewController.h */, - AB433CCB22D7E38000D579CC /* ViewController.m */, - AB433CCD22D7E38000D579CC /* Main.storyboard */, - AB433CD022D7E38100D579CC /* Assets.xcassets */, - AB433CD222D7E38100D579CC /* LaunchScreen.storyboard */, - AB433CD522D7E38100D579CC /* Info.plist */, - AB433CD622D7E38100D579CC /* main.m */, - ); - path = "ios-sample"; - sourceTree = ""; - }; - FD148AE940967C50DB2C12CB /* Frameworks */ = { - isa = PBXGroup; - children = ( - 5AF80A181E30BD84FA56BE33 /* libPods-ios-sample.a */, - ); - name = Frameworks; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - AB433CC322D7E38000D579CC /* ios-sample */ = { - isa = PBXNativeTarget; - buildConfigurationList = AB433CDA22D7E38100D579CC /* Build configuration list for PBXNativeTarget "ios-sample" */; - buildPhases = ( - 9DD34A50D448CD3F464D4A3C /* [CP] Check Pods Manifest.lock */, - AB433CC022D7E38000D579CC /* Sources */, - AB433CC122D7E38000D579CC /* Frameworks */, - AB433CC222D7E38000D579CC /* Resources */, - 630985F7228D41528084692C /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "ios-sample"; - productName = "ios-sample"; - productReference = AB433CC422D7E38000D579CC /* ios-sample.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - AB433CBC22D7E38000D579CC /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1010; - ORGANIZATIONNAME = "Tony Lu"; - TargetAttributes = { - AB433CC322D7E38000D579CC = { - CreatedOnToolsVersion = 10.1; - }; - }; - }; - buildConfigurationList = AB433CBF22D7E38000D579CC /* Build configuration list for PBXProject "ios-sample" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = AB433CBB22D7E38000D579CC; - productRefGroup = AB433CC522D7E38000D579CC /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - AB433CC322D7E38000D579CC /* ios-sample */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - AB433CC222D7E38000D579CC /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AB433CD422D7E38100D579CC /* LaunchScreen.storyboard in Resources */, - AB433CD122D7E38100D579CC /* Assets.xcassets in Resources */, - AB433CCF22D7E38000D579CC /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 630985F7228D41528084692C /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ios-sample/Pods-ios-sample-resources-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ios-sample/Pods-ios-sample-resources-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ios-sample/Pods-ios-sample-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 9DD34A50D448CD3F464D4A3C /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-ios-sample-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - AB433CC022D7E38000D579CC /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AB433CCC22D7E38000D579CC /* ViewController.m in Sources */, - AB433CD722D7E38100D579CC /* main.m in Sources */, - AB433CC922D7E38000D579CC /* AppDelegate.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - AB433CCD22D7E38000D579CC /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - AB433CCE22D7E38000D579CC /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - AB433CD222D7E38100D579CC /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - AB433CD322D7E38100D579CC /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - AB433CD822D7E38100D579CC /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - AB433CD922D7E38100D579CC /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - AB433CDB22D7E38100D579CC /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72599BE4AC5785D3368D40DD /* Pods-ios-sample.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 6T98ZJNPG5; - INFOPLIST_FILE = "ios-sample/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.google.ios-sample-objc-bazel"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - AB433CDC22D7E38100D579CC /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 112D4595FA3E81552DA9E877 /* Pods-ios-sample.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 6T98ZJNPG5; - INFOPLIST_FILE = "ios-sample/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.google.ios-sample-objc-bazel"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - AB433CBF22D7E38000D579CC /* Build configuration list for PBXProject "ios-sample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - AB433CD822D7E38100D579CC /* Debug */, - AB433CD922D7E38100D579CC /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - AB433CDA22D7E38100D579CC /* Build configuration list for PBXNativeTarget "ios-sample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - AB433CDB22D7E38100D579CC /* Debug */, - AB433CDC22D7E38100D579CC /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = AB433CBC22D7E38000D579CC /* Project object */; -} diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.h b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.h deleted file mode 100644 index 183abcf4ec8..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import - -@interface AppDelegate : UIResponder - -@property(strong, nonatomic) UIWindow* window; - -@end diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.m b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.m deleted file mode 100644 index d78f5f2175c..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.m +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "AppDelegate.h" - -@interface AppDelegate () - -@end - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application - didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. - return YES; -} - -- (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for - // certain types of temporary interruptions (such as an incoming phone call or SMS message) or - // when the user quits the application and it begins the transition to the background state. Use - // this method to pause ongoing tasks, disable timers, and invalidate graphics rendering - // callbacks. Games should use this method to pause the game. -} - -- (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store - // enough application state information to restore your application to its current state in case - // it is terminated later. If your application supports background execution, this method is - // called instead of applicationWillTerminate: when the user quits. -} - -- (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the active state; here you can undo - // many of the changes made on entering the background. -} - -- (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If - // the application was previously in the background, optionally refresh the user interface. -} - -- (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also - // applicationDidEnterBackground:. -} - -@end diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index d8db8d65fd7..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "83.5x83.5", - "scale" : "2x" - }, - { - "idiom" : "ios-marketing", - "size" : "1024x1024", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/Contents.json b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c918..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/LaunchScreen.storyboard b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index bfa36129419..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/Main.storyboard b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/Main.storyboard deleted file mode 100644 index 5e257390b33..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/Main.storyboard +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Info.plist b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Info.plist deleted file mode 100644 index e5d82108923..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Info.plist +++ /dev/null @@ -1,45 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en_US - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.h b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.h deleted file mode 100644 index 0aa0b2a73a7..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import - -@interface ViewController : UIViewController - -@end diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.m b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.m deleted file mode 100644 index 6cb5a0be9df..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.m +++ /dev/null @@ -1,86 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "ViewController.h" - -#import -#if COCOAPODS -#import -#import -#else -#import "src/objective-c/examples/BazelBuildSamples/Messages.pbobjc.h" -#import "src/objective-c/examples/BazelBuildSamples/rmt/Test.pbrpc.h" -#endif - -static NSString *const kPackage = @"grpc.testing"; -static NSString *const kService = @"TestService"; - -@interface ViewController () - -@end - -@implementation ViewController { - GRPCCallOptions *_options; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // optionally modify options - _options = options; -} - -- (IBAction)tapCall:(id)sender { - GRPCProtoMethod *kUnaryCallMethod = - [[GRPCProtoMethod alloc] initWithPackage:kPackage service:kService method:@"UnaryCall"]; - - GRPCRequestOptions *requestOptions = - [[GRPCRequestOptions alloc] initWithHost:@"grpc-test.sandbox.googleapis.com" - path:kUnaryCallMethod.HTTPPath - safety:GRPCCallSafetyCacheableRequest]; - - GRPCCall2 *call = [[GRPCCall2 alloc] initWithRequestOptions:requestOptions - responseHandler:self - callOptions:_options]; - - RMTSimpleRequest *request = [RMTSimpleRequest message]; - request.responseSize = 100; - - [call start]; - [call writeData:[request data]]; - [call finish]; -} - -- (dispatch_queue_t)dispatchQueue { - return dispatch_get_main_queue(); -} - -- (void)didReceiveInitialMetadata:(NSDictionary *)initialMetadata { - NSLog(@"Header: %@", initialMetadata); -} - -- (void)didReceiveData:(id)data { - NSLog(@"Message: %@", data); -} - -- (void)didCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { - NSLog(@"Trailer: %@\nError: %@", trailingMetadata, error); -} - -@end diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/main.m b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/main.m deleted file mode 100644 index 2797c6f17f2..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/main.m +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import -#import "AppDelegate.h" - -int main(int argc, char* argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/src/objective-c/examples/BazelBuildSamples/messages.proto b/src/objective-c/examples/BazelBuildSamples/messages.proto deleted file mode 100644 index 128efd9337e..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/messages.proto +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Message definitions to be used by integration test service definitions. - -syntax = "proto3"; - -package grpc.testing; - -option objc_class_prefix = "RMT"; - -// The type of payload that should be returned. -enum PayloadType { - // Compressable text format. - COMPRESSABLE = 0; - - // Uncompressable binary format. - UNCOMPRESSABLE = 1; - - // Randomly chosen from all other formats defined in this enum. - RANDOM = 2; -} - -// A block of data, to simply increase gRPC message size. -message Payload { - // The type of data in body. - PayloadType type = 1; - // Primary contents of payload. - bytes body = 2; -} - -// Unary request. -message SimpleRequest { - // Desired payload type in the response from the server. - // If response_type is RANDOM, server randomly chooses one from other formats. - PayloadType response_type = 1; - - // Desired payload size in the response from the server. - // If response_type is COMPRESSABLE, this denotes the size before compression. - int32 response_size = 2; - - // Optional input payload sent along with the request. - Payload payload = 3; - - // Whether SimpleResponse should include username. - bool fill_username = 4; - - // Whether SimpleResponse should include OAuth scope. - bool fill_oauth_scope = 5; -} - -// Unary response, as configured by the request. -message SimpleResponse { - // Payload to increase message size. - Payload payload = 1; - // The user the request came from, for verifying authentication was - // successful when the client expected it. - string username = 2; - // OAuth scope. - string oauth_scope = 3; -} - -// Client-streaming request. -message StreamingInputCallRequest { - // Optional input payload sent along with the request. - Payload payload = 1; - - // Not expecting any payload from the response. -} - -// Client-streaming response. -message StreamingInputCallResponse { - // Aggregated size of payloads received from the client. - int32 aggregated_payload_size = 1; -} - -// Configuration for a particular response. -message ResponseParameters { - // Desired payload sizes in responses from the server. - // If response_type is COMPRESSABLE, this denotes the size before compression. - int32 size = 1; - - // Desired interval between consecutive responses in the response stream in - // microseconds. - int32 interval_us = 2; -} - -// Server-streaming request. -message StreamingOutputCallRequest { - // Desired payload type in the response from the server. - // If response_type is RANDOM, the payload from each response in the stream - // might be of different types. This is to simulate a mixed type of payload - // stream. - PayloadType response_type = 1; - - // Configuration for each expected response message. - repeated ResponseParameters response_parameters = 2; - - // Optional input payload sent along with the request. - Payload payload = 3; -} - -// Server-streaming response, as configured by the request and parameters. -message StreamingOutputCallResponse { - // Payload to increase response size. - Payload payload = 1; -} diff --git a/src/objective-c/examples/BazelBuildSamples/rmt/BUILD b/src/objective-c/examples/BazelBuildSamples/rmt/BUILD deleted file mode 100644 index 5264196c08e..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/rmt/BUILD +++ /dev/null @@ -1,28 +0,0 @@ -# gRPC Bazel BUILD file. -# -# Copyright 2019 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -licenses(["notice"]) # Apache v2 - -package(default_visibility = ["//visibility:public"]) - -exports_files(["LICENSE"]) - -proto_library( - name = "test_proto", - srcs = ["test.proto"], - deps = ["//src/objective-c/examples:messages_proto"], - visibility = ["//visibility:public"], -) \ No newline at end of file diff --git a/src/objective-c/examples/BazelBuildSamples/rmt/test.proto b/src/objective-c/examples/BazelBuildSamples/rmt/test.proto deleted file mode 100644 index ddc511e1428..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/rmt/test.proto +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// An integration test service that covers all the method signature permutations -// of unary/streaming requests/responses. -syntax = "proto3"; - -import "google/protobuf/empty.proto"; -import "src/objective-c/examples/BazelBuildSamples/messages.proto"; - -package grpc.testing; - -option objc_class_prefix = "RMT"; - -// A simple service to test the various types of RPCs and experiment with -// performance with various types of payload. -service TestService { - // One empty request followed by one empty response. - rpc EmptyCall(google.protobuf.Empty) returns (google.protobuf.Empty); - - // One request followed by one response. - rpc UnaryCall(SimpleRequest) returns (SimpleResponse); - - // One request followed by a sequence of responses (streamed download). - // The server returns the payload with client desired type and sizes. - rpc StreamingOutputCall(StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); - - // A sequence of requests followed by one response (streamed upload). - // The server returns the aggregated size of client payload as the result. - rpc StreamingInputCall(stream StreamingInputCallRequest) - returns (StreamingInputCallResponse); - - // A sequence of requests with each request served by the server immediately. - // As one request could lead to multiple responses, this interface - // demonstrates the idea of full duplexing. - rpc FullDuplexCall(stream StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); - - // A sequence of requests followed by a sequence of responses. - // The server buffers all the client requests and then serves them in order. A - // stream of responses are returned to the client when the server starts with - // first request. - rpc HalfDuplexCall(stream StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); -} diff --git a/src/objective-c/examples/InterceptorSample/InterceptorSample/Info.plist b/src/objective-c/examples/InterceptorSample/InterceptorSample/Info.plist index 16be3b68112..e5d82108923 100644 --- a/src/objective-c/examples/InterceptorSample/InterceptorSample/Info.plist +++ b/src/objective-c/examples/InterceptorSample/InterceptorSample/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en_US CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier From 6522294325382399e28285c972fff597dbc6b88f Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 5 Aug 2019 21:04:21 -0700 Subject: [PATCH 208/661] Fix key gen in locality picking --- src/core/ext/filters/client_channel/lb_policy/xds/xds.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 9721972511a..81f17fbfe3d 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -559,9 +559,8 @@ class XdsLb : public LoadBalancingPolicy { XdsLb::PickResult XdsLb::Picker::Pick(PickArgs args) { // TODO(roth): Add support for drop handling. - // Generate a random number between 0 and the total weight - const uint32_t key = - (rand() * pickers_[pickers_.size() - 1].first) / RAND_MAX; + // Generate a random number in [0, total weight). + const uint32_t key = rand() % pickers_[pickers_.size() - 1].first; // Forward pick to whichever locality maps to the range in which the // random number falls in. PickResult result = PickFromLocality(key, args); From e2ba3aa07009292617c3cabe734e8e44099b22ac Mon Sep 17 00:00:00 2001 From: "Lukacs T. Berki" Date: Tue, 6 Aug 2019 14:00:11 +0200 Subject: [PATCH 209/661] Update C++ code generation to work with Bazel 0.29 . The above Bazel version changes proto compilation slightly: some proto files are put into a `_virtual_imports` directory and thus `_get_include_directory` needs to be updated accordingly. Ideally, it would use instead the `ProtoInfo` provider to tease out the proto import directories, but that's a bit more intrusive change. --- bazel/protobuf.bzl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bazel/protobuf.bzl b/bazel/protobuf.bzl index f2df7bd87b2..3066e1d5500 100644 --- a/bazel/protobuf.bzl +++ b/bazel/protobuf.bzl @@ -59,6 +59,13 @@ def proto_path_to_generated_filename(proto_path, fmt_str): def _get_include_directory(include): directory = include.path prefix_len = 0 + + virtual_imports = "/_virtual_imports/" + if not include.is_source and virtual_imports in include.path: + root, relative = include.path.split(virtual_imports, 2) + result = root + virtual_imports + relative.split("/", 1)[0] + return result + if not include.is_source and directory.startswith(include.root.path): prefix_len = len(include.root.path) + 1 From de3131016d4580077f91cef6702dc7ffaea0b375 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 6 Aug 2019 08:52:31 -0700 Subject: [PATCH 210/661] update BUILD following the new style --- bazel/grpc_build_system.bzl | 9 +- src/compiler/objective_c_plugin.cc | 4 +- src/objective-c/BUILD | 159 ++++++++++++++++++------ src/objective-c/ProtoRPC/ProtoService.m | 2 +- 4 files changed, 128 insertions(+), 46 deletions(-) diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 9e967d8fa9a..c31f3421a58 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -24,7 +24,6 @@ # load("//bazel:cc_grpc_library.bzl", "cc_grpc_library") -load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library") # The set of pollers to test against if a test exercises polling @@ -199,12 +198,6 @@ def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], da ) def grpc_generate_one_off_targets(): - apple_resource_bundle( - # The choice of name is signicant here, since it determines the bundle name. - name = "gRPCCertificates", - resources = ["etc/roots.pem"], - ) - # In open-source, grpc_objc* libraries depend directly on //:grpc native.alias( name = "grpc_objc", @@ -256,7 +249,7 @@ def grpc_package(name, visibility = "private", features = []): def grpc_objc_library( name, - srcs, + srcs = [], hdrs = [], textual_hdrs = [], data = [], diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index 03f7f721b1a..f9066af4aa6 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -205,10 +205,10 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string imports; if (framework.empty()) { imports = LocalImport(file_name + ".pbrpc.h") + - LocalImport(file_name + ".pbobjc.h") + + LocalImport(file_name + ".pbobjc.h"); } else { imports = FrameworkImport(file_name + ".pbrpc.h", framework) + - FrameworkImport(file_name + ".pbobjc.h", framework) + + FrameworkImport(file_name + ".pbobjc.h", framework); } imports += (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoRPC.h") diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index 2492ce8a21f..ba973141bcd 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -24,18 +24,26 @@ exports_files(["LICENSE"]) grpc_objc_use_cronet_config() +grpc_objc_library( + name = "rx_library_headers", + hdrs = glob([ + "RxLibrary/*.h", + "RxLibrary/transformations/*.h", + ]), + includes = ["."], +) + grpc_objc_library( name = "rx_library", srcs = glob([ "RxLibrary/*.m", "RxLibrary/transformations/*.m", ]), - hdrs = glob([ - "RxLibrary/*.h", - "RxLibrary/transformations/*.h", - ]), includes = ["."], - deps = [":rx_library_private"], + deps = [ + ":rx_library_private", + ":rx_library_headers", + ], ) grpc_objc_library( @@ -50,47 +58,128 @@ grpc_objc_library( ) grpc_objc_library( - name = "grpc_objc_client", - srcs = glob( - [ - "GRPCClient/*.m", - "GRPCClient/private/*.m", - ], - exclude = ["GRPCClient/GRPCCall+GID.m"], - ), - hdrs = glob( - [ - "GRPCClient/*.h", - "GRPCClient/internal/*.h", - ], - exclude = ["GRPCClient/GRPCCall+GID.h"], - ), - data = ["//:gRPCCertificates"], + name = "grpc_objc_interface_legacy", + hdrs = [ + "GRPCClient/GRPCCallLegacy.h", + "GRPCClient/GRPCTypes.h", + ], + deps = [ + "rx_library_headers", + ], +) + +grpc_objc_library( + name = "grpc_objc_interface", + hdrs = [ + "GRPCClient/GRPCCall.h", + "GRPCClient/GRPCCall+Interceptor.h", + "GRPCClient/GRPCCallOptions.h", + "GRPCClient/GRPCInterceptor.h", + "GRPCClient/GRPCTransport.h", + "GRPCClient/GRPCDispatchable.h", + "GRPCClient/internal/GRPCCallOptions+Internal.h", + ], + srcs = [ + "GRPCClient/GRPCCall.m", + "GRPCClient/GRPCCall+Interceptor.m", + "GRPCClient/GRPCCallOptions.m", + "GRPCClient/GRPCInterceptor.m", + "GRPCClient/GRPCTransport.m", + "GRPCClient/private/GRPCTransport+Private.m", + ], includes = ["."], - textual_hdrs = glob([ - "GRPCClient/private/*.h", - ]), + textual_hdrs = [ + "GRPCClient/private/GRPCTransport+Private.h", + ], deps = [ + ":grpc_objc_interface_legacy", + ], +) + +grpc_objc_library( + name = "grpc_objc_client_core", + hdrs = [ + "GRPCClient/GRPCCall+ChannelCredentials.h", + "GRPCClient/GRPCCall+Cronet.h", + "GRPCClient/GRPCCall+OAuth2.h", + "GRPCClient/GRPCCall+Tests.h", + "GRPCClient/GRPCCall+ChannelArg.h", + ], + textual_hdrs = native.glob(["GRPCClient/private/GRPCCore/*.h"]), + srcs = [ + "GRPCClient/GRPCCall+ChannelArg.m", + "GRPCClient/GRPCCall+ChannelCredentials.m", + "GRPCClient/GRPCCall+Cronet.m", + "GRPCClient/GRPCCall+OAuth2.m", + "GRPCClient/GRPCCall+Tests.m", + "GRPCClient/GRPCCallLegacy.m", + ] + native.glob(["GRPCClient/private/GRPCCore/*.m"]), + data = [":gRPCCertificates"], + includes = ["."], + deps = [ + ":grpc_objc_interface", + ":grpc_objc_interface_legacy", ":rx_library", "//:grpc_objc", ], ) +alias( + name = "grpc_objc_client", + actual = "grpc_objc_client_core", +) + +grpc_objc_library( + name = "proto_objc_rpc_legacy_header", + hdrs = [ + "ProtoRPC/ProtoRPCLegacy.h", + ], + includes = ["."], +) + grpc_objc_library( + name = "proto_objc_rpc_v2", + srcs = [ + "ProtoRPC/ProtoMethod.m", + "ProtoRPC/ProtoRPC.m", + "ProtoRPC/ProtoService.m", + ], + hdrs = [ + "ProtoRPC/ProtoMethod.h", + "ProtoRPC/ProtoRPC.h", + "ProtoRPC/ProtoService.h", + ], + includes = ["."], + deps = [ + ":grpc_objc_interface", + ":proto_objc_rpc_legacy_header", + "@com_google_protobuf//:protobuf_objc", + ], +) + +native.objc_library( name = "proto_objc_rpc", - srcs = glob( - ["ProtoRPC/*.m"], - ), - hdrs = glob( - ["ProtoRPC/*.h"], - ), - # Different from Cocoapods, do not import as if @com_google_protobuf//:protobuf_objc is a framework, - # use the real paths of @com_google_protobuf//:protobuf_objc instead - defines = ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0"], - includes = ["src/objective-c"], + srcs = [ + "ProtoRPC/ProtoRPCLegacy.m", + "ProtoRPC/ProtoServiceLegacy.m", + ], + hdrs = [ + "ProtoRPC/ProtoServiceLegacy.h", + ], deps = [ - ":grpc_objc_client", ":rx_library", + ":proto_objc_rpc_v2", + ":proto_objc_rpc_legacy_header", + ":grpc_objc_client_core", "@com_google_protobuf//:protobuf_objc", ], ) + +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +apple_resource_bundle( + # The choice of name is signicant here, since it determines the bundle name. + name = "gRPCCertificates", + resources = ["etc/roots.pem"], +) + diff --git a/src/objective-c/ProtoRPC/ProtoService.m b/src/objective-c/ProtoRPC/ProtoService.m index c3684c8e2f2..40c51ed48e7 100644 --- a/src/objective-c/ProtoRPC/ProtoService.m +++ b/src/objective-c/ProtoRPC/ProtoService.m @@ -39,7 +39,7 @@ [NSException raise:NSGenericException format:@"Do not call init method of ProtoService"]; return [self initWithHost:nil packageName:nil serviceName:nil callOptions:nil]; } -#pragma clang diasnostic pop +#pragma clang diagnostic pop // Designated initializer - (instancetype)initWithHost:(NSString *)host From f0c3f7b1baa5ac14d8238f941b6276af8895e57a Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 6 Aug 2019 10:26:16 -0700 Subject: [PATCH 211/661] native.objc_library -> grpc_objc_library --- src/objective-c/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index ba973141bcd..26d0bf00384 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -157,7 +157,7 @@ grpc_objc_library( ], ) -native.objc_library( +grpc_objc_library( name = "proto_objc_rpc", srcs = [ "ProtoRPC/ProtoRPCLegacy.m", From 5fd25f3c7c04ef4153fe26fcb1e42a2a0556b829 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 6 Aug 2019 10:41:54 -0700 Subject: [PATCH 212/661] Refactor rule. --- bazel/protobuf.bzl | 60 +++++++++++++++++++++++++++++++++++ bazel/python_rules.bzl | 71 +++++++----------------------------------- 2 files changed, 72 insertions(+), 59 deletions(-) diff --git a/bazel/protobuf.bzl b/bazel/protobuf.bzl index f2df7bd87b2..39a8cabcdc9 100644 --- a/bazel/protobuf.bzl +++ b/bazel/protobuf.bzl @@ -102,3 +102,63 @@ def get_plugin_args(plugin, flags, dir_out, generate_mocks): "--plugin=protoc-gen-PLUGIN=" + plugin.path, "--PLUGIN_out=" + ",".join(augmented_flags) + ":" + dir_out, ] + +def _get_staged_proto_file(context, source_file): + if source_file.dirname == context.label.package: + return source_file + else: + copied_proto = context.actions.declare_file(source_file.basename) + context.actions.run_shell( + inputs = [source_file], + outputs = [copied_proto], + command = "cp {} {}".format(source_file.path, copied_proto.path), + mnemonic = "CopySourceProto", + ) + return copied_proto + + +def protos_from_context(context): + """Copies proto files to the appropriate location. + + Args: + context: The ctx object for the rule. + + Returns: + A list of the protos. + """ + protos = [] + for src in context.attr.deps: + for file in src[ProtoInfo].direct_sources: + protos.append(_get_staged_proto_file(context, file)) + return protos + + +def includes_from_deps(deps): + """Get includes from rule dependencies.""" + return [ + file + for src in deps + for file in src[ProtoInfo].transitive_imports.to_list() + ] + +def get_proto_arguments(protos, genfiles_dir_path): + """Get the protoc arguments specifying which protos to compile.""" + arguments = [] + for proto in protos: + massaged_path = proto.path + if massaged_path.startswith(genfiles_dir_path): + massaged_path = proto.path[len(genfiles_dir_path) + 1:] + arguments.append(massaged_path) + return arguments + +def declare_out_files(protos, context, generated_file_format): + """Declares and returns the files to be generated.""" + return [ + context.actions.declare_file( + proto_path_to_generated_filename( + proto.basename, + generated_file_format, + ), + ) + for proto in protos + ] diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl index 8f696b1022d..c8fdd1ed3c0 100644 --- a/bazel/python_rules.bzl +++ b/bazel/python_rules.bzl @@ -6,44 +6,20 @@ load( "get_plugin_args", "get_proto_root", "proto_path_to_generated_filename", + "protos_from_context", + "includes_from_deps", + "get_proto_arguments", + "declare_out_files", ) _GENERATED_PROTO_FORMAT = "{}_pb2.py" _GENERATED_GRPC_PROTO_FORMAT = "{}_pb2_grpc.py" -def _get_staged_proto_file(context, source_file): - if source_file.dirname == context.label.package: - return source_file - else: - copied_proto = context.actions.declare_file(source_file.basename) - context.actions.run_shell( - inputs = [source_file], - outputs = [copied_proto], - command = "cp {} {}".format(source_file.path, copied_proto.path), - mnemonic = "CopySourceProto", - ) - return copied_proto - def _generate_py_impl(context): - protos = [] - for src in context.attr.deps: - for file in src[ProtoInfo].direct_sources: - protos.append(_get_staged_proto_file(context, file)) - includes = [ - file - for src in context.attr.deps - for file in src[ProtoInfo].transitive_imports.to_list() - ] + protos = protos_from_context(context) + includes = includes_from_deps(context.attr.deps) proto_root = get_proto_root(context.label.workspace_root) - out_files = [ - context.actions.declare_file( - proto_path_to_generated_filename( - proto.basename, - _GENERATED_PROTO_FORMAT, - ), - ) - for proto in protos - ] + out_files = declare_out_files(protos, context, _GENERATED_PROTO_FORMAT) tools = [context.executable._protoc] arguments = ([ @@ -54,11 +30,7 @@ def _generate_py_impl(context): "--proto_path={}".format(context.genfiles_dir.path) for proto in protos ]) - for proto in protos: - massaged_path = proto.path - if massaged_path.startswith(context.genfiles_dir.path): - massaged_path = proto.path[len(context.genfiles_dir.path) + 1:] - arguments.append(massaged_path) + arguments += get_proto_arguments(protos, context.genfiles_dir.path) context.actions.run( inputs = protos + includes, @@ -116,25 +88,10 @@ def py_proto_library( ) def _generate_pb2_grpc_src_impl(context): - protos = [] - for src in context.attr.deps: - for file in src[ProtoInfo].direct_sources: - protos.append(_get_staged_proto_file(context, file)) - includes = [ - file - for src in context.attr.deps - for file in src[ProtoInfo].transitive_imports.to_list() - ] + protos = protos_from_context(context) + includes = includes_from_deps(context.attr.deps) proto_root = get_proto_root(context.label.workspace_root) - out_files = [ - context.actions.declare_file( - proto_path_to_generated_filename( - proto.basename, - _GENERATED_GRPC_PROTO_FORMAT, - ), - ) - for proto in protos - ] + out_files = declare_out_files(protos, context, _GENERATED_GRPC_PROTO_FORMAT) arguments = [] tools = [context.executable._protoc, context.executable._plugin] @@ -150,11 +107,7 @@ def _generate_pb2_grpc_src_impl(context): "--proto_path={}".format(context.genfiles_dir.path) for proto in protos ] - for proto in protos: - massaged_path = proto.path - if massaged_path.startswith(context.genfiles_dir.path): - massaged_path = proto.path[len(context.genfiles_dir.path) + 1:] - arguments.append(massaged_path) + arguments += get_proto_arguments(protos, context.genfiles_dir.path) context.actions.run( inputs = protos + includes, From 82b2dbfc1dfe9ba07c1b0ee61a08df8fdd0ec7ef Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 6 Aug 2019 12:04:02 -0700 Subject: [PATCH 213/661] Fix import issue --- src/objective-c/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index 26d0bf00384..13a26187e9f 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -180,6 +180,6 @@ load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") apple_resource_bundle( # The choice of name is signicant here, since it determines the bundle name. name = "gRPCCertificates", - resources = ["etc/roots.pem"], + resources = ["//:etc/roots.pem"], ) From b99d3e146497b06e556317c1aa6a43f364ae2772 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 6 Aug 2019 14:10:14 -0700 Subject: [PATCH 214/661] Remove redundant and problematic memset --- src/core/ext/filters/client_idle/client_idle_filter.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/ext/filters/client_idle/client_idle_filter.cc b/src/core/ext/filters/client_idle/client_idle_filter.cc index d2b23a9d20f..542fad05b80 100644 --- a/src/core/ext/filters/client_idle/client_idle_filter.cc +++ b/src/core/ext/filters/client_idle/client_idle_filter.cc @@ -193,8 +193,6 @@ void ChannelData::EnterIdle() { GRPC_IDLE_FILTER_LOG("the channel will enter IDLE"); // Hold a ref to the channel stack for the transport op. GRPC_CHANNEL_STACK_REF(channel_stack_, "idle transport op"); - // Initialize the transport op. - memset(&idle_transport_op_, 0, sizeof(idle_transport_op_)); idle_transport_op_.disconnect_with_error = grpc_error_set_int( GRPC_ERROR_CREATE_FROM_STATIC_STRING("enter idle"), GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE, GRPC_CHANNEL_IDLE); From f212cbad9a2348e73a8158f5a6851bdb6765c160 Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Mon, 5 Aug 2019 13:20:29 -0700 Subject: [PATCH 215/661] Remove references to GRPCConnectivityMonitor from ConnectivityTestingApp --- .../Connectivity/ConnectivityTestingApp/ViewController.m | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/objective-c/tests/Connectivity/ConnectivityTestingApp/ViewController.m b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/ViewController.m index 3c77fe2f2c3..34c93878765 100644 --- a/src/objective-c/tests/Connectivity/ConnectivityTestingApp/ViewController.m +++ b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/ViewController.m @@ -24,8 +24,6 @@ #import #import -#import "src/objective-c/GRPCClient/private/GRPCConnectivityMonitor.h" - NSString *host = @"grpc-test.sandbox.googleapis.com"; @interface ViewController : UIViewController @@ -34,10 +32,6 @@ NSString *host = @"grpc-test.sandbox.googleapis.com"; @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; - -#ifndef GRPC_CFSTREAM - [GRPCConnectivityMonitor registerObserver:self selector:@selector(reachabilityChanged:)]; -#endif } - (void)reachabilityChanged:(NSNotification *)note { From 3db88288767e903db35130c03c920fca709047be Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 6 Aug 2019 15:24:09 -0700 Subject: [PATCH 216/661] Add TODOs for prefix stripping --- examples/python/debug/get_stats.py | 1 + src/python/grpcio_channelz/grpc_channelz/v1/channelz.py | 1 + src/python/grpcio_health_checking/grpc_health/v1/health.py | 2 +- .../grpcio_reflection/grpc_reflection/v1alpha/reflection.py | 1 + .../grpcio_tests/tests/channelz/_channelz_servicer_test.py | 2 ++ .../grpcio_tests/tests/health_check/_health_servicer_test.py | 2 +- .../grpcio_tests/tests/reflection/_reflection_servicer_test.py | 2 ++ 7 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/python/debug/get_stats.py b/examples/python/debug/get_stats.py index 6eb593deb22..2da51d0efcf 100644 --- a/examples/python/debug/get_stats.py +++ b/examples/python/debug/get_stats.py @@ -21,6 +21,7 @@ import logging import argparse import grpc +# TODO(https://github.com/grpc/grpc/issues/19863): Remove. try: from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2 from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2_grpc diff --git a/src/python/grpcio_channelz/grpc_channelz/v1/channelz.py b/src/python/grpcio_channelz/grpc_channelz/v1/channelz.py index 18810cab290..965797f89ec 100644 --- a/src/python/grpcio_channelz/grpc_channelz/v1/channelz.py +++ b/src/python/grpcio_channelz/grpc_channelz/v1/channelz.py @@ -16,6 +16,7 @@ import grpc from grpc._cython import cygrpc +# TODO(https://github.com/grpc/grpc/issues/19863): Remove. try: from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2 as _channelz_pb2 from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2_grpc as _channelz_pb2_grpc diff --git a/src/python/grpcio_health_checking/grpc_health/v1/health.py b/src/python/grpcio_health_checking/grpc_health/v1/health.py index 93c1895df4c..a0d55570990 100644 --- a/src/python/grpcio_health_checking/grpc_health/v1/health.py +++ b/src/python/grpcio_health_checking/grpc_health/v1/health.py @@ -18,7 +18,7 @@ import threading import grpc -# Import using an absolute path to ensure no duplicate loaded modules. +# TODO(https://github.com/grpc/grpc/issues/19863): Remove. try: from src.python.grpcio_health_checking.grpc_health.v1 import health_pb2 as _health_pb2 from src.python.grpcio_health_checking.grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc diff --git a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py index bc76136cc5a..61153d9d625 100644 --- a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py +++ b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py @@ -17,6 +17,7 @@ import grpc from google.protobuf import descriptor_pb2 from google.protobuf import descriptor_pool +# TODO(https://github.com/grpc/grpc/issues/19863): Remove. try: from src.python.grpcio_reflection.grpc_reflection.v1alpha \ import reflection_pb2 as _reflection_pb2 diff --git a/src/python/grpcio_tests/tests/channelz/_channelz_servicer_test.py b/src/python/grpcio_tests/tests/channelz/_channelz_servicer_test.py index bfe184107ec..f2357a4e4a3 100644 --- a/src/python/grpcio_tests/tests/channelz/_channelz_servicer_test.py +++ b/src/python/grpcio_tests/tests/channelz/_channelz_servicer_test.py @@ -18,6 +18,8 @@ import unittest from concurrent import futures import grpc + +# TODO(https://github.com/grpc/grpc/issues/19863): Remove. try: from src.python.grpcio_channelz.grpc_channelz.v1 import channelz from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2 diff --git a/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py b/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py index 91e841a4d60..428806c71b0 100644 --- a/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py +++ b/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py @@ -20,7 +20,7 @@ import unittest import grpc -# Import using an absolute path to ensure no duplicate loaded modules. +# TODO(https://github.com/grpc/grpc/issues/19863): Remove. try: from src.python.grpcio_health_checking.grpc_health.v1 import health from src.python.grpcio_health_checking.grpc_health.v1 import health_pb2 diff --git a/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py b/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py index 1a1fdc83163..e45f98abec6 100644 --- a/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py +++ b/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py @@ -16,6 +16,8 @@ import unittest import grpc + +# TODO(https://github.com/grpc/grpc/issues/19863): Remove. try: from src.python.grpcio_reflection.grpc_reflection.v1alpha import reflection from src.python.grpcio_reflection.grpc_reflection.v1alpha import reflection_pb2 From f88bd06ee5203013b15989df75827a65516f97e4 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 30 Jul 2019 09:59:44 -0700 Subject: [PATCH 217/661] Go UPB! --- .clang_complete | 23 +- BUILD | 151 +- BUILD.gn | 38 + CMakeLists.txt | 4489 +++++++++++------ Makefile | 128 +- bazel/grpc_build_system.bzl | 5 +- bazel/grpc_deps.bzl | 6 +- build.yaml | 60 +- cmake/upb.cmake | 19 + config.m4 | 29 +- config.w32 | 43 +- gRPC-C++.podspec | 18 + gRPC-Core.podspec | 46 + grpc.gemspec | 29 + grpc.gyp | 128 +- package.xml | 29 + setup.py | 23 +- .../google/protobuf/descriptor.upb.c | 485 -- .../google/protobuf/descriptor.upb.h | 1690 ------- .../proto}/grpc/gcp/altscontext.upb.c | 4 +- .../proto}/grpc/gcp/altscontext.upb.h | 8 +- .../{ => src/proto}/grpc/gcp/handshaker.upb.c | 4 +- .../{ => src/proto}/grpc/gcp/handshaker.upb.h | 8 +- .../grpc/gcp/transport_security_common.upb.c | 4 +- .../grpc/gcp/transport_security_common.upb.h | 8 +- .../proto}/grpc/health/v1/health.upb.c | 4 +- .../proto}/grpc/health/v1/health.upb.h | 8 +- .../proto}/grpc/lb/v1/load_balancer.upb.c | 4 +- .../proto}/grpc/lb/v1/load_balancer.upb.h | 8 +- src/python/grpcio/grpc_core_dependencies.py | 18 + src/ruby/ext/grpc/ext-export.clang | 1 + src/ruby/ext/grpc/ext-export.gcc | 6 + src/ruby/ext/grpc/extconf.rb | 5 + src/upb/gen_build_yaml.py | 40 +- templates/CMakeLists.txt.template | 33 +- templates/Makefile.template | 6 +- templates/config.m4.template | 5 +- templates/config.w32.template | 9 +- templates/gRPC-C++.podspec.template | 6 + templates/gRPC-Core.podspec.template | 6 + third_party/upb | 2 +- tools/codegen/core/gen_upb_api.sh | 13 +- .../clang_tidy_all_the_things.sh | 2 +- tools/doxygen/Doxyfile.c++.internal | 11 +- tools/doxygen/Doxyfile.core.internal | 31 +- tools/profiling/ios_bin/binary_size.py | 4 +- .../generated/sources_and_headers.json | 111 +- tools/run_tests/sanity/check_submodules.sh | 2 +- 48 files changed, 3744 insertions(+), 4066 deletions(-) create mode 100644 cmake/upb.cmake delete mode 100644 src/core/ext/upb-generated/google/protobuf/descriptor.upb.c delete mode 100644 src/core/ext/upb-generated/google/protobuf/descriptor.upb.h rename src/core/ext/upb-generated/{ => src/proto}/grpc/gcp/altscontext.upb.c (93%) rename src/core/ext/upb-generated/{ => src/proto}/grpc/gcp/altscontext.upb.h (97%) rename src/core/ext/upb-generated/{ => src/proto}/grpc/gcp/handshaker.upb.c (98%) rename src/core/ext/upb-generated/{ => src/proto}/grpc/gcp/handshaker.upb.h (99%) rename src/core/ext/upb-generated/{ => src/proto}/grpc/gcp/transport_security_common.upb.c (89%) rename src/core/ext/upb-generated/{ => src/proto}/grpc/gcp/transport_security_common.upb.h (95%) rename src/core/ext/upb-generated/{ => src/proto}/grpc/health/v1/health.upb.c (89%) rename src/core/ext/upb-generated/{ => src/proto}/grpc/health/v1/health.upb.h (94%) rename src/core/ext/upb-generated/{ => src/proto}/grpc/lb/v1/load_balancer.upb.c (97%) rename src/core/ext/upb-generated/{ => src/proto}/grpc/lb/v1/load_balancer.upb.h (99%) create mode 100644 src/ruby/ext/grpc/ext-export.clang create mode 100644 src/ruby/ext/grpc/ext-export.gcc diff --git a/.clang_complete b/.clang_complete index 1448b01342d..f789455ea95 100644 --- a/.clang_complete +++ b/.clang_complete @@ -1,18 +1,19 @@ -Wall -Wc++-compat --Ithird_party/googletest/include --Ithird_party/googletest --Iinclude --Igens -I. --Ithird_party/boringssl/include --Ithird_party/benchmark/include --Ithird_party/zlib --Ithird_party/protobuf/src +-Igens +-Iinclude +-Isrc/core/ext/upb-generated -Ithird_party/abseil-cpp --Ithird_party/cares/cares +-Ithird_party/benchmark/include +-Ithird_party/boringssl/include -Ithird_party/cares --Ithird_party/googletest/googletest/include +-Ithird_party/cares/cares +-Ithird_party/googletest -Ithird_party/googletest/googlemock/include +-Ithird_party/googletest/googletest/include +-Ithird_party/googletest/include -Ithird_party/nanopb - +-Ithird_party/protobuf/src +-Ithird_party/upb +-Ithird_party/zlib diff --git a/BUILD b/BUILD index 39c6166cc5e..5da2eda36a3 100644 --- a/BUILD +++ b/BUILD @@ -342,7 +342,6 @@ grpc_cc_library( ], ) - grpc_cc_library( name = "grpc++_public_hdrs", hdrs = GRPCXX_PUBLIC_HDRS, @@ -1065,6 +1064,7 @@ grpc_cc_library( "grpc_base", "grpc_client_authority_filter", "grpc_deadline_filter", + "grpc_health_upb", "health_proto", "inlined_vector", "orphanable", @@ -2002,6 +2002,7 @@ grpc_cc_library( deps = [ "grpc", "grpc++_codegen_base", + "grpc_health_upb", "health_proto", ], ) @@ -2014,6 +2015,7 @@ grpc_cc_library( public_hdrs = GRPCXX_PUBLIC_HDRS, deps = [ "grpc++_codegen_base", + "grpc_health_upb", "grpc_unsecure", "health_proto", ], @@ -2077,7 +2079,7 @@ grpc_cc_library( "include/grpcpp/impl/codegen/config.h", "include/grpcpp/impl/codegen/core_codegen_interface.h", "include/grpcpp/impl/codegen/create_auth_context.h", - "include/grpcpp/impl/codegen/delegating_channel.h", + "include/grpcpp/impl/codegen/delegating_channel.h", "include/grpcpp/impl/codegen/grpc_library.h", "include/grpcpp/impl/codegen/intercepted_channel.h", "include/grpcpp/impl/codegen/interceptor.h", @@ -2277,60 +2279,137 @@ grpc_cc_library( ], ) -grpc_upb_proto_library( - name = "upb_load_report", - deps = ["@envoy_api//envoy/api/v2/endpoint:load_report_export"] -) - -grpc_upb_proto_library( - name = "upb_lrs", - deps = ["@envoy_api//envoy/service/load_stats/v2:lrs_export"] -) +# Once upb code-gen issue is resolved, use this. +# grpc_upb_proto_library( +# name = "upb_load_report", +# deps = ["@envoy_api//envoy/api/v2/endpoint:load_report_export"], +# ) +# +# grpc_upb_proto_library( +# name = "upb_lrs", +# deps = ["@envoy_api//envoy/service/load_stats/v2:lrs_export"], +# ) +# +# grpc_upb_proto_library( +# name = "upb_cds", +# deps = ["@envoy_api//envoy/api/v2:cds_export"], +# ) + +# grpc_cc_library( +# name = "envoy_lrs_upb", +# external_deps = [ +# "upb_lib", +# ], +# language = "c++", +# tags = ["no_windows"], +# deps = [ +# ":upb_load_report", +# ":upb_lrs", +# ], +# ) + +# grpc_cc_library( +# name = "envoy_ads_upb", +# external_deps = [ +# "upb_lib", +# ], +# language = "c++", +# tags = ["no_windows"], +# deps = [ +# ":upb_cds", +# ], +# ) + +# Once upb code-gen issue is resolved, replace grpc_health_upb with this. +# grpc_upb_proto_library( +# name = "grpc_health_upb", +# deps = ["//src/proto/grpc/health/v1:health_proto_descriptor"], +# ) -grpc_upb_proto_library( - name = "upb_cds", - deps = ["@envoy_api//envoy/api/v2:cds_export"] +grpc_cc_library( + name = "grpc_health_upb", + srcs = [ + "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c", + ], + hdrs = [ + "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h", + ], + external_deps = [ + "upb_lib", + ], + language = "c++", ) -#TODO: Get this into build.yaml once we start using it. +# Once upb code-gen issue is resolved, remove this. grpc_cc_library( - name = "envoy_lrs_upb", - language = "c++", + name = "google_api_upb", + srcs = [ + "src/core/ext/upb-generated/google/protobuf/any.upb.c", + "src/core/ext/upb-generated/google/protobuf/duration.upb.c", + "src/core/ext/upb-generated/google/protobuf/empty.upb.c", + "src/core/ext/upb-generated/google/protobuf/struct.upb.c", + "src/core/ext/upb-generated/google/protobuf/timestamp.upb.c", + "src/core/ext/upb-generated/google/protobuf/wrappers.upb.c", + ], + hdrs = [ + "src/core/ext/upb-generated/google/protobuf/any.upb.h", + "src/core/ext/upb-generated/google/protobuf/duration.upb.h", + "src/core/ext/upb-generated/google/protobuf/empty.upb.h", + "src/core/ext/upb-generated/google/protobuf/struct.upb.h", + "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", + "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h", + ], external_deps = [ "upb_lib", ], - deps = [ - ":upb_load_report", - ":upb_lrs" - ], - tags = ["no_windows"], + language = "c++", ) +# Once upb code-gen issue is resolved, replace grpc_lb_upb with this. +# grpc_upb_proto_library( +# name = "grpc_lb_upb", +# deps = ["//src/proto/grpc/lb/v1:load_balancer_proto_descriptor"], +# ) + grpc_cc_library( - name = "envoy_ads_upb", + name = "grpc_lb_upb", + srcs = [ + "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c", + ], + hdrs = [ + "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h", + ], external_deps = [ "upb_lib", ], language = "c++", deps = [ - ":upb_cds", + "google_api_upb", ], - tags = ["no_windows"], -) - -grpc_upb_proto_library( - name = "grpc_health_upb", - deps = ["//src/proto/grpc/health/v1:health_proto_descriptor"] ) -grpc_upb_proto_library( - name = "grpc_lb_upb", - deps = ["//src/proto/grpc/lb/v1:load_balancer_proto_descriptor"] -) +# Once upb code-gen issue is resolved, replace alts_upb with this. +# grpc_upb_proto_library( +# name = "alts_upb", +# deps = ["//src/proto/grpc/gcp:alts_handshaker_proto"], +# ) -grpc_upb_proto_library( +grpc_cc_library( name = "alts_upb", - deps = ["//src/proto/grpc/gcp:alts_handshaker_proto"] + srcs = [ + "src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c", + ], + hdrs = [ + "src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h", + "src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h", + "src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h", + ], + external_deps = [ + "upb_lib", + ], + language = "c++", ) grpc_generate_one_off_targets() diff --git a/BUILD.gn b/BUILD.gn index 8f0967e30ca..5e76bc64065 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -429,6 +429,28 @@ config("grpc_config") { "src/core/ext/transport/inproc/inproc_plugin.cc", "src/core/ext/transport/inproc/inproc_transport.cc", "src/core/ext/transport/inproc/inproc_transport.h", + "src/core/ext/upb-generated/google/protobuf/any.upb.c", + "src/core/ext/upb-generated/google/protobuf/any.upb.h", + "src/core/ext/upb-generated/google/protobuf/duration.upb.c", + "src/core/ext/upb-generated/google/protobuf/duration.upb.h", + "src/core/ext/upb-generated/google/protobuf/empty.upb.c", + "src/core/ext/upb-generated/google/protobuf/empty.upb.h", + "src/core/ext/upb-generated/google/protobuf/struct.upb.c", + "src/core/ext/upb-generated/google/protobuf/struct.upb.h", + "src/core/ext/upb-generated/google/protobuf/timestamp.upb.c", + "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", + "src/core/ext/upb-generated/google/protobuf/wrappers.upb.c", + "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h", + "src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h", + "src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h", + "src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h", + "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h", + "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h", "src/core/lib/avl/avl.cc", "src/core/lib/avl/avl.h", "src/core/lib/backoff/backoff.cc", @@ -874,6 +896,13 @@ config("grpc_config") { "src/core/tsi/transport_security_grpc.cc", "src/core/tsi/transport_security_grpc.h", "src/core/tsi/transport_security_interface.h", + "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c", + "third_party/upb/upb/decode.c", + "third_party/upb/upb/encode.c", + "third_party/upb/upb/msg.c", + "third_party/upb/upb/port.c", + "third_party/upb/upb/table.c", + "third_party/upb/upb/upb.c", ] deps = [ "//third_party/boringssl", @@ -1162,6 +1191,8 @@ config("grpc_config") { "include/grpcpp/support/time.h", "include/grpcpp/support/validate_service_config.h", "src/core/ext/transport/inproc/inproc_transport.h", + "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h", "src/core/lib/avl/avl.h", "src/core/lib/backoff/backoff.h", "src/core/lib/channel/channel_args.h", @@ -1391,6 +1422,13 @@ config("grpc_config") { "src/cpp/util/status.cc", "src/cpp/util/string_ref.cc", "src/cpp/util/time_cc.cc", + "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c", + "third_party/upb/upb/decode.c", + "third_party/upb/upb/encode.c", + "third_party/upb/upb/msg.c", + "third_party/upb/upb/port.c", + "third_party/upb/upb/table.c", + "third_party/upb/upb/upb.c", ] deps = [ "//third_party/boringssl", diff --git a/CMakeLists.txt b/CMakeLists.txt index e2cff6ab631..cf31e17beb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,14 +137,15 @@ else() set(_gRPC_CORE_NOSTDCXX_FLAGS "") endif() -include(cmake/zlib.cmake) +include(cmake/address_sorting.cmake) +include(cmake/benchmark.cmake) include(cmake/cares.cmake) -include(cmake/protobuf.cmake) -include(cmake/ssl.cmake) include(cmake/gflags.cmake) -include(cmake/benchmark.cmake) -include(cmake/address_sorting.cmake) include(cmake/nanopb.cmake) +include(cmake/protobuf.cmake) +include(cmake/ssl.cmake) +include(cmake/upb.cmake) +include(cmake/zlib.cmake) if(NOT MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") @@ -787,14 +788,17 @@ endif() target_include_directories(address_sorting PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -839,14 +843,17 @@ endif() target_include_directories(alts_test_util PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -921,14 +928,17 @@ endif() target_include_directories(gpr PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -1255,7 +1265,17 @@ add_library(grpc third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c third_party/nanopb/pb_encode.c + src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c + src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c + src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c src/core/tsi/transport_security.cc + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc src/core/ext/transport/chttp2/client/authority.cc @@ -1287,6 +1307,7 @@ add_library(grpc src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c src/core/ext/filters/client_channel/health/health.pb.c src/core/tsi/fake_transport_security.cc src/core/tsi/local_transport_security.cc @@ -1306,6 +1327,13 @@ add_library(grpc src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc + src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c + src/core/ext/upb-generated/google/protobuf/any.upb.c + src/core/ext/upb-generated/google/protobuf/duration.upb.c + src/core/ext/upb-generated/google/protobuf/empty.upb.c + src/core/ext/upb-generated/google/protobuf/struct.upb.c + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c @@ -1354,14 +1382,17 @@ endif() target_include_directories(grpc PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -1657,6 +1688,14 @@ add_library(grpc_cronet src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/core/ext/filters/client_channel/health/health.pb.c third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c @@ -1728,6 +1767,9 @@ add_library(grpc_cronet src/core/tsi/alts/handshaker/altscontext.pb.c src/core/tsi/alts/handshaker/handshaker.pb.c src/core/tsi/alts/handshaker/transport_security_common.pb.c + src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c + src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c + src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c src/core/tsi/transport_security.cc src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc @@ -1757,14 +1799,17 @@ endif() target_include_directories(grpc_cronet PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -2046,6 +2091,14 @@ add_library(grpc_test_util src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/core/ext/filters/client_channel/health/health.pb.c third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c @@ -2095,14 +2148,17 @@ endif() target_include_directories(grpc_test_util PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -2381,6 +2437,14 @@ add_library(grpc_test_util_unsecure src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/core/ext/filters/client_channel/health/health.pb.c third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c @@ -2430,14 +2494,17 @@ endif() target_include_directories(grpc_test_util_unsecure PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -2727,6 +2794,14 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/core/ext/filters/client_channel/health/health.pb.c third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c @@ -2752,6 +2827,13 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc + src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c + src/core/ext/upb-generated/google/protobuf/any.upb.c + src/core/ext/upb-generated/google/protobuf/duration.upb.c + src/core/ext/upb-generated/google/protobuf/empty.upb.c + src/core/ext/upb-generated/google/protobuf/struct.upb.c + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c @@ -2786,14 +2868,17 @@ endif() target_include_directories(grpc_unsecure PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -2887,14 +2972,17 @@ endif() target_include_directories(reconnect_server PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -2933,14 +3021,17 @@ endif() target_include_directories(test_tcp_server PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -2987,14 +3078,17 @@ protobuf_generate_grpc_cpp( target_include_directories(bm_callback_test_service_impl PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -3039,14 +3133,17 @@ endif() target_include_directories(dns_test_util PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -3106,6 +3203,14 @@ add_library(grpc++ src/cpp/util/status.cc src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/core/ext/filters/client_channel/health/health.pb.c third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c @@ -3128,14 +3233,17 @@ endif() target_include_directories(grpc++ PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) target_link_libraries(grpc++ @@ -3454,14 +3562,17 @@ protobuf_generate_grpc_cpp( target_include_directories(grpc++_core_stats PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -3506,14 +3617,17 @@ protobuf_generate_grpc_cpp( target_include_directories(grpc++_error_details PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) target_link_libraries(grpc++_error_details @@ -3576,14 +3690,17 @@ protobuf_generate_grpc_cpp( target_include_directories(grpc++_proto_reflection_desc_db PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -3640,14 +3757,17 @@ protobuf_generate_grpc_cpp( target_include_directories(grpc++_reflection PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) target_link_libraries(grpc++_reflection @@ -3702,14 +3822,17 @@ endif() target_include_directories(grpc++_test_config PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -3797,14 +3920,17 @@ protobuf_generate_grpc_cpp( target_include_directories(grpc++_test_util PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -4004,14 +4130,17 @@ protobuf_generate_grpc_cpp( target_include_directories(grpc++_test_util_unsecure PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -4188,6 +4317,14 @@ add_library(grpc++_unsecure src/cpp/util/status.cc src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/core/ext/filters/client_channel/health/health.pb.c third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c @@ -4210,14 +4347,17 @@ endif() target_include_directories(grpc++_unsecure PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) target_link_libraries(grpc++_unsecure @@ -4521,14 +4661,17 @@ endif() target_include_directories(grpc_benchmark PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -4580,14 +4723,17 @@ protobuf_generate_grpc_cpp( target_include_directories(grpc_cli_libs PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -4642,14 +4788,17 @@ endif() target_include_directories(grpc_plugin_support PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) target_link_libraries(grpc_plugin_support @@ -4707,14 +4856,17 @@ protobuf_generate_grpc_cpp( target_include_directories(grpcpp_channelz PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) target_link_libraries(grpcpp_channelz @@ -4790,14 +4942,17 @@ protobuf_generate_grpc_cpp( target_include_directories(http2_client_main PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -4847,14 +5002,17 @@ protobuf_generate_grpc_cpp( target_include_directories(interop_client_helper PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -4919,14 +5077,17 @@ protobuf_generate_grpc_cpp( target_include_directories(interop_client_main PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -4970,14 +5131,17 @@ endif() target_include_directories(interop_server_helper PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -5040,14 +5204,17 @@ protobuf_generate_grpc_cpp( target_include_directories(interop_server_lib PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -5091,15 +5258,18 @@ endif() target_include_directories(interop_server_main PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} - PRIVATE third_party/googletest/googletest/include + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include PRIVATE third_party/googletest/googlemock @@ -5197,14 +5367,17 @@ protobuf_generate_grpc_cpp( target_include_directories(qps PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -5246,14 +5419,17 @@ endif() target_include_directories(grpc_csharp_ext PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -5299,14 +5475,17 @@ endif() target_include_directories(bad_client_test PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -5345,14 +5524,17 @@ endif() target_include_directories(bad_ssl_test_server PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -5469,14 +5651,17 @@ endif() target_include_directories(end2end_tests PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -5593,14 +5778,17 @@ endif() target_include_directories(end2end_nosec_tests PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) # avoid dependency on libstdc++ if (_gRPC_CORE_NOSTDCXX_FLAGS) @@ -5628,14 +5816,17 @@ add_executable(algorithm_test target_include_directories(algorithm_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(algorithm_test @@ -5662,14 +5853,17 @@ add_executable(alloc_test target_include_directories(alloc_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(alloc_test @@ -5696,14 +5890,17 @@ add_executable(alpn_test target_include_directories(alpn_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(alpn_test @@ -5730,14 +5927,17 @@ add_executable(arena_test target_include_directories(arena_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(arena_test @@ -5764,14 +5964,17 @@ add_executable(avl_test target_include_directories(avl_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(avl_test @@ -5798,14 +6001,17 @@ add_executable(bad_server_response_test target_include_directories(bad_server_response_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(bad_server_response_test @@ -5833,14 +6039,17 @@ add_executable(bin_decoder_test target_include_directories(bin_decoder_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(bin_decoder_test @@ -5866,14 +6075,17 @@ add_executable(bin_encoder_test target_include_directories(bin_encoder_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(bin_encoder_test @@ -5900,14 +6112,17 @@ add_executable(buffer_list_test target_include_directories(buffer_list_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(buffer_list_test @@ -5935,14 +6150,17 @@ add_executable(channel_create_test target_include_directories(channel_create_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(channel_create_test @@ -5968,14 +6186,17 @@ add_executable(check_epollexclusive target_include_directories(check_epollexclusive PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(check_epollexclusive @@ -6000,14 +6221,17 @@ add_executable(chttp2_hpack_encoder_test target_include_directories(chttp2_hpack_encoder_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(chttp2_hpack_encoder_test @@ -6034,14 +6258,17 @@ add_executable(chttp2_stream_map_test target_include_directories(chttp2_stream_map_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(chttp2_stream_map_test @@ -6068,14 +6295,17 @@ add_executable(chttp2_varint_test target_include_directories(chttp2_varint_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(chttp2_varint_test @@ -6103,14 +6333,17 @@ add_executable(close_fd_test target_include_directories(close_fd_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(close_fd_test @@ -6138,14 +6371,17 @@ add_executable(cmdline_test target_include_directories(cmdline_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(cmdline_test @@ -6172,14 +6408,17 @@ add_executable(combiner_test target_include_directories(combiner_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(combiner_test @@ -6206,14 +6445,17 @@ add_executable(compression_test target_include_directories(compression_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(compression_test @@ -6240,14 +6482,17 @@ add_executable(concurrent_connectivity_test target_include_directories(concurrent_connectivity_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(concurrent_connectivity_test @@ -6274,14 +6519,17 @@ add_executable(connection_refused_test target_include_directories(connection_refused_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(connection_refused_test @@ -6308,14 +6556,17 @@ add_executable(dns_resolver_connectivity_test target_include_directories(dns_resolver_connectivity_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(dns_resolver_connectivity_test @@ -6342,14 +6593,17 @@ add_executable(dns_resolver_cooldown_using_ares_resolver_test target_include_directories(dns_resolver_cooldown_using_ares_resolver_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(dns_resolver_cooldown_using_ares_resolver_test @@ -6376,14 +6630,17 @@ add_executable(dns_resolver_cooldown_using_native_resolver_test target_include_directories(dns_resolver_cooldown_using_native_resolver_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(dns_resolver_cooldown_using_native_resolver_test @@ -6410,14 +6667,17 @@ add_executable(dns_resolver_test target_include_directories(dns_resolver_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(dns_resolver_test @@ -6445,14 +6705,17 @@ add_executable(dualstack_socket_test target_include_directories(dualstack_socket_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(dualstack_socket_test @@ -6480,14 +6743,17 @@ add_executable(endpoint_pair_test target_include_directories(endpoint_pair_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(endpoint_pair_test @@ -6514,14 +6780,17 @@ add_executable(error_test target_include_directories(error_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(error_test @@ -6549,14 +6818,17 @@ add_executable(ev_epollex_linux_test target_include_directories(ev_epollex_linux_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(ev_epollex_linux_test @@ -6584,14 +6856,17 @@ add_executable(fake_resolver_test target_include_directories(fake_resolver_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(fake_resolver_test @@ -6620,14 +6895,17 @@ add_executable(fake_transport_security_test target_include_directories(fake_transport_security_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(fake_transport_security_test @@ -6656,14 +6934,17 @@ add_executable(fd_conservation_posix_test target_include_directories(fd_conservation_posix_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(fd_conservation_posix_test @@ -6692,14 +6973,17 @@ add_executable(fd_posix_test target_include_directories(fd_posix_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(fd_posix_test @@ -6727,14 +7011,17 @@ add_executable(fling_client target_include_directories(fling_client PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(fling_client @@ -6761,14 +7048,17 @@ add_executable(fling_server target_include_directories(fling_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(fling_server @@ -6796,14 +7086,17 @@ add_executable(fling_stream_test target_include_directories(fling_stream_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(fling_stream_test @@ -6832,14 +7125,17 @@ add_executable(fling_test target_include_directories(fling_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(fling_test @@ -6868,14 +7164,17 @@ add_executable(fork_test target_include_directories(fork_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(fork_test @@ -6904,14 +7203,17 @@ add_executable(goaway_server_test target_include_directories(goaway_server_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(goaway_server_test @@ -6939,14 +7241,17 @@ add_executable(gpr_cpu_test target_include_directories(gpr_cpu_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gpr_cpu_test @@ -6973,14 +7278,17 @@ add_executable(gpr_env_test target_include_directories(gpr_env_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gpr_env_test @@ -7007,14 +7315,17 @@ add_executable(gpr_host_port_test target_include_directories(gpr_host_port_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gpr_host_port_test @@ -7041,14 +7352,17 @@ add_executable(gpr_log_test target_include_directories(gpr_log_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gpr_log_test @@ -7075,14 +7389,17 @@ add_executable(gpr_manual_constructor_test target_include_directories(gpr_manual_constructor_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gpr_manual_constructor_test @@ -7109,14 +7426,17 @@ add_executable(gpr_mpscq_test target_include_directories(gpr_mpscq_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gpr_mpscq_test @@ -7143,14 +7463,17 @@ add_executable(gpr_spinlock_test target_include_directories(gpr_spinlock_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gpr_spinlock_test @@ -7177,14 +7500,17 @@ add_executable(gpr_string_test target_include_directories(gpr_string_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gpr_string_test @@ -7211,14 +7537,17 @@ add_executable(gpr_sync_test target_include_directories(gpr_sync_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gpr_sync_test @@ -7245,14 +7574,17 @@ add_executable(gpr_thd_test target_include_directories(gpr_thd_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gpr_thd_test @@ -7279,14 +7611,17 @@ add_executable(gpr_time_test target_include_directories(gpr_time_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gpr_time_test @@ -7313,14 +7648,17 @@ add_executable(gpr_tls_test target_include_directories(gpr_tls_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gpr_tls_test @@ -7347,14 +7685,17 @@ add_executable(gpr_useful_test target_include_directories(gpr_useful_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gpr_useful_test @@ -7381,14 +7722,17 @@ add_executable(grpc_auth_context_test target_include_directories(grpc_auth_context_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_auth_context_test @@ -7415,14 +7759,17 @@ add_executable(grpc_b64_test target_include_directories(grpc_b64_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_b64_test @@ -7449,14 +7796,17 @@ add_executable(grpc_byte_buffer_reader_test target_include_directories(grpc_byte_buffer_reader_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_byte_buffer_reader_test @@ -7483,14 +7833,17 @@ add_executable(grpc_channel_args_test target_include_directories(grpc_channel_args_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_channel_args_test @@ -7517,14 +7870,17 @@ add_executable(grpc_channel_stack_builder_test target_include_directories(grpc_channel_stack_builder_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_channel_stack_builder_test @@ -7551,14 +7907,17 @@ add_executable(grpc_channel_stack_test target_include_directories(grpc_channel_stack_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_channel_stack_test @@ -7585,14 +7944,17 @@ add_executable(grpc_completion_queue_test target_include_directories(grpc_completion_queue_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_completion_queue_test @@ -7619,14 +7981,17 @@ add_executable(grpc_completion_queue_threading_test target_include_directories(grpc_completion_queue_threading_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_completion_queue_threading_test @@ -7653,14 +8018,17 @@ add_executable(grpc_control_plane_credentials_test target_include_directories(grpc_control_plane_credentials_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_control_plane_credentials_test @@ -7687,14 +8055,17 @@ add_executable(grpc_create_jwt target_include_directories(grpc_create_jwt PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_create_jwt @@ -7720,14 +8091,17 @@ add_executable(grpc_credentials_test target_include_directories(grpc_credentials_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_credentials_test @@ -7754,14 +8128,17 @@ add_executable(grpc_ipv6_loopback_available_test target_include_directories(grpc_ipv6_loopback_available_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_ipv6_loopback_available_test @@ -7789,14 +8166,17 @@ add_executable(grpc_json_token_test target_include_directories(grpc_json_token_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_json_token_test @@ -7824,14 +8204,17 @@ add_executable(grpc_jwt_verifier_test target_include_directories(grpc_jwt_verifier_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_jwt_verifier_test @@ -7858,14 +8241,17 @@ add_executable(grpc_print_google_default_creds_token target_include_directories(grpc_print_google_default_creds_token PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_print_google_default_creds_token @@ -7890,14 +8276,17 @@ add_executable(grpc_security_connector_test target_include_directories(grpc_security_connector_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_security_connector_test @@ -7924,14 +8313,17 @@ add_executable(grpc_ssl_credentials_test target_include_directories(grpc_ssl_credentials_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_ssl_credentials_test @@ -7958,14 +8350,17 @@ add_executable(grpc_verify_jwt target_include_directories(grpc_verify_jwt PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(grpc_verify_jwt @@ -7991,14 +8386,17 @@ add_executable(handshake_client_ssl target_include_directories(handshake_client_ssl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(handshake_client_ssl @@ -8029,14 +8427,17 @@ add_executable(handshake_server_ssl target_include_directories(handshake_server_ssl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(handshake_server_ssl @@ -8067,14 +8468,17 @@ add_executable(handshake_server_with_readahead_handshaker target_include_directories(handshake_server_with_readahead_handshaker PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(handshake_server_with_readahead_handshaker @@ -8104,14 +8508,17 @@ add_executable(handshake_verify_peer_options target_include_directories(handshake_verify_peer_options PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(handshake_verify_peer_options @@ -8140,14 +8547,17 @@ add_executable(histogram_test target_include_directories(histogram_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(histogram_test @@ -8173,14 +8583,17 @@ add_executable(hpack_parser_test target_include_directories(hpack_parser_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(hpack_parser_test @@ -8207,14 +8620,17 @@ add_executable(hpack_table_test target_include_directories(hpack_table_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(hpack_table_test @@ -8241,14 +8657,17 @@ add_executable(http_parser_test target_include_directories(http_parser_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(http_parser_test @@ -8275,14 +8694,17 @@ add_executable(httpcli_format_request_test target_include_directories(httpcli_format_request_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(httpcli_format_request_test @@ -8310,14 +8732,17 @@ add_executable(httpcli_test target_include_directories(httpcli_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(httpcli_test @@ -8346,14 +8771,17 @@ add_executable(httpscli_test target_include_directories(httpscli_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(httpscli_test @@ -8381,14 +8809,17 @@ add_executable(init_test target_include_directories(init_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(init_test @@ -8415,14 +8846,17 @@ add_executable(inproc_callback_test target_include_directories(inproc_callback_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(inproc_callback_test @@ -8449,14 +8883,17 @@ add_executable(invalid_call_argument_test target_include_directories(invalid_call_argument_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(invalid_call_argument_test @@ -8483,14 +8920,17 @@ add_executable(json_rewrite target_include_directories(json_rewrite PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(json_rewrite @@ -8517,14 +8957,17 @@ add_executable(json_rewrite_test target_include_directories(json_rewrite_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(json_rewrite_test @@ -8551,14 +8994,17 @@ add_executable(json_stream_error_test target_include_directories(json_stream_error_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(json_stream_error_test @@ -8585,14 +9031,17 @@ add_executable(json_test target_include_directories(json_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(json_test @@ -8619,14 +9068,17 @@ add_executable(lame_client_test target_include_directories(lame_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(lame_client_test @@ -8653,14 +9105,17 @@ add_executable(load_file_test target_include_directories(load_file_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(load_file_test @@ -8687,14 +9142,17 @@ add_executable(memory_usage_client target_include_directories(memory_usage_client PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(memory_usage_client @@ -8721,14 +9179,17 @@ add_executable(memory_usage_server target_include_directories(memory_usage_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(memory_usage_server @@ -8756,14 +9217,17 @@ add_executable(memory_usage_test target_include_directories(memory_usage_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(memory_usage_test @@ -8791,14 +9255,17 @@ add_executable(message_compress_test target_include_directories(message_compress_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(message_compress_test @@ -8825,14 +9292,17 @@ add_executable(minimal_stack_is_minimal_test target_include_directories(minimal_stack_is_minimal_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(minimal_stack_is_minimal_test @@ -8859,14 +9329,17 @@ add_executable(mpmcqueue_test target_include_directories(mpmcqueue_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(mpmcqueue_test @@ -8893,14 +9366,17 @@ add_executable(multiple_server_queues_test target_include_directories(multiple_server_queues_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(multiple_server_queues_test @@ -8927,14 +9403,17 @@ add_executable(murmur_hash_test target_include_directories(murmur_hash_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(murmur_hash_test @@ -8961,14 +9440,17 @@ add_executable(no_server_test target_include_directories(no_server_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(no_server_test @@ -8995,14 +9477,17 @@ add_executable(num_external_connectivity_watchers_test target_include_directories(num_external_connectivity_watchers_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(num_external_connectivity_watchers_test @@ -9029,14 +9514,17 @@ add_executable(parse_address_test target_include_directories(parse_address_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(parse_address_test @@ -9064,14 +9552,17 @@ add_executable(parse_address_with_named_scope_id_test target_include_directories(parse_address_with_named_scope_id_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(parse_address_with_named_scope_id_test @@ -9099,14 +9590,17 @@ add_executable(percent_encoding_test target_include_directories(percent_encoding_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(percent_encoding_test @@ -9134,14 +9628,17 @@ add_executable(resolve_address_using_ares_resolver_posix_test target_include_directories(resolve_address_using_ares_resolver_posix_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(resolve_address_using_ares_resolver_posix_test @@ -9169,14 +9666,17 @@ add_executable(resolve_address_using_ares_resolver_test target_include_directories(resolve_address_using_ares_resolver_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(resolve_address_using_ares_resolver_test @@ -9204,14 +9704,17 @@ add_executable(resolve_address_using_native_resolver_posix_test target_include_directories(resolve_address_using_native_resolver_posix_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(resolve_address_using_native_resolver_posix_test @@ -9239,14 +9742,17 @@ add_executable(resolve_address_using_native_resolver_test target_include_directories(resolve_address_using_native_resolver_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(resolve_address_using_native_resolver_test @@ -9273,14 +9779,17 @@ add_executable(resource_quota_test target_include_directories(resource_quota_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(resource_quota_test @@ -9307,14 +9816,17 @@ add_executable(secure_channel_create_test target_include_directories(secure_channel_create_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(secure_channel_create_test @@ -9341,14 +9853,17 @@ add_executable(secure_endpoint_test target_include_directories(secure_endpoint_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(secure_endpoint_test @@ -9375,14 +9890,17 @@ add_executable(sequential_connectivity_test target_include_directories(sequential_connectivity_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(sequential_connectivity_test @@ -9409,14 +9927,17 @@ add_executable(server_chttp2_test target_include_directories(server_chttp2_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(server_chttp2_test @@ -9443,14 +9964,17 @@ add_executable(server_test target_include_directories(server_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(server_test @@ -9477,14 +10001,17 @@ add_executable(slice_buffer_test target_include_directories(slice_buffer_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(slice_buffer_test @@ -9511,14 +10038,17 @@ add_executable(slice_string_helpers_test target_include_directories(slice_string_helpers_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(slice_string_helpers_test @@ -9545,14 +10075,17 @@ add_executable(slice_test target_include_directories(slice_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(slice_test @@ -9579,14 +10112,17 @@ add_executable(sockaddr_resolver_test target_include_directories(sockaddr_resolver_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(sockaddr_resolver_test @@ -9613,14 +10149,17 @@ add_executable(sockaddr_utils_test target_include_directories(sockaddr_utils_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(sockaddr_utils_test @@ -9648,14 +10187,17 @@ add_executable(socket_utils_test target_include_directories(socket_utils_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(socket_utils_test @@ -9685,14 +10227,17 @@ add_executable(ssl_transport_security_test target_include_directories(ssl_transport_security_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(ssl_transport_security_test @@ -9720,14 +10265,17 @@ add_executable(status_conversion_test target_include_directories(status_conversion_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(status_conversion_test @@ -9754,14 +10302,17 @@ add_executable(stream_compression_test target_include_directories(stream_compression_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(stream_compression_test @@ -9788,14 +10339,17 @@ add_executable(stream_owned_slice_test target_include_directories(stream_owned_slice_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(stream_owned_slice_test @@ -9823,14 +10377,17 @@ add_executable(tcp_client_posix_test target_include_directories(tcp_client_posix_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(tcp_client_posix_test @@ -9858,14 +10415,17 @@ add_executable(tcp_client_uv_test target_include_directories(tcp_client_uv_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(tcp_client_uv_test @@ -9893,14 +10453,17 @@ add_executable(tcp_posix_test target_include_directories(tcp_posix_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(tcp_posix_test @@ -9929,14 +10492,17 @@ add_executable(tcp_server_posix_test target_include_directories(tcp_server_posix_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(tcp_server_posix_test @@ -9964,14 +10530,17 @@ add_executable(tcp_server_uv_test target_include_directories(tcp_server_uv_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(tcp_server_uv_test @@ -9998,14 +10567,17 @@ add_executable(threadpool_test target_include_directories(threadpool_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(threadpool_test @@ -10032,14 +10604,17 @@ add_executable(time_averaged_stats_test target_include_directories(time_averaged_stats_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(time_averaged_stats_test @@ -10066,14 +10641,17 @@ add_executable(timeout_encoding_test target_include_directories(timeout_encoding_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(timeout_encoding_test @@ -10100,14 +10678,17 @@ add_executable(timer_heap_test target_include_directories(timer_heap_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(timer_heap_test @@ -10134,14 +10715,17 @@ add_executable(timer_list_test target_include_directories(timer_list_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(timer_list_test @@ -10168,14 +10752,17 @@ add_executable(transport_connectivity_state_test target_include_directories(transport_connectivity_state_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(transport_connectivity_state_test @@ -10202,14 +10789,17 @@ add_executable(transport_metadata_test target_include_directories(transport_metadata_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(transport_metadata_test @@ -10237,14 +10827,17 @@ add_executable(transport_security_test target_include_directories(transport_security_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(transport_security_test @@ -10273,14 +10866,17 @@ add_executable(udp_server_test target_include_directories(udp_server_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(udp_server_test @@ -10308,14 +10904,17 @@ add_executable(uri_parser_test target_include_directories(uri_parser_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(uri_parser_test @@ -10344,14 +10943,17 @@ add_executable(alarm_test target_include_directories(alarm_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10384,14 +10986,17 @@ add_executable(alts_counter_test target_include_directories(alts_counter_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10422,14 +11027,17 @@ add_executable(alts_crypt_test target_include_directories(alts_crypt_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10461,14 +11069,17 @@ add_executable(alts_crypter_test target_include_directories(alts_crypter_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10499,14 +11110,17 @@ add_executable(alts_frame_handler_test target_include_directories(alts_frame_handler_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10538,14 +11152,17 @@ add_executable(alts_frame_protector_test target_include_directories(alts_frame_protector_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10576,14 +11193,17 @@ add_executable(alts_grpc_record_protocol_test target_include_directories(alts_grpc_record_protocol_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10614,14 +11234,17 @@ add_executable(alts_handshaker_client_test target_include_directories(alts_handshaker_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10652,14 +11275,17 @@ add_executable(alts_handshaker_service_api_test target_include_directories(alts_handshaker_service_api_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10690,14 +11316,17 @@ add_executable(alts_iovec_record_protocol_test target_include_directories(alts_iovec_record_protocol_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10728,14 +11357,17 @@ add_executable(alts_security_connector_test target_include_directories(alts_security_connector_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10765,14 +11397,17 @@ add_executable(alts_tsi_handshaker_test target_include_directories(alts_tsi_handshaker_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10803,14 +11438,17 @@ add_executable(alts_tsi_utils_test target_include_directories(alts_tsi_utils_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10841,14 +11479,17 @@ add_executable(alts_zero_copy_grpc_protector_test target_include_directories(alts_zero_copy_grpc_protector_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10879,14 +11520,17 @@ add_executable(async_end2end_test target_include_directories(async_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10919,14 +11563,17 @@ add_executable(auth_property_iterator_test target_include_directories(auth_property_iterator_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10959,14 +11606,17 @@ add_executable(backoff_test target_include_directories(backoff_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -10997,14 +11647,17 @@ add_executable(bdp_estimator_test target_include_directories(bdp_estimator_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11038,14 +11691,17 @@ add_executable(bm_alarm target_include_directories(bm_alarm PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11083,14 +11739,17 @@ add_executable(bm_arena target_include_directories(bm_arena PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11128,14 +11787,17 @@ add_executable(bm_byte_buffer target_include_directories(bm_byte_buffer PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11173,14 +11835,17 @@ add_executable(bm_call_create target_include_directories(bm_call_create PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11218,14 +11883,17 @@ add_executable(bm_callback_streaming_ping_pong target_include_directories(bm_callback_streaming_ping_pong PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11264,14 +11932,17 @@ add_executable(bm_callback_unary_ping_pong target_include_directories(bm_callback_unary_ping_pong PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11310,14 +11981,17 @@ add_executable(bm_channel target_include_directories(bm_channel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11355,14 +12029,17 @@ add_executable(bm_chttp2_hpack target_include_directories(bm_chttp2_hpack PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11400,14 +12077,17 @@ add_executable(bm_chttp2_transport target_include_directories(bm_chttp2_transport PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11445,14 +12125,17 @@ add_executable(bm_closure target_include_directories(bm_closure PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11490,14 +12173,17 @@ add_executable(bm_cq target_include_directories(bm_cq PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11535,14 +12221,17 @@ add_executable(bm_cq_multiple_threads target_include_directories(bm_cq_multiple_threads PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11580,14 +12269,17 @@ add_executable(bm_error target_include_directories(bm_error PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11625,14 +12317,17 @@ add_executable(bm_fullstack_streaming_ping_pong target_include_directories(bm_fullstack_streaming_ping_pong PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11670,14 +12365,17 @@ add_executable(bm_fullstack_streaming_pump target_include_directories(bm_fullstack_streaming_pump PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11715,14 +12413,17 @@ add_executable(bm_fullstack_trickle target_include_directories(bm_fullstack_trickle PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11760,14 +12461,17 @@ add_executable(bm_fullstack_unary_ping_pong target_include_directories(bm_fullstack_unary_ping_pong PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11805,14 +12509,17 @@ add_executable(bm_metadata target_include_directories(bm_metadata PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11850,14 +12557,17 @@ add_executable(bm_pollset target_include_directories(bm_pollset PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11895,14 +12605,17 @@ add_executable(bm_threadpool target_include_directories(bm_threadpool PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11940,14 +12653,17 @@ add_executable(bm_timer target_include_directories(bm_timer PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -11984,14 +12700,17 @@ add_executable(byte_stream_test target_include_directories(byte_stream_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12022,14 +12741,17 @@ add_executable(channel_arguments_test target_include_directories(channel_arguments_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12060,14 +12782,17 @@ add_executable(channel_filter_test target_include_directories(channel_filter_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12105,14 +12830,17 @@ protobuf_generate_grpc_cpp( target_include_directories(channel_trace_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12145,14 +12873,17 @@ add_executable(channelz_registry_test target_include_directories(channelz_registry_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12192,14 +12923,17 @@ protobuf_generate_grpc_cpp( target_include_directories(channelz_service_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12240,14 +12974,17 @@ protobuf_generate_grpc_cpp( target_include_directories(channelz_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12280,14 +13017,17 @@ add_executable(check_gcp_environment_linux_test target_include_directories(check_gcp_environment_linux_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12317,14 +13057,17 @@ add_executable(check_gcp_environment_windows_test target_include_directories(check_gcp_environment_windows_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12354,14 +13097,17 @@ add_executable(chttp2_settings_timeout_test target_include_directories(chttp2_settings_timeout_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12392,14 +13138,17 @@ add_executable(cli_call_test target_include_directories(cli_call_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12434,14 +13183,17 @@ add_executable(client_callback_end2end_test target_include_directories(client_callback_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12481,14 +13233,17 @@ protobuf_generate_grpc_cpp( target_include_directories(client_channel_stress_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12522,14 +13277,17 @@ add_executable(client_crash_test target_include_directories(client_crash_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12563,14 +13321,17 @@ add_executable(client_crash_test_server target_include_directories(client_crash_test_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12605,14 +13366,17 @@ add_executable(client_interceptors_end2end_test target_include_directories(client_interceptors_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12645,14 +13409,17 @@ add_executable(client_lb_end2end_test target_include_directories(client_lb_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12734,14 +13501,17 @@ protobuf_generate_grpc_cpp( target_include_directories(codegen_test_full PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12823,14 +13593,17 @@ protobuf_generate_grpc_cpp( target_include_directories(codegen_test_minimal PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12861,14 +13634,17 @@ add_executable(context_list_test target_include_directories(context_list_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12899,14 +13675,17 @@ add_executable(credentials_test target_include_directories(credentials_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12937,14 +13716,17 @@ add_executable(cxx_byte_buffer_test target_include_directories(cxx_byte_buffer_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -12976,14 +13758,17 @@ add_executable(cxx_slice_test target_include_directories(cxx_slice_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13015,14 +13800,17 @@ add_executable(cxx_string_ref_test target_include_directories(cxx_string_ref_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13052,14 +13840,17 @@ add_executable(cxx_time_test target_include_directories(cxx_time_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13091,14 +13882,17 @@ add_executable(delegating_channel_test target_include_directories(delegating_channel_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13132,14 +13926,17 @@ add_executable(end2end_test target_include_directories(end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13179,14 +13976,17 @@ protobuf_generate_grpc_cpp( target_include_directories(error_details_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13216,14 +14016,17 @@ add_executable(exception_test target_include_directories(exception_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13256,14 +14059,17 @@ add_executable(filter_end2end_test target_include_directories(filter_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13296,14 +14102,17 @@ add_executable(generic_end2end_test target_include_directories(generic_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13336,14 +14145,17 @@ add_executable(global_config_env_test target_include_directories(global_config_env_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13373,14 +14185,17 @@ add_executable(global_config_test target_include_directories(global_config_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13417,14 +14232,17 @@ protobuf_generate_grpc_cpp( target_include_directories(golden_file_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13456,14 +14274,17 @@ add_executable(grpc_alts_credentials_options_test target_include_directories(grpc_alts_credentials_options_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13493,14 +14314,17 @@ add_executable(grpc_cli target_include_directories(grpc_cli PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13534,14 +14358,17 @@ add_executable(grpc_core_map_test target_include_directories(grpc_core_map_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13571,14 +14398,17 @@ add_executable(grpc_cpp_plugin target_include_directories(grpc_cpp_plugin PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -13610,14 +14440,17 @@ add_executable(grpc_csharp_plugin target_include_directories(grpc_csharp_plugin PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -13651,14 +14484,17 @@ add_executable(grpc_fetch_oauth2 target_include_directories(grpc_fetch_oauth2 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13690,14 +14526,17 @@ add_executable(grpc_linux_system_roots_test target_include_directories(grpc_linux_system_roots_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13726,14 +14565,17 @@ add_executable(grpc_node_plugin target_include_directories(grpc_node_plugin PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -13765,14 +14607,17 @@ add_executable(grpc_objective_c_plugin target_include_directories(grpc_objective_c_plugin PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -13804,14 +14649,17 @@ add_executable(grpc_php_plugin target_include_directories(grpc_php_plugin PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -13843,14 +14691,17 @@ add_executable(grpc_python_plugin target_include_directories(grpc_python_plugin PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -13882,14 +14733,17 @@ add_executable(grpc_ruby_plugin target_include_directories(grpc_ruby_plugin PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -13937,14 +14791,17 @@ protobuf_generate_grpc_cpp( target_include_directories(grpc_tool_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -13987,14 +14844,17 @@ protobuf_generate_grpc_cpp( target_include_directories(grpclb_api_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14033,14 +14893,17 @@ protobuf_generate_grpc_cpp( target_include_directories(grpclb_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14095,14 +14958,17 @@ protobuf_generate_grpc_cpp( target_include_directories(grpclb_fallback_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14137,14 +15003,17 @@ add_executable(h2_ssl_cert_test target_include_directories(h2_ssl_cert_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14176,14 +15045,17 @@ add_executable(h2_ssl_session_reuse_test target_include_directories(h2_ssl_session_reuse_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14215,14 +15087,17 @@ add_executable(health_service_end2end_test target_include_directories(health_service_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14255,14 +15130,17 @@ add_executable(http2_client target_include_directories(http2_client PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14297,14 +15175,17 @@ add_executable(hybrid_end2end_test target_include_directories(hybrid_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14337,14 +15218,17 @@ add_executable(inlined_vector_test target_include_directories(inlined_vector_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14377,14 +15261,17 @@ add_executable(inproc_sync_unary_ping_pong_test target_include_directories(inproc_sync_unary_ping_pong_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14421,14 +15308,17 @@ add_executable(interop_client target_include_directories(interop_client PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14465,14 +15355,17 @@ add_executable(interop_server target_include_directories(interop_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14511,14 +15404,17 @@ add_executable(interop_test target_include_directories(interop_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14552,14 +15448,17 @@ add_executable(json_run_localhost target_include_directories(json_run_localhost PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14594,14 +15493,17 @@ add_executable(memory_test target_include_directories(memory_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14633,14 +15535,17 @@ add_executable(message_allocator_end2end_test target_include_directories(message_allocator_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14680,14 +15585,17 @@ protobuf_generate_grpc_cpp( target_include_directories(metrics_client PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14719,14 +15627,17 @@ add_executable(mock_test target_include_directories(mock_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14759,14 +15670,17 @@ add_executable(nonblocking_test target_include_directories(nonblocking_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14799,14 +15713,17 @@ add_executable(noop-benchmark target_include_directories(noop-benchmark PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14835,14 +15752,17 @@ add_executable(optional_test target_include_directories(optional_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14874,14 +15794,17 @@ add_executable(orphanable_test target_include_directories(orphanable_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14913,14 +15836,17 @@ add_executable(port_sharing_end2end_test target_include_directories(port_sharing_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14954,14 +15880,17 @@ add_executable(proto_server_reflection_test target_include_directories(proto_server_reflection_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -14996,14 +15925,17 @@ add_executable(proto_utils_test target_include_directories(proto_utils_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15034,14 +15966,17 @@ add_executable(qps_interarrival_test target_include_directories(qps_interarrival_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15077,14 +16012,17 @@ add_executable(qps_json_driver target_include_directories(qps_json_driver PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15121,14 +16059,17 @@ add_executable(qps_openloop_test target_include_directories(qps_openloop_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15165,14 +16106,17 @@ add_executable(qps_worker target_include_directories(qps_worker PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15208,14 +16152,17 @@ add_executable(raw_end2end_test target_include_directories(raw_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15269,14 +16216,17 @@ protobuf_generate_grpc_cpp( target_include_directories(reconnect_interop_client PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15331,14 +16281,17 @@ protobuf_generate_grpc_cpp( target_include_directories(reconnect_interop_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15374,14 +16327,17 @@ add_executable(ref_counted_ptr_test target_include_directories(ref_counted_ptr_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15413,14 +16369,17 @@ add_executable(ref_counted_test target_include_directories(ref_counted_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15452,14 +16411,17 @@ add_executable(retry_throttle_test target_include_directories(retry_throttle_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15490,14 +16452,17 @@ add_executable(secure_auth_context_test target_include_directories(secure_auth_context_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15531,14 +16496,17 @@ add_executable(secure_sync_unary_ping_pong_test target_include_directories(secure_sync_unary_ping_pong_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15575,14 +16543,17 @@ add_executable(server_builder_plugin_test target_include_directories(server_builder_plugin_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15629,14 +16600,17 @@ protobuf_generate_grpc_cpp( target_include_directories(server_builder_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15684,14 +16658,17 @@ protobuf_generate_grpc_cpp( target_include_directories(server_builder_with_socket_mutator_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15725,14 +16702,17 @@ add_executable(server_context_test_spouse_test target_include_directories(server_context_test_spouse_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15765,14 +16745,17 @@ add_executable(server_crash_test target_include_directories(server_crash_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15806,14 +16789,17 @@ add_executable(server_crash_test_client target_include_directories(server_crash_test_client PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15847,14 +16833,17 @@ add_executable(server_early_return_test target_include_directories(server_early_return_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15888,14 +16877,17 @@ add_executable(server_interceptors_end2end_test target_include_directories(server_interceptors_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15942,14 +16934,17 @@ protobuf_generate_grpc_cpp( target_include_directories(server_request_call_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -15982,14 +16977,17 @@ add_executable(service_config_end2end_test target_include_directories(service_config_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16022,14 +17020,17 @@ add_executable(service_config_test target_include_directories(service_config_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16061,14 +17062,17 @@ add_executable(shutdown_test target_include_directories(shutdown_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16101,14 +17105,17 @@ add_executable(slice_hash_table_test target_include_directories(slice_hash_table_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16139,14 +17146,17 @@ add_executable(slice_weak_hash_table_test target_include_directories(slice_weak_hash_table_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16177,14 +17187,17 @@ add_executable(stats_test target_include_directories(stats_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16216,14 +17229,17 @@ add_executable(status_metadata_test target_include_directories(status_metadata_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16252,14 +17268,17 @@ add_executable(status_util_test target_include_directories(status_util_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16289,14 +17308,17 @@ add_executable(streaming_throughput_test target_include_directories(streaming_throughput_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16361,14 +17383,17 @@ protobuf_generate_grpc_cpp( target_include_directories(stress_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16402,14 +17427,17 @@ add_executable(string_view_test target_include_directories(string_view_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16441,14 +17469,17 @@ add_executable(thread_manager_test target_include_directories(thread_manager_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16480,14 +17511,17 @@ add_executable(thread_stress_test target_include_directories(thread_stress_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16521,14 +17555,17 @@ add_executable(time_change_test target_include_directories(time_change_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16562,14 +17599,17 @@ add_executable(transport_pid_controller_test target_include_directories(transport_pid_controller_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16602,14 +17642,17 @@ add_executable(transport_security_common_api_test target_include_directories(transport_security_common_api_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16641,14 +17684,17 @@ add_executable(writes_per_rpc_test target_include_directories(writes_per_rpc_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16689,14 +17735,17 @@ protobuf_generate_grpc_cpp( target_include_directories(xds_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16727,14 +17776,17 @@ add_executable(public_headers_must_be_c89 target_include_directories(public_headers_must_be_c89 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(public_headers_must_be_c89 @@ -16754,14 +17806,17 @@ add_executable(gen_hpack_tables target_include_directories(gen_hpack_tables PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gen_hpack_tables @@ -16780,14 +17835,17 @@ add_executable(gen_legal_metadata_characters target_include_directories(gen_legal_metadata_characters PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gen_legal_metadata_characters @@ -16804,14 +17862,17 @@ add_executable(gen_percent_encoding_tables target_include_directories(gen_percent_encoding_tables PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(gen_percent_encoding_tables @@ -16831,14 +17892,17 @@ add_executable(bad_streaming_id_bad_client_test target_include_directories(bad_streaming_id_bad_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16871,14 +17935,17 @@ add_executable(badreq_bad_client_test target_include_directories(badreq_bad_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16911,14 +17978,17 @@ add_executable(connection_prefix_bad_client_test target_include_directories(connection_prefix_bad_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16951,14 +18021,17 @@ add_executable(duplicate_header_bad_client_test target_include_directories(duplicate_header_bad_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -16991,14 +18064,17 @@ add_executable(head_of_line_blocking_bad_client_test target_include_directories(head_of_line_blocking_bad_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -17031,14 +18107,17 @@ add_executable(headers_bad_client_test target_include_directories(headers_bad_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -17071,14 +18150,17 @@ add_executable(initial_settings_frame_bad_client_test target_include_directories(initial_settings_frame_bad_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -17111,14 +18193,17 @@ add_executable(large_metadata_bad_client_test target_include_directories(large_metadata_bad_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -17151,14 +18236,17 @@ add_executable(out_of_bounds_bad_client_test target_include_directories(out_of_bounds_bad_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -17191,14 +18279,17 @@ add_executable(server_registered_method_bad_client_test target_include_directories(server_registered_method_bad_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -17231,14 +18322,17 @@ add_executable(simple_request_bad_client_test target_include_directories(simple_request_bad_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -17271,14 +18365,17 @@ add_executable(unknown_frame_bad_client_test target_include_directories(unknown_frame_bad_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -17311,14 +18408,17 @@ add_executable(window_overflow_bad_client_test target_include_directories(window_overflow_bad_client_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -17350,14 +18450,17 @@ add_executable(bad_ssl_cert_server target_include_directories(bad_ssl_cert_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(bad_ssl_cert_server @@ -17387,14 +18490,17 @@ add_executable(bad_ssl_cert_test target_include_directories(bad_ssl_cert_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(bad_ssl_cert_test @@ -17422,14 +18528,17 @@ add_executable(h2_census_test target_include_directories(h2_census_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_census_test @@ -17457,14 +18566,17 @@ add_executable(h2_compress_test target_include_directories(h2_compress_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_compress_test @@ -17492,14 +18604,17 @@ add_executable(h2_fakesec_test target_include_directories(h2_fakesec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_fakesec_test @@ -17528,14 +18643,17 @@ add_executable(h2_fd_test target_include_directories(h2_fd_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_fd_test @@ -17564,14 +18682,17 @@ add_executable(h2_full_test target_include_directories(h2_full_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_full_test @@ -17600,14 +18721,17 @@ add_executable(h2_full+pipe_test target_include_directories(h2_full+pipe_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_full+pipe_test @@ -17636,14 +18760,17 @@ add_executable(h2_full+trace_test target_include_directories(h2_full+trace_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_full+trace_test @@ -17671,14 +18798,17 @@ add_executable(h2_full+workarounds_test target_include_directories(h2_full+workarounds_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_full+workarounds_test @@ -17706,14 +18836,17 @@ add_executable(h2_http_proxy_test target_include_directories(h2_http_proxy_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_http_proxy_test @@ -17742,14 +18875,17 @@ add_executable(h2_local_ipv4_test target_include_directories(h2_local_ipv4_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_local_ipv4_test @@ -17779,14 +18915,17 @@ add_executable(h2_local_ipv6_test target_include_directories(h2_local_ipv6_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_local_ipv6_test @@ -17816,14 +18955,17 @@ add_executable(h2_local_uds_test target_include_directories(h2_local_uds_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_local_uds_test @@ -17852,14 +18994,17 @@ add_executable(h2_oauth2_test target_include_directories(h2_oauth2_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_oauth2_test @@ -17887,14 +19032,17 @@ add_executable(h2_proxy_test target_include_directories(h2_proxy_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_proxy_test @@ -17922,14 +19070,17 @@ add_executable(h2_sockpair_test target_include_directories(h2_sockpair_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_sockpair_test @@ -17957,14 +19108,17 @@ add_executable(h2_sockpair+trace_test target_include_directories(h2_sockpair+trace_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_sockpair+trace_test @@ -17992,14 +19146,17 @@ add_executable(h2_sockpair_1byte_test target_include_directories(h2_sockpair_1byte_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_sockpair_1byte_test @@ -18027,14 +19184,17 @@ add_executable(h2_spiffe_test target_include_directories(h2_spiffe_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_spiffe_test @@ -18062,14 +19222,17 @@ add_executable(h2_ssl_test target_include_directories(h2_ssl_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_ssl_test @@ -18097,14 +19260,17 @@ add_executable(h2_ssl_cred_reload_test target_include_directories(h2_ssl_cred_reload_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_ssl_cred_reload_test @@ -18132,14 +19298,17 @@ add_executable(h2_ssl_proxy_test target_include_directories(h2_ssl_proxy_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_ssl_proxy_test @@ -18168,14 +19337,17 @@ add_executable(h2_uds_test target_include_directories(h2_uds_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_uds_test @@ -18204,14 +19376,17 @@ add_executable(inproc_test target_include_directories(inproc_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(inproc_test @@ -18239,14 +19414,17 @@ add_executable(h2_census_nosec_test target_include_directories(h2_census_nosec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_census_nosec_test @@ -18274,14 +19452,17 @@ add_executable(h2_compress_nosec_test target_include_directories(h2_compress_nosec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_compress_nosec_test @@ -18310,14 +19491,17 @@ add_executable(h2_fd_nosec_test target_include_directories(h2_fd_nosec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_fd_nosec_test @@ -18346,14 +19530,17 @@ add_executable(h2_full_nosec_test target_include_directories(h2_full_nosec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_full_nosec_test @@ -18382,14 +19569,17 @@ add_executable(h2_full+pipe_nosec_test target_include_directories(h2_full+pipe_nosec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_full+pipe_nosec_test @@ -18418,14 +19608,17 @@ add_executable(h2_full+trace_nosec_test target_include_directories(h2_full+trace_nosec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_full+trace_nosec_test @@ -18453,14 +19646,17 @@ add_executable(h2_full+workarounds_nosec_test target_include_directories(h2_full+workarounds_nosec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_full+workarounds_nosec_test @@ -18488,14 +19684,17 @@ add_executable(h2_http_proxy_nosec_test target_include_directories(h2_http_proxy_nosec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_http_proxy_nosec_test @@ -18523,14 +19722,17 @@ add_executable(h2_proxy_nosec_test target_include_directories(h2_proxy_nosec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_proxy_nosec_test @@ -18558,14 +19760,17 @@ add_executable(h2_sockpair_nosec_test target_include_directories(h2_sockpair_nosec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_sockpair_nosec_test @@ -18593,14 +19798,17 @@ add_executable(h2_sockpair+trace_nosec_test target_include_directories(h2_sockpair+trace_nosec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_sockpair+trace_nosec_test @@ -18628,14 +19836,17 @@ add_executable(h2_sockpair_1byte_nosec_test target_include_directories(h2_sockpair_1byte_nosec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_sockpair_1byte_nosec_test @@ -18664,14 +19875,17 @@ add_executable(h2_uds_nosec_test target_include_directories(h2_uds_nosec_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(h2_uds_nosec_test @@ -18702,14 +19916,17 @@ add_executable(resolver_component_test_unsecure target_include_directories(resolver_component_test_unsecure PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -18744,14 +19961,17 @@ add_executable(resolver_component_test target_include_directories(resolver_component_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -18787,14 +20007,17 @@ add_executable(resolver_component_tests_runner_invoker_unsecure target_include_directories(resolver_component_tests_runner_invoker_unsecure PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -18830,14 +20053,17 @@ add_executable(resolver_component_tests_runner_invoker target_include_directories(resolver_component_tests_runner_invoker PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -18872,14 +20098,17 @@ add_executable(address_sorting_test_unsecure target_include_directories(address_sorting_test_unsecure PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -18913,14 +20142,17 @@ add_executable(address_sorting_test target_include_directories(address_sorting_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -18954,14 +20186,17 @@ add_executable(cancel_ares_query_test target_include_directories(cancel_ares_query_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest PRIVATE third_party/googletest/googlemock/include @@ -18995,14 +20230,17 @@ add_executable(alts_credentials_fuzzer_one_entry target_include_directories(alts_credentials_fuzzer_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(alts_credentials_fuzzer_one_entry @@ -19030,14 +20268,17 @@ add_executable(api_fuzzer_one_entry target_include_directories(api_fuzzer_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(api_fuzzer_one_entry @@ -19065,14 +20306,17 @@ add_executable(client_fuzzer_one_entry target_include_directories(client_fuzzer_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(client_fuzzer_one_entry @@ -19100,14 +20344,17 @@ add_executable(hpack_parser_fuzzer_test_one_entry target_include_directories(hpack_parser_fuzzer_test_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(hpack_parser_fuzzer_test_one_entry @@ -19135,14 +20382,17 @@ add_executable(http_request_fuzzer_test_one_entry target_include_directories(http_request_fuzzer_test_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(http_request_fuzzer_test_one_entry @@ -19170,14 +20420,17 @@ add_executable(http_response_fuzzer_test_one_entry target_include_directories(http_response_fuzzer_test_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(http_response_fuzzer_test_one_entry @@ -19205,14 +20458,17 @@ add_executable(json_fuzzer_test_one_entry target_include_directories(json_fuzzer_test_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(json_fuzzer_test_one_entry @@ -19240,14 +20496,17 @@ add_executable(nanopb_fuzzer_response_test_one_entry target_include_directories(nanopb_fuzzer_response_test_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(nanopb_fuzzer_response_test_one_entry @@ -19275,14 +20534,17 @@ add_executable(nanopb_fuzzer_serverlist_test_one_entry target_include_directories(nanopb_fuzzer_serverlist_test_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(nanopb_fuzzer_serverlist_test_one_entry @@ -19310,14 +20572,17 @@ add_executable(percent_decode_fuzzer_one_entry target_include_directories(percent_decode_fuzzer_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(percent_decode_fuzzer_one_entry @@ -19345,14 +20610,17 @@ add_executable(percent_encode_fuzzer_one_entry target_include_directories(percent_encode_fuzzer_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(percent_encode_fuzzer_one_entry @@ -19380,14 +20648,17 @@ add_executable(server_fuzzer_one_entry target_include_directories(server_fuzzer_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(server_fuzzer_one_entry @@ -19415,14 +20686,17 @@ add_executable(ssl_server_fuzzer_one_entry target_include_directories(ssl_server_fuzzer_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(ssl_server_fuzzer_one_entry @@ -19450,14 +20724,17 @@ add_executable(uri_fuzzer_test_one_entry target_include_directories(uri_fuzzer_test_one_entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) target_link_libraries(uri_fuzzer_test_one_entry diff --git a/Makefile b/Makefile index fd9d5521a17..e77c5d71089 100644 --- a/Makefile +++ b/Makefile @@ -306,12 +306,6 @@ ifeq ($(HAS_WORKING_NO_CXX14_COMPAT),true) W_NO_CXX14_COMPAT=-Wno-c++14-compat endif -CHECK_SHADOW_WORKS_CMD = $(CC) -std=c99 -Werror -Wshadow -o $(TMPOUT) -c test/build/shadow.c -HAS_WORKING_SHADOW = $(shell $(CHECK_SHADOW_WORKS_CMD) 2> /dev/null && echo true || echo false) -ifeq ($(HAS_WORKING_SHADOW),true) -W_SHADOW=-Wshadow -NO_W_SHADOW=-Wno-shadow -endif CHECK_EXTRA_SEMI_WORKS_CMD = $(CC) -std=c99 -Werror -Wextra-semi -o $(TMPOUT) -c test/build/extra-semi.c HAS_WORKING_EXTRA_SEMI = $(shell $(CHECK_EXTRA_SEMI_WORKS_CMD) 2> /dev/null && echo true || echo false) ifeq ($(HAS_WORKING_EXTRA_SEMI),true) @@ -347,14 +341,14 @@ HOST_CXX ?= $(CXX) HOST_LD ?= $(LD) HOST_LDXX ?= $(LDXX) -CFLAGS += -std=c99 -Wsign-conversion -Wconversion $(W_SHADOW) $(W_EXTRA_SEMI) +CFLAGS += -std=c99 $(W_EXTRA_SEMI) CXXFLAGS += -std=c++11 ifeq ($(SYSTEM),Darwin) CXXFLAGS += -stdlib=libc++ LDFLAGS += -framework CoreFoundation endif CXXFLAGS += -Wnon-virtual-dtor -CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -DOSATOMIC_USE_INLINED=1 -Wno-deprecated-declarations -Ithird_party/nanopb -DPB_FIELD_32BIT +CPPFLAGS += -g -Wall -Wextra -Werror -Wno-unknown-warning-option -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/nanopb -Ithird_party/upb -Ithird_party/upb/generated_for_cmake -Isrc/core/ext/upb-generated COREFLAGS += -fno-rtti -fno-exceptions LDFLAGS += -g @@ -370,7 +364,7 @@ CPPFLAGS += -fPIC LDFLAGS += -fPIC endif -INCLUDES = . include $(GENDIR) third_party/upb third_party/upb/generated_for_cmake src/core/ext/upb-generated +INCLUDES = . include $(GENDIR) LDFLAGS += -Llibs/$(CONFIG) ifeq ($(SYSTEM),Darwin) @@ -1416,7 +1410,7 @@ plugins: $(PROTOC_PLUGINS) privatelibs: privatelibs_c privatelibs_cxx -privatelibs_c: $(LIBDIR)/$(CONFIG)/libalts_test_util.a $(LIBDIR)/$(CONFIG)/libcxxabi.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libreconnect_server.a $(LIBDIR)/$(CONFIG)/libtest_tcp_server.a $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libz.a $(LIBDIR)/$(CONFIG)/libares.a $(LIBDIR)/$(CONFIG)/libbad_ssl_test_server.a $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a +privatelibs_c: $(LIBDIR)/$(CONFIG)/libalts_test_util.a $(LIBDIR)/$(CONFIG)/libcxxabi.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libreconnect_server.a $(LIBDIR)/$(CONFIG)/libtest_tcp_server.a $(LIBDIR)/$(CONFIG)/libz.a $(LIBDIR)/$(CONFIG)/libares.a $(LIBDIR)/$(CONFIG)/libbad_ssl_test_server.a $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a pc_c: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc pc_c_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc @@ -3762,7 +3756,17 @@ LIBGRPC_SRC = \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_encode.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \ src/core/tsi/transport_security.cc \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/authority.cc \ @@ -3794,6 +3798,7 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ src/core/tsi/fake_transport_security.cc \ src/core/tsi/local_transport_security.cc \ @@ -3813,6 +3818,13 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ + src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ + src/core/ext/upb-generated/google/protobuf/any.upb.c \ + src/core/ext/upb-generated/google/protobuf/duration.upb.c \ + src/core/ext/upb-generated/google/protobuf/empty.upb.c \ + src/core/ext/upb-generated/google/protobuf/struct.upb.c \ + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ @@ -4155,6 +4167,14 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ @@ -4226,6 +4246,9 @@ LIBGRPC_CRONET_SRC = \ src/core/tsi/alts/handshaker/altscontext.pb.c \ src/core/tsi/alts/handshaker/handshaker.pb.c \ src/core/tsi/alts/handshaker/transport_security_common.pb.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \ src/core/tsi/transport_security.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ @@ -4534,6 +4557,14 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ @@ -4853,6 +4884,14 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ @@ -5170,6 +5209,14 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ @@ -5195,6 +5242,13 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ + src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ + src/core/ext/upb-generated/google/protobuf/any.upb.c \ + src/core/ext/upb-generated/google/protobuf/duration.upb.c \ + src/core/ext/upb-generated/google/protobuf/empty.upb.c \ + src/core/ext/upb-generated/google/protobuf/struct.upb.c \ + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ @@ -5510,6 +5564,14 @@ LIBGRPC++_SRC = \ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ @@ -6538,6 +6600,14 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ @@ -7903,41 +7973,6 @@ ifneq ($(NO_DEPS),true) endif -LIBUPB_SRC = \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ - third_party/upb/upb/decode.c \ - third_party/upb/upb/def.c \ - third_party/upb/upb/encode.c \ - third_party/upb/upb/handlers.c \ - third_party/upb/upb/msg.c \ - third_party/upb/upb/msgfactory.c \ - third_party/upb/upb/sink.c \ - third_party/upb/upb/table.c \ - third_party/upb/upb/upb.c \ - -PUBLIC_HEADERS_C += \ - -LIBUPB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBUPB_SRC)))) - -$(LIBUPB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers - -$(LIBDIR)/$(CONFIG)/libupb.a: $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(LIBUPB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libupb.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libupb.a $(LIBUPB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libupb.a -endif - - - - -ifneq ($(NO_DEPS),true) --include $(LIBUPB_OBJS:.o=.dep) -endif - - LIBZ_SRC = \ third_party/zlib/adler32.c \ third_party/zlib/compress.c \ @@ -22422,6 +22457,9 @@ src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc: $(OPENSSL_ src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc: $(OPENSSL_DEP) src/core/ext/transport/cronet/transport/cronet_api_dummy.cc: $(OPENSSL_DEP) src/core/ext/transport/cronet/transport/cronet_transport.cc: $(OPENSSL_DEP) +src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c: $(OPENSSL_DEP) +src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c: $(OPENSSL_DEP) +src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c: $(OPENSSL_DEP) src/core/lib/http/httpcli_security_connector.cc: $(OPENSSL_DEP) src/core/lib/security/context/security_context.cc: $(OPENSSL_DEP) src/core/lib/security/credentials/alts/alts_credentials.cc: $(OPENSSL_DEP) diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 9e967d8fa9a..7111b5b8c34 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -104,7 +104,10 @@ def grpc_cc_library( visibility = visibility, testonly = testonly, linkopts = linkopts, - includes = ["include"] + if_not_windows(["src/core/ext/upb-generated"]), + includes = [ + "include", + "src/core/ext/upb-generated", # Once upb code-gen issue is resolved, remove this. + ], alwayslink = alwayslink, data = data, tags = tags, diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index cce2f88fe87..726dc21b44d 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -206,9 +206,9 @@ def grpc_deps(): if "upb" not in native.existing_rules(): http_archive( name = "upb", - sha256 = "73deded75313f80779eba109c32f3c59a813addf5064bf6e7c213fca1e7d8e32", - strip_prefix = "upb-423ea5ca9ce8da69611e6e95559efcb3a1ba8ad8", - url = "https://github.com/protocolbuffers/upb/archive/423ea5ca9ce8da69611e6e95559efcb3a1ba8ad8.tar.gz", + sha256 = "6e3c81c9e6c609d918b399110a88d10efeab73b2c8eb3131de15658b1ec86141", + strip_prefix = "upb-b70f68269a7d51c5ce372a93742bf6960215ffef", + url = "https://github.com/protocolbuffers/upb/archive/b70f68269a7d51c5ce372a93742bf6960215ffef.tar.gz", ) if "envoy_api" not in native.existing_rules(): http_archive( diff --git a/build.yaml b/build.yaml index f8d5458db16..2e81fae5687 100644 --- a/build.yaml +++ b/build.yaml @@ -73,13 +73,13 @@ filegroups: - grpc_shadow_boringssl - name: alts_upb headers: - - src/core/ext/upb-generated/altscontext.upb.h - - src/core/ext/upb-generated/handshaker.upb.h - - src/core/ext/upb-generated/transport_security_common.upb.h + - src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h + - src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h + - src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h src: - - src/core/ext/upb-generated/altscontext.upb.c - - src/core/ext/upb-generated/handshaker.upb.c - - src/core/ext/upb-generated/transport_security_common.upb.c + - src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c + - src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c + - src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c - name: alts_util public_headers: - include/grpc/grpc_security.h @@ -104,9 +104,11 @@ filegroups: - src/core/tsi/alts/handshaker/transport_security_common_api.cc uses: - alts_proto + - alts_upb - grpc_base - - tsi_interface - nanopb + - tsi_interface + - upb - name: census public_headers: - include/grpc/census.h @@ -124,7 +126,6 @@ filegroups: - name: google_api_upb headers: - src/core/ext/upb-generated/google/protobuf/any.upb.h - - src/core/ext/upb-generated/google/protobuf/descriptor.upb.h - src/core/ext/upb-generated/google/protobuf/duration.upb.h - src/core/ext/upb-generated/google/protobuf/empty.upb.h - src/core/ext/upb-generated/google/protobuf/struct.upb.h @@ -132,7 +133,6 @@ filegroups: - src/core/ext/upb-generated/google/protobuf/wrappers.upb.h src: - src/core/ext/upb-generated/google/protobuf/any.upb.c - - src/core/ext/upb-generated/google/protobuf/descriptor.upb.c - src/core/ext/upb-generated/google/protobuf/duration.upb.c - src/core/ext/upb-generated/google/protobuf/empty.upb.c - src/core/ext/upb-generated/google/protobuf/struct.upb.c @@ -660,6 +660,7 @@ filegroups: uses: - grpc_base - grpc_deadline_filter + - grpc_health_upb - health_proto - name: grpc_client_idle_filter src: @@ -689,9 +690,11 @@ filegroups: - grpc_base - name: grpc_health_upb headers: - - src/core/ext/upb-generated/grpc/health/v1/health.upb.c + - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h src: - - src/core/ext/upb-generated/grpc/health/v1/health.upb.h + - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + uses: + - upb - name: grpc_http_filters headers: - src/core/ext/filters/http/client/http_client_filter.h @@ -722,9 +725,11 @@ filegroups: uses: - grpc_base - grpc_client_channel - - nanopb + - grpc_lb_upb - grpc_resolver_fake - grpclb_proto + - nanopb + - upb - name: grpc_lb_policy_grpclb_secure headers: - src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h @@ -741,11 +746,13 @@ filegroups: plugin: grpc_lb_policy_grpclb uses: - grpc_base - - grpc_secure - grpc_client_channel - - nanopb + - grpc_lb_upb - grpc_resolver_fake + - grpc_secure - grpclb_proto + - nanopb + - upb - name: grpc_lb_policy_pick_first src: - src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc @@ -777,9 +784,11 @@ filegroups: uses: - grpc_base - grpc_client_channel - - nanopb + - grpc_lb_upb - grpc_resolver_fake - grpclb_proto + - nanopb + - upb - name: grpc_lb_policy_xds_secure headers: - src/core/ext/filters/client_channel/lb_policy/xds/xds.h @@ -794,11 +803,13 @@ filegroups: plugin: grpc_lb_policy_xds uses: - grpc_base - - grpc_secure - grpc_client_channel - - nanopb + - grpc_lb_upb - grpc_resolver_fake + - grpc_secure - grpclb_proto + - nanopb + - upb - name: grpc_lb_subchannel_list headers: - src/core/ext/filters/client_channel/lb_policy/subchannel_list.h @@ -807,9 +818,9 @@ filegroups: - grpc_client_channel - name: grpc_lb_upb headers: - - src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.h + - src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h src: - - src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.c + - src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c uses: - google_api_upb - name: grpc_max_age_filter @@ -1543,6 +1554,7 @@ filegroups: - grpc_transport_inproc_headers - grpc++_codegen_base - grpc++_internal_hdrs_only + - grpc_health_upb - nanopb_headers - health_proto - name: grpc++_config_proto @@ -6195,13 +6207,13 @@ defaults: CXXFLAGS: $(W_NO_CXX14_COMPAT) global: COREFLAGS: -fno-rtti -fno-exceptions - CPPFLAGS: -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -DOSATOMIC_USE_INLINED=1 - -Wno-deprecated-declarations -Ithird_party/nanopb -DPB_FIELD_32BIT + CPPFLAGS: -g -Wall -Wextra -Werror -Wno-unknown-warning-option -Wno-long-long + -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow + -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers + -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/nanopb + -Ithird_party/upb -Ithird_party/upb/generated_for_cmake -Isrc/core/ext/upb-generated CXXFLAGS: -Wnon-virtual-dtor LDFLAGS: -g - upb: - CFLAGS: -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough - -Wno-sign-compare -Wno-missing-field-initializers zlib: CFLAGS: -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration -Wno-implicit-fallthrough $(W_NO_SHIFT_NEGATIVE_VALUE) -fvisibility=hidden diff --git a/cmake/upb.cmake b/cmake/upb.cmake new file mode 100644 index 00000000000..8a5ef86f1c4 --- /dev/null +++ b/cmake/upb.cmake @@ -0,0 +1,19 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set(UPB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/upb) + +set(_gRPC_UPB_INCLUDE_DIR "${UPB_ROOT_DIR}") +set(_gRPC_UPB_GENERATED_DIR "${UPB_ROOT_DIR}/generated_for_cmake") +set(_gRPC_UPB_GRPC_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated") diff --git a/config.m4 b/config.m4 index 6eeeafce9a5..07925b2d0ac 100644 --- a/config.m4 +++ b/config.m4 @@ -6,10 +6,13 @@ if test "$PHP_GRPC" != "no"; then dnl # --with-grpc -> add include path PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/include) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/core/ext/upb-generated) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc) - PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/address_sorting/include) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/nanopb) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/upb) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/upb/generated_for_cmake) LIBS="-lpthread $LIBS" @@ -342,7 +345,17 @@ if test "$PHP_GRPC" != "no"; then third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_encode.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \ src/core/tsi/transport_security.cc \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/authority.cc \ @@ -374,6 +387,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ src/core/tsi/fake_transport_security.cc \ src/core/tsi/local_transport_security.cc \ @@ -393,6 +407,13 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ + src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ + src/core/ext/upb-generated/google/protobuf/any.upb.c \ + src/core/ext/upb-generated/google/protobuf/duration.upb.c \ + src/core/ext/upb-generated/google/protobuf/empty.upb.c \ + src/core/ext/upb-generated/google/protobuf/struct.upb.c \ + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ @@ -721,6 +742,10 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/server/secure) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/transport) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/inproc) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/google/protobuf) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/gcp) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/health/v1) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/lb/v1) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/avl) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/backoff) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/channel) @@ -805,4 +830,6 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/ssl) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/third_party/fiat) PHP_ADD_BUILD_DIR($ext_builddir/third_party/nanopb) + PHP_ADD_BUILD_DIR($ext_builddir/third_party/upb/generated_for_cmake/google/protobuf) + PHP_ADD_BUILD_DIR($ext_builddir/third_party/upb/upb) fi diff --git a/config.w32 b/config.w32 index fd7920f72fd..8963d80a76d 100644 --- a/config.w32 +++ b/config.w32 @@ -317,7 +317,17 @@ if (PHP_GRPC != "no") { "third_party\\nanopb\\pb_common.c " + "third_party\\nanopb\\pb_decode.c " + "third_party\\nanopb\\pb_encode.c " + + "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp\\altscontext.upb.c " + + "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp\\handshaker.upb.c " + + "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp\\transport_security_common.upb.c " + "src\\core\\tsi\\transport_security.cc " + + "third_party\\upb\\generated_for_cmake\\google\\protobuf\\descriptor.upb.c " + + "third_party\\upb\\upb\\decode.c " + + "third_party\\upb\\upb\\encode.c " + + "third_party\\upb\\upb\\msg.c " + + "third_party\\upb\\upb\\port.c " + + "third_party\\upb\\upb\\table.c " + + "third_party\\upb\\upb\\upb.c " + "src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create.cc " + "src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create_posix.cc " + "src\\core\\ext\\transport\\chttp2\\client\\authority.cc " + @@ -349,6 +359,7 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\subchannel.cc " + "src\\core\\ext\\filters\\client_channel\\subchannel_pool_interface.cc " + "src\\core\\ext\\filters\\deadline\\deadline_filter.cc " + + "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health\\v1\\health.upb.c " + "src\\core\\ext\\filters\\client_channel\\health\\health.pb.c " + "src\\core\\tsi\\fake_transport_security.cc " + "src\\core\\tsi\\local_transport_security.cc " + @@ -368,6 +379,13 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\grpclb_channel_secure.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\grpclb_client_stats.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\load_balancer_api.cc " + + "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb\\v1\\load_balancer.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\any.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\duration.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\empty.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\struct.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\timestamp.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\wrappers.upb.c " + "src\\core\\ext\\filters\\client_channel\\resolver\\fake\\fake_resolver.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\google\\protobuf\\duration.pb.c " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\google\\protobuf\\timestamp.pb.c " + @@ -679,11 +697,14 @@ if (PHP_GRPC != "no") { "/DPB_FIELD_32BIT "+ "/I"+configure_module_dirname+" "+ "/I"+configure_module_dirname+"\\include "+ + "/I"+configure_module_dirname+"\\src\\core\\ext\\upb-generated "+ "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+ - "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ - "/I"+configure_module_dirname+"\\third_party\\zlib "+ "/I"+configure_module_dirname+"\\third_party\\address_sorting\\include "+ - "/I"+configure_module_dirname+"\\third_party\\nanopb"); + "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ + "/I"+configure_module_dirname+"\\third_party\\nanopb "+ + "/I"+configure_module_dirname+"\\third_party\\upb "+ + "/I"+configure_module_dirname+"\\third_party\\upb\\generated_for_cmake "+ + "/I"+configure_module_dirname+"\\third_party\\zlib "); base_dir = get_define('BUILD_DIR'); FSO.CreateFolder(base_dir+"\\ext"); @@ -733,6 +754,17 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\server\\secure"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\transport"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\inproc"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\google"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\google\\protobuf"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health\\v1"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb\\v1"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\avl"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\backoff"); @@ -827,6 +859,11 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\third_party"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\third_party\\fiat"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\nanopb"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\upb"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\upb\\generated_for_cmake"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\upb\\generated_for_cmake\\google"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\upb\\generated_for_cmake\\google\\protobuf"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\upb\\upb"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\zlib"); _build_dirs = new Array(); for (i = 0; i < build_dirs.length; i++) { diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index e9816a481b8..1fb00deb22e 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -387,6 +387,9 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/handshaker/altscontext.pb.h', 'src/core/tsi/alts/handshaker/handshaker.pb.h', 'src/core/tsi/alts/handshaker/transport_security_common.pb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h', 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/authority.h', @@ -419,6 +422,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel_interface.h', 'src/core/ext/filters/client_channel/subchannel_pool_interface.h', 'src/core/ext/filters/deadline/deadline_filter.h', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', 'src/core/ext/filters/client_channel/health/health.pb.h', 'src/core/tsi/fake_transport_security.h', 'src/core/tsi/local_transport_security.h', @@ -578,6 +582,13 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', + 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', + 'src/core/ext/upb-generated/google/protobuf/any.upb.h', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', @@ -782,6 +793,7 @@ Pod::Spec.new do |s| 'src/core/lib/uri/uri_parser.h', 'src/core/lib/debug/trace.h', 'src/core/ext/transport/inproc/inproc_transport.h', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', 'src/core/ext/filters/client_channel/health/health.pb.h' end @@ -801,5 +813,11 @@ Pod::Spec.new do |s| find src/cpp/ -type f -path '*.grpc_back' -print0 | xargs -0 rm find src/core/ -type f ! -path '*.grpc_back' -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(pb(_.*)?\\.h)";#include ;g' find src/core/ -type f -path '*.grpc_back' -print0 | xargs -0 rm + find src/core/ third_party/upb/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "upb/(.*)";#if COCOAPODS==1\\\n #include "third_party/upb/upb/\\1"\\\n#else\\\n #include "upb/\\1"\\\n#endif;g' + find src/core/ third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm + find src/core/ src/cpp/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "src/core/ext/upb-generated/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g' + find src/core/ src/cpp/ -type f -name '*.grpc_back' -print0 | xargs -0 rm + find third_party/upb/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "third_party/upb/generated_for_cmake/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g' + find third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm END_OF_COMMAND end diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index a08b3cc680f..b00fe01fdd9 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -342,6 +342,9 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/handshaker/altscontext.pb.h', 'src/core/tsi/alts/handshaker/handshaker.pb.h', 'src/core/tsi/alts/handshaker/transport_security_common.pb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h', 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/authority.h', @@ -374,6 +377,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel_interface.h', 'src/core/ext/filters/client_channel/subchannel_pool_interface.h', 'src/core/ext/filters/deadline/deadline_filter.h', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', 'src/core/ext/filters/client_channel/health/health.pb.h', 'src/core/tsi/fake_transport_security.h', 'src/core/tsi/local_transport_security.h', @@ -533,6 +537,13 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', + 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', + 'src/core/ext/upb-generated/google/protobuf/any.upb.h', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', @@ -804,7 +815,17 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/handshaker/altscontext.pb.c', 'src/core/tsi/alts/handshaker/handshaker.pb.c', 'src/core/tsi/alts/handshaker/transport_security_common.pb.c', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c', 'src/core/tsi/transport_security.cc', + 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', + 'third_party/upb/upb/decode.c', + 'third_party/upb/upb/encode.c', + 'third_party/upb/upb/msg.c', + 'third_party/upb/upb/port.c', + 'third_party/upb/upb/table.c', + 'third_party/upb/upb/upb.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/authority.cc', @@ -836,6 +857,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', 'src/core/ext/filters/client_channel/health/health.pb.c', 'src/core/tsi/fake_transport_security.cc', 'src/core/tsi/local_transport_security.cc', @@ -855,6 +877,13 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', + 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', + 'src/core/ext/upb-generated/google/protobuf/any.upb.c', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', @@ -1001,6 +1030,9 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/handshaker/altscontext.pb.h', 'src/core/tsi/alts/handshaker/handshaker.pb.h', 'src/core/tsi/alts/handshaker/transport_security_common.pb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h', 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/authority.h', @@ -1033,6 +1065,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel_interface.h', 'src/core/ext/filters/client_channel/subchannel_pool_interface.h', 'src/core/ext/filters/deadline/deadline_filter.h', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', 'src/core/ext/filters/client_channel/health/health.pb.h', 'src/core/tsi/fake_transport_security.h', 'src/core/tsi/local_transport_security.h', @@ -1192,6 +1225,13 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', + 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', + 'src/core/ext/upb-generated/google/protobuf/any.upb.h', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', @@ -1394,5 +1434,11 @@ Pod::Spec.new do |s| s.prepare_command = <<-END_OF_COMMAND sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS==1\\\n #include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/core -type f -print | xargs grep -H -c '#include ;#if COCOAPODS==1\\\n #include \\\n#else\\\n #include \\\n#endif;g' $(find src/core -type f \\( -path '*.h' -or -path '*.cc' \\) -print | xargs grep -H -c '#include + + + @@ -313,6 +316,7 @@ + @@ -472,6 +476,13 @@ + + + + + + + @@ -746,7 +757,17 @@ + + + + + + + + + + @@ -778,6 +799,7 @@ + @@ -797,6 +819,13 @@ + + + + + + + diff --git a/setup.py b/setup.py index 1e205bdf91d..fe8e8d05afd 100644 --- a/setup.py +++ b/setup.py @@ -35,9 +35,7 @@ egg_info.manifest_maker.template = 'PYTHON-MANIFEST.in' PY3 = sys.version_info.major == 3 PYTHON_STEM = os.path.join('src', 'python', 'grpcio') CORE_INCLUDE = ('include', '.',) -SSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),) -ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),) -NANOPB_INCLUDE = (os.path.join('third_party', 'nanopb'),) +ADDRESS_SORTING_INCLUDE = (os.path.join('third_party', 'address_sorting', 'include'),) CARES_INCLUDE = ( os.path.join('third_party', 'cares'), os.path.join('third_party', 'cares', 'cares'),) @@ -49,7 +47,12 @@ if 'linux' in sys.platform: CARES_INCLUDE += (os.path.join('third_party', 'cares', 'config_linux'),) if 'openbsd' in sys.platform: CARES_INCLUDE += (os.path.join('third_party', 'cares', 'config_openbsd'),) -ADDRESS_SORTING_INCLUDE = (os.path.join('third_party', 'address_sorting', 'include'),) +NANOPB_INCLUDE = (os.path.join('third_party', 'nanopb'),) +SSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),) +UPB_INCLUDE = (os.path.join('third_party', 'upb'),) +UPB_GENERATED_INCLUDE = (os.path.join('third_party','upb', 'generated_for_cmake'),) +UPB_GRPC_GENERATED_INCLUDE = (os.path.join('src', 'core', 'ext', 'upb-generated'),) +ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),) README = os.path.join(PYTHON_STEM, 'README.rst') # Ensure we're in the proper directory whether or not we're being used by pip. @@ -203,8 +206,16 @@ if BUILD_WITH_SYSTEM_CARES: CARES_INCLUDE = (os.path.join('/usr', 'include'),) EXTENSION_INCLUDE_DIRECTORIES = ( - (PYTHON_STEM,) + CORE_INCLUDE + SSL_INCLUDE + ZLIB_INCLUDE + - NANOPB_INCLUDE + CARES_INCLUDE + ADDRESS_SORTING_INCLUDE) + (PYTHON_STEM,) + + CORE_INCLUDE + + ADDRESS_SORTING_INCLUDE + + CARES_INCLUDE + + NANOPB_INCLUDE + + SSL_INCLUDE + + UPB_INCLUDE + + UPB_GENERATED_INCLUDE + + UPB_GRPC_GENERATED_INCLUDE + + ZLIB_INCLUDE) EXTENSION_LIBRARIES = () if "linux" in sys.platform: diff --git a/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c b/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c deleted file mode 100644 index 61b9299bb43..00000000000 --- a/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +++ /dev/null @@ -1,485 +0,0 @@ -/* This file was generated by upbc (the upb compiler) from the input - * file: - * - * google/protobuf/descriptor.proto - * - * Do not edit -- your changes will be discarded when the file is - * regenerated. */ - -#include -#include "upb/msg.h" -#include "google/protobuf/descriptor.upb.h" - -#include "upb/port_def.inc" - -static const upb_msglayout *const google_protobuf_FileDescriptorSet_submsgs[1] = { - &google_protobuf_FileDescriptorProto_msginit, -}; - -static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = { - {1, UPB_SIZE(0, 0), 0, 0, 11, 3}, -}; - -const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { - &google_protobuf_FileDescriptorSet_submsgs[0], - &google_protobuf_FileDescriptorSet__fields[0], - UPB_SIZE(4, 8), 1, false, -}; - -static const upb_msglayout *const google_protobuf_FileDescriptorProto_submsgs[6] = { - &google_protobuf_DescriptorProto_msginit, - &google_protobuf_EnumDescriptorProto_msginit, - &google_protobuf_FieldDescriptorProto_msginit, - &google_protobuf_FileOptions_msginit, - &google_protobuf_ServiceDescriptorProto_msginit, - &google_protobuf_SourceCodeInfo_msginit, -}; - -static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] = { - {1, UPB_SIZE(4, 8), 1, 0, 9, 1}, - {2, UPB_SIZE(12, 24), 2, 0, 9, 1}, - {3, UPB_SIZE(36, 72), 0, 0, 9, 3}, - {4, UPB_SIZE(40, 80), 0, 0, 11, 3}, - {5, UPB_SIZE(44, 88), 0, 1, 11, 3}, - {6, UPB_SIZE(48, 96), 0, 4, 11, 3}, - {7, UPB_SIZE(52, 104), 0, 2, 11, 3}, - {8, UPB_SIZE(28, 56), 4, 3, 11, 1}, - {9, UPB_SIZE(32, 64), 5, 5, 11, 1}, - {10, UPB_SIZE(56, 112), 0, 0, 5, 3}, - {11, UPB_SIZE(60, 120), 0, 0, 5, 3}, - {12, UPB_SIZE(20, 40), 3, 0, 9, 1}, -}; - -const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { - &google_protobuf_FileDescriptorProto_submsgs[0], - &google_protobuf_FileDescriptorProto__fields[0], - UPB_SIZE(64, 128), 12, false, -}; - -static const upb_msglayout *const google_protobuf_DescriptorProto_submsgs[8] = { - &google_protobuf_DescriptorProto_msginit, - &google_protobuf_DescriptorProto_ExtensionRange_msginit, - &google_protobuf_DescriptorProto_ReservedRange_msginit, - &google_protobuf_EnumDescriptorProto_msginit, - &google_protobuf_FieldDescriptorProto_msginit, - &google_protobuf_MessageOptions_msginit, - &google_protobuf_OneofDescriptorProto_msginit, -}; - -static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10] = { - {1, UPB_SIZE(4, 8), 1, 0, 9, 1}, - {2, UPB_SIZE(16, 32), 0, 4, 11, 3}, - {3, UPB_SIZE(20, 40), 0, 0, 11, 3}, - {4, UPB_SIZE(24, 48), 0, 3, 11, 3}, - {5, UPB_SIZE(28, 56), 0, 1, 11, 3}, - {6, UPB_SIZE(32, 64), 0, 4, 11, 3}, - {7, UPB_SIZE(12, 24), 2, 5, 11, 1}, - {8, UPB_SIZE(36, 72), 0, 6, 11, 3}, - {9, UPB_SIZE(40, 80), 0, 2, 11, 3}, - {10, UPB_SIZE(44, 88), 0, 0, 9, 3}, -}; - -const upb_msglayout google_protobuf_DescriptorProto_msginit = { - &google_protobuf_DescriptorProto_submsgs[0], - &google_protobuf_DescriptorProto__fields[0], - UPB_SIZE(48, 96), 10, false, -}; - -static const upb_msglayout *const google_protobuf_DescriptorProto_ExtensionRange_submsgs[1] = { - &google_protobuf_ExtensionRangeOptions_msginit, -}; - -static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange__fields[3] = { - {1, UPB_SIZE(4, 4), 1, 0, 5, 1}, - {2, UPB_SIZE(8, 8), 2, 0, 5, 1}, - {3, UPB_SIZE(12, 16), 3, 0, 11, 1}, -}; - -const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { - &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0], - &google_protobuf_DescriptorProto_ExtensionRange__fields[0], - UPB_SIZE(16, 24), 3, false, -}; - -static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__fields[2] = { - {1, UPB_SIZE(4, 4), 1, 0, 5, 1}, - {2, UPB_SIZE(8, 8), 2, 0, 5, 1}, -}; - -const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { - NULL, - &google_protobuf_DescriptorProto_ReservedRange__fields[0], - UPB_SIZE(12, 12), 2, false, -}; - -static const upb_msglayout *const google_protobuf_ExtensionRangeOptions_submsgs[1] = { - &google_protobuf_UninterpretedOption_msginit, -}; - -static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1] = { - {999, UPB_SIZE(0, 0), 0, 0, 11, 3}, -}; - -const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { - &google_protobuf_ExtensionRangeOptions_submsgs[0], - &google_protobuf_ExtensionRangeOptions__fields[0], - UPB_SIZE(4, 8), 1, false, -}; - -static const upb_msglayout *const google_protobuf_FieldDescriptorProto_submsgs[1] = { - &google_protobuf_FieldOptions_msginit, -}; - -static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[10] = { - {1, UPB_SIZE(32, 32), 5, 0, 9, 1}, - {2, UPB_SIZE(40, 48), 6, 0, 9, 1}, - {3, UPB_SIZE(24, 24), 3, 0, 5, 1}, - {4, UPB_SIZE(8, 8), 1, 0, 14, 1}, - {5, UPB_SIZE(16, 16), 2, 0, 14, 1}, - {6, UPB_SIZE(48, 64), 7, 0, 9, 1}, - {7, UPB_SIZE(56, 80), 8, 0, 9, 1}, - {8, UPB_SIZE(72, 112), 10, 0, 11, 1}, - {9, UPB_SIZE(28, 28), 4, 0, 5, 1}, - {10, UPB_SIZE(64, 96), 9, 0, 9, 1}, -}; - -const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { - &google_protobuf_FieldDescriptorProto_submsgs[0], - &google_protobuf_FieldDescriptorProto__fields[0], - UPB_SIZE(80, 128), 10, false, -}; - -static const upb_msglayout *const google_protobuf_OneofDescriptorProto_submsgs[1] = { - &google_protobuf_OneofOptions_msginit, -}; - -static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2] = { - {1, UPB_SIZE(4, 8), 1, 0, 9, 1}, - {2, UPB_SIZE(12, 24), 2, 0, 11, 1}, -}; - -const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { - &google_protobuf_OneofDescriptorProto_submsgs[0], - &google_protobuf_OneofDescriptorProto__fields[0], - UPB_SIZE(16, 32), 2, false, -}; - -static const upb_msglayout *const google_protobuf_EnumDescriptorProto_submsgs[3] = { - &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, - &google_protobuf_EnumOptions_msginit, - &google_protobuf_EnumValueDescriptorProto_msginit, -}; - -static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] = { - {1, UPB_SIZE(4, 8), 1, 0, 9, 1}, - {2, UPB_SIZE(16, 32), 0, 2, 11, 3}, - {3, UPB_SIZE(12, 24), 2, 1, 11, 1}, - {4, UPB_SIZE(20, 40), 0, 0, 11, 3}, - {5, UPB_SIZE(24, 48), 0, 0, 9, 3}, -}; - -const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { - &google_protobuf_EnumDescriptorProto_submsgs[0], - &google_protobuf_EnumDescriptorProto__fields[0], - UPB_SIZE(32, 64), 5, false, -}; - -static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[2] = { - {1, UPB_SIZE(4, 4), 1, 0, 5, 1}, - {2, UPB_SIZE(8, 8), 2, 0, 5, 1}, -}; - -const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { - NULL, - &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], - UPB_SIZE(12, 12), 2, false, -}; - -static const upb_msglayout *const google_protobuf_EnumValueDescriptorProto_submsgs[1] = { - &google_protobuf_EnumValueOptions_msginit, -}; - -static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__fields[3] = { - {1, UPB_SIZE(8, 8), 2, 0, 9, 1}, - {2, UPB_SIZE(4, 4), 1, 0, 5, 1}, - {3, UPB_SIZE(16, 24), 3, 0, 11, 1}, -}; - -const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { - &google_protobuf_EnumValueDescriptorProto_submsgs[0], - &google_protobuf_EnumValueDescriptorProto__fields[0], - UPB_SIZE(24, 32), 3, false, -}; - -static const upb_msglayout *const google_protobuf_ServiceDescriptorProto_submsgs[2] = { - &google_protobuf_MethodDescriptorProto_msginit, - &google_protobuf_ServiceOptions_msginit, -}; - -static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[3] = { - {1, UPB_SIZE(4, 8), 1, 0, 9, 1}, - {2, UPB_SIZE(16, 32), 0, 0, 11, 3}, - {3, UPB_SIZE(12, 24), 2, 1, 11, 1}, -}; - -const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { - &google_protobuf_ServiceDescriptorProto_submsgs[0], - &google_protobuf_ServiceDescriptorProto__fields[0], - UPB_SIZE(24, 48), 3, false, -}; - -static const upb_msglayout *const google_protobuf_MethodDescriptorProto_submsgs[1] = { - &google_protobuf_MethodOptions_msginit, -}; - -static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6] = { - {1, UPB_SIZE(4, 8), 3, 0, 9, 1}, - {2, UPB_SIZE(12, 24), 4, 0, 9, 1}, - {3, UPB_SIZE(20, 40), 5, 0, 9, 1}, - {4, UPB_SIZE(28, 56), 6, 0, 11, 1}, - {5, UPB_SIZE(1, 1), 1, 0, 8, 1}, - {6, UPB_SIZE(2, 2), 2, 0, 8, 1}, -}; - -const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { - &google_protobuf_MethodDescriptorProto_submsgs[0], - &google_protobuf_MethodDescriptorProto__fields[0], - UPB_SIZE(32, 64), 6, false, -}; - -static const upb_msglayout *const google_protobuf_FileOptions_submsgs[1] = { - &google_protobuf_UninterpretedOption_msginit, -}; - -static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { - {1, UPB_SIZE(28, 32), 11, 0, 9, 1}, - {8, UPB_SIZE(36, 48), 12, 0, 9, 1}, - {9, UPB_SIZE(8, 8), 1, 0, 14, 1}, - {10, UPB_SIZE(16, 16), 2, 0, 8, 1}, - {11, UPB_SIZE(44, 64), 13, 0, 9, 1}, - {16, UPB_SIZE(17, 17), 3, 0, 8, 1}, - {17, UPB_SIZE(18, 18), 4, 0, 8, 1}, - {18, UPB_SIZE(19, 19), 5, 0, 8, 1}, - {20, UPB_SIZE(20, 20), 6, 0, 8, 1}, - {23, UPB_SIZE(21, 21), 7, 0, 8, 1}, - {27, UPB_SIZE(22, 22), 8, 0, 8, 1}, - {31, UPB_SIZE(23, 23), 9, 0, 8, 1}, - {36, UPB_SIZE(52, 80), 14, 0, 9, 1}, - {37, UPB_SIZE(60, 96), 15, 0, 9, 1}, - {39, UPB_SIZE(68, 112), 16, 0, 9, 1}, - {40, UPB_SIZE(76, 128), 17, 0, 9, 1}, - {41, UPB_SIZE(84, 144), 18, 0, 9, 1}, - {42, UPB_SIZE(24, 24), 10, 0, 8, 1}, - {44, UPB_SIZE(92, 160), 19, 0, 9, 1}, - {45, UPB_SIZE(100, 176), 20, 0, 9, 1}, - {999, UPB_SIZE(108, 192), 0, 0, 11, 3}, -}; - -const upb_msglayout google_protobuf_FileOptions_msginit = { - &google_protobuf_FileOptions_submsgs[0], - &google_protobuf_FileOptions__fields[0], - UPB_SIZE(112, 208), 21, false, -}; - -static const upb_msglayout *const google_protobuf_MessageOptions_submsgs[1] = { - &google_protobuf_UninterpretedOption_msginit, -}; - -static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = { - {1, UPB_SIZE(1, 1), 1, 0, 8, 1}, - {2, UPB_SIZE(2, 2), 2, 0, 8, 1}, - {3, UPB_SIZE(3, 3), 3, 0, 8, 1}, - {7, UPB_SIZE(4, 4), 4, 0, 8, 1}, - {999, UPB_SIZE(8, 8), 0, 0, 11, 3}, -}; - -const upb_msglayout google_protobuf_MessageOptions_msginit = { - &google_protobuf_MessageOptions_submsgs[0], - &google_protobuf_MessageOptions__fields[0], - UPB_SIZE(12, 16), 5, false, -}; - -static const upb_msglayout *const google_protobuf_FieldOptions_submsgs[1] = { - &google_protobuf_UninterpretedOption_msginit, -}; - -static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { - {1, UPB_SIZE(8, 8), 1, 0, 14, 1}, - {2, UPB_SIZE(24, 24), 3, 0, 8, 1}, - {3, UPB_SIZE(25, 25), 4, 0, 8, 1}, - {5, UPB_SIZE(26, 26), 5, 0, 8, 1}, - {6, UPB_SIZE(16, 16), 2, 0, 14, 1}, - {10, UPB_SIZE(27, 27), 6, 0, 8, 1}, - {999, UPB_SIZE(28, 32), 0, 0, 11, 3}, -}; - -const upb_msglayout google_protobuf_FieldOptions_msginit = { - &google_protobuf_FieldOptions_submsgs[0], - &google_protobuf_FieldOptions__fields[0], - UPB_SIZE(32, 40), 7, false, -}; - -static const upb_msglayout *const google_protobuf_OneofOptions_submsgs[1] = { - &google_protobuf_UninterpretedOption_msginit, -}; - -static const upb_msglayout_field google_protobuf_OneofOptions__fields[1] = { - {999, UPB_SIZE(0, 0), 0, 0, 11, 3}, -}; - -const upb_msglayout google_protobuf_OneofOptions_msginit = { - &google_protobuf_OneofOptions_submsgs[0], - &google_protobuf_OneofOptions__fields[0], - UPB_SIZE(4, 8), 1, false, -}; - -static const upb_msglayout *const google_protobuf_EnumOptions_submsgs[1] = { - &google_protobuf_UninterpretedOption_msginit, -}; - -static const upb_msglayout_field google_protobuf_EnumOptions__fields[3] = { - {2, UPB_SIZE(1, 1), 1, 0, 8, 1}, - {3, UPB_SIZE(2, 2), 2, 0, 8, 1}, - {999, UPB_SIZE(4, 8), 0, 0, 11, 3}, -}; - -const upb_msglayout google_protobuf_EnumOptions_msginit = { - &google_protobuf_EnumOptions_submsgs[0], - &google_protobuf_EnumOptions__fields[0], - UPB_SIZE(8, 16), 3, false, -}; - -static const upb_msglayout *const google_protobuf_EnumValueOptions_submsgs[1] = { - &google_protobuf_UninterpretedOption_msginit, -}; - -static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2] = { - {1, UPB_SIZE(1, 1), 1, 0, 8, 1}, - {999, UPB_SIZE(4, 8), 0, 0, 11, 3}, -}; - -const upb_msglayout google_protobuf_EnumValueOptions_msginit = { - &google_protobuf_EnumValueOptions_submsgs[0], - &google_protobuf_EnumValueOptions__fields[0], - UPB_SIZE(8, 16), 2, false, -}; - -static const upb_msglayout *const google_protobuf_ServiceOptions_submsgs[1] = { - &google_protobuf_UninterpretedOption_msginit, -}; - -static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2] = { - {33, UPB_SIZE(1, 1), 1, 0, 8, 1}, - {999, UPB_SIZE(4, 8), 0, 0, 11, 3}, -}; - -const upb_msglayout google_protobuf_ServiceOptions_msginit = { - &google_protobuf_ServiceOptions_submsgs[0], - &google_protobuf_ServiceOptions__fields[0], - UPB_SIZE(8, 16), 2, false, -}; - -static const upb_msglayout *const google_protobuf_MethodOptions_submsgs[1] = { - &google_protobuf_UninterpretedOption_msginit, -}; - -static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = { - {33, UPB_SIZE(16, 16), 2, 0, 8, 1}, - {34, UPB_SIZE(8, 8), 1, 0, 14, 1}, - {999, UPB_SIZE(20, 24), 0, 0, 11, 3}, -}; - -const upb_msglayout google_protobuf_MethodOptions_msginit = { - &google_protobuf_MethodOptions_submsgs[0], - &google_protobuf_MethodOptions__fields[0], - UPB_SIZE(24, 32), 3, false, -}; - -static const upb_msglayout *const google_protobuf_UninterpretedOption_submsgs[1] = { - &google_protobuf_UninterpretedOption_NamePart_msginit, -}; - -static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7] = { - {2, UPB_SIZE(56, 80), 0, 0, 11, 3}, - {3, UPB_SIZE(32, 32), 4, 0, 9, 1}, - {4, UPB_SIZE(8, 8), 1, 0, 4, 1}, - {5, UPB_SIZE(16, 16), 2, 0, 3, 1}, - {6, UPB_SIZE(24, 24), 3, 0, 1, 1}, - {7, UPB_SIZE(40, 48), 5, 0, 12, 1}, - {8, UPB_SIZE(48, 64), 6, 0, 9, 1}, -}; - -const upb_msglayout google_protobuf_UninterpretedOption_msginit = { - &google_protobuf_UninterpretedOption_submsgs[0], - &google_protobuf_UninterpretedOption__fields[0], - UPB_SIZE(64, 96), 7, false, -}; - -static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__fields[2] = { - {1, UPB_SIZE(4, 8), 2, 0, 9, 2}, - {2, UPB_SIZE(1, 1), 1, 0, 8, 2}, -}; - -const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { - NULL, - &google_protobuf_UninterpretedOption_NamePart__fields[0], - UPB_SIZE(16, 32), 2, false, -}; - -static const upb_msglayout *const google_protobuf_SourceCodeInfo_submsgs[1] = { - &google_protobuf_SourceCodeInfo_Location_msginit, -}; - -static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = { - {1, UPB_SIZE(0, 0), 0, 0, 11, 3}, -}; - -const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { - &google_protobuf_SourceCodeInfo_submsgs[0], - &google_protobuf_SourceCodeInfo__fields[0], - UPB_SIZE(4, 8), 1, false, -}; - -static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields[5] = { - {1, UPB_SIZE(20, 40), 0, 0, 5, 3}, - {2, UPB_SIZE(24, 48), 0, 0, 5, 3}, - {3, UPB_SIZE(4, 8), 1, 0, 9, 1}, - {4, UPB_SIZE(12, 24), 2, 0, 9, 1}, - {6, UPB_SIZE(28, 56), 0, 0, 9, 3}, -}; - -const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { - NULL, - &google_protobuf_SourceCodeInfo_Location__fields[0], - UPB_SIZE(32, 64), 5, false, -}; - -static const upb_msglayout *const google_protobuf_GeneratedCodeInfo_submsgs[1] = { - &google_protobuf_GeneratedCodeInfo_Annotation_msginit, -}; - -static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = { - {1, UPB_SIZE(0, 0), 0, 0, 11, 3}, -}; - -const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { - &google_protobuf_GeneratedCodeInfo_submsgs[0], - &google_protobuf_GeneratedCodeInfo__fields[0], - UPB_SIZE(4, 8), 1, false, -}; - -static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__fields[4] = { - {1, UPB_SIZE(20, 32), 0, 0, 5, 3}, - {2, UPB_SIZE(12, 16), 3, 0, 9, 1}, - {3, UPB_SIZE(4, 4), 1, 0, 5, 1}, - {4, UPB_SIZE(8, 8), 2, 0, 5, 1}, -}; - -const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { - NULL, - &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], - UPB_SIZE(24, 48), 4, false, -}; - -#include "upb/port_undef.inc" - diff --git a/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h b/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h deleted file mode 100644 index 681614910e0..00000000000 --- a/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +++ /dev/null @@ -1,1690 +0,0 @@ -/* This file was generated by upbc (the upb compiler) from the input - * file: - * - * google/protobuf/descriptor.proto - * - * Do not edit -- your changes will be discarded when the file is - * regenerated. */ - -#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ -#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ - -#include "upb/generated_util.h" -#include "upb/msg.h" -#include "upb/decode.h" -#include "upb/encode.h" - -#include "upb/port_def.inc" - -#ifdef __cplusplus -extern "C" { -#endif - -struct google_protobuf_FileDescriptorSet; -struct google_protobuf_FileDescriptorProto; -struct google_protobuf_DescriptorProto; -struct google_protobuf_DescriptorProto_ExtensionRange; -struct google_protobuf_DescriptorProto_ReservedRange; -struct google_protobuf_ExtensionRangeOptions; -struct google_protobuf_FieldDescriptorProto; -struct google_protobuf_OneofDescriptorProto; -struct google_protobuf_EnumDescriptorProto; -struct google_protobuf_EnumDescriptorProto_EnumReservedRange; -struct google_protobuf_EnumValueDescriptorProto; -struct google_protobuf_ServiceDescriptorProto; -struct google_protobuf_MethodDescriptorProto; -struct google_protobuf_FileOptions; -struct google_protobuf_MessageOptions; -struct google_protobuf_FieldOptions; -struct google_protobuf_OneofOptions; -struct google_protobuf_EnumOptions; -struct google_protobuf_EnumValueOptions; -struct google_protobuf_ServiceOptions; -struct google_protobuf_MethodOptions; -struct google_protobuf_UninterpretedOption; -struct google_protobuf_UninterpretedOption_NamePart; -struct google_protobuf_SourceCodeInfo; -struct google_protobuf_SourceCodeInfo_Location; -struct google_protobuf_GeneratedCodeInfo; -struct google_protobuf_GeneratedCodeInfo_Annotation; -typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet; -typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto; -typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto; -typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange; -typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange; -typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions; -typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto; -typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto; -typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto; -typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange; -typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto; -typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto; -typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto; -typedef struct google_protobuf_FileOptions google_protobuf_FileOptions; -typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions; -typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions; -typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions; -typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions; -typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions; -typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions; -typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions; -typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption; -typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart; -typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo; -typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location; -typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo; -typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation; -extern const upb_msglayout google_protobuf_FileDescriptorSet_msginit; -extern const upb_msglayout google_protobuf_FileDescriptorProto_msginit; -extern const upb_msglayout google_protobuf_DescriptorProto_msginit; -extern const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit; -extern const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit; -extern const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit; -extern const upb_msglayout google_protobuf_FieldDescriptorProto_msginit; -extern const upb_msglayout google_protobuf_OneofDescriptorProto_msginit; -extern const upb_msglayout google_protobuf_EnumDescriptorProto_msginit; -extern const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit; -extern const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit; -extern const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit; -extern const upb_msglayout google_protobuf_MethodDescriptorProto_msginit; -extern const upb_msglayout google_protobuf_FileOptions_msginit; -extern const upb_msglayout google_protobuf_MessageOptions_msginit; -extern const upb_msglayout google_protobuf_FieldOptions_msginit; -extern const upb_msglayout google_protobuf_OneofOptions_msginit; -extern const upb_msglayout google_protobuf_EnumOptions_msginit; -extern const upb_msglayout google_protobuf_EnumValueOptions_msginit; -extern const upb_msglayout google_protobuf_ServiceOptions_msginit; -extern const upb_msglayout google_protobuf_MethodOptions_msginit; -extern const upb_msglayout google_protobuf_UninterpretedOption_msginit; -extern const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit; -extern const upb_msglayout google_protobuf_SourceCodeInfo_msginit; -extern const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit; -extern const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit; -extern const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit; - -typedef enum { - google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1, - google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2, - google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3 -} google_protobuf_FieldDescriptorProto_Label; - -typedef enum { - google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1, - google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2, - google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3, - google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4, - google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5, - google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6, - google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7, - google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8, - google_protobuf_FieldDescriptorProto_TYPE_STRING = 9, - google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10, - google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11, - google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12, - google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13, - google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14, - google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15, - google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16, - google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17, - google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18 -} google_protobuf_FieldDescriptorProto_Type; - -typedef enum { - google_protobuf_FieldOptions_STRING = 0, - google_protobuf_FieldOptions_CORD = 1, - google_protobuf_FieldOptions_STRING_PIECE = 2 -} google_protobuf_FieldOptions_CType; - -typedef enum { - google_protobuf_FieldOptions_JS_NORMAL = 0, - google_protobuf_FieldOptions_JS_STRING = 1, - google_protobuf_FieldOptions_JS_NUMBER = 2 -} google_protobuf_FieldOptions_JSType; - -typedef enum { - google_protobuf_FileOptions_SPEED = 1, - google_protobuf_FileOptions_CODE_SIZE = 2, - google_protobuf_FileOptions_LITE_RUNTIME = 3 -} google_protobuf_FileOptions_OptimizeMode; - -typedef enum { - google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0, - google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1, - google_protobuf_MethodOptions_IDEMPOTENT = 2 -} google_protobuf_MethodOptions_IdempotencyLevel; - - -/* google.protobuf.FileDescriptorSet */ - -UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_arena *arena) { - return (google_protobuf_FileDescriptorSet *)upb_msg_new(&google_protobuf_FileDescriptorSet_msginit, arena); -} -UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_FileDescriptorSet *ret = google_protobuf_FileDescriptorSet_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_FileDescriptorSet_msginit, arena, len); -} - -UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet *msg, size_t *len) { return (const google_protobuf_FileDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } - -UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet *msg, size_t *len) { - return (google_protobuf_FileDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); -} -UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet *msg, size_t len, upb_arena *arena) { - return (google_protobuf_FileDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet *msg, upb_arena *arena) { - struct google_protobuf_FileDescriptorProto* sub = (struct google_protobuf_FileDescriptorProto*)upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} - -/* google.protobuf.FileDescriptorProto */ - -UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_arena *arena) { - return (google_protobuf_FileDescriptorProto *)upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena); -} -UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_FileDescriptorProto *ret = google_protobuf_FileDescriptorProto_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_FileDescriptorProto_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } -UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); } -UPB_INLINE upb_strview const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); } -UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); } -UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); } -UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(48, 96), len); } -UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(52, 104), len); } -UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 4); } -UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_FileOptions*, UPB_SIZE(28, 56)); } -UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 5); } -UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_SourceCodeInfo*, UPB_SIZE(32, 64)); } -UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(56, 112), len); } -UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(60, 120), len); } -UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 3); } -UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); } - -UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; -} -UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value; -} -UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) { - return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len); -} -UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(36, 72), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); -} -UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto *msg, upb_strview val, upb_arena *arena) { - return _upb_array_append_accessor( - msg, UPB_SIZE(36, 72), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); -} -UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto *msg, size_t *len) { - return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len); -} -UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(40, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto *msg, size_t *len) { - return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len); -} -UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(44, 88), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto *msg, size_t *len) { - return (google_protobuf_ServiceDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(48, 96), len); -} -UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_ServiceDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(48, 96), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_ServiceDescriptorProto* sub = (struct google_protobuf_ServiceDescriptorProto*)upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(48, 96), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto *msg, size_t *len) { - return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(52, 104), len); -} -UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(52, 104), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(52, 104), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) { - _upb_sethas(msg, 4); - UPB_FIELD_AT(msg, google_protobuf_FileOptions*, UPB_SIZE(28, 56)) = value; -} -UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg); - if (sub == NULL) { - sub = (struct google_protobuf_FileOptions*)upb_msg_new(&google_protobuf_FileOptions_msginit, arena); - if (!sub) return NULL; - google_protobuf_FileDescriptorProto_set_options(msg, sub); - } - return sub; -} -UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) { - _upb_sethas(msg, 5); - UPB_FIELD_AT(msg, google_protobuf_SourceCodeInfo*, UPB_SIZE(32, 64)) = value; -} -UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg); - if (sub == NULL) { - sub = (struct google_protobuf_SourceCodeInfo*)upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena); - if (!sub) return NULL; - google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub); - } - return sub; -} -UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) { - return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 112), len); -} -UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(56, 112), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena); -} -UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) { - return _upb_array_append_accessor( - msg, UPB_SIZE(56, 112), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); -} -UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) { - return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(60, 120), len); -} -UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(60, 120), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena); -} -UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) { - return _upb_array_append_accessor( - msg, UPB_SIZE(60, 120), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); -} -UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 3); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value; -} - -/* google.protobuf.DescriptorProto */ - -UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_arena *arena) { - return (google_protobuf_DescriptorProto *)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena); -} -UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_DescriptorProto *ret = google_protobuf_DescriptorProto_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_DescriptorProto_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE upb_strview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } -UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); } -UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); } -UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); } -UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); } -UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); } -UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_MessageOptions*, UPB_SIZE(12, 24)); } -UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); } -UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); } -UPB_INLINE upb_strview const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); } - -UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; -} -UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto *msg, size_t *len) { - return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len); -} -UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto *msg, size_t *len) { - return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len); -} -UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto *msg, size_t *len) { - return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len); -} -UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(24, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_mutable_extension_range(google_protobuf_DescriptorProto *msg, size_t *len) { - return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len); -} -UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_DescriptorProto_ExtensionRange* sub = (struct google_protobuf_DescriptorProto_ExtensionRange*)upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(28, 56), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto *msg, size_t *len) { - return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len); -} -UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(32, 64), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, google_protobuf_MessageOptions*, UPB_SIZE(12, 24)) = value; -} -UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg); - if (sub == NULL) { - sub = (struct google_protobuf_MessageOptions*)upb_msg_new(&google_protobuf_MessageOptions_msginit, arena); - if (!sub) return NULL; - google_protobuf_DescriptorProto_set_options(msg, sub); - } - return sub; -} -UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto *msg, size_t *len) { - return (google_protobuf_OneofDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len); -} -UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_OneofDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(36, 72), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_OneofDescriptorProto* google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_OneofDescriptorProto* sub = (struct google_protobuf_OneofDescriptorProto*)upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(36, 72), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_mutable_reserved_range(google_protobuf_DescriptorProto *msg, size_t *len) { - return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len); -} -UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_DescriptorProto_ReservedRange* sub = (struct google_protobuf_DescriptorProto_ReservedRange*)upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(40, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE upb_strview* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto *msg, size_t *len) { - return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len); -} -UPB_INLINE upb_strview* google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); -} -UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto *msg, upb_strview val, upb_arena *arena) { - return _upb_array_append_accessor( - msg, UPB_SIZE(44, 88), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); -} - -/* google.protobuf.DescriptorProto.ExtensionRange */ - -UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_arena *arena) { - return (google_protobuf_DescriptorProto_ExtensionRange *)upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena); -} -UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_DescriptorProto_ExtensionRange *ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_DescriptorProto_ExtensionRange_serialize(const google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); } -UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } -UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_has_field(msg, 3); } -UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return UPB_FIELD_AT(msg, const google_protobuf_ExtensionRangeOptions*, UPB_SIZE(12, 16)); } - -UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value; -} -UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; -} -UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) { - _upb_sethas(msg, 3); - UPB_FIELD_AT(msg, google_protobuf_ExtensionRangeOptions*, UPB_SIZE(12, 16)) = value; -} -UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena) { - struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg); - if (sub == NULL) { - sub = (struct google_protobuf_ExtensionRangeOptions*)upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena); - if (!sub) return NULL; - google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub); - } - return sub; -} - -/* google.protobuf.DescriptorProto.ReservedRange */ - -UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_arena *arena) { - return (google_protobuf_DescriptorProto_ReservedRange *)upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena); -} -UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_DescriptorProto_ReservedRange *ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_DescriptorProto_ReservedRange_serialize(const google_protobuf_DescriptorProto_ReservedRange *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); } -UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } - -UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value; -} -UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; -} - -/* google.protobuf.ExtensionRangeOptions */ - -UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_arena *arena) { - return (google_protobuf_ExtensionRangeOptions *)upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena); -} -UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_ExtensionRangeOptions *ret = google_protobuf_ExtensionRangeOptions_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_ExtensionRangeOptions_msginit, arena, len); -} - -UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } - -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t *len) { - return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena) { - struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} - -/* google.protobuf.FieldDescriptorProto */ - -UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_arena *arena) { - return (google_protobuf_FieldDescriptorProto *)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena); -} -UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_FieldDescriptorProto *ret = google_protobuf_FieldDescriptorProto_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_FieldDescriptorProto_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 5); } -UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 6); } -UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 3); } -UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 24)); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 7); } -UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 8); } -UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(56, 80)); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 10); } -UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_FieldOptions*, UPB_SIZE(72, 112)); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 4); } -UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(28, 28)); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 9); } -UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(64, 96)); } - -UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 5); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)) = value; -} -UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 6); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)) = value; -} -UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) { - _upb_sethas(msg, 3); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 24)) = value; -} -UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; -} -UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)) = value; -} -UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 7); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)) = value; -} -UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 8); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(56, 80)) = value; -} -UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) { - _upb_sethas(msg, 10); - UPB_FIELD_AT(msg, google_protobuf_FieldOptions*, UPB_SIZE(72, 112)) = value; -} -UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg); - if (sub == NULL) { - sub = (struct google_protobuf_FieldOptions*)upb_msg_new(&google_protobuf_FieldOptions_msginit, arena); - if (!sub) return NULL; - google_protobuf_FieldDescriptorProto_set_options(msg, sub); - } - return sub; -} -UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) { - _upb_sethas(msg, 4); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(28, 28)) = value; -} -UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 9); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(64, 96)) = value; -} - -/* google.protobuf.OneofDescriptorProto */ - -UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_arena *arena) { - return (google_protobuf_OneofDescriptorProto *)upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena); -} -UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_OneofDescriptorProto *ret = google_protobuf_OneofDescriptorProto_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_OneofDescriptorProto_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE upb_strview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } -UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_OneofOptions*, UPB_SIZE(12, 24)); } - -UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; -} -UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, google_protobuf_OneofOptions*, UPB_SIZE(12, 24)) = value; -} -UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg); - if (sub == NULL) { - sub = (struct google_protobuf_OneofOptions*)upb_msg_new(&google_protobuf_OneofOptions_msginit, arena); - if (!sub) return NULL; - google_protobuf_OneofDescriptorProto_set_options(msg, sub); - } - return sub; -} - -/* google.protobuf.EnumDescriptorProto */ - -UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_arena *arena) { - return (google_protobuf_EnumDescriptorProto *)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena); -} -UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_EnumDescriptorProto *ret = google_protobuf_EnumDescriptorProto_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_EnumDescriptorProto_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE upb_strview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } -UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); } -UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_EnumOptions*, UPB_SIZE(12, 24)); } -UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); } -UPB_INLINE upb_strview const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); } - -UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; -} -UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto *msg, size_t *len) { - return (google_protobuf_EnumValueDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len); -} -UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_EnumValueDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_EnumValueDescriptorProto* sub = (struct google_protobuf_EnumValueDescriptorProto*)upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, google_protobuf_EnumOptions*, UPB_SIZE(12, 24)) = value; -} -UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg); - if (sub == NULL) { - sub = (struct google_protobuf_EnumOptions*)upb_msg_new(&google_protobuf_EnumOptions_msginit, arena); - if (!sub) return NULL; - google_protobuf_EnumDescriptorProto_set_options(msg, sub); - } - return sub; -} -UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_mutable_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t *len) { - return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len); -} -UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_EnumDescriptorProto_EnumReservedRange* sub = (struct google_protobuf_EnumDescriptorProto_EnumReservedRange*)upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t *len) { - return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len); -} -UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) { - return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); -} -UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_strview val, upb_arena *arena) { - return _upb_array_append_accessor( - msg, UPB_SIZE(24, 48), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); -} - -/* google.protobuf.EnumDescriptorProto.EnumReservedRange */ - -UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_arena *arena) { - return (google_protobuf_EnumDescriptorProto_EnumReservedRange *)upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena); -} -UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_EnumDescriptorProto_EnumReservedRange *ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); } -UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } - -UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value; -} -UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; -} - -/* google.protobuf.EnumValueDescriptorProto */ - -UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_arena *arena) { - return (google_protobuf_EnumValueDescriptorProto *)upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena); -} -UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_EnumValueDescriptorProto *ret = google_protobuf_EnumValueDescriptorProto_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_EnumValueDescriptorProto_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE upb_strview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); } -UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); } -UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_has_field(msg, 3); } -UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_EnumValueOptions*, UPB_SIZE(16, 24)); } - -UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value; -} -UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value; -} -UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) { - _upb_sethas(msg, 3); - UPB_FIELD_AT(msg, google_protobuf_EnumValueOptions*, UPB_SIZE(16, 24)) = value; -} -UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg); - if (sub == NULL) { - sub = (struct google_protobuf_EnumValueOptions*)upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena); - if (!sub) return NULL; - google_protobuf_EnumValueDescriptorProto_set_options(msg, sub); - } - return sub; -} - -/* google.protobuf.ServiceDescriptorProto */ - -UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_arena *arena) { - return (google_protobuf_ServiceDescriptorProto *)upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena); -} -UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_ServiceDescriptorProto *ret = google_protobuf_ServiceDescriptorProto_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_ServiceDescriptorProto_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE upb_strview google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } -UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto *msg, size_t *len) { return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); } -UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_ServiceOptions*, UPB_SIZE(12, 24)); } - -UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; -} -UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto *msg, size_t *len) { - return (google_protobuf_MethodDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len); -} -UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_MethodDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_MethodDescriptorProto* sub = (struct google_protobuf_MethodDescriptorProto*)upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, google_protobuf_ServiceOptions*, UPB_SIZE(12, 24)) = value; -} -UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg); - if (sub == NULL) { - sub = (struct google_protobuf_ServiceOptions*)upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena); - if (!sub) return NULL; - google_protobuf_ServiceDescriptorProto_set_options(msg, sub); - } - return sub; -} - -/* google.protobuf.MethodDescriptorProto */ - -UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_arena *arena) { - return (google_protobuf_MethodDescriptorProto *)upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena); -} -UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_MethodDescriptorProto *ret = google_protobuf_MethodDescriptorProto_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_MethodDescriptorProto_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 3); } -UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } -UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 4); } -UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); } -UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 5); } -UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); } -UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 6); } -UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_MethodOptions*, UPB_SIZE(28, 56)); } -UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } -UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); } - -UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 3); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; -} -UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 4); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value; -} -UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 5); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value; -} -UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) { - _upb_sethas(msg, 6); - UPB_FIELD_AT(msg, google_protobuf_MethodOptions*, UPB_SIZE(28, 56)) = value; -} -UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto *msg, upb_arena *arena) { - struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg); - if (sub == NULL) { - sub = (struct google_protobuf_MethodOptions*)upb_msg_new(&google_protobuf_MethodOptions_msginit, arena); - if (!sub) return NULL; - google_protobuf_MethodDescriptorProto_set_options(msg, sub); - } - return sub; -} -UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; -} -UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value; -} - -/* google.protobuf.FileOptions */ - -UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_arena *arena) { - return (google_protobuf_FileOptions *)upb_msg_new(&google_protobuf_FileOptions_msginit, arena); -} -UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_FileOptions *ret = google_protobuf_FileOptions_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_FileOptions_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_FileOptions_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 11); } -UPB_INLINE upb_strview google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)); } -UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 12); } -UPB_INLINE upb_strview google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 48)); } -UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } -UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)); } -UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 13); } -UPB_INLINE upb_strview google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(44, 64)); } -UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 3); } -UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(17, 17)); } -UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 4); } -UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(18, 18)); } -UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 5); } -UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(19, 19)); } -UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 6); } -UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(20, 20)); } -UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 7); } -UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(21, 21)); } -UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 8); } -UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(22, 22)); } -UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 9); } -UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(23, 23)); } -UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 14); } -UPB_INLINE upb_strview google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(52, 80)); } -UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 15); } -UPB_INLINE upb_strview google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(60, 96)); } -UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 16); } -UPB_INLINE upb_strview google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(68, 112)); } -UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 17); } -UPB_INLINE upb_strview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(76, 128)); } -UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 18); } -UPB_INLINE upb_strview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(84, 144)); } -UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 10); } -UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)); } -UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 19); } -UPB_INLINE upb_strview google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(92, 160)); } -UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 20); } -UPB_INLINE upb_strview google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(100, 176)); } -UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(108, 192), len); } - -UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 11); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 12); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 48)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 13); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(44, 64)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 3); - UPB_FIELD_AT(msg, bool, UPB_SIZE(17, 17)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 4); - UPB_FIELD_AT(msg, bool, UPB_SIZE(18, 18)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 5); - UPB_FIELD_AT(msg, bool, UPB_SIZE(19, 19)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 6); - UPB_FIELD_AT(msg, bool, UPB_SIZE(20, 20)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 7); - UPB_FIELD_AT(msg, bool, UPB_SIZE(21, 21)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 8); - UPB_FIELD_AT(msg, bool, UPB_SIZE(22, 22)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 9); - UPB_FIELD_AT(msg, bool, UPB_SIZE(23, 23)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 14); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(52, 80)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 15); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(60, 96)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 16); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(68, 112)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 17); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(76, 128)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 18); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(84, 144)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 10); - UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 19); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(92, 160)) = value; -} -UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 20); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(100, 176)) = value; -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions *msg, size_t *len) { - return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(108, 192), len); -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_resize_uninterpreted_option(google_protobuf_FileOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(108, 192), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptions_add_uninterpreted_option(google_protobuf_FileOptions *msg, upb_arena *arena) { - struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(108, 192), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} - -/* google.protobuf.MessageOptions */ - -UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_arena *arena) { - return (google_protobuf_MessageOptions *)upb_msg_new(&google_protobuf_MessageOptions_msginit, arena); -} -UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_MessageOptions *ret = google_protobuf_MessageOptions_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_MessageOptions_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_MessageOptions_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } -UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); } -UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 3); } -UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(3, 3)); } -UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 4); } -UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)); } -UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(8, 8), len); } - -UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; -} -UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value; -} -UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) { - _upb_sethas(msg, 3); - UPB_FIELD_AT(msg, bool, UPB_SIZE(3, 3)) = value; -} -UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) { - _upb_sethas(msg, 4); - UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)) = value; -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions *msg, size_t *len) { - return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 8), len); -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_resize_uninterpreted_option(google_protobuf_MessageOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(8, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOptions_add_uninterpreted_option(google_protobuf_MessageOptions *msg, upb_arena *arena) { - struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(8, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} - -/* google.protobuf.FieldOptions */ - -UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_arena *arena) { - return (google_protobuf_FieldOptions *)upb_msg_new(&google_protobuf_FieldOptions_msginit, arena); -} -UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_FieldOptions *ret = google_protobuf_FieldOptions_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_FieldOptions_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_FieldOptions_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } -UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 3); } -UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)); } -UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 4); } -UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(25, 25)); } -UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 5); } -UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(26, 26)); } -UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)); } -UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 6); } -UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(27, 27)); } -UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(28, 32), len); } - -UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; -} -UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) { - _upb_sethas(msg, 3); - UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)) = value; -} -UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) { - _upb_sethas(msg, 4); - UPB_FIELD_AT(msg, bool, UPB_SIZE(25, 25)) = value; -} -UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) { - _upb_sethas(msg, 5); - UPB_FIELD_AT(msg, bool, UPB_SIZE(26, 26)) = value; -} -UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)) = value; -} -UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) { - _upb_sethas(msg, 6); - UPB_FIELD_AT(msg, bool, UPB_SIZE(27, 27)) = value; -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions *msg, size_t *len) { - return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 32), len); -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions *msg, upb_arena *arena) { - struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(28, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} - -/* google.protobuf.OneofOptions */ - -UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_arena *arena) { - return (google_protobuf_OneofOptions *)upb_msg_new(&google_protobuf_OneofOptions_msginit, arena); -} -UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_OneofOptions *ret = google_protobuf_OneofOptions_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_OneofOptions_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_OneofOptions_msginit, arena, len); -} - -UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } - -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mutable_uninterpreted_option(google_protobuf_OneofOptions *msg, size_t *len) { - return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_resize_uninterpreted_option(google_protobuf_OneofOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOptions_add_uninterpreted_option(google_protobuf_OneofOptions *msg, upb_arena *arena) { - struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} - -/* google.protobuf.EnumOptions */ - -UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_arena *arena) { - return (google_protobuf_EnumOptions *)upb_msg_new(&google_protobuf_EnumOptions_msginit, arena); -} -UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_EnumOptions *ret = google_protobuf_EnumOptions_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumOptions_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_EnumOptions_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } -UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); } -UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); } - -UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; -} -UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value; -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions *msg, size_t *len) { - return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_resize_uninterpreted_option(google_protobuf_EnumOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptions_add_uninterpreted_option(google_protobuf_EnumOptions *msg, upb_arena *arena) { - struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} - -/* google.protobuf.EnumValueOptions */ - -UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_arena *arena) { - return (google_protobuf_EnumValueOptions *)upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena); -} -UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_EnumValueOptions *ret = google_protobuf_EnumValueOptions_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumValueOptions_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_EnumValueOptions_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } -UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); } - -UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions *msg, size_t *len) { - return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions *msg, upb_arena *arena) { - struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} - -/* google.protobuf.ServiceOptions */ - -UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_arena *arena) { - return (google_protobuf_ServiceOptions *)upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena); -} -UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_ServiceOptions *ret = google_protobuf_ServiceOptions_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_ServiceOptions_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_ServiceOptions_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } -UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); } - -UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions *msg, size_t *len) { - return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_resize_uninterpreted_option(google_protobuf_ServiceOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOptions_add_uninterpreted_option(google_protobuf_ServiceOptions *msg, upb_arena *arena) { - struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} - -/* google.protobuf.MethodOptions */ - -UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_arena *arena) { - return (google_protobuf_MethodOptions *)upb_msg_new(&google_protobuf_MethodOptions_msginit, arena); -} -UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_MethodOptions *ret = google_protobuf_MethodOptions_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_MethodOptions_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_MethodOptions_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)); } -UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } -UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(20, 24), len); } - -UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)) = value; -} -UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t *len) { - return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 24), len); -} -UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_resize_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 24), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOptions_add_uninterpreted_option(google_protobuf_MethodOptions *msg, upb_arena *arena) { - struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(20, 24), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} - -/* google.protobuf.UninterpretedOption */ - -UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_arena *arena) { - return (google_protobuf_UninterpretedOption *)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); -} -UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_UninterpretedOption *ret = google_protobuf_UninterpretedOption_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_UninterpretedOption_msginit, arena, len); -} - -UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg, size_t *len) { return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_accessor(msg, UPB_SIZE(56, 80), len); } -UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 4); } -UPB_INLINE upb_strview google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)); } -UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(8, 8)); } -UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(16, 16)); } -UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 3); } -UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(24, 24)); } -UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 5); } -UPB_INLINE upb_strview google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)); } -UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 6); } -UPB_INLINE upb_strview google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)); } - -UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption *msg, size_t *len) { - return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 80), len); -} -UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_resize_accessor(msg, UPB_SIZE(56, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption *msg, upb_arena *arena) { - struct google_protobuf_UninterpretedOption_NamePart* sub = (struct google_protobuf_UninterpretedOption_NamePart*)upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(56, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} -UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_strview value) { - _upb_sethas(msg, 4); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)) = value; -} -UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(8, 8)) = value; -} -UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, int64_t, UPB_SIZE(16, 16)) = value; -} -UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) { - _upb_sethas(msg, 3); - UPB_FIELD_AT(msg, double, UPB_SIZE(24, 24)) = value; -} -UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_strview value) { - _upb_sethas(msg, 5); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)) = value; -} -UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_strview value) { - _upb_sethas(msg, 6); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)) = value; -} - -/* google.protobuf.UninterpretedOption.NamePart */ - -UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_arena *arena) { - return (google_protobuf_UninterpretedOption_NamePart *)upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena); -} -UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_UninterpretedOption_NamePart *ret = google_protobuf_UninterpretedOption_NamePart_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_UninterpretedOption_NamePart_serialize(const google_protobuf_UninterpretedOption_NamePart *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_UninterpretedOption_NamePart_msginit, arena, len); -} - -UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE upb_strview google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } -UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } - -UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_strview value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; -} -UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; -} - -/* google.protobuf.SourceCodeInfo */ - -UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_arena *arena) { - return (google_protobuf_SourceCodeInfo *)upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena); -} -UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_SourceCodeInfo *ret = google_protobuf_SourceCodeInfo_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_SourceCodeInfo_msginit, arena, len); -} - -UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo *msg, size_t *len) { return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } - -UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_mutable_location(google_protobuf_SourceCodeInfo *msg, size_t *len) { - return (google_protobuf_SourceCodeInfo_Location**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); -} -UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_resize_location(google_protobuf_SourceCodeInfo *msg, size_t len, upb_arena *arena) { - return (google_protobuf_SourceCodeInfo_Location**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_add_location(google_protobuf_SourceCodeInfo *msg, upb_arena *arena) { - struct google_protobuf_SourceCodeInfo_Location* sub = (struct google_protobuf_SourceCodeInfo_Location*)upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} - -/* google.protobuf.SourceCodeInfo.Location */ - -UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_arena *arena) { - return (google_protobuf_SourceCodeInfo_Location *)upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena); -} -UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_SourceCodeInfo_Location *ret = google_protobuf_SourceCodeInfo_Location_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_SourceCodeInfo_Location_serialize(const google_protobuf_SourceCodeInfo_Location *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_SourceCodeInfo_Location_msginit, arena, len); -} - -UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); } -UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); } -UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE upb_strview google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } -UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE upb_strview google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); } -UPB_INLINE upb_strview const* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); } - -UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { - return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len); -} -UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) { - return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena); -} -UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) { - return _upb_array_append_accessor( - msg, UPB_SIZE(20, 40), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); -} -UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { - return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len); -} -UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) { - return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena); -} -UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) { - return _upb_array_append_accessor( - msg, UPB_SIZE(24, 48), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); -} -UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; -} -UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value; -} -UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { - return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len); -} -UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_resize_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) { - return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); -} -UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview val, upb_arena *arena) { - return _upb_array_append_accessor( - msg, UPB_SIZE(28, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); -} - -/* google.protobuf.GeneratedCodeInfo */ - -UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_arena *arena) { - return (google_protobuf_GeneratedCodeInfo *)upb_msg_new(&google_protobuf_GeneratedCodeInfo_msginit, arena); -} -UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_GeneratedCodeInfo *ret = google_protobuf_GeneratedCodeInfo_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_msginit, arena, len); -} - -UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo *msg, size_t *len) { return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } - -UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_mutable_annotation(google_protobuf_GeneratedCodeInfo *msg, size_t *len) { - return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); -} -UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_resize_annotation(google_protobuf_GeneratedCodeInfo *msg, size_t len, upb_arena *arena) { - return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); -} -UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_add_annotation(google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena) { - struct google_protobuf_GeneratedCodeInfo_Annotation* sub = (struct google_protobuf_GeneratedCodeInfo_Annotation*)upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena); - bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); - if (!ok) return NULL; - return sub; -} - -/* google.protobuf.GeneratedCodeInfo.Annotation */ - -UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_arena *arena) { - return (google_protobuf_GeneratedCodeInfo_Annotation *)upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena); -} -UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parse(const char *buf, size_t size, - upb_arena *arena) { - google_protobuf_GeneratedCodeInfo_Annotation *ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); - return (ret && upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena)) ? ret : NULL; -} -UPB_INLINE char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(const google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena, len); -} - -UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(20, 32), len); } -UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_has_field(msg, 3); } -UPB_INLINE upb_strview google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)); } -UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_has_field(msg, 1); } -UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); } -UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_has_field(msg, 2); } -UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } - -UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) { - return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 32), len); -} -UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t len, upb_arena *arena) { - return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 32), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena); -} -UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t val, upb_arena *arena) { - return _upb_array_append_accessor( - msg, UPB_SIZE(20, 32), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); -} -UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_strview value) { - _upb_sethas(msg, 3); - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)) = value; -} -UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { - _upb_sethas(msg, 1); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value; -} -UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { - _upb_sethas(msg, 2); - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#include "upb/port_undef.inc" - -#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */ diff --git a/src/core/ext/upb-generated/grpc/gcp/altscontext.upb.c b/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c similarity index 93% rename from src/core/ext/upb-generated/grpc/gcp/altscontext.upb.c rename to src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c index 52477e183dc..9ffd2fbb4c0 100644 --- a/src/core/ext/upb-generated/grpc/gcp/altscontext.upb.c +++ b/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c @@ -1,14 +1,14 @@ /* This file was generated by upbc (the upb compiler) from the input * file: * - * grpc/gcp/altscontext.proto + * src/proto/grpc/gcp/altscontext.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ #include #include "upb/msg.h" -#include "grpc/gcp/altscontext.upb.h" +#include "src/proto/grpc/gcp/altscontext.upb.h" #include "src/proto/grpc/gcp/transport_security_common.upb.h" #include "upb/port_def.inc" diff --git a/src/core/ext/upb-generated/grpc/gcp/altscontext.upb.h b/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h similarity index 97% rename from src/core/ext/upb-generated/grpc/gcp/altscontext.upb.h rename to src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h index d9a4d58854d..ce32864cbc3 100644 --- a/src/core/ext/upb-generated/grpc/gcp/altscontext.upb.h +++ b/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h @@ -1,13 +1,13 @@ /* This file was generated by upbc (the upb compiler) from the input * file: * - * grpc/gcp/altscontext.proto + * src/proto/grpc/gcp/altscontext.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ -#ifndef GRPC_GCP_ALTSCONTEXT_PROTO_UPB_H_ -#define GRPC_GCP_ALTSCONTEXT_PROTO_UPB_H_ +#ifndef SRC_PROTO_GRPC_GCP_ALTSCONTEXT_PROTO_UPB_H_ +#define SRC_PROTO_GRPC_GCP_ALTSCONTEXT_PROTO_UPB_H_ #include "upb/generated_util.h" #include "upb/msg.h" @@ -123,4 +123,4 @@ UPB_INLINE void grpc_gcp_AltsContext_PeerAttributesEntry_set_value(grpc_gcp_Alts #include "upb/port_undef.inc" -#endif /* GRPC_GCP_ALTSCONTEXT_PROTO_UPB_H_ */ +#endif /* SRC_PROTO_GRPC_GCP_ALTSCONTEXT_PROTO_UPB_H_ */ diff --git a/src/core/ext/upb-generated/grpc/gcp/handshaker.upb.c b/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c similarity index 98% rename from src/core/ext/upb-generated/grpc/gcp/handshaker.upb.c rename to src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c index 9e957538323..80f3a0a82dc 100644 --- a/src/core/ext/upb-generated/grpc/gcp/handshaker.upb.c +++ b/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c @@ -1,14 +1,14 @@ /* This file was generated by upbc (the upb compiler) from the input * file: * - * grpc/gcp/handshaker.proto + * src/proto/grpc/gcp/handshaker.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ #include #include "upb/msg.h" -#include "grpc/gcp/handshaker.upb.h" +#include "src/proto/grpc/gcp/handshaker.upb.h" #include "src/proto/grpc/gcp/transport_security_common.upb.h" #include "upb/port_def.inc" diff --git a/src/core/ext/upb-generated/grpc/gcp/handshaker.upb.h b/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h similarity index 99% rename from src/core/ext/upb-generated/grpc/gcp/handshaker.upb.h rename to src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h index 97c8d44f45e..11a64324867 100644 --- a/src/core/ext/upb-generated/grpc/gcp/handshaker.upb.h +++ b/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h @@ -1,13 +1,13 @@ /* This file was generated by upbc (the upb compiler) from the input * file: * - * grpc/gcp/handshaker.proto + * src/proto/grpc/gcp/handshaker.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ -#ifndef GRPC_GCP_HANDSHAKER_PROTO_UPB_H_ -#define GRPC_GCP_HANDSHAKER_PROTO_UPB_H_ +#ifndef SRC_PROTO_GRPC_GCP_HANDSHAKER_PROTO_UPB_H_ +#define SRC_PROTO_GRPC_GCP_HANDSHAKER_PROTO_UPB_H_ #include "upb/generated_util.h" #include "upb/msg.h" @@ -678,4 +678,4 @@ UPB_INLINE struct grpc_gcp_HandshakerStatus* grpc_gcp_HandshakerResp_mutable_sta #include "upb/port_undef.inc" -#endif /* GRPC_GCP_HANDSHAKER_PROTO_UPB_H_ */ +#endif /* SRC_PROTO_GRPC_GCP_HANDSHAKER_PROTO_UPB_H_ */ diff --git a/src/core/ext/upb-generated/grpc/gcp/transport_security_common.upb.c b/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c similarity index 89% rename from src/core/ext/upb-generated/grpc/gcp/transport_security_common.upb.c rename to src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c index 19859504b87..9b6303458e2 100644 --- a/src/core/ext/upb-generated/grpc/gcp/transport_security_common.upb.c +++ b/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c @@ -1,14 +1,14 @@ /* This file was generated by upbc (the upb compiler) from the input * file: * - * grpc/gcp/transport_security_common.proto + * src/proto/grpc/gcp/transport_security_common.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ #include #include "upb/msg.h" -#include "grpc/gcp/transport_security_common.upb.h" +#include "src/proto/grpc/gcp/transport_security_common.upb.h" #include "upb/port_def.inc" diff --git a/src/core/ext/upb-generated/grpc/gcp/transport_security_common.upb.h b/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h similarity index 95% rename from src/core/ext/upb-generated/grpc/gcp/transport_security_common.upb.h rename to src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h index 14d4898b2ab..0e55e45f4fb 100644 --- a/src/core/ext/upb-generated/grpc/gcp/transport_security_common.upb.h +++ b/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h @@ -1,13 +1,13 @@ /* This file was generated by upbc (the upb compiler) from the input * file: * - * grpc/gcp/transport_security_common.proto + * src/proto/grpc/gcp/transport_security_common.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ -#ifndef GRPC_GCP_TRANSPORT_SECURITY_COMMON_PROTO_UPB_H_ -#define GRPC_GCP_TRANSPORT_SECURITY_COMMON_PROTO_UPB_H_ +#ifndef SRC_PROTO_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PROTO_UPB_H_ +#define SRC_PROTO_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PROTO_UPB_H_ #include "upb/generated_util.h" #include "upb/msg.h" @@ -106,4 +106,4 @@ UPB_INLINE void grpc_gcp_RpcProtocolVersions_Version_set_minor(grpc_gcp_RpcProto #include "upb/port_undef.inc" -#endif /* GRPC_GCP_TRANSPORT_SECURITY_COMMON_PROTO_UPB_H_ */ +#endif /* SRC_PROTO_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PROTO_UPB_H_ */ diff --git a/src/core/ext/upb-generated/grpc/health/v1/health.upb.c b/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c similarity index 89% rename from src/core/ext/upb-generated/grpc/health/v1/health.upb.c rename to src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c index e672d431005..8a3359bb769 100644 --- a/src/core/ext/upb-generated/grpc/health/v1/health.upb.c +++ b/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c @@ -1,14 +1,14 @@ /* This file was generated by upbc (the upb compiler) from the input * file: * - * grpc/health/v1/health.proto + * src/proto/grpc/health/v1/health.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ #include #include "upb/msg.h" -#include "grpc/health/v1/health.upb.h" +#include "src/proto/grpc/health/v1/health.upb.h" #include "upb/port_def.inc" diff --git a/src/core/ext/upb-generated/grpc/health/v1/health.upb.h b/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h similarity index 94% rename from src/core/ext/upb-generated/grpc/health/v1/health.upb.h rename to src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h index 536e7d8131b..103b4ddbafc 100644 --- a/src/core/ext/upb-generated/grpc/health/v1/health.upb.h +++ b/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h @@ -1,13 +1,13 @@ /* This file was generated by upbc (the upb compiler) from the input * file: * - * grpc/health/v1/health.proto + * src/proto/grpc/health/v1/health.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ -#ifndef GRPC_HEALTH_V1_HEALTH_PROTO_UPB_H_ -#define GRPC_HEALTH_V1_HEALTH_PROTO_UPB_H_ +#ifndef SRC_PROTO_GRPC_HEALTH_V1_HEALTH_PROTO_UPB_H_ +#define SRC_PROTO_GRPC_HEALTH_V1_HEALTH_PROTO_UPB_H_ #include "upb/generated_util.h" #include "upb/msg.h" @@ -81,4 +81,4 @@ UPB_INLINE void grpc_health_v1_HealthCheckResponse_set_status(grpc_health_v1_Hea #include "upb/port_undef.inc" -#endif /* GRPC_HEALTH_V1_HEALTH_PROTO_UPB_H_ */ +#endif /* SRC_PROTO_GRPC_HEALTH_V1_HEALTH_PROTO_UPB_H_ */ diff --git a/src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.c b/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c similarity index 97% rename from src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.c rename to src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c index 74a01dc8d98..75f07614920 100644 --- a/src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.c +++ b/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c @@ -1,14 +1,14 @@ /* This file was generated by upbc (the upb compiler) from the input * file: * - * grpc/lb/v1/load_balancer.proto + * src/proto/grpc/lb/v1/load_balancer.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ #include #include "upb/msg.h" -#include "grpc/lb/v1/load_balancer.upb.h" +#include "src/proto/grpc/lb/v1/load_balancer.upb.h" #include "google/protobuf/duration.upb.h" #include "google/protobuf/timestamp.upb.h" diff --git a/src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.h b/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h similarity index 99% rename from src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.h rename to src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h index 398da3b71fe..64845660d17 100644 --- a/src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.h +++ b/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h @@ -1,13 +1,13 @@ /* This file was generated by upbc (the upb compiler) from the input * file: * - * grpc/lb/v1/load_balancer.proto + * src/proto/grpc/lb/v1/load_balancer.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ -#ifndef GRPC_LB_V1_LOAD_BALANCER_PROTO_UPB_H_ -#define GRPC_LB_V1_LOAD_BALANCER_PROTO_UPB_H_ +#ifndef SRC_PROTO_GRPC_LB_V1_LOAD_BALANCER_PROTO_UPB_H_ +#define SRC_PROTO_GRPC_LB_V1_LOAD_BALANCER_PROTO_UPB_H_ #include "upb/generated_util.h" #include "upb/msg.h" @@ -356,4 +356,4 @@ UPB_INLINE void grpc_lb_v1_Server_set_drop(grpc_lb_v1_Server *msg, bool value) { #include "upb/port_undef.inc" -#endif /* GRPC_LB_V1_LOAD_BALANCER_PROTO_UPB_H_ */ +#endif /* SRC_PROTO_GRPC_LB_V1_LOAD_BALANCER_PROTO_UPB_H_ */ diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index aab3768b02e..95f1d0eea1d 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -316,7 +316,17 @@ CORE_SOURCE_FILES = [ 'third_party/nanopb/pb_common.c', 'third_party/nanopb/pb_decode.c', 'third_party/nanopb/pb_encode.c', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c', 'src/core/tsi/transport_security.cc', + 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', + 'third_party/upb/upb/decode.c', + 'third_party/upb/upb/encode.c', + 'third_party/upb/upb/msg.c', + 'third_party/upb/upb/port.c', + 'third_party/upb/upb/table.c', + 'third_party/upb/upb/upb.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/authority.cc', @@ -348,6 +358,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', 'src/core/ext/filters/client_channel/health/health.pb.c', 'src/core/tsi/fake_transport_security.cc', 'src/core/tsi/local_transport_security.cc', @@ -367,6 +378,13 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', + 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', + 'src/core/ext/upb-generated/google/protobuf/any.upb.c', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', diff --git a/src/ruby/ext/grpc/ext-export.clang b/src/ruby/ext/grpc/ext-export.clang new file mode 100644 index 00000000000..d568e8e40e0 --- /dev/null +++ b/src/ruby/ext/grpc/ext-export.clang @@ -0,0 +1 @@ +_Init_grpc_c diff --git a/src/ruby/ext/grpc/ext-export.gcc b/src/ruby/ext/grpc/ext-export.gcc new file mode 100644 index 00000000000..b9c8c560334 --- /dev/null +++ b/src/ruby/ext/grpc/ext-export.gcc @@ -0,0 +1,6 @@ +grpc_1.0 { + global: + Init_grpc_c; + local: + *; +}; \ No newline at end of file diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb index 9950976eeb1..8cdd03f297e 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -60,6 +60,11 @@ unless windows end $CFLAGS << ' -I' + File.join(grpc_root, 'include') + +ext_export_file = File.join(grpc_root, 'src', 'ruby', 'ext', 'grpc', 'ext-export') +$LDFLAGS << ' -Wl,--version-script="' + ext_export_file + '.gcc"' if RUBY_PLATFORM =~ /linux/ +$LDFLAGS << ' -Wl,-exported_symbols_list,"' + ext_export_file + '.clang"' if RUBY_PLATFORM =~ /darwin/ + $LDFLAGS << ' ' + File.join(grpc_lib_dir, 'libgrpc.a') unless windows if grpc_config == 'gcov' $CFLAGS << ' -O0 -fprofile-arcs -ftest-coverage' diff --git a/src/upb/gen_build_yaml.py b/src/upb/gen_build_yaml.py index 181d026fbd2..0eb9eb1bd47 100755 --- a/src/upb/gen_build_yaml.py +++ b/src/upb/gen_build_yaml.py @@ -21,43 +21,37 @@ import os import sys import yaml -srcs = [ - "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c", - "third_party/upb/upb/decode.c", - "third_party/upb/upb/def.c", - "third_party/upb/upb/encode.c", - "third_party/upb/upb/handlers.c", - "third_party/upb/upb/msg.c", - "third_party/upb/upb/msgfactory.c", - "third_party/upb/upb/sink.c", - "third_party/upb/upb/table.c", - "third_party/upb/upb/upb.c", -] - hdrs = [ "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.h", "third_party/upb/upb/decode.h", - "third_party/upb/upb/def.h", "third_party/upb/upb/encode.h", - "third_party/upb/upb/handlers.h", + "third_party/upb/upb/generated_util.h", "third_party/upb/upb/msg.h", - "third_party/upb/upb/msgfactory.h", - "third_party/upb/upb/sink.h", + "third_party/upb/upb/port_def.inc", + "third_party/upb/upb/port_undef.inc", + "third_party/upb/upb/table.int.h", "third_party/upb/upb/upb.h", ] -os.chdir(os.path.dirname(sys.argv[0])+'/../..') +srcs = [ + "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c", + "third_party/upb/upb/decode.c", + "third_party/upb/upb/encode.c", + "third_party/upb/upb/msg.c", + "third_party/upb/upb/port.c", + "third_party/upb/upb/table.c", + "third_party/upb/upb/upb.c", +] out = {} try: - out['libs'] = [{ + out['filegroups'] = [{ 'name': 'upb', - 'defaults': 'upb', - 'build': 'private', - 'language': 'c', - 'secure': 'no', 'src': srcs, + 'uses': [ 'nanopb_headers' ], + }, { + 'name': 'upb_headers', 'headers': hdrs, }] except: diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index 87088abfc53..8d01540453c 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -186,14 +186,15 @@ set(_gRPC_CORE_NOSTDCXX_FLAGS "") endif() - include(cmake/zlib.cmake) + include(cmake/address_sorting.cmake) + include(cmake/benchmark.cmake) include(cmake/cares.cmake) - include(cmake/protobuf.cmake) - include(cmake/ssl.cmake) include(cmake/gflags.cmake) - include(cmake/benchmark.cmake) - include(cmake/address_sorting.cmake) include(cmake/nanopb.cmake) + include(cmake/protobuf.cmake) + include(cmake/ssl.cmake) + include(cmake/upb.cmake) + include(cmake/zlib.cmake) if(NOT MSVC) set(CMAKE_C_FLAGS "<%text>${CMAKE_C_FLAGS} -std=c99") @@ -426,14 +427,17 @@ target_include_directories(${lib.name} PUBLIC <%text>$ $ PRIVATE <%text>${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE <%text>${_gRPC_SSL_INCLUDE_DIR} - PRIVATE <%text>${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE <%text>${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE <%text>${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE <%text>${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE <%text>${_gRPC_CARES_INCLUDE_DIR} PRIVATE <%text>${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE <%text>${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE <%text>${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE <%text>${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE <%text>${_gRPC_SSL_INCLUDE_DIR} + PRIVATE <%text>${_gRPC_UPB_GENERATED_DIR} + PRIVATE <%text>${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE <%text>${_gRPC_UPB_INCLUDE_DIR} + PRIVATE <%text>${_gRPC_ZLIB_INCLUDE_DIR} % if lib.build in ['test', 'private'] and lib.language == 'c++': PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest @@ -522,14 +526,17 @@ target_include_directories(${tgt.name} PRIVATE <%text>${CMAKE_CURRENT_SOURCE_DIR} PRIVATE <%text>${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE <%text>${_gRPC_SSL_INCLUDE_DIR} - PRIVATE <%text>${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE <%text>${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE <%text>${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE <%text>${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE <%text>${_gRPC_CARES_INCLUDE_DIR} PRIVATE <%text>${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE <%text>${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} PRIVATE <%text>${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE <%text>${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE <%text>${_gRPC_SSL_INCLUDE_DIR} + PRIVATE <%text>${_gRPC_UPB_GENERATED_DIR} + PRIVATE <%text>${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE <%text>${_gRPC_UPB_INCLUDE_DIR} + PRIVATE <%text>${_gRPC_ZLIB_INCLUDE_DIR} % if tgt.build in ['test', 'private'] and tgt.language == 'c++': PRIVATE third_party/googletest/googletest/include PRIVATE third_party/googletest/googletest diff --git a/templates/Makefile.template b/templates/Makefile.template index 21e1b6cd01c..c7f8a05739e 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -36,7 +36,7 @@ sources_that_don_t_need_openssl = set() # warnings we'd like, but that dont exist in all compilers - PREFERRED_WARNINGS=['shadow', 'extra-semi'] + PREFERRED_WARNINGS=['extra-semi'] CHECK_WARNINGS=PREFERRED_WARNINGS + ['no-shift-negative-value', 'no-unused-but-set-variable', 'no-maybe-uninitialized'] def warning_var(fmt, warning): @@ -216,7 +216,7 @@ HOST_LD ?= $(LD) HOST_LDXX ?= $(LDXX) - CFLAGS += -std=c99 -Wsign-conversion -Wconversion ${' '.join(warning_var('$(W_%s)', warning) for warning in PREFERRED_WARNINGS)} + CFLAGS += -std=c99 ${' '.join(warning_var('$(W_%s)', warning) for warning in PREFERRED_WARNINGS)} CXXFLAGS += -std=c++11 ifeq ($(SYSTEM),Darwin) CXXFLAGS += -stdlib=libc++ @@ -240,7 +240,7 @@ LDFLAGS += -fPIC endif - INCLUDES = . include $(GENDIR) third_party/upb third_party/upb/generated_for_cmake src/core/ext/upb-generated + INCLUDES = . include $(GENDIR) LDFLAGS += -Llibs/$(CONFIG) ifeq ($(SYSTEM),Darwin) diff --git a/templates/config.m4.template b/templates/config.m4.template index 18378cfc34d..db55a34d84c 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -8,10 +8,13 @@ dnl # --with-grpc -> add include path PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/include) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/core/ext/upb-generated) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc) - PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/address_sorting/include) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/nanopb) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/upb) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/upb/generated_for_cmake) LIBS="-lpthread $LIBS" diff --git a/templates/config.w32.template b/templates/config.w32.template index 5e37cf568c2..b9e9acd1ec1 100644 --- a/templates/config.w32.template +++ b/templates/config.w32.template @@ -26,11 +26,14 @@ "/DPB_FIELD_32BIT "+ "/I"+configure_module_dirname+" "+ "/I"+configure_module_dirname+"\\include "+ + "/I"+configure_module_dirname+"\\src\\core\\ext\\upb-generated "+ "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+ - "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ - "/I"+configure_module_dirname+"\\third_party\\zlib "+ "/I"+configure_module_dirname+"\\third_party\\address_sorting\\include "+ - "/I"+configure_module_dirname+"\\third_party\\nanopb"); + "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ + "/I"+configure_module_dirname+"\\third_party\\nanopb "+ + "/I"+configure_module_dirname+"\\third_party\\upb "+ + "/I"+configure_module_dirname+"\\third_party\\upb\\generated_for_cmake "+ + "/I"+configure_module_dirname+"\\third_party\\zlib "); <% dirs = {} for lib in libs: diff --git a/templates/gRPC-C++.podspec.template b/templates/gRPC-C++.podspec.template index 9ecdf80143e..1ec2d877542 100644 --- a/templates/gRPC-C++.podspec.template +++ b/templates/gRPC-C++.podspec.template @@ -227,5 +227,11 @@ find src/cpp/ -type f -path '*.grpc_back' -print0 | xargs -0 rm find src/core/ -type f ! -path '*.grpc_back' -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(pb(_.*)?\\.h)";#include ;g' find src/core/ -type f -path '*.grpc_back' -print0 | xargs -0 rm + find src/core/ third_party/upb/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "upb/(.*)";#if COCOAPODS==1\\\n #include "third_party/upb/upb/\\1"\\\n#else\\\n #include "upb/\\1"\\\n#endif;g' + find src/core/ third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm + find src/core/ src/cpp/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "src/core/ext/upb-generated/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g' + find src/core/ src/cpp/ -type f -name '*.grpc_back' -print0 | xargs -0 rm + find third_party/upb/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "third_party/upb/generated_for_cmake/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g' + find third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm END_OF_COMMAND end diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 0ed3b8399b5..9d4f1b4d4a0 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -214,5 +214,11 @@ s.prepare_command = <<-END_OF_COMMAND sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS==1\\\n #include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/core -type f -print | xargs grep -H -c '#include ;#if COCOAPODS==1\\\n #include \\\n#else\\\n #include \\\n#endif;g' $(find src/core -type f \\( -path '*.h' -or -path '*.cc' \\) -print | xargs grep -H -c '#include "$want_submodules" 9245d481eb3e890f708ff2d7dadf2a10c04748ba third_party/libcxxabi (heads/release_60) 09745575a923640154bcf307fba8aedff47f240a third_party/protobuf (v3.7.0-rc.2-247-g09745575) e143189bf6f37b3957fb31743df6a1bcf4a8c685 third_party/protoc-gen-validate (v0.0.10) - 423ea5ca9ce8da69611e6e95559efcb3a1ba8ad8 third_party/upb (heads/master) + b70f68269a7d51c5ce372a93742bf6960215ffef third_party/upb (heads/master) cacf7f1d4e3d44d871b605da3b647f07d718623f third_party/zlib (v1.2.11) EOF From bc83ccd08b80d8e9b2854715d2b5c97a7e50c3b7 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 6 Aug 2019 15:37:18 -0700 Subject: [PATCH 218/661] Log goaway only if it ended with an non NO_ERROR code --- src/core/ext/transport/chttp2/transport/chttp2_transport.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 633b35e7d61..791caaf4ba5 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -1155,8 +1155,10 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t, gpr_log(GPR_INFO, "transport %p got goaway with last stream id %d", t, last_stream_id)); /* We want to log this irrespective of whether http tracing is enabled */ - gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string, goaway_error, - grpc_error_string(t->goaway_error)); + if (goaway_error != GRPC_HTTP2_NO_ERROR) { + gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string, + goaway_error, grpc_error_string(t->goaway_error)); + } /* When a client receives a GOAWAY with error code ENHANCE_YOUR_CALM and debug * data equal to "too_many_pings", it should log the occurrence at a log level From 308ce6b64a4c50b9699c39a92f84f85e0fd70b49 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 6 Aug 2019 15:46:01 -0700 Subject: [PATCH 219/661] Reviewer comments --- src/core/ext/transport/chttp2/transport/chttp2_transport.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 791caaf4ba5..578300e559b 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -1154,7 +1154,8 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t, GRPC_CHTTP2_IF_TRACING( gpr_log(GPR_INFO, "transport %p got goaway with last stream id %d", t, last_stream_id)); - /* We want to log this irrespective of whether http tracing is enabled */ + /* We want to log this irrespective of whether http tracing is enabled if we + * received a GOAWAY with a non NO_ERROR code. */ if (goaway_error != GRPC_HTTP2_NO_ERROR) { gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string, goaway_error, grpc_error_string(t->goaway_error)); From 04fa4328316a70fe776930582f810c5447a95ff2 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 6 Aug 2019 16:12:51 -0700 Subject: [PATCH 220/661] Fail SEND_MESSAGE ops if stream is closed for writes --- .../chttp2/transport/chttp2_transport.cc | 16 +++++----------- src/core/lib/surface/call.cc | 6 ++++++ src/core/lib/transport/transport.h | 12 ++++++++++++ 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 633b35e7d61..1a1c03208eb 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -1532,19 +1532,13 @@ static void perform_stream_op_locked(void* stream_op, on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE; s->fetching_send_message_finished = add_closure_barrier(op->on_complete); if (s->write_closed) { - // Return an error unless the client has already received trailing - // metadata from the server, since an application using a - // streaming call might send another message before getting a - // recv_message failure, breaking out of its loop, and then - // starting recv_trailing_metadata. + op->payload->send_message.stream_write_closed = true; + // We should NOT return an error here, so as to avoid a cancel OP being + // started. The surface layer will notice that the stream has been closed + // for writes and fail the send message op. op->payload->send_message.send_message.reset(); grpc_chttp2_complete_closure_step( - t, s, &s->fetching_send_message_finished, - t->is_client && s->received_trailing_metadata - ? GRPC_ERROR_NONE - : GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( - "Attempt to send message after stream was closed", - &s->write_closed_error, 1), + t, s, &s->fetching_send_message_finished, GRPC_ERROR_NONE, "fetching_send_message_finished"); } else { GPR_ASSERT(s->fetching_send_message == nullptr); diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 13b1d126393..378d148c674 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -1175,6 +1175,12 @@ static void post_batch_completion(batch_control* bctl) { &call->metadata_batch[0 /* is_receiving */][0 /* is_trailing */]); } if (bctl->op.send_message) { + if (bctl->op.payload->send_message.stream_write_closed && + error == GRPC_ERROR_NONE) { + error = grpc_error_add_child( + error, GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "Attempt to send message after stream was closed.")); + } call->sending_message = false; } if (bctl->op.send_trailing_metadata) { diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index 17608f4bc60..c40b290d535 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -245,6 +245,18 @@ struct grpc_transport_stream_op_batch_payload { // The batch's on_complete will not be called until after the byte // stream is orphaned. grpc_core::OrphanablePtr send_message; + // Set by the transport if the stream has been closed for writes. If this + // is set and send message op is present, we set the operation to be a + // failure without sending a cancel OP down the stack. This is so that the + // status of the call does not get overwritten by the Cancel OP, which would + // be especially problematic if we had received a valid status from the + // server. + // For send_initial_metadata, it is fine for the status to be overwritten + // because at that point, the client will not have received a status. + // For send_trailing_metadata, we might overwrite the status if we have + // non-zero metadata to send. This is fine because the API does not allow + // the client to send trailing metadata. + bool stream_write_closed = false; } send_message; struct { From fc76cc0d1e9972893816c59671e867c4483f0025 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 6 Aug 2019 16:28:58 -0700 Subject: [PATCH 221/661] Remove received_trailing_metadata since it's no longer used --- src/core/ext/transport/chttp2/transport/internal.h | 2 -- src/core/ext/transport/chttp2/transport/parsing.cc | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 643cd25b8bd..2204691726a 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -564,8 +564,6 @@ struct grpc_chttp2_stream { /** Are we buffering writes on this stream? If yes, we won't become writable until there's enough queued up in the flow_controlled_buffer */ bool write_buffering = false; - /** Has trailing metadata been received. */ - bool received_trailing_metadata = false; /* have we sent or received the EOS bit? */ bool eos_received = false; diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc index 796f63573c0..c1b226c5fb3 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.cc +++ b/src/core/ext/transport/chttp2/transport/parsing.cc @@ -648,7 +648,6 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t, *s->trailing_metadata_available = true; } t->hpack_parser.on_header = on_trailing_header; - s->received_trailing_metadata = true; } else { GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "parsing initial_metadata")); t->hpack_parser.on_header = on_initial_header; @@ -657,7 +656,6 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t, case 1: GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "parsing trailing_metadata")); t->hpack_parser.on_header = on_trailing_header; - s->received_trailing_metadata = true; break; case 2: gpr_log(GPR_ERROR, "too many header frames received"); From 8dfa3c2255bdbf9075e20c0850754bde57a1c15f Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 6 Aug 2019 17:40:02 -0700 Subject: [PATCH 222/661] Remove upb targets from BUILD --- BUILD | 3 - BUILD.gn | 31 ------- CMakeLists.txt | 83 +++--------------- Makefile | 86 +++---------------- build.yaml | 7 -- config.m4 | 15 ---- config.w32 | 22 ----- gRPC-C++.podspec | 12 --- gRPC-Core.podspec | 33 ------- grpc.gemspec | 22 ----- grpc.gyp | 65 ++------------ package.xml | 22 ----- src/python/grpcio/grpc_core_dependencies.py | 11 --- tools/doxygen/Doxyfile.c++.internal | 11 +-- tools/doxygen/Doxyfile.core.internal | 22 ----- .../generated/sources_and_headers.json | 7 -- 16 files changed, 36 insertions(+), 416 deletions(-) diff --git a/BUILD b/BUILD index 5da2eda36a3..d42572b6559 100644 --- a/BUILD +++ b/BUILD @@ -1064,7 +1064,6 @@ grpc_cc_library( "grpc_base", "grpc_client_authority_filter", "grpc_deadline_filter", - "grpc_health_upb", "health_proto", "inlined_vector", "orphanable", @@ -2002,7 +2001,6 @@ grpc_cc_library( deps = [ "grpc", "grpc++_codegen_base", - "grpc_health_upb", "health_proto", ], ) @@ -2015,7 +2013,6 @@ grpc_cc_library( public_hdrs = GRPCXX_PUBLIC_HDRS, deps = [ "grpc++_codegen_base", - "grpc_health_upb", "grpc_unsecure", "health_proto", ], diff --git a/BUILD.gn b/BUILD.gn index 5e76bc64065..1ee7929c0cb 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -429,28 +429,6 @@ config("grpc_config") { "src/core/ext/transport/inproc/inproc_plugin.cc", "src/core/ext/transport/inproc/inproc_transport.cc", "src/core/ext/transport/inproc/inproc_transport.h", - "src/core/ext/upb-generated/google/protobuf/any.upb.c", - "src/core/ext/upb-generated/google/protobuf/any.upb.h", - "src/core/ext/upb-generated/google/protobuf/duration.upb.c", - "src/core/ext/upb-generated/google/protobuf/duration.upb.h", - "src/core/ext/upb-generated/google/protobuf/empty.upb.c", - "src/core/ext/upb-generated/google/protobuf/empty.upb.h", - "src/core/ext/upb-generated/google/protobuf/struct.upb.c", - "src/core/ext/upb-generated/google/protobuf/struct.upb.h", - "src/core/ext/upb-generated/google/protobuf/timestamp.upb.c", - "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", - "src/core/ext/upb-generated/google/protobuf/wrappers.upb.c", - "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h", - "src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c", - "src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h", - "src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c", - "src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h", - "src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c", - "src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h", - "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c", - "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h", - "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c", - "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h", "src/core/lib/avl/avl.cc", "src/core/lib/avl/avl.h", "src/core/lib/backoff/backoff.cc", @@ -1191,8 +1169,6 @@ config("grpc_config") { "include/grpcpp/support/time.h", "include/grpcpp/support/validate_service_config.h", "src/core/ext/transport/inproc/inproc_transport.h", - "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c", - "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h", "src/core/lib/avl/avl.h", "src/core/lib/backoff/backoff.h", "src/core/lib/channel/channel_args.h", @@ -1422,13 +1398,6 @@ config("grpc_config") { "src/cpp/util/status.cc", "src/cpp/util/string_ref.cc", "src/cpp/util/time_cc.cc", - "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c", - "third_party/upb/upb/decode.c", - "third_party/upb/upb/encode.c", - "third_party/upb/upb/msg.c", - "third_party/upb/upb/port.c", - "third_party/upb/upb/table.c", - "third_party/upb/upb/upb.c", ] deps = [ "//third_party/boringssl", diff --git a/CMakeLists.txt b/CMakeLists.txt index cf31e17beb1..68d3ade6519 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1265,9 +1265,6 @@ add_library(grpc third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c third_party/nanopb/pb_encode.c - src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c - src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c - src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c src/core/tsi/transport_security.cc third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c third_party/upb/upb/decode.c @@ -1307,7 +1304,6 @@ add_library(grpc src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c src/core/ext/filters/client_channel/health/health.pb.c src/core/tsi/fake_transport_security.cc src/core/tsi/local_transport_security.cc @@ -1327,13 +1323,6 @@ add_library(grpc src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc - src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c - src/core/ext/upb-generated/google/protobuf/any.upb.c - src/core/ext/upb-generated/google/protobuf/duration.upb.c - src/core/ext/upb-generated/google/protobuf/empty.upb.c - src/core/ext/upb-generated/google/protobuf/struct.upb.c - src/core/ext/upb-generated/google/protobuf/timestamp.upb.c - src/core/ext/upb-generated/google/protobuf/wrappers.upb.c src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c @@ -1688,14 +1677,6 @@ add_library(grpc_cronet src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c - third_party/upb/upb/decode.c - third_party/upb/upb/encode.c - third_party/upb/upb/msg.c - third_party/upb/upb/port.c - third_party/upb/upb/table.c - third_party/upb/upb/upb.c src/core/ext/filters/client_channel/health/health.pb.c third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c @@ -1767,10 +1748,14 @@ add_library(grpc_cronet src/core/tsi/alts/handshaker/altscontext.pb.c src/core/tsi/alts/handshaker/handshaker.pb.c src/core/tsi/alts/handshaker/transport_security_common.pb.c - src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c - src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c - src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c src/core/tsi/transport_security.cc + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc src/core/ext/transport/chttp2/client/authority.cc @@ -2091,14 +2076,6 @@ add_library(grpc_test_util src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c - third_party/upb/upb/decode.c - third_party/upb/upb/encode.c - third_party/upb/upb/msg.c - third_party/upb/upb/port.c - third_party/upb/upb/table.c - third_party/upb/upb/upb.c src/core/ext/filters/client_channel/health/health.pb.c third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c @@ -2437,14 +2414,6 @@ add_library(grpc_test_util_unsecure src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c - third_party/upb/upb/decode.c - third_party/upb/upb/encode.c - third_party/upb/upb/msg.c - third_party/upb/upb/port.c - third_party/upb/upb/table.c - third_party/upb/upb/upb.c src/core/ext/filters/client_channel/health/health.pb.c third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c @@ -2794,14 +2763,6 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c - third_party/upb/upb/decode.c - third_party/upb/upb/encode.c - third_party/upb/upb/msg.c - third_party/upb/upb/port.c - third_party/upb/upb/table.c - third_party/upb/upb/upb.c src/core/ext/filters/client_channel/health/health.pb.c third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c @@ -2827,16 +2788,16 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc - src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c - src/core/ext/upb-generated/google/protobuf/any.upb.c - src/core/ext/upb-generated/google/protobuf/duration.upb.c - src/core/ext/upb-generated/google/protobuf/empty.upb.c - src/core/ext/upb-generated/google/protobuf/struct.upb.c - src/core/ext/upb-generated/google/protobuf/timestamp.upb.c - src/core/ext/upb-generated/google/protobuf/wrappers.upb.c src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/core/ext/filters/client_channel/lb_policy/xds/xds.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc @@ -3203,14 +3164,6 @@ add_library(grpc++ src/cpp/util/status.cc src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c - third_party/upb/upb/decode.c - third_party/upb/upb/encode.c - third_party/upb/upb/msg.c - third_party/upb/upb/port.c - third_party/upb/upb/table.c - third_party/upb/upb/upb.c src/core/ext/filters/client_channel/health/health.pb.c third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c @@ -4317,14 +4270,6 @@ add_library(grpc++_unsecure src/cpp/util/status.cc src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c - third_party/upb/upb/decode.c - third_party/upb/upb/encode.c - third_party/upb/upb/msg.c - third_party/upb/upb/port.c - third_party/upb/upb/table.c - third_party/upb/upb/upb.c src/core/ext/filters/client_channel/health/health.pb.c third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c diff --git a/Makefile b/Makefile index e77c5d71089..87a43958abc 100644 --- a/Makefile +++ b/Makefile @@ -3756,9 +3756,6 @@ LIBGRPC_SRC = \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_encode.c \ - src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c \ - src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c \ - src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \ src/core/tsi/transport_security.cc \ third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ third_party/upb/upb/decode.c \ @@ -3798,7 +3795,6 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ src/core/tsi/fake_transport_security.cc \ src/core/tsi/local_transport_security.cc \ @@ -3818,13 +3814,6 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ - src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ - src/core/ext/upb-generated/google/protobuf/any.upb.c \ - src/core/ext/upb-generated/google/protobuf/duration.upb.c \ - src/core/ext/upb-generated/google/protobuf/empty.upb.c \ - src/core/ext/upb-generated/google/protobuf/struct.upb.c \ - src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ - src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ @@ -4167,14 +4156,6 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ - third_party/upb/upb/decode.c \ - third_party/upb/upb/encode.c \ - third_party/upb/upb/msg.c \ - third_party/upb/upb/port.c \ - third_party/upb/upb/table.c \ - third_party/upb/upb/upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ @@ -4246,10 +4227,14 @@ LIBGRPC_CRONET_SRC = \ src/core/tsi/alts/handshaker/altscontext.pb.c \ src/core/tsi/alts/handshaker/handshaker.pb.c \ src/core/tsi/alts/handshaker/transport_security_common.pb.c \ - src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c \ - src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c \ - src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \ src/core/tsi/transport_security.cc \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/authority.cc \ @@ -4557,14 +4542,6 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ - third_party/upb/upb/decode.c \ - third_party/upb/upb/encode.c \ - third_party/upb/upb/msg.c \ - third_party/upb/upb/port.c \ - third_party/upb/upb/table.c \ - third_party/upb/upb/upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ @@ -4884,14 +4861,6 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ - third_party/upb/upb/decode.c \ - third_party/upb/upb/encode.c \ - third_party/upb/upb/msg.c \ - third_party/upb/upb/port.c \ - third_party/upb/upb/table.c \ - third_party/upb/upb/upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ @@ -5209,14 +5178,6 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ - third_party/upb/upb/decode.c \ - third_party/upb/upb/encode.c \ - third_party/upb/upb/msg.c \ - third_party/upb/upb/port.c \ - third_party/upb/upb/table.c \ - third_party/upb/upb/upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ @@ -5242,16 +5203,16 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ - src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ - src/core/ext/upb-generated/google/protobuf/any.upb.c \ - src/core/ext/upb-generated/google/protobuf/duration.upb.c \ - src/core/ext/upb-generated/google/protobuf/empty.upb.c \ - src/core/ext/upb-generated/google/protobuf/struct.upb.c \ - src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ - src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/ext/filters/client_channel/lb_policy/xds/xds.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc \ @@ -5564,14 +5525,6 @@ LIBGRPC++_SRC = \ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ - third_party/upb/upb/decode.c \ - third_party/upb/upb/encode.c \ - third_party/upb/upb/msg.c \ - third_party/upb/upb/port.c \ - third_party/upb/upb/table.c \ - third_party/upb/upb/upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ @@ -6600,14 +6553,6 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ - third_party/upb/upb/decode.c \ - third_party/upb/upb/encode.c \ - third_party/upb/upb/msg.c \ - third_party/upb/upb/port.c \ - third_party/upb/upb/table.c \ - third_party/upb/upb/upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ @@ -22457,9 +22402,6 @@ src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc: $(OPENSSL_ src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc: $(OPENSSL_DEP) src/core/ext/transport/cronet/transport/cronet_api_dummy.cc: $(OPENSSL_DEP) src/core/ext/transport/cronet/transport/cronet_transport.cc: $(OPENSSL_DEP) -src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c: $(OPENSSL_DEP) -src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c: $(OPENSSL_DEP) -src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c: $(OPENSSL_DEP) src/core/lib/http/httpcli_security_connector.cc: $(OPENSSL_DEP) src/core/lib/security/context/security_context.cc: $(OPENSSL_DEP) src/core/lib/security/credentials/alts/alts_credentials.cc: $(OPENSSL_DEP) diff --git a/build.yaml b/build.yaml index 2e81fae5687..87a2f09cb8e 100644 --- a/build.yaml +++ b/build.yaml @@ -104,7 +104,6 @@ filegroups: - src/core/tsi/alts/handshaker/transport_security_common_api.cc uses: - alts_proto - - alts_upb - grpc_base - nanopb - tsi_interface @@ -660,7 +659,6 @@ filegroups: uses: - grpc_base - grpc_deadline_filter - - grpc_health_upb - health_proto - name: grpc_client_idle_filter src: @@ -725,7 +723,6 @@ filegroups: uses: - grpc_base - grpc_client_channel - - grpc_lb_upb - grpc_resolver_fake - grpclb_proto - nanopb @@ -747,7 +744,6 @@ filegroups: uses: - grpc_base - grpc_client_channel - - grpc_lb_upb - grpc_resolver_fake - grpc_secure - grpclb_proto @@ -784,7 +780,6 @@ filegroups: uses: - grpc_base - grpc_client_channel - - grpc_lb_upb - grpc_resolver_fake - grpclb_proto - nanopb @@ -804,7 +799,6 @@ filegroups: uses: - grpc_base - grpc_client_channel - - grpc_lb_upb - grpc_resolver_fake - grpc_secure - grpclb_proto @@ -1554,7 +1548,6 @@ filegroups: - grpc_transport_inproc_headers - grpc++_codegen_base - grpc++_internal_hdrs_only - - grpc_health_upb - nanopb_headers - health_proto - name: grpc++_config_proto diff --git a/config.m4 b/config.m4 index 07925b2d0ac..0b7e67ed5ca 100644 --- a/config.m4 +++ b/config.m4 @@ -345,9 +345,6 @@ if test "$PHP_GRPC" != "no"; then third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_encode.c \ - src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c \ - src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c \ - src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \ src/core/tsi/transport_security.cc \ third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ third_party/upb/upb/decode.c \ @@ -387,7 +384,6 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ src/core/ext/filters/client_channel/health/health.pb.c \ src/core/tsi/fake_transport_security.cc \ src/core/tsi/local_transport_security.cc \ @@ -407,13 +403,6 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ - src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ - src/core/ext/upb-generated/google/protobuf/any.upb.c \ - src/core/ext/upb-generated/google/protobuf/duration.upb.c \ - src/core/ext/upb-generated/google/protobuf/empty.upb.c \ - src/core/ext/upb-generated/google/protobuf/struct.upb.c \ - src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ - src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ @@ -742,10 +731,6 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/server/secure) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/transport) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/inproc) - PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/google/protobuf) - PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/gcp) - PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/health/v1) - PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/lb/v1) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/avl) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/backoff) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/channel) diff --git a/config.w32 b/config.w32 index 8963d80a76d..fc2eec7fcc7 100644 --- a/config.w32 +++ b/config.w32 @@ -317,9 +317,6 @@ if (PHP_GRPC != "no") { "third_party\\nanopb\\pb_common.c " + "third_party\\nanopb\\pb_decode.c " + "third_party\\nanopb\\pb_encode.c " + - "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp\\altscontext.upb.c " + - "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp\\handshaker.upb.c " + - "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp\\transport_security_common.upb.c " + "src\\core\\tsi\\transport_security.cc " + "third_party\\upb\\generated_for_cmake\\google\\protobuf\\descriptor.upb.c " + "third_party\\upb\\upb\\decode.c " + @@ -359,7 +356,6 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\subchannel.cc " + "src\\core\\ext\\filters\\client_channel\\subchannel_pool_interface.cc " + "src\\core\\ext\\filters\\deadline\\deadline_filter.cc " + - "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health\\v1\\health.upb.c " + "src\\core\\ext\\filters\\client_channel\\health\\health.pb.c " + "src\\core\\tsi\\fake_transport_security.cc " + "src\\core\\tsi\\local_transport_security.cc " + @@ -379,13 +375,6 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\grpclb_channel_secure.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\grpclb_client_stats.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\load_balancer_api.cc " + - "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb\\v1\\load_balancer.upb.c " + - "src\\core\\ext\\upb-generated\\google\\protobuf\\any.upb.c " + - "src\\core\\ext\\upb-generated\\google\\protobuf\\duration.upb.c " + - "src\\core\\ext\\upb-generated\\google\\protobuf\\empty.upb.c " + - "src\\core\\ext\\upb-generated\\google\\protobuf\\struct.upb.c " + - "src\\core\\ext\\upb-generated\\google\\protobuf\\timestamp.upb.c " + - "src\\core\\ext\\upb-generated\\google\\protobuf\\wrappers.upb.c " + "src\\core\\ext\\filters\\client_channel\\resolver\\fake\\fake_resolver.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\google\\protobuf\\duration.pb.c " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\google\\protobuf\\timestamp.pb.c " + @@ -754,17 +743,6 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\server\\secure"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\transport"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\inproc"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\google"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\google\\protobuf"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health\\v1"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb\\v1"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\avl"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\backoff"); diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 1fb00deb22e..08f2395769a 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -387,9 +387,6 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/handshaker/altscontext.pb.h', 'src/core/tsi/alts/handshaker/handshaker.pb.h', 'src/core/tsi/alts/handshaker/transport_security_common.pb.h', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h', 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/authority.h', @@ -422,7 +419,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel_interface.h', 'src/core/ext/filters/client_channel/subchannel_pool_interface.h', 'src/core/ext/filters/deadline/deadline_filter.h', - 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', 'src/core/ext/filters/client_channel/health/health.pb.h', 'src/core/tsi/fake_transport_security.h', 'src/core/tsi/local_transport_security.h', @@ -582,13 +578,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', - 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', - 'src/core/ext/upb-generated/google/protobuf/any.upb.h', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', @@ -793,7 +782,6 @@ Pod::Spec.new do |s| 'src/core/lib/uri/uri_parser.h', 'src/core/lib/debug/trace.h', 'src/core/ext/transport/inproc/inproc_transport.h', - 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', 'src/core/ext/filters/client_channel/health/health.pb.h' end diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index b00fe01fdd9..206be3da588 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -342,9 +342,6 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/handshaker/altscontext.pb.h', 'src/core/tsi/alts/handshaker/handshaker.pb.h', 'src/core/tsi/alts/handshaker/transport_security_common.pb.h', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h', 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/authority.h', @@ -377,7 +374,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel_interface.h', 'src/core/ext/filters/client_channel/subchannel_pool_interface.h', 'src/core/ext/filters/deadline/deadline_filter.h', - 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', 'src/core/ext/filters/client_channel/health/health.pb.h', 'src/core/tsi/fake_transport_security.h', 'src/core/tsi/local_transport_security.h', @@ -537,13 +533,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', - 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', - 'src/core/ext/upb-generated/google/protobuf/any.upb.h', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', @@ -815,9 +804,6 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/handshaker/altscontext.pb.c', 'src/core/tsi/alts/handshaker/handshaker.pb.c', 'src/core/tsi/alts/handshaker/transport_security_common.pb.c', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c', 'src/core/tsi/transport_security.cc', 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', 'third_party/upb/upb/decode.c', @@ -857,7 +843,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', - 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', 'src/core/ext/filters/client_channel/health/health.pb.c', 'src/core/tsi/fake_transport_security.cc', 'src/core/tsi/local_transport_security.cc', @@ -877,13 +862,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', - 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', - 'src/core/ext/upb-generated/google/protobuf/any.upb.c', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', @@ -1030,9 +1008,6 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/handshaker/altscontext.pb.h', 'src/core/tsi/alts/handshaker/handshaker.pb.h', 'src/core/tsi/alts/handshaker/transport_security_common.pb.h', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h', 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/authority.h', @@ -1065,7 +1040,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel_interface.h', 'src/core/ext/filters/client_channel/subchannel_pool_interface.h', 'src/core/ext/filters/deadline/deadline_filter.h', - 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', 'src/core/ext/filters/client_channel/health/health.pb.h', 'src/core/tsi/fake_transport_security.h', 'src/core/tsi/local_transport_security.h', @@ -1225,13 +1199,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', - 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', - 'src/core/ext/upb-generated/google/protobuf/any.upb.h', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', diff --git a/grpc.gemspec b/grpc.gemspec index 757228dd232..ff7b0663ca2 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -276,9 +276,6 @@ Gem::Specification.new do |s| s.files += %w( third_party/nanopb/pb_common.h ) s.files += %w( third_party/nanopb/pb_decode.h ) s.files += %w( third_party/nanopb/pb_encode.h ) - s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h ) - s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h ) - s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h ) s.files += %w( src/core/tsi/transport_security.h ) s.files += %w( src/core/tsi/transport_security_interface.h ) s.files += %w( src/core/ext/transport/chttp2/client/authority.h ) @@ -311,7 +308,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/subchannel_interface.h ) s.files += %w( src/core/ext/filters/client_channel/subchannel_pool_interface.h ) s.files += %w( src/core/ext/filters/deadline/deadline_filter.h ) - s.files += %w( src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h ) s.files += %w( src/core/ext/filters/client_channel/health/health.pb.h ) s.files += %w( src/core/tsi/fake_transport_security.h ) s.files += %w( src/core/tsi/local_transport_security.h ) @@ -471,13 +467,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h ) - s.files += %w( src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/any.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/duration.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/empty.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/struct.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/timestamp.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/wrappers.upb.h ) s.files += %w( src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h ) @@ -752,9 +741,6 @@ Gem::Specification.new do |s| s.files += %w( third_party/nanopb/pb_common.c ) s.files += %w( third_party/nanopb/pb_decode.c ) s.files += %w( third_party/nanopb/pb_encode.c ) - s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c ) - s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c ) - s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c ) s.files += %w( src/core/tsi/transport_security.cc ) s.files += %w( third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c ) s.files += %w( third_party/upb/upb/decode.c ) @@ -794,7 +780,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/subchannel.cc ) s.files += %w( src/core/ext/filters/client_channel/subchannel_pool_interface.cc ) s.files += %w( src/core/ext/filters/deadline/deadline_filter.cc ) - s.files += %w( src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c ) s.files += %w( src/core/ext/filters/client_channel/health/health.pb.c ) s.files += %w( src/core/tsi/fake_transport_security.cc ) s.files += %w( src/core/tsi/local_transport_security.cc ) @@ -814,13 +799,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc ) - s.files += %w( src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/any.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/duration.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/empty.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/struct.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/timestamp.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/wrappers.upb.c ) s.files += %w( src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c ) diff --git a/grpc.gyp b/grpc.gyp index a6e39f8bacc..5f9f900c2cd 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -557,9 +557,6 @@ 'third_party/nanopb/pb_common.c', 'third_party/nanopb/pb_decode.c', 'third_party/nanopb/pb_encode.c', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c', 'src/core/tsi/transport_security.cc', 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', 'third_party/upb/upb/decode.c', @@ -599,7 +596,6 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', - 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', 'src/core/ext/filters/client_channel/health/health.pb.c', 'src/core/tsi/fake_transport_security.cc', 'src/core/tsi/local_transport_security.cc', @@ -619,13 +615,6 @@ 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', - 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', - 'src/core/ext/upb-generated/google/protobuf/any.upb.c', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', @@ -882,14 +871,6 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', - 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', - 'third_party/upb/upb/decode.c', - 'third_party/upb/upb/encode.c', - 'third_party/upb/upb/msg.c', - 'third_party/upb/upb/port.c', - 'third_party/upb/upb/table.c', - 'third_party/upb/upb/upb.c', 'src/core/ext/filters/client_channel/health/health.pb.c', 'third_party/nanopb/pb_common.c', 'third_party/nanopb/pb_decode.c', @@ -1142,14 +1123,6 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', - 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', - 'third_party/upb/upb/decode.c', - 'third_party/upb/upb/encode.c', - 'third_party/upb/upb/msg.c', - 'third_party/upb/upb/port.c', - 'third_party/upb/upb/table.c', - 'third_party/upb/upb/upb.c', 'src/core/ext/filters/client_channel/health/health.pb.c', 'third_party/nanopb/pb_common.c', 'third_party/nanopb/pb_decode.c', @@ -1413,14 +1386,6 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', - 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', - 'third_party/upb/upb/decode.c', - 'third_party/upb/upb/encode.c', - 'third_party/upb/upb/msg.c', - 'third_party/upb/upb/port.c', - 'third_party/upb/upb/table.c', - 'third_party/upb/upb/upb.c', 'src/core/ext/filters/client_channel/health/health.pb.c', 'third_party/nanopb/pb_common.c', 'third_party/nanopb/pb_decode.c', @@ -1446,16 +1411,16 @@ 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', - 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', - 'src/core/ext/upb-generated/google/protobuf/any.upb.c', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', + 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', + 'third_party/upb/upb/decode.c', + 'third_party/upb/upb/encode.c', + 'third_party/upb/upb/msg.c', + 'third_party/upb/upb/port.c', + 'third_party/upb/upb/table.c', + 'third_party/upb/upb/upb.c', 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc', @@ -1575,14 +1540,6 @@ 'src/cpp/util/status.cc', 'src/cpp/util/string_ref.cc', 'src/cpp/util/time_cc.cc', - 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', - 'third_party/upb/upb/decode.c', - 'third_party/upb/upb/encode.c', - 'third_party/upb/upb/msg.c', - 'third_party/upb/upb/port.c', - 'third_party/upb/upb/table.c', - 'third_party/upb/upb/upb.c', 'src/core/ext/filters/client_channel/health/health.pb.c', 'third_party/nanopb/pb_common.c', 'third_party/nanopb/pb_decode.c', @@ -1740,14 +1697,6 @@ 'src/cpp/util/status.cc', 'src/cpp/util/string_ref.cc', 'src/cpp/util/time_cc.cc', - 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', - 'third_party/upb/upb/decode.c', - 'third_party/upb/upb/encode.c', - 'third_party/upb/upb/msg.c', - 'third_party/upb/upb/port.c', - 'third_party/upb/upb/table.c', - 'third_party/upb/upb/upb.c', 'src/core/ext/filters/client_channel/health/health.pb.c', 'third_party/nanopb/pb_common.c', 'third_party/nanopb/pb_decode.c', diff --git a/package.xml b/package.xml index 89a199f0198..adf09c06361 100644 --- a/package.xml +++ b/package.xml @@ -281,9 +281,6 @@ - - - @@ -316,7 +313,6 @@ - @@ -476,13 +472,6 @@ - - - - - - - @@ -757,9 +746,6 @@ - - - @@ -799,7 +785,6 @@ - @@ -819,13 +804,6 @@ - - - - - - - diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 95f1d0eea1d..49a591c5f23 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -316,9 +316,6 @@ CORE_SOURCE_FILES = [ 'third_party/nanopb/pb_common.c', 'third_party/nanopb/pb_decode.c', 'third_party/nanopb/pb_encode.c', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c', 'src/core/tsi/transport_security.cc', 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', 'third_party/upb/upb/decode.c', @@ -358,7 +355,6 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', - 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', 'src/core/ext/filters/client_channel/health/health.pb.c', 'src/core/tsi/fake_transport_security.cc', 'src/core/tsi/local_transport_security.cc', @@ -378,13 +374,6 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', - 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', - 'src/core/ext/upb-generated/google/protobuf/any.upb.c', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 0ef86c9065e..b43ae2f4254 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1062,8 +1062,6 @@ include/grpcpp/support/validate_service_config.h \ src/core/ext/filters/client_channel/health/health.pb.c \ src/core/ext/filters/client_channel/health/health.pb.h \ src/core/ext/transport/inproc/inproc_transport.h \ -src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ -src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h \ src/core/lib/avl/avl.h \ src/core/lib/backoff/backoff.h \ src/core/lib/channel/channel_args.h \ @@ -1300,14 +1298,7 @@ third_party/nanopb/pb_common.h \ third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_decode.h \ third_party/nanopb/pb_encode.c \ -third_party/nanopb/pb_encode.h \ -third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ -third_party/upb/upb/decode.c \ -third_party/upb/upb/encode.c \ -third_party/upb/upb/msg.c \ -third_party/upb/upb/port.c \ -third_party/upb/upb/table.c \ -third_party/upb/upb/upb.c +third_party/nanopb/pb_encode.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index c1a5102709c..d11ea7f7daa 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1066,28 +1066,6 @@ src/core/ext/transport/chttp2/transport/writing.cc \ src/core/ext/transport/inproc/inproc_plugin.cc \ src/core/ext/transport/inproc/inproc_transport.cc \ src/core/ext/transport/inproc/inproc_transport.h \ -src/core/ext/upb-generated/google/protobuf/any.upb.c \ -src/core/ext/upb-generated/google/protobuf/any.upb.h \ -src/core/ext/upb-generated/google/protobuf/duration.upb.c \ -src/core/ext/upb-generated/google/protobuf/duration.upb.h \ -src/core/ext/upb-generated/google/protobuf/empty.upb.c \ -src/core/ext/upb-generated/google/protobuf/empty.upb.h \ -src/core/ext/upb-generated/google/protobuf/struct.upb.c \ -src/core/ext/upb-generated/google/protobuf/struct.upb.h \ -src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ -src/core/ext/upb-generated/google/protobuf/timestamp.upb.h \ -src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ -src/core/ext/upb-generated/google/protobuf/wrappers.upb.h \ -src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c \ -src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h \ -src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c \ -src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h \ -src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \ -src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h \ -src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ -src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h \ -src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ -src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h \ src/core/lib/README.md \ src/core/lib/avl/avl.cc \ src/core/lib/avl/avl.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index f06e6522c99..0dcecd83a6b 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -8228,7 +8228,6 @@ { "deps": [ "alts_proto", - "alts_upb", "gpr", "grpc_base", "nanopb", @@ -9090,7 +9089,6 @@ "gpr", "grpc_base", "grpc_deadline_filter", - "grpc_health_upb", "health_proto" ], "headers": [ @@ -9293,7 +9291,6 @@ "gpr", "grpc_base", "grpc_client_channel", - "grpc_lb_upb", "grpc_resolver_fake", "grpclb_proto", "nanopb", @@ -9329,7 +9326,6 @@ "gpr", "grpc_base", "grpc_client_channel", - "grpc_lb_upb", "grpc_resolver_fake", "grpc_secure", "grpclb_proto", @@ -9400,7 +9396,6 @@ "gpr", "grpc_base", "grpc_client_channel", - "grpc_lb_upb", "grpc_resolver_fake", "grpclb_proto", "nanopb", @@ -9433,7 +9428,6 @@ "gpr", "grpc_base", "grpc_client_channel", - "grpc_lb_upb", "grpc_resolver_fake", "grpc_secure", "grpclb_proto", @@ -10569,7 +10563,6 @@ "grpc++_codegen_base", "grpc++_internal_hdrs_only", "grpc_base_headers", - "grpc_health_upb", "grpc_transport_inproc_headers", "health_proto", "nanopb_headers" From d12f310b0d6c26f09eee4c3909eca9788d373e23 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 6 Aug 2019 17:48:53 -0700 Subject: [PATCH 223/661] Added targets for examples --- src/objective-c/BUILD | 1 - src/objective-c/examples/BUILD | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index c3629d0ada4..3a71086f0f6 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -130,5 +130,4 @@ grpc_objc_library( "//:grpc_objc", "@com_google_protobuf//:protobuf_objc", ], - visibility = ["//visibility:public"], ) diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index d3a5a76b89a..d6e1140d8f5 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -52,8 +52,8 @@ local_objc_grpc_library( objc_library( name = "Sample-lib", - srcs = glob(["Sample/**/*.m"]), - hdrs = glob(["Sample/**/*.h"]), + srcs = glob(["Sample/Sample/**/*.m"]), + hdrs = glob(["Sample/Sample/**/*.h"]), data = glob([ "Sample/Sample/Base.lproj/**", "Sample/Sample/Images.xcassets/**", @@ -71,12 +71,13 @@ ios_application( "ipad", ], deps = ["Sample-lib"], + visibility = ["//visibility:public"], ) objc_library( name = "InterceptorSample-lib", - srcs = glob(["InterceptorSample/**/*.m"]), - hdrs = glob(["InterceptorSample/**/*.h"]), + srcs = glob(["InterceptorSample/InterceptorSample/**/*.m"]), + hdrs = glob(["InterceptorSample/InterceptorSample/**/*.h"]), data = glob([ "InterceptorSample/InterceptorSample/Base.lproj/**", "InterceptorSample/InterceptorSample/Images.xcassets/**", From f7454a9876c136502e1679312ef1d3a9ae87baf3 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 31 Jul 2019 09:42:16 -0700 Subject: [PATCH 224/661] Modified health_check to use upb proto instead of nanopb --- BUILD | 22 +---- BUILD.gn | 33 +++---- CMakeLists.txt | 94 +++++++++++-------- Makefile | 94 +++++++++++-------- build.yaml | 11 +-- config.m4 | 3 +- config.w32 | 8 +- gRPC-C++.podspec | 6 +- gRPC-Core.podspec | 9 +- grpc.gemspec | 4 +- grpc.gyp | 72 ++++++++------ package.xml | 4 +- .../health/health_check_client.cc | 48 ++++------ .../health/default_health_check_service.cc | 58 ++++++------ src/python/grpcio/grpc_core_dependencies.py | 2 +- tools/doxygen/Doxyfile.c++.internal | 16 ++-- tools/doxygen/Doxyfile.core.internal | 4 +- .../generated/sources_and_headers.json | 21 +---- 18 files changed, 255 insertions(+), 254 deletions(-) diff --git a/BUILD b/BUILD index d42572b6559..ac23308620d 100644 --- a/BUILD +++ b/BUILD @@ -1064,7 +1064,7 @@ grpc_cc_library( "grpc_base", "grpc_client_authority_filter", "grpc_deadline_filter", - "health_proto", + "grpc_health_upb", "inlined_vector", "orphanable", "ref_counted", @@ -1192,20 +1192,6 @@ grpc_cc_library( ], ) -grpc_cc_library( - name = "health_proto", - srcs = [ - "src/core/ext/filters/client_channel/health/health.pb.c", - ], - hdrs = [ - "src/core/ext/filters/client_channel/health/health.pb.h", - ], - external_deps = [ - "nanopb", - ], - language = "c++", -) - grpc_cc_library( name = "grpclb_proto", srcs = [ @@ -1999,9 +1985,9 @@ grpc_cc_library( language = "c++", public_hdrs = GRPCXX_PUBLIC_HDRS, deps = [ - "grpc", "grpc++_codegen_base", - "health_proto", + "grpc", + "grpc_health_upb", ], ) @@ -2014,7 +2000,7 @@ grpc_cc_library( deps = [ "grpc++_codegen_base", "grpc_unsecure", - "health_proto", + "grpc_health_upb", ], ) diff --git a/BUILD.gn b/BUILD.gn index 1ee7929c0cb..df9329bdacd 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -33,25 +33,6 @@ config("grpc_config") { - source_set("health_proto") { - sources = [ - "src/core/ext/filters/client_channel/health/health.pb.c", - "src/core/ext/filters/client_channel/health/health.pb.h", - ] - deps = [ - ":nanopb", - ] - - public_configs = [ - ":grpc_config", - ] - include_dirs = [ - "third_party/nanopb", - ] - } - - - source_set("nanopb") { sources = [ "third_party/nanopb/pb.h", @@ -429,6 +410,8 @@ config("grpc_config") { "src/core/ext/transport/inproc/inproc_plugin.cc", "src/core/ext/transport/inproc/inproc_transport.cc", "src/core/ext/transport/inproc/inproc_transport.h", + "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h", "src/core/lib/avl/avl.cc", "src/core/lib/avl/avl.h", "src/core/lib/backoff/backoff.cc", @@ -889,7 +872,6 @@ config("grpc_config") { "//third_party/cares", ":address_sorting", ":nanopb", - ":health_proto", ] public_configs = [ @@ -1169,6 +1151,8 @@ config("grpc_config") { "include/grpcpp/support/time.h", "include/grpcpp/support/validate_service_config.h", "src/core/ext/transport/inproc/inproc_transport.h", + "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h", "src/core/lib/avl/avl.h", "src/core/lib/backoff/backoff.h", "src/core/lib/channel/channel_args.h", @@ -1398,14 +1382,19 @@ config("grpc_config") { "src/cpp/util/status.cc", "src/cpp/util/string_ref.cc", "src/cpp/util/time_cc.cc", + "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c", + "third_party/upb/upb/decode.c", + "third_party/upb/upb/encode.c", + "third_party/upb/upb/msg.c", + "third_party/upb/upb/port.c", + "third_party/upb/upb/table.c", + "third_party/upb/upb/upb.c", ] deps = [ "//third_party/boringssl", "//third_party/protobuf:protobuf_lite", ":grpc", ":gpr", - ":nanopb", - ":health_proto", ] public_configs = [ diff --git a/CMakeLists.txt b/CMakeLists.txt index 68d3ade6519..00183363fdc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1304,7 +1304,7 @@ add_library(grpc src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc - src/core/ext/filters/client_channel/health/health.pb.c + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c src/core/tsi/fake_transport_security.cc src/core/tsi/local_transport_security.cc src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc @@ -1677,10 +1677,14 @@ add_library(grpc_cronet src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc - src/core/ext/filters/client_channel/health/health.pb.c - third_party/nanopb/pb_common.c - third_party/nanopb/pb_decode.c - third_party/nanopb/pb_encode.c + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/core/lib/http/httpcli_security_connector.cc src/core/lib/security/context/security_context.cc src/core/lib/security/credentials/alts/alts_credentials.cc @@ -1748,14 +1752,10 @@ add_library(grpc_cronet src/core/tsi/alts/handshaker/altscontext.pb.c src/core/tsi/alts/handshaker/handshaker.pb.c src/core/tsi/alts/handshaker/transport_security_common.pb.c + third_party/nanopb/pb_common.c + third_party/nanopb/pb_decode.c + third_party/nanopb/pb_encode.c src/core/tsi/transport_security.cc - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c - third_party/upb/upb/decode.c - third_party/upb/upb/encode.c - third_party/upb/upb/msg.c - third_party/upb/upb/port.c - third_party/upb/upb/table.c - third_party/upb/upb/upb.c src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc src/core/ext/transport/chttp2/client/authority.cc @@ -2076,10 +2076,14 @@ add_library(grpc_test_util src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc - src/core/ext/filters/client_channel/health/health.pb.c - third_party/nanopb/pb_common.c - third_party/nanopb/pb_decode.c - third_party/nanopb/pb_encode.c + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/core/ext/transport/chttp2/transport/bin_decoder.cc src/core/ext/transport/chttp2/transport/bin_encoder.cc src/core/ext/transport/chttp2/transport/chttp2_plugin.cc @@ -2414,10 +2418,14 @@ add_library(grpc_test_util_unsecure src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc - src/core/ext/filters/client_channel/health/health.pb.c - third_party/nanopb/pb_common.c - third_party/nanopb/pb_decode.c - third_party/nanopb/pb_encode.c + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/core/ext/transport/chttp2/transport/bin_decoder.cc src/core/ext/transport/chttp2/transport/bin_encoder.cc src/core/ext/transport/chttp2/transport/chttp2_plugin.cc @@ -2763,10 +2771,14 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc - src/core/ext/filters/client_channel/health/health.pb.c - third_party/nanopb/pb_common.c - third_party/nanopb/pb_decode.c - third_party/nanopb/pb_encode.c + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/core/ext/transport/inproc/inproc_plugin.cc src/core/ext/transport/inproc/inproc_transport.cc src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc @@ -2791,13 +2803,9 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c - third_party/upb/upb/decode.c - third_party/upb/upb/encode.c - third_party/upb/upb/msg.c - third_party/upb/upb/port.c - third_party/upb/upb/table.c - third_party/upb/upb/upb.c + third_party/nanopb/pb_common.c + third_party/nanopb/pb_decode.c + third_party/nanopb/pb_encode.c src/core/ext/filters/client_channel/lb_policy/xds/xds.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc @@ -3164,10 +3172,14 @@ add_library(grpc++ src/cpp/util/status.cc src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc - src/core/ext/filters/client_channel/health/health.pb.c - third_party/nanopb/pb_common.c - third_party/nanopb/pb_decode.c - third_party/nanopb/pb_encode.c + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/cpp/codegen/codegen_init.cc ) @@ -4270,10 +4282,14 @@ add_library(grpc++_unsecure src/cpp/util/status.cc src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc - src/core/ext/filters/client_channel/health/health.pb.c - third_party/nanopb/pb_common.c - third_party/nanopb/pb_decode.c - third_party/nanopb/pb_encode.c + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c + third_party/upb/upb/decode.c + third_party/upb/upb/encode.c + third_party/upb/upb/msg.c + third_party/upb/upb/port.c + third_party/upb/upb/table.c + third_party/upb/upb/upb.c src/cpp/codegen/codegen_init.cc ) diff --git a/Makefile b/Makefile index 87a43958abc..97eaae13b2e 100644 --- a/Makefile +++ b/Makefile @@ -3795,7 +3795,7 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ - src/core/ext/filters/client_channel/health/health.pb.c \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ src/core/tsi/fake_transport_security.cc \ src/core/tsi/local_transport_security.cc \ src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc \ @@ -4156,10 +4156,14 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ - src/core/ext/filters/client_channel/health/health.pb.c \ - third_party/nanopb/pb_common.c \ - third_party/nanopb/pb_decode.c \ - third_party/nanopb/pb_encode.c \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/lib/http/httpcli_security_connector.cc \ src/core/lib/security/context/security_context.cc \ src/core/lib/security/credentials/alts/alts_credentials.cc \ @@ -4227,14 +4231,10 @@ LIBGRPC_CRONET_SRC = \ src/core/tsi/alts/handshaker/altscontext.pb.c \ src/core/tsi/alts/handshaker/handshaker.pb.c \ src/core/tsi/alts/handshaker/transport_security_common.pb.c \ + third_party/nanopb/pb_common.c \ + third_party/nanopb/pb_decode.c \ + third_party/nanopb/pb_encode.c \ src/core/tsi/transport_security.cc \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ - third_party/upb/upb/decode.c \ - third_party/upb/upb/encode.c \ - third_party/upb/upb/msg.c \ - third_party/upb/upb/port.c \ - third_party/upb/upb/table.c \ - third_party/upb/upb/upb.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/authority.cc \ @@ -4542,10 +4542,14 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ - src/core/ext/filters/client_channel/health/health.pb.c \ - third_party/nanopb/pb_common.c \ - third_party/nanopb/pb_decode.c \ - third_party/nanopb/pb_encode.c \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ src/core/ext/transport/chttp2/transport/chttp2_plugin.cc \ @@ -4861,10 +4865,14 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ - src/core/ext/filters/client_channel/health/health.pb.c \ - third_party/nanopb/pb_common.c \ - third_party/nanopb/pb_decode.c \ - third_party/nanopb/pb_encode.c \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ src/core/ext/transport/chttp2/transport/chttp2_plugin.cc \ @@ -5178,10 +5186,14 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ - src/core/ext/filters/client_channel/health/health.pb.c \ - third_party/nanopb/pb_common.c \ - third_party/nanopb/pb_decode.c \ - third_party/nanopb/pb_encode.c \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/core/ext/transport/inproc/inproc_plugin.cc \ src/core/ext/transport/inproc/inproc_transport.cc \ src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc \ @@ -5206,13 +5218,9 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ - third_party/upb/upb/decode.c \ - third_party/upb/upb/encode.c \ - third_party/upb/upb/msg.c \ - third_party/upb/upb/port.c \ - third_party/upb/upb/table.c \ - third_party/upb/upb/upb.c \ + third_party/nanopb/pb_common.c \ + third_party/nanopb/pb_decode.c \ + third_party/nanopb/pb_encode.c \ src/core/ext/filters/client_channel/lb_policy/xds/xds.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc \ @@ -5525,10 +5533,14 @@ LIBGRPC++_SRC = \ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ - src/core/ext/filters/client_channel/health/health.pb.c \ - third_party/nanopb/pb_common.c \ - third_party/nanopb/pb_decode.c \ - third_party/nanopb/pb_encode.c \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/cpp/codegen/codegen_init.cc \ PUBLIC_HEADERS_CXX += \ @@ -6553,10 +6565,14 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ - src/core/ext/filters/client_channel/health/health.pb.c \ - third_party/nanopb/pb_common.c \ - third_party/nanopb/pb_decode.c \ - third_party/nanopb/pb_encode.c \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ + third_party/upb/upb/decode.c \ + third_party/upb/upb/encode.c \ + third_party/upb/upb/msg.c \ + third_party/upb/upb/port.c \ + third_party/upb/upb/table.c \ + third_party/upb/upb/upb.c \ src/cpp/codegen/codegen_init.cc \ PUBLIC_HEADERS_CXX += \ diff --git a/build.yaml b/build.yaml index 87a2f09cb8e..ee6c05795d7 100644 --- a/build.yaml +++ b/build.yaml @@ -659,7 +659,7 @@ filegroups: uses: - grpc_base - grpc_deadline_filter - - health_proto + - grpc_health_upb - name: grpc_client_idle_filter src: - src/core/ext/filters/client_idle/client_idle_filter.cc @@ -1207,13 +1207,6 @@ filegroups: - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c uses: - nanopb -- name: health_proto - headers: - - src/core/ext/filters/client_channel/health/health.pb.h - src: - - src/core/ext/filters/client_channel/health/health.pb.c - uses: - - nanopb - name: nanopb src: - third_party/nanopb/pb_common.c @@ -1545,11 +1538,11 @@ filegroups: uses: - gpr_base_headers - grpc_base_headers + - grpc_health_upb - grpc_transport_inproc_headers - grpc++_codegen_base - grpc++_internal_hdrs_only - nanopb_headers - - health_proto - name: grpc++_config_proto language: c++ public_headers: diff --git a/config.m4 b/config.m4 index 0b7e67ed5ca..dfb4f7eb0c6 100644 --- a/config.m4 +++ b/config.m4 @@ -384,7 +384,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ - src/core/ext/filters/client_channel/health/health.pb.c \ + src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ src/core/tsi/fake_transport_security.cc \ src/core/tsi/local_transport_security.cc \ src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc \ @@ -731,6 +731,7 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/server/secure) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/transport) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/inproc) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/health/v1) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/avl) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/backoff) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/channel) diff --git a/config.w32 b/config.w32 index fc2eec7fcc7..06a52da2904 100644 --- a/config.w32 +++ b/config.w32 @@ -356,7 +356,7 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\subchannel.cc " + "src\\core\\ext\\filters\\client_channel\\subchannel_pool_interface.cc " + "src\\core\\ext\\filters\\deadline\\deadline_filter.cc " + - "src\\core\\ext\\filters\\client_channel\\health\\health.pb.c " + + "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health\\v1\\health.upb.c " + "src\\core\\tsi\\fake_transport_security.cc " + "src\\core\\tsi\\local_transport_security.cc " + "src\\core\\tsi\\ssl\\session_cache\\ssl_session_boringssl.cc " + @@ -743,6 +743,12 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\server\\secure"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\transport"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\inproc"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health\\v1"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\avl"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\backoff"); diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 08f2395769a..b6482fe66b9 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -419,7 +419,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel_interface.h', 'src/core/ext/filters/client_channel/subchannel_pool_interface.h', 'src/core/ext/filters/deadline/deadline_filter.h', - 'src/core/ext/filters/client_channel/health/health.pb.h', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', 'src/core/tsi/fake_transport_security.h', 'src/core/tsi/local_transport_security.h', 'src/core/tsi/ssl/session_cache/ssl_session.h', @@ -781,8 +781,8 @@ Pod::Spec.new do |s| 'src/core/lib/transport/transport_impl.h', 'src/core/lib/uri/uri_parser.h', 'src/core/lib/debug/trace.h', - 'src/core/ext/transport/inproc/inproc_transport.h', - 'src/core/ext/filters/client_channel/health/health.pb.h' + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', + 'src/core/ext/transport/inproc/inproc_transport.h' end s.subspec 'Protobuf' do |ss| diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 206be3da588..07dccee41f9 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -374,7 +374,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel_interface.h', 'src/core/ext/filters/client_channel/subchannel_pool_interface.h', 'src/core/ext/filters/deadline/deadline_filter.h', - 'src/core/ext/filters/client_channel/health/health.pb.h', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', 'src/core/tsi/fake_transport_security.h', 'src/core/tsi/local_transport_security.h', 'src/core/tsi/ssl/session_cache/ssl_session.h', @@ -843,7 +843,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', - 'src/core/ext/filters/client_channel/health/health.pb.c', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', 'src/core/tsi/fake_transport_security.cc', 'src/core/tsi/local_transport_security.cc', 'src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc', @@ -1040,7 +1040,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel_interface.h', 'src/core/ext/filters/client_channel/subchannel_pool_interface.h', 'src/core/ext/filters/deadline/deadline_filter.h', - 'src/core/ext/filters/client_channel/health/health.pb.h', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', 'src/core/tsi/fake_transport_security.h', 'src/core/tsi/local_transport_security.h', 'src/core/tsi/ssl/session_cache/ssl_session.h', @@ -1282,9 +1282,6 @@ Pod::Spec.new do |s| 'test/core/util/tracer_util.cc', 'test/core/util/trickle_endpoint.cc', 'test/core/util/cmdline.cc', - 'third_party/nanopb/pb_common.c', - 'third_party/nanopb/pb_decode.c', - 'third_party/nanopb/pb_encode.c', 'test/core/end2end/data/ssl_test_data.h', 'test/core/security/oauth2_utils.h', 'test/core/end2end/cq_verifier.h', diff --git a/grpc.gemspec b/grpc.gemspec index ff7b0663ca2..d56ed118d6d 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -308,7 +308,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/subchannel_interface.h ) s.files += %w( src/core/ext/filters/client_channel/subchannel_pool_interface.h ) s.files += %w( src/core/ext/filters/deadline/deadline_filter.h ) - s.files += %w( src/core/ext/filters/client_channel/health/health.pb.h ) + s.files += %w( src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h ) s.files += %w( src/core/tsi/fake_transport_security.h ) s.files += %w( src/core/tsi/local_transport_security.h ) s.files += %w( src/core/tsi/ssl/session_cache/ssl_session.h ) @@ -780,7 +780,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/subchannel.cc ) s.files += %w( src/core/ext/filters/client_channel/subchannel_pool_interface.cc ) s.files += %w( src/core/ext/filters/deadline/deadline_filter.cc ) - s.files += %w( src/core/ext/filters/client_channel/health/health.pb.c ) + s.files += %w( src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c ) s.files += %w( src/core/tsi/fake_transport_security.cc ) s.files += %w( src/core/tsi/local_transport_security.cc ) s.files += %w( src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc ) diff --git a/grpc.gyp b/grpc.gyp index 5f9f900c2cd..b4c19bb6124 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -596,7 +596,7 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', - 'src/core/ext/filters/client_channel/health/health.pb.c', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', 'src/core/tsi/fake_transport_security.cc', 'src/core/tsi/local_transport_security.cc', 'src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc', @@ -871,10 +871,14 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', - 'src/core/ext/filters/client_channel/health/health.pb.c', - 'third_party/nanopb/pb_common.c', - 'third_party/nanopb/pb_decode.c', - 'third_party/nanopb/pb_encode.c', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', + 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', + 'third_party/upb/upb/decode.c', + 'third_party/upb/upb/encode.c', + 'third_party/upb/upb/msg.c', + 'third_party/upb/upb/port.c', + 'third_party/upb/upb/table.c', + 'third_party/upb/upb/upb.c', 'src/core/ext/transport/chttp2/transport/bin_decoder.cc', 'src/core/ext/transport/chttp2/transport/bin_encoder.cc', 'src/core/ext/transport/chttp2/transport/chttp2_plugin.cc', @@ -1123,10 +1127,14 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', - 'src/core/ext/filters/client_channel/health/health.pb.c', - 'third_party/nanopb/pb_common.c', - 'third_party/nanopb/pb_decode.c', - 'third_party/nanopb/pb_encode.c', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', + 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', + 'third_party/upb/upb/decode.c', + 'third_party/upb/upb/encode.c', + 'third_party/upb/upb/msg.c', + 'third_party/upb/upb/port.c', + 'third_party/upb/upb/table.c', + 'third_party/upb/upb/upb.c', 'src/core/ext/transport/chttp2/transport/bin_decoder.cc', 'src/core/ext/transport/chttp2/transport/bin_encoder.cc', 'src/core/ext/transport/chttp2/transport/chttp2_plugin.cc', @@ -1386,10 +1394,14 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', - 'src/core/ext/filters/client_channel/health/health.pb.c', - 'third_party/nanopb/pb_common.c', - 'third_party/nanopb/pb_decode.c', - 'third_party/nanopb/pb_encode.c', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', + 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', + 'third_party/upb/upb/decode.c', + 'third_party/upb/upb/encode.c', + 'third_party/upb/upb/msg.c', + 'third_party/upb/upb/port.c', + 'third_party/upb/upb/table.c', + 'third_party/upb/upb/upb.c', 'src/core/ext/transport/inproc/inproc_plugin.cc', 'src/core/ext/transport/inproc/inproc_transport.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc', @@ -1414,13 +1426,9 @@ 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', - 'third_party/upb/upb/decode.c', - 'third_party/upb/upb/encode.c', - 'third_party/upb/upb/msg.c', - 'third_party/upb/upb/port.c', - 'third_party/upb/upb/table.c', - 'third_party/upb/upb/upb.c', + 'third_party/nanopb/pb_common.c', + 'third_party/nanopb/pb_decode.c', + 'third_party/nanopb/pb_encode.c', 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc', @@ -1540,10 +1548,14 @@ 'src/cpp/util/status.cc', 'src/cpp/util/string_ref.cc', 'src/cpp/util/time_cc.cc', - 'src/core/ext/filters/client_channel/health/health.pb.c', - 'third_party/nanopb/pb_common.c', - 'third_party/nanopb/pb_decode.c', - 'third_party/nanopb/pb_encode.c', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', + 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', + 'third_party/upb/upb/decode.c', + 'third_party/upb/upb/encode.c', + 'third_party/upb/upb/msg.c', + 'third_party/upb/upb/port.c', + 'third_party/upb/upb/table.c', + 'third_party/upb/upb/upb.c', 'src/cpp/codegen/codegen_init.cc', ], }, @@ -1697,10 +1709,14 @@ 'src/cpp/util/status.cc', 'src/cpp/util/string_ref.cc', 'src/cpp/util/time_cc.cc', - 'src/core/ext/filters/client_channel/health/health.pb.c', - 'third_party/nanopb/pb_common.c', - 'third_party/nanopb/pb_decode.c', - 'third_party/nanopb/pb_encode.c', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', + 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', + 'third_party/upb/upb/decode.c', + 'third_party/upb/upb/encode.c', + 'third_party/upb/upb/msg.c', + 'third_party/upb/upb/port.c', + 'third_party/upb/upb/table.c', + 'third_party/upb/upb/upb.c', 'src/cpp/codegen/codegen_init.cc', ], }, diff --git a/package.xml b/package.xml index adf09c06361..575449448ea 100644 --- a/package.xml +++ b/package.xml @@ -313,7 +313,7 @@ - + @@ -785,7 +785,7 @@ - + diff --git a/src/core/ext/filters/client_channel/health/health_check_client.cc b/src/core/ext/filters/client_channel/health/health_check_client.cc index a6b910b5dad..63a0a455fc1 100644 --- a/src/core/ext/filters/client_channel/health/health_check_client.cc +++ b/src/core/ext/filters/client_channel/health/health_check_client.cc @@ -23,14 +23,12 @@ #include "src/core/ext/filters/client_channel/health/health_check_client.h" -#include "pb_decode.h" -#include "pb_encode.h" -#include "src/core/ext/filters/client_channel/health/health.pb.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/transport/error_utils.h" #include "src/core/lib/transport/status_metadata.h" +#include "src/proto/grpc/health/v1/health.upb.h" #define HEALTH_CHECK_INITIAL_CONNECT_BACKOFF_SECONDS 1 #define HEALTH_CHECK_RECONNECT_BACKOFF_MULTIPLIER 1.6 @@ -202,19 +200,16 @@ namespace { void EncodeRequest(const char* service_name, ManualConstructor* send_message) { - grpc_health_v1_HealthCheckRequest request_struct; - request_struct.has_service = true; - snprintf(request_struct.service, sizeof(request_struct.service), "%s", - service_name); - pb_ostream_t ostream; - memset(&ostream, 0, sizeof(ostream)); - pb_encode(&ostream, grpc_health_v1_HealthCheckRequest_fields, - &request_struct); - grpc_slice request_slice = GRPC_SLICE_MALLOC(ostream.bytes_written); - ostream = pb_ostream_from_buffer(GRPC_SLICE_START_PTR(request_slice), - GRPC_SLICE_LENGTH(request_slice)); - GPR_ASSERT(pb_encode(&ostream, grpc_health_v1_HealthCheckRequest_fields, - &request_struct) != 0); + upb::Arena arena; + grpc_health_v1_HealthCheckRequest* request_struct = + grpc_health_v1_HealthCheckRequest_new(arena.ptr()); + grpc_health_v1_HealthCheckRequest_set_service( + request_struct, upb_strview_makez(service_name)); + size_t buf_length; + char* buf = grpc_health_v1_HealthCheckRequest_serialize( + request_struct, arena.ptr(), &buf_length); + grpc_slice request_slice = GRPC_SLICE_MALLOC(buf_length); + memcpy(GRPC_SLICE_START_PTR(request_slice), buf, buf_length); grpc_slice_buffer slice_buffer; grpc_slice_buffer_init(&slice_buffer); grpc_slice_buffer_add(&slice_buffer, request_slice); @@ -248,24 +243,19 @@ bool DecodeResponse(grpc_slice_buffer* slice_buffer, grpc_error** error) { } } // Deserialize message. - grpc_health_v1_HealthCheckResponse response_struct; - pb_istream_t istream = - pb_istream_from_buffer(recv_message, slice_buffer->length); - if (!pb_decode(&istream, grpc_health_v1_HealthCheckResponse_fields, - &response_struct)) { + upb::Arena arena; + grpc_health_v1_HealthCheckResponse* response_struct = + grpc_health_v1_HealthCheckResponse_parse( + reinterpret_cast(recv_message), slice_buffer->length, + arena.ptr()); + if (response_struct == nullptr) { // Can't parse message; assume unhealthy. *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING( "cannot parse health check response"); return false; } - if (!response_struct.has_status) { - // Field not present; assume unhealthy. - *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING( - "status field not present in health check response"); - return false; - } - return response_struct.status == - grpc_health_v1_HealthCheckResponse_ServingStatus_SERVING; + int32_t status = grpc_health_v1_HealthCheckResponse_status(response_struct); + return status == grpc_health_v1_HealthCheckResponse_SERVING; } } // namespace diff --git a/src/cpp/server/health/default_health_check_service.cc b/src/cpp/server/health/default_health_check_service.cc index 01bc51aa213..c6fd4c20fff 100644 --- a/src/cpp/server/health/default_health_check_service.cc +++ b/src/cpp/server/health/default_health_check_service.cc @@ -24,10 +24,10 @@ #include #include -#include "pb_decode.h" -#include "pb_encode.h" -#include "src/core/ext/filters/client_channel/health/health.pb.h" #include "src/cpp/server/health/default_health_check_service.h" +#include "src/proto/grpc/health/v1/health.upb.h" + +#define MAX_SERVICE_NAME_LENGTH 200 namespace grpc { @@ -204,8 +204,6 @@ bool DefaultHealthCheckService::HealthCheckServiceImpl::DecodeRequest( if (!request.Dump(&slices).ok()) return false; uint8_t* request_bytes = nullptr; size_t request_size = 0; - grpc_health_v1_HealthCheckRequest request_struct; - request_struct.has_service = false; if (slices.size() == 1) { request_bytes = const_cast(slices[0].begin()); request_size = slices[0].size(); @@ -217,37 +215,43 @@ bool DefaultHealthCheckService::HealthCheckServiceImpl::DecodeRequest( copy_to += slices[i].size(); } } - pb_istream_t istream = pb_istream_from_buffer(request_bytes, request_size); - bool decode_status = pb_decode( - &istream, grpc_health_v1_HealthCheckRequest_fields, &request_struct); + upb::Arena arena; + grpc_health_v1_HealthCheckRequest* request_struct = + grpc_health_v1_HealthCheckRequest_parse( + reinterpret_cast(request_bytes), request_size, arena.ptr()); if (slices.size() > 1) { gpr_free(request_bytes); } - if (!decode_status) return false; - *service_name = request_struct.has_service ? request_struct.service : ""; + if (request_struct == nullptr) { + return false; + } + upb_strview service = + grpc_health_v1_HealthCheckRequest_service(request_struct); + if (service.size > MAX_SERVICE_NAME_LENGTH) { + return false; + } + service_name->assign(service.data, service.size); return true; } bool DefaultHealthCheckService::HealthCheckServiceImpl::EncodeResponse( ServingStatus status, ByteBuffer* response) { - grpc_health_v1_HealthCheckResponse response_struct; - response_struct.has_status = true; - response_struct.status = + upb::Arena arena; + grpc_health_v1_HealthCheckResponse* response_struct = + grpc_health_v1_HealthCheckResponse_new(arena.ptr()); + grpc_health_v1_HealthCheckResponse_set_status( + response_struct, status == NOT_FOUND - ? grpc_health_v1_HealthCheckResponse_ServingStatus_SERVICE_UNKNOWN - : status == SERVING - ? grpc_health_v1_HealthCheckResponse_ServingStatus_SERVING - : grpc_health_v1_HealthCheckResponse_ServingStatus_NOT_SERVING; - pb_ostream_t ostream; - memset(&ostream, 0, sizeof(ostream)); - pb_encode(&ostream, grpc_health_v1_HealthCheckResponse_fields, - &response_struct); - grpc_slice response_slice = grpc_slice_malloc(ostream.bytes_written); - ostream = pb_ostream_from_buffer(GRPC_SLICE_START_PTR(response_slice), - GRPC_SLICE_LENGTH(response_slice)); - bool encode_status = pb_encode( - &ostream, grpc_health_v1_HealthCheckResponse_fields, &response_struct); - if (!encode_status) return false; + ? grpc_health_v1_HealthCheckResponse_SERVICE_UNKNOWN + : status == SERVING ? grpc_health_v1_HealthCheckResponse_SERVING + : grpc_health_v1_HealthCheckResponse_NOT_SERVING); + size_t buf_length; + char* buf = grpc_health_v1_HealthCheckResponse_serialize( + response_struct, arena.ptr(), &buf_length); + if (buf == nullptr) { + return false; + } + grpc_slice response_slice = grpc_slice_from_copied_buffer(buf, buf_length); Slice encoded_response(response_slice, Slice::STEAL_REF); ByteBuffer response_buffer(&encoded_response, 1); response->Swap(&response_buffer); diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 49a591c5f23..cf9f284db88 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -355,7 +355,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', - 'src/core/ext/filters/client_channel/health/health.pb.c', + 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', 'src/core/tsi/fake_transport_security.cc', 'src/core/tsi/local_transport_security.cc', 'src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc', diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index b43ae2f4254..3b7b4843815 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1059,9 +1059,9 @@ include/grpcpp/support/sync_stream.h \ include/grpcpp/support/sync_stream_impl.h \ include/grpcpp/support/time.h \ include/grpcpp/support/validate_service_config.h \ -src/core/ext/filters/client_channel/health/health.pb.c \ -src/core/ext/filters/client_channel/health/health.pb.h \ src/core/ext/transport/inproc/inproc_transport.h \ +src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ +src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h \ src/core/lib/avl/avl.h \ src/core/lib/backoff/backoff.h \ src/core/lib/channel/channel_args.h \ @@ -1293,12 +1293,16 @@ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ third_party/nanopb/pb.h \ -third_party/nanopb/pb_common.c \ third_party/nanopb/pb_common.h \ -third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_decode.h \ -third_party/nanopb/pb_encode.c \ -third_party/nanopb/pb_encode.h +third_party/nanopb/pb_encode.h \ +third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ +third_party/upb/upb/decode.c \ +third_party/upb/upb/encode.c \ +third_party/upb/upb/msg.c \ +third_party/upb/upb/port.c \ +third_party/upb/upb/table.c \ +third_party/upb/upb/upb.c # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index d11ea7f7daa..e64dce2e3f1 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -889,8 +889,6 @@ src/core/ext/filters/client_channel/connector.cc \ src/core/ext/filters/client_channel/connector.h \ src/core/ext/filters/client_channel/global_subchannel_pool.cc \ src/core/ext/filters/client_channel/global_subchannel_pool.h \ -src/core/ext/filters/client_channel/health/health.pb.c \ -src/core/ext/filters/client_channel/health/health.pb.h \ src/core/ext/filters/client_channel/health/health_check_client.cc \ src/core/ext/filters/client_channel/health/health_check_client.h \ src/core/ext/filters/client_channel/http_connect_handshaker.cc \ @@ -1066,6 +1064,8 @@ src/core/ext/transport/chttp2/transport/writing.cc \ src/core/ext/transport/inproc/inproc_plugin.cc \ src/core/ext/transport/inproc/inproc_transport.cc \ src/core/ext/transport/inproc/inproc_transport.h \ +src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ +src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h \ src/core/lib/README.md \ src/core/lib/avl/avl.cc \ src/core/lib/avl/avl.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 0dcecd83a6b..b7ba89293a0 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -9089,7 +9089,7 @@ "gpr", "grpc_base", "grpc_deadline_filter", - "health_proto" + "grpc_health_upb" ], "headers": [ "src/core/ext/filters/client_channel/backup_poller.h", @@ -10222,23 +10222,6 @@ "third_party": false, "type": "filegroup" }, - { - "deps": [ - "nanopb" - ], - "headers": [ - "src/core/ext/filters/client_channel/health/health.pb.h" - ], - "is_filegroup": true, - "language": "c", - "name": "health_proto", - "src": [ - "src/core/ext/filters/client_channel/health/health.pb.c", - "src/core/ext/filters/client_channel/health/health.pb.h" - ], - "third_party": false, - "type": "filegroup" - }, { "deps": [ "nanopb_headers" @@ -10563,8 +10546,8 @@ "grpc++_codegen_base", "grpc++_internal_hdrs_only", "grpc_base_headers", + "grpc_health_upb", "grpc_transport_inproc_headers", - "health_proto", "nanopb_headers" ], "headers": [ From b892ea749c0af8bee6146e12f41170fc9a013c13 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 6 Aug 2019 17:49:16 -0700 Subject: [PATCH 225/661] Fixed address resolution failure by attaching to a host application Added copyright statements Fix clang format code --- src/objective-c/tests/BUILD | 45 ++++++++++++++++--- .../tests/Hosts/ios-host/AppDelegate.h | 25 +++++++++++ .../tests/Hosts/ios-host/AppDelegate.m | 27 +++++++++++ .../tests/Hosts/ios-host/Info.plist | 41 +++++++++++++++++ src/objective-c/tests/Hosts/ios-host/main.m | 26 +++++++++++ 5 files changed, 158 insertions(+), 6 deletions(-) create mode 100644 src/objective-c/tests/Hosts/ios-host/AppDelegate.h create mode 100644 src/objective-c/tests/Hosts/ios-host/AppDelegate.m create mode 100644 src/objective-c/tests/Hosts/ios-host/Info.plist create mode 100644 src/objective-c/tests/Hosts/ios-host/main.m diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index 2718cca5880..0817bbdd6c7 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -24,9 +24,9 @@ load( "testing_objc_grpc_library" ) load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") -load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test") +load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test") load("@build_bazel_rules_apple//apple:macos.bzl", "macos_unit_test") -load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_unit_test") +load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application", "tvos_unit_test") exports_files(["LICENSE"]) @@ -59,12 +59,42 @@ grpc_objc_testing_library( hdrs = ["version.h"], data = [":TestCertificates"], defines = [ + "DEBUG=1", + "PB_FIELD_32BIT=1", + "PB_NO_PACKED_STRUCTS=1", + "PB_ENABLE_MALLOC=1", "HOST_PORT_LOCALSSL=localhost:5051", "HOST_PORT_LOCAL=localhost:5050", "HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com", ], ) +objc_library( + name = "host-lib", + srcs = glob(["Hosts/ios-host/*.m"]), + hdrs = glob(["Hosts/ios-host/*.h"]), +) + +ios_application( + name = "ios-host", + bundle_id = "grpc.objc.tests.ios-host", + infoplists = ["Hosts/ios-host/Info.plist"], + minimum_os_version = "9.0", + families = [ + "iphone", + "ipad", + ], + deps = ["host-lib"], +) + +tvos_application( + name = "tvos-host", + bundle_id = "grpc.objc.tests.tvos-host", + infoplists = ["Hosts/ios-host/Info.plist"], + minimum_os_version = "10.0", + deps = ["host-lib"], +) + grpc_objc_testing_library( name = "CronetConfig", srcs = ["ConfigureCronet.m"], @@ -159,7 +189,8 @@ ios_unit_test( ":ChannelPoolTest-lib", ":ChannelTests-lib", ":NSErrorUnitTests-lib", - ] + ], + test_host = ":ios-host", ) ios_unit_test( @@ -169,8 +200,9 @@ ios_unit_test( ":InteropTestsRemote-lib", ":InteropTestsLocalSSL-lib", ":InteropTestsLocalCleartext-lib", - # ":InteropTestsMultipleChannels-lib", #??????? Cronet must be used? + # ":InteropTestsMulitpleChannels-lib", # needs Cronet ], + test_host = ":ios-host", ) macos_unit_test( @@ -187,7 +219,7 @@ macos_unit_test( ] ) -# cares does not support tvOS CPU architecture with Bazel yet +# c-ares does not support tvOS CPU architecture with Bazel yet tvos_unit_test( name = "TvTests", minimum_os_version = "10.0", @@ -198,5 +230,6 @@ tvos_unit_test( ":InteropTestsRemote-lib", ":InteropTestsLocalSSL-lib", ":InteropTestsLocalCleartext-lib", - ] + ], + test_host = ":tvos-host", ) \ No newline at end of file diff --git a/src/objective-c/tests/Hosts/ios-host/AppDelegate.h b/src/objective-c/tests/Hosts/ios-host/AppDelegate.h new file mode 100644 index 00000000000..183abcf4ec8 --- /dev/null +++ b/src/objective-c/tests/Hosts/ios-host/AppDelegate.h @@ -0,0 +1,25 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +@interface AppDelegate : UIResponder + +@property(strong, nonatomic) UIWindow* window; + +@end diff --git a/src/objective-c/tests/Hosts/ios-host/AppDelegate.m b/src/objective-c/tests/Hosts/ios-host/AppDelegate.m new file mode 100644 index 00000000000..4a76f4c488c --- /dev/null +++ b/src/objective-c/tests/Hosts/ios-host/AppDelegate.m @@ -0,0 +1,27 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + +@end diff --git a/src/objective-c/tests/Hosts/ios-host/Info.plist b/src/objective-c/tests/Hosts/ios-host/Info.plist new file mode 100644 index 00000000000..e5baf19b85c --- /dev/null +++ b/src/objective-c/tests/Hosts/ios-host/Info.plist @@ -0,0 +1,41 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/src/objective-c/tests/Hosts/ios-host/main.m b/src/objective-c/tests/Hosts/ios-host/main.m new file mode 100644 index 00000000000..2797c6f17f2 --- /dev/null +++ b/src/objective-c/tests/Hosts/ios-host/main.m @@ -0,0 +1,26 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import "AppDelegate.h" + +int main(int argc, char* argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} From b26b25113f2fd09046613a2956c7d84971259e7b Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 7 Aug 2019 11:22:01 -0700 Subject: [PATCH 226/661] Make soruce file validation exact --- bazel/python_rules.bzl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl index c8fdd1ed3c0..0f00d53b6fb 100644 --- a/bazel/python_rules.bzl +++ b/bazel/python_rules.bzl @@ -70,7 +70,7 @@ def py_proto_library( srcs: A list of proto_library dependencies. Must contain a single element. """ codegen_target = "_{}_codegen".format(name) - if len(srcs) > 1: + if len(srcs) != 1: fail("Can only compile a single proto at a time.") @@ -158,10 +158,10 @@ def py_grpc_library( proto_library in `srcs`. """ codegen_grpc_target = "_{}_grpc_codegen".format(name) - if len(srcs) > 1: + if len(srcs) != 1: fail("Can only compile a single proto at a time.") - if len(deps) > 1: + if len(deps) != 1: fail("Deps must have length 1.") _generate_pb2_grpc_src( From bdd3fdddb26496b86bdd6aa117a04b140555b713 Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Thu, 2 May 2019 11:08:59 -0400 Subject: [PATCH 227/661] Expose cycle counter and use it /channelz. We are using clock real time (which is very expensive) on every RPC to update channelz. We should simply use cycle clock. This patch exposes cycle clock, enables RDTSC on intel, and use it for channelz. This patch also changes the implementation of time_precise_init to that more accurately using the monotonic clock and shorter by looping at most a few hundred milliseconds. This is part of a larger performance series. --- include/grpc/impl/codegen/port_platform.h | 17 +++ src/core/lib/channel/channelz.cc | 110 ++++++++--------- src/core/lib/channel/channelz.h | 38 ++++-- src/core/lib/gpr/time_precise.cc | 143 ++++++++++++++++------ src/core/lib/gpr/time_precise.h | 36 ++++++ src/core/lib/gprpp/inlined_vector.h | 20 ++- test/core/channel/channelz_test.cc | 3 +- 7 files changed, 259 insertions(+), 108 deletions(-) diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index c0ca9f43716..dd49a66fe25 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -463,6 +463,23 @@ typedef unsigned __int64 uint64_t; #include #endif /* _MSC_VER */ +/* Type of cycle clock implementation */ +#ifdef GPR_LINUX +/* Disable cycle clock by default. + TODO(soheil): enable when we support fallback for unstable cycle clocks. +#if defined(__i386__) +#define GPR_CYCLE_COUNTER_RDTSC_32 1 +#elif defined(__x86_64__) || defined(__amd64__) +#define GPR_CYCLE_COUNTER_RDTSC_64 1 +#else +#define GPR_CYCLE_COUNTER_FALLBACK 1 +#endif +*/ +#define GPR_CYCLE_COUNTER_FALLBACK 1 +#else +#define GPR_CYCLE_COUNTER_FALLBACK 1 +#endif /* GPR_LINUX */ + /* Cache line alignment */ #ifndef GPR_CACHELINE_SIZE_LOG #if defined(__i386__) || defined(__x86_64__) diff --git a/src/core/lib/channel/channelz.cc b/src/core/lib/channel/channelz.cc index 325131b8439..fb913beb0f0 100644 --- a/src/core/lib/channel/channelz.cc +++ b/src/core/lib/channel/channelz.cc @@ -107,51 +107,45 @@ char* BaseNode::RenderJsonString() { CallCountingHelper::CallCountingHelper() { num_cores_ = GPR_MAX(1, gpr_cpu_num_cores()); - per_cpu_counter_data_storage_ = static_cast( - gpr_zalloc(sizeof(AtomicCounterData) * num_cores_)); -} - -CallCountingHelper::~CallCountingHelper() { - gpr_free(per_cpu_counter_data_storage_); + per_cpu_counter_data_storage_.reserve(num_cores_); + for (size_t i = 0; i < num_cores_; ++i) { + per_cpu_counter_data_storage_.emplace_back(); + } } void CallCountingHelper::RecordCallStarted() { - gpr_atm_no_barrier_fetch_add( - &per_cpu_counter_data_storage_[grpc_core::ExecCtx::Get()->starting_cpu()] - .calls_started, - static_cast(1)); - gpr_atm_no_barrier_store( - &per_cpu_counter_data_storage_[grpc_core::ExecCtx::Get()->starting_cpu()] - .last_call_started_millis, - (gpr_atm)ExecCtx::Get()->Now()); + AtomicCounterData& data = + per_cpu_counter_data_storage_[ExecCtx::Get()->starting_cpu()]; + data.calls_started.FetchAdd(1, MemoryOrder::RELAXED); + data.last_call_started_cycle.Store(gpr_get_cycle_counter(), + MemoryOrder::RELAXED); } void CallCountingHelper::RecordCallFailed() { - gpr_atm_no_barrier_fetch_add( - &per_cpu_counter_data_storage_[grpc_core::ExecCtx::Get()->starting_cpu()] - .calls_failed, - static_cast(1)); + per_cpu_counter_data_storage_[ExecCtx::Get()->starting_cpu()] + .calls_failed.FetchAdd(1, MemoryOrder::RELAXED); } void CallCountingHelper::RecordCallSucceeded() { - gpr_atm_no_barrier_fetch_add( - &per_cpu_counter_data_storage_[grpc_core::ExecCtx::Get()->starting_cpu()] - .calls_succeeded, - static_cast(1)); + per_cpu_counter_data_storage_[ExecCtx::Get()->starting_cpu()] + .calls_succeeded.FetchAdd(1, MemoryOrder::RELAXED); } void CallCountingHelper::CollectData(CounterData* out) { for (size_t core = 0; core < num_cores_; ++core) { - out->calls_started += gpr_atm_no_barrier_load( - &per_cpu_counter_data_storage_[core].calls_started); - out->calls_succeeded += gpr_atm_no_barrier_load( - &per_cpu_counter_data_storage_[core].calls_succeeded); - out->calls_failed += gpr_atm_no_barrier_load( - &per_cpu_counter_data_storage_[core].calls_failed); - gpr_atm last_call = gpr_atm_no_barrier_load( - &per_cpu_counter_data_storage_[core].last_call_started_millis); - if (last_call > out->last_call_started_millis) { - out->last_call_started_millis = last_call; + AtomicCounterData& data = per_cpu_counter_data_storage_[core]; + + out->calls_started += data.calls_started.Load(MemoryOrder::RELAXED); + out->calls_succeeded += + per_cpu_counter_data_storage_[core].calls_succeeded.Load( + MemoryOrder::RELAXED); + out->calls_failed += per_cpu_counter_data_storage_[core].calls_failed.Load( + MemoryOrder::RELAXED); + const gpr_cycle_counter last_call = + per_cpu_counter_data_storage_[core].last_call_started_cycle.Load( + MemoryOrder::RELAXED); + if (last_call > out->last_call_started_cycle) { + out->last_call_started_cycle = last_call; } } } @@ -173,8 +167,9 @@ void CallCountingHelper::PopulateCallCounts(grpc_json* json) { json, json_iterator, "callsFailed", data.calls_failed); } if (data.calls_started != 0) { - gpr_timespec ts = grpc_millis_to_timespec(data.last_call_started_millis, - GPR_CLOCK_REALTIME); + gpr_timespec ts = gpr_convert_clock_type( + gpr_cycle_counter_to_time(data.last_call_started_cycle), + GPR_CLOCK_REALTIME); json_iterator = grpc_json_create_child(json_iterator, json, "lastCallStartedTimestamp", gpr_format_timespec(ts), GRPC_JSON_STRING, true); @@ -493,26 +488,25 @@ SocketNode::SocketNode(UniquePtr local, UniquePtr remote, void SocketNode::RecordStreamStartedFromLocal() { gpr_atm_no_barrier_fetch_add(&streams_started_, static_cast(1)); - gpr_atm_no_barrier_store(&last_local_stream_created_millis_, - (gpr_atm)ExecCtx::Get()->Now()); + gpr_atm_no_barrier_store(&last_local_stream_created_cycle_, + gpr_get_cycle_counter()); } void SocketNode::RecordStreamStartedFromRemote() { gpr_atm_no_barrier_fetch_add(&streams_started_, static_cast(1)); - gpr_atm_no_barrier_store(&last_remote_stream_created_millis_, - (gpr_atm)ExecCtx::Get()->Now()); + gpr_atm_no_barrier_store(&last_remote_stream_created_cycle_, + gpr_get_cycle_counter()); } void SocketNode::RecordMessagesSent(uint32_t num_sent) { gpr_atm_no_barrier_fetch_add(&messages_sent_, static_cast(num_sent)); - gpr_atm_no_barrier_store(&last_message_sent_millis_, - (gpr_atm)ExecCtx::Get()->Now()); + gpr_atm_no_barrier_store(&last_message_sent_cycle_, gpr_get_cycle_counter()); } void SocketNode::RecordMessageReceived() { gpr_atm_no_barrier_fetch_add(&messages_received_, static_cast(1)); - gpr_atm_no_barrier_store(&last_message_received_millis_, - (gpr_atm)ExecCtx::Get()->Now()); + gpr_atm_no_barrier_store(&last_message_received_cycle_, + gpr_get_cycle_counter()); } grpc_json* SocketNode::RenderJson() { @@ -545,20 +539,22 @@ grpc_json* SocketNode::RenderJson() { if (streams_started != 0) { json_iterator = grpc_json_add_number_string_child( json, json_iterator, "streamsStarted", streams_started); - gpr_atm last_local_stream_created_millis = - gpr_atm_no_barrier_load(&last_local_stream_created_millis_); - if (last_local_stream_created_millis != 0) { - ts = grpc_millis_to_timespec(last_local_stream_created_millis, - GPR_CLOCK_REALTIME); + gpr_cycle_counter last_local_stream_created_cycle = + gpr_atm_no_barrier_load(&last_local_stream_created_cycle_); + if (last_local_stream_created_cycle != 0) { + ts = gpr_convert_clock_type( + gpr_cycle_counter_to_time(last_local_stream_created_cycle), + GPR_CLOCK_REALTIME); json_iterator = grpc_json_create_child( json_iterator, json, "lastLocalStreamCreatedTimestamp", gpr_format_timespec(ts), GRPC_JSON_STRING, true); } - gpr_atm last_remote_stream_created_millis = - gpr_atm_no_barrier_load(&last_remote_stream_created_millis_); - if (last_remote_stream_created_millis != 0) { - ts = grpc_millis_to_timespec(last_remote_stream_created_millis, - GPR_CLOCK_REALTIME); + gpr_cycle_counter last_remote_stream_created_cycle = + gpr_atm_no_barrier_load(&last_remote_stream_created_cycle_); + if (last_remote_stream_created_cycle != 0) { + ts = gpr_convert_clock_type( + gpr_cycle_counter_to_time(last_remote_stream_created_cycle), + GPR_CLOCK_REALTIME); json_iterator = grpc_json_create_child( json_iterator, json, "lastRemoteStreamCreatedTimestamp", gpr_format_timespec(ts), GRPC_JSON_STRING, true); @@ -578,8 +574,9 @@ grpc_json* SocketNode::RenderJson() { if (messages_sent != 0) { json_iterator = grpc_json_add_number_string_child( json, json_iterator, "messagesSent", messages_sent); - ts = grpc_millis_to_timespec( - gpr_atm_no_barrier_load(&last_message_sent_millis_), + ts = gpr_convert_clock_type( + gpr_cycle_counter_to_time( + gpr_atm_no_barrier_load(&last_message_sent_cycle_)), GPR_CLOCK_REALTIME); json_iterator = grpc_json_create_child(json_iterator, json, "lastMessageSentTimestamp", @@ -589,8 +586,9 @@ grpc_json* SocketNode::RenderJson() { if (messages_received != 0) { json_iterator = grpc_json_add_number_string_child( json, json_iterator, "messagesReceived", messages_received); - ts = grpc_millis_to_timespec( - gpr_atm_no_barrier_load(&last_message_received_millis_), + ts = gpr_convert_clock_type( + gpr_cycle_counter_to_time( + gpr_atm_no_barrier_load(&last_message_received_cycle_)), GPR_CLOCK_REALTIME); json_iterator = grpc_json_create_child( json_iterator, json, "lastMessageReceivedTimestamp", diff --git a/src/core/lib/channel/channelz.h b/src/core/lib/channel/channelz.h index e1af701834d..2561bff807e 100644 --- a/src/core/lib/channel/channelz.h +++ b/src/core/lib/channel/channelz.h @@ -24,6 +24,7 @@ #include #include "src/core/lib/channel/channel_trace.h" +#include "src/core/lib/gpr/time_precise.h" #include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/gprpp/map.h" @@ -111,7 +112,6 @@ class BaseNode : public RefCounted { class CallCountingHelper { public: CallCountingHelper(); - ~CallCountingHelper(); void RecordCallStarted(); void RecordCallFailed(); @@ -124,24 +124,38 @@ class CallCountingHelper { // testing peer friend. friend class testing::CallCountingHelperPeer; + // TODO(soheil): add a proper PerCPU helper and use it here. struct AtomicCounterData { - gpr_atm calls_started = 0; - gpr_atm calls_succeeded = 0; - gpr_atm calls_failed = 0; - gpr_atm last_call_started_millis = 0; - }; + // Define the ctors so that we can use this structure in InlinedVector. + AtomicCounterData() = default; + AtomicCounterData(const AtomicCounterData& that) + : calls_started(that.calls_started.Load(MemoryOrder::RELAXED)), + calls_succeeded(that.calls_succeeded.Load(MemoryOrder::RELAXED)), + calls_failed(that.calls_failed.Load(MemoryOrder::RELAXED)), + last_call_started_cycle( + that.last_call_started_cycle.Load(MemoryOrder::RELAXED)) {} + + Atomic calls_started{0}; + Atomic calls_succeeded{0}; + Atomic calls_failed{0}; + Atomic last_call_started_cycle{0}; + // Make sure the size is exactly one cache line. + uint8_t padding[GPR_CACHELINE_SIZE - 3 * sizeof(Atomic) - + sizeof(Atomic)]; + } GPR_ALIGN_STRUCT(GPR_CACHELINE_SIZE); struct CounterData { intptr_t calls_started = 0; intptr_t calls_succeeded = 0; intptr_t calls_failed = 0; - intptr_t last_call_started_millis = 0; + gpr_cycle_counter last_call_started_cycle = 0; }; // collects the sharded data into one CounterData struct. void CollectData(CounterData* out); - AtomicCounterData* per_cpu_counter_data_storage_ = nullptr; + // Really zero-sized, but 0-sized arrays are illegal on MSVC. + InlinedVector per_cpu_counter_data_storage_; size_t num_cores_ = 0; }; @@ -281,10 +295,10 @@ class SocketNode : public BaseNode { gpr_atm messages_sent_ = 0; gpr_atm messages_received_ = 0; gpr_atm keepalives_sent_ = 0; - gpr_atm last_local_stream_created_millis_ = 0; - gpr_atm last_remote_stream_created_millis_ = 0; - gpr_atm last_message_sent_millis_ = 0; - gpr_atm last_message_received_millis_ = 0; + gpr_atm last_local_stream_created_cycle_ = 0; + gpr_atm last_remote_stream_created_cycle_ = 0; + gpr_atm last_message_sent_cycle_ = 0; + gpr_atm last_message_received_cycle_ = 0; UniquePtr local_; UniquePtr remote_; }; diff --git a/src/core/lib/gpr/time_precise.cc b/src/core/lib/gpr/time_precise.cc index 1b34fd7eb1b..9d11c66831c 100644 --- a/src/core/lib/gpr/time_precise.cc +++ b/src/core/lib/gpr/time_precise.cc @@ -18,61 +18,132 @@ #include +#if GPR_LINUX +#include +#include +#endif + +#include + +#include #include #include -#include #include "src/core/lib/gpr/time_precise.h" -#ifdef GRPC_TIMERS_RDTSC -#if defined(__i386__) -static void gpr_get_cycle_counter(int64_t int* clk) { - int64_t int ret; - __asm__ volatile("rdtsc" : "=A"(ret)); - *clk = ret; +#if GPR_CYCLE_COUNTER_RDTSC_32 or GPR_CYCLE_COUNTER_RDTSC_64 +#if GPR_LINUX +static bool read_freq_from_kernel(double* freq) { + // Google production kernel export the frequency for us in kHz. + int fd = open("/sys/devices/system/cpu/cpu0/tsc_freq_khz", O_RDONLY); + if (fd == -1) { + return false; + } + char line[1024] = {}; + char* err; + bool ret = false; + int len = read(fd, line, sizeof(line) - 1); + if (len > 0) { + const long val = strtol(line, &err, 10); + if (line[0] != '\0' && (*err == '\n' || *err == '\0')) { + *freq = val * 1e3; // Value is kHz. + ret = true; + } + } + close(fd); + return ret; } +#endif /* GPR_LINUX */ + +static double cycles_per_second = 0; +static gpr_cycle_counter start_cycle; -// ---------------------------------------------------------------- -#elif defined(__x86_64__) || defined(__amd64__) -static void gpr_get_cycle_counter(int64_t* clk) { - uint64_t low, high; - __asm__ volatile("rdtsc" : "=a"(low), "=d"(high)); - *clk = (int64_t)(high << 32) | (int64_t)low; +static bool is_fake_clock() { + gpr_timespec start = gpr_now(GPR_CLOCK_MONOTONIC); + int64_t sum = 0; + for (int i = 0; i < 8; ++i) { + gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC); + gpr_timespec delta = gpr_time_sub(now, start); + sum += delta.tv_sec * GPR_NS_PER_SEC + delta.tv_nsec; + } + // If the clock doesn't move even a nano after 8 tries, it's a fake one. + return sum == 0; } -#endif -static double cycles_per_second = 0; -static int64_t start_cycle; void gpr_precise_clock_init(void) { - time_t start; - int64_t end_cycle; gpr_log(GPR_DEBUG, "Calibrating timers"); - start = time(NULL); - while (time(NULL) == start) - ; - gpr_get_cycle_counter(&start_cycle); - while (time(NULL) <= start + 10) - ; - gpr_get_cycle_counter(&end_cycle); - cycles_per_second = (double)(end_cycle - start_cycle) / 10.0; + +#if GPR_LINUX + if (read_freq_from_kernel(&cycles_per_second)) { + start_cycle = gpr_get_cycle_counter(); + return; + } +#endif /* GPR_LINUX */ + + if (is_fake_clock()) { + cycles_per_second = 1; + start_cycle = 0; + return; + } + // Start from a loop of 1ms, and gradually increase the loop duration + // until we either converge or we have passed 255ms (1ms+2ms+...+128ms). + int64_t measurement_ns = GPR_NS_PER_MS; + double last_freq = -1; + bool converged = false; + for (int i = 0; i < 8 && !converged; ++i, measurement_ns *= 2) { + start_cycle = gpr_get_cycle_counter(); + int64_t loop_ns; + gpr_timespec start = gpr_now(GPR_CLOCK_MONOTONIC); + do { + // TODO(soheil): Maybe sleep instead of busy polling. + gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC); + gpr_timespec delta = gpr_time_sub(now, start); + loop_ns = delta.tv_sec * GPR_NS_PER_SEC + delta.tv_nsec; + } while (loop_ns < measurement_ns); + gpr_cycle_counter end_cycle = gpr_get_cycle_counter(); + // Frequency should be in Hz. + const double freq = + static_cast(end_cycle - start_cycle) / loop_ns * GPR_NS_PER_SEC; + converged = + last_freq != -1 && (freq * 0.99 < last_freq && last_freq < freq * 1.01); + last_freq = freq; + } + cycles_per_second = last_freq; gpr_log(GPR_DEBUG, "... cycles_per_second = %f\n", cycles_per_second); } -void gpr_precise_clock_now(gpr_timespec* clk) { - int64_t counter; - double secs; - gpr_get_cycle_counter(&counter); - secs = (double)(counter - start_cycle) / cycles_per_second; - clk->clock_type = GPR_CLOCK_PRECISE; - clk->tv_sec = (int64_t)secs; - clk->tv_nsec = (int32_t)(1e9 * (secs - (double)clk->tv_sec)); +gpr_timespec gpr_cycle_counter_to_time(gpr_cycle_counter cycles) { + double secs = static_cast(cycles - start_cycle) / cycles_per_second; + gpr_timespec ts; + ts.tv_sec = static_cast(secs); + ts.tv_nsec = static_cast(GPR_NS_PER_SEC * + (secs - static_cast(ts.tv_sec))); + ts.clock_type = GPR_CLOCK_PRECISE; + return ts; } -#else /* GRPC_TIMERS_RDTSC */ +void gpr_precise_clock_now(gpr_timespec* clk) { + int64_t counter = gpr_get_cycle_counter(); + *clk = gpr_cycle_counter_to_time(counter); +} +#elif GPR_CYCLE_COUNTER_FALLBACK void gpr_precise_clock_init(void) {} +gpr_cycle_counter gpr_get_cycle_counter() { + gpr_timespec ts = gpr_now(GPR_CLOCK_REALTIME); + return gpr_timespec_to_micros(ts); +} + +gpr_timespec gpr_cycle_counter_to_time(gpr_cycle_counter cycles) { + gpr_timespec ts; + ts.tv_sec = cycles / GPR_US_PER_SEC; + ts.tv_nsec = (cycles - ts.tv_sec * GPR_US_PER_SEC) * GPR_NS_PER_US; + ts.clock_type = GPR_CLOCK_PRECISE; + return ts; +} + void gpr_precise_clock_now(gpr_timespec* clk) { *clk = gpr_now(GPR_CLOCK_REALTIME); clk->clock_type = GPR_CLOCK_PRECISE; } -#endif /* GRPC_TIMERS_RDTSC */ +#endif /* GPR_CYCLE_COUNTER_FALLBACK */ diff --git a/src/core/lib/gpr/time_precise.h b/src/core/lib/gpr/time_precise.h index a63ea9dc689..ce16bafab2d 100644 --- a/src/core/lib/gpr/time_precise.h +++ b/src/core/lib/gpr/time_precise.h @@ -21,9 +21,45 @@ #include +#include #include +// Depending on the platform gpr_get_cycle_counter() can have a resolution as +// low as a usec. Use other clock sources or gpr_precise_clock_now(), +// where you need high resolution clocks. +// +// Using gpr_get_cycle_counter() is preferred to using ExecCtx::Get()->Now() +// whenever possible. + +#if GPR_CYCLE_COUNTER_RDTSC_32 +typedef int64_t gpr_cycle_counter; +inline gpr_cycle_counter gpr_get_cycle_counter() { + int64_t ret; + __asm__ volatile("rdtsc" : "=A"(ret)); + return ret; +} +#elif GPR_CYCLE_COUNTER_RDTSC_64 +typedef int64_t gpr_cycle_counter; +inline gpr_cycle_counter gpr_get_cycle_counter() { + uint64_t low, high; + __asm__ volatile("rdtsc" : "=a"(low), "=d"(high)); + return (high << 32) | low; +} +#elif GPR_CYCLE_COUNTER_FALLBACK +// TODO(soheil): add support for mrs on Arm. + +// Real time in micros. +typedef double gpr_cycle_counter; +gpr_cycle_counter gpr_get_cycle_counter(); +#else +#error Must define exactly one of \ + GPR_CYCLE_COUNTER_RDTSC_32, \ + GPR_CYCLE_COUNTER_RDTSC_64, or \ + GPR_CYCLE_COUNTER_FALLBACK +#endif + void gpr_precise_clock_init(void); void gpr_precise_clock_now(gpr_timespec* clk); +gpr_timespec gpr_cycle_counter_to_time(gpr_cycle_counter cycles); #endif /* GRPC_CORE_LIB_GPR_TIME_PRECISE_H */ diff --git a/src/core/lib/gprpp/inlined_vector.h b/src/core/lib/gprpp/inlined_vector.h index f511d520f50..c5ae0e8e65d 100644 --- a/src/core/lib/gprpp/inlined_vector.h +++ b/src/core/lib/gprpp/inlined_vector.h @@ -109,9 +109,13 @@ class InlinedVector { void reserve(size_t capacity) { if (capacity > capacity_) { - T* new_dynamic = static_cast(gpr_malloc(sizeof(T) * capacity)); + T* new_dynamic = + std::alignment_of::value == 0 + ? static_cast(gpr_malloc(sizeof(T) * capacity)) + : static_cast(gpr_malloc_aligned( + sizeof(T) * capacity, std::alignment_of::value)); move_elements(data(), new_dynamic, size_); - gpr_free(dynamic_); + free_dynamic(); dynamic_ = new_dynamic; capacity_ = capacity; } @@ -196,7 +200,17 @@ class InlinedVector { T& value = data()[i]; value.~T(); } - gpr_free(dynamic_); + free_dynamic(); + } + + void free_dynamic() { + if (dynamic_ != nullptr) { + if (std::alignment_of::value == 0) { + gpr_free(dynamic_); + } else { + gpr_free_aligned(dynamic_); + } + } } typename std::aligned_storage::type inline_[N]; diff --git a/test/core/channel/channelz_test.cc b/test/core/channel/channelz_test.cc index 7c55f9ffe0f..08ed4dd4fa5 100644 --- a/test/core/channel/channelz_test.cc +++ b/test/core/channel/channelz_test.cc @@ -51,7 +51,8 @@ class CallCountingHelperPeer { grpc_millis last_call_started_millis() const { CallCountingHelper::CounterData data; node_->CollectData(&data); - return (grpc_millis)gpr_atm_no_barrier_load(&data.last_call_started_millis); + gpr_timespec ts = gpr_cycle_counter_to_time(data.last_call_started_cycle); + return grpc_timespec_to_millis_round_up(ts); } private: From b1021ae64816c1da0ec01a5aa390267651bf0d63 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 7 Aug 2019 11:22:56 -0700 Subject: [PATCH 228/661] Capitalize name. --- tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh index 00bf971a3e2..f725eb7a3d7 100755 --- a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh +++ b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh @@ -30,7 +30,7 @@ bazel clean --expunge bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //src/python/... bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //examples/python/... -# TODO(https://github.com/grpc/grpc/issues/19854): Move this to a new kokoro +# TODO(https://github.com/grpc/grpc/issues/19854): Move this to a new Kokoro # job. (cd /var/local/git/grpc/bazel/test/python_test_repo; bazel test --test_output=errors //... From 6ddfb384c120f129e92bd85589e2ae7aad99e253 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 7 Aug 2019 11:59:36 -0700 Subject: [PATCH 229/661] Added google/protobuf/descriptor.upb.* to google_api_upb --- BUILD | 2 + BUILD.gn | 2 - CMakeLists.txt | 7 - Makefile | 9 +- build.yaml | 4 +- cmake/upb.cmake | 1 - config.m4 | 3 - config.w32 | 5 - gRPC-C++.podspec | 2 - gRPC-Core.podspec | 3 - grpc.gemspec | 1 - grpc.gyp | 9 - package.xml | 1 - setup.py | 2 - .../google/protobuf/descriptor.upb.c | 485 +++++ .../google/protobuf/descriptor.upb.h | 1690 +++++++++++++++++ src/python/grpcio/grpc_core_dependencies.py | 1 - src/upb/gen_build_yaml.py | 2 - templates/config.m4.template | 1 - templates/config.w32.template | 1 - templates/gRPC-C++.podspec.template | 2 - templates/gRPC-Core.podspec.template | 2 - tools/codegen/core/gen_upb_api.sh | 1 + tools/doxygen/Doxyfile.c++.internal | 1 - tools/doxygen/Doxyfile.core.internal | 1 - .../generated/sources_and_headers.json | 4 +- 26 files changed, 2185 insertions(+), 57 deletions(-) create mode 100644 src/core/ext/upb-generated/google/protobuf/descriptor.upb.c create mode 100644 src/core/ext/upb-generated/google/protobuf/descriptor.upb.h diff --git a/BUILD b/BUILD index ac23308620d..74af17760a9 100644 --- a/BUILD +++ b/BUILD @@ -2329,6 +2329,7 @@ grpc_cc_library( srcs = [ "src/core/ext/upb-generated/google/protobuf/any.upb.c", "src/core/ext/upb-generated/google/protobuf/duration.upb.c", + "src/core/ext/upb-generated/google/protobuf/descriptor.upb.c", "src/core/ext/upb-generated/google/protobuf/empty.upb.c", "src/core/ext/upb-generated/google/protobuf/struct.upb.c", "src/core/ext/upb-generated/google/protobuf/timestamp.upb.c", @@ -2337,6 +2338,7 @@ grpc_cc_library( hdrs = [ "src/core/ext/upb-generated/google/protobuf/any.upb.h", "src/core/ext/upb-generated/google/protobuf/duration.upb.h", + "src/core/ext/upb-generated/google/protobuf/descriptor.upb.h", "src/core/ext/upb-generated/google/protobuf/empty.upb.h", "src/core/ext/upb-generated/google/protobuf/struct.upb.h", "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", diff --git a/BUILD.gn b/BUILD.gn index df9329bdacd..9b003465bc8 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -857,7 +857,6 @@ config("grpc_config") { "src/core/tsi/transport_security_grpc.cc", "src/core/tsi/transport_security_grpc.h", "src/core/tsi/transport_security_interface.h", - "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c", "third_party/upb/upb/decode.c", "third_party/upb/upb/encode.c", "third_party/upb/upb/msg.c", @@ -1382,7 +1381,6 @@ config("grpc_config") { "src/cpp/util/status.cc", "src/cpp/util/string_ref.cc", "src/cpp/util/time_cc.cc", - "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c", "third_party/upb/upb/decode.c", "third_party/upb/upb/encode.c", "third_party/upb/upb/msg.c", diff --git a/CMakeLists.txt b/CMakeLists.txt index 00183363fdc..2034ec6c490 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1266,7 +1266,6 @@ add_library(grpc third_party/nanopb/pb_decode.c third_party/nanopb/pb_encode.c src/core/tsi/transport_security.cc - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c third_party/upb/upb/decode.c third_party/upb/upb/encode.c third_party/upb/upb/msg.c @@ -1678,7 +1677,6 @@ add_library(grpc_cronet src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c third_party/upb/upb/decode.c third_party/upb/upb/encode.c third_party/upb/upb/msg.c @@ -2077,7 +2075,6 @@ add_library(grpc_test_util src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c third_party/upb/upb/decode.c third_party/upb/upb/encode.c third_party/upb/upb/msg.c @@ -2419,7 +2416,6 @@ add_library(grpc_test_util_unsecure src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c third_party/upb/upb/decode.c third_party/upb/upb/encode.c third_party/upb/upb/msg.c @@ -2772,7 +2768,6 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c third_party/upb/upb/decode.c third_party/upb/upb/encode.c third_party/upb/upb/msg.c @@ -3173,7 +3168,6 @@ add_library(grpc++ src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c third_party/upb/upb/decode.c third_party/upb/upb/encode.c third_party/upb/upb/msg.c @@ -4283,7 +4277,6 @@ add_library(grpc++_unsecure src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c third_party/upb/upb/decode.c third_party/upb/upb/encode.c third_party/upb/upb/msg.c diff --git a/Makefile b/Makefile index 97eaae13b2e..97eb59912ec 100644 --- a/Makefile +++ b/Makefile @@ -348,7 +348,7 @@ CXXFLAGS += -stdlib=libc++ LDFLAGS += -framework CoreFoundation endif CXXFLAGS += -Wnon-virtual-dtor -CPPFLAGS += -g -Wall -Wextra -Werror -Wno-unknown-warning-option -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/nanopb -Ithird_party/upb -Ithird_party/upb/generated_for_cmake -Isrc/core/ext/upb-generated +CPPFLAGS += -g -Wall -Wextra -Werror -Wno-unknown-warning-option -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/nanopb -Ithird_party/upb -Isrc/core/ext/upb-generated COREFLAGS += -fno-rtti -fno-exceptions LDFLAGS += -g @@ -3757,7 +3757,6 @@ LIBGRPC_SRC = \ third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_encode.c \ src/core/tsi/transport_security.cc \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ third_party/upb/upb/decode.c \ third_party/upb/upb/encode.c \ third_party/upb/upb/msg.c \ @@ -4157,7 +4156,6 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ third_party/upb/upb/decode.c \ third_party/upb/upb/encode.c \ third_party/upb/upb/msg.c \ @@ -4543,7 +4541,6 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ third_party/upb/upb/decode.c \ third_party/upb/upb/encode.c \ third_party/upb/upb/msg.c \ @@ -4866,7 +4863,6 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ third_party/upb/upb/decode.c \ third_party/upb/upb/encode.c \ third_party/upb/upb/msg.c \ @@ -5187,7 +5183,6 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ third_party/upb/upb/decode.c \ third_party/upb/upb/encode.c \ third_party/upb/upb/msg.c \ @@ -5534,7 +5529,6 @@ LIBGRPC++_SRC = \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ third_party/upb/upb/decode.c \ third_party/upb/upb/encode.c \ third_party/upb/upb/msg.c \ @@ -6566,7 +6560,6 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ third_party/upb/upb/decode.c \ third_party/upb/upb/encode.c \ third_party/upb/upb/msg.c \ diff --git a/build.yaml b/build.yaml index ee6c05795d7..0563f6558fb 100644 --- a/build.yaml +++ b/build.yaml @@ -125,6 +125,7 @@ filegroups: - name: google_api_upb headers: - src/core/ext/upb-generated/google/protobuf/any.upb.h + - src/core/ext/upb-generated/google/protobuf/descriptor.upb.h - src/core/ext/upb-generated/google/protobuf/duration.upb.h - src/core/ext/upb-generated/google/protobuf/empty.upb.h - src/core/ext/upb-generated/google/protobuf/struct.upb.h @@ -132,6 +133,7 @@ filegroups: - src/core/ext/upb-generated/google/protobuf/wrappers.upb.h src: - src/core/ext/upb-generated/google/protobuf/any.upb.c + - src/core/ext/upb-generated/google/protobuf/descriptor.upb.c - src/core/ext/upb-generated/google/protobuf/duration.upb.c - src/core/ext/upb-generated/google/protobuf/empty.upb.c - src/core/ext/upb-generated/google/protobuf/struct.upb.c @@ -6197,7 +6199,7 @@ defaults: -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/nanopb - -Ithird_party/upb -Ithird_party/upb/generated_for_cmake -Isrc/core/ext/upb-generated + -Ithird_party/upb -Isrc/core/ext/upb-generated CXXFLAGS: -Wnon-virtual-dtor LDFLAGS: -g zlib: diff --git a/cmake/upb.cmake b/cmake/upb.cmake index 8a5ef86f1c4..3affa25d382 100644 --- a/cmake/upb.cmake +++ b/cmake/upb.cmake @@ -15,5 +15,4 @@ set(UPB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/upb) set(_gRPC_UPB_INCLUDE_DIR "${UPB_ROOT_DIR}") -set(_gRPC_UPB_GENERATED_DIR "${UPB_ROOT_DIR}/generated_for_cmake") set(_gRPC_UPB_GRPC_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated") diff --git a/config.m4 b/config.m4 index dfb4f7eb0c6..34974f18ac2 100644 --- a/config.m4 +++ b/config.m4 @@ -12,7 +12,6 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/nanopb) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/upb) - PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/upb/generated_for_cmake) LIBS="-lpthread $LIBS" @@ -346,7 +345,6 @@ if test "$PHP_GRPC" != "no"; then third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_encode.c \ src/core/tsi/transport_security.cc \ - third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ third_party/upb/upb/decode.c \ third_party/upb/upb/encode.c \ third_party/upb/upb/msg.c \ @@ -816,6 +814,5 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/ssl) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/third_party/fiat) PHP_ADD_BUILD_DIR($ext_builddir/third_party/nanopb) - PHP_ADD_BUILD_DIR($ext_builddir/third_party/upb/generated_for_cmake/google/protobuf) PHP_ADD_BUILD_DIR($ext_builddir/third_party/upb/upb) fi diff --git a/config.w32 b/config.w32 index 06a52da2904..db7f05c7aa5 100644 --- a/config.w32 +++ b/config.w32 @@ -318,7 +318,6 @@ if (PHP_GRPC != "no") { "third_party\\nanopb\\pb_decode.c " + "third_party\\nanopb\\pb_encode.c " + "src\\core\\tsi\\transport_security.cc " + - "third_party\\upb\\generated_for_cmake\\google\\protobuf\\descriptor.upb.c " + "third_party\\upb\\upb\\decode.c " + "third_party\\upb\\upb\\encode.c " + "third_party\\upb\\upb\\msg.c " + @@ -692,7 +691,6 @@ if (PHP_GRPC != "no") { "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ "/I"+configure_module_dirname+"\\third_party\\nanopb "+ "/I"+configure_module_dirname+"\\third_party\\upb "+ - "/I"+configure_module_dirname+"\\third_party\\upb\\generated_for_cmake "+ "/I"+configure_module_dirname+"\\third_party\\zlib "); base_dir = get_define('BUILD_DIR'); @@ -844,9 +842,6 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\third_party\\fiat"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\nanopb"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\upb"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\upb\\generated_for_cmake"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\upb\\generated_for_cmake\\google"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\upb\\generated_for_cmake\\google\\protobuf"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\upb\\upb"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\zlib"); _build_dirs = new Array(); diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index b6482fe66b9..7e728026e68 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -805,7 +805,5 @@ Pod::Spec.new do |s| find src/core/ third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm find src/core/ src/cpp/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "src/core/ext/upb-generated/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g' find src/core/ src/cpp/ -type f -name '*.grpc_back' -print0 | xargs -0 rm - find third_party/upb/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "third_party/upb/generated_for_cmake/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g' - find third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm END_OF_COMMAND end diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 07dccee41f9..1e2be599afb 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -805,7 +805,6 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/handshaker/handshaker.pb.c', 'src/core/tsi/alts/handshaker/transport_security_common.pb.c', 'src/core/tsi/transport_security.cc', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', 'third_party/upb/upb/decode.c', 'third_party/upb/upb/encode.c', 'third_party/upb/upb/msg.c', @@ -1402,7 +1401,5 @@ Pod::Spec.new do |s| find src/core/ third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm find src/core/ src/cpp/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "src/core/ext/upb-generated/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g' find src/core/ src/cpp/ -type f -name '*.grpc_back' -print0 | xargs -0 rm - find third_party/upb/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "third_party/upb/generated_for_cmake/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g' - find third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm END_OF_COMMAND end diff --git a/grpc.gemspec b/grpc.gemspec index d56ed118d6d..45f4a759473 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -742,7 +742,6 @@ Gem::Specification.new do |s| s.files += %w( third_party/nanopb/pb_decode.c ) s.files += %w( third_party/nanopb/pb_encode.c ) s.files += %w( src/core/tsi/transport_security.cc ) - s.files += %w( third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c ) s.files += %w( third_party/upb/upb/decode.c ) s.files += %w( third_party/upb/upb/encode.c ) s.files += %w( third_party/upb/upb/msg.c ) diff --git a/grpc.gyp b/grpc.gyp index b4c19bb6124..a5287a606ed 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -70,7 +70,6 @@ '-DOSATOMIC_USE_INLINED=1', '-Ithird_party/nanopb', '-Ithird_party/upb', - '-Ithird_party/upb/generated_for_cmake', '-Isrc/core/ext/upb-generated', ], 'ldflags': [ @@ -162,7 +161,6 @@ '-DOSATOMIC_USE_INLINED=1', '-Ithird_party/nanopb', '-Ithird_party/upb', - '-Ithird_party/upb/generated_for_cmake', '-Isrc/core/ext/upb-generated', ], 'OTHER_CPLUSPLUSFLAGS': [ @@ -185,7 +183,6 @@ '-DOSATOMIC_USE_INLINED=1', '-Ithird_party/nanopb', '-Ithird_party/upb', - '-Ithird_party/upb/generated_for_cmake', '-Isrc/core/ext/upb-generated', '-stdlib=libc++', '-std=c++11', @@ -558,7 +555,6 @@ 'third_party/nanopb/pb_decode.c', 'third_party/nanopb/pb_encode.c', 'src/core/tsi/transport_security.cc', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', 'third_party/upb/upb/decode.c', 'third_party/upb/upb/encode.c', 'third_party/upb/upb/msg.c', @@ -872,7 +868,6 @@ 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', 'third_party/upb/upb/decode.c', 'third_party/upb/upb/encode.c', 'third_party/upb/upb/msg.c', @@ -1128,7 +1123,6 @@ 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', 'third_party/upb/upb/decode.c', 'third_party/upb/upb/encode.c', 'third_party/upb/upb/msg.c', @@ -1395,7 +1389,6 @@ 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', 'third_party/upb/upb/decode.c', 'third_party/upb/upb/encode.c', 'third_party/upb/upb/msg.c', @@ -1549,7 +1542,6 @@ 'src/cpp/util/string_ref.cc', 'src/cpp/util/time_cc.cc', 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', 'third_party/upb/upb/decode.c', 'third_party/upb/upb/encode.c', 'third_party/upb/upb/msg.c', @@ -1710,7 +1702,6 @@ 'src/cpp/util/string_ref.cc', 'src/cpp/util/time_cc.cc', 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', 'third_party/upb/upb/decode.c', 'third_party/upb/upb/encode.c', 'third_party/upb/upb/msg.c', diff --git a/package.xml b/package.xml index 575449448ea..fc68a9cdf12 100644 --- a/package.xml +++ b/package.xml @@ -747,7 +747,6 @@ - diff --git a/setup.py b/setup.py index fe8e8d05afd..4f787c05cf7 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,6 @@ if 'openbsd' in sys.platform: NANOPB_INCLUDE = (os.path.join('third_party', 'nanopb'),) SSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),) UPB_INCLUDE = (os.path.join('third_party', 'upb'),) -UPB_GENERATED_INCLUDE = (os.path.join('third_party','upb', 'generated_for_cmake'),) UPB_GRPC_GENERATED_INCLUDE = (os.path.join('src', 'core', 'ext', 'upb-generated'),) ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),) README = os.path.join(PYTHON_STEM, 'README.rst') @@ -213,7 +212,6 @@ EXTENSION_INCLUDE_DIRECTORIES = ( NANOPB_INCLUDE + SSL_INCLUDE + UPB_INCLUDE + - UPB_GENERATED_INCLUDE + UPB_GRPC_GENERATED_INCLUDE + ZLIB_INCLUDE) diff --git a/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c b/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c new file mode 100644 index 00000000000..61b9299bb43 --- /dev/null +++ b/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c @@ -0,0 +1,485 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * google/protobuf/descriptor.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#include +#include "upb/msg.h" +#include "google/protobuf/descriptor.upb.h" + +#include "upb/port_def.inc" + +static const upb_msglayout *const google_protobuf_FileDescriptorSet_submsgs[1] = { + &google_protobuf_FileDescriptorProto_msginit, +}; + +static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = { + {1, UPB_SIZE(0, 0), 0, 0, 11, 3}, +}; + +const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { + &google_protobuf_FileDescriptorSet_submsgs[0], + &google_protobuf_FileDescriptorSet__fields[0], + UPB_SIZE(4, 8), 1, false, +}; + +static const upb_msglayout *const google_protobuf_FileDescriptorProto_submsgs[6] = { + &google_protobuf_DescriptorProto_msginit, + &google_protobuf_EnumDescriptorProto_msginit, + &google_protobuf_FieldDescriptorProto_msginit, + &google_protobuf_FileOptions_msginit, + &google_protobuf_ServiceDescriptorProto_msginit, + &google_protobuf_SourceCodeInfo_msginit, +}; + +static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] = { + {1, UPB_SIZE(4, 8), 1, 0, 9, 1}, + {2, UPB_SIZE(12, 24), 2, 0, 9, 1}, + {3, UPB_SIZE(36, 72), 0, 0, 9, 3}, + {4, UPB_SIZE(40, 80), 0, 0, 11, 3}, + {5, UPB_SIZE(44, 88), 0, 1, 11, 3}, + {6, UPB_SIZE(48, 96), 0, 4, 11, 3}, + {7, UPB_SIZE(52, 104), 0, 2, 11, 3}, + {8, UPB_SIZE(28, 56), 4, 3, 11, 1}, + {9, UPB_SIZE(32, 64), 5, 5, 11, 1}, + {10, UPB_SIZE(56, 112), 0, 0, 5, 3}, + {11, UPB_SIZE(60, 120), 0, 0, 5, 3}, + {12, UPB_SIZE(20, 40), 3, 0, 9, 1}, +}; + +const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { + &google_protobuf_FileDescriptorProto_submsgs[0], + &google_protobuf_FileDescriptorProto__fields[0], + UPB_SIZE(64, 128), 12, false, +}; + +static const upb_msglayout *const google_protobuf_DescriptorProto_submsgs[8] = { + &google_protobuf_DescriptorProto_msginit, + &google_protobuf_DescriptorProto_ExtensionRange_msginit, + &google_protobuf_DescriptorProto_ReservedRange_msginit, + &google_protobuf_EnumDescriptorProto_msginit, + &google_protobuf_FieldDescriptorProto_msginit, + &google_protobuf_MessageOptions_msginit, + &google_protobuf_OneofDescriptorProto_msginit, +}; + +static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10] = { + {1, UPB_SIZE(4, 8), 1, 0, 9, 1}, + {2, UPB_SIZE(16, 32), 0, 4, 11, 3}, + {3, UPB_SIZE(20, 40), 0, 0, 11, 3}, + {4, UPB_SIZE(24, 48), 0, 3, 11, 3}, + {5, UPB_SIZE(28, 56), 0, 1, 11, 3}, + {6, UPB_SIZE(32, 64), 0, 4, 11, 3}, + {7, UPB_SIZE(12, 24), 2, 5, 11, 1}, + {8, UPB_SIZE(36, 72), 0, 6, 11, 3}, + {9, UPB_SIZE(40, 80), 0, 2, 11, 3}, + {10, UPB_SIZE(44, 88), 0, 0, 9, 3}, +}; + +const upb_msglayout google_protobuf_DescriptorProto_msginit = { + &google_protobuf_DescriptorProto_submsgs[0], + &google_protobuf_DescriptorProto__fields[0], + UPB_SIZE(48, 96), 10, false, +}; + +static const upb_msglayout *const google_protobuf_DescriptorProto_ExtensionRange_submsgs[1] = { + &google_protobuf_ExtensionRangeOptions_msginit, +}; + +static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange__fields[3] = { + {1, UPB_SIZE(4, 4), 1, 0, 5, 1}, + {2, UPB_SIZE(8, 8), 2, 0, 5, 1}, + {3, UPB_SIZE(12, 16), 3, 0, 11, 1}, +}; + +const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { + &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0], + &google_protobuf_DescriptorProto_ExtensionRange__fields[0], + UPB_SIZE(16, 24), 3, false, +}; + +static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__fields[2] = { + {1, UPB_SIZE(4, 4), 1, 0, 5, 1}, + {2, UPB_SIZE(8, 8), 2, 0, 5, 1}, +}; + +const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { + NULL, + &google_protobuf_DescriptorProto_ReservedRange__fields[0], + UPB_SIZE(12, 12), 2, false, +}; + +static const upb_msglayout *const google_protobuf_ExtensionRangeOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1] = { + {999, UPB_SIZE(0, 0), 0, 0, 11, 3}, +}; + +const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { + &google_protobuf_ExtensionRangeOptions_submsgs[0], + &google_protobuf_ExtensionRangeOptions__fields[0], + UPB_SIZE(4, 8), 1, false, +}; + +static const upb_msglayout *const google_protobuf_FieldDescriptorProto_submsgs[1] = { + &google_protobuf_FieldOptions_msginit, +}; + +static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[10] = { + {1, UPB_SIZE(32, 32), 5, 0, 9, 1}, + {2, UPB_SIZE(40, 48), 6, 0, 9, 1}, + {3, UPB_SIZE(24, 24), 3, 0, 5, 1}, + {4, UPB_SIZE(8, 8), 1, 0, 14, 1}, + {5, UPB_SIZE(16, 16), 2, 0, 14, 1}, + {6, UPB_SIZE(48, 64), 7, 0, 9, 1}, + {7, UPB_SIZE(56, 80), 8, 0, 9, 1}, + {8, UPB_SIZE(72, 112), 10, 0, 11, 1}, + {9, UPB_SIZE(28, 28), 4, 0, 5, 1}, + {10, UPB_SIZE(64, 96), 9, 0, 9, 1}, +}; + +const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { + &google_protobuf_FieldDescriptorProto_submsgs[0], + &google_protobuf_FieldDescriptorProto__fields[0], + UPB_SIZE(80, 128), 10, false, +}; + +static const upb_msglayout *const google_protobuf_OneofDescriptorProto_submsgs[1] = { + &google_protobuf_OneofOptions_msginit, +}; + +static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2] = { + {1, UPB_SIZE(4, 8), 1, 0, 9, 1}, + {2, UPB_SIZE(12, 24), 2, 0, 11, 1}, +}; + +const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { + &google_protobuf_OneofDescriptorProto_submsgs[0], + &google_protobuf_OneofDescriptorProto__fields[0], + UPB_SIZE(16, 32), 2, false, +}; + +static const upb_msglayout *const google_protobuf_EnumDescriptorProto_submsgs[3] = { + &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, + &google_protobuf_EnumOptions_msginit, + &google_protobuf_EnumValueDescriptorProto_msginit, +}; + +static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] = { + {1, UPB_SIZE(4, 8), 1, 0, 9, 1}, + {2, UPB_SIZE(16, 32), 0, 2, 11, 3}, + {3, UPB_SIZE(12, 24), 2, 1, 11, 1}, + {4, UPB_SIZE(20, 40), 0, 0, 11, 3}, + {5, UPB_SIZE(24, 48), 0, 0, 9, 3}, +}; + +const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { + &google_protobuf_EnumDescriptorProto_submsgs[0], + &google_protobuf_EnumDescriptorProto__fields[0], + UPB_SIZE(32, 64), 5, false, +}; + +static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[2] = { + {1, UPB_SIZE(4, 4), 1, 0, 5, 1}, + {2, UPB_SIZE(8, 8), 2, 0, 5, 1}, +}; + +const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { + NULL, + &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], + UPB_SIZE(12, 12), 2, false, +}; + +static const upb_msglayout *const google_protobuf_EnumValueDescriptorProto_submsgs[1] = { + &google_protobuf_EnumValueOptions_msginit, +}; + +static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__fields[3] = { + {1, UPB_SIZE(8, 8), 2, 0, 9, 1}, + {2, UPB_SIZE(4, 4), 1, 0, 5, 1}, + {3, UPB_SIZE(16, 24), 3, 0, 11, 1}, +}; + +const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { + &google_protobuf_EnumValueDescriptorProto_submsgs[0], + &google_protobuf_EnumValueDescriptorProto__fields[0], + UPB_SIZE(24, 32), 3, false, +}; + +static const upb_msglayout *const google_protobuf_ServiceDescriptorProto_submsgs[2] = { + &google_protobuf_MethodDescriptorProto_msginit, + &google_protobuf_ServiceOptions_msginit, +}; + +static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[3] = { + {1, UPB_SIZE(4, 8), 1, 0, 9, 1}, + {2, UPB_SIZE(16, 32), 0, 0, 11, 3}, + {3, UPB_SIZE(12, 24), 2, 1, 11, 1}, +}; + +const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { + &google_protobuf_ServiceDescriptorProto_submsgs[0], + &google_protobuf_ServiceDescriptorProto__fields[0], + UPB_SIZE(24, 48), 3, false, +}; + +static const upb_msglayout *const google_protobuf_MethodDescriptorProto_submsgs[1] = { + &google_protobuf_MethodOptions_msginit, +}; + +static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6] = { + {1, UPB_SIZE(4, 8), 3, 0, 9, 1}, + {2, UPB_SIZE(12, 24), 4, 0, 9, 1}, + {3, UPB_SIZE(20, 40), 5, 0, 9, 1}, + {4, UPB_SIZE(28, 56), 6, 0, 11, 1}, + {5, UPB_SIZE(1, 1), 1, 0, 8, 1}, + {6, UPB_SIZE(2, 2), 2, 0, 8, 1}, +}; + +const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { + &google_protobuf_MethodDescriptorProto_submsgs[0], + &google_protobuf_MethodDescriptorProto__fields[0], + UPB_SIZE(32, 64), 6, false, +}; + +static const upb_msglayout *const google_protobuf_FileOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { + {1, UPB_SIZE(28, 32), 11, 0, 9, 1}, + {8, UPB_SIZE(36, 48), 12, 0, 9, 1}, + {9, UPB_SIZE(8, 8), 1, 0, 14, 1}, + {10, UPB_SIZE(16, 16), 2, 0, 8, 1}, + {11, UPB_SIZE(44, 64), 13, 0, 9, 1}, + {16, UPB_SIZE(17, 17), 3, 0, 8, 1}, + {17, UPB_SIZE(18, 18), 4, 0, 8, 1}, + {18, UPB_SIZE(19, 19), 5, 0, 8, 1}, + {20, UPB_SIZE(20, 20), 6, 0, 8, 1}, + {23, UPB_SIZE(21, 21), 7, 0, 8, 1}, + {27, UPB_SIZE(22, 22), 8, 0, 8, 1}, + {31, UPB_SIZE(23, 23), 9, 0, 8, 1}, + {36, UPB_SIZE(52, 80), 14, 0, 9, 1}, + {37, UPB_SIZE(60, 96), 15, 0, 9, 1}, + {39, UPB_SIZE(68, 112), 16, 0, 9, 1}, + {40, UPB_SIZE(76, 128), 17, 0, 9, 1}, + {41, UPB_SIZE(84, 144), 18, 0, 9, 1}, + {42, UPB_SIZE(24, 24), 10, 0, 8, 1}, + {44, UPB_SIZE(92, 160), 19, 0, 9, 1}, + {45, UPB_SIZE(100, 176), 20, 0, 9, 1}, + {999, UPB_SIZE(108, 192), 0, 0, 11, 3}, +}; + +const upb_msglayout google_protobuf_FileOptions_msginit = { + &google_protobuf_FileOptions_submsgs[0], + &google_protobuf_FileOptions__fields[0], + UPB_SIZE(112, 208), 21, false, +}; + +static const upb_msglayout *const google_protobuf_MessageOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = { + {1, UPB_SIZE(1, 1), 1, 0, 8, 1}, + {2, UPB_SIZE(2, 2), 2, 0, 8, 1}, + {3, UPB_SIZE(3, 3), 3, 0, 8, 1}, + {7, UPB_SIZE(4, 4), 4, 0, 8, 1}, + {999, UPB_SIZE(8, 8), 0, 0, 11, 3}, +}; + +const upb_msglayout google_protobuf_MessageOptions_msginit = { + &google_protobuf_MessageOptions_submsgs[0], + &google_protobuf_MessageOptions__fields[0], + UPB_SIZE(12, 16), 5, false, +}; + +static const upb_msglayout *const google_protobuf_FieldOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { + {1, UPB_SIZE(8, 8), 1, 0, 14, 1}, + {2, UPB_SIZE(24, 24), 3, 0, 8, 1}, + {3, UPB_SIZE(25, 25), 4, 0, 8, 1}, + {5, UPB_SIZE(26, 26), 5, 0, 8, 1}, + {6, UPB_SIZE(16, 16), 2, 0, 14, 1}, + {10, UPB_SIZE(27, 27), 6, 0, 8, 1}, + {999, UPB_SIZE(28, 32), 0, 0, 11, 3}, +}; + +const upb_msglayout google_protobuf_FieldOptions_msginit = { + &google_protobuf_FieldOptions_submsgs[0], + &google_protobuf_FieldOptions__fields[0], + UPB_SIZE(32, 40), 7, false, +}; + +static const upb_msglayout *const google_protobuf_OneofOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_field google_protobuf_OneofOptions__fields[1] = { + {999, UPB_SIZE(0, 0), 0, 0, 11, 3}, +}; + +const upb_msglayout google_protobuf_OneofOptions_msginit = { + &google_protobuf_OneofOptions_submsgs[0], + &google_protobuf_OneofOptions__fields[0], + UPB_SIZE(4, 8), 1, false, +}; + +static const upb_msglayout *const google_protobuf_EnumOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_field google_protobuf_EnumOptions__fields[3] = { + {2, UPB_SIZE(1, 1), 1, 0, 8, 1}, + {3, UPB_SIZE(2, 2), 2, 0, 8, 1}, + {999, UPB_SIZE(4, 8), 0, 0, 11, 3}, +}; + +const upb_msglayout google_protobuf_EnumOptions_msginit = { + &google_protobuf_EnumOptions_submsgs[0], + &google_protobuf_EnumOptions__fields[0], + UPB_SIZE(8, 16), 3, false, +}; + +static const upb_msglayout *const google_protobuf_EnumValueOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2] = { + {1, UPB_SIZE(1, 1), 1, 0, 8, 1}, + {999, UPB_SIZE(4, 8), 0, 0, 11, 3}, +}; + +const upb_msglayout google_protobuf_EnumValueOptions_msginit = { + &google_protobuf_EnumValueOptions_submsgs[0], + &google_protobuf_EnumValueOptions__fields[0], + UPB_SIZE(8, 16), 2, false, +}; + +static const upb_msglayout *const google_protobuf_ServiceOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2] = { + {33, UPB_SIZE(1, 1), 1, 0, 8, 1}, + {999, UPB_SIZE(4, 8), 0, 0, 11, 3}, +}; + +const upb_msglayout google_protobuf_ServiceOptions_msginit = { + &google_protobuf_ServiceOptions_submsgs[0], + &google_protobuf_ServiceOptions__fields[0], + UPB_SIZE(8, 16), 2, false, +}; + +static const upb_msglayout *const google_protobuf_MethodOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = { + {33, UPB_SIZE(16, 16), 2, 0, 8, 1}, + {34, UPB_SIZE(8, 8), 1, 0, 14, 1}, + {999, UPB_SIZE(20, 24), 0, 0, 11, 3}, +}; + +const upb_msglayout google_protobuf_MethodOptions_msginit = { + &google_protobuf_MethodOptions_submsgs[0], + &google_protobuf_MethodOptions__fields[0], + UPB_SIZE(24, 32), 3, false, +}; + +static const upb_msglayout *const google_protobuf_UninterpretedOption_submsgs[1] = { + &google_protobuf_UninterpretedOption_NamePart_msginit, +}; + +static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7] = { + {2, UPB_SIZE(56, 80), 0, 0, 11, 3}, + {3, UPB_SIZE(32, 32), 4, 0, 9, 1}, + {4, UPB_SIZE(8, 8), 1, 0, 4, 1}, + {5, UPB_SIZE(16, 16), 2, 0, 3, 1}, + {6, UPB_SIZE(24, 24), 3, 0, 1, 1}, + {7, UPB_SIZE(40, 48), 5, 0, 12, 1}, + {8, UPB_SIZE(48, 64), 6, 0, 9, 1}, +}; + +const upb_msglayout google_protobuf_UninterpretedOption_msginit = { + &google_protobuf_UninterpretedOption_submsgs[0], + &google_protobuf_UninterpretedOption__fields[0], + UPB_SIZE(64, 96), 7, false, +}; + +static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__fields[2] = { + {1, UPB_SIZE(4, 8), 2, 0, 9, 2}, + {2, UPB_SIZE(1, 1), 1, 0, 8, 2}, +}; + +const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { + NULL, + &google_protobuf_UninterpretedOption_NamePart__fields[0], + UPB_SIZE(16, 32), 2, false, +}; + +static const upb_msglayout *const google_protobuf_SourceCodeInfo_submsgs[1] = { + &google_protobuf_SourceCodeInfo_Location_msginit, +}; + +static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = { + {1, UPB_SIZE(0, 0), 0, 0, 11, 3}, +}; + +const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { + &google_protobuf_SourceCodeInfo_submsgs[0], + &google_protobuf_SourceCodeInfo__fields[0], + UPB_SIZE(4, 8), 1, false, +}; + +static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields[5] = { + {1, UPB_SIZE(20, 40), 0, 0, 5, 3}, + {2, UPB_SIZE(24, 48), 0, 0, 5, 3}, + {3, UPB_SIZE(4, 8), 1, 0, 9, 1}, + {4, UPB_SIZE(12, 24), 2, 0, 9, 1}, + {6, UPB_SIZE(28, 56), 0, 0, 9, 3}, +}; + +const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { + NULL, + &google_protobuf_SourceCodeInfo_Location__fields[0], + UPB_SIZE(32, 64), 5, false, +}; + +static const upb_msglayout *const google_protobuf_GeneratedCodeInfo_submsgs[1] = { + &google_protobuf_GeneratedCodeInfo_Annotation_msginit, +}; + +static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = { + {1, UPB_SIZE(0, 0), 0, 0, 11, 3}, +}; + +const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { + &google_protobuf_GeneratedCodeInfo_submsgs[0], + &google_protobuf_GeneratedCodeInfo__fields[0], + UPB_SIZE(4, 8), 1, false, +}; + +static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__fields[4] = { + {1, UPB_SIZE(20, 32), 0, 0, 5, 3}, + {2, UPB_SIZE(12, 16), 3, 0, 9, 1}, + {3, UPB_SIZE(4, 4), 1, 0, 5, 1}, + {4, UPB_SIZE(8, 8), 2, 0, 5, 1}, +}; + +const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { + NULL, + &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], + UPB_SIZE(24, 48), 4, false, +}; + +#include "upb/port_undef.inc" + diff --git a/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h b/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h new file mode 100644 index 00000000000..681614910e0 --- /dev/null +++ b/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h @@ -0,0 +1,1690 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * google/protobuf/descriptor.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ +#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ + +#include "upb/generated_util.h" +#include "upb/msg.h" +#include "upb/decode.h" +#include "upb/encode.h" + +#include "upb/port_def.inc" + +#ifdef __cplusplus +extern "C" { +#endif + +struct google_protobuf_FileDescriptorSet; +struct google_protobuf_FileDescriptorProto; +struct google_protobuf_DescriptorProto; +struct google_protobuf_DescriptorProto_ExtensionRange; +struct google_protobuf_DescriptorProto_ReservedRange; +struct google_protobuf_ExtensionRangeOptions; +struct google_protobuf_FieldDescriptorProto; +struct google_protobuf_OneofDescriptorProto; +struct google_protobuf_EnumDescriptorProto; +struct google_protobuf_EnumDescriptorProto_EnumReservedRange; +struct google_protobuf_EnumValueDescriptorProto; +struct google_protobuf_ServiceDescriptorProto; +struct google_protobuf_MethodDescriptorProto; +struct google_protobuf_FileOptions; +struct google_protobuf_MessageOptions; +struct google_protobuf_FieldOptions; +struct google_protobuf_OneofOptions; +struct google_protobuf_EnumOptions; +struct google_protobuf_EnumValueOptions; +struct google_protobuf_ServiceOptions; +struct google_protobuf_MethodOptions; +struct google_protobuf_UninterpretedOption; +struct google_protobuf_UninterpretedOption_NamePart; +struct google_protobuf_SourceCodeInfo; +struct google_protobuf_SourceCodeInfo_Location; +struct google_protobuf_GeneratedCodeInfo; +struct google_protobuf_GeneratedCodeInfo_Annotation; +typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet; +typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto; +typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto; +typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange; +typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange; +typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions; +typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto; +typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto; +typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto; +typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange; +typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto; +typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto; +typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto; +typedef struct google_protobuf_FileOptions google_protobuf_FileOptions; +typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions; +typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions; +typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions; +typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions; +typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions; +typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions; +typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions; +typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption; +typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart; +typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo; +typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location; +typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo; +typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation; +extern const upb_msglayout google_protobuf_FileDescriptorSet_msginit; +extern const upb_msglayout google_protobuf_FileDescriptorProto_msginit; +extern const upb_msglayout google_protobuf_DescriptorProto_msginit; +extern const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit; +extern const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit; +extern const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit; +extern const upb_msglayout google_protobuf_FieldDescriptorProto_msginit; +extern const upb_msglayout google_protobuf_OneofDescriptorProto_msginit; +extern const upb_msglayout google_protobuf_EnumDescriptorProto_msginit; +extern const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit; +extern const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit; +extern const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit; +extern const upb_msglayout google_protobuf_MethodDescriptorProto_msginit; +extern const upb_msglayout google_protobuf_FileOptions_msginit; +extern const upb_msglayout google_protobuf_MessageOptions_msginit; +extern const upb_msglayout google_protobuf_FieldOptions_msginit; +extern const upb_msglayout google_protobuf_OneofOptions_msginit; +extern const upb_msglayout google_protobuf_EnumOptions_msginit; +extern const upb_msglayout google_protobuf_EnumValueOptions_msginit; +extern const upb_msglayout google_protobuf_ServiceOptions_msginit; +extern const upb_msglayout google_protobuf_MethodOptions_msginit; +extern const upb_msglayout google_protobuf_UninterpretedOption_msginit; +extern const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit; +extern const upb_msglayout google_protobuf_SourceCodeInfo_msginit; +extern const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit; +extern const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit; +extern const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit; + +typedef enum { + google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1, + google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2, + google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3 +} google_protobuf_FieldDescriptorProto_Label; + +typedef enum { + google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1, + google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2, + google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3, + google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4, + google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5, + google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6, + google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7, + google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8, + google_protobuf_FieldDescriptorProto_TYPE_STRING = 9, + google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10, + google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11, + google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12, + google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13, + google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14, + google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15, + google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16, + google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17, + google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18 +} google_protobuf_FieldDescriptorProto_Type; + +typedef enum { + google_protobuf_FieldOptions_STRING = 0, + google_protobuf_FieldOptions_CORD = 1, + google_protobuf_FieldOptions_STRING_PIECE = 2 +} google_protobuf_FieldOptions_CType; + +typedef enum { + google_protobuf_FieldOptions_JS_NORMAL = 0, + google_protobuf_FieldOptions_JS_STRING = 1, + google_protobuf_FieldOptions_JS_NUMBER = 2 +} google_protobuf_FieldOptions_JSType; + +typedef enum { + google_protobuf_FileOptions_SPEED = 1, + google_protobuf_FileOptions_CODE_SIZE = 2, + google_protobuf_FileOptions_LITE_RUNTIME = 3 +} google_protobuf_FileOptions_OptimizeMode; + +typedef enum { + google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0, + google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1, + google_protobuf_MethodOptions_IDEMPOTENT = 2 +} google_protobuf_MethodOptions_IdempotencyLevel; + + +/* google.protobuf.FileDescriptorSet */ + +UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_arena *arena) { + return (google_protobuf_FileDescriptorSet *)upb_msg_new(&google_protobuf_FileDescriptorSet_msginit, arena); +} +UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_FileDescriptorSet *ret = google_protobuf_FileDescriptorSet_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_FileDescriptorSet_msginit, arena, len); +} + +UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet *msg, size_t *len) { return (const google_protobuf_FileDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } + +UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet *msg, size_t *len) { + return (google_protobuf_FileDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); +} +UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet *msg, size_t len, upb_arena *arena) { + return (google_protobuf_FileDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet *msg, upb_arena *arena) { + struct google_protobuf_FileDescriptorProto* sub = (struct google_protobuf_FileDescriptorProto*)upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* google.protobuf.FileDescriptorProto */ + +UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_arena *arena) { + return (google_protobuf_FileDescriptorProto *)upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena); +} +UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_FileDescriptorProto *ret = google_protobuf_FileDescriptorProto_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_FileDescriptorProto_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } +UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); } +UPB_INLINE upb_strview const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); } +UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); } +UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); } +UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(48, 96), len); } +UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(52, 104), len); } +UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 4); } +UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_FileOptions*, UPB_SIZE(28, 56)); } +UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 5); } +UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_SourceCodeInfo*, UPB_SIZE(32, 64)); } +UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(56, 112), len); } +UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(60, 120), len); } +UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 3); } +UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); } + +UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; +} +UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value; +} +UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) { + return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len); +} +UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(36, 72), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); +} +UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto *msg, upb_strview val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(36, 72), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); +} +UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto *msg, size_t *len) { + return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len); +} +UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(40, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto *msg, size_t *len) { + return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len); +} +UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(44, 88), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto *msg, size_t *len) { + return (google_protobuf_ServiceDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(48, 96), len); +} +UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_ServiceDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(48, 96), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_ServiceDescriptorProto* sub = (struct google_protobuf_ServiceDescriptorProto*)upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(48, 96), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto *msg, size_t *len) { + return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(52, 104), len); +} +UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(52, 104), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(52, 104), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) { + _upb_sethas(msg, 4); + UPB_FIELD_AT(msg, google_protobuf_FileOptions*, UPB_SIZE(28, 56)) = value; +} +UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg); + if (sub == NULL) { + sub = (struct google_protobuf_FileOptions*)upb_msg_new(&google_protobuf_FileOptions_msginit, arena); + if (!sub) return NULL; + google_protobuf_FileDescriptorProto_set_options(msg, sub); + } + return sub; +} +UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) { + _upb_sethas(msg, 5); + UPB_FIELD_AT(msg, google_protobuf_SourceCodeInfo*, UPB_SIZE(32, 64)) = value; +} +UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg); + if (sub == NULL) { + sub = (struct google_protobuf_SourceCodeInfo*)upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena); + if (!sub) return NULL; + google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub); + } + return sub; +} +UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) { + return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 112), len); +} +UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { + return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(56, 112), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena); +} +UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(56, 112), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); +} +UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) { + return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(60, 120), len); +} +UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { + return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(60, 120), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena); +} +UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(60, 120), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); +} +UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 3); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value; +} + +/* google.protobuf.DescriptorProto */ + +UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_arena *arena) { + return (google_protobuf_DescriptorProto *)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena); +} +UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_DescriptorProto *ret = google_protobuf_DescriptorProto_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_DescriptorProto_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE upb_strview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } +UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); } +UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); } +UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); } +UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); } +UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); } +UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_MessageOptions*, UPB_SIZE(12, 24)); } +UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); } +UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); } +UPB_INLINE upb_strview const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); } + +UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; +} +UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto *msg, size_t *len) { + return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len); +} +UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto *msg, size_t *len) { + return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len); +} +UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto *msg, size_t *len) { + return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len); +} +UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(24, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_mutable_extension_range(google_protobuf_DescriptorProto *msg, size_t *len) { + return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len); +} +UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_DescriptorProto_ExtensionRange* sub = (struct google_protobuf_DescriptorProto_ExtensionRange*)upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(28, 56), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto *msg, size_t *len) { + return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len); +} +UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(32, 64), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, google_protobuf_MessageOptions*, UPB_SIZE(12, 24)) = value; +} +UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg); + if (sub == NULL) { + sub = (struct google_protobuf_MessageOptions*)upb_msg_new(&google_protobuf_MessageOptions_msginit, arena); + if (!sub) return NULL; + google_protobuf_DescriptorProto_set_options(msg, sub); + } + return sub; +} +UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto *msg, size_t *len) { + return (google_protobuf_OneofDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len); +} +UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_OneofDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(36, 72), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_OneofDescriptorProto* google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_OneofDescriptorProto* sub = (struct google_protobuf_OneofDescriptorProto*)upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(36, 72), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_mutable_reserved_range(google_protobuf_DescriptorProto *msg, size_t *len) { + return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len); +} +UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_DescriptorProto_ReservedRange* sub = (struct google_protobuf_DescriptorProto_ReservedRange*)upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(40, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE upb_strview* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto *msg, size_t *len) { + return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len); +} +UPB_INLINE upb_strview* google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); +} +UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto *msg, upb_strview val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(44, 88), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); +} + +/* google.protobuf.DescriptorProto.ExtensionRange */ + +UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_arena *arena) { + return (google_protobuf_DescriptorProto_ExtensionRange *)upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena); +} +UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_DescriptorProto_ExtensionRange *ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_DescriptorProto_ExtensionRange_serialize(const google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); } +UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } +UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_has_field(msg, 3); } +UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return UPB_FIELD_AT(msg, const google_protobuf_ExtensionRangeOptions*, UPB_SIZE(12, 16)); } + +UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value; +} +UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) { + _upb_sethas(msg, 3); + UPB_FIELD_AT(msg, google_protobuf_ExtensionRangeOptions*, UPB_SIZE(12, 16)) = value; +} +UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena) { + struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg); + if (sub == NULL) { + sub = (struct google_protobuf_ExtensionRangeOptions*)upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena); + if (!sub) return NULL; + google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub); + } + return sub; +} + +/* google.protobuf.DescriptorProto.ReservedRange */ + +UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_arena *arena) { + return (google_protobuf_DescriptorProto_ReservedRange *)upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena); +} +UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_DescriptorProto_ReservedRange *ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_DescriptorProto_ReservedRange_serialize(const google_protobuf_DescriptorProto_ReservedRange *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); } +UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } + +UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value; +} +UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; +} + +/* google.protobuf.ExtensionRangeOptions */ + +UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_arena *arena) { + return (google_protobuf_ExtensionRangeOptions *)upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena); +} +UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_ExtensionRangeOptions *ret = google_protobuf_ExtensionRangeOptions_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_ExtensionRangeOptions_msginit, arena, len); +} + +UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } + +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t *len) { + return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t len, upb_arena *arena) { + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena) { + struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* google.protobuf.FieldDescriptorProto */ + +UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_arena *arena) { + return (google_protobuf_FieldDescriptorProto *)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena); +} +UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_FieldDescriptorProto *ret = google_protobuf_FieldDescriptorProto_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_FieldDescriptorProto_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 5); } +UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 6); } +UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 3); } +UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 24)); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 7); } +UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 8); } +UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(56, 80)); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 10); } +UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_FieldOptions*, UPB_SIZE(72, 112)); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 4); } +UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(28, 28)); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 9); } +UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(64, 96)); } + +UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 5); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)) = value; +} +UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 6); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)) = value; +} +UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) { + _upb_sethas(msg, 3); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 24)) = value; +} +UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)) = value; +} +UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 7); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)) = value; +} +UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 8); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(56, 80)) = value; +} +UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) { + _upb_sethas(msg, 10); + UPB_FIELD_AT(msg, google_protobuf_FieldOptions*, UPB_SIZE(72, 112)) = value; +} +UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg); + if (sub == NULL) { + sub = (struct google_protobuf_FieldOptions*)upb_msg_new(&google_protobuf_FieldOptions_msginit, arena); + if (!sub) return NULL; + google_protobuf_FieldDescriptorProto_set_options(msg, sub); + } + return sub; +} +UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) { + _upb_sethas(msg, 4); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(28, 28)) = value; +} +UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 9); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(64, 96)) = value; +} + +/* google.protobuf.OneofDescriptorProto */ + +UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_arena *arena) { + return (google_protobuf_OneofDescriptorProto *)upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena); +} +UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_OneofDescriptorProto *ret = google_protobuf_OneofDescriptorProto_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_OneofDescriptorProto_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE upb_strview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } +UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_OneofOptions*, UPB_SIZE(12, 24)); } + +UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; +} +UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, google_protobuf_OneofOptions*, UPB_SIZE(12, 24)) = value; +} +UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg); + if (sub == NULL) { + sub = (struct google_protobuf_OneofOptions*)upb_msg_new(&google_protobuf_OneofOptions_msginit, arena); + if (!sub) return NULL; + google_protobuf_OneofDescriptorProto_set_options(msg, sub); + } + return sub; +} + +/* google.protobuf.EnumDescriptorProto */ + +UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_arena *arena) { + return (google_protobuf_EnumDescriptorProto *)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena); +} +UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_EnumDescriptorProto *ret = google_protobuf_EnumDescriptorProto_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_EnumDescriptorProto_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE upb_strview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } +UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); } +UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_EnumOptions*, UPB_SIZE(12, 24)); } +UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); } +UPB_INLINE upb_strview const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); } + +UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; +} +UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto *msg, size_t *len) { + return (google_protobuf_EnumValueDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len); +} +UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_EnumValueDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_EnumValueDescriptorProto* sub = (struct google_protobuf_EnumValueDescriptorProto*)upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, google_protobuf_EnumOptions*, UPB_SIZE(12, 24)) = value; +} +UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg); + if (sub == NULL) { + sub = (struct google_protobuf_EnumOptions*)upb_msg_new(&google_protobuf_EnumOptions_msginit, arena); + if (!sub) return NULL; + google_protobuf_EnumDescriptorProto_set_options(msg, sub); + } + return sub; +} +UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_mutable_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t *len) { + return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len); +} +UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_EnumDescriptorProto_EnumReservedRange* sub = (struct google_protobuf_EnumDescriptorProto_EnumReservedRange*)upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t *len) { + return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len); +} +UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) { + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); +} +UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_strview val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(24, 48), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); +} + +/* google.protobuf.EnumDescriptorProto.EnumReservedRange */ + +UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_arena *arena) { + return (google_protobuf_EnumDescriptorProto_EnumReservedRange *)upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena); +} +UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_EnumDescriptorProto_EnumReservedRange *ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); } +UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } + +UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value; +} +UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; +} + +/* google.protobuf.EnumValueDescriptorProto */ + +UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_arena *arena) { + return (google_protobuf_EnumValueDescriptorProto *)upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena); +} +UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_EnumValueDescriptorProto *ret = google_protobuf_EnumValueDescriptorProto_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_EnumValueDescriptorProto_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE upb_strview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); } +UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); } +UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_has_field(msg, 3); } +UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_EnumValueOptions*, UPB_SIZE(16, 24)); } + +UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value; +} +UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) { + _upb_sethas(msg, 3); + UPB_FIELD_AT(msg, google_protobuf_EnumValueOptions*, UPB_SIZE(16, 24)) = value; +} +UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg); + if (sub == NULL) { + sub = (struct google_protobuf_EnumValueOptions*)upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena); + if (!sub) return NULL; + google_protobuf_EnumValueDescriptorProto_set_options(msg, sub); + } + return sub; +} + +/* google.protobuf.ServiceDescriptorProto */ + +UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_arena *arena) { + return (google_protobuf_ServiceDescriptorProto *)upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena); +} +UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_ServiceDescriptorProto *ret = google_protobuf_ServiceDescriptorProto_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_ServiceDescriptorProto_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE upb_strview google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } +UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto *msg, size_t *len) { return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); } +UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_ServiceOptions*, UPB_SIZE(12, 24)); } + +UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; +} +UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto *msg, size_t *len) { + return (google_protobuf_MethodDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len); +} +UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto *msg, size_t len, upb_arena *arena) { + return (google_protobuf_MethodDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_MethodDescriptorProto* sub = (struct google_protobuf_MethodDescriptorProto*)upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, google_protobuf_ServiceOptions*, UPB_SIZE(12, 24)) = value; +} +UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg); + if (sub == NULL) { + sub = (struct google_protobuf_ServiceOptions*)upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena); + if (!sub) return NULL; + google_protobuf_ServiceDescriptorProto_set_options(msg, sub); + } + return sub; +} + +/* google.protobuf.MethodDescriptorProto */ + +UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_arena *arena) { + return (google_protobuf_MethodDescriptorProto *)upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena); +} +UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_MethodDescriptorProto *ret = google_protobuf_MethodDescriptorProto_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_MethodDescriptorProto_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 3); } +UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } +UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 4); } +UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); } +UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 5); } +UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); } +UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 6); } +UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_MethodOptions*, UPB_SIZE(28, 56)); } +UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } +UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); } + +UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 3); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; +} +UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 4); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value; +} +UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) { + _upb_sethas(msg, 5); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value; +} +UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) { + _upb_sethas(msg, 6); + UPB_FIELD_AT(msg, google_protobuf_MethodOptions*, UPB_SIZE(28, 56)) = value; +} +UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto *msg, upb_arena *arena) { + struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg); + if (sub == NULL) { + sub = (struct google_protobuf_MethodOptions*)upb_msg_new(&google_protobuf_MethodOptions_msginit, arena); + if (!sub) return NULL; + google_protobuf_MethodDescriptorProto_set_options(msg, sub); + } + return sub; +} +UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; +} +UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value; +} + +/* google.protobuf.FileOptions */ + +UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_arena *arena) { + return (google_protobuf_FileOptions *)upb_msg_new(&google_protobuf_FileOptions_msginit, arena); +} +UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_FileOptions *ret = google_protobuf_FileOptions_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_FileOptions_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_FileOptions_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 11); } +UPB_INLINE upb_strview google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)); } +UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 12); } +UPB_INLINE upb_strview google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 48)); } +UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } +UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)); } +UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 13); } +UPB_INLINE upb_strview google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(44, 64)); } +UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 3); } +UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(17, 17)); } +UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 4); } +UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(18, 18)); } +UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 5); } +UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(19, 19)); } +UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 6); } +UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(20, 20)); } +UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 7); } +UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(21, 21)); } +UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 8); } +UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(22, 22)); } +UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 9); } +UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(23, 23)); } +UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 14); } +UPB_INLINE upb_strview google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(52, 80)); } +UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 15); } +UPB_INLINE upb_strview google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(60, 96)); } +UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 16); } +UPB_INLINE upb_strview google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(68, 112)); } +UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 17); } +UPB_INLINE upb_strview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(76, 128)); } +UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 18); } +UPB_INLINE upb_strview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(84, 144)); } +UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 10); } +UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)); } +UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 19); } +UPB_INLINE upb_strview google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(92, 160)); } +UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 20); } +UPB_INLINE upb_strview google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(100, 176)); } +UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(108, 192), len); } + +UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_strview value) { + _upb_sethas(msg, 11); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_strview value) { + _upb_sethas(msg, 12); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 48)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_strview value) { + _upb_sethas(msg, 13); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(44, 64)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) { + _upb_sethas(msg, 3); + UPB_FIELD_AT(msg, bool, UPB_SIZE(17, 17)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) { + _upb_sethas(msg, 4); + UPB_FIELD_AT(msg, bool, UPB_SIZE(18, 18)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) { + _upb_sethas(msg, 5); + UPB_FIELD_AT(msg, bool, UPB_SIZE(19, 19)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) { + _upb_sethas(msg, 6); + UPB_FIELD_AT(msg, bool, UPB_SIZE(20, 20)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) { + _upb_sethas(msg, 7); + UPB_FIELD_AT(msg, bool, UPB_SIZE(21, 21)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) { + _upb_sethas(msg, 8); + UPB_FIELD_AT(msg, bool, UPB_SIZE(22, 22)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) { + _upb_sethas(msg, 9); + UPB_FIELD_AT(msg, bool, UPB_SIZE(23, 23)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) { + _upb_sethas(msg, 14); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(52, 80)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_strview value) { + _upb_sethas(msg, 15); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(60, 96)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_strview value) { + _upb_sethas(msg, 16); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(68, 112)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) { + _upb_sethas(msg, 17); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(76, 128)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_strview value) { + _upb_sethas(msg, 18); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(84, 144)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) { + _upb_sethas(msg, 10); + UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_strview value) { + _upb_sethas(msg, 19); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(92, 160)) = value; +} +UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_strview value) { + _upb_sethas(msg, 20); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(100, 176)) = value; +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions *msg, size_t *len) { + return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(108, 192), len); +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_resize_uninterpreted_option(google_protobuf_FileOptions *msg, size_t len, upb_arena *arena) { + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(108, 192), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptions_add_uninterpreted_option(google_protobuf_FileOptions *msg, upb_arena *arena) { + struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(108, 192), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* google.protobuf.MessageOptions */ + +UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_arena *arena) { + return (google_protobuf_MessageOptions *)upb_msg_new(&google_protobuf_MessageOptions_msginit, arena); +} +UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_MessageOptions *ret = google_protobuf_MessageOptions_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_MessageOptions_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_MessageOptions_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } +UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); } +UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 3); } +UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(3, 3)); } +UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 4); } +UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)); } +UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(8, 8), len); } + +UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; +} +UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value; +} +UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) { + _upb_sethas(msg, 3); + UPB_FIELD_AT(msg, bool, UPB_SIZE(3, 3)) = value; +} +UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) { + _upb_sethas(msg, 4); + UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)) = value; +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions *msg, size_t *len) { + return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 8), len); +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_resize_uninterpreted_option(google_protobuf_MessageOptions *msg, size_t len, upb_arena *arena) { + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(8, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOptions_add_uninterpreted_option(google_protobuf_MessageOptions *msg, upb_arena *arena) { + struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(8, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* google.protobuf.FieldOptions */ + +UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_arena *arena) { + return (google_protobuf_FieldOptions *)upb_msg_new(&google_protobuf_FieldOptions_msginit, arena); +} +UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_FieldOptions *ret = google_protobuf_FieldOptions_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_FieldOptions_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_FieldOptions_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } +UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 3); } +UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)); } +UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 4); } +UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(25, 25)); } +UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 5); } +UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(26, 26)); } +UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)); } +UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 6); } +UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(27, 27)); } +UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(28, 32), len); } + +UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) { + _upb_sethas(msg, 3); + UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)) = value; +} +UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) { + _upb_sethas(msg, 4); + UPB_FIELD_AT(msg, bool, UPB_SIZE(25, 25)) = value; +} +UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) { + _upb_sethas(msg, 5); + UPB_FIELD_AT(msg, bool, UPB_SIZE(26, 26)) = value; +} +UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)) = value; +} +UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) { + _upb_sethas(msg, 6); + UPB_FIELD_AT(msg, bool, UPB_SIZE(27, 27)) = value; +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions *msg, size_t *len) { + return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 32), len); +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions *msg, size_t len, upb_arena *arena) { + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions *msg, upb_arena *arena) { + struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(28, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* google.protobuf.OneofOptions */ + +UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_arena *arena) { + return (google_protobuf_OneofOptions *)upb_msg_new(&google_protobuf_OneofOptions_msginit, arena); +} +UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_OneofOptions *ret = google_protobuf_OneofOptions_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_OneofOptions_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_OneofOptions_msginit, arena, len); +} + +UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } + +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mutable_uninterpreted_option(google_protobuf_OneofOptions *msg, size_t *len) { + return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_resize_uninterpreted_option(google_protobuf_OneofOptions *msg, size_t len, upb_arena *arena) { + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOptions_add_uninterpreted_option(google_protobuf_OneofOptions *msg, upb_arena *arena) { + struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* google.protobuf.EnumOptions */ + +UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_arena *arena) { + return (google_protobuf_EnumOptions *)upb_msg_new(&google_protobuf_EnumOptions_msginit, arena); +} +UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_EnumOptions *ret = google_protobuf_EnumOptions_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumOptions_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_EnumOptions_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } +UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); } +UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); } + +UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; +} +UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value; +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions *msg, size_t *len) { + return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_resize_uninterpreted_option(google_protobuf_EnumOptions *msg, size_t len, upb_arena *arena) { + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptions_add_uninterpreted_option(google_protobuf_EnumOptions *msg, upb_arena *arena) { + struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* google.protobuf.EnumValueOptions */ + +UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_arena *arena) { + return (google_protobuf_EnumValueOptions *)upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena); +} +UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_EnumValueOptions *ret = google_protobuf_EnumValueOptions_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumValueOptions_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_EnumValueOptions_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } +UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); } + +UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions *msg, size_t *len) { + return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions *msg, size_t len, upb_arena *arena) { + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions *msg, upb_arena *arena) { + struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* google.protobuf.ServiceOptions */ + +UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_arena *arena) { + return (google_protobuf_ServiceOptions *)upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena); +} +UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_ServiceOptions *ret = google_protobuf_ServiceOptions_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_ServiceOptions_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_ServiceOptions_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } +UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); } + +UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions *msg, size_t *len) { + return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_resize_uninterpreted_option(google_protobuf_ServiceOptions *msg, size_t len, upb_arena *arena) { + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOptions_add_uninterpreted_option(google_protobuf_ServiceOptions *msg, upb_arena *arena) { + struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* google.protobuf.MethodOptions */ + +UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_arena *arena) { + return (google_protobuf_MethodOptions *)upb_msg_new(&google_protobuf_MethodOptions_msginit, arena); +} +UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_MethodOptions *ret = google_protobuf_MethodOptions_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_MethodOptions_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_MethodOptions_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)); } +UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } +UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(20, 24), len); } + +UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)) = value; +} +UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t *len) { + return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 24), len); +} +UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_resize_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t len, upb_arena *arena) { + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 24), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOptions_add_uninterpreted_option(google_protobuf_MethodOptions *msg, upb_arena *arena) { + struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(20, 24), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* google.protobuf.UninterpretedOption */ + +UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_arena *arena) { + return (google_protobuf_UninterpretedOption *)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); +} +UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_UninterpretedOption *ret = google_protobuf_UninterpretedOption_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_UninterpretedOption_msginit, arena, len); +} + +UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg, size_t *len) { return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_accessor(msg, UPB_SIZE(56, 80), len); } +UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 4); } +UPB_INLINE upb_strview google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)); } +UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(8, 8)); } +UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(16, 16)); } +UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 3); } +UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(24, 24)); } +UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 5); } +UPB_INLINE upb_strview google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)); } +UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 6); } +UPB_INLINE upb_strview google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)); } + +UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption *msg, size_t *len) { + return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 80), len); +} +UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption *msg, size_t len, upb_arena *arena) { + return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_resize_accessor(msg, UPB_SIZE(56, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption *msg, upb_arena *arena) { + struct google_protobuf_UninterpretedOption_NamePart* sub = (struct google_protobuf_UninterpretedOption_NamePart*)upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(56, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_strview value) { + _upb_sethas(msg, 4); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)) = value; +} +UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, int64_t, UPB_SIZE(16, 16)) = value; +} +UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) { + _upb_sethas(msg, 3); + UPB_FIELD_AT(msg, double, UPB_SIZE(24, 24)) = value; +} +UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_strview value) { + _upb_sethas(msg, 5); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)) = value; +} +UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_strview value) { + _upb_sethas(msg, 6); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)) = value; +} + +/* google.protobuf.UninterpretedOption.NamePart */ + +UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_arena *arena) { + return (google_protobuf_UninterpretedOption_NamePart *)upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena); +} +UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_UninterpretedOption_NamePart *ret = google_protobuf_UninterpretedOption_NamePart_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_UninterpretedOption_NamePart_serialize(const google_protobuf_UninterpretedOption_NamePart *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_UninterpretedOption_NamePart_msginit, arena, len); +} + +UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE upb_strview google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } +UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } + +UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_strview value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; +} +UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; +} + +/* google.protobuf.SourceCodeInfo */ + +UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_arena *arena) { + return (google_protobuf_SourceCodeInfo *)upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena); +} +UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_SourceCodeInfo *ret = google_protobuf_SourceCodeInfo_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_SourceCodeInfo_msginit, arena, len); +} + +UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo *msg, size_t *len) { return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } + +UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_mutable_location(google_protobuf_SourceCodeInfo *msg, size_t *len) { + return (google_protobuf_SourceCodeInfo_Location**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); +} +UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_resize_location(google_protobuf_SourceCodeInfo *msg, size_t len, upb_arena *arena) { + return (google_protobuf_SourceCodeInfo_Location**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_add_location(google_protobuf_SourceCodeInfo *msg, upb_arena *arena) { + struct google_protobuf_SourceCodeInfo_Location* sub = (struct google_protobuf_SourceCodeInfo_Location*)upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* google.protobuf.SourceCodeInfo.Location */ + +UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_arena *arena) { + return (google_protobuf_SourceCodeInfo_Location *)upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena); +} +UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_SourceCodeInfo_Location *ret = google_protobuf_SourceCodeInfo_Location_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_SourceCodeInfo_Location_serialize(const google_protobuf_SourceCodeInfo_Location *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_SourceCodeInfo_Location_msginit, arena, len); +} + +UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); } +UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); } +UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE upb_strview google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } +UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE upb_strview google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); } +UPB_INLINE upb_strview const* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); } + +UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { + return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len); +} +UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) { + return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena); +} +UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(20, 40), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); +} +UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { + return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len); +} +UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) { + return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena); +} +UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(24, 48), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); +} +UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; +} +UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value; +} +UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { + return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len); +} +UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_resize_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) { + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); +} +UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(28, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); +} + +/* google.protobuf.GeneratedCodeInfo */ + +UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_arena *arena) { + return (google_protobuf_GeneratedCodeInfo *)upb_msg_new(&google_protobuf_GeneratedCodeInfo_msginit, arena); +} +UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_GeneratedCodeInfo *ret = google_protobuf_GeneratedCodeInfo_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_msginit, arena, len); +} + +UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo *msg, size_t *len) { return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } + +UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_mutable_annotation(google_protobuf_GeneratedCodeInfo *msg, size_t *len) { + return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); +} +UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_resize_annotation(google_protobuf_GeneratedCodeInfo *msg, size_t len, upb_arena *arena) { + return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_add_annotation(google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena) { + struct google_protobuf_GeneratedCodeInfo_Annotation* sub = (struct google_protobuf_GeneratedCodeInfo_Annotation*)upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* google.protobuf.GeneratedCodeInfo.Annotation */ + +UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_arena *arena) { + return (google_protobuf_GeneratedCodeInfo_Annotation *)upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena); +} +UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parse(const char *buf, size_t size, + upb_arena *arena) { + google_protobuf_GeneratedCodeInfo_Annotation *ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); + return (ret && upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(const google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena, len); +} + +UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(20, 32), len); } +UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_has_field(msg, 3); } +UPB_INLINE upb_strview google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)); } +UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_has_field(msg, 1); } +UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); } +UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_has_field(msg, 2); } +UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } + +UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) { + return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 32), len); +} +UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t len, upb_arena *arena) { + return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 32), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena); +} +UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(20, 32), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); +} +UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_strview value) { + _upb_sethas(msg, 3); + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)) = value; +} +UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { + _upb_sethas(msg, 1); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value; +} +UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { + _upb_sethas(msg, 2); + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include "upb/port_undef.inc" + +#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */ diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index cf9f284db88..ec5b79d965b 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -317,7 +317,6 @@ CORE_SOURCE_FILES = [ 'third_party/nanopb/pb_decode.c', 'third_party/nanopb/pb_encode.c', 'src/core/tsi/transport_security.cc', - 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', 'third_party/upb/upb/decode.c', 'third_party/upb/upb/encode.c', 'third_party/upb/upb/msg.c', diff --git a/src/upb/gen_build_yaml.py b/src/upb/gen_build_yaml.py index 0eb9eb1bd47..65d31953b1f 100755 --- a/src/upb/gen_build_yaml.py +++ b/src/upb/gen_build_yaml.py @@ -22,7 +22,6 @@ import sys import yaml hdrs = [ - "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.h", "third_party/upb/upb/decode.h", "third_party/upb/upb/encode.h", "third_party/upb/upb/generated_util.h", @@ -34,7 +33,6 @@ hdrs = [ ] srcs = [ - "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c", "third_party/upb/upb/decode.c", "third_party/upb/upb/encode.c", "third_party/upb/upb/msg.c", diff --git a/templates/config.m4.template b/templates/config.m4.template index db55a34d84c..677c7ddf63a 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -14,7 +14,6 @@ PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/nanopb) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/upb) - PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/upb/generated_for_cmake) LIBS="-lpthread $LIBS" diff --git a/templates/config.w32.template b/templates/config.w32.template index b9e9acd1ec1..70920f3527d 100644 --- a/templates/config.w32.template +++ b/templates/config.w32.template @@ -32,7 +32,6 @@ "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ "/I"+configure_module_dirname+"\\third_party\\nanopb "+ "/I"+configure_module_dirname+"\\third_party\\upb "+ - "/I"+configure_module_dirname+"\\third_party\\upb\\generated_for_cmake "+ "/I"+configure_module_dirname+"\\third_party\\zlib "); <% dirs = {} diff --git a/templates/gRPC-C++.podspec.template b/templates/gRPC-C++.podspec.template index 1ec2d877542..b8080c92731 100644 --- a/templates/gRPC-C++.podspec.template +++ b/templates/gRPC-C++.podspec.template @@ -231,7 +231,5 @@ find src/core/ third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm find src/core/ src/cpp/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "src/core/ext/upb-generated/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g' find src/core/ src/cpp/ -type f -name '*.grpc_back' -print0 | xargs -0 rm - find third_party/upb/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "third_party/upb/generated_for_cmake/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g' - find third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm END_OF_COMMAND end diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 9d4f1b4d4a0..9f67ae428ae 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -218,7 +218,5 @@ find src/core/ third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm find src/core/ src/cpp/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "src/core/ext/upb-generated/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g' find src/core/ src/cpp/ -type f -name '*.grpc_back' -print0 | xargs -0 rm - find third_party/upb/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "third_party/upb/generated_for_cmake/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g' - find third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm END_OF_COMMAND end diff --git a/tools/codegen/core/gen_upb_api.sh b/tools/codegen/core/gen_upb_api.sh index 8d208c01e32..4a9239a2828 100755 --- a/tools/codegen/core/gen_upb_api.sh +++ b/tools/codegen/core/gen_upb_api.sh @@ -60,6 +60,7 @@ proto_files=( \ "google/api/annotations.proto" \ "google/api/http.proto" \ "google/protobuf/any.proto" \ + "google/protobuf/descriptor.proto" \ "google/protobuf/duration.proto" \ "google/protobuf/empty.proto" \ "google/protobuf/struct.proto" \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 3b7b4843815..ac421d418ba 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1296,7 +1296,6 @@ third_party/nanopb/pb.h \ third_party/nanopb/pb_common.h \ third_party/nanopb/pb_decode.h \ third_party/nanopb/pb_encode.h \ -third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ third_party/upb/upb/decode.c \ third_party/upb/upb/encode.c \ third_party/upb/upb/msg.c \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index e64dce2e3f1..58d719c438e 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1597,7 +1597,6 @@ third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_decode.h \ third_party/nanopb/pb_encode.c \ third_party/nanopb/pb_encode.h \ -third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ third_party/upb/upb/decode.c \ third_party/upb/upb/encode.c \ third_party/upb/upb/msg.c \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index b7ba89293a0..3278e997e6b 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -8308,6 +8308,7 @@ "deps": [], "headers": [ "src/core/ext/upb-generated/google/protobuf/any.upb.h", + "src/core/ext/upb-generated/google/protobuf/descriptor.upb.h", "src/core/ext/upb-generated/google/protobuf/duration.upb.h", "src/core/ext/upb-generated/google/protobuf/empty.upb.h", "src/core/ext/upb-generated/google/protobuf/struct.upb.h", @@ -8320,6 +8321,8 @@ "src": [ "src/core/ext/upb-generated/google/protobuf/any.upb.c", "src/core/ext/upb-generated/google/protobuf/any.upb.h", + "src/core/ext/upb-generated/google/protobuf/descriptor.upb.c", + "src/core/ext/upb-generated/google/protobuf/descriptor.upb.h", "src/core/ext/upb-generated/google/protobuf/duration.upb.c", "src/core/ext/upb-generated/google/protobuf/duration.upb.h", "src/core/ext/upb-generated/google/protobuf/empty.upb.c", @@ -10947,7 +10950,6 @@ { "deps": [], "headers": [ - "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.h", "third_party/upb/upb/decode.h", "third_party/upb/upb/encode.h", "third_party/upb/upb/generated_util.h", From c6b0bd08c70cc57cb65c3f634824bd1fda804e7c Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 24 Jul 2019 14:33:18 -0700 Subject: [PATCH 230/661] Updated grpclb to use upb --- BUILD | 10 +- BUILD.gn | 16 + CMakeLists.txt | 30 +- Makefile | 30 +- build.yaml | 8 +- config.m4 | 16 +- config.w32 | 18 +- gRPC-C++.podspec | 14 +- gRPC-Core.podspec | 42 ++- grpc.gemspec | 28 +- grpc.gyp | 30 +- package.xml | 28 +- .../client_channel/lb_policy/grpclb/grpclb.cc | 73 ++-- .../lb_policy/grpclb/load_balancer_api.cc | 345 +++++++----------- .../lb_policy/grpclb/load_balancer_api.h | 55 +-- src/python/grpcio/grpc_core_dependencies.py | 14 +- test/core/nanopb/fuzzer_response.cc | 6 +- test/core/nanopb/fuzzer_serverlist.cc | 4 +- test/cpp/grpclb/grpclb_api_test.cc | 39 +- tools/doxygen/Doxyfile.core.internal | 16 + .../generated/sources_and_headers.json | 12 +- 21 files changed, 469 insertions(+), 365 deletions(-) diff --git a/BUILD b/BUILD index 74af17760a9..0f3b426ff06 100644 --- a/BUILD +++ b/BUILD @@ -1226,15 +1226,12 @@ grpc_cc_library( "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h", "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h", ], - external_deps = [ - "nanopb", - ], language = "c++", deps = [ "grpc_base", "grpc_client_channel", "grpc_resolver_fake", - "grpclb_proto", + "grpc_lb_upb", ], ) @@ -1254,16 +1251,13 @@ grpc_cc_library( "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h", "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h", ], - external_deps = [ - "nanopb", - ], language = "c++", deps = [ "grpc_base", "grpc_client_channel", "grpc_resolver_fake", "grpc_secure", - "grpclb_proto", + "grpc_lb_upb", ], ) diff --git a/BUILD.gn b/BUILD.gn index 9b003465bc8..28a950c13cf 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -410,8 +410,24 @@ config("grpc_config") { "src/core/ext/transport/inproc/inproc_plugin.cc", "src/core/ext/transport/inproc/inproc_transport.cc", "src/core/ext/transport/inproc/inproc_transport.h", + "src/core/ext/upb-generated/google/protobuf/any.upb.c", + "src/core/ext/upb-generated/google/protobuf/any.upb.h", + "src/core/ext/upb-generated/google/protobuf/descriptor.upb.c", + "src/core/ext/upb-generated/google/protobuf/descriptor.upb.h", + "src/core/ext/upb-generated/google/protobuf/duration.upb.c", + "src/core/ext/upb-generated/google/protobuf/duration.upb.h", + "src/core/ext/upb-generated/google/protobuf/empty.upb.c", + "src/core/ext/upb-generated/google/protobuf/empty.upb.h", + "src/core/ext/upb-generated/google/protobuf/struct.upb.c", + "src/core/ext/upb-generated/google/protobuf/struct.upb.h", + "src/core/ext/upb-generated/google/protobuf/timestamp.upb.c", + "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", + "src/core/ext/upb-generated/google/protobuf/wrappers.upb.c", + "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h", "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c", "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h", + "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h", "src/core/lib/avl/avl.cc", "src/core/lib/avl/avl.h", "src/core/lib/backoff/backoff.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index 2034ec6c490..6c3c7d3feb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1322,14 +1322,22 @@ add_library(grpc src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc + src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c + src/core/ext/upb-generated/google/protobuf/any.upb.c + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c + src/core/ext/upb-generated/google/protobuf/duration.upb.c + src/core/ext/upb-generated/google/protobuf/empty.upb.c + src/core/ext/upb-generated/google/protobuf/struct.upb.c + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c src/core/ext/filters/client_channel/lb_policy/xds/xds.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc + src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c + src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c + src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc @@ -2795,16 +2803,24 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc + src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c + src/core/ext/upb-generated/google/protobuf/any.upb.c + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c + src/core/ext/upb-generated/google/protobuf/duration.upb.c + src/core/ext/upb-generated/google/protobuf/empty.upb.c + src/core/ext/upb-generated/google/protobuf/struct.upb.c + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c + src/core/ext/filters/client_channel/lb_policy/xds/xds.cc + src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc + src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc + src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c third_party/nanopb/pb_common.c third_party/nanopb/pb_decode.c third_party/nanopb/pb_encode.c - src/core/ext/filters/client_channel/lb_policy/xds/xds.cc - src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc - src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc - src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc src/core/ext/filters/census/grpc_context.cc diff --git a/Makefile b/Makefile index 97eb59912ec..4ea6acdb4bf 100644 --- a/Makefile +++ b/Makefile @@ -3813,14 +3813,22 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ + src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ + src/core/ext/upb-generated/google/protobuf/any.upb.c \ + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ + src/core/ext/upb-generated/google/protobuf/duration.upb.c \ + src/core/ext/upb-generated/google/protobuf/empty.upb.c \ + src/core/ext/upb-generated/google/protobuf/struct.upb.c \ + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ src/core/ext/filters/client_channel/lb_policy/xds/xds.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc \ + src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ + src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ + src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \ src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \ src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc \ @@ -5210,16 +5218,24 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ + src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ + src/core/ext/upb-generated/google/protobuf/any.upb.c \ + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ + src/core/ext/upb-generated/google/protobuf/duration.upb.c \ + src/core/ext/upb-generated/google/protobuf/empty.upb.c \ + src/core/ext/upb-generated/google/protobuf/struct.upb.c \ + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ + src/core/ext/filters/client_channel/lb_policy/xds/xds.cc \ + src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc \ + src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc \ + src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_encode.c \ - src/core/ext/filters/client_channel/lb_policy/xds/xds.cc \ - src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc \ - src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc \ - src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc \ src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \ src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \ src/core/ext/filters/census/grpc_context.cc \ diff --git a/build.yaml b/build.yaml index 0563f6558fb..24da28e2591 100644 --- a/build.yaml +++ b/build.yaml @@ -725,9 +725,8 @@ filegroups: uses: - grpc_base - grpc_client_channel + - grpc_lb_upb - grpc_resolver_fake - - grpclb_proto - - nanopb - upb - name: grpc_lb_policy_grpclb_secure headers: @@ -746,10 +745,9 @@ filegroups: uses: - grpc_base - grpc_client_channel + - grpc_lb_upb - grpc_resolver_fake - grpc_secure - - grpclb_proto - - nanopb - upb - name: grpc_lb_policy_pick_first src: @@ -785,7 +783,6 @@ filegroups: - grpc_resolver_fake - grpclb_proto - nanopb - - upb - name: grpc_lb_policy_xds_secure headers: - src/core/ext/filters/client_channel/lb_policy/xds/xds.h @@ -805,7 +802,6 @@ filegroups: - grpc_secure - grpclb_proto - nanopb - - upb - name: grpc_lb_subchannel_list headers: - src/core/ext/filters/client_channel/lb_policy/subchannel_list.h diff --git a/config.m4 b/config.m4 index 34974f18ac2..a23d65f8542 100644 --- a/config.m4 +++ b/config.m4 @@ -401,14 +401,22 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ + src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ + src/core/ext/upb-generated/google/protobuf/any.upb.c \ + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ + src/core/ext/upb-generated/google/protobuf/duration.upb.c \ + src/core/ext/upb-generated/google/protobuf/empty.upb.c \ + src/core/ext/upb-generated/google/protobuf/struct.upb.c \ + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ src/core/ext/filters/client_channel/lb_policy/xds/xds.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc \ + src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ + src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ + src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \ src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \ src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc \ @@ -729,7 +737,9 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/server/secure) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/transport) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/inproc) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/google/protobuf) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/health/v1) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/lb/v1) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/avl) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/backoff) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/channel) diff --git a/config.w32 b/config.w32 index db7f05c7aa5..27635b54544 100644 --- a/config.w32 +++ b/config.w32 @@ -374,14 +374,22 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\grpclb_channel_secure.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\grpclb_client_stats.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\load_balancer_api.cc " + + "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb\\v1\\load_balancer.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\any.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\descriptor.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\duration.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\empty.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\struct.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\timestamp.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\wrappers.upb.c " + "src\\core\\ext\\filters\\client_channel\\resolver\\fake\\fake_resolver.cc " + - "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\google\\protobuf\\duration.pb.c " + - "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\google\\protobuf\\timestamp.pb.c " + - "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\load_balancer.pb.c " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds_channel_secure.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds_client_stats.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds_load_balancer_api.cc " + + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\google\\protobuf\\duration.pb.c " + + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\google\\protobuf\\timestamp.pb.c " + + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\load_balancer.pb.c " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\pick_first\\pick_first.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\round_robin\\round_robin.cc " + "src\\core\\ext\\filters\\client_channel\\resolver\\dns\\c_ares\\dns_resolver_ares.cc " + @@ -742,11 +750,15 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\transport"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\inproc"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\google"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\google\\protobuf"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health\\v1"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb\\v1"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\avl"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\backoff"); diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 7e728026e68..b1a169207ac 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -578,13 +578,21 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', + 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', + 'src/core/ext/upb-generated/google/protobuf/any.upb.h', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h', 'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 1e2be599afb..6a449efed19 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -533,13 +533,21 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', + 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', + 'src/core/ext/upb-generated/google/protobuf/any.upb.h', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h', 'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h', @@ -861,14 +869,22 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', + 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', + 'src/core/ext/upb-generated/google/protobuf/any.upb.c', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', 'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc', @@ -1198,13 +1214,21 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', + 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', + 'src/core/ext/upb-generated/google/protobuf/any.upb.h', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h', 'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h', diff --git a/grpc.gemspec b/grpc.gemspec index 45f4a759473..12fddb3252e 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -467,13 +467,21 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h ) + s.files += %w( src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/any.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/descriptor.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/duration.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/empty.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/struct.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/timestamp.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/wrappers.upb.h ) s.files += %w( src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h ) - s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h ) - s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h ) - s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h ) + s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h ) + s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h ) + s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/subchannel_list.h ) s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h ) s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h ) @@ -798,14 +806,22 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc ) + s.files += %w( src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/any.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/descriptor.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/duration.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/empty.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/struct.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/timestamp.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/wrappers.upb.c ) s.files += %w( src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc ) - s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c ) - s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c ) - s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc ) + s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c ) + s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c ) + s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc ) s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc ) diff --git a/grpc.gyp b/grpc.gyp index a5287a606ed..040831ec4f3 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -611,14 +611,22 @@ 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', + 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', + 'src/core/ext/upb-generated/google/protobuf/any.upb.c', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', 'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc', @@ -1416,16 +1424,24 @@ 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', + 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', + 'src/core/ext/upb-generated/google/protobuf/any.upb.c', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', + 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', + 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc', + 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc', + 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', 'third_party/nanopb/pb_common.c', 'third_party/nanopb/pb_decode.c', 'third_party/nanopb/pb_encode.c', - 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', - 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc', - 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc', - 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc', 'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'src/core/ext/filters/census/grpc_context.cc', diff --git a/package.xml b/package.xml index fc68a9cdf12..5b85159a4f5 100644 --- a/package.xml +++ b/package.xml @@ -472,13 +472,21 @@ + + + + + + + + - - - + + + @@ -803,14 +811,22 @@ + + + + + + + + - - - + + + diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index bc4b63b74ec..6a565e057b9 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -409,18 +409,18 @@ void ParseServer(const grpc_grpclb_server* server, const uint16_t netorder_port = grpc_htons((uint16_t)server->port); /* the addresses are given in binary format (a in(6)_addr struct) in * server->ip_address.bytes. */ - const grpc_grpclb_ip_address* ip = &server->ip_address; - if (ip->size == 4) { + const grpc_grpclb_server_ip_address& ip = server->ip_address; + if (ip.size == 4) { addr->len = static_cast(sizeof(grpc_sockaddr_in)); grpc_sockaddr_in* addr4 = reinterpret_cast(&addr->addr); addr4->sin_family = GRPC_AF_INET; - memcpy(&addr4->sin_addr, ip->bytes, ip->size); + memcpy(&addr4->sin_addr, ip.data, ip.size); addr4->sin_port = netorder_port; - } else if (ip->size == 16) { + } else if (ip.size == 16) { addr->len = static_cast(sizeof(grpc_sockaddr_in6)); grpc_sockaddr_in6* addr6 = (grpc_sockaddr_in6*)&addr->addr; addr6->sin6_family = GRPC_AF_INET6; - memcpy(&addr6->sin6_addr, ip->bytes, ip->size); + memcpy(&addr6->sin6_addr, ip.data, ip.size); addr6->sin6_port = netorder_port; } } @@ -490,7 +490,7 @@ const grpc_arg_pointer_vtable client_stats_arg_vtable = { bool IsServerValid(const grpc_grpclb_server* server, size_t idx, bool log) { if (server->drop) return false; - const grpc_grpclb_ip_address* ip = &server->ip_address; + const grpc_grpclb_server_ip_address& ip = server->ip_address; if (GPR_UNLIKELY(server->port >> 16 != 0)) { if (log) { gpr_log(GPR_ERROR, @@ -499,12 +499,12 @@ bool IsServerValid(const grpc_grpclb_server* server, size_t idx, bool log) { } return false; } - if (GPR_UNLIKELY(ip->size != 4 && ip->size != 16)) { + if (GPR_UNLIKELY(ip.size != 4 && ip.size != 16)) { if (log) { gpr_log(GPR_ERROR, "Expected IP to be 4 or 16 bytes, got %d at index %lu of " "serverlist. Ignoring", - ip->size, (unsigned long)idx); + ip.size, (unsigned long)idx); } return false; } @@ -523,7 +523,7 @@ ServerAddressList GrpcLb::Serverlist::GetServerAddressList( ParseServer(server, &addr); // LB token processing. char lb_token[GPR_ARRAY_SIZE(server->load_balance_token) + 1]; - if (server->has_load_balance_token) { + if (server->load_balance_token[0] != 0) { const size_t lb_token_max_length = GPR_ARRAY_SIZE(server->load_balance_token); const size_t lb_token_length = @@ -790,13 +790,14 @@ GrpcLb::BalancerCallState::BalancerCallState( GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD, nullptr, deadline, nullptr); // Init the LB call request payload. + upb::Arena arena; grpc_grpclb_request* request = - grpc_grpclb_request_create(grpclb_policy()->server_name_); - grpc_slice request_payload_slice = grpc_grpclb_request_encode(request); + grpc_grpclb_request_create(grpclb_policy()->server_name_, arena.ptr()); + grpc_slice request_payload_slice = + grpc_grpclb_request_encode(request, arena.ptr()); send_message_payload_ = grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_slice_unref_internal(request_payload_slice); - grpc_grpclb_request_destroy(request); // Init other data associated with the LB call. grpc_metadata_array_init(&lb_initial_metadata_recv_); grpc_metadata_array_init(&lb_trailing_metadata_recv_); @@ -940,27 +941,32 @@ void GrpcLb::BalancerCallState::MaybeSendClientLoadReportLocked( bool GrpcLb::BalancerCallState::LoadReportCountersAreZero( grpc_grpclb_request* request) { - GrpcLbClientStats::DroppedCallCounts* drop_entries = - static_cast( - request->client_stats.calls_finished_with_drop.arg); - return request->client_stats.num_calls_started == 0 && - request->client_stats.num_calls_finished == 0 && - request->client_stats.num_calls_finished_with_client_failed_to_send == + const grpc_lb_v1_ClientStats* cstats = + grpc_lb_v1_LoadBalanceRequest_client_stats(request); + if (cstats == nullptr) { + return true; + } + size_t drop_count; + grpc_lb_v1_ClientStats_calls_finished_with_drop(cstats, &drop_count); + return grpc_lb_v1_ClientStats_num_calls_started(cstats) == 0 && + grpc_lb_v1_ClientStats_num_calls_finished(cstats) == 0 && + grpc_lb_v1_ClientStats_num_calls_finished_with_client_failed_to_send( + cstats) == 0 && + grpc_lb_v1_ClientStats_num_calls_finished_known_received(cstats) == 0 && - request->client_stats.num_calls_finished_known_received == 0 && - (drop_entries == nullptr || drop_entries->size() == 0); + drop_count == 0; } void GrpcLb::BalancerCallState::SendClientLoadReportLocked() { // Construct message payload. GPR_ASSERT(send_message_payload_ == nullptr); + upb::Arena arena; grpc_grpclb_request* request = - grpc_grpclb_load_report_request_create(client_stats_.get()); + grpc_grpclb_load_report_request_create(client_stats_.get(), arena.ptr()); // Skip client load report if the counters were all zero in the last // report and they are still zero in this one. if (LoadReportCountersAreZero(request)) { if (last_client_load_report_counters_were_zero_) { - grpc_grpclb_request_destroy(request); ScheduleNextClientLoadReportLocked(); return; } @@ -968,11 +974,11 @@ void GrpcLb::BalancerCallState::SendClientLoadReportLocked() { } else { last_client_load_report_counters_were_zero_ = false; } - grpc_slice request_payload_slice = grpc_grpclb_request_encode(request); + grpc_slice request_payload_slice = + grpc_grpclb_request_encode(request, arena.ptr()); send_message_payload_ = grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_slice_unref_internal(request_payload_slice); - grpc_grpclb_request_destroy(request); // Send the report. grpc_op op; memset(&op, 0, sizeof(op)); @@ -1034,16 +1040,20 @@ void GrpcLb::BalancerCallState::OnBalancerMessageReceivedLocked( grpc_byte_buffer_reader_destroy(&bbr); grpc_byte_buffer_destroy(lb_calld->recv_message_payload_); lb_calld->recv_message_payload_ = nullptr; - grpc_grpclb_initial_response* initial_response; + const grpc_grpclb_initial_response* initial_response; grpc_grpclb_serverlist* serverlist; + upb::Arena arena; if (!lb_calld->seen_initial_response_ && - (initial_response = grpc_grpclb_initial_response_parse(response_slice)) != - nullptr) { + (initial_response = grpc_grpclb_initial_response_parse( + response_slice, arena.ptr())) != nullptr) { // Have NOT seen initial response, look for initial response. - if (initial_response->has_client_stats_report_interval) { - lb_calld->client_stats_report_interval_ = GPR_MAX( - GPR_MS_PER_SEC, grpc_grpclb_duration_to_millis( - &initial_response->client_stats_report_interval)); + const google_protobuf_Duration* client_stats_report_interval = + grpc_lb_v1_InitialLoadBalanceResponse_client_stats_report_interval( + initial_response); + if (client_stats_report_interval != nullptr) { + lb_calld->client_stats_report_interval_ = + GPR_MAX(GPR_MS_PER_SEC, + grpc_grpclb_duration_to_millis(client_stats_report_interval)); if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_glb_trace)) { gpr_log(GPR_INFO, "[grpclb %p] lb_calld=%p: Received initial LB response " @@ -1058,7 +1068,6 @@ void GrpcLb::BalancerCallState::OnBalancerMessageReceivedLocked( "client load reporting NOT enabled", grpclb_policy, lb_calld); } - grpc_grpclb_initial_response_destroy(initial_response); lb_calld->seen_initial_response_ = true; } else if ((serverlist = grpc_grpclb_response_parse_serverlist( response_slice)) != nullptr) { diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc index 22cefc937b0..68097e14a4e 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc @@ -18,213 +18,154 @@ #include -#include "pb_decode.h" -#include "pb_encode.h" #include "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h" +#include "src/core/lib/gpr/useful.h" -#include - -/* invoked once for every Server in ServerList */ -static bool count_serverlist(pb_istream_t* stream, const pb_field_t* field, - void** arg) { - grpc_grpclb_serverlist* sl = static_cast(*arg); - grpc_grpclb_server server; - if (GPR_UNLIKELY(!pb_decode(stream, grpc_lb_v1_Server_fields, &server))) { - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(stream)); - return false; - } - ++sl->num_servers; - return true; -} - -typedef struct decode_serverlist_arg { - /* The decoding callback is invoked once per server in serverlist. Remember - * which index of the serverlist are we currently decoding */ - size_t decoding_idx; - /* The decoded serverlist */ - grpc_grpclb_serverlist* serverlist; -} decode_serverlist_arg; +#include "google/protobuf/duration.upb.h" +#include "google/protobuf/timestamp.upb.h" -/* invoked once for every Server in ServerList */ -static bool decode_serverlist(pb_istream_t* stream, const pb_field_t* field, - void** arg) { - decode_serverlist_arg* dec_arg = static_cast(*arg); - GPR_ASSERT(dec_arg->serverlist->num_servers >= dec_arg->decoding_idx); - grpc_grpclb_server* server = - static_cast(gpr_zalloc(sizeof(grpc_grpclb_server))); - if (GPR_UNLIKELY(!pb_decode(stream, grpc_lb_v1_Server_fields, server))) { - gpr_free(server); - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(stream)); - return false; - } - dec_arg->serverlist->servers[dec_arg->decoding_idx++] = server; - return true; -} +#include -grpc_grpclb_request* grpc_grpclb_request_create(const char* lb_service_name) { - grpc_grpclb_request* req = static_cast( - gpr_malloc(sizeof(grpc_grpclb_request))); - req->has_client_stats = false; - req->has_initial_request = true; - req->initial_request.has_name = true; - // GCC warns (-Wstringop-truncation) because the destination - // buffer size is identical to max-size, leading to a potential - // char[] with no null terminator. nanopb can handle it fine, - // and parantheses around strncpy silence that compiler warning. - (strncpy(req->initial_request.name, lb_service_name, - GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH)); +namespace grpc_core { + +grpc_grpclb_request* grpc_grpclb_request_create(const char* lb_service_name, + upb_arena* arena) { + grpc_grpclb_request* req = grpc_lb_v1_LoadBalanceRequest_new(arena); + grpc_lb_v1_InitialLoadBalanceRequest* initial_request = + grpc_lb_v1_LoadBalanceRequest_mutable_initial_request(req, arena); + size_t name_len = + GPR_MIN(strlen(lb_service_name), GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH); + grpc_lb_v1_InitialLoadBalanceRequest_set_name( + initial_request, upb_strview_make(lb_service_name, name_len)); return req; } -static void populate_timestamp(gpr_timespec timestamp, - grpc_grpclb_timestamp* timestamp_pb) { - timestamp_pb->has_seconds = true; - timestamp_pb->seconds = timestamp.tv_sec; - timestamp_pb->has_nanos = true; - timestamp_pb->nanos = timestamp.tv_nsec; -} +namespace { -static bool encode_string(pb_ostream_t* stream, const pb_field_t* field, - void* const* arg) { - char* str = static_cast(*arg); - if (!pb_encode_tag_for_field(stream, field)) return false; - return pb_encode_string(stream, reinterpret_cast(str), strlen(str)); +void google_protobuf_Timestamp_assign(google_protobuf_Timestamp* timestamp, + const gpr_timespec& value) { + google_protobuf_Timestamp_set_seconds(timestamp, value.tv_sec); + google_protobuf_Timestamp_set_nanos(timestamp, value.tv_nsec); } -static bool encode_drops(pb_ostream_t* stream, const pb_field_t* field, - void* const* arg) { - grpc_core::GrpcLbClientStats::DroppedCallCounts* drop_entries = - static_cast(*arg); - if (drop_entries == nullptr) return true; - for (size_t i = 0; i < drop_entries->size(); ++i) { - if (!pb_encode_tag_for_field(stream, field)) return false; - grpc_lb_v1_ClientStatsPerToken drop_message; - drop_message.load_balance_token.funcs.encode = encode_string; - drop_message.load_balance_token.arg = (*drop_entries)[i].token.get(); - drop_message.has_num_calls = true; - drop_message.num_calls = (*drop_entries)[i].count; - if (!pb_encode_submessage(stream, grpc_lb_v1_ClientStatsPerToken_fields, - &drop_message)) { - return false; - } - } - return true; -} +} // namespace grpc_grpclb_request* grpc_grpclb_load_report_request_create( - grpc_core::GrpcLbClientStats* client_stats) { - grpc_grpclb_request* req = static_cast( - gpr_zalloc(sizeof(grpc_grpclb_request))); - req->has_client_stats = true; - req->client_stats.has_timestamp = true; - populate_timestamp(gpr_now(GPR_CLOCK_REALTIME), &req->client_stats.timestamp); - req->client_stats.has_num_calls_started = true; - req->client_stats.has_num_calls_finished = true; - req->client_stats.has_num_calls_finished_with_client_failed_to_send = true; - req->client_stats.has_num_calls_finished_with_client_failed_to_send = true; - req->client_stats.has_num_calls_finished_known_received = true; - req->client_stats.calls_finished_with_drop.funcs.encode = encode_drops; - grpc_core::UniquePtr - drop_counts; - client_stats->Get( - &req->client_stats.num_calls_started, - &req->client_stats.num_calls_finished, - &req->client_stats.num_calls_finished_with_client_failed_to_send, - &req->client_stats.num_calls_finished_known_received, &drop_counts); - // Will be deleted in grpc_grpclb_request_destroy(). - req->client_stats.calls_finished_with_drop.arg = drop_counts.release(); + GrpcLbClientStats* client_stats, upb_arena* arena) { + grpc_grpclb_request* req = grpc_lb_v1_LoadBalanceRequest_new(arena); + grpc_lb_v1_ClientStats* req_stats = + grpc_lb_v1_LoadBalanceRequest_mutable_client_stats(req, arena); + google_protobuf_Timestamp_assign( + grpc_lb_v1_ClientStats_mutable_timestamp(req_stats, arena), + gpr_now(GPR_CLOCK_REALTIME)); + + int64_t num_calls_started; + int64_t num_calls_finished; + int64_t num_calls_finished_with_client_failed_to_send; + int64_t num_calls_finished_known_received; + UniquePtr drop_token_counts; + client_stats->Get(&num_calls_started, &num_calls_finished, + &num_calls_finished_with_client_failed_to_send, + &num_calls_finished_known_received, &drop_token_counts); + grpc_lb_v1_ClientStats_set_num_calls_started(req_stats, num_calls_started); + grpc_lb_v1_ClientStats_set_num_calls_finished(req_stats, num_calls_finished); + grpc_lb_v1_ClientStats_set_num_calls_finished_with_client_failed_to_send( + req_stats, num_calls_finished_with_client_failed_to_send); + grpc_lb_v1_ClientStats_set_num_calls_finished_known_received( + req_stats, num_calls_finished_known_received); + if (drop_token_counts != nullptr) { + for (size_t i = 0; i < drop_token_counts->size(); ++i) { + GrpcLbClientStats::DropTokenCount& cur = (*drop_token_counts)[i]; + grpc_lb_v1_ClientStatsPerToken* cur_msg = + grpc_lb_v1_ClientStats_add_calls_finished_with_drop(req_stats, arena); + + const size_t token_len = strlen(cur.token.get()); + char* token = reinterpret_cast(upb_arena_malloc(arena, token_len)); + memcpy(token, cur.token.get(), token_len); + + grpc_lb_v1_ClientStatsPerToken_set_load_balance_token( + cur_msg, upb_strview_make(token, token_len)); + grpc_lb_v1_ClientStatsPerToken_set_num_calls(cur_msg, cur.count); + } + } return req; } -grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request* request) { - size_t encoded_length; - pb_ostream_t sizestream; - pb_ostream_t outputstream; - grpc_slice slice; - memset(&sizestream, 0, sizeof(pb_ostream_t)); - pb_encode(&sizestream, grpc_lb_v1_LoadBalanceRequest_fields, request); - encoded_length = sizestream.bytes_written; - - slice = GRPC_SLICE_MALLOC(encoded_length); - outputstream = - pb_ostream_from_buffer(GRPC_SLICE_START_PTR(slice), encoded_length); - GPR_ASSERT(pb_encode(&outputstream, grpc_lb_v1_LoadBalanceRequest_fields, - request) != 0); - return slice; -} - -void grpc_grpclb_request_destroy(grpc_grpclb_request* request) { - if (request->has_client_stats) { - grpc_core::GrpcLbClientStats::DroppedCallCounts* drop_entries = - static_cast( - request->client_stats.calls_finished_with_drop.arg); - grpc_core::Delete(drop_entries); - } - gpr_free(request); +grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request* request, + upb_arena* arena) { + size_t buf_length; + char* buf = + grpc_lb_v1_LoadBalanceRequest_serialize(request, arena, &buf_length); + return grpc_slice_from_copied_buffer(buf, buf_length); } -typedef grpc_lb_v1_LoadBalanceResponse grpc_grpclb_response; -grpc_grpclb_initial_response* grpc_grpclb_initial_response_parse( - const grpc_slice& encoded_grpc_grpclb_response) { - pb_istream_t stream = pb_istream_from_buffer( - const_cast(GRPC_SLICE_START_PTR(encoded_grpc_grpclb_response)), - GRPC_SLICE_LENGTH(encoded_grpc_grpclb_response)); - grpc_grpclb_response res; - memset(&res, 0, sizeof(grpc_grpclb_response)); - if (GPR_UNLIKELY( - !pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, &res))) { - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream)); +const grpc_grpclb_initial_response* grpc_grpclb_initial_response_parse( + const grpc_slice& encoded_grpc_grpclb_response, upb_arena* arena) { + grpc_lb_v1_LoadBalanceResponse* response = + grpc_lb_v1_LoadBalanceResponse_parse( + reinterpret_cast( + GRPC_SLICE_START_PTR(encoded_grpc_grpclb_response)), + GRPC_SLICE_LENGTH(encoded_grpc_grpclb_response), arena); + if (response == nullptr) { + gpr_log(GPR_ERROR, "grpc_lb_v1_LoadBalanceResponse parse error"); return nullptr; } - - if (!res.has_initial_response) return nullptr; - - grpc_grpclb_initial_response* initial_res = - static_cast( - gpr_malloc(sizeof(grpc_grpclb_initial_response))); - memcpy(initial_res, &res.initial_response, - sizeof(grpc_grpclb_initial_response)); - - return initial_res; + return grpc_lb_v1_LoadBalanceResponse_initial_response(response); } grpc_grpclb_serverlist* grpc_grpclb_response_parse_serverlist( const grpc_slice& encoded_grpc_grpclb_response) { - pb_istream_t stream = pb_istream_from_buffer( - const_cast(GRPC_SLICE_START_PTR(encoded_grpc_grpclb_response)), - GRPC_SLICE_LENGTH(encoded_grpc_grpclb_response)); - pb_istream_t stream_at_start = stream; - grpc_grpclb_serverlist* sl = static_cast( + upb::Arena arena; + grpc_lb_v1_LoadBalanceResponse* response = + grpc_lb_v1_LoadBalanceResponse_parse( + reinterpret_cast( + GRPC_SLICE_START_PTR(encoded_grpc_grpclb_response)), + GRPC_SLICE_LENGTH(encoded_grpc_grpclb_response), arena.ptr()); + if (response == nullptr) { + gpr_log(GPR_ERROR, "grpc_lb_v1_LoadBalanceResponse parse error"); + return nullptr; + } + grpc_grpclb_serverlist* server_list = static_cast( gpr_zalloc(sizeof(grpc_grpclb_serverlist))); - grpc_grpclb_response res; - memset(&res, 0, sizeof(grpc_grpclb_response)); // First pass: count number of servers. - res.server_list.servers.funcs.decode = count_serverlist; - res.server_list.servers.arg = sl; - bool status = pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, &res); - if (GPR_UNLIKELY(!status)) { - gpr_free(sl); - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream)); - return nullptr; + const grpc_lb_v1_ServerList* server_list_msg = + grpc_lb_v1_LoadBalanceResponse_server_list(response); + size_t server_count = 0; + const grpc_lb_v1_Server* const* servers = nullptr; + if (server_list_msg != nullptr) { + servers = grpc_lb_v1_ServerList_servers(server_list_msg, &server_count); } // Second pass: populate servers. - if (sl->num_servers > 0) { - sl->servers = static_cast( - gpr_zalloc(sizeof(grpc_grpclb_server*) * sl->num_servers)); - decode_serverlist_arg decode_arg; - memset(&decode_arg, 0, sizeof(decode_arg)); - decode_arg.serverlist = sl; - res.server_list.servers.funcs.decode = decode_serverlist; - res.server_list.servers.arg = &decode_arg; - status = pb_decode(&stream_at_start, grpc_lb_v1_LoadBalanceResponse_fields, - &res); - if (GPR_UNLIKELY(!status)) { - grpc_grpclb_destroy_serverlist(sl); - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream)); - return nullptr; + if (server_count > 0) { + server_list->servers = static_cast( + gpr_zalloc(sizeof(grpc_grpclb_server*) * server_count)); + server_list->num_servers = server_count; + for (size_t i = 0; i < server_count; ++i) { + grpc_grpclb_server* cur = server_list->servers[i] = + static_cast( + gpr_zalloc(sizeof(grpc_grpclb_server))); + upb_strview address = grpc_lb_v1_Server_ip_address(servers[i]); + if (address.size == 0) { + ; // Nothing to do because cur->ip_address is an empty string. + } else if (address.size <= GRPC_GRPCLB_SERVER_IP_ADDRESS_MAX_SIZE) { + cur->ip_address.size = static_cast(address.size); + memcpy(cur->ip_address.data, address.data, address.size); + } + cur->port = grpc_lb_v1_Server_port(servers[i]); + upb_strview token = grpc_lb_v1_Server_load_balance_token(servers[i]); + if (token.size == 0) { + ; // Nothing to do because cur->load_balance_token is an empty string. + } else if (token.size <= GRPC_GRPCLB_SERVER_LOAD_BALANCE_TOKEN_MAX_SIZE) { + memcpy(cur->load_balance_token, token.data, token.size); + } else { + gpr_log(GPR_ERROR, + "grpc_lb_v1_LoadBalanceResponse has too long token. len=%zu", + token.size); + } + cur->drop = grpc_lb_v1_Server_drop(servers[i]); } } - return sl; + return server_list; } void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist* serverlist) { @@ -239,16 +180,17 @@ void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist* serverlist) { } grpc_grpclb_serverlist* grpc_grpclb_serverlist_copy( - const grpc_grpclb_serverlist* sl) { + const grpc_grpclb_serverlist* server_list) { grpc_grpclb_serverlist* copy = static_cast( gpr_zalloc(sizeof(grpc_grpclb_serverlist))); - copy->num_servers = sl->num_servers; + copy->num_servers = server_list->num_servers; copy->servers = static_cast( - gpr_malloc(sizeof(grpc_grpclb_server*) * sl->num_servers)); - for (size_t i = 0; i < sl->num_servers; i++) { + gpr_malloc(sizeof(grpc_grpclb_server*) * server_list->num_servers)); + for (size_t i = 0; i < server_list->num_servers; i++) { copy->servers[i] = static_cast( gpr_malloc(sizeof(grpc_grpclb_server))); - memcpy(copy->servers[i], sl->servers[i], sizeof(grpc_grpclb_server)); + memcpy(copy->servers[i], server_list->servers[i], + sizeof(grpc_grpclb_server)); } return copy; } @@ -274,38 +216,11 @@ bool grpc_grpclb_server_equals(const grpc_grpclb_server* lhs, return memcmp(lhs, rhs, sizeof(grpc_grpclb_server)) == 0; } -int grpc_grpclb_duration_compare(const grpc_grpclb_duration* lhs, - const grpc_grpclb_duration* rhs) { - GPR_ASSERT(lhs && rhs); - if (lhs->has_seconds && rhs->has_seconds) { - if (lhs->seconds < rhs->seconds) return -1; - if (lhs->seconds > rhs->seconds) return 1; - } else if (lhs->has_seconds) { - return 1; - } else if (rhs->has_seconds) { - return -1; - } - - GPR_ASSERT(lhs->seconds == rhs->seconds); - if (lhs->has_nanos && rhs->has_nanos) { - if (lhs->nanos < rhs->nanos) return -1; - if (lhs->nanos > rhs->nanos) return 1; - } else if (lhs->has_nanos) { - return 1; - } else if (rhs->has_nanos) { - return -1; - } - - return 0; -} - -grpc_millis grpc_grpclb_duration_to_millis(grpc_grpclb_duration* duration_pb) { +grpc_millis grpc_grpclb_duration_to_millis( + const grpc_grpclb_duration* duration_pb) { return static_cast( - (duration_pb->has_seconds ? duration_pb->seconds : 0) * GPR_MS_PER_SEC + - (duration_pb->has_nanos ? duration_pb->nanos : 0) / GPR_NS_PER_MS); + google_protobuf_Duration_seconds(duration_pb) * GPR_MS_PER_SEC + + google_protobuf_Duration_nanos(duration_pb) / GPR_NS_PER_MS); } -void grpc_grpclb_initial_response_destroy( - grpc_grpclb_initial_response* response) { - gpr_free(response); -} +} // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h index 8005f6fe301..3062e9526ae 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h @@ -24,38 +24,57 @@ #include #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h" -#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h" #include "src/core/lib/iomgr/exec_ctx.h" +#include "src/proto/grpc/lb/v1/load_balancer.upb.h" #define GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH 128 +#define GRPC_GRPCLB_SERVER_IP_ADDRESS_MAX_SIZE 16 +#define GRPC_GRPCLB_SERVER_LOAD_BALANCE_TOKEN_MAX_SIZE 50 + +namespace grpc_core { -typedef grpc_lb_v1_Server_ip_address_t grpc_grpclb_ip_address; typedef grpc_lb_v1_LoadBalanceRequest grpc_grpclb_request; +typedef grpc_lb_v1_LoadBalanceResponse grpc_grpclb_response; typedef grpc_lb_v1_InitialLoadBalanceResponse grpc_grpclb_initial_response; -typedef grpc_lb_v1_Server grpc_grpclb_server; typedef google_protobuf_Duration grpc_grpclb_duration; typedef google_protobuf_Timestamp grpc_grpclb_timestamp; +typedef struct { + int32_t size; + char data[GRPC_GRPCLB_SERVER_IP_ADDRESS_MAX_SIZE]; +} grpc_grpclb_server_ip_address; + +// Contains server information. When the drop field is not true, use the other +// fields. +typedef struct { + grpc_grpclb_server_ip_address ip_address; + int32_t port; + char load_balance_token[GRPC_GRPCLB_SERVER_LOAD_BALANCE_TOKEN_MAX_SIZE]; + bool drop; +} grpc_grpclb_server; + typedef struct { grpc_grpclb_server** servers; size_t num_servers; } grpc_grpclb_serverlist; -/** Create a request for a gRPC LB service under \a lb_service_name */ -grpc_grpclb_request* grpc_grpclb_request_create(const char* lb_service_name); +/** + * Create a request for a gRPC LB service under \a lb_service_name. + * \a lb_service_name should be alive when returned request is being used. + */ +grpc_grpclb_request* grpc_grpclb_request_create(const char* lb_service_name, + upb_arena* arena); grpc_grpclb_request* grpc_grpclb_load_report_request_create( - grpc_core::GrpcLbClientStats* client_stats); + grpc_core::GrpcLbClientStats* client_stats, upb_arena* arena); /** Protocol Buffers v3-encode \a request */ -grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request* request); - -/** Destroy \a request */ -void grpc_grpclb_request_destroy(grpc_grpclb_request* request); +grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request* request, + upb_arena* arena); /** Parse (ie, decode) the bytes in \a encoded_grpc_grpclb_response as a \a * grpc_grpclb_initial_response */ -grpc_grpclb_initial_response* grpc_grpclb_initial_response_parse( - const grpc_slice& encoded_grpc_grpclb_response); +const grpc_grpclb_initial_response* grpc_grpclb_initial_response_parse( + const grpc_slice& encoded_grpc_grpclb_response, upb_arena* arena); /** Parse the list of servers from an encoded \a grpc_grpclb_response */ grpc_grpclb_serverlist* grpc_grpclb_response_parse_serverlist( @@ -75,16 +94,10 @@ bool grpc_grpclb_server_equals(const grpc_grpclb_server* lhs, /** Destroy \a serverlist */ void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist* serverlist); -/** Compare \a lhs against \a rhs and return 0 if \a lhs and \a rhs are equal, - * < 0 if \a lhs represents a duration shorter than \a rhs and > 0 otherwise */ -int grpc_grpclb_duration_compare(const grpc_grpclb_duration* lhs, - const grpc_grpclb_duration* rhs); - -grpc_millis grpc_grpclb_duration_to_millis(grpc_grpclb_duration* duration_pb); +grpc_millis grpc_grpclb_duration_to_millis( + const grpc_grpclb_duration* duration_pb); -/** Destroy \a initial_response */ -void grpc_grpclb_initial_response_destroy( - grpc_grpclb_initial_response* response); +} // namespace grpc_core #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_LOAD_BALANCER_API_H \ */ diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index ec5b79d965b..8138b2a6264 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -373,14 +373,22 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', + 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', + 'src/core/ext/upb-generated/google/protobuf/any.upb.c', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', + 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', 'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc', diff --git a/test/core/nanopb/fuzzer_response.cc b/test/core/nanopb/fuzzer_response.cc index 3a70dea5e98..1f35eac8f64 100644 --- a/test/core/nanopb/fuzzer_response.cc +++ b/test/core/nanopb/fuzzer_response.cc @@ -33,10 +33,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_init(); if (squelch) gpr_set_log_function(dont_log); grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); - grpc_grpclb_initial_response* response; - if ((response = grpc_grpclb_initial_response_parse(slice))) { - grpc_grpclb_initial_response_destroy(response); - } + upb::Arena arena; + grpc_core::grpc_grpclb_initial_response_parse(slice, arena.ptr()); grpc_slice_unref(slice); grpc_shutdown(); return 0; diff --git a/test/core/nanopb/fuzzer_serverlist.cc b/test/core/nanopb/fuzzer_serverlist.cc index d0af117ef96..079fbd34be1 100644 --- a/test/core/nanopb/fuzzer_serverlist.cc +++ b/test/core/nanopb/fuzzer_serverlist.cc @@ -33,8 +33,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_init(); if (squelch) gpr_set_log_function(dont_log); grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); - grpc_grpclb_serverlist* serverlist; - if ((serverlist = grpc_grpclb_response_parse_serverlist(slice))) { + grpc_core::grpc_grpclb_serverlist* serverlist; + if ((serverlist = grpc_core::grpc_grpclb_response_parse_serverlist(slice))) { grpc_grpclb_destroy_serverlist(serverlist); } grpc_slice_unref(slice); diff --git a/test/cpp/grpclb/grpclb_api_test.cc b/test/cpp/grpclb/grpclb_api_test.cc index 0ace512c278..62e7c06bbb8 100644 --- a/test/cpp/grpclb/grpclb_api_test.cc +++ b/test/cpp/grpclb/grpclb_api_test.cc @@ -20,6 +20,7 @@ #include #include +#include "google/protobuf/duration.upb.h" #include "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/sockaddr_utils.h" @@ -44,7 +45,8 @@ grpc::string Ip4ToPackedString(const char* ip_str) { return grpc::string(reinterpret_cast(&ip4), sizeof(ip4)); } -grpc::string PackedStringToIp(const grpc_grpclb_ip_address& pb_ip) { +grpc::string PackedStringToIp( + const grpc_core::grpc_grpclb_server_ip_address& pb_ip) { char ip_str[46] = {0}; int af = -1; if (pb_ip.size == 4) { @@ -54,21 +56,22 @@ grpc::string PackedStringToIp(const grpc_grpclb_ip_address& pb_ip) { } else { abort(); } - GPR_ASSERT(inet_ntop(af, (void*)pb_ip.bytes, ip_str, 46) != nullptr); + GPR_ASSERT(inet_ntop(af, (void*)pb_ip.data, ip_str, 46) != nullptr); return ip_str; } TEST_F(GrpclbTest, CreateRequest) { const grpc::string service_name = "AServiceName"; LoadBalanceRequest request; - grpc_grpclb_request* c_req = grpc_grpclb_request_create(service_name.c_str()); - grpc_slice slice = grpc_grpclb_request_encode(c_req); + upb::Arena arena; + grpc_core::grpc_grpclb_request* c_req = + grpc_core::grpc_grpclb_request_create(service_name.c_str(), arena.ptr()); + grpc_slice slice = grpc_core::grpc_grpclb_request_encode(c_req, arena.ptr()); const int num_bytes_written = GRPC_SLICE_LENGTH(slice); EXPECT_GT(num_bytes_written, 0); request.ParseFromArray(GRPC_SLICE_START_PTR(slice), num_bytes_written); EXPECT_EQ(request.initial_request().name(), service_name); grpc_slice_unref(slice); - grpc_grpclb_request_destroy(c_req); } TEST_F(GrpclbTest, ParseInitialResponse) { @@ -82,13 +85,21 @@ TEST_F(GrpclbTest, ParseInitialResponse) { grpc_slice encoded_slice = grpc_slice_from_copied_string(encoded_response.c_str()); - grpc_grpclb_initial_response* c_initial_response = - grpc_grpclb_initial_response_parse(encoded_slice); - EXPECT_FALSE(c_initial_response->has_load_balancer_delegate); - EXPECT_EQ(c_initial_response->client_stats_report_interval.seconds, 123); - EXPECT_EQ(c_initial_response->client_stats_report_interval.nanos, 456); + upb::Arena arena; + const grpc_core::grpc_grpclb_initial_response* c_initial_response = + grpc_core::grpc_grpclb_initial_response_parse(encoded_slice, arena.ptr()); + + upb_strview load_balancer_delegate = + grpc_lb_v1_InitialLoadBalanceResponse_load_balancer_delegate( + c_initial_response); + EXPECT_EQ(load_balancer_delegate.size, 0); + + const google_protobuf_Duration* report_interval = + grpc_lb_v1_InitialLoadBalanceResponse_client_stats_report_interval( + c_initial_response); + EXPECT_EQ(google_protobuf_Duration_seconds(report_interval), 123); + EXPECT_EQ(google_protobuf_Duration_nanos(report_interval), 456); grpc_slice_unref(encoded_slice); - grpc_grpclb_initial_response_destroy(c_initial_response); } TEST_F(GrpclbTest, ParseResponseServerList) { @@ -108,16 +119,14 @@ TEST_F(GrpclbTest, ParseResponseServerList) { const grpc::string encoded_response = response.SerializeAsString(); const grpc_slice encoded_slice = grpc_slice_from_copied_buffer( encoded_response.data(), encoded_response.size()); - grpc_grpclb_serverlist* c_serverlist = - grpc_grpclb_response_parse_serverlist(encoded_slice); + grpc_core::grpc_grpclb_serverlist* c_serverlist = + grpc_core::grpc_grpclb_response_parse_serverlist(encoded_slice); ASSERT_EQ(c_serverlist->num_servers, 2ul); - EXPECT_TRUE(c_serverlist->servers[0]->has_ip_address); EXPECT_EQ(PackedStringToIp(c_serverlist->servers[0]->ip_address), "127.0.0.1"); EXPECT_EQ(c_serverlist->servers[0]->port, 12345); EXPECT_STREQ(c_serverlist->servers[0]->load_balance_token, "rate_limting"); EXPECT_TRUE(c_serverlist->servers[0]->drop); - EXPECT_TRUE(c_serverlist->servers[1]->has_ip_address); EXPECT_EQ(PackedStringToIp(c_serverlist->servers[1]->ip_address), "10.0.0.1"); EXPECT_EQ(c_serverlist->servers[1]->port, 54321); diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 58d719c438e..e15778c276b 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1064,8 +1064,24 @@ src/core/ext/transport/chttp2/transport/writing.cc \ src/core/ext/transport/inproc/inproc_plugin.cc \ src/core/ext/transport/inproc/inproc_transport.cc \ src/core/ext/transport/inproc/inproc_transport.h \ +src/core/ext/upb-generated/google/protobuf/any.upb.c \ +src/core/ext/upb-generated/google/protobuf/any.upb.h \ +src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ +src/core/ext/upb-generated/google/protobuf/descriptor.upb.h \ +src/core/ext/upb-generated/google/protobuf/duration.upb.c \ +src/core/ext/upb-generated/google/protobuf/duration.upb.h \ +src/core/ext/upb-generated/google/protobuf/empty.upb.c \ +src/core/ext/upb-generated/google/protobuf/empty.upb.h \ +src/core/ext/upb-generated/google/protobuf/struct.upb.c \ +src/core/ext/upb-generated/google/protobuf/struct.upb.h \ +src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ +src/core/ext/upb-generated/google/protobuf/timestamp.upb.h \ +src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ +src/core/ext/upb-generated/google/protobuf/wrappers.upb.h \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h \ +src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ +src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h \ src/core/lib/README.md \ src/core/lib/avl/avl.cc \ src/core/lib/avl/avl.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 3278e997e6b..eea82fd730c 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -9294,9 +9294,8 @@ "gpr", "grpc_base", "grpc_client_channel", + "grpc_lb_upb", "grpc_resolver_fake", - "grpclb_proto", - "nanopb", "upb" ], "headers": [ @@ -9329,10 +9328,9 @@ "gpr", "grpc_base", "grpc_client_channel", + "grpc_lb_upb", "grpc_resolver_fake", "grpc_secure", - "grpclb_proto", - "nanopb", "upb" ], "headers": [ @@ -9401,8 +9399,7 @@ "grpc_client_channel", "grpc_resolver_fake", "grpclb_proto", - "nanopb", - "upb" + "nanopb" ], "headers": [ "src/core/ext/filters/client_channel/lb_policy/xds/xds.h", @@ -9434,8 +9431,7 @@ "grpc_resolver_fake", "grpc_secure", "grpclb_proto", - "nanopb", - "upb" + "nanopb" ], "headers": [ "src/core/ext/filters/client_channel/lb_policy/xds/xds.h", From 8a301a438ac0dfd4311157bd3e62f6880bc19ede Mon Sep 17 00:00:00 2001 From: Yihua Zhang Date: Wed, 7 Aug 2019 14:33:09 -0700 Subject: [PATCH 231/661] revision 1 --- src/core/tsi/ssl_transport_security.cc | 6 +-- src/core/tsi/ssl_transport_security.h | 4 +- src/core/tsi/test_creds/multi-domain.key | 50 ++++++++++---------- src/core/tsi/test_creds/multi-domain.pem | 42 ++++++++-------- test/core/tsi/ssl_transport_security_test.cc | 21 ++++++-- 5 files changed, 69 insertions(+), 54 deletions(-) diff --git a/src/core/tsi/ssl_transport_security.cc b/src/core/tsi/ssl_transport_security.cc index f3982fa1caa..32a96b23f29 100644 --- a/src/core/tsi/ssl_transport_security.cc +++ b/src/core/tsi/ssl_transport_security.cc @@ -711,8 +711,8 @@ static tsi_result populate_ssl_context( } /* Extracts the CN and the SANs from an X509 cert as a peer object. */ -tsi_result extract_x509_subject_names_from_pem_cert(const char* pem_cert, - tsi_peer* peer) { +tsi_result tsi_ssl_extract_x509_subject_names_from_pem_cert( + const char* pem_cert, tsi_peer* peer) { tsi_result result = TSI_OK; X509* cert = nullptr; BIO* pem; @@ -1890,7 +1890,7 @@ tsi_result tsi_create_ssl_server_handshaker_factory_with_options( } /* TODO(jboeuf): Add revocation verification. */ - result = extract_x509_subject_names_from_pem_cert( + result = tsi_ssl_extract_x509_subject_names_from_pem_cert( options->pem_key_cert_pairs[i].cert_chain, &impl->ssl_context_x509_subject_names[i]); if (result != TSI_OK) break; diff --git a/src/core/tsi/ssl_transport_security.h b/src/core/tsi/ssl_transport_security.h index 638c088442c..04f038ac3b4 100644 --- a/src/core/tsi/ssl_transport_security.h +++ b/src/core/tsi/ssl_transport_security.h @@ -333,7 +333,7 @@ const tsi_ssl_handshaker_factory_vtable* tsi_ssl_handshaker_factory_swap_vtable( tsi_ssl_handshaker_factory_vtable* new_vtable); /* Exposed for testing only. */ -tsi_result extract_x509_subject_names_from_pem_cert(const char* pem_cert, - tsi_peer* peer); +tsi_result tsi_ssl_extract_x509_subject_names_from_pem_cert( + const char* pem_cert, tsi_peer* peer); #endif /* GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/test_creds/multi-domain.key b/src/core/tsi/test_creds/multi-domain.key index 59008191888..74e8122e186 100644 --- a/src/core/tsi/test_creds/multi-domain.key +++ b/src/core/tsi/test_creds/multi-domain.key @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEA1e+GwyVNsoKu7PqvOf/EubN45rB5o5PQF9A5fBPpiBtKZdvb -bOouGlulRwaMQOLDZi9M6l/AhE1b207+iSBTn9jSQT0elaYwVtKgb/qoehQjFAG8 -BckPmA9E4SDx2Ug9AtV3rTVs4V2yaDHNSfDSXQ2PS9fuIx7FK5mMnUM2fjskcZqu -HV5f8McXEtvpuTktnb+KDgETO0Cdu3+rf/RtraTuKZb0kmAgf+KaNWDL2j5QsFKa -6sT4812Vfwaevm9qKOtzgAFobCwdVt+Ap/B0XWj4CmzJMPN/SXESluoBHszmTi6Q -mkTEzYbzmD/ObyTxXVKu46kRVmJKXh6BE1wk2QIDAQABAoIBAQDPpS8OFhT14LXc -Oez9xGyzOaltb3iA9qURl/9TmRggDS0G9IBjlGCvIKio6YgUKoUxl1N2YP3A7Dzt -/hw8CG5iRda9j48x/R4KB2HFjmscIpNxhcVzcBV8p8VZJdrX5K+jIoKIUcSecY0K -aNwymlX0D4c4PBtdZy5FBUJgGa64kPQqd+1Ha4cKgD9+oZzSo5Me04cGV7gWqBGt -qY9KL9j8RGA5m+CHu4Qi2ZXnFlkeH/teXuH5AhFzxeYZG4ZwtXCTjNXxQelVNbYw -mIOnADvd+RhJoeLZnGdM/gyFfLpJW6rtqva9l4h2qxKxnO3CcYHwac475wE49ukv -qx027fopAoGBAPTXRsXRHnK+ZZbj1mafFXeM4G+f8QMLxaSP/za6uYKd1BihXurr -NUhYCQ+d6E+HXnCsYQcfR4AMTSqZRA2XImW4ZW8HRog+OBOn9LDaRcvqlqenKs/Z -IoOUqaqVTqNF2ukkH4usnBugPvdxiqtIGXCBFlS0st+PwIoBtRYD0u6bAoGBAN+v -qElfO/LOjzYWsV6bUSxWRp1XFnfxujitkcYbai+AnBITvZ6BcPfcATQ9IIp42HKk -vQ5PVViN2eCzB0R4I09fSOk/1PPGQM/jzgDQ5Q7zy644ee/lPbryKeFbCOxQtQ50 -0ZRHmQmUW/L9FmNxW1Dx0wcicMC2Bq+VnXvkHVebAoGBAMChpxL4Boasee0PcJ3o -x9D5S5NHOS32Uxe4G0mJ+25ikn6WZ8FYMOGsMeTRjfcUQB9R4DzkRTLfes7rKvmu -UOfK/jMufDWxDhmY6RFDiep3tPROt4Y0Bc2UZzDIq8gVq7gGLbOMqH2rxB6WfE1q -Ommjhlg6mwj9ZrStxzV86LXFAoGAISX22miyiZjywCE8x7hcnyVp8YcmXUAFSMDw -CVumsMNuXX9vaj3kb9a6lvM4D005RkQDgEtham4bC6F8QjlLgkeslmRPOpD2qdgo -fxZ123Fljbvw1gwyybF5Y1wKRnrvWeUV6dNyamkB91BqMPJrheNQUo5YBzbyZrLV -U7bKYmECgYEAj7ekhtCiIUMih8noMfpHR0lJG4VhdfqiVL+w25CgnpZJDa6o7pYD -F5fMivdfdKaSAOA5mUGN5u6NrTpfFKhHDucpIOM2+WGOzbbWEc/gEDQ/xEyPEhxj -t4ErMTByrDGKtGuaolNYzAU0SSbCnAAH3L2MRChC9Qv7f5ZVOZX1GPQ= +MIIEpAIBAAKCAQEAtCJ7xmvXxypNx7d6vV9YWZ3SHtm7+OrnDP9LBokGvpkIUloJ +q6IJxVQPTepJWM7JfXGtWgkdfmUCZjswlQmvbCJSYA8+Y76Sm9M6sf26RsMayxXU +ozWdw227frCpQt2ybor7qOLBBbQ30XbsdxPIwlrJst9Shleey93g56EDkhZWQQMN +8cciakv9zUz6GwRu3XtK4KGtWb3VpsOhf8WAoVQ05o4Cevz3LrY7NcZj2IvIna5V ++E5QxQnRXpd5gNzyE1rbzN3pXmHk2SShGI7sEqgo9HOfu7EufwsfmaCXbuCNGhlS +4YfJvuqZ7ElijUbMnYu3eGKWfjymfp/7qHu87wIDAQABAoIBAQCtgU2BaJy1XN0A +Uo1p3G2IHEioqIazEuesEDaeu9uAOHzYfZs082W/6OC45sLxRHS1XIph38fF19tA +xyBbXbHXURPRLL2ma4hhiUrO6JrEz+Z92LAw6FLmS0q+k8DlBA97BGm0WX0cVmMx +YgAQDkFgWvxOS2b8uWbd7QBVezSqPzN8iV2GNmnEA7FIphqqJbkgEBOxbwJig5Ll +WJ51Q8nWWVZS1AY2kJjf2ndFJgrB3Zbuib0nnmjsG4esB5AS9Fyjadmc+ilU7ceX +y+AdccV2cO0f9k8SBPWHUrRuiuMTcwoQ/r2HN9THaho1QBWPRPjzvXetKLTzRdK0 ++yzEI9x5AoGBAO+CYFKWwt8ylrqQzuGPVYu32RUaVgUtZVsWoF5vzK35WYFCfA+S +qIO+wPs06py79Ytgk/ff5QCz7DRepdlrmyq5ZqZ0xD858H8qzNByySZI0DSJU1wr +7Uw/5vf/+6/1/dmgPrT7HjZyGuvqq1XieBcjonQ5RYooEcjCcCnz9+z9AoGBAMCJ +kApBhTOVBquiXiqEsrbrT7s8u2KbqN9L7E2o5MnfG7sIhrFbY0Bjvdsut1omfBxd +XpTWnyR+OLd6xSpBB5fEBKD21dotwgNmJm+wTAER8ZpohlTLv8gQRHclkFg5chyY +2LJKfssiaXvocKMq3CwM7XAnbI8OTDnwxSqAfCtbAoGBAI7RGGzG90auXNC83pAD +r0gUBb8eqCKIMkMBl/kYA13OLP/1zBJhKlj82wgwQqHZNo64tSL+gAhOQU/tDEo8 +bxcn3LzvLcJh4zWBKQY3HBjXHEfnhyyUCPkJtck1/DetoIQvmJTElPx0R/dbRHV/ +CIsLtahGKmA6inhC8S0jDDhlAoGAX5svglg8q3uB33J17gkMsVYxtlkW94UyGweZ +ZIrMaQ23uG0obSNjKpMcsJ0HAOYBVRhsId5dEgL3aOy2wR+fhJYack9/q6JzJ7ru +tSFG7HUbkr/6jFrMdazWQo/NmHGWH2sql4X0ZixFUvj+DZf30ovsz3dUKclAwriz +P0Kj5ecCgYBbn1REy6+5x6lLO2SIymharMTPSG23GBiwPTSpyMD5WbzqKEQVSSJX +eIaaTPz68HOmgvBZUE7Svbz/OqhDEgZxZG9o7Pr4tsdAUzAt/LNkYA8BOjTnrx7W +ANPvr6b2UHBn26SitdwC5emdsGZIPBGS0XDzznvNwxl2+t14iteEbg== -----END RSA PRIVATE KEY----- diff --git a/src/core/tsi/test_creds/multi-domain.pem b/src/core/tsi/test_creds/multi-domain.pem index c60d2baef6e..cf28b4a6cfa 100644 --- a/src/core/tsi/test_creds/multi-domain.pem +++ b/src/core/tsi/test_creds/multi-domain.pem @@ -1,23 +1,23 @@ -----BEGIN CERTIFICATE----- -MIIDwDCCAqigAwIBAgIUYSe4/8nE/RVUX7e7QeyCmqPWd6AwDQYJKoZIhvcNAQEL -BQAwODELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEPMA0G -A1UECwwGR29vZ2xlMB4XDTE5MDgwNTE4MDYwNVoXDTIwMDgwNDE4MDYwNVowODEL -MAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEPMA0GA1UECwwG -R29vZ2xlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1e+GwyVNsoKu -7PqvOf/EubN45rB5o5PQF9A5fBPpiBtKZdvbbOouGlulRwaMQOLDZi9M6l/AhE1b -207+iSBTn9jSQT0elaYwVtKgb/qoehQjFAG8BckPmA9E4SDx2Ug9AtV3rTVs4V2y -aDHNSfDSXQ2PS9fuIx7FK5mMnUM2fjskcZquHV5f8McXEtvpuTktnb+KDgETO0Cd -u3+rf/RtraTuKZb0kmAgf+KaNWDL2j5QsFKa6sT4812Vfwaevm9qKOtzgAFobCwd -Vt+Ap/B0XWj4CmzJMPN/SXESluoBHszmTi6QmkTEzYbzmD/ObyTxXVKu46kRVmJK -Xh6BE1wk2QIDAQABo4HBMIG+MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgXgMIGjBgNV -HREEgZswgZiCE2Zvby50ZXN0LmRvbWFpbi5jb22CE2Jhci50ZXN0LmRvbWFpbi5j -b22GIGh0dHBzOi8vZm9vLnRlc3QuZG9tYWluLmNvbS90ZXN0hiBodHRwczovL2Jh -ci50ZXN0LmRvbWFpbi5jb20vdGVzdIETZm9vQHRlc3QuZG9tYWluLmNvbYETYmFy -QHRlc3QuZG9tYWluLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAzBhVGeqIntQs9qpK -xGOjpFTBMzCjYORNAq09Otkc/IBwtPOq0K2as7fp6Vr5DRStN7hDSBrMjZh+XujY -3GNEv4pIR5fWwrZg/fnNyG5BIUhdq/qtC3JAMqBjno3OJjg1t4KzS4l+ozHeevJA -qT9t6aodsn1r7w89MfAVGPIw7D3n9n5N4z2b/co17W8B0RyMWX2PmQWkEqn7kId/ -Jj+hmw2n9UV1IU3xhcepxG+wzjFLIB9nsDwgtZogK6f5p9FFBG8raqk6QhVSlRgh -JmNqmK5+hyUy1zbjGqgfM5eVmQ/A3qWVQTrk3HeTr2hO9GoBHeXQfinjlIhnbbtJ -xouhvA== +MIID5DCCAsygAwIBAgIUMmNBVcGnMw2sMASWhdn5IvFktoYwDQYJKoZIhvcNAQEL +BQAwSjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEPMA0G +A1UECwwGR29vZ2xlMRAwDgYDVQQDDAd4cGlnb3JzMB4XDTE5MDgwNzIxMDY0NVoX +DTIwMDgwNjIxMDY0NVowSjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYD +VQQHDAJTRjEPMA0GA1UECwwGR29vZ2xlMRAwDgYDVQQDDAd4cGlnb3JzMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtCJ7xmvXxypNx7d6vV9YWZ3SHtm7 ++OrnDP9LBokGvpkIUloJq6IJxVQPTepJWM7JfXGtWgkdfmUCZjswlQmvbCJSYA8+ +Y76Sm9M6sf26RsMayxXUozWdw227frCpQt2ybor7qOLBBbQ30XbsdxPIwlrJst9S +hleey93g56EDkhZWQQMN8cciakv9zUz6GwRu3XtK4KGtWb3VpsOhf8WAoVQ05o4C +evz3LrY7NcZj2IvIna5V+E5QxQnRXpd5gNzyE1rbzN3pXmHk2SShGI7sEqgo9HOf +u7EufwsfmaCXbuCNGhlS4YfJvuqZ7ElijUbMnYu3eGKWfjymfp/7qHu87wIDAQAB +o4HBMIG+MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgXgMIGjBgNVHREEgZswgZiCE2Zv +by50ZXN0LmRvbWFpbi5jb22CE2Jhci50ZXN0LmRvbWFpbi5jb22BE2Zvb0B0ZXN0 +LmRvbWFpbi5jb22BE2JhckB0ZXN0LmRvbWFpbi5jb22GIGh0dHBzOi8vZm9vLnRl +c3QuZG9tYWluLmNvbS90ZXN0hiBodHRwczovL2Jhci50ZXN0LmRvbWFpbi5jb20v +dGVzdDANBgkqhkiG9w0BAQsFAAOCAQEAIu99zFdybv5OoLNYeyhZsiGjHJQ/ECYr +dp4XeRftwO5lvLUbxDz4nfs7dedDYqk+amfgJsVg9zDykeAslvjmuWHJ1IgACAqm +SlR43gwWt1YMXH7NJ8unAxF3OwGDMdIA5WJfYo2XFz4o55wWCiUbxCpWJYu8hwz6 +6IRmn6hWWsxlflWmgaV5hYKL8bLF13Ku9gZbNFFJw6knyqw+x4b1LwsnKeZGvS7E +EvGVyhMylPVFc0ZZy0TZvk3UOR9TbIMXiztQIWrw30izwPNElvUTzSkAbAg+h6+8 +G7xSZYDr6l81M0a3S2VU75yjMCHKP5/wE9hsfTr/NpWN7w5w5PmqdA== -----END CERTIFICATE----- diff --git a/test/core/tsi/ssl_transport_security_test.cc b/test/core/tsi/ssl_transport_security_test.cc index 014127a3042..c5e6e839b18 100644 --- a/test/core/tsi/ssl_transport_security_test.cc +++ b/test/core/tsi/ssl_transport_security_test.cc @@ -790,13 +790,25 @@ void ssl_tsi_test_duplicate_root_certificates() { gpr_free(dup_root_cert); } -void ssl_tsi_test_uri_email_subject_alt_names() { +void ssl_tsi_test_extract_x509_subject_names() { char* cert = load_file(SSL_TSI_TEST_CREDENTIALS_DIR, "multi-domain.pem"); tsi_peer peer; - GPR_ASSERT(extract_x509_subject_names_from_pem_cert(cert, &peer) == TSI_OK); + GPR_ASSERT(tsi_ssl_extract_x509_subject_names_from_pem_cert(cert, &peer) == + TSI_OK); // One for common name, one for certificate, and six for SAN fields. size_t expected_property_count = 8; GPR_ASSERT(peer.property_count == expected_property_count); + // Check common name + const char* expected_cn = "xpigors"; + const tsi_peer_property* property = tsi_peer_get_property_by_name( + &peer, TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY); + GPR_ASSERT(property != nullptr); + GPR_ASSERT( + memcmp(property->value.data, expected_cn, property->value.length) == 0); + // Check certificate data + property = tsi_peer_get_property_by_name(&peer, TSI_X509_PEM_CERT_PROPERTY); + GPR_ASSERT(property != nullptr); + GPR_ASSERT(memcmp(property->value.data, cert, property->value.length) == 0); // Check DNS GPR_ASSERT(check_subject_alt_name(&peer, "foo.test.domain.com") == 1); GPR_ASSERT(check_subject_alt_name(&peer, "bar.test.domain.com") == 1); @@ -808,6 +820,9 @@ void ssl_tsi_test_uri_email_subject_alt_names() { // Check email address GPR_ASSERT(check_subject_alt_name(&peer, "foo@test.domain.com") == 1); GPR_ASSERT(check_subject_alt_name(&peer, "bar@test.domain.com") == 1); + // Free memory + gpr_free(cert); + tsi_peer_destruct(&peer); } int main(int argc, char** argv) { @@ -835,7 +850,7 @@ int main(int argc, char** argv) { ssl_tsi_test_do_round_trip_odd_buffer_size(); ssl_tsi_test_handshaker_factory_internals(); ssl_tsi_test_duplicate_root_certificates(); - ssl_tsi_test_uri_email_subject_alt_names(); + ssl_tsi_test_extract_x509_subject_names(); grpc_shutdown(); return 0; } From 807cd08f4a1f006a4d9c56ada0947c9da7c6d647 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 7 Aug 2019 15:43:31 -0700 Subject: [PATCH 232/661] Fix upb build typo --- BUILD.gn | 16 ++++ gRPC-C++.podspec | 16 ++++ gRPC-Core.podspec | 20 ++++- grpc.gemspec | 8 ++ package.xml | 8 ++ .../filters/client_channel/health/health.pb.c | 23 ------ .../filters/client_channel/health/health.pb.h | 73 ------------------- src/upb/gen_build_yaml.py | 2 +- tools/distrib/check_copyright.py | 2 - tools/doxygen/Doxyfile.c++.internal | 10 ++- tools/doxygen/Doxyfile.core.internal | 10 ++- .../generated/sources_and_headers.json | 2 +- tools/run_tests/sanity/sanity_tests.yaml | 1 - 13 files changed, 84 insertions(+), 107 deletions(-) delete mode 100644 src/core/ext/filters/client_channel/health/health.pb.c delete mode 100644 src/core/ext/filters/client_channel/health/health.pb.h diff --git a/BUILD.gn b/BUILD.gn index 28a950c13cf..95857cc245c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -874,11 +874,19 @@ config("grpc_config") { "src/core/tsi/transport_security_grpc.h", "src/core/tsi/transport_security_interface.h", "third_party/upb/upb/decode.c", + "third_party/upb/upb/decode.h", "third_party/upb/upb/encode.c", + "third_party/upb/upb/encode.h", + "third_party/upb/upb/generated_util.h", "third_party/upb/upb/msg.c", + "third_party/upb/upb/msg.h", "third_party/upb/upb/port.c", + "third_party/upb/upb/port_def.inc", + "third_party/upb/upb/port_undef.inc", "third_party/upb/upb/table.c", + "third_party/upb/upb/table.int.h", "third_party/upb/upb/upb.c", + "third_party/upb/upb/upb.h", ] deps = [ "//third_party/boringssl", @@ -1398,11 +1406,19 @@ config("grpc_config") { "src/cpp/util/string_ref.cc", "src/cpp/util/time_cc.cc", "third_party/upb/upb/decode.c", + "third_party/upb/upb/decode.h", "third_party/upb/upb/encode.c", + "third_party/upb/upb/encode.h", + "third_party/upb/upb/generated_util.h", "third_party/upb/upb/msg.c", + "third_party/upb/upb/msg.h", "third_party/upb/upb/port.c", + "third_party/upb/upb/port_def.inc", + "third_party/upb/upb/port_undef.inc", "third_party/upb/upb/table.c", + "third_party/upb/upb/table.int.h", "third_party/upb/upb/upb.c", + "third_party/upb/upb/upb.h", ] deps = [ "//third_party/boringssl", diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index b1a169207ac..b90a006e9b1 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -389,6 +389,14 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/handshaker/transport_security_common.pb.h', 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_interface.h', + 'third_party/upb/upb/decode.h', + 'third_party/upb/upb/encode.h', + 'third_party/upb/upb/generated_util.h', + 'third_party/upb/upb/msg.h', + 'third_party/upb/upb/port_def.inc', + 'third_party/upb/upb/port_undef.inc', + 'third_party/upb/upb/table.int.h', + 'third_party/upb/upb/upb.h', 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/ext/filters/client_channel/backup_poller.h', @@ -790,6 +798,14 @@ Pod::Spec.new do |s| 'src/core/lib/uri/uri_parser.h', 'src/core/lib/debug/trace.h', 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', + 'third_party/upb/upb/decode.h', + 'third_party/upb/upb/encode.h', + 'third_party/upb/upb/generated_util.h', + 'third_party/upb/upb/msg.h', + 'third_party/upb/upb/port_def.inc', + 'third_party/upb/upb/port_undef.inc', + 'third_party/upb/upb/table.int.h', + 'third_party/upb/upb/upb.h', 'src/core/ext/transport/inproc/inproc_transport.h' end diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index f69e985ccf5..6ee74687c74 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -345,6 +345,14 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/handshaker/transport_security_common.pb.h', 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_interface.h', + 'third_party/upb/upb/decode.h', + 'third_party/upb/upb/encode.h', + 'third_party/upb/upb/generated_util.h', + 'third_party/upb/upb/msg.h', + 'third_party/upb/upb/port_def.inc', + 'third_party/upb/upb/port_undef.inc', + 'third_party/upb/upb/table.int.h', + 'third_party/upb/upb/upb.h', 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/ext/filters/client_channel/backup_poller.h', @@ -1026,6 +1034,14 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/handshaker/transport_security_common.pb.h', 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_interface.h', + 'third_party/upb/upb/decode.h', + 'third_party/upb/upb/encode.h', + 'third_party/upb/upb/generated_util.h', + 'third_party/upb/upb/msg.h', + 'third_party/upb/upb/port_def.inc', + 'third_party/upb/upb/port_undef.inc', + 'third_party/upb/upb/table.int.h', + 'third_party/upb/upb/upb.h', 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/ext/filters/client_channel/backup_poller.h', @@ -1330,10 +1346,6 @@ Pod::Spec.new do |s| 'test/core/util/tracer_util.h', 'test/core/util/trickle_endpoint.h', 'test/core/util/cmdline.h', - 'third_party/nanopb/pb.h', - 'third_party/nanopb/pb_common.h', - 'third_party/nanopb/pb_decode.h', - 'third_party/nanopb/pb_encode.h', 'test/core/end2end/end2end_tests.cc', 'test/core/end2end/end2end_test_utils.cc', 'test/core/end2end/tests/authority_not_supported.cc', diff --git a/grpc.gemspec b/grpc.gemspec index 12fddb3252e..af2129350ef 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -278,6 +278,14 @@ Gem::Specification.new do |s| s.files += %w( third_party/nanopb/pb_encode.h ) s.files += %w( src/core/tsi/transport_security.h ) s.files += %w( src/core/tsi/transport_security_interface.h ) + s.files += %w( third_party/upb/upb/decode.h ) + s.files += %w( third_party/upb/upb/encode.h ) + s.files += %w( third_party/upb/upb/generated_util.h ) + s.files += %w( third_party/upb/upb/msg.h ) + s.files += %w( third_party/upb/upb/port_def.inc ) + s.files += %w( third_party/upb/upb/port_undef.inc ) + s.files += %w( third_party/upb/upb/table.int.h ) + s.files += %w( third_party/upb/upb/upb.h ) s.files += %w( src/core/ext/transport/chttp2/client/authority.h ) s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.h ) s.files += %w( src/core/ext/filters/client_channel/backup_poller.h ) diff --git a/package.xml b/package.xml index 5b85159a4f5..5352a9f43d7 100644 --- a/package.xml +++ b/package.xml @@ -283,6 +283,14 @@ + + + + + + + + diff --git a/src/core/ext/filters/client_channel/health/health.pb.c b/src/core/ext/filters/client_channel/health/health.pb.c deleted file mode 100644 index 5499c549cc6..00000000000 --- a/src/core/ext/filters/client_channel/health/health.pb.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.3.7-dev */ - -#include "src/core/ext/filters/client_channel/health/health.pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - - - -const pb_field_t grpc_health_v1_HealthCheckRequest_fields[2] = { - PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_health_v1_HealthCheckRequest, service, service, 0), - PB_LAST_FIELD -}; - -const pb_field_t grpc_health_v1_HealthCheckResponse_fields[2] = { - PB_FIELD( 1, UENUM , OPTIONAL, STATIC , FIRST, grpc_health_v1_HealthCheckResponse, status, status, 0), - PB_LAST_FIELD -}; - - -/* @@protoc_insertion_point(eof) */ diff --git a/src/core/ext/filters/client_channel/health/health.pb.h b/src/core/ext/filters/client_channel/health/health.pb.h deleted file mode 100644 index 9d54ccd6182..00000000000 --- a/src/core/ext/filters/client_channel/health/health.pb.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Automatically generated nanopb header */ -/* Generated by nanopb-0.3.7-dev */ - -#ifndef PB_GRPC_HEALTH_V1_HEALTH_PB_H_INCLUDED -#define PB_GRPC_HEALTH_V1_HEALTH_PB_H_INCLUDED -#include "pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Enum definitions */ -typedef enum _grpc_health_v1_HealthCheckResponse_ServingStatus { - grpc_health_v1_HealthCheckResponse_ServingStatus_UNKNOWN = 0, - grpc_health_v1_HealthCheckResponse_ServingStatus_SERVING = 1, - grpc_health_v1_HealthCheckResponse_ServingStatus_NOT_SERVING = 2, - grpc_health_v1_HealthCheckResponse_ServingStatus_SERVICE_UNKNOWN = 3 -} grpc_health_v1_HealthCheckResponse_ServingStatus; -#define _grpc_health_v1_HealthCheckResponse_ServingStatus_MIN grpc_health_v1_HealthCheckResponse_ServingStatus_UNKNOWN -#define _grpc_health_v1_HealthCheckResponse_ServingStatus_MAX grpc_health_v1_HealthCheckResponse_ServingStatus_SERVICE_UNKNOWN -#define _grpc_health_v1_HealthCheckResponse_ServingStatus_ARRAYSIZE ((grpc_health_v1_HealthCheckResponse_ServingStatus)(grpc_health_v1_HealthCheckResponse_ServingStatus_SERVICE_UNKNOWN+1)) - -/* Struct definitions */ -typedef struct _grpc_health_v1_HealthCheckRequest { - bool has_service; - char service[200]; -/* @@protoc_insertion_point(struct:grpc_health_v1_HealthCheckRequest) */ -} grpc_health_v1_HealthCheckRequest; - -typedef struct _grpc_health_v1_HealthCheckResponse { - bool has_status; - grpc_health_v1_HealthCheckResponse_ServingStatus status; -/* @@protoc_insertion_point(struct:grpc_health_v1_HealthCheckResponse) */ -} grpc_health_v1_HealthCheckResponse; - -/* Default values for struct fields */ - -/* Initializer values for message structs */ -#define grpc_health_v1_HealthCheckRequest_init_default {false, ""} -#define grpc_health_v1_HealthCheckResponse_init_default {false, (grpc_health_v1_HealthCheckResponse_ServingStatus)0} -#define grpc_health_v1_HealthCheckRequest_init_zero {false, ""} -#define grpc_health_v1_HealthCheckResponse_init_zero {false, (grpc_health_v1_HealthCheckResponse_ServingStatus)0} - -/* Field tags (for use in manual encoding/decoding) */ -#define grpc_health_v1_HealthCheckRequest_service_tag 1 -#define grpc_health_v1_HealthCheckResponse_status_tag 1 - -/* Struct field encoding specification for nanopb */ -extern const pb_field_t grpc_health_v1_HealthCheckRequest_fields[2]; -extern const pb_field_t grpc_health_v1_HealthCheckResponse_fields[2]; - -/* Maximum encoded size of messages (where known) */ -#define grpc_health_v1_HealthCheckRequest_size 203 -#define grpc_health_v1_HealthCheckResponse_size 2 - -/* Message IDs (where set with "msgid" option) */ -#ifdef PB_MSGID - -#define HEALTH_MESSAGES \ - - -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif -/* @@protoc_insertion_point(eof) */ - -#endif diff --git a/src/upb/gen_build_yaml.py b/src/upb/gen_build_yaml.py index 65d31953b1f..ba11ebd846c 100755 --- a/src/upb/gen_build_yaml.py +++ b/src/upb/gen_build_yaml.py @@ -47,7 +47,7 @@ try: out['filegroups'] = [{ 'name': 'upb', 'src': srcs, - 'uses': [ 'nanopb_headers' ], + 'uses': [ 'upb_headers' ], }, { 'name': 'upb_headers', 'headers': hdrs, diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index aed63474b2d..a67802b2a2c 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -75,8 +75,6 @@ _EXEMPT = frozenset(( 'examples/python/multiplex/route_guide_pb2_grpc.py', 'examples/python/route_guide/route_guide_pb2.py', 'examples/python/route_guide/route_guide_pb2_grpc.py', - 'src/core/ext/filters/client_channel/health/health.pb.h', - 'src/core/ext/filters/client_channel/health/health.pb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index ac421d418ba..3e6b641c8e4 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1297,11 +1297,19 @@ third_party/nanopb/pb_common.h \ third_party/nanopb/pb_decode.h \ third_party/nanopb/pb_encode.h \ third_party/upb/upb/decode.c \ +third_party/upb/upb/decode.h \ third_party/upb/upb/encode.c \ +third_party/upb/upb/encode.h \ +third_party/upb/upb/generated_util.h \ third_party/upb/upb/msg.c \ +third_party/upb/upb/msg.h \ third_party/upb/upb/port.c \ +third_party/upb/upb/port_def.inc \ +third_party/upb/upb/port_undef.inc \ third_party/upb/upb/table.c \ -third_party/upb/upb/upb.c +third_party/upb/upb/table.int.h \ +third_party/upb/upb/upb.c \ +third_party/upb/upb/upb.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index e15778c276b..e1d03c33268 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1614,11 +1614,19 @@ third_party/nanopb/pb_decode.h \ third_party/nanopb/pb_encode.c \ third_party/nanopb/pb_encode.h \ third_party/upb/upb/decode.c \ +third_party/upb/upb/decode.h \ third_party/upb/upb/encode.c \ +third_party/upb/upb/encode.h \ +third_party/upb/upb/generated_util.h \ third_party/upb/upb/msg.c \ +third_party/upb/upb/msg.h \ third_party/upb/upb/port.c \ +third_party/upb/upb/port_def.inc \ +third_party/upb/upb/port_undef.inc \ third_party/upb/upb/table.c \ -third_party/upb/upb/upb.c +third_party/upb/upb/table.int.h \ +third_party/upb/upb/upb.c \ +third_party/upb/upb/upb.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index eea82fd730c..c026d6a1caa 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -10933,7 +10933,7 @@ }, { "deps": [ - "nanopb_headers" + "upb_headers" ], "headers": [], "is_filegroup": true, diff --git a/tools/run_tests/sanity/sanity_tests.yaml b/tools/run_tests/sanity/sanity_tests.yaml index e9459911a1e..222e63a46dc 100644 --- a/tools/run_tests/sanity/sanity_tests.yaml +++ b/tools/run_tests/sanity/sanity_tests.yaml @@ -16,7 +16,6 @@ cpu_cost: 3 - script: tools/distrib/check_copyright.py - script: tools/distrib/check_include_guards.py -- script: tools/distrib/check_nanopb_output.sh - script: tools/distrib/check_trailing_newlines.sh - script: tools/distrib/check_upb_output.sh - script: tools/distrib/clang_format_code.sh From 0f02911d3d8258d958cfd2938c37a01458cc147b Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 7 Aug 2019 14:52:09 -0700 Subject: [PATCH 233/661] Added targets for tv and watch samples --- src/objective-c/examples/BUILD | 72 ++++++++++++++++++- .../tvOS-sample/tvOS-sample/Info.plist | 2 +- .../AppIcon.appiconset/Contents.json | 21 ++++++ .../watchOS-sample/WatchKit-App/Info.plist | 2 +- .../WatchKit-Extension/Info.plist | 2 +- .../watchOS-sample/watchOS-sample/Info.plist | 2 +- 6 files changed, 96 insertions(+), 5 deletions(-) diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index d6e1140d8f5..5e3e4f9badd 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -18,7 +18,7 @@ load("//src/objective-c:grpc_objc_internal_library.bzl", "local_objc_grpc_library") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application") -load("@build_bazel_rules_apple//apple:watchos.bzl", "watchos_application") +load("@build_bazel_rules_apple//apple:watchos.bzl", "watchos_application", "watchos_extension") proto_library( name = "messages_proto", @@ -96,3 +96,73 @@ ios_application( ], deps = ["InterceptorSample-lib"], ) + +objc_library( + name = "tvOS-sample-lib", + srcs = glob(["tvOS-sample/tvOS-sample/**/*.m"]), + hdrs = glob(["tvOS-sample/tvOS-sample/**/*.h"]), + data = glob([ + "tvOS-sample/tvOS-sample/Base.lproj/**", + "tvOS-sample/tvOS-sample/Images.xcassets/**", + ]), + deps = [":test_grpc_objc"], +) + +# c-ares does not support tvOS CPU architecture with Bazel yet +tvos_application( + name = "tvOS-sample", + bundle_id = "grpc.objc.examples.tvOS-sample", + minimum_os_version = "10.0", + infoplists = ["tvOS-sample/tvOS-sample/Info.plist"], + deps = [":tvOS-sample-lib"], +) + +objc_library( + name = "watchOS-sample-iOS-lib", + srcs = glob(["watchOS-sample/watchOS-sample/**/*.m"]), + hdrs = glob(["watchOS-sample/watchOS-sample/**/*.h"]), + data = glob([ + "watchOS-sample/watchOS-sample/Base.lproj/**", + "watchOS-sample/watchOS-sample/Images.xcassets/**", + ]), + deps = [":test_grpc_objc"], +) + +objc_library( + name = "watchOS-sample-extension-lib", + srcs = glob(["watchOS-sample/WatchKit-Extention/**/*.m"]), + hdrs = glob(["watchOS-sample/WatchKit-Extension/**/*.h"]), + deps = [":test_grpc_objc"], + sdk_frameworks = [ + "WatchConnectivity", + "WatchKit", + ], +) + +ios_application( + name = "watchOS-sample", + bundle_id = "com.google.watchOS-sample", + minimum_os_version = "9.0", # Safe Area Layout Guide used + families = ["iphone"], + infoplists = ["watchOS-sample/watchOS-sample/Info.plist"], + deps = [":watchOS-sample-iOS-lib"], + watch_application = "watchOS-sample-watchApp", +) + +# c-ares does not support watchOS CPU architecture with Bazel yet +watchos_application( + name = "watchOS-sample-watchApp", + bundle_id = "com.google.watchOS-sample.watchkitapp", + minimum_os_version = "4.0", + storyboards = ["watchOS-sample/WatchKit-App/Base.lproj/Interface.storyboard"], + infoplists = ["watchOS-sample/WatchKit-App/Info.plist"], + extension = ":watchOS-sample-extension", +) + +watchos_extension( + name = "watchOS-sample-extension", + bundle_id = "com.google.watchOS-sample.watchkitapp.watchkitextension", + minimum_os_version = "4.0", + infoplists = ["watchOS-sample/WatchKit-Extension/Info.plist"], + deps = [":watchOS-sample-extension-lib"], +) diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist b/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist index 02942a34f3e..63dcd6c1d26 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json index 215c1ddfee9..6c0f2b4204b 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -33,6 +33,20 @@ "role" : "appLauncher", "subtype" : "38mm" }, + { + "size" : "44x44", + "idiom" : "watch", + "scale" : "2x", + "role" : "appLauncher", + "subtype" : "40mm" + }, + { + "size" : "50x50", + "idiom" : "watch", + "scale" : "2x", + "role" : "appLauncher", + "subtype" : "44mm" + }, { "size" : "86x86", "idiom" : "watch", @@ -47,6 +61,13 @@ "role" : "quickLook", "subtype" : "42mm" }, + { + "size" : "108x108", + "idiom" : "watch", + "scale" : "2x", + "role" : "quickLook", + "subtype" : "44mm" + }, { "idiom" : "watch-marketing", "size" : "1024x1024", diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist index 309d7867639..6dbcfe04d53 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist +++ b/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleDisplayName WatchKit-App CFBundleExecutable diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist index bc09fa0f786..4a0a252b854 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleDisplayName watchOS-sample WatchKit Extension CFBundleExecutable diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist b/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist index 16be3b68112..d0524738680 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier From f036d6ef58f2737bff36872c6cb452dfeeb5ab20 Mon Sep 17 00:00:00 2001 From: Arjun Roy Date: Thu, 1 Aug 2019 15:28:44 -0700 Subject: [PATCH 234/661] s/gpr_ref/grpc_core::RefCount/ for frequent users. --- src/core/lib/iomgr/ev_epollex_linux.cc | 79 ++++++++---------------- src/core/lib/iomgr/tcp_posix.cc | 36 ++++------- src/core/lib/surface/completion_queue.cc | 26 +++----- src/core/lib/surface/server.cc | 10 ++- 4 files changed, 53 insertions(+), 98 deletions(-) diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc index 08116b3ab53..c2d80c08ddb 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.cc +++ b/src/core/lib/iomgr/ev_epollex_linux.cc @@ -47,6 +47,7 @@ #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/manual_constructor.h" +#include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/block_annotate.h" #include "src/core/lib/iomgr/iomgr_internal.h" @@ -89,7 +90,7 @@ typedef struct pollable pollable; /// - PO_MULTI - a pollable containing many fds struct pollable { pollable_type type; // immutable - gpr_refcount refs; + grpc_core::RefCount refs; int epfd; grpc_wakeup_fd wakeup; @@ -135,17 +136,26 @@ static char* pollable_desc(pollable* p) { static pollable* g_empty_pollable; static grpc_error* pollable_create(pollable_type type, pollable** p); -#ifdef NDEBUG -static pollable* pollable_ref(pollable* p); -static void pollable_unref(pollable* p); -#define POLLABLE_REF(p, r) pollable_ref(p) -#define POLLABLE_UNREF(p, r) pollable_unref(p) -#else -static pollable* pollable_ref(pollable* p, int line, const char* reason); -static void pollable_unref(pollable* p, int line, const char* reason); -#define POLLABLE_REF(p, r) pollable_ref((p), __LINE__, (r)) -#define POLLABLE_UNREF(p, r) pollable_unref((p), __LINE__, (r)) -#endif +static pollable* pollable_ref(pollable* p, + const grpc_core::DebugLocation& dbg_loc, + const char* reason) { + p->refs.Ref(dbg_loc, reason); + return p; +} +static void pollable_unref(pollable* p, const grpc_core::DebugLocation& dbg_loc, + const char* reason) { + if (p == nullptr) return; + if (GPR_UNLIKELY(p != nullptr && p->refs.Unref(dbg_loc, reason))) { + GRPC_FD_TRACE("pollable_unref: Closing epfd: %d", p->epfd); + close(p->epfd); + grpc_wakeup_fd_destroy(&p->wakeup); + gpr_mu_destroy(&p->owner_orphan_mu); + gpr_mu_destroy(&p->mu); + gpr_free(p); + } +} +#define POLLABLE_REF(p, r) pollable_ref((p), DEBUG_LOCATION, (r)) +#define POLLABLE_UNREF(p, r) pollable_unref((p), DEBUG_LOCATION, (r)) /******************************************************************************* * Fd Declarations @@ -283,7 +293,7 @@ struct grpc_pollset { */ struct grpc_pollset_set { - gpr_refcount refs; + grpc_core::RefCount refs; gpr_mu mu; grpc_pollset_set* parent; @@ -568,7 +578,7 @@ static grpc_error* pollable_create(pollable_type type, pollable** p) { } (*p)->type = type; - gpr_ref_init(&(*p)->refs, 1); + new (&(*p)->refs) grpc_core::RefCount(1, &grpc_trace_pollable_refcount); gpr_mu_init(&(*p)->mu); (*p)->epfd = epfd; (*p)->owner_fd = nullptr; @@ -582,41 +592,6 @@ static grpc_error* pollable_create(pollable_type type, pollable** p) { return GRPC_ERROR_NONE; } -#ifdef NDEBUG -static pollable* pollable_ref(pollable* p) { -#else -static pollable* pollable_ref(pollable* p, int line, const char* reason) { - if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_pollable_refcount)) { - int r = static_cast gpr_atm_no_barrier_load(&p->refs.count); - gpr_log(__FILE__, line, GPR_LOG_SEVERITY_DEBUG, - "POLLABLE:%p ref %d->%d %s", p, r, r + 1, reason); - } -#endif - gpr_ref(&p->refs); - return p; -} - -#ifdef NDEBUG -static void pollable_unref(pollable* p) { -#else -static void pollable_unref(pollable* p, int line, const char* reason) { - if (p == nullptr) return; - if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_pollable_refcount)) { - int r = static_cast gpr_atm_no_barrier_load(&p->refs.count); - gpr_log(__FILE__, line, GPR_LOG_SEVERITY_DEBUG, - "POLLABLE:%p unref %d->%d %s", p, r, r - 1, reason); - } -#endif - if (p != nullptr && gpr_unref(&p->refs)) { - GRPC_FD_TRACE("pollable_unref: Closing epfd: %d", p->epfd); - close(p->epfd); - grpc_wakeup_fd_destroy(&p->wakeup); - gpr_mu_destroy(&p->owner_orphan_mu); - gpr_mu_destroy(&p->mu); - gpr_free(p); - } -} - static grpc_error* pollable_add_fd(pollable* p, grpc_fd* fd) { grpc_error* error = GRPC_ERROR_NONE; static const char* err_desc = "pollable_add_fd"; @@ -1331,13 +1306,13 @@ static grpc_pollset_set* pollset_set_create(void) { grpc_pollset_set* pss = static_cast(gpr_zalloc(sizeof(*pss))); gpr_mu_init(&pss->mu); - gpr_ref_init(&pss->refs, 1); + new (&pss->refs) grpc_core::RefCount(); return pss; } static void pollset_set_unref(grpc_pollset_set* pss) { if (pss == nullptr) return; - if (!gpr_unref(&pss->refs)) return; + if (GPR_LIKELY(!pss->refs.Unref())) return; pollset_set_unref(pss->parent); gpr_mu_destroy(&pss->mu); for (size_t i = 0; i < pss->pollset_count; i++) { @@ -1528,7 +1503,7 @@ static void pollset_set_add_pollset_set(grpc_pollset_set* a, if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { gpr_log(GPR_INFO, "PSS: parent %p to %p", b, a); } - gpr_ref(&a->refs); + a->refs.Ref(); b->parent = a; if (a->fd_capacity < a->fd_count + b->fd_count) { a->fd_capacity = GPR_MAX(2 * a->fd_capacity, a->fd_count + b->fd_count); diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index 819c5284256..498aecc069b 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -89,7 +89,7 @@ struct grpc_tcp { bool is_first_read; double target_length; double bytes_read_this_round; - gpr_refcount refcount; + grpc_core::RefCount refcount; gpr_atm shutdown_count; int min_read_chunk_size; @@ -359,41 +359,29 @@ static void tcp_free(grpc_tcp* tcp) { } #ifndef NDEBUG -#define TCP_UNREF(tcp, reason) tcp_unref((tcp), (reason), __FILE__, __LINE__) -#define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), __FILE__, __LINE__) -static void tcp_unref(grpc_tcp* tcp, const char* reason, const char* file, - int line) { - if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) { - gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, - val - 1); - } - if (gpr_unref(&tcp->refcount)) { +#define TCP_UNREF(tcp, reason) tcp_unref((tcp), (reason), DEBUG_LOCATION) +#define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), DEBUG_LOCATION) +static void tcp_unref(grpc_tcp* tcp, const char* reason, + const grpc_core::DebugLocation& debug_location) { + if (GPR_UNLIKELY(tcp->refcount.Unref(debug_location, reason))) { tcp_free(tcp); } } -static void tcp_ref(grpc_tcp* tcp, const char* reason, const char* file, - int line) { - if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) { - gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "TCP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val, - val + 1); - } - gpr_ref(&tcp->refcount); +static void tcp_ref(grpc_tcp* tcp, const char* reason, + const grpc_core::DebugLocation& debug_location) { + tcp->refcount.Ref(debug_location, reason); } #else #define TCP_UNREF(tcp, reason) tcp_unref((tcp)) #define TCP_REF(tcp, reason) tcp_ref((tcp)) static void tcp_unref(grpc_tcp* tcp) { - if (gpr_unref(&tcp->refcount)) { + if (GPR_UNLIKELY(tcp->refcount.Unref())) { tcp_free(tcp); } } -static void tcp_ref(grpc_tcp* tcp) { gpr_ref(&tcp->refcount); } +static void tcp_ref(grpc_tcp* tcp) { tcp->refcount.Ref(); } #endif static void tcp_destroy(grpc_endpoint* ep) { @@ -1230,7 +1218,7 @@ grpc_endpoint* grpc_tcp_create(grpc_fd* em_fd, tcp->ts_capable = true; tcp->outgoing_buffer_arg = nullptr; /* paired with unref in grpc_tcp_destroy */ - gpr_ref_init(&tcp->refcount, 1); + new (&tcp->refcount) grpc_core::RefCount(1, &grpc_tcp_trace); gpr_atm_no_barrier_store(&tcp->shutdown_count, 0); tcp->em_fd = em_fd; grpc_slice_buffer_init(&tcp->last_read_buffer); diff --git a/src/core/lib/surface/completion_queue.cc b/src/core/lib/surface/completion_queue.cc index 82f87e769bf..acdf42eae34 100644 --- a/src/core/lib/surface/completion_queue.cc +++ b/src/core/lib/surface/completion_queue.cc @@ -320,7 +320,7 @@ struct cq_callback_data { /* Completion queue structure */ struct grpc_completion_queue { /** Once owning_refs drops to zero, we will destroy the cq */ - gpr_refcount owning_refs; + grpc_core::RefCount owning_refs; gpr_mu* mu; @@ -518,7 +518,7 @@ grpc_completion_queue* grpc_completion_queue_create_internal( cq->poller_vtable = poller_vtable; /* One for destroy(), one for pollset_shutdown */ - gpr_ref_init(&cq->owning_refs, 2); + new (&cq->owning_refs) grpc_core::RefCount(2); poller_vtable->init(POLLSET_FROM_CQ(cq), &cq->mu); vtable->init(DATA_FROM_CQ(cq), shutdown_callback); @@ -573,16 +573,13 @@ int grpc_get_cq_poll_num(grpc_completion_queue* cq) { #ifndef NDEBUG void grpc_cq_internal_ref(grpc_completion_queue* cq, const char* reason, const char* file, int line) { - if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_cq_refcount)) { - gpr_atm val = gpr_atm_no_barrier_load(&cq->owning_refs.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "CQ:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", cq, val, val + 1, - reason); - } + grpc_core::DebugLocation debug_location(file, line); #else void grpc_cq_internal_ref(grpc_completion_queue* cq) { + grpc_core::DebugLocation debug_location; + const char* reason = nullptr; #endif - gpr_ref(&cq->owning_refs); + cq->owning_refs.Ref(debug_location, reason); } static void on_pollset_shutdown_done(void* arg, grpc_error* error) { @@ -593,16 +590,13 @@ static void on_pollset_shutdown_done(void* arg, grpc_error* error) { #ifndef NDEBUG void grpc_cq_internal_unref(grpc_completion_queue* cq, const char* reason, const char* file, int line) { - if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_cq_refcount)) { - gpr_atm val = gpr_atm_no_barrier_load(&cq->owning_refs.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "CQ:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", cq, val, val - 1, - reason); - } + grpc_core::DebugLocation debug_location(file, line); #else void grpc_cq_internal_unref(grpc_completion_queue* cq) { + grpc_core::DebugLocation debug_location; + const char* reason = nullptr; #endif - if (gpr_unref(&cq->owning_refs)) { + if (GPR_UNLIKELY(cq->owning_refs.Unref(debug_location, reason))) { cq->vtable->destroy(DATA_FROM_CQ(cq)); cq->poller_vtable->destroy(POLLSET_FROM_CQ(cq)); #ifndef NDEBUG diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index db2d291bc59..f344b32d7a6 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -256,7 +256,7 @@ struct grpc_server { listener* listeners; int listeners_destroyed; - gpr_refcount internal_refcount; + grpc_core::RefCount internal_refcount; /** when did we print the last shutdown progress message */ gpr_timespec last_shutdown_message_time; @@ -400,9 +400,7 @@ static void request_matcher_kill_requests(grpc_server* server, * server proper */ -static void server_ref(grpc_server* server) { - gpr_ref(&server->internal_refcount); -} +static void server_ref(grpc_server* server) { server->internal_refcount.Ref(); } static void server_delete(grpc_server* server) { registered_method* rm; @@ -434,7 +432,7 @@ static void server_delete(grpc_server* server) { } static void server_unref(grpc_server* server) { - if (gpr_unref(&server->internal_refcount)) { + if (GPR_UNLIKELY(server->internal_refcount.Unref())) { server_delete(server); } } @@ -1031,7 +1029,7 @@ grpc_server* grpc_server_create(const grpc_channel_args* args, void* reserved) { gpr_cv_init(&server->starting_cv); /* decremented by grpc_server_destroy */ - gpr_ref_init(&server->internal_refcount, 1); + new (&server->internal_refcount) grpc_core::RefCount(); server->root_channel_data.next = server->root_channel_data.prev = &server->root_channel_data; From 820a0892ac1e3ff954d0309e9fd0ead2688ca3e9 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 7 Aug 2019 17:00:59 -0700 Subject: [PATCH 235/661] Updated comments (notice) on tvtests --- src/objective-c/tests/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index 0817bbdd6c7..5d8042ca20a 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -219,7 +219,7 @@ macos_unit_test( ] ) -# c-ares does not support tvOS CPU architecture with Bazel yet +# bazel run tvos_unit_test is not yet supported by xctestrunner tvos_unit_test( name = "TvTests", minimum_os_version = "10.0", From c81dfd91dedd0828c89fe2b185c2e11c6e153e7f Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 7 Aug 2019 17:01:37 -0700 Subject: [PATCH 236/661] Added cpu architecture for tvos and watchos --- third_party/cares/cares.BUILD | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/third_party/cares/cares.BUILD b/third_party/cares/cares.BUILD index 78a4590c3e0..596dd06f88e 100644 --- a/third_party/cares/cares.BUILD +++ b/third_party/cares/cares.BUILD @@ -44,6 +44,36 @@ config_setting( values = {"cpu": "ios_arm64"}, ) +config_setting( + name = "tvos_x86_64", + values = {"cpu": "tvos_x86_64"}, +) + +config_setting( + name = "tvos_arm64", + values = {"cpu": "tvos_arm64"} +) + +config_setting( + name = "watchos_i386", + values = {"cpu": "watchos_i386"}, +) + +config_setting( + name = "watchos_x86_64", + values = {"cpu": "watchos_x86_64"} +) + +config_setting( + name = "watchos_armv7k", + values = {"cpu": "watchos_armv7k"}, +) + +config_setting( + name = "watchos_arm64_32", + values = {"cpu": "watchos_arm64_32"} +) + genrule( name = "ares_build_h", srcs = ["@com_github_grpc_grpc//third_party/cares:ares_build.h"], @@ -58,6 +88,12 @@ genrule( ":ios_armv7": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], ":ios_armv7s": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], ":ios_arm64": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], + ":tvos_x86_64": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], + ":tvos_arm64": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], + ":watchos_i386": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], + ":watchos_x86_64": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], + ":watchos_armv7k": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], + ":watchos_arm64_32": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], ":darwin": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], ":darwin_x86_64": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], ":windows": ["@com_github_grpc_grpc//third_party/cares:config_windows/ares_config.h"], From ddf3f7ffb1c3d877e09118fb41a17a7b3619b238 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 7 Aug 2019 17:26:06 -0700 Subject: [PATCH 237/661] Experimentally changed non-framework builds to bazel build Experimentally run Unit/MacTests with Bazel --- src/objective-c/tests/build_one_example.sh | 67 ++++++++++++--------- src/objective-c/tests/run_one_test_bazel.sh | 44 ++++++++++++++ tools/run_tests/run_tests.py | 4 +- 3 files changed, 83 insertions(+), 32 deletions(-) create mode 100755 src/objective-c/tests/run_one_test_bazel.sh diff --git a/src/objective-c/tests/build_one_example.sh b/src/objective-c/tests/build_one_example.sh index caa048e258b..0a62008f8de 100755 --- a/src/objective-c/tests/build_one_example.sh +++ b/src/objective-c/tests/build_one_example.sh @@ -29,36 +29,43 @@ cd `dirname $0`/../../.. cd $EXAMPLE_PATH -# clean the directory -rm -rf Pods -rm -rf *.xcworkspace -rm -f Podfile.lock +if [ "$FRAMEWORKS" == "NO" ]; then + if [ "$SCHEME" == "watchOS-sample-WatchKit-App" ]; then + SCHEME="watchOS-sample" + fi + cd .. + ../../../tools/bazel build $SCHEME +else + # clean the directory + rm -rf Pods + rm -rf *.xcworkspace + rm -f Podfile.lock -pod install + pod install -set -o pipefail -XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )' -if [ "$SCHEME" == "tvOS-sample" ]; then - xcodebuild \ - build \ - -workspace *.xcworkspace \ - -scheme $SCHEME \ - -destination generic/platform=tvOS \ - -derivedDataPath Build/Build \ - CODE_SIGN_IDENTITY="" \ - CODE_SIGNING_REQUIRED=NO \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v "^$" - -else - xcodebuild \ - build \ - -workspace *.xcworkspace \ - -scheme $SCHEME \ - -destination generic/platform=iOS \ - -derivedDataPath Build/Build \ - CODE_SIGN_IDENTITY="" \ - CODE_SIGNING_REQUIRED=NO \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v "^$" - + set -o pipefail + XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )' + if [ "$SCHEME" == "tvOS-sample" ]; then + xcodebuild \ + build \ + -workspace *.xcworkspace \ + -scheme $SCHEME \ + -destination generic/platform=tvOS \ + -derivedDataPath Build/Build \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v "^$" - + else + xcodebuild \ + build \ + -workspace *.xcworkspace \ + -scheme $SCHEME \ + -destination generic/platform=iOS \ + -derivedDataPath Build/Build \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v "^$" - + fi fi - diff --git a/src/objective-c/tests/run_one_test_bazel.sh b/src/objective-c/tests/run_one_test_bazel.sh new file mode 100755 index 00000000000..41ffa21490c --- /dev/null +++ b/src/objective-c/tests/run_one_test_bazel.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Don't run this script standalone. Instead, run from the repository root: +# ./tools/run_tests/run_tests.py -l objc + +set -ev + +cd $(dirname $0) + +BINDIR=../../../bins/$CONFIG + +[ -f $BINDIR/interop_server ] || { + echo >&2 "Can't find the test server. Make sure run_tests.py is making" \ + "interop_server before calling this script." + exit 1 +} + +[ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { + echo >&2 "Can't find the port server. Start port server with tools/run_tests/start_port_server.py." + exit 1 +} + +PLAIN_PORT=$(curl localhost:32766/get) +TLS_PORT=$(curl localhost:32766/get) + +$BINDIR/interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & +$BINDIR/interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & + +trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT + +../../../tools/bazel run $SCHEME \ No newline at end of file diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index d3b028d4590..1cbf50e5264 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1150,7 +1150,7 @@ class ObjCLanguage(object): environ=_FORCE_ENVIRON_FOR_WRAPPERS)) out.append( self.config.job_spec( - ['src/objective-c/tests/run_one_test.sh'], + ['src/objective-c/tests/run_one_test_bazel.sh'], timeout_seconds=60 * 60, shortname='ios-test-unittests', cpu_cost=1e6, @@ -1184,7 +1184,7 @@ class ObjCLanguage(object): environ=_FORCE_ENVIRON_FOR_WRAPPERS)) out.append( self.config.job_spec( - ['src/objective-c/tests/run_one_test.sh'], + ['src/objective-c/tests/run_one_test_bazel.sh'], timeout_seconds=60 * 60, shortname='mac-test-basictests', cpu_cost=1e6, From a1c5c6053ed5e65b4f92f6f69bfdd83b3df72d50 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 7 Aug 2019 17:49:02 -0700 Subject: [PATCH 238/661] Added upb to python manifest --- PYTHON-MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/PYTHON-MANIFEST.in b/PYTHON-MANIFEST.in index 544fefbc487..f3ef08c8263 100644 --- a/PYTHON-MANIFEST.in +++ b/PYTHON-MANIFEST.in @@ -8,6 +8,7 @@ graft third_party/address_sorting graft third_party/boringssl graft third_party/cares graft third_party/nanopb +graft third_party/upb graft third_party/zlib include src/python/grpcio/_parallel_compile_patch.py include src/python/grpcio/_spawn_patch.py From dcd544451a60047ab35cc6d01e342a698881b59b Mon Sep 17 00:00:00 2001 From: Arjun Roy Date: Thu, 1 Aug 2019 15:53:19 -0700 Subject: [PATCH 239/661] Cache CH2 trace flag at hpack parser init. This removes what may be an atomic read for each header in each request. --- src/core/ext/transport/chttp2/transport/chttp2_transport.h | 1 + src/core/ext/transport/chttp2/transport/hpack_parser.cc | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.h b/src/core/ext/transport/chttp2/transport/chttp2_transport.h index c22cfb0ad7d..39574f93ec7 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.h +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.h @@ -29,6 +29,7 @@ extern grpc_core::TraceFlag grpc_http_trace; extern grpc_core::TraceFlag grpc_trace_http2_stream_state; extern grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount; +extern grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_hpack_parser; extern bool g_flow_control_enabled; diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc index 724c6c1bffc..be52d62be3a 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc @@ -38,6 +38,9 @@ #include "src/core/lib/surface/validate_metadata.h" #include "src/core/lib/transport/http2_errors.h" +grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_hpack_parser( + false, "chttp2_hpack_parser"); + typedef enum { NOT_BINARY, BINARY_BEGIN, @@ -643,7 +646,7 @@ static void GPR_ATTRIBUTE_NOINLINE on_hdr_log(grpc_mdelem md) { /* emission helpers */ template static grpc_error* on_hdr(grpc_chttp2_hpack_parser* p, grpc_mdelem md) { - if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) { + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_chttp2_hpack_parser)) { on_hdr_log(md); } if (do_add) { @@ -1021,7 +1024,7 @@ static grpc_error* parse_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p, /* finish parsing a max table size change */ static grpc_error* finish_max_tbl_size(grpc_chttp2_hpack_parser* p, const uint8_t* cur, const uint8_t* end) { - if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) { + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_chttp2_hpack_parser)) { gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index); } grpc_error* err = From 42737d976aa842d82afb7eea327a3ec6b97c8587 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 7 Aug 2019 19:37:19 -0700 Subject: [PATCH 240/661] Fixed prepare command to let bazel work after replacement --- gRPC-C++.podspec | 6 ++---- templates/gRPC-C++.podspec.template | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 7e728026e68..fd25efda82a 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -797,10 +797,8 @@ Pod::Spec.new do |s| end s.prepare_command = <<-END_OF_COMMAND - find src/cpp/ -type f ! -path '*.grpc_back' -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(pb(_.*)?\\.h)";#include ;g' - find src/cpp/ -type f -path '*.grpc_back' -print0 | xargs -0 rm - find src/core/ -type f ! -path '*.grpc_back' -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(pb(_.*)?\\.h)";#include ;g' - find src/core/ -type f -path '*.grpc_back' -print0 | xargs -0 rm + sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS==1\\\n #include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/core -type f -print | xargs grep -H -c '#include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/cpp -type f -print | xargs grep -H -c '#include ;g' - find src/cpp/ -type f -path '*.grpc_back' -print0 | xargs -0 rm - find src/core/ -type f ! -path '*.grpc_back' -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(pb(_.*)?\\.h)";#include ;g' - find src/core/ -type f -path '*.grpc_back' -print0 | xargs -0 rm + sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS==1\\\n #include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/core -type f -print | xargs grep -H -c '#include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/cpp -type f -print | xargs grep -H -c '#include Date: Wed, 7 Aug 2019 22:21:50 -0700 Subject: [PATCH 241/661] Added upb *.inc to python manifest --- PYTHON-MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PYTHON-MANIFEST.in b/PYTHON-MANIFEST.in index f3ef08c8263..aa044d84074 100644 --- a/PYTHON-MANIFEST.in +++ b/PYTHON-MANIFEST.in @@ -1,4 +1,4 @@ -recursive-include src/python/grpcio/grpc *.c *.h *.py *.pyx *.pxd *.pxi *.python *.pem +recursive-include src/python/grpcio/grpc *.c *.h *.inc *.py *.pyx *.pxd *.pxi *.python *.pem recursive-exclude src/python/grpcio/grpc/_cython *.so *.pyd graft src/python/grpcio/grpcio.egg-info graft src/core From 79f191114e291f0a7874370388f32fa6bced4f5f Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Wed, 7 Aug 2019 22:43:45 -0700 Subject: [PATCH 242/661] Use EDS in xds LB policy --- BUILD | 152 ++++- BUILD.gn | 52 +- CMakeLists.txt | 65 +- Makefile | 80 ++- build.yaml | 93 ++- config.m4 | 40 +- config.w32 | 49 +- gRPC-C++.podspec | 26 +- gRPC-Core.podspec | 78 ++- grpc.gemspec | 52 +- grpc.gyp | 55 +- package.xml | 52 +- .../grpc/lb/v1/google/protobuf/duration.pb.c | 19 - .../grpc/lb/v1/google/protobuf/duration.pb.h | 54 -- .../grpc/lb/v1/google/protobuf/timestamp.pb.c | 19 - .../grpc/lb/v1/google/protobuf/timestamp.pb.h | 54 -- .../proto/grpc/lb/v1/load_balancer.pb.c | 89 --- .../proto/grpc/lb/v1/load_balancer.pb.h | 164 ----- .../client_channel/lb_policy/xds/xds.cc | 438 ++++--------- .../lb_policy/xds/xds_load_balancer_api.cc | 463 ++++++------- .../lb_policy/xds/xds_load_balancer_api.h | 143 +++-- src/core/lib/transport/static_metadata.cc | 607 +++++++++--------- src/core/lib/transport/static_metadata.h | 149 ++--- src/proto/grpc/lb/v2/BUILD | 31 + src/proto/grpc/lb/v2/xds_for_test.proto | 553 ++++++++++++++++ src/python/grpcio/grpc_core_dependencies.py | 26 +- test/core/end2end/fuzzers/hpack.dictionary | 1 + test/cpp/end2end/BUILD | 8 +- test/cpp/end2end/xds_end2end_test.cc | 141 ++-- tools/codegen/core/gen_static_metadata.py | 1 + tools/distrib/check_nanopb_output.sh | 26 - tools/doxygen/Doxyfile.core.internal | 52 +- .../generated/sources_and_headers.json | 176 ++++- 33 files changed, 2339 insertions(+), 1669 deletions(-) delete mode 100644 src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c delete mode 100644 src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h delete mode 100644 src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c delete mode 100644 src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h delete mode 100644 src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c delete mode 100644 src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h create mode 100644 src/proto/grpc/lb/v2/BUILD create mode 100644 src/proto/grpc/lb/v2/xds_for_test.proto diff --git a/BUILD b/BUILD index 0f3b426ff06..7b7b4499a26 100644 --- a/BUILD +++ b/BUILD @@ -1192,24 +1192,6 @@ grpc_cc_library( ], ) -grpc_cc_library( - name = "grpclb_proto", - srcs = [ - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c", - ], - hdrs = [ - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h", - ], - external_deps = [ - "nanopb", - ], - language = "c++", -) - grpc_cc_library( name = "grpc_lb_policy_grpclb", srcs = [ @@ -1230,8 +1212,8 @@ grpc_cc_library( deps = [ "grpc_base", "grpc_client_channel", - "grpc_resolver_fake", "grpc_lb_upb", + "grpc_resolver_fake", ], ) @@ -1255,9 +1237,9 @@ grpc_cc_library( deps = [ "grpc_base", "grpc_client_channel", + "grpc_lb_upb", "grpc_resolver_fake", "grpc_secure", - "grpc_lb_upb", ], ) @@ -1280,10 +1262,11 @@ grpc_cc_library( ], language = "c++", deps = [ + "envoy_ads_upb", "grpc_base", "grpc_client_channel", + "grpc_lb_upb", "grpc_resolver_fake", - "grpclb_proto", ], ) @@ -1306,11 +1289,12 @@ grpc_cc_library( ], language = "c++", deps = [ + "envoy_ads_upb", "grpc_base", "grpc_client_channel", + "grpc_lb_upb", "grpc_resolver_fake", "grpc_secure", - "grpclb_proto", ], ) @@ -1979,8 +1963,8 @@ grpc_cc_library( language = "c++", public_hdrs = GRPCXX_PUBLIC_HDRS, deps = [ - "grpc++_codegen_base", "grpc", + "grpc++_codegen_base", "grpc_health_upb", ], ) @@ -1993,8 +1977,8 @@ grpc_cc_library( public_hdrs = GRPCXX_PUBLIC_HDRS, deps = [ "grpc++_codegen_base", - "grpc_unsecure", "grpc_health_upb", + "grpc_unsecure", ], ) @@ -2256,7 +2240,9 @@ grpc_cc_library( ], ) -# Once upb code-gen issue is resolved, use this. +# Once upb code-gen issue is resolved, use the targets commented below to replace the ones using +# upb-generated files. + # grpc_upb_proto_library( # name = "upb_load_report", # deps = ["@envoy_api//envoy/api/v2/endpoint:load_report_export"], @@ -2297,6 +2283,112 @@ grpc_cc_library( # ], # ) +grpc_cc_library( + name = "envoy_ads_upb", + srcs = [ + "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/cds.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/eds.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c", + "src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c", + "src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c", + ], + hdrs = [ + "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cds.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/eds.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h", + "src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h", + "src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h", + ], + external_deps = [ + "upb_lib", + ], + language = "c++", + deps = [ + ":envoy_core_upb", + ":envoy_type_upb", + ":google_api_upb", + ":proto_gen_validate_upb", + ], +) + +grpc_cc_library( + name = "envoy_core_upb", + srcs = [ + "src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c", + ], + hdrs = [ + "src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h", + ], + external_deps = [ + "upb_lib", + ], + language = "c++", + deps = [ + ":envoy_type_upb", + ":google_api_upb", + ":proto_gen_validate_upb", + ], +) + +grpc_cc_library( + name = "envoy_type_upb", + srcs = [ + "src/core/ext/upb-generated/envoy/type/percent.upb.c", + "src/core/ext/upb-generated/envoy/type/range.upb.c", + ], + hdrs = [ + "src/core/ext/upb-generated/envoy/type/percent.upb.h", + "src/core/ext/upb-generated/envoy/type/range.upb.h", + ], + external_deps = [ + "upb_lib", + ], + language = "c++", + deps = [ + ":google_api_upb", + ":proto_gen_validate_upb", + ], +) + +grpc_cc_library( + name = "proto_gen_validate_upb", + srcs = [ + "src/core/ext/upb-generated/gogoproto/gogo.upb.c", + "src/core/ext/upb-generated/validate/validate.upb.c", + ], + hdrs = [ + "src/core/ext/upb-generated/gogoproto/gogo.upb.h", + "src/core/ext/upb-generated/validate/validate.upb.h", + ], + external_deps = [ + "upb_lib", + ], + language = "c++", + deps = [ + ":google_api_upb", + ], +) + # Once upb code-gen issue is resolved, replace grpc_health_upb with this. # grpc_upb_proto_library( # name = "grpc_health_upb", @@ -2321,22 +2413,28 @@ grpc_cc_library( grpc_cc_library( name = "google_api_upb", srcs = [ + "src/core/ext/upb-generated/google/api/annotations.upb.c", + "src/core/ext/upb-generated/google/api/http.upb.c", "src/core/ext/upb-generated/google/protobuf/any.upb.c", - "src/core/ext/upb-generated/google/protobuf/duration.upb.c", "src/core/ext/upb-generated/google/protobuf/descriptor.upb.c", + "src/core/ext/upb-generated/google/protobuf/duration.upb.c", "src/core/ext/upb-generated/google/protobuf/empty.upb.c", "src/core/ext/upb-generated/google/protobuf/struct.upb.c", "src/core/ext/upb-generated/google/protobuf/timestamp.upb.c", "src/core/ext/upb-generated/google/protobuf/wrappers.upb.c", + "src/core/ext/upb-generated/google/rpc/status.upb.c", ], hdrs = [ + "src/core/ext/upb-generated/google/api/annotations.upb.h", + "src/core/ext/upb-generated/google/api/http.upb.h", "src/core/ext/upb-generated/google/protobuf/any.upb.h", - "src/core/ext/upb-generated/google/protobuf/duration.upb.h", "src/core/ext/upb-generated/google/protobuf/descriptor.upb.h", + "src/core/ext/upb-generated/google/protobuf/duration.upb.h", "src/core/ext/upb-generated/google/protobuf/empty.upb.h", "src/core/ext/upb-generated/google/protobuf/struct.upb.h", "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h", + "src/core/ext/upb-generated/google/rpc/status.upb.h", ], external_deps = [ "upb_lib", diff --git a/BUILD.gn b/BUILD.gn index 95857cc245c..e63f7d2f2f1 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -263,12 +263,6 @@ config("grpc_config") { "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h", "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc", "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h", "src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc", "src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc", "src/core/ext/filters/client_channel/lb_policy/subchannel_list.h", @@ -410,6 +404,48 @@ config("grpc_config") { "src/core/ext/transport/inproc/inproc_plugin.cc", "src/core/ext/transport/inproc/inproc_transport.cc", "src/core/ext/transport/inproc/inproc_transport.h", + "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cds.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/cds.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/eds.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/eds.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h", + "src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c", + "src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h", + "src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c", + "src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h", + "src/core/ext/upb-generated/envoy/type/percent.upb.c", + "src/core/ext/upb-generated/envoy/type/percent.upb.h", + "src/core/ext/upb-generated/envoy/type/range.upb.c", + "src/core/ext/upb-generated/envoy/type/range.upb.h", + "src/core/ext/upb-generated/gogoproto/gogo.upb.c", + "src/core/ext/upb-generated/gogoproto/gogo.upb.h", + "src/core/ext/upb-generated/google/api/annotations.upb.c", + "src/core/ext/upb-generated/google/api/annotations.upb.h", + "src/core/ext/upb-generated/google/api/http.upb.c", + "src/core/ext/upb-generated/google/api/http.upb.h", "src/core/ext/upb-generated/google/protobuf/any.upb.c", "src/core/ext/upb-generated/google/protobuf/any.upb.h", "src/core/ext/upb-generated/google/protobuf/descriptor.upb.c", @@ -424,10 +460,14 @@ config("grpc_config") { "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", "src/core/ext/upb-generated/google/protobuf/wrappers.upb.c", "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h", + "src/core/ext/upb-generated/google/rpc/status.upb.c", + "src/core/ext/upb-generated/google/rpc/status.upb.h", "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c", "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h", "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c", "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h", + "src/core/ext/upb-generated/validate/validate.upb.c", + "src/core/ext/upb-generated/validate/validate.upb.h", "src/core/lib/avl/avl.cc", "src/core/lib/avl/avl.h", "src/core/lib/backoff/backoff.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c3c7d3feb0..b1c70db8fcf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1323,6 +1323,8 @@ add_library(grpc src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c + src/core/ext/upb-generated/google/api/annotations.upb.c + src/core/ext/upb-generated/google/api/http.upb.c src/core/ext/upb-generated/google/protobuf/any.upb.c src/core/ext/upb-generated/google/protobuf/descriptor.upb.c src/core/ext/upb-generated/google/protobuf/duration.upb.c @@ -1330,14 +1332,32 @@ add_library(grpc src/core/ext/upb-generated/google/protobuf/struct.upb.c src/core/ext/upb-generated/google/protobuf/timestamp.upb.c src/core/ext/upb-generated/google/protobuf/wrappers.upb.c + src/core/ext/upb-generated/google/rpc/status.upb.c src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc src/core/ext/filters/client_channel/lb_policy/xds/xds.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c + src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c + src/core/ext/upb-generated/envoy/api/v2/cds.upb.c + src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c + src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c + src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c + src/core/ext/upb-generated/envoy/api/v2/eds.upb.c + src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c + src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c + src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c + src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c + src/core/ext/upb-generated/envoy/type/percent.upb.c + src/core/ext/upb-generated/envoy/type/range.upb.c + src/core/ext/upb-generated/gogoproto/gogo.upb.c + src/core/ext/upb-generated/validate/validate.upb.c src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc @@ -2804,6 +2824,8 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c + src/core/ext/upb-generated/google/api/annotations.upb.c + src/core/ext/upb-generated/google/api/http.upb.c src/core/ext/upb-generated/google/protobuf/any.upb.c src/core/ext/upb-generated/google/protobuf/descriptor.upb.c src/core/ext/upb-generated/google/protobuf/duration.upb.c @@ -2811,16 +2833,31 @@ add_library(grpc_unsecure src/core/ext/upb-generated/google/protobuf/struct.upb.c src/core/ext/upb-generated/google/protobuf/timestamp.upb.c src/core/ext/upb-generated/google/protobuf/wrappers.upb.c + src/core/ext/upb-generated/google/rpc/status.upb.c src/core/ext/filters/client_channel/lb_policy/xds/xds.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c - third_party/nanopb/pb_common.c - third_party/nanopb/pb_decode.c - third_party/nanopb/pb_encode.c + src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c + src/core/ext/upb-generated/envoy/api/v2/cds.upb.c + src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c + src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c + src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c + src/core/ext/upb-generated/envoy/api/v2/eds.upb.c + src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c + src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c + src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c + src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c + src/core/ext/upb-generated/envoy/type/percent.upb.c + src/core/ext/upb-generated/envoy/type/range.upb.c + src/core/ext/upb-generated/gogoproto/gogo.upb.c + src/core/ext/upb-generated/validate/validate.upb.c src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc src/core/ext/filters/census/grpc_context.cc @@ -17689,17 +17726,17 @@ endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) add_executable(xds_end2end_test - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v1/load_balancer.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v1/load_balancer.pb.h - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v1/load_balancer.grpc.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/xds_for_test.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/xds_for_test.grpc.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/xds_for_test.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/xds_for_test.grpc.pb.h test/cpp/end2end/xds_end2end_test.cc third_party/googletest/googletest/src/gtest-all.cc third_party/googletest/googlemock/src/gmock-all.cc ) protobuf_generate_grpc_cpp( - src/proto/grpc/lb/v1/load_balancer.proto + src/proto/grpc/lb/v2/xds_for_test.proto ) target_include_directories(xds_end2end_test diff --git a/Makefile b/Makefile index 4ea6acdb4bf..51895104453 100644 --- a/Makefile +++ b/Makefile @@ -2704,6 +2704,22 @@ $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc: src/proto/grpc/lb/v1/lo $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< endif +ifeq ($(NO_PROTOC),true) +$(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.pb.cc: protoc_dep_error +$(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.grpc.pb.cc: protoc_dep_error +else + +$(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.pb.cc: src/proto/grpc/lb/v2/xds_for_test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[PROTOC] Generating protobuf CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $< + +$(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.grpc.pb.cc: src/proto/grpc/lb/v2/xds_for_test.proto $(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.pb.cc $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< +endif + ifeq ($(NO_PROTOC),true) $(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.pb.cc: protoc_dep_error $(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc: protoc_dep_error @@ -3814,6 +3830,8 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ + src/core/ext/upb-generated/google/api/annotations.upb.c \ + src/core/ext/upb-generated/google/api/http.upb.c \ src/core/ext/upb-generated/google/protobuf/any.upb.c \ src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ src/core/ext/upb-generated/google/protobuf/duration.upb.c \ @@ -3821,14 +3839,32 @@ LIBGRPC_SRC = \ src/core/ext/upb-generated/google/protobuf/struct.upb.c \ src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ + src/core/ext/upb-generated/google/rpc/status.upb.c \ src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ + src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/cds.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/eds.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c \ + src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c \ + src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c \ + src/core/ext/upb-generated/envoy/type/percent.upb.c \ + src/core/ext/upb-generated/envoy/type/range.upb.c \ + src/core/ext/upb-generated/gogoproto/gogo.upb.c \ + src/core/ext/upb-generated/validate/validate.upb.c \ src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \ src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \ src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc \ @@ -5219,6 +5255,8 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ + src/core/ext/upb-generated/google/api/annotations.upb.c \ + src/core/ext/upb-generated/google/api/http.upb.c \ src/core/ext/upb-generated/google/protobuf/any.upb.c \ src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ src/core/ext/upb-generated/google/protobuf/duration.upb.c \ @@ -5226,16 +5264,31 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/upb-generated/google/protobuf/struct.upb.c \ src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ + src/core/ext/upb-generated/google/rpc/status.upb.c \ src/core/ext/filters/client_channel/lb_policy/xds/xds.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ - third_party/nanopb/pb_common.c \ - third_party/nanopb/pb_decode.c \ - third_party/nanopb/pb_encode.c \ + src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/cds.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/eds.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c \ + src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c \ + src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c \ + src/core/ext/upb-generated/envoy/type/percent.upb.c \ + src/core/ext/upb-generated/envoy/type/range.upb.c \ + src/core/ext/upb-generated/gogoproto/gogo.upb.c \ + src/core/ext/upb-generated/validate/validate.upb.c \ src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \ src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \ src/core/ext/filters/census/grpc_context.cc \ @@ -19749,7 +19802,7 @@ endif XDS_END2END_TEST_SRC = \ - $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.pb.cc $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc \ + $(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.grpc.pb.cc \ test/cpp/end2end/xds_end2end_test.cc \ XDS_END2END_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(XDS_END2END_TEST_SRC)))) @@ -19781,7 +19834,7 @@ endif endif -$(OBJDIR)/$(CONFIG)/src/proto/grpc/lb/v1/load_balancer.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(OBJDIR)/$(CONFIG)/src/proto/grpc/lb/v2/xds_for_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/cpp/end2end/xds_end2end_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -19792,7 +19845,7 @@ ifneq ($(NO_DEPS),true) -include $(XDS_END2END_TEST_OBJS:.o=.dep) endif endif -$(OBJDIR)/$(CONFIG)/test/cpp/end2end/xds_end2end_test.o: $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.pb.cc $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/end2end/xds_end2end_test.o: $(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.grpc.pb.cc PUBLIC_HEADERS_MUST_BE_C89_SRC = \ @@ -22567,6 +22620,9 @@ test/cpp/util/string_ref_helper.cc: $(OPENSSL_DEP) test/cpp/util/subprocess.cc: $(OPENSSL_DEP) test/cpp/util/test_config_cc.cc: $(OPENSSL_DEP) test/cpp/util/test_credentials_provider.cc: $(OPENSSL_DEP) +third_party/nanopb/pb_common.c: $(OPENSSL_DEP) +third_party/nanopb/pb_decode.c: $(OPENSSL_DEP) +third_party/nanopb/pb_encode.c: $(OPENSSL_DEP) endif .PHONY: all strip tools dep_error openssl_dep_error openssl_dep_message git_update stop buildtests buildtests_c buildtests_cxx test test_c test_cxx install install_c install_cxx install-headers install-headers_c install-headers_cxx install-shared install-shared_c install-shared_cxx install-static install-static_c install-static_cxx strip strip-shared strip-static strip_c strip-shared_c strip-static_c strip_cxx strip-shared_cxx strip-static_cxx dep_c dep_cxx bins_dep_c bins_dep_cxx clean diff --git a/build.yaml b/build.yaml index 24da28e2591..a18b916ec66 100644 --- a/build.yaml +++ b/build.yaml @@ -122,8 +122,67 @@ filegroups: - test/core/util/cmdline.cc uses: - gpr_base_headers +- name: envoy_ads_upb + headers: + - src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h + - src/core/ext/upb-generated/envoy/api/v2/cds.upb.h + - src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h + - src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h + - src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h + - src/core/ext/upb-generated/envoy/api/v2/eds.upb.h + - src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h + - src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h + - src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h + - src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h + src: + - src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c + - src/core/ext/upb-generated/envoy/api/v2/cds.upb.c + - src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c + - src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c + - src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c + - src/core/ext/upb-generated/envoy/api/v2/eds.upb.c + - src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c + - src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c + - src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c + - src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c + uses: + - envoy_core_upb + - envoy_type_upb + - google_api_upb + - proto_gen_validate_upb +- name: envoy_core_upb + headers: + - src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h + - src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h + - src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h + - src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h + - src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h + - src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h + src: + - src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c + - src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c + - src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c + - src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c + - src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c + - src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c + uses: + - envoy_type_upb + - google_api_upb + - proto_gen_validate_upb +- name: envoy_type_upb + headers: + - src/core/ext/upb-generated/envoy/type/percent.upb.h + - src/core/ext/upb-generated/envoy/type/range.upb.h + src: + - src/core/ext/upb-generated/envoy/type/percent.upb.c + - src/core/ext/upb-generated/envoy/type/range.upb.c + uses: + - google_api_upb + - proto_gen_validate_upb - name: google_api_upb headers: + - src/core/ext/upb-generated/google/api/annotations.upb.h + - src/core/ext/upb-generated/google/api/http.upb.h - src/core/ext/upb-generated/google/protobuf/any.upb.h - src/core/ext/upb-generated/google/protobuf/descriptor.upb.h - src/core/ext/upb-generated/google/protobuf/duration.upb.h @@ -131,7 +190,10 @@ filegroups: - src/core/ext/upb-generated/google/protobuf/struct.upb.h - src/core/ext/upb-generated/google/protobuf/timestamp.upb.h - src/core/ext/upb-generated/google/protobuf/wrappers.upb.h + - src/core/ext/upb-generated/google/rpc/status.upb.h src: + - src/core/ext/upb-generated/google/api/annotations.upb.c + - src/core/ext/upb-generated/google/api/http.upb.c - src/core/ext/upb-generated/google/protobuf/any.upb.c - src/core/ext/upb-generated/google/protobuf/descriptor.upb.c - src/core/ext/upb-generated/google/protobuf/duration.upb.c @@ -139,6 +201,7 @@ filegroups: - src/core/ext/upb-generated/google/protobuf/struct.upb.c - src/core/ext/upb-generated/google/protobuf/timestamp.upb.c - src/core/ext/upb-generated/google/protobuf/wrappers.upb.c + - src/core/ext/upb-generated/google/rpc/status.upb.c - name: gpr_base src: - src/core/lib/gpr/alloc.cc @@ -778,11 +841,11 @@ filegroups: - src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc plugin: grpc_lb_policy_xds uses: + - envoy_ads_upb - grpc_base - grpc_client_channel - grpc_resolver_fake - - grpclb_proto - - nanopb + - grpc_lb_upb - name: grpc_lb_policy_xds_secure headers: - src/core/ext/filters/client_channel/lb_policy/xds/xds.h @@ -796,12 +859,12 @@ filegroups: - src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc plugin: grpc_lb_policy_xds uses: + - envoy_ads_upb - grpc_base - grpc_client_channel - grpc_resolver_fake - grpc_secure - - grpclb_proto - - nanopb + - grpc_lb_upb - name: grpc_lb_subchannel_list headers: - src/core/ext/filters/client_channel/lb_policy/subchannel_list.h @@ -1194,17 +1257,6 @@ filegroups: uses: - grpc_base - grpc_server_backward_compatibility -- name: grpclb_proto - headers: - - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h - - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h - - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h - src: - - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c - - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c - - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c - uses: - - nanopb - name: nanopb src: - third_party/nanopb/pb_common.c @@ -1218,6 +1270,15 @@ filegroups: - third_party/nanopb/pb_common.h - third_party/nanopb/pb_decode.h - third_party/nanopb/pb_encode.h +- name: proto_gen_validate_upb + headers: + - src/core/ext/upb-generated/gogoproto/gogo.upb.h + - src/core/ext/upb-generated/validate/validate.upb.h + src: + - src/core/ext/upb-generated/gogoproto/gogo.upb.c + - src/core/ext/upb-generated/validate/validate.upb.c + uses: + - google_api_upb - name: transport_security_test_lib build: test headers: @@ -5986,7 +6047,7 @@ targets: build: test language: c++ src: - - src/proto/grpc/lb/v1/load_balancer.proto + - src/proto/grpc/lb/v2/xds_for_test.proto - test/cpp/end2end/xds_end2end_test.cc deps: - grpc++_test_util diff --git a/config.m4 b/config.m4 index a23d65f8542..1bc581e6b67 100644 --- a/config.m4 +++ b/config.m4 @@ -402,6 +402,8 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ + src/core/ext/upb-generated/google/api/annotations.upb.c \ + src/core/ext/upb-generated/google/api/http.upb.c \ src/core/ext/upb-generated/google/protobuf/any.upb.c \ src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ src/core/ext/upb-generated/google/protobuf/duration.upb.c \ @@ -409,14 +411,32 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/upb-generated/google/protobuf/struct.upb.c \ src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ + src/core/ext/upb-generated/google/rpc/status.upb.c \ src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ + src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/cds.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/eds.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c \ + src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c \ + src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c \ + src/core/ext/upb-generated/envoy/type/percent.upb.c \ + src/core/ext/upb-generated/envoy/type/range.upb.c \ + src/core/ext/upb-generated/gogoproto/gogo.upb.c \ + src/core/ext/upb-generated/validate/validate.upb.c \ src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \ src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \ src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc \ @@ -709,8 +729,6 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/health) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/grpclb) - PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1) - PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/pick_first) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/round_robin) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/xds) @@ -737,9 +755,21 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/server/secure) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/transport) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/inproc) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/envoy/api/v2) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/envoy/api/v2/auth) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/envoy/api/v2/cluster) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/envoy/api/v2/core) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/envoy/api/v2/endpoint) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/envoy/service/discovery/v2) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/envoy/service/load_stats/v2) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/envoy/type) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/gogoproto) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/google/api) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/google/protobuf) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/google/rpc) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/health/v1) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/lb/v1) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/validate) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/avl) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/backoff) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/channel) diff --git a/config.w32 b/config.w32 index 27635b54544..52553fe5d5f 100644 --- a/config.w32 +++ b/config.w32 @@ -375,6 +375,8 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\grpclb_client_stats.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\load_balancer_api.cc " + "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb\\v1\\load_balancer.upb.c " + + "src\\core\\ext\\upb-generated\\google\\api\\annotations.upb.c " + + "src\\core\\ext\\upb-generated\\google\\api\\http.upb.c " + "src\\core\\ext\\upb-generated\\google\\protobuf\\any.upb.c " + "src\\core\\ext\\upb-generated\\google\\protobuf\\descriptor.upb.c " + "src\\core\\ext\\upb-generated\\google\\protobuf\\duration.upb.c " + @@ -382,14 +384,32 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\upb-generated\\google\\protobuf\\struct.upb.c " + "src\\core\\ext\\upb-generated\\google\\protobuf\\timestamp.upb.c " + "src\\core\\ext\\upb-generated\\google\\protobuf\\wrappers.upb.c " + + "src\\core\\ext\\upb-generated\\google\\rpc\\status.upb.c " + "src\\core\\ext\\filters\\client_channel\\resolver\\fake\\fake_resolver.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds_channel_secure.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds_client_stats.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds_load_balancer_api.cc " + - "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\google\\protobuf\\duration.pb.c " + - "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\google\\protobuf\\timestamp.pb.c " + - "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\load_balancer.pb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\auth\\cert.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\cds.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\cluster\\circuit_breaker.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\cluster\\outlier_detection.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\discovery.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\eds.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\endpoint\\endpoint.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\endpoint\\load_report.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\service\\discovery\\v2\\ads.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\service\\load_stats\\v2\\lrs.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\core\\address.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\core\\base.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\core\\config_source.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\core\\grpc_service.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\core\\health_check.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\core\\protocol.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\type\\percent.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\type\\range.upb.c " + + "src\\core\\ext\\upb-generated\\gogoproto\\gogo.upb.c " + + "src\\core\\ext\\upb-generated\\validate\\validate.upb.c " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\pick_first\\pick_first.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\round_robin\\round_robin.cc " + "src\\core\\ext\\filters\\client_channel\\resolver\\dns\\c_ares\\dns_resolver_ares.cc " + @@ -714,12 +734,6 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\health"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\google"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\proto\\grpc\\lb\\v1\\google\\protobuf"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\pick_first"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\round_robin"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\xds"); @@ -750,8 +764,24 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\transport"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\inproc"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\envoy"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\envoy\\api"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\envoy\\api\\v2"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\envoy\\api\\v2\\auth"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\envoy\\api\\v2\\cluster"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\envoy\\api\\v2\\core"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\envoy\\api\\v2\\endpoint"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\envoy\\service"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\envoy\\service\\discovery"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\envoy\\service\\discovery\\v2"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\envoy\\service\\load_stats"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\envoy\\service\\load_stats\\v2"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\envoy\\type"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\gogoproto"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\google"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\google\\api"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\google\\protobuf"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\google\\rpc"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc"); @@ -759,6 +789,7 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health\\v1"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb\\v1"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\validate"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\avl"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\backoff"); diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index b90a006e9b1..e0c8a570d48 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -587,6 +587,8 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', + 'src/core/ext/upb-generated/google/api/annotations.upb.h', + 'src/core/ext/upb-generated/google/api/http.upb.h', 'src/core/ext/upb-generated/google/protobuf/any.upb.h', 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h', 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', @@ -594,13 +596,31 @@ Pod::Spec.new do |s| 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', + 'src/core/ext/upb-generated/google/rpc/status.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h', + 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h', + 'src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h', + 'src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h', + 'src/core/ext/upb-generated/envoy/type/percent.upb.h', + 'src/core/ext/upb-generated/envoy/type/range.upb.h', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.h', + 'src/core/ext/upb-generated/validate/validate.upb.h', 'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 6ee74687c74..0d6a282a94a 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -543,6 +543,8 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', + 'src/core/ext/upb-generated/google/api/annotations.upb.h', + 'src/core/ext/upb-generated/google/api/http.upb.h', 'src/core/ext/upb-generated/google/protobuf/any.upb.h', 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h', 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', @@ -550,13 +552,31 @@ Pod::Spec.new do |s| 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', + 'src/core/ext/upb-generated/google/rpc/status.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h', + 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h', + 'src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h', + 'src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h', + 'src/core/ext/upb-generated/envoy/type/percent.upb.h', + 'src/core/ext/upb-generated/envoy/type/range.upb.h', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.h', + 'src/core/ext/upb-generated/validate/validate.upb.h', 'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h', @@ -879,6 +899,8 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', + 'src/core/ext/upb-generated/google/api/annotations.upb.c', + 'src/core/ext/upb-generated/google/api/http.upb.c', 'src/core/ext/upb-generated/google/protobuf/any.upb.c', 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', @@ -886,14 +908,32 @@ Pod::Spec.new do |s| 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', + 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', + 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c', + 'src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c', + 'src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c', + 'src/core/ext/upb-generated/envoy/type/percent.upb.c', + 'src/core/ext/upb-generated/envoy/type/range.upb.c', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', + 'src/core/ext/upb-generated/validate/validate.upb.c', 'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc', @@ -1232,6 +1272,8 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', + 'src/core/ext/upb-generated/google/api/annotations.upb.h', + 'src/core/ext/upb-generated/google/api/http.upb.h', 'src/core/ext/upb-generated/google/protobuf/any.upb.h', 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h', 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', @@ -1239,13 +1281,31 @@ Pod::Spec.new do |s| 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', + 'src/core/ext/upb-generated/google/rpc/status.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h', + 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h', + 'src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h', + 'src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h', + 'src/core/ext/upb-generated/envoy/type/percent.upb.h', + 'src/core/ext/upb-generated/envoy/type/range.upb.h', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.h', + 'src/core/ext/upb-generated/validate/validate.upb.h', 'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h', diff --git a/grpc.gemspec b/grpc.gemspec index af2129350ef..2c658f48d80 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -476,6 +476,8 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h ) s.files += %w( src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/api/annotations.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/api/http.upb.h ) s.files += %w( src/core/ext/upb-generated/google/protobuf/any.upb.h ) s.files += %w( src/core/ext/upb-generated/google/protobuf/descriptor.upb.h ) s.files += %w( src/core/ext/upb-generated/google/protobuf/duration.upb.h ) @@ -483,13 +485,31 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/upb-generated/google/protobuf/struct.upb.h ) s.files += %w( src/core/ext/upb-generated/google/protobuf/timestamp.upb.h ) s.files += %w( src/core/ext/upb-generated/google/protobuf/wrappers.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/rpc/status.upb.h ) s.files += %w( src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h ) - s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h ) - s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h ) - s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cds.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/eds.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/type/percent.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/type/range.upb.h ) + s.files += %w( src/core/ext/upb-generated/gogoproto/gogo.upb.h ) + s.files += %w( src/core/ext/upb-generated/validate/validate.upb.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/subchannel_list.h ) s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h ) s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h ) @@ -815,6 +835,8 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc ) s.files += %w( src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/api/annotations.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/api/http.upb.c ) s.files += %w( src/core/ext/upb-generated/google/protobuf/any.upb.c ) s.files += %w( src/core/ext/upb-generated/google/protobuf/descriptor.upb.c ) s.files += %w( src/core/ext/upb-generated/google/protobuf/duration.upb.c ) @@ -822,14 +844,32 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/upb-generated/google/protobuf/struct.upb.c ) s.files += %w( src/core/ext/upb-generated/google/protobuf/timestamp.upb.c ) s.files += %w( src/core/ext/upb-generated/google/protobuf/wrappers.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/rpc/status.upb.c ) s.files += %w( src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc ) - s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c ) - s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c ) - s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cds.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/eds.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/type/percent.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/type/range.upb.c ) + s.files += %w( src/core/ext/upb-generated/gogoproto/gogo.upb.c ) + s.files += %w( src/core/ext/upb-generated/validate/validate.upb.c ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc ) s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc ) diff --git a/grpc.gyp b/grpc.gyp index 040831ec4f3..5241a57007a 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -612,6 +612,8 @@ 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', + 'src/core/ext/upb-generated/google/api/annotations.upb.c', + 'src/core/ext/upb-generated/google/api/http.upb.c', 'src/core/ext/upb-generated/google/protobuf/any.upb.c', 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', @@ -619,14 +621,32 @@ 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', + 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', + 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c', + 'src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c', + 'src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c', + 'src/core/ext/upb-generated/envoy/type/percent.upb.c', + 'src/core/ext/upb-generated/envoy/type/range.upb.c', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', + 'src/core/ext/upb-generated/validate/validate.upb.c', 'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc', @@ -1425,6 +1445,8 @@ 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', + 'src/core/ext/upb-generated/google/api/annotations.upb.c', + 'src/core/ext/upb-generated/google/api/http.upb.c', 'src/core/ext/upb-generated/google/protobuf/any.upb.c', 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', @@ -1432,16 +1454,31 @@ 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', + 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', - 'third_party/nanopb/pb_common.c', - 'third_party/nanopb/pb_decode.c', - 'third_party/nanopb/pb_encode.c', + 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c', + 'src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c', + 'src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c', + 'src/core/ext/upb-generated/envoy/type/percent.upb.c', + 'src/core/ext/upb-generated/envoy/type/range.upb.c', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', + 'src/core/ext/upb-generated/validate/validate.upb.c', 'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'src/core/ext/filters/census/grpc_context.cc', diff --git a/package.xml b/package.xml index 5352a9f43d7..1e1bc3d4176 100644 --- a/package.xml +++ b/package.xml @@ -481,6 +481,8 @@ + + @@ -488,13 +490,31 @@ + - - - + + + + + + + + + + + + + + + + + + + + @@ -820,6 +840,8 @@ + + @@ -827,14 +849,32 @@ + - - - + + + + + + + + + + + + + + + + + + + + diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c b/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c deleted file mode 100644 index 131d9b7cae0..00000000000 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.3.7-dev */ - -#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - - - -const pb_field_t google_protobuf_Duration_fields[3] = { - PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, google_protobuf_Duration, seconds, seconds, 0), - PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, google_protobuf_Duration, nanos, seconds, 0), - PB_LAST_FIELD -}; - - -/* @@protoc_insertion_point(eof) */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h deleted file mode 100644 index 93070c65b83..00000000000 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Automatically generated nanopb header */ -/* Generated by nanopb-0.3.7-dev */ - -#ifndef PB_GOOGLE_PROTOBUF_DURATION_PB_H_INCLUDED -#define PB_GOOGLE_PROTOBUF_DURATION_PB_H_INCLUDED -#include "pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Struct definitions */ -typedef struct _google_protobuf_Duration { - bool has_seconds; - int64_t seconds; - bool has_nanos; - int32_t nanos; -/* @@protoc_insertion_point(struct:google_protobuf_Duration) */ -} google_protobuf_Duration; - -/* Default values for struct fields */ - -/* Initializer values for message structs */ -#define google_protobuf_Duration_init_default {false, 0, false, 0} -#define google_protobuf_Duration_init_zero {false, 0, false, 0} - -/* Field tags (for use in manual encoding/decoding) */ -#define google_protobuf_Duration_seconds_tag 1 -#define google_protobuf_Duration_nanos_tag 2 - -/* Struct field encoding specification for nanopb */ -extern const pb_field_t google_protobuf_Duration_fields[3]; - -/* Maximum encoded size of messages (where known) */ -#define google_protobuf_Duration_size 22 - -/* Message IDs (where set with "msgid" option) */ -#ifdef PB_MSGID - -#define DURATION_MESSAGES \ - - -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif -/* @@protoc_insertion_point(eof) */ - -#endif diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c b/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c deleted file mode 100644 index b6f8ffc5592..00000000000 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.3.7-dev */ - -#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - - - -const pb_field_t google_protobuf_Timestamp_fields[3] = { - PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, google_protobuf_Timestamp, seconds, seconds, 0), - PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, google_protobuf_Timestamp, nanos, seconds, 0), - PB_LAST_FIELD -}; - - -/* @@protoc_insertion_point(eof) */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h deleted file mode 100644 index 7f484815244..00000000000 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Automatically generated nanopb header */ -/* Generated by nanopb-0.3.7-dev */ - -#ifndef PB_GOOGLE_PROTOBUF_TIMESTAMP_PB_H_INCLUDED -#define PB_GOOGLE_PROTOBUF_TIMESTAMP_PB_H_INCLUDED -#include "pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Struct definitions */ -typedef struct _google_protobuf_Timestamp { - bool has_seconds; - int64_t seconds; - bool has_nanos; - int32_t nanos; -/* @@protoc_insertion_point(struct:google_protobuf_Timestamp) */ -} google_protobuf_Timestamp; - -/* Default values for struct fields */ - -/* Initializer values for message structs */ -#define google_protobuf_Timestamp_init_default {false, 0, false, 0} -#define google_protobuf_Timestamp_init_zero {false, 0, false, 0} - -/* Field tags (for use in manual encoding/decoding) */ -#define google_protobuf_Timestamp_seconds_tag 1 -#define google_protobuf_Timestamp_nanos_tag 2 - -/* Struct field encoding specification for nanopb */ -extern const pb_field_t google_protobuf_Timestamp_fields[3]; - -/* Maximum encoded size of messages (where known) */ -#define google_protobuf_Timestamp_size 22 - -/* Message IDs (where set with "msgid" option) */ -#ifdef PB_MSGID - -#define TIMESTAMP_MESSAGES \ - - -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif -/* @@protoc_insertion_point(eof) */ - -#endif diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c b/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c deleted file mode 100644 index f6538e1349f..00000000000 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +++ /dev/null @@ -1,89 +0,0 @@ -/* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.3.7-dev */ - -#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - - - -const pb_field_t grpc_lb_v1_LoadBalanceRequest_fields[3] = { - PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v1_LoadBalanceRequest, initial_request, initial_request, &grpc_lb_v1_InitialLoadBalanceRequest_fields), - PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v1_LoadBalanceRequest, client_stats, initial_request, &grpc_lb_v1_ClientStats_fields), - PB_LAST_FIELD -}; - -const pb_field_t grpc_lb_v1_InitialLoadBalanceRequest_fields[2] = { - PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_lb_v1_InitialLoadBalanceRequest, name, name, 0), - PB_LAST_FIELD -}; - -const pb_field_t grpc_lb_v1_ClientStatsPerToken_fields[3] = { - PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, grpc_lb_v1_ClientStatsPerToken, load_balance_token, load_balance_token, 0), - PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStatsPerToken, num_calls, load_balance_token, 0), - PB_LAST_FIELD -}; - -const pb_field_t grpc_lb_v1_ClientStats_fields[7] = { - PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v1_ClientStats, timestamp, timestamp, &google_protobuf_Timestamp_fields), - PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_started, timestamp, 0), - PB_FIELD( 3, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished, num_calls_started, 0), - PB_FIELD( 6, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_with_client_failed_to_send, num_calls_finished, 0), - PB_FIELD( 7, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_known_received, num_calls_finished_with_client_failed_to_send, 0), - PB_FIELD( 8, MESSAGE , REPEATED, CALLBACK, OTHER, grpc_lb_v1_ClientStats, calls_finished_with_drop, num_calls_finished_known_received, &grpc_lb_v1_ClientStatsPerToken_fields), - PB_LAST_FIELD -}; - -const pb_field_t grpc_lb_v1_LoadBalanceResponse_fields[3] = { - PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v1_LoadBalanceResponse, initial_response, initial_response, &grpc_lb_v1_InitialLoadBalanceResponse_fields), - PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v1_LoadBalanceResponse, server_list, initial_response, &grpc_lb_v1_ServerList_fields), - PB_LAST_FIELD -}; - -const pb_field_t grpc_lb_v1_InitialLoadBalanceResponse_fields[3] = { - PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_lb_v1_InitialLoadBalanceResponse, load_balancer_delegate, load_balancer_delegate, 0), - PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval, load_balancer_delegate, &google_protobuf_Duration_fields), - PB_LAST_FIELD -}; - -const pb_field_t grpc_lb_v1_ServerList_fields[2] = { - PB_FIELD( 1, MESSAGE , REPEATED, CALLBACK, FIRST, grpc_lb_v1_ServerList, servers, servers, &grpc_lb_v1_Server_fields), - PB_LAST_FIELD -}; - -const pb_field_t grpc_lb_v1_Server_fields[5] = { - PB_FIELD( 1, BYTES , OPTIONAL, STATIC , FIRST, grpc_lb_v1_Server, ip_address, ip_address, 0), - PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, port, ip_address, 0), - PB_FIELD( 3, STRING , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, load_balance_token, port, 0), - PB_FIELD( 4, BOOL , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, drop, load_balance_token, 0), - PB_LAST_FIELD -}; - - -/* Check that field information fits in pb_field_t */ -#if !defined(PB_FIELD_32BIT) -/* If you get an error here, it means that you need to define PB_FIELD_32BIT - * compile-time option. You can do that in pb.h or on compiler command line. - * - * The reason you need to do this is that some of your messages contain tag - * numbers or field sizes that are larger than what can fit in 8 or 16 bit - * field descriptors. - */ -PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 65536 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 65536 && pb_membersize(grpc_lb_v1_ClientStats, calls_finished_with_drop) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 65536 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 65536 && pb_membersize(grpc_lb_v1_ServerList, servers) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStatsPerToken_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server) -#endif - -#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT) -/* If you get an error here, it means that you need to define PB_FIELD_16BIT - * compile-time option. You can do that in pb.h or on compiler command line. - * - * The reason you need to do this is that some of your messages contain tag - * numbers or field sizes that are larger than what can fit in the default - * 8 bit descriptors. - */ -PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 256 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 256 && pb_membersize(grpc_lb_v1_ClientStats, calls_finished_with_drop) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 256 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 256 && pb_membersize(grpc_lb_v1_ServerList, servers) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStatsPerToken_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server) -#endif - - -/* @@protoc_insertion_point(eof) */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h deleted file mode 100644 index a4ff516d8e1..00000000000 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +++ /dev/null @@ -1,164 +0,0 @@ -/* Automatically generated nanopb header */ -/* Generated by nanopb-0.3.7-dev */ - -#ifndef PB_GRPC_LB_V1_LOAD_BALANCER_PB_H_INCLUDED -#define PB_GRPC_LB_V1_LOAD_BALANCER_PB_H_INCLUDED -#include "pb.h" -#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h" -#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Struct definitions */ -typedef struct _grpc_lb_v1_ServerList { - pb_callback_t servers; -/* @@protoc_insertion_point(struct:grpc_lb_v1_ServerList) */ -} grpc_lb_v1_ServerList; - -typedef struct _grpc_lb_v1_ClientStats { - bool has_timestamp; - google_protobuf_Timestamp timestamp; - bool has_num_calls_started; - int64_t num_calls_started; - bool has_num_calls_finished; - int64_t num_calls_finished; - bool has_num_calls_finished_with_client_failed_to_send; - int64_t num_calls_finished_with_client_failed_to_send; - bool has_num_calls_finished_known_received; - int64_t num_calls_finished_known_received; - pb_callback_t calls_finished_with_drop; -/* @@protoc_insertion_point(struct:grpc_lb_v1_ClientStats) */ -} grpc_lb_v1_ClientStats; - -typedef struct _grpc_lb_v1_ClientStatsPerToken { - pb_callback_t load_balance_token; - bool has_num_calls; - int64_t num_calls; -/* @@protoc_insertion_point(struct:grpc_lb_v1_ClientStatsPerToken) */ -} grpc_lb_v1_ClientStatsPerToken; - -typedef struct _grpc_lb_v1_InitialLoadBalanceRequest { - bool has_name; - char name[128]; -/* @@protoc_insertion_point(struct:grpc_lb_v1_InitialLoadBalanceRequest) */ -} grpc_lb_v1_InitialLoadBalanceRequest; - -typedef struct _grpc_lb_v1_InitialLoadBalanceResponse { - bool has_load_balancer_delegate; - char load_balancer_delegate[64]; - bool has_client_stats_report_interval; - google_protobuf_Duration client_stats_report_interval; -/* @@protoc_insertion_point(struct:grpc_lb_v1_InitialLoadBalanceResponse) */ -} grpc_lb_v1_InitialLoadBalanceResponse; - -typedef PB_BYTES_ARRAY_T(16) grpc_lb_v1_Server_ip_address_t; -typedef struct _grpc_lb_v1_Server { - bool has_ip_address; - grpc_lb_v1_Server_ip_address_t ip_address; - bool has_port; - int32_t port; - bool has_load_balance_token; - char load_balance_token[50]; - bool has_drop; - bool drop; -/* @@protoc_insertion_point(struct:grpc_lb_v1_Server) */ -} grpc_lb_v1_Server; - -typedef struct _grpc_lb_v1_LoadBalanceRequest { - bool has_initial_request; - grpc_lb_v1_InitialLoadBalanceRequest initial_request; - bool has_client_stats; - grpc_lb_v1_ClientStats client_stats; -/* @@protoc_insertion_point(struct:grpc_lb_v1_LoadBalanceRequest) */ -} grpc_lb_v1_LoadBalanceRequest; - -typedef struct _grpc_lb_v1_LoadBalanceResponse { - bool has_initial_response; - grpc_lb_v1_InitialLoadBalanceResponse initial_response; - bool has_server_list; - grpc_lb_v1_ServerList server_list; -/* @@protoc_insertion_point(struct:grpc_lb_v1_LoadBalanceResponse) */ -} grpc_lb_v1_LoadBalanceResponse; - -/* Default values for struct fields */ - -/* Initializer values for message structs */ -#define grpc_lb_v1_LoadBalanceRequest_init_default {false, grpc_lb_v1_InitialLoadBalanceRequest_init_default, false, grpc_lb_v1_ClientStats_init_default} -#define grpc_lb_v1_InitialLoadBalanceRequest_init_default {false, ""} -#define grpc_lb_v1_ClientStatsPerToken_init_default {{{NULL}, NULL}, false, 0} -#define grpc_lb_v1_ClientStats_init_default {false, google_protobuf_Timestamp_init_default, false, 0, false, 0, false, 0, false, 0, {{NULL}, NULL}} -#define grpc_lb_v1_LoadBalanceResponse_init_default {false, grpc_lb_v1_InitialLoadBalanceResponse_init_default, false, grpc_lb_v1_ServerList_init_default} -#define grpc_lb_v1_InitialLoadBalanceResponse_init_default {false, "", false, google_protobuf_Duration_init_default} -#define grpc_lb_v1_ServerList_init_default {{{NULL}, NULL}} -#define grpc_lb_v1_Server_init_default {false, {0, {0}}, false, 0, false, "", false, 0} -#define grpc_lb_v1_LoadBalanceRequest_init_zero {false, grpc_lb_v1_InitialLoadBalanceRequest_init_zero, false, grpc_lb_v1_ClientStats_init_zero} -#define grpc_lb_v1_InitialLoadBalanceRequest_init_zero {false, ""} -#define grpc_lb_v1_ClientStatsPerToken_init_zero {{{NULL}, NULL}, false, 0} -#define grpc_lb_v1_ClientStats_init_zero {false, google_protobuf_Timestamp_init_zero, false, 0, false, 0, false, 0, false, 0, {{NULL}, NULL}} -#define grpc_lb_v1_LoadBalanceResponse_init_zero {false, grpc_lb_v1_InitialLoadBalanceResponse_init_zero, false, grpc_lb_v1_ServerList_init_zero} -#define grpc_lb_v1_InitialLoadBalanceResponse_init_zero {false, "", false, google_protobuf_Duration_init_zero} -#define grpc_lb_v1_ServerList_init_zero {{{NULL}, NULL}} -#define grpc_lb_v1_Server_init_zero {false, {0, {0}}, false, 0, false, "", false, 0} - -/* Field tags (for use in manual encoding/decoding) */ -#define grpc_lb_v1_ServerList_servers_tag 1 -#define grpc_lb_v1_ClientStats_timestamp_tag 1 -#define grpc_lb_v1_ClientStats_num_calls_started_tag 2 -#define grpc_lb_v1_ClientStats_num_calls_finished_tag 3 -#define grpc_lb_v1_ClientStats_num_calls_finished_with_client_failed_to_send_tag 6 -#define grpc_lb_v1_ClientStats_num_calls_finished_known_received_tag 7 -#define grpc_lb_v1_ClientStats_calls_finished_with_drop_tag 8 -#define grpc_lb_v1_ClientStatsPerToken_load_balance_token_tag 1 -#define grpc_lb_v1_ClientStatsPerToken_num_calls_tag 2 -#define grpc_lb_v1_InitialLoadBalanceRequest_name_tag 1 -#define grpc_lb_v1_InitialLoadBalanceResponse_load_balancer_delegate_tag 1 -#define grpc_lb_v1_InitialLoadBalanceResponse_client_stats_report_interval_tag 2 -#define grpc_lb_v1_Server_ip_address_tag 1 -#define grpc_lb_v1_Server_port_tag 2 -#define grpc_lb_v1_Server_load_balance_token_tag 3 -#define grpc_lb_v1_Server_drop_tag 4 -#define grpc_lb_v1_LoadBalanceRequest_initial_request_tag 1 -#define grpc_lb_v1_LoadBalanceRequest_client_stats_tag 2 -#define grpc_lb_v1_LoadBalanceResponse_initial_response_tag 1 -#define grpc_lb_v1_LoadBalanceResponse_server_list_tag 2 - -/* Struct field encoding specification for nanopb */ -extern const pb_field_t grpc_lb_v1_LoadBalanceRequest_fields[3]; -extern const pb_field_t grpc_lb_v1_InitialLoadBalanceRequest_fields[2]; -extern const pb_field_t grpc_lb_v1_ClientStatsPerToken_fields[3]; -extern const pb_field_t grpc_lb_v1_ClientStats_fields[7]; -extern const pb_field_t grpc_lb_v1_LoadBalanceResponse_fields[3]; -extern const pb_field_t grpc_lb_v1_InitialLoadBalanceResponse_fields[3]; -extern const pb_field_t grpc_lb_v1_ServerList_fields[2]; -extern const pb_field_t grpc_lb_v1_Server_fields[5]; - -/* Maximum encoded size of messages (where known) */ -#define grpc_lb_v1_LoadBalanceRequest_size (140 + grpc_lb_v1_ClientStats_size) -#define grpc_lb_v1_InitialLoadBalanceRequest_size 131 -/* grpc_lb_v1_ClientStatsPerToken_size depends on runtime parameters */ -/* grpc_lb_v1_ClientStats_size depends on runtime parameters */ -#define grpc_lb_v1_LoadBalanceResponse_size (98 + grpc_lb_v1_ServerList_size) -#define grpc_lb_v1_InitialLoadBalanceResponse_size 90 -/* grpc_lb_v1_ServerList_size depends on runtime parameters */ -#define grpc_lb_v1_Server_size 83 - -/* Message IDs (where set with "msgid" option) */ -#ifdef PB_MSGID - -#define LOAD_BALANCER_MESSAGES \ - - -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif -/* @@protoc_insertion_point(eof) */ - -#endif diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 9721972511a..851b84b2a71 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -116,10 +116,6 @@ TraceFlag grpc_lb_xds_trace(false, "xds"); namespace { constexpr char kXds[] = "xds_experimental"; -constexpr char kDefaultLocalityRegion[] = "xds_default_locality_region"; -constexpr char kDefaultLocalityZone[] = "xds_default_locality_zone"; -constexpr char kDefaultLocalitySubzone[] = "xds_default_locality_subzone"; -constexpr uint32_t kDefaultLocalityWeight = 3; class ParsedXdsConfig : public LoadBalancingPolicy::Config { public: @@ -158,9 +154,6 @@ class XdsLb : public LoadBalancingPolicy { void ResetBackoffLocked() override; private: - struct LocalityServerlistEntry; - using LocalityList = InlinedVector, 1>; - /// Contains a channel to the LB server and all the data related to the /// channel. class BalancerChannelState @@ -181,7 +174,7 @@ class XdsLb : public LoadBalancingPolicy { return client_stats_; } - bool seen_initial_response() const { return seen_initial_response_; } + bool seen_response() const { return seen_response_; } private: GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE @@ -220,7 +213,7 @@ class XdsLb : public LoadBalancingPolicy { // recv_message grpc_byte_buffer* recv_message_payload_ = nullptr; grpc_closure lb_on_balancer_message_received_; - bool seen_initial_response_ = false; + bool seen_response_ = false; // recv_trailing_metadata grpc_closure lb_on_balancer_status_received_; @@ -351,57 +344,16 @@ class XdsLb : public LoadBalancingPolicy { LoadBalancingPolicy* child_ = nullptr; }; - class LocalityName : public RefCounted { - public: - struct Less { - bool operator()(const RefCountedPtr& lhs, - const RefCountedPtr& rhs) { - int cmp_result = strcmp(lhs->region_.get(), rhs->region_.get()); - if (cmp_result != 0) return cmp_result < 0; - cmp_result = strcmp(lhs->zone_.get(), rhs->zone_.get()); - if (cmp_result != 0) return cmp_result < 0; - return strcmp(lhs->subzone_.get(), rhs->subzone_.get()) < 0; - } - }; - - LocalityName(UniquePtr region, UniquePtr zone, - UniquePtr subzone) - : region_(std::move(region)), - zone_(std::move(zone)), - subzone_(std::move(subzone)) {} - - bool operator==(const LocalityName& other) const { - return strcmp(region_.get(), other.region_.get()) == 0 && - strcmp(zone_.get(), other.zone_.get()) == 0 && - strcmp(subzone_.get(), other.subzone_.get()) == 0; - } - - const char* AsHumanReadableString() { - if (human_readable_string_ == nullptr) { - char* tmp; - gpr_asprintf(&tmp, "{region=\"%s\", zone=\"%s\", subzone=\"%s\"}", - region_.get(), zone_.get(), subzone_.get()); - human_readable_string_.reset(tmp); - } - return human_readable_string_.get(); - } - - private: - UniquePtr region_; - UniquePtr zone_; - UniquePtr subzone_; - UniquePtr human_readable_string_; - }; - class LocalityMap { public: class LocalityEntry : public InternallyRefCounted { public: LocalityEntry(RefCountedPtr parent, - RefCountedPtr name, uint32_t locality_weight); + RefCountedPtr name, + uint32_t locality_weight); ~LocalityEntry(); - void UpdateLocked(xds_grpclb_serverlist* serverlist, + void UpdateLocked(ServerAddressList serverlist, LoadBalancingPolicy::Config* child_policy_config, const grpc_channel_args* args); void ShutdownLocked(); @@ -441,7 +393,7 @@ class XdsLb : public LoadBalancingPolicy { const grpc_channel_args* args); RefCountedPtr parent_; - RefCountedPtr name_; + RefCountedPtr name_; OrphanablePtr child_policy_; OrphanablePtr pending_child_policy_; RefCountedPtr picker_ref_; @@ -449,35 +401,25 @@ class XdsLb : public LoadBalancingPolicy { uint32_t locality_weight_; }; - void UpdateLocked(const LocalityList& locality_list, + void UpdateLocked(const XdsLocalityList& locality_list, LoadBalancingPolicy::Config* child_policy_config, const grpc_channel_args* args, XdsLb* parent); void ShutdownLocked(); void ResetBackoffLocked(); private: - void PruneLocalities(const LocalityList& locality_list); - Map, OrphanablePtr, - LocalityName::Less> + void PruneLocalities(const XdsLocalityList& locality_list); + Map, OrphanablePtr, + XdsLocalityName::Less> map_; }; - struct LocalityServerlistEntry { - ~LocalityServerlistEntry() { xds_grpclb_destroy_serverlist(serverlist); } - - RefCountedPtr locality_name; - uint32_t locality_weight; - // The deserialized response from the balancer. May be nullptr until one - // such response has arrived. - xds_grpclb_serverlist* serverlist; - }; - ~XdsLb(); void ShutdownLocked() override; // Helper function used in UpdateLocked(). - void ProcessAddressesAndChannelArgsLocked(const ServerAddressList& addresses, + void ProcessAddressesAndChannelArgsLocked(ServerAddressList addresses, const grpc_channel_args& args); // Parses the xds config given the JSON node of the first child of XdsConfig. @@ -499,7 +441,7 @@ class XdsLb : public LoadBalancingPolicy { const char* name, const grpc_channel_args* args); void MaybeExitFallbackMode(); - // Who the client is trying to communicate with. + // Name of the backend server to connect to. const char* server_name_ = nullptr; // Name of the balancer to connect to. @@ -547,7 +489,7 @@ class XdsLb : public LoadBalancingPolicy { LocalityMap locality_map_; // TODO(mhaidry) : Add support for multiple maps of localities // with different priorities - LocalityList locality_serverlist_; + XdsLocalityList locality_list_; // TODO(mhaidry) : Add a pending locality map that may be swapped with the // the current one when new localities in the pending map are ready // to accept connections @@ -677,79 +619,6 @@ void XdsLb::FallbackHelper::AddTraceEvent(TraceSeverity severity, parent_->channel_control_helper()->AddTraceEvent(severity, message); } -// -// serverlist parsing code -// - -// Returns the backend addresses extracted from the given addresses. -ServerAddressList ExtractBackendAddresses(const ServerAddressList& addresses) { - ServerAddressList backend_addresses; - for (size_t i = 0; i < addresses.size(); ++i) { - if (!addresses[i].IsBalancer()) { - backend_addresses.emplace_back(addresses[i]); - } - } - return backend_addresses; -} - -bool IsServerValid(const xds_grpclb_server* server, size_t idx, bool log) { - if (server->drop) return false; - const xds_grpclb_ip_address* ip = &server->ip_address; - if (GPR_UNLIKELY(server->port >> 16 != 0)) { - if (log) { - gpr_log(GPR_ERROR, - "Invalid port '%d' at index %lu of serverlist. Ignoring.", - server->port, (unsigned long)idx); - } - return false; - } - if (GPR_UNLIKELY(ip->size != 4 && ip->size != 16)) { - if (log) { - gpr_log(GPR_ERROR, - "Expected IP to be 4 or 16 bytes, got %d at index %lu of " - "serverlist. Ignoring", - ip->size, (unsigned long)idx); - } - return false; - } - return true; -} - -void ParseServer(const xds_grpclb_server* server, grpc_resolved_address* addr) { - memset(addr, 0, sizeof(*addr)); - if (server->drop) return; - const uint16_t netorder_port = grpc_htons((uint16_t)server->port); - /* the addresses are given in binary format (a in(6)_addr struct) in - * server->ip_address.bytes. */ - const xds_grpclb_ip_address* ip = &server->ip_address; - if (ip->size == 4) { - addr->len = static_cast(sizeof(grpc_sockaddr_in)); - grpc_sockaddr_in* addr4 = reinterpret_cast(&addr->addr); - addr4->sin_family = GRPC_AF_INET; - memcpy(&addr4->sin_addr, ip->bytes, ip->size); - addr4->sin_port = netorder_port; - } else if (ip->size == 16) { - addr->len = static_cast(sizeof(grpc_sockaddr_in6)); - grpc_sockaddr_in6* addr6 = (grpc_sockaddr_in6*)&addr->addr; - addr6->sin6_family = GRPC_AF_INET6; - memcpy(&addr6->sin6_addr, ip->bytes, ip->size); - addr6->sin6_port = netorder_port; - } -} - -// Returns addresses extracted from \a serverlist. -ServerAddressList ProcessServerlist(const xds_grpclb_serverlist* serverlist) { - ServerAddressList addresses; - for (size_t i = 0; i < serverlist->num_servers; ++i) { - const xds_grpclb_server* server = serverlist->servers[i]; - if (!IsServerValid(serverlist->servers[i], i, false)) continue; - grpc_resolved_address addr; - ParseServer(server, &addr); - addresses.emplace_back(addr, nullptr); - } - return addresses; -} - // // XdsLb::BalancerChannelState // @@ -913,19 +782,18 @@ XdsLb::BalancerChannelState::BalancerCallState::BalancerCallState( xdslb_policy()->lb_call_timeout_ms_ == 0 ? GRPC_MILLIS_INF_FUTURE : ExecCtx::Get()->Now() + xdslb_policy()->lb_call_timeout_ms_; + // Create an LB call with the specified method name. lb_call_ = grpc_channel_create_pollset_set_call( lb_chand_->channel_, nullptr, GRPC_PROPAGATE_DEFAULTS, xdslb_policy()->interested_parties(), - GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD, + GRPC_MDSTR_SLASH_ENVOY_DOT_API_DOT_V2_DOT_ENDPOINTDISCOVERYSERVICE_SLASH_STREAMENDPOINTS, nullptr, deadline, nullptr); // Init the LB call request payload. - xds_grpclb_request* request = - xds_grpclb_request_create(xdslb_policy()->server_name_); - grpc_slice request_payload_slice = xds_grpclb_request_encode(request); + grpc_slice request_payload_slice = + XdsEdsRequestCreateAndEncode(xdslb_policy()->server_name_); send_message_payload_ = grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_slice_unref_internal(request_payload_slice); - xds_grpclb_request_destroy(request); // Init other data associated with the LB call. grpc_metadata_array_init(&lb_initial_metadata_recv_); grpc_metadata_array_init(&lb_trailing_metadata_recv_); @@ -1068,15 +936,20 @@ void XdsLb::BalancerChannelState::BalancerCallState:: bool XdsLb::BalancerChannelState::BalancerCallState::LoadReportCountersAreZero( xds_grpclb_request* request) { - XdsLbClientStats::DroppedCallCounts* drop_entries = - static_cast( - request->client_stats.calls_finished_with_drop.arg); - return request->client_stats.num_calls_started == 0 && - request->client_stats.num_calls_finished == 0 && - request->client_stats.num_calls_finished_with_client_failed_to_send == + const grpc_lb_v1_ClientStats* cstats = + grpc_lb_v1_LoadBalanceRequest_client_stats(request); + if (cstats == nullptr) { + return true; + } + size_t drop_count; + grpc_lb_v1_ClientStats_calls_finished_with_drop(cstats, &drop_count); + return grpc_lb_v1_ClientStats_num_calls_started(cstats) == 0 && + grpc_lb_v1_ClientStats_num_calls_finished(cstats) == 0 && + grpc_lb_v1_ClientStats_num_calls_finished_with_client_failed_to_send( + cstats) == 0 && + grpc_lb_v1_ClientStats_num_calls_finished_known_received(cstats) == 0 && - request->client_stats.num_calls_finished_known_received == 0 && - (drop_entries == nullptr || drop_entries->empty()); + drop_count == 0; } // TODO(vpowar): Use LRS to send the client Load Report. @@ -1084,13 +957,13 @@ void XdsLb::BalancerChannelState::BalancerCallState:: SendClientLoadReportLocked() { // Construct message payload. GPR_ASSERT(send_message_payload_ == nullptr); - xds_grpclb_request* request = - xds_grpclb_load_report_request_create_locked(client_stats_.get()); + upb::Arena arena; + xds_grpclb_request* request = xds_grpclb_load_report_request_create_locked( + client_stats_.get(), arena.ptr()); // Skip client load report if the counters were all zero in the last // report and they are still zero in this one. if (LoadReportCountersAreZero(request)) { if (last_client_load_report_counters_were_zero_) { - xds_grpclb_request_destroy(request); ScheduleNextClientLoadReportLocked(); return; } @@ -1099,7 +972,6 @@ void XdsLb::BalancerChannelState::BalancerCallState:: last_client_load_report_counters_were_zero_ = false; } // TODO(vpowar): Send the report on LRS stream. - xds_grpclb_request_destroy(request); } void XdsLb::BalancerChannelState::BalancerCallState::OnInitialRequestSentLocked( @@ -1127,65 +999,67 @@ void XdsLb::BalancerChannelState::BalancerCallState:: lb_calld->Unref(DEBUG_LOCATION, "on_message_received"); return; } + lb_calld->seen_response_ = true; + // Read the response. grpc_byte_buffer_reader bbr; grpc_byte_buffer_reader_init(&bbr, lb_calld->recv_message_payload_); grpc_slice response_slice = grpc_byte_buffer_reader_readall(&bbr); grpc_byte_buffer_reader_destroy(&bbr); grpc_byte_buffer_destroy(lb_calld->recv_message_payload_); lb_calld->recv_message_payload_ = nullptr; - xds_grpclb_initial_response* initial_response; - xds_grpclb_serverlist* serverlist; - if (!lb_calld->seen_initial_response_ && - (initial_response = xds_grpclb_initial_response_parse(response_slice)) != - nullptr) { - // Have NOT seen initial response, look for initial response. - // TODO(juanlishen): When we convert this to use the xds protocol, the - // balancer will send us a fallback timeout such that we should go into - // fallback mode if we have lost contact with the balancer after a certain - // period of time. We will need to save the timeout value here, and then - // when the balancer call ends, we will need to start a timer for the - // specified period of time, and if the timer fires, we go into fallback - // mode. We will also need to cancel the timer when we receive a serverlist - // from the balancer. - if (initial_response->has_client_stats_report_interval) { - const grpc_millis interval = xds_grpclb_duration_to_millis( - &initial_response->client_stats_report_interval); - if (interval > 0) { - lb_calld->client_stats_report_interval_ = - GPR_MAX(GPR_MS_PER_SEC, interval); - } + // TODO(juanlishen): When we convert this to use the xds protocol, the + // balancer will send us a fallback timeout such that we should go into + // fallback mode if we have lost contact with the balancer after a certain + // period of time. We will need to save the timeout value here, and then + // when the balancer call ends, we will need to start a timer for the + // specified period of time, and if the timer fires, we go into fallback + // mode. We will also need to cancel the timer when we receive a serverlist + // from the balancer. + // This anonymous lambda is a hack to avoid the usage of goto. + [&]() { + // Parse the response. + XdsUpdate update; + grpc_error* parse_error = + XdsEdsResponseDecodeAndParse(response_slice, &update); + if (parse_error != GRPC_ERROR_NONE) { + gpr_log(GPR_ERROR, "[xdslb %p] EDS response parsing failed. error=%s", + xdslb_policy, grpc_error_string(parse_error)); + GRPC_ERROR_UNREF(parse_error); + return; } - if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { - if (lb_calld->client_stats_report_interval_ != 0) { - gpr_log(GPR_INFO, - "[xdslb %p] Received initial LB response message; " - "client load reporting interval = %" PRId64 " milliseconds", - xdslb_policy, lb_calld->client_stats_report_interval_); - } else { - gpr_log(GPR_INFO, - "[xdslb %p] Received initial LB response message; client load " - "reporting NOT enabled", - xdslb_policy); - } + if (update.locality_list.empty()) { + char* response_slice_str = + grpc_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX); + gpr_log(GPR_ERROR, + "[xdslb %p] EDS response '%s' doesn't contain any valid locality " + "update. Ignoring.", + xdslb_policy, response_slice_str); + gpr_free(response_slice_str); + return; } - xds_grpclb_initial_response_destroy(initial_response); - lb_calld->seen_initial_response_ = true; - } else if ((serverlist = xds_grpclb_response_parse_serverlist( - response_slice)) != nullptr) { - // Have seen initial response, look for serverlist. - GPR_ASSERT(lb_calld->lb_call_ != nullptr); if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { gpr_log(GPR_INFO, - "[xdslb %p] Serverlist with %" PRIuPTR " servers received", - xdslb_policy, serverlist->num_servers); - for (size_t i = 0; i < serverlist->num_servers; ++i) { - grpc_resolved_address addr; - ParseServer(serverlist->servers[i], &addr); - char* ipport; - grpc_sockaddr_to_string(&ipport, &addr, false); - gpr_log(GPR_INFO, "[xdslb %p] Serverlist[%" PRIuPTR "]: %s", - xdslb_policy, i, ipport); - gpr_free(ipport); + "[xdslb %p] EDS response with %" PRIuPTR " localities received", + xdslb_policy, update.locality_list.size()); + for (size_t i = 0; i < update.locality_list.size(); ++i) { + const XdsLocalityInfo& locality = update.locality_list[i]; + gpr_log(GPR_INFO, + "[xdslb %p] Locality %" PRIuPTR " %s contains %" PRIuPTR + " server addresses", + xdslb_policy, i, + locality.locality_name->AsHumanReadableString(), + locality.serverlist.size()); + for (size_t j = 0; j < locality.serverlist.size(); ++j) { + char* ipport; + grpc_sockaddr_to_string(&ipport, &locality.serverlist[j].address(), + false); + gpr_log(GPR_INFO, + "[xdslb %p] Locality %" PRIuPTR + " %s, server address %" PRIuPTR ": %s", + xdslb_policy, i, + locality.locality_name->AsHumanReadableString(), j, ipport); + gpr_free(ipport); + } } } // Pending LB channel receives a serverlist; promote it. @@ -1211,73 +1085,47 @@ void XdsLb::BalancerChannelState::BalancerCallState:: lb_calld->Ref(DEBUG_LOCATION, "client_load_report").release(); lb_calld->ScheduleNextClientLoadReportLocked(); } - if (!xdslb_policy->locality_serverlist_.empty() && - xds_grpclb_serverlist_equals( - xdslb_policy->locality_serverlist_[0]->serverlist, serverlist)) { + // Ignore identical update. + if (xdslb_policy->locality_list_ == update.locality_list) { if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { gpr_log(GPR_INFO, "[xdslb %p] Incoming server list identical to current, " "ignoring.", xdslb_policy); } - xds_grpclb_destroy_serverlist(serverlist); - } else { // New serverlist. - // If the balancer tells us to drop all the calls, we should exit fallback - // mode immediately. - // TODO(juanlishen): When we add EDS drop, we should change to check - // drop_percentage. - if (serverlist->num_servers == 0) xdslb_policy->MaybeExitFallbackMode(); - if (!xdslb_policy->locality_serverlist_.empty()) { - xds_grpclb_destroy_serverlist( - xdslb_policy->locality_serverlist_[0]->serverlist); - } else { - // Initialize locality serverlist, currently the list only handles - // one child. - xdslb_policy->locality_serverlist_.emplace_back( - MakeUnique()); - xdslb_policy->locality_serverlist_[0]->locality_name = - MakeRefCounted( - UniquePtr(gpr_strdup(kDefaultLocalityRegion)), - UniquePtr(gpr_strdup(kDefaultLocalityZone)), - UniquePtr(gpr_strdup(kDefaultLocalitySubzone))); - xdslb_policy->locality_serverlist_[0]->locality_weight = - kDefaultLocalityWeight; - } - // Update the serverlist in the XdsLb instance. This serverlist - // instance will be destroyed either upon the next update or when the - // XdsLb instance is destroyed. - xdslb_policy->locality_serverlist_[0]->serverlist = serverlist; - xdslb_policy->locality_map_.UpdateLocked( - xdslb_policy->locality_serverlist_, - xdslb_policy->child_policy_config_.get(), xdslb_policy->args_, - xdslb_policy); + return; } - } else { - // No valid initial response or serverlist found. - char* response_slice_str = - grpc_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX); - gpr_log(GPR_ERROR, - "[xdslb %p] Invalid LB response received: '%s'. Ignoring.", - xdslb_policy, response_slice_str); - gpr_free(response_slice_str); - } + // If the balancer tells us to drop all the calls, we should exit fallback + // mode immediately. + // TODO(juanlishen): When we add EDS drop, we should change to check + // drop_percentage. + if (update.locality_list[0].serverlist.empty()) { + xdslb_policy->MaybeExitFallbackMode(); + } + // Update the locality list. + xdslb_policy->locality_list_ = std::move(update.locality_list); + // Update the locality map. + xdslb_policy->locality_map_.UpdateLocked( + xdslb_policy->locality_list_, xdslb_policy->child_policy_config_.get(), + xdslb_policy->args_, xdslb_policy); + }(); grpc_slice_unref_internal(response_slice); - if (!xdslb_policy->shutting_down_) { - // Keep listening for serverlist updates. - grpc_op op; - memset(&op, 0, sizeof(op)); - op.op = GRPC_OP_RECV_MESSAGE; - op.data.recv_message.recv_message = &lb_calld->recv_message_payload_; - op.flags = 0; - op.reserved = nullptr; - // Reuse the "OnBalancerMessageReceivedLocked" ref taken in StartQuery(). - const grpc_call_error call_error = grpc_call_start_batch_and_execute( - lb_calld->lb_call_, &op, 1, - &lb_calld->lb_on_balancer_message_received_); - GPR_ASSERT(GRPC_CALL_OK == call_error); - } else { + if (xdslb_policy->shutting_down_) { lb_calld->Unref(DEBUG_LOCATION, "on_message_received+xds_shutdown"); + return; } + // Keep listening for serverlist updates. + grpc_op op; + memset(&op, 0, sizeof(op)); + op.op = GRPC_OP_RECV_MESSAGE; + op.data.recv_message.recv_message = &lb_calld->recv_message_payload_; + op.flags = 0; + op.reserved = nullptr; + GPR_ASSERT(lb_calld->lb_call_ != nullptr); + // Reuse the "OnBalancerMessageReceivedLocked" ref taken in StartQuery(). + const grpc_call_error call_error = grpc_call_start_batch_and_execute( + lb_calld->lb_call_, &op, 1, &lb_calld->lb_on_balancer_message_received_); + GPR_ASSERT(GRPC_CALL_OK == call_error); } void XdsLb::BalancerChannelState::BalancerCallState:: @@ -1317,7 +1165,7 @@ void XdsLb::BalancerChannelState::BalancerCallState:: // This channel is the most recently created one. Try to restart the call // and reresolve. lb_chand->lb_calld_.reset(); - if (lb_calld->seen_initial_response_) { + if (lb_calld->seen_response_) { // If we lost connection to the LB server, reset the backoff and restart // the LB call immediately. lb_chand->lb_call_backoff_.Reset(); @@ -1402,9 +1250,7 @@ grpc_channel_args* BuildBalancerChannelArgs(const grpc_channel_args* args) { // XdsLb::XdsLb(Args args) - : LoadBalancingPolicy(std::move(args)), - locality_map_(), - locality_serverlist_() { + : LoadBalancingPolicy(std::move(args)), locality_map_(), locality_list_() { // Record server name. const grpc_arg* arg = grpc_channel_args_find(args.args, GRPC_ARG_SERVER_URI); const char* server_uri = grpc_channel_arg_get_string(arg); @@ -1433,7 +1279,7 @@ XdsLb::~XdsLb() { } gpr_free((void*)server_name_); grpc_channel_args_destroy(args_); - locality_serverlist_.clear(); + locality_list_.clear(); } void XdsLb::ShutdownLocked() { @@ -1482,9 +1328,9 @@ void XdsLb::ResetBackoffLocked() { } void XdsLb::ProcessAddressesAndChannelArgsLocked( - const ServerAddressList& addresses, const grpc_channel_args& args) { + ServerAddressList addresses, const grpc_channel_args& args) { // Update fallback address list. - fallback_backend_addresses_ = ExtractBackendAddresses(addresses); + fallback_backend_addresses_ = std::move(addresses); // Make sure that GRPC_ARG_LB_POLICY_NAME is set in channel args, // since we use this to trigger the client_load_reporting filter. static const char* args_to_remove[] = {GRPC_ARG_LB_POLICY_NAME}; @@ -1536,9 +1382,9 @@ void XdsLb::UpdateLocked(UpdateArgs args) { gpr_log(GPR_ERROR, "[xdslb %p] LB config parsing fails.", this); return; } - ProcessAddressesAndChannelArgsLocked(args.addresses, *args.args); - locality_map_.UpdateLocked(locality_serverlist_, child_policy_config_.get(), - args_, this); + ProcessAddressesAndChannelArgsLocked(std::move(args.addresses), *args.args); + locality_map_.UpdateLocked(locality_list_, child_policy_config_.get(), args_, + this); // Update the existing fallback policy. The fallback policy config and/or the // fallback addresses may be new. if (fallback_policy_ != nullptr) UpdateFallbackPolicyLocked(); @@ -1736,16 +1582,16 @@ void XdsLb::MaybeExitFallbackMode() { // XdsLb::LocalityMap // -void XdsLb::LocalityMap::PruneLocalities(const LocalityList& locality_list) { +void XdsLb::LocalityMap::PruneLocalities(const XdsLocalityList& locality_list) { for (auto iter = map_.begin(); iter != map_.end();) { bool found = false; for (size_t i = 0; i < locality_list.size(); i++) { - if (*locality_list[i]->locality_name == *iter->first) { + if (*locality_list[i].locality_name == *iter->first) { found = true; break; } } - if (!found) { // Remove entries not present in the locality list + if (!found) { // Remove entries not present in the locality list. iter = map_.erase(iter); } else iter++; @@ -1753,27 +1599,27 @@ void XdsLb::LocalityMap::PruneLocalities(const LocalityList& locality_list) { } void XdsLb::LocalityMap::UpdateLocked( - const LocalityList& locality_serverlist, + const XdsLocalityList& locality_list, LoadBalancingPolicy::Config* child_policy_config, const grpc_channel_args* args, XdsLb* parent) { if (parent->shutting_down_) return; - for (size_t i = 0; i < locality_serverlist.size(); i++) { - auto iter = map_.find(locality_serverlist[i]->locality_name); + for (size_t i = 0; i < locality_list.size(); i++) { + auto iter = map_.find(locality_list[i].locality_name); + // Add a new entry in the locality map if a new locality is received in the + // locality list. if (iter == map_.end()) { OrphanablePtr new_entry = MakeOrphanable( parent->Ref(DEBUG_LOCATION, "LocalityEntry"), - locality_serverlist[i]->locality_name, - locality_serverlist[i]->locality_weight); - iter = map_.emplace(locality_serverlist[i]->locality_name, - std::move(new_entry)) + locality_list[i].locality_name, locality_list[i].lb_weight); + iter = map_.emplace(locality_list[i].locality_name, std::move(new_entry)) .first; } - // Don't create new child policies if not directed to - xds_grpclb_serverlist* serverlist = - parent->locality_serverlist_[i]->serverlist; - iter->second->UpdateLocked(serverlist, child_policy_config, args); + // Keep a copy of serverlist in locality_list_ so that we can compare it + // with the future ones. + iter->second->UpdateLocked(locality_list[i].serverlist, child_policy_config, + args); } - PruneLocalities(locality_serverlist); + PruneLocalities(locality_list); } void XdsLb::LocalityMap::ShutdownLocked() { map_.clear(); } @@ -1789,7 +1635,7 @@ void XdsLb::LocalityMap::ResetBackoffLocked() { // XdsLb::LocalityMap::LocalityEntry::LocalityEntry( - RefCountedPtr parent, RefCountedPtr name, + RefCountedPtr parent, RefCountedPtr name, uint32_t locality_weight) : parent_(std::move(parent)), name_(std::move(name)), @@ -1861,13 +1707,13 @@ XdsLb::LocalityMap::LocalityEntry::CreateChildPolicyLocked( } void XdsLb::LocalityMap::LocalityEntry::UpdateLocked( - xds_grpclb_serverlist* serverlist, + ServerAddressList serverlist, LoadBalancingPolicy::Config* child_policy_config, const grpc_channel_args* args_in) { if (parent_->shutting_down_) return; // Construct update args. UpdateArgs update_args; - update_args.addresses = ProcessServerlist(serverlist); + update_args.addresses = std::move(serverlist); update_args.config = child_policy_config == nullptr ? nullptr : child_policy_config->Ref(); update_args.args = CreateChildPolicyArgsLocked(args_in); @@ -2158,7 +2004,7 @@ void XdsLb::LocalityMap::LocalityEntry::Helper::RequestReresolution() { // the child policy. Otherwise, pass the re-resolution request up to the // channel. if (entry_->parent_->lb_chand_->lb_calld() == nullptr || - !entry_->parent_->lb_chand_->lb_calld()->seen_initial_response()) { + !entry_->parent_->lb_chand_->lb_calld()->seen_response()) { entry_->parent_->channel_control_helper()->RequestReresolution(); } } diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc index 58f26bf54ec..8ae6a5e7590 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc @@ -18,294 +18,245 @@ #include -#include "pb_decode.h" -#include "pb_encode.h" -#include "src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h" +#include +#include #include +#include -/* invoked once for every Server in ServerList */ -static bool count_serverlist(pb_istream_t* stream, const pb_field_t* field, - void** arg) { - xds_grpclb_serverlist* sl = static_cast(*arg); - xds_grpclb_server server; - if (GPR_UNLIKELY(!pb_decode(stream, grpc_lb_v1_Server_fields, &server))) { - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(stream)); - return false; - } - ++sl->num_servers; - return true; -} +#include "src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h" +#include "src/core/lib/iomgr/error.h" +#include "src/core/lib/iomgr/sockaddr_utils.h" -typedef struct decode_serverlist_arg { - /* The decoding callback is invoked once per server in serverlist. Remember - * which index of the serverlist are we currently decoding */ - size_t decoding_idx; - /* The decoded serverlist */ - xds_grpclb_serverlist* serverlist; -} decode_serverlist_arg; +#include "envoy/api/v2/core/address.upb.h" +#include "envoy/api/v2/core/base.upb.h" +#include "envoy/api/v2/discovery.upb.h" +#include "envoy/api/v2/eds.upb.h" +#include "envoy/api/v2/endpoint/endpoint.upb.h" +#include "google/protobuf/any.upb.h" +#include "google/protobuf/struct.upb.h" +#include "google/protobuf/timestamp.upb.h" +#include "google/protobuf/wrappers.upb.h" +#include "upb/upb.h" -/* invoked once for every Server in ServerList */ -static bool decode_serverlist(pb_istream_t* stream, const pb_field_t* field, - void** arg) { - decode_serverlist_arg* dec_arg = static_cast(*arg); - GPR_ASSERT(dec_arg->serverlist->num_servers >= dec_arg->decoding_idx); - xds_grpclb_server* server = - static_cast(gpr_zalloc(sizeof(xds_grpclb_server))); - if (GPR_UNLIKELY(!pb_decode(stream, grpc_lb_v1_Server_fields, server))) { - gpr_free(server); - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(stream)); - return false; - } - dec_arg->serverlist->servers[dec_arg->decoding_idx++] = server; - return true; -} +namespace grpc_core { -xds_grpclb_request* xds_grpclb_request_create(const char* lb_service_name) { - xds_grpclb_request* req = - static_cast(gpr_malloc(sizeof(xds_grpclb_request))); - req->has_client_stats = false; - req->has_initial_request = true; - req->initial_request.has_name = true; - // GCC warns (-Wstringop-truncation) because the destination - // buffer size is identical to max-size, leading to a potential - // char[] with no null terminator. nanopb can handle it fine, - // and parantheses around strncpy silence that compiler warning. - (strncpy(req->initial_request.name, lb_service_name, - XDS_SERVICE_NAME_MAX_LENGTH)); - return req; -} +namespace { -static void populate_timestamp(gpr_timespec timestamp, - xds_grpclb_timestamp* timestamp_pb) { - timestamp_pb->has_seconds = true; - timestamp_pb->seconds = timestamp.tv_sec; - timestamp_pb->has_nanos = true; - timestamp_pb->nanos = timestamp.tv_nsec; -} +constexpr char kEdsTypeUrl[] = + "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment"; +constexpr char kEndpointRequired[] = "endpointRequired"; -static bool encode_string(pb_ostream_t* stream, const pb_field_t* field, - void* const* arg) { - char* str = static_cast(*arg); - if (!pb_encode_tag_for_field(stream, field)) return false; - return pb_encode_string(stream, reinterpret_cast(str), strlen(str)); -} +} // namespace -static bool encode_drops(pb_ostream_t* stream, const pb_field_t* field, - void* const* arg) { - grpc_core::XdsLbClientStats::DroppedCallCounts* drop_entries = - static_cast(*arg); - if (drop_entries == nullptr) return true; - for (size_t i = 0; i < drop_entries->size(); ++i) { - if (!pb_encode_tag_for_field(stream, field)) return false; - grpc_lb_v1_ClientStatsPerToken drop_message; - drop_message.load_balance_token.funcs.encode = encode_string; - drop_message.load_balance_token.arg = (*drop_entries)[i].token.get(); - drop_message.has_num_calls = true; - drop_message.num_calls = (*drop_entries)[i].count; - if (!pb_encode_submessage(stream, grpc_lb_v1_ClientStatsPerToken_fields, - &drop_message)) { - return false; - } - } - return true; -} - -xds_grpclb_request* xds_grpclb_load_report_request_create_locked( - grpc_core::XdsLbClientStats* client_stats) { - xds_grpclb_request* req = - static_cast(gpr_zalloc(sizeof(xds_grpclb_request))); - req->has_client_stats = true; - req->client_stats.has_timestamp = true; - populate_timestamp(gpr_now(GPR_CLOCK_REALTIME), &req->client_stats.timestamp); - req->client_stats.has_num_calls_started = true; - req->client_stats.has_num_calls_finished = true; - req->client_stats.has_num_calls_finished_with_client_failed_to_send = true; - req->client_stats.has_num_calls_finished_with_client_failed_to_send = true; - req->client_stats.has_num_calls_finished_known_received = true; - req->client_stats.calls_finished_with_drop.funcs.encode = encode_drops; - grpc_core::UniquePtr - drop_counts; - client_stats->GetLocked( - &req->client_stats.num_calls_started, - &req->client_stats.num_calls_finished, - &req->client_stats.num_calls_finished_with_client_failed_to_send, - &req->client_stats.num_calls_finished_known_received, &drop_counts); - // Will be deleted in xds_grpclb_request_destroy(). - req->client_stats.calls_finished_with_drop.arg = drop_counts.release(); - return req; +grpc_slice XdsEdsRequestCreateAndEncode(const char* service_name) { + upb::Arena arena; + // Create a request. + envoy_api_v2_DiscoveryRequest* request = + envoy_api_v2_DiscoveryRequest_new(arena.ptr()); + envoy_api_v2_core_Node* node = + envoy_api_v2_DiscoveryRequest_mutable_node(request, arena.ptr()); + google_protobuf_Struct* metadata = + envoy_api_v2_core_Node_mutable_metadata(node, arena.ptr()); + google_protobuf_Struct_FieldsEntry* field = + google_protobuf_Struct_add_fields(metadata, arena.ptr()); + google_protobuf_Struct_FieldsEntry_set_key( + field, upb_strview_makez(kEndpointRequired)); + google_protobuf_Value* value = + google_protobuf_Struct_FieldsEntry_mutable_value(field, arena.ptr()); + google_protobuf_Value_set_bool_value(value, true); + envoy_api_v2_DiscoveryRequest_add_resource_names( + request, upb_strview_makez(service_name), arena.ptr()); + envoy_api_v2_DiscoveryRequest_set_type_url(request, + upb_strview_makez(kEdsTypeUrl)); + // Encode the request. + size_t output_length; + char* output = envoy_api_v2_DiscoveryRequest_serialize(request, arena.ptr(), + &output_length); + return grpc_slice_from_copied_buffer(output, output_length); } -grpc_slice xds_grpclb_request_encode(const xds_grpclb_request* request) { - size_t encoded_length; - pb_ostream_t sizestream; - pb_ostream_t outputstream; - grpc_slice slice; - memset(&sizestream, 0, sizeof(pb_ostream_t)); - pb_encode(&sizestream, grpc_lb_v1_LoadBalanceRequest_fields, request); - encoded_length = sizestream.bytes_written; +namespace { - slice = GRPC_SLICE_MALLOC(encoded_length); - outputstream = - pb_ostream_from_buffer(GRPC_SLICE_START_PTR(slice), encoded_length); - GPR_ASSERT(pb_encode(&outputstream, grpc_lb_v1_LoadBalanceRequest_fields, - request) != 0); - return slice; -} - -void xds_grpclb_request_destroy(xds_grpclb_request* request) { - if (request->has_client_stats) { - grpc_core::XdsLbClientStats::DroppedCallCounts* drop_entries = - static_cast( - request->client_stats.calls_finished_with_drop.arg); - grpc_core::Delete(drop_entries); +grpc_error* ServerAddressParseAndAppend( + const envoy_api_v2_endpoint_LbEndpoint* lb_endpoint, + ServerAddressList* list) { + // Find the ip:port. + const envoy_api_v2_endpoint_Endpoint* endpoint = + envoy_api_v2_endpoint_LbEndpoint_endpoint(lb_endpoint); + const envoy_api_v2_core_Address* address = + envoy_api_v2_endpoint_Endpoint_address(endpoint); + const envoy_api_v2_core_SocketAddress* socket_address = + envoy_api_v2_core_Address_socket_address(address); + upb_strview address_strview = + envoy_api_v2_core_SocketAddress_address(socket_address); + uint32_t port = envoy_api_v2_core_SocketAddress_port_value(socket_address); + if (GPR_UNLIKELY(port >> 16) != 0) { + return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Invalid port."); } - gpr_free(request); + // Populate grpc_resolved_address. + grpc_resolved_address addr; + char* address_str = static_cast(gpr_malloc(address_strview.size + 1)); + memcpy(address_str, address_strview.data, address_strview.size); + address_str[address_strview.size] = '\0'; + grpc_string_to_sockaddr(&addr, address_str, port); + gpr_free(address_str); + // Append the address to the list. + list->emplace_back(addr, nullptr); + return GRPC_ERROR_NONE; } -typedef grpc_lb_v1_LoadBalanceResponse xds_grpclb_response; -xds_grpclb_initial_response* xds_grpclb_initial_response_parse( - const grpc_slice& encoded_xds_grpclb_response) { - pb_istream_t stream = pb_istream_from_buffer( - const_cast(GRPC_SLICE_START_PTR(encoded_xds_grpclb_response)), - GRPC_SLICE_LENGTH(encoded_xds_grpclb_response)); - xds_grpclb_response res; - memset(&res, 0, sizeof(xds_grpclb_response)); - if (GPR_UNLIKELY( - !pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, &res))) { - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream)); - return nullptr; - } - - if (!res.has_initial_response) return nullptr; - - xds_grpclb_initial_response* initial_res = - static_cast( - gpr_malloc(sizeof(xds_grpclb_initial_response))); - memcpy(initial_res, &res.initial_response, - sizeof(xds_grpclb_initial_response)); +namespace { - return initial_res; +UniquePtr StringCopy(const upb_strview& strview) { + char* str = static_cast(gpr_malloc(strview.size + 1)); + memcpy(str, strview.data, strview.size); + str[strview.size] = '\0'; + return UniquePtr(str); } -xds_grpclb_serverlist* xds_grpclb_response_parse_serverlist( - const grpc_slice& encoded_xds_grpclb_response) { - pb_istream_t stream = pb_istream_from_buffer( - const_cast(GRPC_SLICE_START_PTR(encoded_xds_grpclb_response)), - GRPC_SLICE_LENGTH(encoded_xds_grpclb_response)); - pb_istream_t stream_at_start = stream; - xds_grpclb_serverlist* sl = static_cast( - gpr_zalloc(sizeof(xds_grpclb_serverlist))); - xds_grpclb_response res; - memset(&res, 0, sizeof(xds_grpclb_response)); - // First pass: count number of servers. - res.server_list.servers.funcs.decode = count_serverlist; - res.server_list.servers.arg = sl; - bool status = pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, &res); - if (GPR_UNLIKELY(!status)) { - gpr_free(sl); - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream)); - return nullptr; - } - // Second pass: populate servers. - if (sl->num_servers > 0) { - sl->servers = static_cast( - gpr_zalloc(sizeof(xds_grpclb_server*) * sl->num_servers)); - decode_serverlist_arg decode_arg; - memset(&decode_arg, 0, sizeof(decode_arg)); - decode_arg.serverlist = sl; - res.server_list.servers.funcs.decode = decode_serverlist; - res.server_list.servers.arg = &decode_arg; - status = pb_decode(&stream_at_start, grpc_lb_v1_LoadBalanceResponse_fields, - &res); - if (GPR_UNLIKELY(!status)) { - xds_grpclb_destroy_serverlist(sl); - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream)); - return nullptr; - } - } - return sl; -} +} // namespace -void xds_grpclb_destroy_serverlist(xds_grpclb_serverlist* serverlist) { - if (serverlist == nullptr) { - return; - } - for (size_t i = 0; i < serverlist->num_servers; i++) { - gpr_free(serverlist->servers[i]); +grpc_error* LocalityParse( + const envoy_api_v2_endpoint_LocalityLbEndpoints* locality_lb_endpoints, + XdsLocalityInfo* locality_info) { + // Parse locality name. + const envoy_api_v2_core_Locality* locality = + envoy_api_v2_endpoint_LocalityLbEndpoints_locality(locality_lb_endpoints); + locality_info->locality_name = MakeRefCounted( + StringCopy(envoy_api_v2_core_Locality_region(locality)), + StringCopy(envoy_api_v2_core_Locality_zone(locality)), + StringCopy(envoy_api_v2_core_Locality_sub_zone(locality))); + // Parse the addresses. + size_t size; + const envoy_api_v2_endpoint_LbEndpoint* const* lb_endpoints = + envoy_api_v2_endpoint_LocalityLbEndpoints_lb_endpoints( + locality_lb_endpoints, &size); + for (size_t i = 0; i < size; ++i) { + grpc_error* error = ServerAddressParseAndAppend(lb_endpoints[i], + &locality_info->serverlist); + if (error != GRPC_ERROR_NONE) return error; } - gpr_free(serverlist->servers); - gpr_free(serverlist); + // Parse the lb_weight and priority. + const google_protobuf_UInt32Value* lb_weight = + envoy_api_v2_endpoint_LocalityLbEndpoints_load_balancing_weight( + locality_lb_endpoints); + // If LB weight is not specified, the default weight 0 is used, which means + // this locality is assigned no load. + locality_info->lb_weight = + lb_weight != nullptr ? google_protobuf_UInt32Value_value(lb_weight) : 0; + locality_info->priority = + envoy_api_v2_endpoint_LocalityLbEndpoints_priority(locality_lb_endpoints); + return GRPC_ERROR_NONE; } -xds_grpclb_serverlist* xds_grpclb_serverlist_copy( - const xds_grpclb_serverlist* sl) { - xds_grpclb_serverlist* copy = static_cast( - gpr_zalloc(sizeof(xds_grpclb_serverlist))); - copy->num_servers = sl->num_servers; - copy->servers = static_cast( - gpr_malloc(sizeof(xds_grpclb_server*) * sl->num_servers)); - for (size_t i = 0; i < sl->num_servers; i++) { - copy->servers[i] = - static_cast(gpr_malloc(sizeof(xds_grpclb_server))); - memcpy(copy->servers[i], sl->servers[i], sizeof(xds_grpclb_server)); - } - return copy; -} +} // namespace -bool xds_grpclb_serverlist_equals(const xds_grpclb_serverlist* lhs, - const xds_grpclb_serverlist* rhs) { - if (lhs == nullptr || rhs == nullptr) { - return false; +grpc_error* XdsEdsResponseDecodeAndParse(const grpc_slice& encoded_response, + XdsUpdate* update) { + upb::Arena arena; + // Decode the response. + const envoy_api_v2_DiscoveryResponse* response = + envoy_api_v2_DiscoveryResponse_parse( + reinterpret_cast(GRPC_SLICE_START_PTR(encoded_response)), + GRPC_SLICE_LENGTH(encoded_response), arena.ptr()); + // Parse the response. + if (response == nullptr) { + return GRPC_ERROR_CREATE_FROM_STATIC_STRING("No response found."); } - if (lhs->num_servers != rhs->num_servers) { - return false; + // Check the type_url of the response. + upb_strview type_url = envoy_api_v2_DiscoveryResponse_type_url(response); + upb_strview expected_type_url = upb_strview_makez(kEdsTypeUrl); + if (!upb_strview_eql(type_url, expected_type_url)) { + return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resource is not EDS."); } - for (size_t i = 0; i < lhs->num_servers; i++) { - if (!xds_grpclb_server_equals(lhs->servers[i], rhs->servers[i])) { - return false; - } + // Get the resources from the response. + size_t size; + const google_protobuf_Any* const* resources = + envoy_api_v2_DiscoveryResponse_resources(response, &size); + if (size < 1) { + return GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "EDS response contains 0 resource."); + } + // Check the type_url of the resource. + type_url = google_protobuf_Any_type_url(resources[0]); + if (!upb_strview_eql(type_url, expected_type_url)) { + return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resource is not EDS."); + } + // Get the cluster_load_assignment. + upb_strview encoded_cluster_load_assignment = + google_protobuf_Any_value(resources[0]); + envoy_api_v2_ClusterLoadAssignment* cluster_load_assignment = + envoy_api_v2_ClusterLoadAssignment_parse( + encoded_cluster_load_assignment.data, + encoded_cluster_load_assignment.size, arena.ptr()); + const envoy_api_v2_endpoint_LocalityLbEndpoints* const* endpoints = + envoy_api_v2_ClusterLoadAssignment_endpoints(cluster_load_assignment, + &size); + for (size_t i = 0; i < size; ++i) { + XdsLocalityInfo locality_info; + grpc_error* error = LocalityParse(endpoints[i], &locality_info); + if (error != GRPC_ERROR_NONE) return error; + update->locality_list.push_back(std::move(locality_info)); } - return true; + // The locality list is sorted here into deterministic order so that it's + // easier to check if two locality lists contain the same set of localities. + std::sort(update->locality_list.data(), + update->locality_list.data() + update->locality_list.size(), + XdsLocalityInfo::Less()); + return GRPC_ERROR_NONE; } -bool xds_grpclb_server_equals(const xds_grpclb_server* lhs, - const xds_grpclb_server* rhs) { - return memcmp(lhs, rhs, sizeof(xds_grpclb_server)) == 0; +namespace { + +void google_protobuf_Timestamp_assign(google_protobuf_Timestamp* timestamp, + const gpr_timespec& value) { + google_protobuf_Timestamp_set_seconds(timestamp, value.tv_sec); + google_protobuf_Timestamp_set_nanos(timestamp, value.tv_nsec); } -int xds_grpclb_duration_compare(const xds_grpclb_duration* lhs, - const xds_grpclb_duration* rhs) { - GPR_ASSERT(lhs && rhs); - if (lhs->has_seconds && rhs->has_seconds) { - if (lhs->seconds < rhs->seconds) return -1; - if (lhs->seconds > rhs->seconds) return 1; - } else if (lhs->has_seconds) { - return 1; - } else if (rhs->has_seconds) { - return -1; - } +} // namespace - GPR_ASSERT(lhs->seconds == rhs->seconds); - if (lhs->has_nanos && rhs->has_nanos) { - if (lhs->nanos < rhs->nanos) return -1; - if (lhs->nanos > rhs->nanos) return 1; - } else if (lhs->has_nanos) { - return 1; - } else if (rhs->has_nanos) { - return -1; - } +xds_grpclb_request* xds_grpclb_load_report_request_create_locked( + grpc_core::XdsLbClientStats* client_stats, upb_arena* arena) { + xds_grpclb_request* req = grpc_lb_v1_LoadBalanceRequest_new(arena); + grpc_lb_v1_ClientStats* req_stats = + grpc_lb_v1_LoadBalanceRequest_mutable_client_stats(req, arena); + google_protobuf_Timestamp_assign( + grpc_lb_v1_ClientStats_mutable_timestamp(req_stats, arena), + gpr_now(GPR_CLOCK_REALTIME)); - return 0; -} + int64_t num_calls_started; + int64_t num_calls_finished; + int64_t num_calls_finished_with_client_failed_to_send; + int64_t num_calls_finished_known_received; + UniquePtr drop_token_counts; + client_stats->GetLocked(&num_calls_started, &num_calls_finished, + &num_calls_finished_with_client_failed_to_send, + &num_calls_finished_known_received, + &drop_token_counts); + grpc_lb_v1_ClientStats_set_num_calls_started(req_stats, num_calls_started); + grpc_lb_v1_ClientStats_set_num_calls_finished(req_stats, num_calls_finished); + grpc_lb_v1_ClientStats_set_num_calls_finished_with_client_failed_to_send( + req_stats, num_calls_finished_with_client_failed_to_send); + grpc_lb_v1_ClientStats_set_num_calls_finished_known_received( + req_stats, num_calls_finished_known_received); + if (drop_token_counts != nullptr) { + for (size_t i = 0; i < drop_token_counts->size(); ++i) { + XdsLbClientStats::DropTokenCount& cur = (*drop_token_counts)[i]; + grpc_lb_v1_ClientStatsPerToken* cur_msg = + grpc_lb_v1_ClientStats_add_calls_finished_with_drop(req_stats, arena); -grpc_millis xds_grpclb_duration_to_millis(xds_grpclb_duration* duration_pb) { - return static_cast( - (duration_pb->has_seconds ? duration_pb->seconds : 0) * GPR_MS_PER_SEC + - (duration_pb->has_nanos ? duration_pb->nanos : 0) / GPR_NS_PER_MS); -} + const size_t token_len = strlen(cur.token.get()); + char* token = reinterpret_cast(upb_arena_malloc(arena, token_len)); + memcpy(token, cur.token.get(), token_len); -void xds_grpclb_initial_response_destroy( - xds_grpclb_initial_response* response) { - gpr_free(response); + grpc_lb_v1_ClientStatsPerToken_set_load_balance_token( + cur_msg, upb_strview_make(token, token_len)); + grpc_lb_v1_ClientStatsPerToken_set_num_calls(cur_msg, cur.count); + } + } + return req; } + +} // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h index e52d20f8658..8e31584e257 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h @@ -23,67 +23,100 @@ #include -#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h" #include "src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h" -#include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/ext/filters/client_channel/server_address.h" +#include "src/proto/grpc/lb/v1/load_balancer.upb.h" -#define XDS_SERVICE_NAME_MAX_LENGTH 128 +namespace grpc_core { -typedef grpc_lb_v1_Server_ip_address_t xds_grpclb_ip_address; typedef grpc_lb_v1_LoadBalanceRequest xds_grpclb_request; -typedef grpc_lb_v1_InitialLoadBalanceResponse xds_grpclb_initial_response; -typedef grpc_lb_v1_Server xds_grpclb_server; -typedef google_protobuf_Duration xds_grpclb_duration; -typedef google_protobuf_Timestamp xds_grpclb_timestamp; - -typedef struct { - xds_grpclb_server** servers; - size_t num_servers; -} xds_grpclb_serverlist; - -/** Create a request for a gRPC LB service under \a lb_service_name */ -xds_grpclb_request* xds_grpclb_request_create(const char* lb_service_name); -xds_grpclb_request* xds_grpclb_load_report_request_create_locked( - grpc_core::XdsLbClientStats* client_stats); - -/** Protocol Buffers v3-encode \a request */ -grpc_slice xds_grpclb_request_encode(const xds_grpclb_request* request); - -/** Destroy \a request */ -void xds_grpclb_request_destroy(xds_grpclb_request* request); - -/** Parse (ie, decode) the bytes in \a encoded_xds_grpclb_response as a \a - * xds_grpclb_initial_response */ -xds_grpclb_initial_response* xds_grpclb_initial_response_parse( - const grpc_slice& encoded_xds_grpclb_response); - -/** Parse the list of servers from an encoded \a xds_grpclb_response */ -xds_grpclb_serverlist* xds_grpclb_response_parse_serverlist( - const grpc_slice& encoded_xds_grpclb_response); - -/** Return a copy of \a sl. The caller is responsible for calling \a - * xds_grpclb_destroy_serverlist on the returned copy. */ -xds_grpclb_serverlist* xds_grpclb_serverlist_copy( - const xds_grpclb_serverlist* sl); -bool xds_grpclb_serverlist_equals(const xds_grpclb_serverlist* lhs, - const xds_grpclb_serverlist* rhs); - -bool xds_grpclb_server_equals(const xds_grpclb_server* lhs, - const xds_grpclb_server* rhs); - -/** Destroy \a serverlist */ -void xds_grpclb_destroy_serverlist(xds_grpclb_serverlist* serverlist); - -/** Compare \a lhs against \a rhs and return 0 if \a lhs and \a rhs are equal, - * < 0 if \a lhs represents a duration shorter than \a rhs and > 0 otherwise */ -int xds_grpclb_duration_compare(const xds_grpclb_duration* lhs, - const xds_grpclb_duration* rhs); - -grpc_millis xds_grpclb_duration_to_millis(xds_grpclb_duration* duration_pb); +class XdsLocalityName : public RefCounted { + public: + struct Less { + bool operator()(const RefCountedPtr& lhs, + const RefCountedPtr& rhs) { + int cmp_result = strcmp(lhs->region_.get(), rhs->region_.get()); + if (cmp_result != 0) return cmp_result < 0; + cmp_result = strcmp(lhs->zone_.get(), rhs->zone_.get()); + if (cmp_result != 0) return cmp_result < 0; + return strcmp(lhs->sub_zone_.get(), rhs->sub_zone_.get()) < 0; + } + }; + + XdsLocalityName(UniquePtr region, UniquePtr zone, + UniquePtr sub_zone) + : region_(std::move(region)), + zone_(std::move(zone)), + sub_zone_(std::move(sub_zone)) {} + + bool operator==(const XdsLocalityName& other) const { + return strcmp(region_.get(), other.region_.get()) == 0 && + strcmp(zone_.get(), other.zone_.get()) == 0 && + strcmp(sub_zone_.get(), other.sub_zone_.get()) == 0; + } + + const char* region() const { return region_.get(); } + const char* zone() const { return zone_.get(); } + const char* sub_zone() const { return sub_zone_.get(); } + + const char* AsHumanReadableString() { + if (human_readable_string_ == nullptr) { + char* tmp; + gpr_asprintf(&tmp, "{region=\"%s\", zone=\"%s\", sub_zone=\"%s\"}", + region_.get(), zone_.get(), sub_zone_.get()); + human_readable_string_.reset(tmp); + } + return human_readable_string_.get(); + } + + private: + UniquePtr region_; + UniquePtr zone_; + UniquePtr sub_zone_; + UniquePtr human_readable_string_; +}; + +struct XdsLocalityInfo { + bool operator==(const XdsLocalityInfo& other) const { + return *locality_name == *other.locality_name && + serverlist == other.serverlist && lb_weight == other.lb_weight && + priority == other.priority; + } + + // This comparator only compares the locality names. + struct Less { + bool operator()(const XdsLocalityInfo& lhs, const XdsLocalityInfo& rhs) { + return XdsLocalityName::Less()(lhs.locality_name, rhs.locality_name); + } + }; + + RefCountedPtr locality_name; + ServerAddressList serverlist; + uint32_t lb_weight; + uint32_t priority; +}; + +using XdsLocalityList = InlinedVector; + +struct XdsUpdate { + XdsLocalityList locality_list; + // TODO(juanlishen): Pass drop_per_million when adding drop support. +}; + +// Creates an EDS request querying \a service_name. +grpc_slice XdsEdsRequestCreateAndEncode(const char* service_name); + +// Parses the EDS response and returns the args to update locality map. If there +// is any error, the output update is invalid. +grpc_error* XdsEdsResponseDecodeAndParse(const grpc_slice& encoded_response, + XdsUpdate* update); + +// TODO(juanlishen): Delete these when LRS is added. +xds_grpclb_request* xds_grpclb_load_report_request_create_locked( + grpc_core::XdsLbClientStats* client_stats, upb_arena* arena); -/** Destroy \a initial_response */ -void xds_grpclb_initial_response_destroy(xds_grpclb_initial_response* response); +} // namespace grpc_core #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_XDS_XDS_LOAD_BALANCER_API_H \ */ diff --git a/src/core/lib/transport/static_metadata.cc b/src/core/lib/transport/static_metadata.cc index 3085348d9e5..d72ea3f63ae 100644 --- a/src/core/lib/transport/static_metadata.cc +++ b/src/core/lib/transport/static_metadata.cc @@ -62,59 +62,62 @@ static uint8_t g_bytes[] = { 111, 110, 115, 101, 95, 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 47, 103, 114, 112, 99, 46, 108, 98, 46, 118, 49, 46, 76, 111, 97, 100, 66, 97, 108, 97, 110, 99, 101, 114, 47, 66, 97, - 108, 97, 110, 99, 101, 76, 111, 97, 100, 47, 103, 114, 112, 99, 46, - 104, 101, 97, 108, 116, 104, 46, 118, 49, 46, 72, 101, 97, 108, 116, - 104, 47, 87, 97, 116, 99, 104, 47, 101, 110, 118, 111, 121, 46, 115, - 101, 114, 118, 105, 99, 101, 46, 100, 105, 115, 99, 111, 118, 101, 114, - 121, 46, 118, 50, 46, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, - 68, 105, 115, 99, 111, 118, 101, 114, 121, 83, 101, 114, 118, 105, 99, - 101, 47, 83, 116, 114, 101, 97, 109, 65, 103, 103, 114, 101, 103, 97, - 116, 101, 100, 82, 101, 115, 111, 117, 114, 99, 101, 115, 100, 101, 102, - 108, 97, 116, 101, 103, 122, 105, 112, 115, 116, 114, 101, 97, 109, 47, - 103, 122, 105, 112, 71, 69, 84, 80, 79, 83, 84, 47, 47, 105, 110, - 100, 101, 120, 46, 104, 116, 109, 108, 104, 116, 116, 112, 104, 116, 116, - 112, 115, 50, 48, 48, 50, 48, 52, 50, 48, 54, 51, 48, 52, 52, - 48, 48, 52, 48, 52, 53, 48, 48, 97, 99, 99, 101, 112, 116, 45, - 99, 104, 97, 114, 115, 101, 116, 103, 122, 105, 112, 44, 32, 100, 101, - 102, 108, 97, 116, 101, 97, 99, 99, 101, 112, 116, 45, 108, 97, 110, - 103, 117, 97, 103, 101, 97, 99, 99, 101, 112, 116, 45, 114, 97, 110, - 103, 101, 115, 97, 99, 99, 101, 112, 116, 97, 99, 99, 101, 115, 115, - 45, 99, 111, 110, 116, 114, 111, 108, 45, 97, 108, 108, 111, 119, 45, - 111, 114, 105, 103, 105, 110, 97, 103, 101, 97, 108, 108, 111, 119, 97, - 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 99, 97, 99, - 104, 101, 45, 99, 111, 110, 116, 114, 111, 108, 99, 111, 110, 116, 101, - 110, 116, 45, 100, 105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 99, - 111, 110, 116, 101, 110, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, - 99, 111, 110, 116, 101, 110, 116, 45, 108, 101, 110, 103, 116, 104, 99, - 111, 110, 116, 101, 110, 116, 45, 108, 111, 99, 97, 116, 105, 111, 110, - 99, 111, 110, 116, 101, 110, 116, 45, 114, 97, 110, 103, 101, 99, 111, - 111, 107, 105, 101, 100, 97, 116, 101, 101, 116, 97, 103, 101, 120, 112, - 101, 99, 116, 101, 120, 112, 105, 114, 101, 115, 102, 114, 111, 109, 105, - 102, 45, 109, 97, 116, 99, 104, 105, 102, 45, 109, 111, 100, 105, 102, - 105, 101, 100, 45, 115, 105, 110, 99, 101, 105, 102, 45, 110, 111, 110, - 101, 45, 109, 97, 116, 99, 104, 105, 102, 45, 114, 97, 110, 103, 101, - 105, 102, 45, 117, 110, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, - 105, 110, 99, 101, 108, 97, 115, 116, 45, 109, 111, 100, 105, 102, 105, - 101, 100, 108, 105, 110, 107, 108, 111, 99, 97, 116, 105, 111, 110, 109, - 97, 120, 45, 102, 111, 114, 119, 97, 114, 100, 115, 112, 114, 111, 120, - 121, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 112, - 114, 111, 120, 121, 45, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, - 105, 111, 110, 114, 97, 110, 103, 101, 114, 101, 102, 101, 114, 101, 114, - 114, 101, 102, 114, 101, 115, 104, 114, 101, 116, 114, 121, 45, 97, 102, - 116, 101, 114, 115, 101, 114, 118, 101, 114, 115, 101, 116, 45, 99, 111, - 111, 107, 105, 101, 115, 116, 114, 105, 99, 116, 45, 116, 114, 97, 110, - 115, 112, 111, 114, 116, 45, 115, 101, 99, 117, 114, 105, 116, 121, 116, - 114, 97, 110, 115, 102, 101, 114, 45, 101, 110, 99, 111, 100, 105, 110, - 103, 118, 97, 114, 121, 118, 105, 97, 119, 119, 119, 45, 97, 117, 116, - 104, 101, 110, 116, 105, 99, 97, 116, 101, 48, 105, 100, 101, 110, 116, - 105, 116, 121, 116, 114, 97, 105, 108, 101, 114, 115, 97, 112, 112, 108, - 105, 99, 97, 116, 105, 111, 110, 47, 103, 114, 112, 99, 103, 114, 112, - 99, 80, 85, 84, 108, 98, 45, 99, 111, 115, 116, 45, 98, 105, 110, - 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, - 101, 105, 100, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100, - 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, - 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, - 105, 112}; + 108, 97, 110, 99, 101, 76, 111, 97, 100, 47, 101, 110, 118, 111, 121, + 46, 97, 112, 105, 46, 118, 50, 46, 69, 110, 100, 112, 111, 105, 110, + 116, 68, 105, 115, 99, 111, 118, 101, 114, 121, 83, 101, 114, 118, 105, + 99, 101, 47, 83, 116, 114, 101, 97, 109, 69, 110, 100, 112, 111, 105, + 110, 116, 115, 47, 103, 114, 112, 99, 46, 104, 101, 97, 108, 116, 104, + 46, 118, 49, 46, 72, 101, 97, 108, 116, 104, 47, 87, 97, 116, 99, + 104, 47, 101, 110, 118, 111, 121, 46, 115, 101, 114, 118, 105, 99, 101, + 46, 100, 105, 115, 99, 111, 118, 101, 114, 121, 46, 118, 50, 46, 65, + 103, 103, 114, 101, 103, 97, 116, 101, 100, 68, 105, 115, 99, 111, 118, + 101, 114, 121, 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, 114, 101, + 97, 109, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 82, 101, 115, + 111, 117, 114, 99, 101, 115, 100, 101, 102, 108, 97, 116, 101, 103, 122, + 105, 112, 115, 116, 114, 101, 97, 109, 47, 103, 122, 105, 112, 71, 69, + 84, 80, 79, 83, 84, 47, 47, 105, 110, 100, 101, 120, 46, 104, 116, + 109, 108, 104, 116, 116, 112, 104, 116, 116, 112, 115, 50, 48, 48, 50, + 48, 52, 50, 48, 54, 51, 48, 52, 52, 48, 48, 52, 48, 52, 53, + 48, 48, 97, 99, 99, 101, 112, 116, 45, 99, 104, 97, 114, 115, 101, + 116, 103, 122, 105, 112, 44, 32, 100, 101, 102, 108, 97, 116, 101, 97, + 99, 99, 101, 112, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 97, + 99, 99, 101, 112, 116, 45, 114, 97, 110, 103, 101, 115, 97, 99, 99, + 101, 112, 116, 97, 99, 99, 101, 115, 115, 45, 99, 111, 110, 116, 114, + 111, 108, 45, 97, 108, 108, 111, 119, 45, 111, 114, 105, 103, 105, 110, + 97, 103, 101, 97, 108, 108, 111, 119, 97, 117, 116, 104, 111, 114, 105, + 122, 97, 116, 105, 111, 110, 99, 97, 99, 104, 101, 45, 99, 111, 110, + 116, 114, 111, 108, 99, 111, 110, 116, 101, 110, 116, 45, 100, 105, 115, + 112, 111, 115, 105, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, + 45, 108, 97, 110, 103, 117, 97, 103, 101, 99, 111, 110, 116, 101, 110, + 116, 45, 108, 101, 110, 103, 116, 104, 99, 111, 110, 116, 101, 110, 116, + 45, 108, 111, 99, 97, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, + 116, 45, 114, 97, 110, 103, 101, 99, 111, 111, 107, 105, 101, 100, 97, + 116, 101, 101, 116, 97, 103, 101, 120, 112, 101, 99, 116, 101, 120, 112, + 105, 114, 101, 115, 102, 114, 111, 109, 105, 102, 45, 109, 97, 116, 99, + 104, 105, 102, 45, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, + 110, 99, 101, 105, 102, 45, 110, 111, 110, 101, 45, 109, 97, 116, 99, + 104, 105, 102, 45, 114, 97, 110, 103, 101, 105, 102, 45, 117, 110, 109, + 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 108, 97, + 115, 116, 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 105, 110, 107, + 108, 111, 99, 97, 116, 105, 111, 110, 109, 97, 120, 45, 102, 111, 114, + 119, 97, 114, 100, 115, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, + 101, 110, 116, 105, 99, 97, 116, 101, 112, 114, 111, 120, 121, 45, 97, + 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 114, 97, 110, + 103, 101, 114, 101, 102, 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, + 104, 114, 101, 116, 114, 121, 45, 97, 102, 116, 101, 114, 115, 101, 114, + 118, 101, 114, 115, 101, 116, 45, 99, 111, 111, 107, 105, 101, 115, 116, + 114, 105, 99, 116, 45, 116, 114, 97, 110, 115, 112, 111, 114, 116, 45, + 115, 101, 99, 117, 114, 105, 116, 121, 116, 114, 97, 110, 115, 102, 101, + 114, 45, 101, 110, 99, 111, 100, 105, 110, 103, 118, 97, 114, 121, 118, + 105, 97, 119, 119, 119, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, + 97, 116, 101, 48, 105, 100, 101, 110, 116, 105, 116, 121, 116, 114, 97, + 105, 108, 101, 114, 115, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, + 110, 47, 103, 114, 112, 99, 103, 114, 112, 99, 80, 85, 84, 108, 98, + 45, 99, 111, 115, 116, 45, 98, 105, 110, 105, 100, 101, 110, 116, 105, + 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, 100, 101, 110, 116, + 105, 116, 121, 44, 103, 122, 105, 112, 100, 101, 102, 108, 97, 116, 101, + 44, 103, 122, 105, 112, 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, + 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112}; grpc_slice_refcount grpc_core::StaticSliceRefcount::kStaticSubRefcount; grpc_core::StaticSliceRefcount @@ -225,6 +228,7 @@ grpc_core::StaticSliceRefcount grpc_core::StaticSliceRefcount(103), grpc_core::StaticSliceRefcount(104), grpc_core::StaticSliceRefcount(105), + grpc_core::StaticSliceRefcount(106), }; const grpc_core::StaticMetadataSlice @@ -298,149 +302,151 @@ const grpc_core::StaticMetadataSlice grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[33].base, 36, g_bytes + 438), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[34].base, - 28, g_bytes + 474), + 54, g_bytes + 474), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[35].base, - 80, g_bytes + 502), + 28, g_bytes + 528), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36].base, - 7, g_bytes + 582), + 80, g_bytes + 556), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, - 4, g_bytes + 589), + 7, g_bytes + 636), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, - 11, g_bytes + 593), + 4, g_bytes + 643), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, - 3, g_bytes + 604), + 11, g_bytes + 647), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40].base, - 4, g_bytes + 607), + 3, g_bytes + 658), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41].base, - 1, g_bytes + 611), + 4, g_bytes + 661), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42].base, - 11, g_bytes + 612), + 1, g_bytes + 665), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43].base, - 4, g_bytes + 623), + 11, g_bytes + 666), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44].base, - 5, g_bytes + 627), + 4, g_bytes + 677), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45].base, - 3, g_bytes + 632), + 5, g_bytes + 681), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46].base, - 3, g_bytes + 635), + 3, g_bytes + 686), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47].base, - 3, g_bytes + 638), + 3, g_bytes + 689), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48].base, - 3, g_bytes + 641), + 3, g_bytes + 692), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49].base, - 3, g_bytes + 644), + 3, g_bytes + 695), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50].base, - 3, g_bytes + 647), + 3, g_bytes + 698), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51].base, - 3, g_bytes + 650), + 3, g_bytes + 701), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52].base, - 14, g_bytes + 653), + 3, g_bytes + 704), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53].base, - 13, g_bytes + 667), + 14, g_bytes + 707), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54].base, - 15, g_bytes + 680), + 13, g_bytes + 721), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55].base, - 13, g_bytes + 695), + 15, g_bytes + 734), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56].base, - 6, g_bytes + 708), + 13, g_bytes + 749), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57].base, - 27, g_bytes + 714), + 6, g_bytes + 762), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58].base, - 3, g_bytes + 741), + 27, g_bytes + 768), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59].base, - 5, g_bytes + 744), + 3, g_bytes + 795), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60].base, - 13, g_bytes + 749), + 5, g_bytes + 798), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61].base, - 13, g_bytes + 762), + 13, g_bytes + 803), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62].base, - 19, g_bytes + 775), + 13, g_bytes + 816), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63].base, - 16, g_bytes + 794), + 19, g_bytes + 829), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64].base, - 14, g_bytes + 810), + 16, g_bytes + 848), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65].base, - 16, g_bytes + 824), + 14, g_bytes + 864), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66].base, - 13, g_bytes + 840), + 16, g_bytes + 878), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67].base, - 6, g_bytes + 853), + 13, g_bytes + 894), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68].base, - 4, g_bytes + 859), + 6, g_bytes + 907), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69].base, - 4, g_bytes + 863), + 4, g_bytes + 913), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70].base, - 6, g_bytes + 867), + 4, g_bytes + 917), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71].base, - 7, g_bytes + 873), + 6, g_bytes + 921), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72].base, - 4, g_bytes + 880), + 7, g_bytes + 927), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73].base, - 8, g_bytes + 884), + 4, g_bytes + 934), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74].base, - 17, g_bytes + 892), + 8, g_bytes + 938), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75].base, - 13, g_bytes + 909), + 17, g_bytes + 946), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76].base, - 8, g_bytes + 922), + 13, g_bytes + 963), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77].base, - 19, g_bytes + 930), + 8, g_bytes + 976), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78].base, - 13, g_bytes + 949), + 19, g_bytes + 984), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79].base, - 4, g_bytes + 962), + 13, g_bytes + 1003), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80].base, - 8, g_bytes + 966), + 4, g_bytes + 1016), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81].base, - 12, g_bytes + 974), + 8, g_bytes + 1020), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82].base, - 18, g_bytes + 986), + 12, g_bytes + 1028), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83].base, - 19, g_bytes + 1004), + 18, g_bytes + 1040), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84].base, - 5, g_bytes + 1023), + 19, g_bytes + 1058), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85].base, - 7, g_bytes + 1028), + 5, g_bytes + 1077), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86].base, - 7, g_bytes + 1035), + 7, g_bytes + 1082), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87].base, - 11, g_bytes + 1042), + 7, g_bytes + 1089), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88].base, - 6, g_bytes + 1053), + 11, g_bytes + 1096), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89].base, - 10, g_bytes + 1059), + 6, g_bytes + 1107), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90].base, - 25, g_bytes + 1069), + 10, g_bytes + 1113), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91].base, - 17, g_bytes + 1094), + 25, g_bytes + 1123), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92].base, - 4, g_bytes + 1111), + 17, g_bytes + 1148), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93].base, - 3, g_bytes + 1115), + 4, g_bytes + 1165), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94].base, - 16, g_bytes + 1118), + 3, g_bytes + 1169), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95].base, - 1, g_bytes + 1134), + 16, g_bytes + 1172), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, - 8, g_bytes + 1135), + 1, g_bytes + 1188), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, - 8, g_bytes + 1143), + 8, g_bytes + 1189), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, - 16, g_bytes + 1151), + 8, g_bytes + 1197), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99].base, - 4, g_bytes + 1167), + 16, g_bytes + 1205), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[100].base, 4, g_bytes + 1221), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[100].base, 3, g_bytes + 1171), + &grpc_static_metadata_refcounts[101].base, 3, g_bytes + 1225), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[101].base, 11, g_bytes + 1174), + &grpc_static_metadata_refcounts[102].base, 11, g_bytes + 1228), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[102].base, 16, g_bytes + 1185), + &grpc_static_metadata_refcounts[103].base, 16, g_bytes + 1239), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[103].base, 13, g_bytes + 1201), + &grpc_static_metadata_refcounts[104].base, 13, g_bytes + 1255), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[104].base, 12, g_bytes + 1214), + &grpc_static_metadata_refcounts[105].base, 12, g_bytes + 1268), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[105].base, 21, g_bytes + 1226), + &grpc_static_metadata_refcounts[106].base, 21, g_bytes + 1280), }; /* Warning: the core static metadata currently operates under the soft @@ -886,17 +892,17 @@ uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8, 2, 4, 4}; static const int8_t elems_r[] = { - 15, 10, -8, 0, 2, -42, -80, -43, 0, 6, -8, 0, 0, 0, 2, - -3, -10, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -63, 0, -47, -68, -69, -70, -52, 0, - 31, 30, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, - 18, 17, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, - 4, 3, 4, 3, 3, 7, 0, 0, 0, 0, 0, 0, -5, 0}; + 15, 10, -8, 0, 2, -43, -81, -43, 0, 4, -8, 0, 0, 0, 8, + -2, -9, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -64, 0, -67, -68, -69, -51, -72, + 0, 32, 31, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, + 19, 18, 17, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, + 5, 4, 3, 4, 3, 3, 8, 0, 0, 0, 0, 0, 0, -5, 0}; static uint32_t elems_phash(uint32_t i) { - i -= 41; - uint32_t x = i % 104; - uint32_t y = i / 104; + i -= 42; + uint32_t x = i % 105; + uint32_t y = i / 105; uint32_t h = x; if (y < GPR_ARRAY_SIZE(elems_r)) { uint32_t delta = (uint32_t)elems_r[y]; @@ -906,28 +912,29 @@ static uint32_t elems_phash(uint32_t i) { } static const uint16_t elem_keys[] = { - 257, 258, 259, 260, 261, 262, 263, 1096, 1097, 1724, 145, 146, - 467, 468, 1618, 41, 42, 1512, 1733, 990, 991, 766, 767, 1627, - 627, 837, 2042, 2148, 5540, 5858, 5964, 6070, 6282, 6388, 1749, 6494, - 6600, 6706, 6812, 6918, 7024, 7130, 7236, 7342, 7448, 7554, 7660, 7766, - 5752, 7872, 7978, 6176, 8084, 8190, 8296, 8402, 8508, 8614, 8720, 8826, - 8932, 9038, 9144, 9250, 9356, 9462, 9568, 1156, 523, 9674, 9780, 206, - 9886, 1162, 1163, 1164, 1165, 1792, 9992, 1050, 10734, 0, 1686, 0, - 1799, 0, 0, 1582, 0, 346, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0}; + 260, 261, 262, 263, 264, 265, 266, 1107, 1108, 1740, 147, 148, + 472, 473, 1633, 42, 43, 1000, 1001, 1750, 773, 774, 1526, 633, + 1643, 845, 2061, 2168, 5699, 5913, 6020, 6127, 6341, 6448, 6555, 1766, + 6662, 6769, 6876, 6983, 7090, 7197, 7304, 7411, 7518, 7625, 7732, 7839, + 7946, 8053, 8160, 6234, 8267, 8374, 8481, 8588, 8695, 8802, 8909, 9016, + 9123, 9230, 9337, 9444, 9551, 9658, 9765, 1167, 528, 9872, 9979, 208, + 10086, 1173, 1174, 1175, 1176, 1060, 1809, 10193, 10942, 0, 0, 1702, + 0, 1816, 0, 0, 0, 349, 0, 0, 0, 1597, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0}; static const uint8_t elem_idxs[] = { - 7, 8, 9, 10, 11, 12, 13, 76, 78, 71, 1, 2, 5, 6, 25, 3, 4, 30, - 83, 66, 65, 62, 63, 73, 67, 61, 57, 37, 14, 17, 18, 19, 21, 22, 15, 23, - 24, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 38, 16, 39, 40, 20, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 75, 69, 56, 58, 70, - 59, 77, 79, 80, 81, 82, 60, 64, 74, 255, 72, 255, 84, 255, 255, 68, 255, 0}; + 7, 8, 9, 10, 11, 12, 13, 76, 78, 71, 1, 2, 5, 6, 25, 3, + 4, 66, 65, 83, 62, 63, 30, 67, 73, 61, 57, 37, 14, 16, 17, 18, + 20, 21, 22, 15, 23, 24, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, + 38, 39, 40, 19, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 75, 69, 56, 58, 70, 59, 77, 79, 80, 81, 64, 82, 60, + 74, 255, 255, 72, 255, 84, 255, 255, 255, 0, 255, 255, 255, 68}; grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b) { if (a == -1 || b == -1) return GRPC_MDNULL; - uint32_t k = static_cast(a * 106 + b); + uint32_t k = static_cast(a * 107 + b); uint32_t h = elems_phash(k); return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k && elem_idxs[h] != 255 @@ -946,144 +953,144 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, 7, g_bytes + 5), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, - 3, g_bytes + 604), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40].base, + 3, g_bytes + 658), 1), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, 7, g_bytes + 5), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40].base, - 4, g_bytes + 607), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41].base, + 4, g_bytes + 661), 2), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0].base, 5, g_bytes + 0), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41].base, - 1, g_bytes + 611), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42].base, + 1, g_bytes + 665), 3), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0].base, 5, g_bytes + 0), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42].base, - 11, g_bytes + 612), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43].base, + 11, g_bytes + 666), 4), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, 7, g_bytes + 29), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43].base, - 4, g_bytes + 623), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44].base, + 4, g_bytes + 677), 5), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, 7, g_bytes + 29), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44].base, - 5, g_bytes + 627), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45].base, + 5, g_bytes + 681), 6), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45].base, - 3, g_bytes + 632), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46].base, + 3, g_bytes + 686), 7), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46].base, - 3, g_bytes + 635), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47].base, + 3, g_bytes + 689), 8), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47].base, - 3, g_bytes + 638), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48].base, + 3, g_bytes + 692), 9), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48].base, - 3, g_bytes + 641), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49].base, + 3, g_bytes + 695), 10), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49].base, - 3, g_bytes + 644), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50].base, + 3, g_bytes + 698), 11), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50].base, - 3, g_bytes + 647), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51].base, + 3, g_bytes + 701), 12), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51].base, - 3, g_bytes + 650), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52].base, + 3, g_bytes + 704), 13), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52].base, - 14, g_bytes + 653), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53].base, + 14, g_bytes + 707), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 14), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53].base, - 13, g_bytes + 667), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54].base, + 13, g_bytes + 721), 15), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54].base, - 15, g_bytes + 680), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55].base, + 15, g_bytes + 734), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 16), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55].base, - 13, g_bytes + 695), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56].base, + 13, g_bytes + 749), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 17), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56].base, - 6, g_bytes + 708), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57].base, + 6, g_bytes + 762), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 18), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57].base, - 27, g_bytes + 714), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58].base, + 27, g_bytes + 768), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 19), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58].base, - 3, g_bytes + 741), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59].base, + 3, g_bytes + 795), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 20), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59].base, - 5, g_bytes + 744), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60].base, + 5, g_bytes + 798), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 21), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60].base, - 13, g_bytes + 749), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61].base, + 13, g_bytes + 803), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 22), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61].base, - 13, g_bytes + 762), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62].base, + 13, g_bytes + 816), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 23), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62].base, - 19, g_bytes + 775), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63].base, + 19, g_bytes + 829), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 24), @@ -1094,26 +1101,26 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { 0, g_bytes + 346), 25), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63].base, - 16, g_bytes + 794), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64].base, + 16, g_bytes + 848), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 26), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64].base, - 14, g_bytes + 810), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65].base, + 14, g_bytes + 864), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 27), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65].base, - 16, g_bytes + 824), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66].base, + 16, g_bytes + 878), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 28), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66].base, - 13, g_bytes + 840), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67].base, + 13, g_bytes + 894), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 29), @@ -1124,38 +1131,38 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { 0, g_bytes + 346), 30), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67].base, - 6, g_bytes + 853), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68].base, + 6, g_bytes + 907), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 31), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68].base, - 4, g_bytes + 859), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69].base, + 4, g_bytes + 913), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 32), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69].base, - 4, g_bytes + 863), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70].base, + 4, g_bytes + 917), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 33), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70].base, - 6, g_bytes + 867), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71].base, + 6, g_bytes + 921), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 34), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71].base, - 7, g_bytes + 873), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72].base, + 7, g_bytes + 927), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 35), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72].base, - 4, g_bytes + 880), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73].base, + 4, g_bytes + 934), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 36), @@ -1166,116 +1173,116 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { 0, g_bytes + 346), 37), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73].base, - 8, g_bytes + 884), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74].base, + 8, g_bytes + 938), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 38), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74].base, - 17, g_bytes + 892), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75].base, + 17, g_bytes + 946), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 39), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75].base, - 13, g_bytes + 909), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76].base, + 13, g_bytes + 963), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 40), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76].base, - 8, g_bytes + 922), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77].base, + 8, g_bytes + 976), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 41), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77].base, - 19, g_bytes + 930), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78].base, + 19, g_bytes + 984), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 42), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78].base, - 13, g_bytes + 949), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79].base, + 13, g_bytes + 1003), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 43), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79].base, - 4, g_bytes + 962), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80].base, + 4, g_bytes + 1016), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 44), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80].base, - 8, g_bytes + 966), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81].base, + 8, g_bytes + 1020), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 45), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81].base, - 12, g_bytes + 974), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82].base, + 12, g_bytes + 1028), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 46), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82].base, - 18, g_bytes + 986), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83].base, + 18, g_bytes + 1040), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 47), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83].base, - 19, g_bytes + 1004), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84].base, + 19, g_bytes + 1058), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 48), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84].base, - 5, g_bytes + 1023), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85].base, + 5, g_bytes + 1077), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 49), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85].base, - 7, g_bytes + 1028), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86].base, + 7, g_bytes + 1082), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 50), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86].base, - 7, g_bytes + 1035), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87].base, + 7, g_bytes + 1089), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 51), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87].base, - 11, g_bytes + 1042), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88].base, + 11, g_bytes + 1096), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 52), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88].base, - 6, g_bytes + 1053), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89].base, + 6, g_bytes + 1107), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 53), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89].base, - 10, g_bytes + 1059), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90].base, + 10, g_bytes + 1113), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 54), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90].base, - 25, g_bytes + 1069), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91].base, + 25, g_bytes + 1123), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 55), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91].base, - 17, g_bytes + 1094), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92].base, + 17, g_bytes + 1148), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 56), @@ -1286,28 +1293,28 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { 0, g_bytes + 346), 57), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92].base, - 4, g_bytes + 1111), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93].base, + 4, g_bytes + 1165), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 58), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93].base, - 3, g_bytes + 1115), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94].base, + 3, g_bytes + 1169), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 59), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94].base, - 16, g_bytes + 1118), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95].base, + 16, g_bytes + 1172), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 60), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7].base, 11, g_bytes + 50), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95].base, - 1, g_bytes + 1134), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, + 1, g_bytes + 1188), 61), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7].base, @@ -1324,44 +1331,44 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, 13, g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, - 8, g_bytes + 1135), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, + 8, g_bytes + 1189), 64), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, 13, g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, - 4, g_bytes + 589), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, + 4, g_bytes + 643), 65), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, 13, g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36].base, - 7, g_bytes + 582), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, + 7, g_bytes + 636), 66), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[5].base, 2, g_bytes + 36), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, - 8, g_bytes + 1143), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, + 8, g_bytes + 1197), 67), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14].base, 12, g_bytes + 158), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, - 16, g_bytes + 1151), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99].base, + 16, g_bytes + 1205), 68), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, 7, g_bytes + 29), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99].base, - 4, g_bytes + 1167), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[100].base, 4, g_bytes + 1221), 69), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, 7, g_bytes + 5), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[100].base, 3, g_bytes + 1171), + &grpc_static_metadata_refcounts[101].base, 3, g_bytes + 1225), 70), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, @@ -1372,80 +1379,80 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15].base, 16, g_bytes + 170), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, - 8, g_bytes + 1135), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, + 8, g_bytes + 1189), 72), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15].base, 16, g_bytes + 170), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, - 4, g_bytes + 589), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, + 4, g_bytes + 643), 73), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[101].base, 11, g_bytes + 1174), + &grpc_static_metadata_refcounts[102].base, 11, g_bytes + 1228), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 74), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, - 8, g_bytes + 1135), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, + 8, g_bytes + 1189), 75), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36].base, - 7, g_bytes + 582), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, + 7, g_bytes + 636), 76), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[102].base, 16, g_bytes + 1185), + &grpc_static_metadata_refcounts[103].base, 16, g_bytes + 1239), 77), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, - 4, g_bytes + 589), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, + 4, g_bytes + 643), 78), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[103].base, 13, g_bytes + 1201), + &grpc_static_metadata_refcounts[104].base, 13, g_bytes + 1255), 79), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[104].base, 12, g_bytes + 1214), + &grpc_static_metadata_refcounts[105].base, 12, g_bytes + 1268), 80), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[105].base, 21, g_bytes + 1226), + &grpc_static_metadata_refcounts[106].base, 21, g_bytes + 1280), 81), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, - 8, g_bytes + 1135), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, + 8, g_bytes + 1189), 82), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, - 4, g_bytes + 589), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, + 4, g_bytes + 643), 83), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, 15, g_bytes + 186), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[103].base, 13, g_bytes + 1201), + &grpc_static_metadata_refcounts[104].base, 13, g_bytes + 1255), 84), }; const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 75, 76, 77, diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index 30082985b5c..787bae7ede5 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -36,7 +36,7 @@ static_assert( std::is_trivially_destructible::value, "grpc_core::StaticMetadataSlice must be trivially destructible."); -#define GRPC_STATIC_MDSTR_COUNT 106 +#define GRPC_STATIC_MDSTR_COUNT 107 extern const grpc_core::StaticMetadataSlice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; /* ":path" */ @@ -111,154 +111,157 @@ extern const grpc_core::StaticMetadataSlice /* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \ (grpc_static_slice_table[33]) +/* "/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints" */ +#define GRPC_MDSTR_SLASH_ENVOY_DOT_API_DOT_V2_DOT_ENDPOINTDISCOVERYSERVICE_SLASH_STREAMENDPOINTS \ + (grpc_static_slice_table[34]) /* "/grpc.health.v1.Health/Watch" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH \ - (grpc_static_slice_table[34]) + (grpc_static_slice_table[35]) /* "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources" */ #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \ - (grpc_static_slice_table[35]) + (grpc_static_slice_table[36]) /* "deflate" */ -#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[36]) +#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[37]) /* "gzip" */ -#define GRPC_MDSTR_GZIP (grpc_static_slice_table[37]) +#define GRPC_MDSTR_GZIP (grpc_static_slice_table[38]) /* "stream/gzip" */ -#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[38]) +#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[39]) /* "GET" */ -#define GRPC_MDSTR_GET (grpc_static_slice_table[39]) +#define GRPC_MDSTR_GET (grpc_static_slice_table[40]) /* "POST" */ -#define GRPC_MDSTR_POST (grpc_static_slice_table[40]) +#define GRPC_MDSTR_POST (grpc_static_slice_table[41]) /* "/" */ -#define GRPC_MDSTR_SLASH (grpc_static_slice_table[41]) +#define GRPC_MDSTR_SLASH (grpc_static_slice_table[42]) /* "/index.html" */ -#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[42]) +#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[43]) /* "http" */ -#define GRPC_MDSTR_HTTP (grpc_static_slice_table[43]) +#define GRPC_MDSTR_HTTP (grpc_static_slice_table[44]) /* "https" */ -#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[44]) +#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[45]) /* "200" */ -#define GRPC_MDSTR_200 (grpc_static_slice_table[45]) +#define GRPC_MDSTR_200 (grpc_static_slice_table[46]) /* "204" */ -#define GRPC_MDSTR_204 (grpc_static_slice_table[46]) +#define GRPC_MDSTR_204 (grpc_static_slice_table[47]) /* "206" */ -#define GRPC_MDSTR_206 (grpc_static_slice_table[47]) +#define GRPC_MDSTR_206 (grpc_static_slice_table[48]) /* "304" */ -#define GRPC_MDSTR_304 (grpc_static_slice_table[48]) +#define GRPC_MDSTR_304 (grpc_static_slice_table[49]) /* "400" */ -#define GRPC_MDSTR_400 (grpc_static_slice_table[49]) +#define GRPC_MDSTR_400 (grpc_static_slice_table[50]) /* "404" */ -#define GRPC_MDSTR_404 (grpc_static_slice_table[50]) +#define GRPC_MDSTR_404 (grpc_static_slice_table[51]) /* "500" */ -#define GRPC_MDSTR_500 (grpc_static_slice_table[51]) +#define GRPC_MDSTR_500 (grpc_static_slice_table[52]) /* "accept-charset" */ -#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[52]) +#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[53]) /* "gzip, deflate" */ -#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[53]) +#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[54]) /* "accept-language" */ -#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[54]) +#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[55]) /* "accept-ranges" */ -#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[55]) +#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[56]) /* "accept" */ -#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[56]) +#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[57]) /* "access-control-allow-origin" */ -#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[57]) +#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[58]) /* "age" */ -#define GRPC_MDSTR_AGE (grpc_static_slice_table[58]) +#define GRPC_MDSTR_AGE (grpc_static_slice_table[59]) /* "allow" */ -#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[59]) +#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[60]) /* "authorization" */ -#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[60]) +#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[61]) /* "cache-control" */ -#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[61]) +#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[62]) /* "content-disposition" */ -#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[62]) +#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[63]) /* "content-language" */ -#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[63]) +#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[64]) /* "content-length" */ -#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[64]) +#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[65]) /* "content-location" */ -#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[65]) +#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[66]) /* "content-range" */ -#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[66]) +#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[67]) /* "cookie" */ -#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[67]) +#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[68]) /* "date" */ -#define GRPC_MDSTR_DATE (grpc_static_slice_table[68]) +#define GRPC_MDSTR_DATE (grpc_static_slice_table[69]) /* "etag" */ -#define GRPC_MDSTR_ETAG (grpc_static_slice_table[69]) +#define GRPC_MDSTR_ETAG (grpc_static_slice_table[70]) /* "expect" */ -#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[70]) +#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[71]) /* "expires" */ -#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[71]) +#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[72]) /* "from" */ -#define GRPC_MDSTR_FROM (grpc_static_slice_table[72]) +#define GRPC_MDSTR_FROM (grpc_static_slice_table[73]) /* "if-match" */ -#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[73]) +#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[74]) /* "if-modified-since" */ -#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[74]) +#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[75]) /* "if-none-match" */ -#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[75]) +#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[76]) /* "if-range" */ -#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[76]) +#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[77]) /* "if-unmodified-since" */ -#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[77]) +#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[78]) /* "last-modified" */ -#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[78]) +#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[79]) /* "link" */ -#define GRPC_MDSTR_LINK (grpc_static_slice_table[79]) +#define GRPC_MDSTR_LINK (grpc_static_slice_table[80]) /* "location" */ -#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[80]) +#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[81]) /* "max-forwards" */ -#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[81]) +#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[82]) /* "proxy-authenticate" */ -#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[82]) +#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[83]) /* "proxy-authorization" */ -#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[83]) +#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[84]) /* "range" */ -#define GRPC_MDSTR_RANGE (grpc_static_slice_table[84]) +#define GRPC_MDSTR_RANGE (grpc_static_slice_table[85]) /* "referer" */ -#define GRPC_MDSTR_REFERER (grpc_static_slice_table[85]) +#define GRPC_MDSTR_REFERER (grpc_static_slice_table[86]) /* "refresh" */ -#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[86]) +#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[87]) /* "retry-after" */ -#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[87]) +#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[88]) /* "server" */ -#define GRPC_MDSTR_SERVER (grpc_static_slice_table[88]) +#define GRPC_MDSTR_SERVER (grpc_static_slice_table[89]) /* "set-cookie" */ -#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[89]) +#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[90]) /* "strict-transport-security" */ -#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[90]) +#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[91]) /* "transfer-encoding" */ -#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[91]) +#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[92]) /* "vary" */ -#define GRPC_MDSTR_VARY (grpc_static_slice_table[92]) +#define GRPC_MDSTR_VARY (grpc_static_slice_table[93]) /* "via" */ -#define GRPC_MDSTR_VIA (grpc_static_slice_table[93]) +#define GRPC_MDSTR_VIA (grpc_static_slice_table[94]) /* "www-authenticate" */ -#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[94]) +#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[95]) /* "0" */ -#define GRPC_MDSTR_0 (grpc_static_slice_table[95]) +#define GRPC_MDSTR_0 (grpc_static_slice_table[96]) /* "identity" */ -#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[96]) +#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[97]) /* "trailers" */ -#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[97]) +#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[98]) /* "application/grpc" */ -#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[98]) +#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[99]) /* "grpc" */ -#define GRPC_MDSTR_GRPC (grpc_static_slice_table[99]) +#define GRPC_MDSTR_GRPC (grpc_static_slice_table[100]) /* "PUT" */ -#define GRPC_MDSTR_PUT (grpc_static_slice_table[100]) +#define GRPC_MDSTR_PUT (grpc_static_slice_table[101]) /* "lb-cost-bin" */ -#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[101]) +#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[102]) /* "identity,deflate" */ -#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[102]) +#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[103]) /* "identity,gzip" */ -#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[103]) +#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[104]) /* "deflate,gzip" */ -#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[104]) +#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[105]) /* "identity,deflate,gzip" */ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (grpc_static_slice_table[105]) + (grpc_static_slice_table[106]) namespace grpc_core { struct StaticSliceRefcount; diff --git a/src/proto/grpc/lb/v2/BUILD b/src/proto/grpc/lb/v2/BUILD new file mode 100644 index 00000000000..bf0f1a78b1c --- /dev/null +++ b/src/proto/grpc/lb/v2/BUILD @@ -0,0 +1,31 @@ +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +licenses(["notice"]) # Apache v2 + +load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library") + +grpc_package( + name = "lb", + visibility = "public", +) + +grpc_proto_library( + name = "xds_for_test_proto", + srcs = [ + "xds_for_test.proto", + ], + has_services = True, + well_known_protos = True, +) diff --git a/src/proto/grpc/lb/v2/xds_for_test.proto b/src/proto/grpc/lb/v2/xds_for_test.proto new file mode 100644 index 00000000000..3126095c92d --- /dev/null +++ b/src/proto/grpc/lb/v2/xds_for_test.proto @@ -0,0 +1,553 @@ +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file contains the xds protocol and its dependency. It can't be used by +// the gRPC library; otherwise there can be duplicate definition problems if +// users depend on both gRPC and Envoy. It can only be used by gRPC tests. +// +// TODO(juanlishen): It's a workaround and should be removed once we have a +// clean solution to use protobuf and external proto files. + +syntax = "proto3"; + +package envoy.api.v2; + +import "google/protobuf/any.proto"; + +message UInt32Value { + // The uint32 value. + uint32 value = 1; +} + +message Status { + // The status code, which should be an enum value of [google.rpc.Code][]. + int32 code = 1; + + // A developer-facing error message, which should be in English. Any + // user-facing error message should be localized and sent in the + // [google.rpc.Status.details][] field, or localized by the client. + string message = 2; + + // A list of messages that carry the error details. There is a common set of + // message types for APIs to use. + repeated google.protobuf.Any details = 3; +} + +// `Struct` represents a structured data value, consisting of fields +// which map to dynamically typed values. In some languages, `Struct` +// might be supported by a native representation. For example, in +// scripting languages like JS a struct is represented as an +// object. The details of that representation are described together +// with the proto support for the language. +// +// The JSON representation for `Struct` is JSON object. +message Struct { + // Unordered map of dynamically typed values. + map fields = 1; +} + +// `Value` represents a dynamically typed value which can be either +// null, a number, a string, a boolean, a recursive struct value, or a +// list of values. A producer of value is expected to set one of that +// variants, absence of any variant indicates an error. +// +// The JSON representation for `Value` is JSON value. +message Value { + // The kind of value. + oneof kind { + // Represents a null value. + NullValue null_value = 1; + // Represents a double value. + double number_value = 2; + // Represents a string value. + string string_value = 3; + // Represents a boolean value. + bool bool_value = 4; + // Represents a structured value. + Struct struct_value = 5; + // Represents a repeated `Value`. + ListValue list_value = 6; + } +} + +// `NullValue` is a singleton enumeration to represent the null value for the +// `Value` type union. +// +// The JSON representation for `NullValue` is JSON `null`. +enum NullValue { + // Null value. + NULL_VALUE = 0; +} + +// `ListValue` is a wrapper around a repeated field of values. +// +// The JSON representation for `ListValue` is JSON array. +message ListValue { + // Repeated field of dynamically typed values. + repeated Value values = 1; +} + +/////////////////////////////////////////////////////////////////////////////// + +// Identifies location of where either Envoy runs or where upstream hosts run. +message Locality { + // Region this :ref:`zone ` belongs to. + string region = 1; + + // Defines the local service zone where Envoy is running. Though optional, it + // should be set if discovery service routing is used and the discovery + // service exposes :ref:`zone data `, + // either in this message or via :option:`--service-zone`. The meaning of zone + // is context dependent, e.g. `Availability Zone (AZ) + // `_ + // on AWS, `Zone `_ on + // GCP, etc. + string zone = 2; + + // When used for locality of upstream hosts, this field further splits zone + // into smaller chunks of sub-zones so they can be load balanced + // independently. + string sub_zone = 3; +} + +// Identifies a specific Envoy instance. The node identifier is presented to the +// management server, which may use this identifier to distinguish per Envoy +// configuration for serving. +message Node { + // An opaque node identifier for the Envoy node. This also provides the local + // service node name. It should be set if any of the following features are + // used: :ref:`statsd `, :ref:`CDS + // `, and :ref:`HTTP tracing + // `, either in this message or via + // :option:`--service-node`. + string id = 1; + + // Defines the local service cluster name where Envoy is running. Though + // optional, it should be set if any of the following features are used: + // :ref:`statsd `, :ref:`health check cluster + // verification `, + // :ref:`runtime override directory `, + // :ref:`user agent addition + // `, + // :ref:`HTTP global rate limiting `, + // :ref:`CDS `, and :ref:`HTTP tracing + // `, either in this message or via + // :option:`--service-cluster`. + string cluster = 2; + + // Opaque metadata extending the node identifier. Envoy will pass this + // directly to the management server. + Struct metadata = 3; + + // Locality specifying where the Envoy instance is running. + Locality locality = 4; + + // This is motivated by informing a management server during canary which + // version of Envoy is being tested in a heterogeneous fleet. This will be set + // by Envoy in management server RPCs. + string build_version = 5; +} + +/////////////////////////////////////////////////////////////////////////////// + +// A DiscoveryRequest requests a set of versioned resources of the same type for +// a given Envoy node on some API. +message DiscoveryRequest { + // The version_info provided in the request messages will be the version_info + // received with the most recent successfully processed response or empty on + // the first request. It is expected that no new request is sent after a + // response is received until the Envoy instance is ready to ACK/NACK the new + // configuration. ACK/NACK takes place by returning the new API config version + // as applied or the previous API config version respectively. Each type_url + // (see below) has an independent version associated with it. + string version_info = 1; + + // The node making the request. + Node node = 2; + + // List of resources to subscribe to, e.g. list of cluster names or a route + // configuration name. If this is empty, all resources for the API are + // returned. LDS/CDS expect empty resource_names, since this is global + // discovery for the Envoy instance. The LDS and CDS responses will then imply + // a number of resources that need to be fetched via EDS/RDS, which will be + // explicitly enumerated in resource_names. + repeated string resource_names = 3; + + // Type of the resource that is being requested, e.g. + // "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment". This is implicit + // in requests made via singleton xDS APIs such as CDS, LDS, etc. but is + // required for ADS. + string type_url = 4; + + // nonce corresponding to DiscoveryResponse being ACK/NACKed. See above + // discussion on version_info and the DiscoveryResponse nonce comment. This + // may be empty if no nonce is available, e.g. at startup or for non-stream + // xDS implementations. + string response_nonce = 5; + + // This is populated when the previous :ref:`DiscoveryResponse ` + // failed to update configuration. The *message* field in *error_details* provides the Envoy + // internal exception related to the failure. It is only intended for consumption during manual + // debugging, the string provided is not guaranteed to be stable across Envoy versions. + Status error_detail = 6; +} + +message DiscoveryResponse { + // The version of the response data. + string version_info = 1; + + // The response resources. These resources are typed and depend on the API being called. + repeated google.protobuf.Any resources = 2; + + // [#not-implemented-hide:] + // Canary is used to support two Envoy command line flags: + // + // * --terminate-on-canary-transition-failure. When set, Envoy is able to + // terminate if it detects that configuration is stuck at canary. Consider + // this example sequence of updates: + // - Management server applies a canary config successfully. + // - Management server rolls back to a production config. + // - Envoy rejects the new production config. + // Since there is no sensible way to continue receiving configuration + // updates, Envoy will then terminate and apply production config from a + // clean slate. + // * --dry-run-canary. When set, a canary response will never be applied, only + // validated via a dry run. + bool canary = 3; + + // Type URL for resources. This must be consistent with the type_url in the + // Any messages for resources if resources is non-empty. This effectively + // identifies the xDS API when muxing over ADS. + string type_url = 4; + + // For gRPC based subscriptions, the nonce provides a way to explicitly ack a + // specific DiscoveryResponse in a following DiscoveryRequest. Additional + // messages may have been sent by Envoy to the management server for the + // previous version on the stream prior to this DiscoveryResponse, that were + // unprocessed at response send time. The nonce allows the management server + // to ignore any further DiscoveryRequests for the previous version until a + // DiscoveryRequest bearing the nonce. The nonce is optional and is not + // required for non-stream based xDS implementations. + string nonce = 5; +} + +/////////////////////////////////////////////////////////////////////////////// + +message Pipe { + // Unix Domain Socket path. On Linux, paths starting with '@' will use the + // abstract namespace. The starting '@' is replaced by a null byte by Envoy. + // Paths starting with '@' will result in an error in environments other than + // Linux. + string path = 1; +} + +message SocketAddress { + enum Protocol { + TCP = 0; + // [#not-implemented-hide:] + UDP = 1; + } + Protocol protocol = 1; + // The address for this socket. :ref:`Listeners ` will bind + // to the address. An empty address is not allowed. Specify ``0.0.0.0`` or ``::`` + // to bind to any address. [#comment:TODO(zuercher) reinstate when implemented: + // It is possible to distinguish a Listener address via the prefix/suffix matching + // in :ref:`FilterChainMatch `.] When used + // within an upstream :ref:`BindConfig `, the address + // controls the source address of outbound connections. For :ref:`clusters + // `, the cluster type determines whether the + // address must be an IP (*STATIC* or *EDS* clusters) or a hostname resolved by DNS + // (*STRICT_DNS* or *LOGICAL_DNS* clusters). Address resolution can be customized + // via :ref:`resolver_name `. + string address = 2; + oneof port_specifier { + uint32 port_value = 3; + // This is only valid if :ref:`resolver_name + // ` is specified below and the + // named resolver is capable of named port resolution. + string named_port = 4; + } + // The name of the resolver. This must have been registered with Envoy. If this is + // empty, a context dependent default applies. If address is a hostname this + // should be set for resolution other than DNS. If the address is a concrete + // IP address, no resolution will occur. + string resolver_name = 5; + + // When binding to an IPv6 address above, this enables `IPv4 compatibity + // `_. Binding to ``::`` will + // allow both IPv4 and IPv6 connections, with peer IPv4 addresses mapped into + // IPv6 space as ``::FFFF:``. + bool ipv4_compat = 6; +} + +// Addresses specify either a logical or physical address and port, which are +// used to tell Envoy where to bind/listen, connect to upstream and find +// management servers. +message Address { + oneof address { + + SocketAddress socket_address = 1; + Pipe pipe = 2; + } +} + +/////////////////////////////////////////////////////////////////////////////// + +message Metadata { + // Key is the reverse DNS filter name, e.g. com.acme.widget. The envoy.* + // namespace is reserved for Envoy's built-in filters. + map filter_metadata = 1; +} + +/////////////////////////////////////////////////////////////////////////////// + +// Endpoint health status. +enum HealthStatus { + // The health status is not known. This is interpreted by Envoy as *HEALTHY*. + UNKNOWN = 0; + + // Healthy. + HEALTHY = 1; + + // Unhealthy. + UNHEALTHY = 2; + + // Connection draining in progress. E.g., + // ``_ + // or + // ``_. + // This is interpreted by Envoy as *UNHEALTHY*. + DRAINING = 3; + + // Health check timed out. This is part of HDS and is interpreted by Envoy as + // *UNHEALTHY*. + TIMEOUT = 4; +} + +/////////////////////////////////////////////////////////////////////////////// + +// Upstream host identifier. +message Endpoint { + // The upstream host address. + // + // .. attention:: + // + // The form of host address depends on the given cluster type. For STATIC or EDS, + // it is expected to be a direct IP address (or something resolvable by the + // specified :ref:`resolver ` + // in the Address). For LOGICAL or STRICT DNS, it is expected to be hostname, + // and will be resolved via DNS. + Address address = 1; + + // The optional health check configuration. + message HealthCheckConfig { + // Optional alternative health check port value. + // + // By default the health check address port of an upstream host is the same + // as the host's serving address port. This provides an alternative health + // check port. Setting this with a non-zero value allows an upstream host + // to have different health check address port. + uint32 port_value = 1; + } + + // The optional health check configuration is used as configuration for the + // health checker to contact the health checked host. + // + // .. attention:: + // + // This takes into effect only for upstream clusters with + // :ref:`active health checking ` enabled. + HealthCheckConfig health_check_config = 2; +} + +// An Endpoint that Envoy can route traffic to. +message LbEndpoint { + // Upstream host identifier + Endpoint endpoint = 1; + + // Optional health status when known and supplied by EDS server. + HealthStatus health_status = 2; + + // The endpoint metadata specifies values that may be used by the load + // balancer to select endpoints in a cluster for a given request. The filter + // name should be specified as *envoy.lb*. An example boolean key-value pair + // is *canary*, providing the optional canary status of the upstream host. + // This may be matched against in a route's + // :ref:`RouteAction ` metadata_match field + // to subset the endpoints considered in cluster load balancing. + Metadata metadata = 3; + + // The optional load balancing weight of the upstream host, in the range 1 - + // 128. Envoy uses the load balancing weight in some of the built in load + // balancers. The load balancing weight for an endpoint is divided by the sum + // of the weights of all endpoints in the endpoint's locality to produce a + // percentage of traffic for the endpoint. This percentage is then further + // weighted by the endpoint's locality's load balancing weight from + // LocalityLbEndpoints. If unspecified, each host is presumed to have equal + // weight in a locality. + // + // .. attention:: + // + // The limit of 128 is somewhat arbitrary, but is applied due to performance + // concerns with the current implementation and can be removed when + // `this issue `_ is fixed. + UInt32Value load_balancing_weight = 4; +} + +// A group of endpoints belonging to a Locality. +// One can have multiple LocalityLbEndpoints for a locality, but this is +// generally only done if the different groups need to have different load +// balancing weights or different priorities. +message LocalityLbEndpoints { + // Identifies location of where the upstream hosts run. + Locality locality = 1; + + // The group of endpoints belonging to the locality specified. + repeated LbEndpoint lb_endpoints = 2; + + // Optional: Per priority/region/zone/sub_zone weight - range 1-128. The load + // balancing weight for a locality is divided by the sum of the weights of all + // localities at the same priority level to produce the effective percentage + // of traffic for the locality. + // + // Locality weights are only considered when :ref:`locality weighted load + // balancing ` is + // configured. These weights are ignored otherwise. If no weights are + // specificed when locality weighted load balancing is enabled, the cluster is + // assumed to have a weight of 1. + // + // .. attention:: + // + // The limit of 128 is somewhat arbitrary, but is applied due to performance + // concerns with the current implementation and can be removed when + // `this issue `_ is fixed. + UInt32Value load_balancing_weight = 3; + + // Optional: the priority for this LocalityLbEndpoints. If unspecified this will + // default to the highest priority (0). + // + // Under usual circumstances, Envoy will only select endpoints for the highest + // priority (0). In the event all endpoints for a particular priority are + // unavailable/unhealthy, Envoy will fail over to selecting endpoints for the + // next highest priority group. + // + // Priorities should range from 0 (highest) to N (lowest) without skipping. + uint32 priority = 5; +} + +/////////////////////////////////////////////////////////////////////////////// + +message FractionalPercent { + // Specifies the numerator. Defaults to 0. + uint32 numerator = 1; + + // Fraction percentages support several fixed denominator values. + enum DenominatorType { + // 100. + // + // **Example**: 1/100 = 1%. + HUNDRED = 0; + + // 10,000. + // + // **Example**: 1/10000 = 0.01%. + TEN_THOUSAND = 1; + + // 1,000,000. + // + // **Example**: 1/1000000 = 0.0001%. + MILLION = 2; + } + + // Specifies the denominator. If the denominator specified is less than the numerator, the final + // fractional percentage is capped at 1 (100%). + DenominatorType denominator = 2; +} + +/////////////////////////////////////////////////////////////////////////////// + +// [#protodoc-title: EDS] +// Endpoint discovery :ref:`architecture overview ` +service EndpointDiscoveryService { + // The resource_names field in DiscoveryRequest specifies a list of clusters + // to subscribe to updates for. + rpc StreamEndpoints(stream DiscoveryRequest) returns (stream DiscoveryResponse) { + } +} + +// Each route from RDS will map to a single cluster or traffic split across +// clusters using weights expressed in the RDS WeightedCluster. +// +// With EDS, each cluster is treated independently from a LB perspective, with +// LB taking place between the Localities within a cluster and at a finer +// granularity between the hosts within a locality. For a given cluster, the +// effective weight of a host is its load_balancing_weight multiplied by the +// load_balancing_weight of its Locality. +message ClusterLoadAssignment { + // Name of the cluster. This will be the :ref:`service_name + // ` value if specified + // in the cluster :ref:`EdsClusterConfig + // `. + string cluster_name = 1; + + // List of endpoints to load balance to. + repeated LocalityLbEndpoints endpoints = 2; + + // Load balancing policy settings. + message Policy { + reserved 1; + + message DropOverload { + // Identifier for the policy specifying the drop. + string category = 1; + + // Percentage of traffic that should be dropped for the category. + FractionalPercent drop_percentage = 2; + } + // Action to trim the overall incoming traffic to protect the upstream + // hosts. This action allows protection in case the hosts are unable to + // recover from an outage, or unable to autoscale or unable to handle + // incoming traffic volume for any reason. + // + // At the client each category is applied one after the other to generate + // the 'actual' drop percentage on all outgoing traffic. For example: + // + // .. code-block:: json + // + // { "drop_overloads": [ + // { "category": "throttle", "drop_percentage": 60 } + // { "category": "lb", "drop_percentage": 50 } + // ]} + // + // The actual drop percentages applied to the traffic at the clients will be + // "throttle"_drop = 60% + // "lb"_drop = 20% // 50% of the remaining 'actual' load, which is 40%. + // actual_outgoing_load = 20% // remaining after applying all categories. + repeated DropOverload drop_overloads = 2; + + // Priority levels and localities are considered overprovisioned with this + // factor (in percentage). This means that we don't consider a priority + // level or locality unhealthy until the percentage of healthy hosts + // multiplied by the overprovisioning factor drops below 100. + // With the default value 140(1.4), Envoy doesn't consider a priority level + // or a locality unhealthy until their percentage of healthy hosts drops + // below 72%. + // Read more at :ref:`priority levels ` and + // :ref:`localities `. + UInt32Value overprovisioning_factor = 3; + } + + // Load balancing policy settings. + Policy policy = 4; +} diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 8138b2a6264..f1c1a72765b 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -374,6 +374,8 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', + 'src/core/ext/upb-generated/google/api/annotations.upb.c', + 'src/core/ext/upb-generated/google/api/http.upb.c', 'src/core/ext/upb-generated/google/protobuf/any.upb.c', 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', @@ -381,14 +383,32 @@ CORE_SOURCE_FILES = [ 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', + 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', + 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c', + 'src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c', + 'src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c', + 'src/core/ext/upb-generated/envoy/type/percent.upb.c', + 'src/core/ext/upb-generated/envoy/type/range.upb.c', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', + 'src/core/ext/upb-generated/validate/validate.upb.c', 'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc', diff --git a/test/core/end2end/fuzzers/hpack.dictionary b/test/core/end2end/fuzzers/hpack.dictionary index abad1720ee8..24e3320dd71 100644 --- a/test/core/end2end/fuzzers/hpack.dictionary +++ b/test/core/end2end/fuzzers/hpack.dictionary @@ -33,6 +33,7 @@ "\x1Egrpc.max_request_message_bytes" "\x1Fgrpc.max_response_message_bytes" "$/grpc.lb.v1.LoadBalancer/BalanceLoad" +"6/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints" "\x1C/grpc.health.v1.Health/Watch" "P/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources" "\x07deflate" diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index 0ddafc92abe..4b83d0615af 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -89,6 +89,7 @@ grpc_cc_test( external_deps = [ "gtest", ], + tags = ["no_windows"], deps = [ ":test_service_impl", "//:gpr", @@ -99,7 +100,6 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], - tags = ["no_windows"], ) grpc_cc_test( @@ -492,6 +492,7 @@ grpc_cc_test( "//:grpc++", "//:grpc_resolver_fake", "//src/proto/grpc/lb/v1:load_balancer_proto", + "//src/proto/grpc/lb/v2:xds_for_test_proto", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -658,6 +659,7 @@ grpc_cc_test( external_deps = [ "gtest", ], + tags = ["no_windows"], deps = [ "//:gpr", "//:grpc", @@ -668,7 +670,6 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], - tags = ["no_windows"], ) grpc_cc_test( @@ -718,8 +719,8 @@ grpc_cc_test( ], deps = [ ":test_service_impl", - "//:grpc", "//:gpr", + "//:grpc", "//:grpc++", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", @@ -746,4 +747,3 @@ grpc_cc_test( "//test/cpp/util:test_util", ], ) - diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 5e7717e4e06..5aa20e27a49 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -48,7 +48,7 @@ #include "test/core/util/test_config.h" #include "test/cpp/end2end/test_service_impl.h" -#include "src/proto/grpc/lb/v1/load_balancer.grpc.pb.h" +#include "src/proto/grpc/lb/v2/xds_for_test.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include @@ -71,16 +71,23 @@ // 2) the retry timer is active. Again, the weak reference it holds should // prevent a premature call to \a glb_destroy. -using std::chrono::system_clock; - -using grpc::lb::v1::LoadBalanceRequest; -using grpc::lb::v1::LoadBalanceResponse; -using grpc::lb::v1::LoadBalancer; - namespace grpc { namespace testing { namespace { +using std::chrono::system_clock; + +using ::envoy::api::v2::ClusterLoadAssignment; +using ::envoy::api::v2::DiscoveryRequest; +using ::envoy::api::v2::DiscoveryResponse; +using ::envoy::api::v2::EndpointDiscoveryService; + +constexpr char kEdsTypeUrl[] = + "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment"; +constexpr char kDefaultLocalityRegion[] = "xds_default_locality_region"; +constexpr char kDefaultLocalityZone[] = "xds_default_locality_zone"; +constexpr char kDefaultLocalitySubzone[] = "xds_default_locality_subzone"; + template class CountedService : public ServiceType { public: @@ -118,7 +125,7 @@ class CountedService : public ServiceType { }; using BackendService = CountedService; -using BalancerService = CountedService; +using BalancerService = CountedService; const char g_kCallCredsMdKey[] = "Balancer should not ..."; const char g_kCallCredsMdValue[] = "... receive me"; @@ -161,12 +168,6 @@ class BackendServiceImpl : public BackendService { std::set clients_; }; -grpc::string Ip4ToPackedString(const char* ip_str) { - struct in_addr ip4; - GPR_ASSERT(inet_pton(AF_INET, ip_str, &ip4) == 1); - return grpc::string(reinterpret_cast(&ip4), sizeof(ip4)); -} - struct ClientStats { size_t num_calls_started = 0; size_t num_calls_finished = 0; @@ -198,16 +199,16 @@ struct ClientStats { class BalancerServiceImpl : public BalancerService { public: - using Stream = ServerReaderWriter; - using ResponseDelayPair = std::pair; + using Stream = ServerReaderWriter; + using ResponseDelayPair = std::pair; explicit BalancerServiceImpl(int client_load_reporting_interval_seconds) : client_load_reporting_interval_seconds_( client_load_reporting_interval_seconds) {} - Status BalanceLoad(ServerContext* context, Stream* stream) override { + Status StreamEndpoints(ServerContext* context, Stream* stream) override { // TODO(juanlishen): Clean up the scoping. - gpr_log(GPR_INFO, "LB[%p]: BalanceLoad", this); + gpr_log(GPR_INFO, "LB[%p]: EDS starts", this); { grpc::internal::MutexLock lock(&mu_); if (serverlist_done_) goto done; @@ -216,24 +217,12 @@ class BalancerServiceImpl : public BalancerService { // Balancer shouldn't receive the call credentials metadata. EXPECT_EQ(context->client_metadata().find(g_kCallCredsMdKey), context->client_metadata().end()); - LoadBalanceRequest request; + DiscoveryRequest request; std::vector responses_and_delays; - - if (!stream->Read(&request)) { - goto done; - } + if (!stream->Read(&request)) goto done; IncreaseRequestCount(); gpr_log(GPR_INFO, "LB[%p]: received initial message '%s'", this, request.DebugString().c_str()); - - { - LoadBalanceResponse initial_response; - initial_response.mutable_initial_response() - ->mutable_client_stats_report_interval() - ->set_seconds(client_load_reporting_interval_seconds_); - stream->Write(initial_response); - } - { grpc::internal::MutexLock lock(&mu_); responses_and_delays = responses_and_delays_; @@ -246,34 +235,8 @@ class BalancerServiceImpl : public BalancerService { grpc::internal::MutexLock lock(&mu_); serverlist_cond_.WaitUntil(&mu_, [this] { return serverlist_done_; }); } - if (client_load_reporting_interval_seconds_ > 0) { - request.Clear(); - if (stream->Read(&request)) { - gpr_log(GPR_INFO, "LB[%p]: received client load report message '%s'", - this, request.DebugString().c_str()); - GPR_ASSERT(request.has_client_stats()); - // We need to acquire the lock here in order to prevent the notify_one - // below from firing before its corresponding wait is executed. - grpc::internal::MutexLock lock(&mu_); - client_stats_.num_calls_started += - request.client_stats().num_calls_started(); - client_stats_.num_calls_finished += - request.client_stats().num_calls_finished(); - client_stats_.num_calls_finished_with_client_failed_to_send += - request.client_stats() - .num_calls_finished_with_client_failed_to_send(); - client_stats_.num_calls_finished_known_received += - request.client_stats().num_calls_finished_known_received(); - for (const auto& drop_token_count : - request.client_stats().calls_finished_with_drop()) { - client_stats_ - .drop_token_counts[drop_token_count.load_balance_token()] += - drop_token_count.num_calls(); - } - load_report_ready_ = true; - load_report_cond_.Signal(); - } + // TODO(juanlishen): Use LRS to receive load report. } } done: @@ -281,7 +244,7 @@ class BalancerServiceImpl : public BalancerService { return Status::OK; } - void add_response(const LoadBalanceResponse& response, int send_after_ms) { + void add_response(const DiscoveryResponse& response, int send_after_ms) { grpc::internal::MutexLock lock(&mu_); responses_and_delays_.push_back(std::make_pair(response, send_after_ms)); } @@ -290,41 +253,34 @@ class BalancerServiceImpl : public BalancerService { grpc::internal::MutexLock lock(&mu_); NotifyDoneWithServerlistsLocked(); responses_and_delays_.clear(); - client_stats_.Reset(); gpr_log(GPR_INFO, "LB[%p]: shut down", this); } - static LoadBalanceResponse BuildResponseForBackends( + static DiscoveryResponse BuildResponseForBackends( const std::vector& backend_ports, const std::map& drop_token_counts) { - LoadBalanceResponse response; - for (const auto& drop_token_count : drop_token_counts) { - for (size_t i = 0; i < drop_token_count.second; ++i) { - auto* server = response.mutable_server_list()->add_servers(); - server->set_drop(true); - server->set_load_balance_token(drop_token_count.first); - } - } + ClusterLoadAssignment assignment; + assignment.set_cluster_name("service name"); + auto* endpoints = assignment.add_endpoints(); + endpoints->mutable_load_balancing_weight()->set_value(3); + endpoints->set_priority(0); + endpoints->mutable_locality()->set_region(kDefaultLocalityRegion); + endpoints->mutable_locality()->set_zone(kDefaultLocalityZone); + endpoints->mutable_locality()->set_sub_zone(kDefaultLocalitySubzone); for (const int& backend_port : backend_ports) { - auto* server = response.mutable_server_list()->add_servers(); - server->set_ip_address(Ip4ToPackedString("127.0.0.1")); - server->set_port(backend_port); - static int token_count = 0; - char* token; - gpr_asprintf(&token, "token%03d", ++token_count); - server->set_load_balance_token(token); - gpr_free(token); + auto* lb_endpoints = endpoints->add_lb_endpoints(); + auto* endpoint = lb_endpoints->mutable_endpoint(); + auto* address = endpoint->mutable_address(); + auto* socket_address = address->mutable_socket_address(); + socket_address->set_address("127.0.0.1"); + socket_address->set_port_value(backend_port); } + DiscoveryResponse response; + response.set_type_url(kEdsTypeUrl); + response.add_resources()->PackFrom(assignment); return response; } - const ClientStats& WaitForLoadReport() { - grpc::internal::MutexLock lock(&mu_); - load_report_cond_.WaitUntil(&mu_, [this] { return load_report_ready_; }); - load_report_ready_ = false; - return client_stats_; - } - void NotifyDoneWithServerlists() { grpc::internal::MutexLock lock(&mu_); NotifyDoneWithServerlistsLocked(); @@ -338,7 +294,7 @@ class BalancerServiceImpl : public BalancerService { } private: - void SendResponse(Stream* stream, const LoadBalanceResponse& response, + void SendResponse(Stream* stream, const DiscoveryResponse& response, int delay_ms) { gpr_log(GPR_INFO, "LB[%p]: sleeping for %d ms...", this, delay_ms); if (delay_ms > 0) { @@ -353,11 +309,8 @@ class BalancerServiceImpl : public BalancerService { const int client_load_reporting_interval_seconds_; std::vector responses_and_delays_; grpc::internal::Mutex mu_; - grpc::internal::CondVar load_report_cond_; - bool load_report_ready_ = false; grpc::internal::CondVar serverlist_cond_; bool serverlist_done_ = false; - ClientStats client_stats_; }; class XdsEnd2endTest : public ::testing::Test { @@ -450,9 +403,7 @@ class XdsEnd2endTest : public ::testing::Test { ClientStats WaitForLoadReports() { ClientStats client_stats; - for (auto& balancer : balancers_) { - client_stats += balancer->service_.WaitForLoadReport(); - } + // TODO(juanlishen): Wait in LRS. return client_stats; } @@ -597,8 +548,7 @@ class XdsEnd2endTest : public ::testing::Test { return backend_ports; } - void ScheduleResponseForBalancer(size_t i, - const LoadBalanceResponse& response, + void ScheduleResponseForBalancer(size_t i, const DiscoveryResponse& response, int delay_ms) { balancers_[i]->service_.add_response(response, delay_ms); } @@ -820,7 +770,8 @@ TEST_F(SingleBalancerTest, InitiallyEmptyServerlist) { const int kServerlistDelayMs = 500 * grpc_test_slowdown_factor(); const int kCallDeadlineMs = kServerlistDelayMs * 2; // First response is an empty serverlist, sent right away. - ScheduleResponseForBalancer(0, LoadBalanceResponse(), 0); + ScheduleResponseForBalancer( + 0, BalancerServiceImpl::BuildResponseForBackends({}, {}), 0); // Send non-empty serverlist only after kServerlistDelayMs ScheduleResponseForBalancer( 0, BalancerServiceImpl::BuildResponseForBackends(GetBackendPorts(), {}), diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index fd1d9cbfb49..f0f94c00466 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -63,6 +63,7 @@ CONFIG = [ 'grpc.max_response_message_bytes', # well known method names '/grpc.lb.v1.LoadBalancer/BalanceLoad', + '/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints', '/grpc.health.v1.Health/Watch', '/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources', # compression algorithm names diff --git a/tools/distrib/check_nanopb_output.sh b/tools/distrib/check_nanopb_output.sh index 018cbb7b66a..7317e842b89 100755 --- a/tools/distrib/check_nanopb_output.sh +++ b/tools/distrib/check_nanopb_output.sh @@ -42,32 +42,6 @@ make -j 8 # back to the root directory popd -# -# Checks for load_balancer.proto -# -readonly LOAD_BALANCER_GRPC_OUTPUT_PATH='src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1' -# nanopb-compile the proto to a temp location -./tools/codegen/core/gen_nano_proto.sh \ - src/proto/grpc/lb/v1/load_balancer.proto \ - "$NANOPB_TMP_OUTPUT" \ - "$LOAD_BALANCER_GRPC_OUTPUT_PATH" - -./tools/codegen/core/gen_nano_proto.sh \ - third_party/protobuf/src/google/protobuf/duration.proto \ - "$NANOPB_TMP_OUTPUT/google/protobuf" \ - "$LOAD_BALANCER_GRPC_OUTPUT_PATH/google/protobuf" - -./tools/codegen/core/gen_nano_proto.sh \ - third_party/protobuf/src/google/protobuf/timestamp.proto \ - "$NANOPB_TMP_OUTPUT/google/protobuf" \ - "$LOAD_BALANCER_GRPC_OUTPUT_PATH/google/protobuf" - -# compare outputs to checked compiled code -if ! diff -r "$NANOPB_TMP_OUTPUT" src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1; then - echo "Outputs differ: $NANOPB_TMP_OUTPUT vs $LOAD_BALANCER_GRPC_OUTPUT_PATH" - exit 2 -fi - # # checks for health.proto # diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index e1d03c33268..4579af50ee9 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -907,12 +907,6 @@ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h \ -src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c \ -src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h \ -src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c \ -src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h \ -src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ -src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h \ src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \ src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \ src/core/ext/filters/client_channel/lb_policy/subchannel_list.h \ @@ -1064,6 +1058,48 @@ src/core/ext/transport/chttp2/transport/writing.cc \ src/core/ext/transport/inproc/inproc_plugin.cc \ src/core/ext/transport/inproc/inproc_transport.cc \ src/core/ext/transport/inproc/inproc_transport.h \ +src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/cds.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/cds.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/eds.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/eds.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h \ +src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c \ +src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h \ +src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c \ +src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h \ +src/core/ext/upb-generated/envoy/type/percent.upb.c \ +src/core/ext/upb-generated/envoy/type/percent.upb.h \ +src/core/ext/upb-generated/envoy/type/range.upb.c \ +src/core/ext/upb-generated/envoy/type/range.upb.h \ +src/core/ext/upb-generated/gogoproto/gogo.upb.c \ +src/core/ext/upb-generated/gogoproto/gogo.upb.h \ +src/core/ext/upb-generated/google/api/annotations.upb.c \ +src/core/ext/upb-generated/google/api/annotations.upb.h \ +src/core/ext/upb-generated/google/api/http.upb.c \ +src/core/ext/upb-generated/google/api/http.upb.h \ src/core/ext/upb-generated/google/protobuf/any.upb.c \ src/core/ext/upb-generated/google/protobuf/any.upb.h \ src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ @@ -1078,10 +1114,14 @@ src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ src/core/ext/upb-generated/google/protobuf/timestamp.upb.h \ src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ src/core/ext/upb-generated/google/protobuf/wrappers.upb.h \ +src/core/ext/upb-generated/google/rpc/status.upb.c \ +src/core/ext/upb-generated/google/rpc/status.upb.h \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h \ src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h \ +src/core/ext/upb-generated/validate/validate.upb.c \ +src/core/ext/upb-generated/validate/validate.upb.h \ src/core/lib/README.md \ src/core/lib/avl/avl.cc \ src/core/lib/avl/avl.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index c026d6a1caa..60ba4d7fa18 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -5323,9 +5323,9 @@ "grpc_test_util" ], "headers": [ - "src/proto/grpc/lb/v1/load_balancer.grpc.pb.h", - "src/proto/grpc/lb/v1/load_balancer.pb.h", - "src/proto/grpc/lb/v1/load_balancer_mock.grpc.pb.h" + "src/proto/grpc/lb/v2/xds_for_test.grpc.pb.h", + "src/proto/grpc/lb/v2/xds_for_test.pb.h", + "src/proto/grpc/lb/v2/xds_for_test_mock.grpc.pb.h" ], "is_filegroup": false, "language": "c++", @@ -8304,21 +8304,130 @@ "third_party": false, "type": "filegroup" }, + { + "deps": [ + "envoy_core_upb", + "envoy_type_upb", + "google_api_upb", + "proto_gen_validate_upb" + ], + "headers": [ + "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cds.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/eds.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h", + "src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h", + "src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h" + ], + "is_filegroup": true, + "language": "c", + "name": "envoy_ads_upb", + "src": [ + "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cds.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/cds.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/eds.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/eds.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h", + "src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c", + "src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h", + "src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c", + "src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h" + ], + "third_party": false, + "type": "filegroup" + }, + { + "deps": [ + "envoy_type_upb", + "google_api_upb", + "proto_gen_validate_upb" + ], + "headers": [ + "src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h" + ], + "is_filegroup": true, + "language": "c", + "name": "envoy_core_upb", + "src": [ + "src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h" + ], + "third_party": false, + "type": "filegroup" + }, + { + "deps": [ + "google_api_upb", + "proto_gen_validate_upb" + ], + "headers": [ + "src/core/ext/upb-generated/envoy/type/percent.upb.h", + "src/core/ext/upb-generated/envoy/type/range.upb.h" + ], + "is_filegroup": true, + "language": "c", + "name": "envoy_type_upb", + "src": [ + "src/core/ext/upb-generated/envoy/type/percent.upb.c", + "src/core/ext/upb-generated/envoy/type/percent.upb.h", + "src/core/ext/upb-generated/envoy/type/range.upb.c", + "src/core/ext/upb-generated/envoy/type/range.upb.h" + ], + "third_party": false, + "type": "filegroup" + }, { "deps": [], "headers": [ + "src/core/ext/upb-generated/google/api/annotations.upb.h", + "src/core/ext/upb-generated/google/api/http.upb.h", "src/core/ext/upb-generated/google/protobuf/any.upb.h", "src/core/ext/upb-generated/google/protobuf/descriptor.upb.h", "src/core/ext/upb-generated/google/protobuf/duration.upb.h", "src/core/ext/upb-generated/google/protobuf/empty.upb.h", "src/core/ext/upb-generated/google/protobuf/struct.upb.h", "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", - "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h" + "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h", + "src/core/ext/upb-generated/google/rpc/status.upb.h" ], "is_filegroup": true, "language": "c", "name": "google_api_upb", "src": [ + "src/core/ext/upb-generated/google/api/annotations.upb.c", + "src/core/ext/upb-generated/google/api/annotations.upb.h", + "src/core/ext/upb-generated/google/api/http.upb.c", + "src/core/ext/upb-generated/google/api/http.upb.h", "src/core/ext/upb-generated/google/protobuf/any.upb.c", "src/core/ext/upb-generated/google/protobuf/any.upb.h", "src/core/ext/upb-generated/google/protobuf/descriptor.upb.c", @@ -8332,7 +8441,9 @@ "src/core/ext/upb-generated/google/protobuf/timestamp.upb.c", "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", "src/core/ext/upb-generated/google/protobuf/wrappers.upb.c", - "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h" + "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h", + "src/core/ext/upb-generated/google/rpc/status.upb.c", + "src/core/ext/upb-generated/google/rpc/status.upb.h" ], "third_party": false, "type": "filegroup" @@ -9394,12 +9505,12 @@ }, { "deps": [ + "envoy_ads_upb", "gpr", "grpc_base", "grpc_client_channel", - "grpc_resolver_fake", - "grpclb_proto", - "nanopb" + "grpc_lb_upb", + "grpc_resolver_fake" ], "headers": [ "src/core/ext/filters/client_channel/lb_policy/xds/xds.h", @@ -9425,13 +9536,13 @@ }, { "deps": [ + "envoy_ads_upb", "gpr", "grpc_base", "grpc_client_channel", + "grpc_lb_upb", "grpc_resolver_fake", - "grpc_secure", - "grpclb_proto", - "nanopb" + "grpc_secure" ], "headers": [ "src/core/ext/filters/client_channel/lb_policy/xds/xds.h", @@ -10198,29 +10309,6 @@ "third_party": false, "type": "filegroup" }, - { - "deps": [ - "nanopb" - ], - "headers": [ - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpclb_proto", - "src": [ - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c", - "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h" - ], - "third_party": false, - "type": "filegroup" - }, { "deps": [ "nanopb_headers" @@ -10248,6 +10336,26 @@ "third_party": false, "type": "filegroup" }, + { + "deps": [ + "google_api_upb" + ], + "headers": [ + "src/core/ext/upb-generated/gogoproto/gogo.upb.h", + "src/core/ext/upb-generated/validate/validate.upb.h" + ], + "is_filegroup": true, + "language": "c", + "name": "proto_gen_validate_upb", + "src": [ + "src/core/ext/upb-generated/gogoproto/gogo.upb.c", + "src/core/ext/upb-generated/gogoproto/gogo.upb.h", + "src/core/ext/upb-generated/validate/validate.upb.c", + "src/core/ext/upb-generated/validate/validate.upb.h" + ], + "third_party": false, + "type": "filegroup" + }, { "deps": [ "grpc" From 20885a944cd557eb557366d8a71dc4df6924ecba Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Wed, 7 Aug 2019 23:29:00 -0700 Subject: [PATCH 243/661] Fix channel args cmp --- src/core/lib/channel/channel_args.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/lib/channel/channel_args.cc b/src/core/lib/channel/channel_args.cc index a35db186a30..b629ac0e107 100644 --- a/src/core/lib/channel/channel_args.cc +++ b/src/core/lib/channel/channel_args.cc @@ -214,6 +214,8 @@ void grpc_channel_args_destroy(grpc_channel_args* a) { int grpc_channel_args_compare(const grpc_channel_args* a, const grpc_channel_args* b) { + if (a == nullptr && b == nullptr) return 0; + if (a == nullptr || b == nullptr) return a == nullptr ? -1 : 1; int c = GPR_ICMP(a->num_args, b->num_args); if (c != 0) return c; for (size_t i = 0; i < a->num_args; i++) { From 6f2234277a496cde9e60965ad69e1923912116a4 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 7 Aug 2019 20:05:02 -0700 Subject: [PATCH 244/661] Disable nanopb fuzzer test --- test/core/nanopb/fuzzer_response.cc | 3 +++ test/core/nanopb/fuzzer_serverlist.cc | 3 +++ 2 files changed, 6 insertions(+) diff --git a/test/core/nanopb/fuzzer_response.cc b/test/core/nanopb/fuzzer_response.cc index 1f35eac8f64..c5fb8905935 100644 --- a/test/core/nanopb/fuzzer_response.cc +++ b/test/core/nanopb/fuzzer_response.cc @@ -32,10 +32,13 @@ static void dont_log(gpr_log_func_args* args) {} extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_init(); if (squelch) gpr_set_log_function(dont_log); + // TODO(veblush): Convert this to upb. + /* grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); upb::Arena arena; grpc_core::grpc_grpclb_initial_response_parse(slice, arena.ptr()); grpc_slice_unref(slice); + */ grpc_shutdown(); return 0; } diff --git a/test/core/nanopb/fuzzer_serverlist.cc b/test/core/nanopb/fuzzer_serverlist.cc index 079fbd34be1..bc812952cd4 100644 --- a/test/core/nanopb/fuzzer_serverlist.cc +++ b/test/core/nanopb/fuzzer_serverlist.cc @@ -32,12 +32,15 @@ static void dont_log(gpr_log_func_args* args) {} extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_init(); if (squelch) gpr_set_log_function(dont_log); + // TODO(veblush): Convert this to upb. + /* grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); grpc_core::grpc_grpclb_serverlist* serverlist; if ((serverlist = grpc_core::grpc_grpclb_response_parse_serverlist(slice))) { grpc_grpclb_destroy_serverlist(serverlist); } grpc_slice_unref(slice); + */ grpc_shutdown(); return 0; } From c414fe06f803a57acda5c29e9ff5fd5cbd9b45d6 Mon Sep 17 00:00:00 2001 From: Yihua Zhang Date: Thu, 8 Aug 2019 09:46:44 -0700 Subject: [PATCH 245/661] add cred data to BUILD files --- src/core/tsi/test_creds/BUILD | 2 ++ test/core/tsi/BUILD | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/core/tsi/test_creds/BUILD b/src/core/tsi/test_creds/BUILD index 732f6d91b26..b83c87de723 100644 --- a/src/core/tsi/test_creds/BUILD +++ b/src/core/tsi/test_creds/BUILD @@ -26,4 +26,6 @@ exports_files([ "badserver.pem", "badclient.key", "badclient.pem", + "multi-domain.key", + "multi-domain.pem", ]) diff --git a/test/core/tsi/BUILD b/test/core/tsi/BUILD index 14578c0e48b..e9faf5c99f3 100644 --- a/test/core/tsi/BUILD +++ b/test/core/tsi/BUILD @@ -74,6 +74,8 @@ grpc_cc_test( "//src/core/tsi/test_creds:server0.pem", "//src/core/tsi/test_creds:server1.key", "//src/core/tsi/test_creds:server1.pem", + "//src/core/tsi/test_creds:multi-domain.key", + "//src/core/tsi/test_creds:multi-domain.pem", ], language = "C++", deps = [ From d2ce6e707cdbd68fbe97ad57bf9a70ea2f8b4bd2 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 8 Aug 2019 11:50:38 -0700 Subject: [PATCH 246/661] Isolated test-specific build steps so that unrelated tasks don't run them Move interop making back to run_tests.py --- src/objective-c/tests/build_one_example.sh | 67 +++++++++---------- .../tests/build_one_example_bazel.sh | 35 ++++++++++ src/objective-c/tests/run_one_test.sh | 4 ++ .../{run_tests.sh => build_and_run_tests.sh} | 4 ++ ...{build_tests.sh => build_and_run_tests.sh} | 0 test/cpp/ios/run_tests.sh | 5 ++ tools/run_tests/run_tests.py | 18 ++--- 7 files changed, 85 insertions(+), 48 deletions(-) create mode 100755 src/objective-c/tests/build_one_example_bazel.sh rename test/core/iomgr/ios/CFStreamTests/{run_tests.sh => build_and_run_tests.sh} (97%) rename test/cpp/ios/{build_tests.sh => build_and_run_tests.sh} (100%) diff --git a/src/objective-c/tests/build_one_example.sh b/src/objective-c/tests/build_one_example.sh index 0a62008f8de..caa048e258b 100755 --- a/src/objective-c/tests/build_one_example.sh +++ b/src/objective-c/tests/build_one_example.sh @@ -29,43 +29,36 @@ cd `dirname $0`/../../.. cd $EXAMPLE_PATH -if [ "$FRAMEWORKS" == "NO" ]; then - if [ "$SCHEME" == "watchOS-sample-WatchKit-App" ]; then - SCHEME="watchOS-sample" - fi - cd .. - ../../../tools/bazel build $SCHEME -else - # clean the directory - rm -rf Pods - rm -rf *.xcworkspace - rm -f Podfile.lock +# clean the directory +rm -rf Pods +rm -rf *.xcworkspace +rm -f Podfile.lock - pod install +pod install - set -o pipefail - XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )' - if [ "$SCHEME" == "tvOS-sample" ]; then - xcodebuild \ - build \ - -workspace *.xcworkspace \ - -scheme $SCHEME \ - -destination generic/platform=tvOS \ - -derivedDataPath Build/Build \ - CODE_SIGN_IDENTITY="" \ - CODE_SIGNING_REQUIRED=NO \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v "^$" - - else - xcodebuild \ - build \ - -workspace *.xcworkspace \ - -scheme $SCHEME \ - -destination generic/platform=iOS \ - -derivedDataPath Build/Build \ - CODE_SIGN_IDENTITY="" \ - CODE_SIGNING_REQUIRED=NO \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v "^$" - - fi +set -o pipefail +XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )' +if [ "$SCHEME" == "tvOS-sample" ]; then + xcodebuild \ + build \ + -workspace *.xcworkspace \ + -scheme $SCHEME \ + -destination generic/platform=tvOS \ + -derivedDataPath Build/Build \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v "^$" - +else + xcodebuild \ + build \ + -workspace *.xcworkspace \ + -scheme $SCHEME \ + -destination generic/platform=iOS \ + -derivedDataPath Build/Build \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v "^$" - fi + diff --git a/src/objective-c/tests/build_one_example_bazel.sh b/src/objective-c/tests/build_one_example_bazel.sh new file mode 100755 index 00000000000..c3fb3f232b5 --- /dev/null +++ b/src/objective-c/tests/build_one_example_bazel.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# Copyright 2016 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Don't run this script standalone. Instead, run from the repository root: +# ./tools/run_tests/run_tests.py -l objc + +set -ev + +# Params: +# EXAMPLE_PATH - directory of the example +# SCHEME - scheme of the example, used by xcodebuild + +# CocoaPods requires the terminal to be using UTF-8 encoding. +export LANG=en_US.UTF-8 + +cd `dirname $0`/../../.. + +cd $EXAMPLE_PATH/.. + +if [ "$SCHEME" == "watchOS-sample-WatchKit-App" ]; then + SCHEME="watchOS-sample watchOS-sample-watchApp" +fi +../../../tools/bazel build $SCHEME \ No newline at end of file diff --git a/src/objective-c/tests/run_one_test.sh b/src/objective-c/tests/run_one_test.sh index b74107e4a66..a643740b64e 100755 --- a/src/objective-c/tests/run_one_test.sh +++ b/src/objective-c/tests/run_one_test.sh @@ -22,6 +22,10 @@ cd $(dirname $0) BINDIR=../../../bins/$CONFIG +[ -d Tests.xcworkspace/ ] || { + ./build_tests.sh +} + [ -f $BINDIR/interop_server ] || { echo >&2 "Can't find the test server. Make sure run_tests.py is making" \ "interop_server before calling this script." diff --git a/test/core/iomgr/ios/CFStreamTests/run_tests.sh b/test/core/iomgr/ios/CFStreamTests/build_and_run_tests.sh similarity index 97% rename from test/core/iomgr/ios/CFStreamTests/run_tests.sh rename to test/core/iomgr/ios/CFStreamTests/build_and_run_tests.sh index e49a2e0b65e..933af6c8d9e 100755 --- a/test/core/iomgr/ios/CFStreamTests/run_tests.sh +++ b/test/core/iomgr/ios/CFStreamTests/build_and_run_tests.sh @@ -23,6 +23,10 @@ cd "$(dirname "$0")" echo "TIME: $(date)" +./build_tests.sh + +echo "TIME: $(date)" + XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' xcodebuild \ diff --git a/test/cpp/ios/build_tests.sh b/test/cpp/ios/build_and_run_tests.sh similarity index 100% rename from test/cpp/ios/build_tests.sh rename to test/cpp/ios/build_and_run_tests.sh diff --git a/test/cpp/ios/run_tests.sh b/test/cpp/ios/run_tests.sh index 9eee0cd28ca..83db83fd199 100755 --- a/test/cpp/ios/run_tests.sh +++ b/test/cpp/ios/run_tests.sh @@ -20,6 +20,11 @@ set -ev cd "$(dirname "$0")" +echo "TIME: $(date)" + +./build_tests.sh + +echo "TIME: $(date)" set -o pipefail diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 1cbf50e5264..0f42b52c50e 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1060,7 +1060,7 @@ class ObjCLanguage(object): out = [] out.append( self.config.job_spec( - ['src/objective-c/tests/build_one_example.sh'], + ['src/objective-c/tests/build_one_example_bazel.sh'], timeout_seconds=10 * 60, shortname='ios-buildtest-example-sample', cpu_cost=1e6, @@ -1092,7 +1092,7 @@ class ObjCLanguage(object): })) out.append( self.config.job_spec( - ['src/objective-c/tests/build_one_example.sh'], + ['src/objective-c/tests/build_one_example_bazel.sh'], timeout_seconds=10 * 60, shortname='ios-buildtest-example-tvOS-sample', cpu_cost=1e6, @@ -1114,7 +1114,7 @@ class ObjCLanguage(object): # })) out.append( self.config.job_spec( - ['src/objective-c/tests/build_one_example.sh'], + ['src/objective-c/tests/build_one_example_bazel.sh'], timeout_seconds=20 * 60, shortname='ios-buildtest-example-watchOS-sample', cpu_cost=1e6, @@ -1143,7 +1143,7 @@ class ObjCLanguage(object): environ=_FORCE_ENVIRON_FOR_WRAPPERS)) out.append( self.config.job_spec( - ['test/core/iomgr/ios/CFStreamTests/run_tests.sh'], + ['test/core/iomgr/ios/CFStreamTests/build_and_run_tests.sh'], timeout_seconds=20 * 60, shortname='ios-test-cfstream-tests', cpu_cost=1e6, @@ -1177,14 +1177,14 @@ class ObjCLanguage(object): })) out.append( self.config.job_spec( - ['test/cpp/ios/run_tests.sh'], + ['test/cpp/ios/build_and_run_tests.sh'], timeout_seconds=20 * 60, shortname='ios-cpp-test-cronet', cpu_cost=1e6, environ=_FORCE_ENVIRON_FOR_WRAPPERS)) out.append( self.config.job_spec( - ['src/objective-c/tests/run_one_test_bazel.sh'], + ['src/objective-c/tests/run_one_test.sh'], timeout_seconds=60 * 60, shortname='mac-test-basictests', cpu_cost=1e6, @@ -1215,11 +1215,7 @@ class ObjCLanguage(object): return [] def build_steps(self): - return [ - ['src/objective-c/tests/build_tests.sh'], - ['test/core/iomgr/ios/CFStreamTests/build_tests.sh'], - ['test/cpp/ios/build_tests.sh'], - ] + return [] def post_tests_steps(self): return [] From d06f5448157a00bf101e30cfc7ee23b1716670ec Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 8 Aug 2019 13:41:23 -0700 Subject: [PATCH 247/661] Fix Swift build issues --- gRPC.podspec | 14 ++- src/objective-c/BUILD | 11 +- .../GRPCClient/GRPCCall+ChannelArg.h | 2 +- .../GRPCClient/GRPCCall+ChannelCredentials.h | 2 +- src/objective-c/GRPCClient/GRPCCall+Cronet.h | 4 +- src/objective-c/GRPCClient/GRPCCall+GID.h | 2 +- src/objective-c/GRPCClient/GRPCCall+OAuth2.h | 4 +- src/objective-c/GRPCClient/GRPCCall+Tests.h | 2 +- src/objective-c/GRPCClient/GRPCCall.h | 111 +----------------- src/objective-c/GRPCClient/GRPCCallLegacy.m | 1 + src/objective-c/GRPCClient/GRPCCallOptions.h | 1 - src/objective-c/GRPCClient/GRPCTypes.h | 111 ++++++++++++++++++ .../GRPCClient/private/GRPCCore/GRPCHost.m | 1 + .../private/GRPCTransport+Private.m | 4 +- src/objective-c/ProtoRPC/ProtoRPCLegacy.h | 8 ++ src/objective-c/ProtoRPC/ProtoService.h | 6 +- src/objective-c/ProtoRPC/ProtoService.m | 6 +- src/objective-c/ProtoRPC/ProtoServiceLegacy.m | 24 +++- templates/gRPC.podspec.template | 14 ++- 19 files changed, 188 insertions(+), 140 deletions(-) diff --git a/gRPC.podspec b/gRPC.podspec index 4b8f9358e8d..06d553db102 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -51,10 +51,20 @@ Pod::Spec.new do |s| s.subspec 'Interface-Legacy' do |ss| ss.header_mappings_dir = 'src/objective-c/GRPCClient' - ss.public_header_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h", + ss.public_header_files = "GRPCClient/GRPCCall+ChannelArg.h", + "GRPCClient/GRPCCall+ChannelCredentials.h", + "GRPCClient/GRPCCall+Cronet.h", + "GRPCClient/GRPCCall+OAuth2.h", + "GRPCClient/GRPCCall+Tests.h", + "src/objective-c/GRPCClient/GRPCCallLegacy.h", "src/objective-c/GRPCClient/GRPCTypes.h" - ss.source_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h", + ss.source_files = "GRPCClient/GRPCCall+ChannelArg.h", + "GRPCClient/GRPCCall+ChannelCredentials.h", + "GRPCClient/GRPCCall+Cronet.h", + "GRPCClient/GRPCCall+OAuth2.h", + "GRPCClient/GRPCCall+Tests.h", + "src/objective-c/GRPCClient/GRPCCallLegacy.h", "src/objective-c/GRPCClient/GRPCTypes.h" end diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index 13a26187e9f..9e0181d9e98 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -18,11 +18,11 @@ licenses(["notice"]) # Apache v2 package(default_visibility = ["//visibility:public"]) -load("//bazel:grpc_build_system.bzl", "grpc_objc_library", "grpc_objc_use_cronet_config") +load("//bazel:grpc_build_system.bzl", "grpc_objc_library", "grpc_generate_objc_one_off_targets") exports_files(["LICENSE"]) -grpc_objc_use_cronet_config() +grpc_generate_objc_one_off_targets() grpc_objc_library( name = "rx_library_headers", @@ -41,8 +41,8 @@ grpc_objc_library( ]), includes = ["."], deps = [ - ":rx_library_private", ":rx_library_headers", + ":rx_library_private", ], ) @@ -60,6 +60,11 @@ grpc_objc_library( grpc_objc_library( name = "grpc_objc_interface_legacy", hdrs = [ + "GRPCClient/GRPCCall+ChannelArg.h", + "GRPCClient/GRPCCall+ChannelCredentials.h", + "GRPCClient/GRPCCall+Cronet.h", + "GRPCClient/GRPCCall+OAuth2.h", + "GRPCClient/GRPCCall+Tests.h", "GRPCClient/GRPCCallLegacy.h", "GRPCClient/GRPCTypes.h", ], diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h index 2ddd53a5c66..ff5a153a0f6 100644 --- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h +++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h @@ -15,7 +15,7 @@ * limitations under the License. * */ -#import "GRPCCall.h" +#import "GRPCCallLegacy.h" #include diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h index 7d6f79b7655..c3d194bff94 100644 --- a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h +++ b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h @@ -16,7 +16,7 @@ * */ -#import "GRPCCall.h" +#import "GRPCCallLegacy.h" // Deprecated interface. Please use GRPCCallOptions instead. @interface GRPCCall (ChannelCredentials) diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.h b/src/objective-c/GRPCClient/GRPCCall+Cronet.h index c49d7cf16f3..d107ada3672 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.h +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.h @@ -16,8 +16,8 @@ * */ -#import "GRPCCall.h" -#import "GRPCTransport.h" +#import "GRPCCallLegacy.h" +#import "GRPCTypes.h" typedef struct stream_engine stream_engine; diff --git a/src/objective-c/GRPCClient/GRPCCall+GID.h b/src/objective-c/GRPCClient/GRPCCall+GID.h index 8293e92ebe9..80e34ea98da 100644 --- a/src/objective-c/GRPCClient/GRPCCall+GID.h +++ b/src/objective-c/GRPCClient/GRPCCall+GID.h @@ -17,7 +17,7 @@ */ #import "GRPCCall+OAuth2.h" -#import "GRPCCall.h" +#import "GRPCCallLegacy.h" #import diff --git a/src/objective-c/GRPCClient/GRPCCall+OAuth2.h b/src/objective-c/GRPCClient/GRPCCall+OAuth2.h index 60cdc50bfda..cf60c794f27 100644 --- a/src/objective-c/GRPCClient/GRPCCall+OAuth2.h +++ b/src/objective-c/GRPCClient/GRPCCall+OAuth2.h @@ -16,9 +16,9 @@ * */ -#import "GRPCCall.h" +#import "GRPCCallLegacy.h" -#import "GRPCCallOptions.h" +@protocol GRPCAuthorizationProtocol; // Deprecated interface. Please use GRPCCallOptions instead. @interface GRPCCall (OAuth2) diff --git a/src/objective-c/GRPCClient/GRPCCall+Tests.h b/src/objective-c/GRPCClient/GRPCCall+Tests.h index edaa5ed582c..af81eec6b82 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Tests.h +++ b/src/objective-c/GRPCClient/GRPCCall+Tests.h @@ -16,7 +16,7 @@ * */ -#import "GRPCCall.h" +#import "GRPCCallLegacy.h" // Deprecated interface. Please use GRPCCallOptions instead. @interface GRPCCall (Tests) diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 153ddc5c171..1c7a10048cf 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -36,6 +36,7 @@ #import "GRPCCallOptions.h" #import "GRPCDispatchable.h" +#import "GRPCTypes.h" // The legacy header is included for backwards compatibility. Some V1 API users are still using // GRPCCall by importing GRPCCall.h header so we need this import. @@ -43,116 +44,6 @@ NS_ASSUME_NONNULL_BEGIN -#pragma mark gRPC errors - -/** Domain of NSError objects produced by gRPC. */ -extern NSString *const kGRPCErrorDomain; - -/** - * gRPC error codes. - * Note that a few of these are never produced by the gRPC libraries, but are of general utility for - * server applications to produce. - */ -typedef NS_ENUM(NSUInteger, GRPCErrorCode) { - /** The operation was cancelled (typically by the caller). */ - GRPCErrorCodeCancelled = 1, - - /** - * Unknown error. Errors raised by APIs that do not return enough error information may be - * converted to this error. - */ - GRPCErrorCodeUnknown = 2, - - /** - * The client specified an invalid argument. Note that this differs from FAILED_PRECONDITION. - * INVALID_ARGUMENT indicates arguments that are problematic regardless of the state of the - * server (e.g., a malformed file name). - */ - GRPCErrorCodeInvalidArgument = 3, - - /** - * Deadline expired before operation could complete. For operations that change the state of the - * server, this error may be returned even if the operation has completed successfully. For - * example, a successful response from the server could have been delayed long enough for the - * deadline to expire. - */ - GRPCErrorCodeDeadlineExceeded = 4, - - /** Some requested entity (e.g., file or directory) was not found. */ - GRPCErrorCodeNotFound = 5, - - /** Some entity that we attempted to create (e.g., file or directory) already exists. */ - GRPCErrorCodeAlreadyExists = 6, - - /** - * The caller does not have permission to execute the specified operation. PERMISSION_DENIED isn't - * used for rejections caused by exhausting some resource (RESOURCE_EXHAUSTED is used instead for - * those errors). PERMISSION_DENIED doesn't indicate a failure to identify the caller - * (UNAUTHENTICATED is used instead for those errors). - */ - GRPCErrorCodePermissionDenied = 7, - - /** - * The request does not have valid authentication credentials for the operation (e.g. the caller's - * identity can't be verified). - */ - GRPCErrorCodeUnauthenticated = 16, - - /** Some resource has been exhausted, perhaps a per-user quota. */ - GRPCErrorCodeResourceExhausted = 8, - - /** - * The RPC was rejected because the server is not in a state required for the procedure's - * execution. For example, a directory to be deleted may be non-empty, etc. - * The client should not retry until the server state has been explicitly fixed (e.g. by - * performing another RPC). The details depend on the service being called, and should be found in - * the NSError's userInfo. - */ - GRPCErrorCodeFailedPrecondition = 9, - - /** - * The RPC was aborted, typically due to a concurrency issue like sequencer check failures, - * transaction aborts, etc. The client should retry at a higher-level (e.g., restarting a read- - * modify-write sequence). - */ - GRPCErrorCodeAborted = 10, - - /** - * The RPC was attempted past the valid range. E.g., enumerating past the end of a list. - * Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed if the system state - * changes. For example, an RPC to get elements of a list will generate INVALID_ARGUMENT if asked - * to return the element at a negative index, but it will generate OUT_OF_RANGE if asked to return - * the element at an index past the current size of the list. - */ - GRPCErrorCodeOutOfRange = 11, - - /** The procedure is not implemented or not supported/enabled in this server. */ - GRPCErrorCodeUnimplemented = 12, - - /** - * Internal error. Means some invariant expected by the server application or the gRPC library has - * been broken. - */ - GRPCErrorCodeInternal = 13, - - /** - * The server is currently unavailable. This is most likely a transient condition and may be - * corrected by retrying with a backoff. Note that it is not always safe to retry - * non-idempotent operations. - */ - GRPCErrorCodeUnavailable = 14, - - /** Unrecoverable data loss or corruption. */ - GRPCErrorCodeDataLoss = 15, -}; - -/** - * Keys used in |NSError|'s |userInfo| dictionary to store the response headers and trailers sent by - * the server. - */ -extern NSString *const kGRPCHeadersKey; -extern NSString *const kGRPCTrailersKey; - /** An object can implement this protocol to receive responses from server from a call. */ @protocol GRPCResponseHandler diff --git a/src/objective-c/GRPCClient/GRPCCallLegacy.m b/src/objective-c/GRPCClient/GRPCCallLegacy.m index e25048cfc7e..b1220999741 100644 --- a/src/objective-c/GRPCClient/GRPCCallLegacy.m +++ b/src/objective-c/GRPCClient/GRPCCallLegacy.m @@ -21,6 +21,7 @@ #import "GRPCCall+Cronet.h" #import "GRPCCall+OAuth2.h" #import "GRPCCallOptions.h" +#import "GRPCTypes.h" #import "private/GRPCCore/GRPCChannelPool.h" #import "private/GRPCCore/GRPCCompletionQueue.h" diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.h b/src/objective-c/GRPCClient/GRPCCallOptions.h index 6adc8aa1776..d4a60a2a1c7 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.h +++ b/src/objective-c/GRPCClient/GRPCCallOptions.h @@ -22,7 +22,6 @@ NS_ASSUME_NONNULL_BEGIN -typedef char *GRPCTransportId; @protocol GRPCInterceptorFactory; /** diff --git a/src/objective-c/GRPCClient/GRPCTypes.h b/src/objective-c/GRPCClient/GRPCTypes.h index 332b6e86a2b..de4f2f9e93c 100644 --- a/src/objective-c/GRPCClient/GRPCTypes.h +++ b/src/objective-c/GRPCClient/GRPCTypes.h @@ -16,6 +16,104 @@ * */ +/** + * gRPC error codes. + * Note that a few of these are never produced by the gRPC libraries, but are of general utility for + * server applications to produce. + */ +typedef NS_ENUM(NSUInteger, GRPCErrorCode) { + /** The operation was cancelled (typically by the caller). */ + GRPCErrorCodeCancelled = 1, + + /** + * Unknown error. Errors raised by APIs that do not return enough error information may be + * converted to this error. + */ + GRPCErrorCodeUnknown = 2, + + /** + * The client specified an invalid argument. Note that this differs from FAILED_PRECONDITION. + * INVALID_ARGUMENT indicates arguments that are problematic regardless of the state of the + * server (e.g., a malformed file name). + */ + GRPCErrorCodeInvalidArgument = 3, + + /** + * Deadline expired before operation could complete. For operations that change the state of the + * server, this error may be returned even if the operation has completed successfully. For + * example, a successful response from the server could have been delayed long enough for the + * deadline to expire. + */ + GRPCErrorCodeDeadlineExceeded = 4, + + /** Some requested entity (e.g., file or directory) was not found. */ + GRPCErrorCodeNotFound = 5, + + /** Some entity that we attempted to create (e.g., file or directory) already exists. */ + GRPCErrorCodeAlreadyExists = 6, + + /** + * The caller does not have permission to execute the specified operation. PERMISSION_DENIED isn't + * used for rejections caused by exhausting some resource (RESOURCE_EXHAUSTED is used instead for + * those errors). PERMISSION_DENIED doesn't indicate a failure to identify the caller + * (UNAUTHENTICATED is used instead for those errors). + */ + GRPCErrorCodePermissionDenied = 7, + + /** + * The request does not have valid authentication credentials for the operation (e.g. the caller's + * identity can't be verified). + */ + GRPCErrorCodeUnauthenticated = 16, + + /** Some resource has been exhausted, perhaps a per-user quota. */ + GRPCErrorCodeResourceExhausted = 8, + + /** + * The RPC was rejected because the server is not in a state required for the procedure's + * execution. For example, a directory to be deleted may be non-empty, etc. + * The client should not retry until the server state has been explicitly fixed (e.g. by + * performing another RPC). The details depend on the service being called, and should be found in + * the NSError's userInfo. + */ + GRPCErrorCodeFailedPrecondition = 9, + + /** + * The RPC was aborted, typically due to a concurrency issue like sequencer check failures, + * transaction aborts, etc. The client should retry at a higher-level (e.g., restarting a read- + * modify-write sequence). + */ + GRPCErrorCodeAborted = 10, + + /** + * The RPC was attempted past the valid range. E.g., enumerating past the end of a list. + * Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed if the system state + * changes. For example, an RPC to get elements of a list will generate INVALID_ARGUMENT if asked + * to return the element at a negative index, but it will generate OUT_OF_RANGE if asked to return + * the element at an index past the current size of the list. + */ + GRPCErrorCodeOutOfRange = 11, + + /** The procedure is not implemented or not supported/enabled in this server. */ + GRPCErrorCodeUnimplemented = 12, + + /** + * Internal error. Means some invariant expected by the server application or the gRPC library has + * been broken. + */ + GRPCErrorCodeInternal = 13, + + /** + * The server is currently unavailable. This is most likely a transient condition and may be + * corrected by retrying with a backoff. Note that it is not always safe to retry + * non-idempotent operations. + */ + GRPCErrorCodeUnavailable = 14, + + /** Unrecoverable data loss or corruption. */ + GRPCErrorCodeDataLoss = 15, +}; + /** * Safety remark of a gRPC method as defined in RFC 2616 Section 9.1 */ @@ -55,3 +153,16 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) { /** Insecure channel. FOR TEST ONLY! */ GRPCTransportTypeInsecure, }; + +/** Domain of NSError objects produced by gRPC. */ +extern NSString *const kGRPCErrorDomain; + +/** + * Keys used in |NSError|'s |userInfo| dictionary to store the response headers and trailers sent by + * the server. + */ +extern NSString *const kGRPCHeadersKey; +extern NSString *const kGRPCTrailersKey; + +/** The id of a transport implementation. */ +typedef char *GRPCTransportId; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m index efee85e3108..98f46062786 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m @@ -21,6 +21,7 @@ #import #import #import +#import #include #include diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m index 2482ff86e6a..0daf127d150 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m @@ -83,7 +83,7 @@ /** Forward initial metadata to the previous interceptor in the chain */ - (void)forwardPreviousInterceptorWithInitialMetadata:(NSDictionary *)initialMetadata { - if (_previousInterceptor == nil) { + if (initialMetadata == nil || _previousInterceptor == nil) { return; } id copiedPreviousInterceptor = _previousInterceptor; @@ -94,7 +94,7 @@ /** Forward a received message to the previous interceptor in the chain */ - (void)forwardPreviousInterceptorWithData:(id)data { - if (_previousInterceptor == nil) { + if (data == nil || _previousInterceptor == nil) { return; } id copiedPreviousInterceptor = _previousInterceptor; diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h index 7b9658d5b94..54823ab90db 100644 --- a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h @@ -18,6 +18,13 @@ #import +// Import category headers for Swift build +#import +#import +#import +#import +#import + @class GRPCProtoMethod; @class GRXWriter; @protocol GRXWriteable; @@ -36,6 +43,7 @@ __attribute__((deprecated("Please use GRPCProtoCall."))) @interface ProtoRPC : (id)responsesWriteable NS_DESIGNATED_INITIALIZER; - (void)start; + @end /** diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index d55ed30a39b..2f1d596c59e 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -30,11 +30,7 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-completeness" -__attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoService : NSObject { - NSString *_host; - NSString *_packageName; - NSString *_serviceName; -} +__attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoService : NSObject - (nullable instancetype)initWithHost:(nonnull NSString *)host packageName:(nonnull NSString *)packageName diff --git a/src/objective-c/ProtoRPC/ProtoService.m b/src/objective-c/ProtoRPC/ProtoService.m index 40c51ed48e7..e84cab8903f 100644 --- a/src/objective-c/ProtoRPC/ProtoService.m +++ b/src/objective-c/ProtoRPC/ProtoService.m @@ -29,7 +29,11 @@ #pragma clang diagnostic ignored "-Wdeprecated-implementations" @implementation ProtoService { #pragma clang diagnostic pop + GRPCCallOptions *_callOptions; + NSString *_host; + NSString *_packageName; + NSString *_serviceName; } #pragma clang diagnostic push @@ -60,8 +64,6 @@ return self; } -#pragma clang diagnostic pop - - (GRPCUnaryProtoCall *)RPCToMethod:(NSString *)method message:(id)message responseHandler:(id)handler diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m index 3f1cb278723..ecac401703f 100644 --- a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m +++ b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m @@ -16,6 +16,8 @@ * */ +#import + #import "ProtoServiceLegacy.h" #import "ProtoMethod.h" #import "ProtoRPCLegacy.h" @@ -34,20 +36,32 @@ packageName:(NSString *)packageName serviceName:(NSString *)serviceName { if ((self = [super init])) { - _host = [host copy]; - _packageName = [packageName copy]; - _serviceName = [serviceName copy]; + Ivar hostIvar = class_getInstanceVariable([ProtoService class], "_host"); + Ivar packageNameIvar = class_getInstanceVariable([ProtoService class], "_packageName"); + Ivar serviceNameIvar = class_getInstanceVariable([ProtoService class], "_serviceName"); + + object_setIvar(self, hostIvar, [host copy]); + object_setIvar(self, packageNameIvar, [packageName copy]); + object_setIvar(self, serviceNameIvar, [serviceName copy]); } return self; } +#pragma clang diagnostic pop - (GRPCProtoCall *)RPCToMethod:(NSString *)method requestsWriter:(GRXWriter *)requestsWriter responseClass:(Class)responseClass responsesWriteable:(id)responsesWriteable { + Ivar hostIvar = class_getInstanceVariable([ProtoService class], "_host"); + Ivar packageNameIvar = class_getInstanceVariable([ProtoService class], "_packageName"); + Ivar serviceNameIvar = class_getInstanceVariable([ProtoService class], "_serviceName"); + NSString *host = object_getIvar(self, hostIvar); + NSString *packageName = object_getIvar(self, packageNameIvar); + NSString *serviceName = object_getIvar(self, serviceNameIvar); + GRPCProtoMethod *methodName = - [[GRPCProtoMethod alloc] initWithPackage:_packageName service:_serviceName method:method]; - return [[GRPCProtoCall alloc] initWithHost:_host + [[GRPCProtoMethod alloc] initWithPackage:packageName service:serviceName method:method]; + return [[GRPCProtoCall alloc] initWithHost:host method:methodName requestsWriter:requestsWriter responseClass:responseClass diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index 78e95abdc9e..2f1268e5c49 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -53,10 +53,20 @@ s.subspec 'Interface-Legacy' do |ss| ss.header_mappings_dir = 'src/objective-c/GRPCClient' - ss.public_header_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h", + ss.public_header_files = "GRPCClient/GRPCCall+ChannelArg.h", + "GRPCClient/GRPCCall+ChannelCredentials.h", + "GRPCClient/GRPCCall+Cronet.h", + "GRPCClient/GRPCCall+OAuth2.h", + "GRPCClient/GRPCCall+Tests.h", + "src/objective-c/GRPCClient/GRPCCallLegacy.h", "src/objective-c/GRPCClient/GRPCTypes.h" - ss.source_files = "src/objective-c/GRPCClient/GRPCCallLegacy.h", + ss.source_files = "GRPCClient/GRPCCall+ChannelArg.h", + "GRPCClient/GRPCCall+ChannelCredentials.h", + "GRPCClient/GRPCCall+Cronet.h", + "GRPCClient/GRPCCall+OAuth2.h", + "GRPCClient/GRPCCall+Tests.h", + "src/objective-c/GRPCClient/GRPCCallLegacy.h", "src/objective-c/GRPCClient/GRPCTypes.h" end From 25432e011a0bf4ae8f48ad16f251aeab89966ca0 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 8 Aug 2019 14:12:43 -0700 Subject: [PATCH 248/661] clang-format --- src/compiler/objective_c_plugin.cc | 4 +- src/objective-c/GRPCClient/GRPCTypes.h | 90 ++++++++++--------- src/objective-c/ProtoRPC/ProtoService.h | 12 +-- src/objective-c/ProtoRPC/ProtoServiceLegacy.m | 4 +- .../InteropTestsMultipleChannels.m | 2 +- 5 files changed, 59 insertions(+), 53 deletions(-) diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index f9066af4aa6..682cc28b739 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -211,8 +211,8 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { FrameworkImport(file_name + ".pbobjc.h", framework); } imports += (generator_params.no_v1_compatibility - ? SystemImport("ProtoRPC/ProtoRPC.h") - : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); + ? SystemImport("ProtoRPC/ProtoRPC.h") + : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); if (!generator_params.no_v1_compatibility) { imports += SystemImport("RxLibrary/GRXWriter+Immediate.h"); } diff --git a/src/objective-c/GRPCClient/GRPCTypes.h b/src/objective-c/GRPCClient/GRPCTypes.h index de4f2f9e93c..0aacf0f9d15 100644 --- a/src/objective-c/GRPCClient/GRPCTypes.h +++ b/src/objective-c/GRPCClient/GRPCTypes.h @@ -18,51 +18,55 @@ /** * gRPC error codes. - * Note that a few of these are never produced by the gRPC libraries, but are of general utility for - * server applications to produce. + * Note that a few of these are never produced by the gRPC libraries, but are of + * general utility for server applications to produce. */ typedef NS_ENUM(NSUInteger, GRPCErrorCode) { /** The operation was cancelled (typically by the caller). */ GRPCErrorCodeCancelled = 1, /** - * Unknown error. Errors raised by APIs that do not return enough error information may be - * converted to this error. + * Unknown error. Errors raised by APIs that do not return enough error + * information may be converted to this error. */ GRPCErrorCodeUnknown = 2, /** - * The client specified an invalid argument. Note that this differs from FAILED_PRECONDITION. - * INVALID_ARGUMENT indicates arguments that are problematic regardless of the state of the - * server (e.g., a malformed file name). + * The client specified an invalid argument. Note that this differs from + * FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are + * problematic regardless of the state of the server (e.g., a malformed file + * name). */ GRPCErrorCodeInvalidArgument = 3, /** - * Deadline expired before operation could complete. For operations that change the state of the - * server, this error may be returned even if the operation has completed successfully. For - * example, a successful response from the server could have been delayed long enough for the - * deadline to expire. + * Deadline expired before operation could complete. For operations that + * change the state of the server, this error may be returned even if the + * operation has completed successfully. For example, a successful response + * from the server could have been delayed long enough for the deadline to + * expire. */ GRPCErrorCodeDeadlineExceeded = 4, /** Some requested entity (e.g., file or directory) was not found. */ GRPCErrorCodeNotFound = 5, - /** Some entity that we attempted to create (e.g., file or directory) already exists. */ + /** Some entity that we attempted to create (e.g., file or directory) already + exists. */ GRPCErrorCodeAlreadyExists = 6, /** - * The caller does not have permission to execute the specified operation. PERMISSION_DENIED isn't - * used for rejections caused by exhausting some resource (RESOURCE_EXHAUSTED is used instead for - * those errors). PERMISSION_DENIED doesn't indicate a failure to identify the caller + * The caller does not have permission to execute the specified operation. + * PERMISSION_DENIED isn't used for rejections caused by exhausting some + * resource (RESOURCE_EXHAUSTED is used instead for those errors). + * PERMISSION_DENIED doesn't indicate a failure to identify the caller * (UNAUTHENTICATED is used instead for those errors). */ GRPCErrorCodePermissionDenied = 7, /** - * The request does not have valid authentication credentials for the operation (e.g. the caller's - * identity can't be verified). + * The request does not have valid authentication credentials for the + * operation (e.g. the caller's identity can't be verified). */ GRPCErrorCodeUnauthenticated = 16, @@ -70,43 +74,45 @@ typedef NS_ENUM(NSUInteger, GRPCErrorCode) { GRPCErrorCodeResourceExhausted = 8, /** - * The RPC was rejected because the server is not in a state required for the procedure's - * execution. For example, a directory to be deleted may be non-empty, etc. - * The client should not retry until the server state has been explicitly fixed (e.g. by - * performing another RPC). The details depend on the service being called, and should be found in - * the NSError's userInfo. + * The RPC was rejected because the server is not in a state required for the + * procedure's execution. For example, a directory to be deleted may be + * non-empty, etc. The client should not retry until the server state has been + * explicitly fixed (e.g. by performing another RPC). The details depend on + * the service being called, and should be found in the NSError's userInfo. */ GRPCErrorCodeFailedPrecondition = 9, /** - * The RPC was aborted, typically due to a concurrency issue like sequencer check failures, - * transaction aborts, etc. The client should retry at a higher-level (e.g., restarting a read- - * modify-write sequence). + * The RPC was aborted, typically due to a concurrency issue like sequencer + * check failures, transaction aborts, etc. The client should retry at a + * higher-level (e.g., restarting a read- modify-write sequence). */ GRPCErrorCodeAborted = 10, /** - * The RPC was attempted past the valid range. E.g., enumerating past the end of a list. - * Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed if the system state - * changes. For example, an RPC to get elements of a list will generate INVALID_ARGUMENT if asked - * to return the element at a negative index, but it will generate OUT_OF_RANGE if asked to return - * the element at an index past the current size of the list. + * The RPC was attempted past the valid range. E.g., enumerating past the end + * of a list. Unlike INVALID_ARGUMENT, this error indicates a problem that may + * be fixed if the system state changes. For example, an RPC to get elements + * of a list will generate INVALID_ARGUMENT if asked to return the element at + * a negative index, but it will generate OUT_OF_RANGE if asked to return the + * element at an index past the current size of the list. */ GRPCErrorCodeOutOfRange = 11, - /** The procedure is not implemented or not supported/enabled in this server. */ + /** The procedure is not implemented or not supported/enabled in this server. + */ GRPCErrorCodeUnimplemented = 12, /** - * Internal error. Means some invariant expected by the server application or the gRPC library has - * been broken. + * Internal error. Means some invariant expected by the server application or + * the gRPC library has been broken. */ GRPCErrorCodeInternal = 13, /** - * The server is currently unavailable. This is most likely a transient condition and may be - * corrected by retrying with a backoff. Note that it is not always safe to retry - * non-idempotent operations. + * The server is currently unavailable. This is most likely a transient + * condition and may be corrected by retrying with a backoff. Note that it is + * not always safe to retry non-idempotent operations. */ GRPCErrorCodeUnavailable = 14, @@ -155,14 +161,14 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) { }; /** Domain of NSError objects produced by gRPC. */ -extern NSString *const kGRPCErrorDomain; +extern NSString* const kGRPCErrorDomain; /** - * Keys used in |NSError|'s |userInfo| dictionary to store the response headers and trailers sent by - * the server. + * Keys used in |NSError|'s |userInfo| dictionary to store the response headers + * and trailers sent by the server. */ -extern NSString *const kGRPCHeadersKey; -extern NSString *const kGRPCTrailersKey; +extern NSString* const kGRPCHeadersKey; +extern NSString* const kGRPCTrailersKey; /** The id of a transport implementation. */ -typedef char *GRPCTransportId; +typedef char* GRPCTransportId; diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index 2f1d596c59e..34aea380668 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -30,13 +30,13 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-completeness" -__attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoService : NSObject +__attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoService + : NSObject -- (nullable instancetype)initWithHost:(nonnull NSString *)host - packageName:(nonnull NSString *)packageName - serviceName:(nonnull NSString *)serviceName - callOptions:(nullable GRPCCallOptions *)callOptions - NS_DESIGNATED_INITIALIZER; + - + (nullable instancetype)initWithHost : (nonnull NSString *)host packageName + : (nonnull NSString *)packageName serviceName : (nonnull NSString *)serviceName callOptions + : (nullable GRPCCallOptions *)callOptions NS_DESIGNATED_INITIALIZER; - (nullable GRPCUnaryProtoCall *)RPCToMethod:(nonnull NSString *)method message:(nonnull id)message diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m index ecac401703f..b8b2766cdb0 100644 --- a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m +++ b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m @@ -18,9 +18,9 @@ #import -#import "ProtoServiceLegacy.h" #import "ProtoMethod.h" #import "ProtoRPCLegacy.h" +#import "ProtoServiceLegacy.h" #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-implementations" @@ -60,7 +60,7 @@ NSString *serviceName = object_getIvar(self, serviceNameIvar); GRPCProtoMethod *methodName = - [[GRPCProtoMethod alloc] initWithPackage:packageName service:serviceName method:method]; + [[GRPCProtoMethod alloc] initWithPackage:packageName service:serviceName method:method]; return [[GRPCProtoCall alloc] initWithHost:host method:methodName requestsWriter:requestsWriter diff --git a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m index 5decdd05a95..d3dd1bf8d7f 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m +++ b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m @@ -20,10 +20,10 @@ #import #import +#import #import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" #import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" -#import #import "../ConfigureCronet.h" #import "InteropTestsBlockCallbacks.h" From df59df8ba260eb356b9bca39ff6f180535bdaac8 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 8 Aug 2019 14:48:10 -0700 Subject: [PATCH 249/661] Upgrading bazel_skylib --- bazel/grpc_deps.bzl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 7752ab814e5..c954dc99760 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -191,11 +191,10 @@ def grpc_deps(): ) if "bazel_skylib" not in native.existing_rules(): - http_archive( + git_repository( name = "bazel_skylib", - sha256 = "ba5d15ca230efca96320085d8e4d58da826d1f81b444ef8afccd8b23e0799b52", - strip_prefix = "bazel-skylib-f83cb8dd6f5658bc574ccd873e25197055265d1c", - url = "https://github.com/bazelbuild/bazel-skylib/archive/f83cb8dd6f5658bc574ccd873e25197055265d1c.tar.gz", + remote = "https://github.com/bazelbuild/bazel-skylib", + tag = "0.9.0", ) if "io_opencensus_cpp" not in native.existing_rules(): From 1069dee43a51d04a32cc1f70c3e2ba84f3153183 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Thu, 8 Aug 2019 15:00:02 -0700 Subject: [PATCH 250/661] Excluded *.inc from python garbage cleanup --- tools/run_tests/artifacts/build_artifact_python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/artifacts/build_artifact_python.sh b/tools/run_tests/artifacts/build_artifact_python.sh index c5e380fe5dc..55fd4ead04d 100755 --- a/tools/run_tests/artifacts/build_artifact_python.sh +++ b/tools/run_tests/artifacts/build_artifact_python.sh @@ -48,7 +48,7 @@ clean_non_source_files() { ( cd "$1" find . -type f \ | grep -v '\.c$' | grep -v '\.cc$' | grep -v '\.cpp$' \ - | grep -v '\.h$' | grep -v '\.hh$' \ + | grep -v '\.h$' | grep -v '\.hh$' | grep -v '\.inc$' \ | grep -v '\.s$' | grep -v '\.py$' \ | while read -r file; do rm -f "$file" || true From 4be53843d3f25025cf8f65d5644143305e8a8e54 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 8 Aug 2019 14:41:46 -0700 Subject: [PATCH 251/661] Use bazel to run interop server Removed commented tests --- src/objective-c/tests/run_one_test.sh | 14 ++++------- src/objective-c/tests/run_one_test_bazel.sh | 12 +++++----- src/objective-c/tests/run_tests.sh | 13 +++++------ tools/run_tests/run_tests.py | 26 ++------------------- 4 files changed, 18 insertions(+), 47 deletions(-) diff --git a/src/objective-c/tests/run_one_test.sh b/src/objective-c/tests/run_one_test.sh index a643740b64e..8fb26d75b72 100755 --- a/src/objective-c/tests/run_one_test.sh +++ b/src/objective-c/tests/run_one_test.sh @@ -20,18 +20,12 @@ set -ev cd $(dirname $0) -BINDIR=../../../bins/$CONFIG +BAZEL=../../../tools/bazel -[ -d Tests.xcworkspace/ ] || { +[ -d Tests.xcworkspace ] || { ./build_tests.sh } -[ -f $BINDIR/interop_server ] || { - echo >&2 "Can't find the test server. Make sure run_tests.py is making" \ - "interop_server before calling this script." - exit 1 -} - [ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { echo >&2 "Can't find the port server. Start port server with tools/run_tests/start_port_server.py." exit 1 @@ -40,8 +34,8 @@ BINDIR=../../../bins/$CONFIG PLAIN_PORT=$(curl localhost:32766/get) TLS_PORT=$(curl localhost:32766/get) -$BINDIR/interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & -$BINDIR/interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & +BAZEL run -- //test/cpp/interop:interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & +BAZEL run -- //test/cpp/interop:interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT diff --git a/src/objective-c/tests/run_one_test_bazel.sh b/src/objective-c/tests/run_one_test_bazel.sh index 41ffa21490c..39c28fb28a5 100755 --- a/src/objective-c/tests/run_one_test_bazel.sh +++ b/src/objective-c/tests/run_one_test_bazel.sh @@ -22,10 +22,10 @@ cd $(dirname $0) BINDIR=../../../bins/$CONFIG -[ -f $BINDIR/interop_server ] || { - echo >&2 "Can't find the test server. Make sure run_tests.py is making" \ - "interop_server before calling this script." - exit 1 +BAZEL=../../../tools/bazel + +[ -d Tests.xcworkspace ] || { + ./build_tests.sh } [ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { @@ -36,8 +36,8 @@ BINDIR=../../../bins/$CONFIG PLAIN_PORT=$(curl localhost:32766/get) TLS_PORT=$(curl localhost:32766/get) -$BINDIR/interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & -$BINDIR/interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & +BAZEL run -- //test/cpp/interop:interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & +BAZEL run -- //test/cpp/interop:interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh index 24185c561ec..916ca15b39f 100755 --- a/src/objective-c/tests/run_tests.sh +++ b/src/objective-c/tests/run_tests.sh @@ -22,15 +22,14 @@ cd $(dirname $0) # Run the tests server. -BINDIR=../../../bins/$CONFIG +BAZEL=../../../tools/bazel -[ -f $BINDIR/interop_server ] || { - echo >&2 "Can't find the test server. Make sure run_tests.py is making" \ - "interop_server before calling this script." - exit 1 +[ -d Tests.xcworkspace ] || { + ./build_tests.sh } -$BINDIR/interop_server --port=5050 --max_send_message_size=8388608 & -$BINDIR/interop_server --port=5051 --max_send_message_size=8388608 --use_tls & +BAZEL run -- //test/cpp/interop:interop_server --port=5050 --max_send_message_size=8388608 & +BAZEL run -- //test/cpp/interop:interop_server --port=5051 --max_send_message_size=8388608 --use_tls & + # Kill them when this script exits. trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 0f42b52c50e..0c3ef0bd57f 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1101,17 +1101,6 @@ class ObjCLanguage(object): 'EXAMPLE_PATH': 'src/objective-c/examples/tvOS-sample', 'FRAMEWORKS': 'NO' })) - # out.append( - # self.config.job_spec( - # ['src/objective-c/tests/build_one_example.sh'], - # timeout_seconds=10 * 60, - # shortname='ios-buildtest-example-tvOS-sample-framework', - # cpu_cost=1e6, - # environ={ - # 'SCHEME': 'tvOS-sample', - # 'EXAMPLE_PATH': 'src/objective-c/examples/tvOS-sample', - # 'FRAMEWORKS': 'YES' - # })) out.append( self.config.job_spec( ['src/objective-c/tests/build_one_example_bazel.sh'], @@ -1123,17 +1112,6 @@ class ObjCLanguage(object): 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', 'FRAMEWORKS': 'NO' })) - # out.append( - # self.config.job_spec( - # ['src/objective-c/tests/build_one_example.sh'], - # timeout_seconds=20 * 60, - # shortname='ios-buildtest-example-watchOS-sample-framework', - # cpu_cost=1e6, - # environ={ - # 'SCHEME': 'watchOS-sample-WatchKit-App', - # 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', - # 'FRAMEWORKS': 'YES' - # })) out.append( self.config.job_spec( ['src/objective-c/tests/run_plugin_tests.sh'], @@ -1150,7 +1128,7 @@ class ObjCLanguage(object): environ=_FORCE_ENVIRON_FOR_WRAPPERS)) out.append( self.config.job_spec( - ['src/objective-c/tests/run_one_test_bazel.sh'], + ['src/objective-c/tests/run_one_test.sh'], timeout_seconds=60 * 60, shortname='ios-test-unittests', cpu_cost=1e6, @@ -1209,7 +1187,7 @@ class ObjCLanguage(object): return [] def make_targets(self): - return ['interop_server'] + return [] def make_options(self): return [] From adbe914f4b434e3138ac348b82624c13fedb12cb Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Thu, 8 Aug 2019 16:19:18 -0700 Subject: [PATCH 252/661] Removed nanopb dependency from xDS --- BUILD | 6 ------ 1 file changed, 6 deletions(-) diff --git a/BUILD b/BUILD index 7b7b4499a26..c5abe5ce217 100644 --- a/BUILD +++ b/BUILD @@ -1257,9 +1257,6 @@ grpc_cc_library( "src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h", "src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h", ], - external_deps = [ - "nanopb", - ], language = "c++", deps = [ "envoy_ads_upb", @@ -1284,9 +1281,6 @@ grpc_cc_library( "src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h", "src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h", ], - external_deps = [ - "nanopb", - ], language = "c++", deps = [ "envoy_ads_upb", From be4e684a8259acb8132652d12aa3d511f76c3e09 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 12 Jul 2019 15:41:50 -0700 Subject: [PATCH 253/661] Migrated tsi/alts from nanopb to upb --- BUILD | 27 +- BUILD.gn | 17 +- CMakeLists.txt | 66 +- Makefile | 83 +-- build.yaml | 32 +- config.m4 | 15 +- config.w32 | 15 +- gRPC-C++.podspec | 16 +- gRPC-Core.podspec | 43 +- grpc.gemspec | 29 +- grpc.gyp | 13 +- package.xml | 29 +- .../alts/handshaker/alts_handshaker_client.cc | 180 +++-- .../handshaker/alts_handshaker_service_api.cc | 520 ------------- .../handshaker/alts_handshaker_service_api.h | 323 -------- .../alts_handshaker_service_api_util.cc | 145 ---- .../alts_handshaker_service_api_util.h | 149 ---- .../alts/handshaker/alts_tsi_handshaker.cc | 41 +- .../tsi/alts/handshaker/alts_tsi_handshaker.h | 4 +- .../tsi/alts/handshaker/alts_tsi_utils.cc | 16 +- src/core/tsi/alts/handshaker/alts_tsi_utils.h | 7 +- src/core/tsi/alts/handshaker/altscontext.pb.c | 47 -- src/core/tsi/alts/handshaker/altscontext.pb.h | 63 -- src/core/tsi/alts/handshaker/handshaker.pb.c | 122 --- src/core/tsi/alts/handshaker/handshaker.pb.h | 254 ------- .../handshaker/transport_security_common.pb.c | 49 -- .../handshaker/transport_security_common.pb.h | 78 -- .../transport_security_common_api.cc | 122 +-- .../transport_security_common_api.h | 60 +- src/python/grpcio/grpc_core_dependencies.py | 13 +- test/core/tsi/alts/handshaker/BUILD | 11 - .../handshaker/alts_handshaker_client_test.cc | 182 ++--- .../alts_handshaker_service_api_test.cc | 149 ---- .../alts_handshaker_service_api_test_lib.cc | 703 +++--------------- .../alts_handshaker_service_api_test_lib.h | 116 +-- .../handshaker/alts_tsi_handshaker_test.cc | 66 +- .../alts/handshaker/alts_tsi_utils_test.cc | 23 +- .../transport_security_common_api_test.cc | 52 +- tools/distrib/check_nanopb_output.sh | 27 - tools/doxygen/Doxyfile.core.internal | 23 +- .../generated/sources_and_headers.json | 59 +- tools/run_tests/generated/tests.json | 24 - 42 files changed, 637 insertions(+), 3376 deletions(-) delete mode 100644 src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc delete mode 100644 src/core/tsi/alts/handshaker/alts_handshaker_service_api.h delete mode 100644 src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc delete mode 100644 src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h delete mode 100644 src/core/tsi/alts/handshaker/altscontext.pb.c delete mode 100644 src/core/tsi/alts/handshaker/altscontext.pb.h delete mode 100644 src/core/tsi/alts/handshaker/handshaker.pb.c delete mode 100644 src/core/tsi/alts/handshaker/handshaker.pb.h delete mode 100644 src/core/tsi/alts/handshaker/transport_security_common.pb.c delete mode 100644 src/core/tsi/alts/handshaker/transport_security_common.pb.h delete mode 100644 test/core/tsi/alts/handshaker/alts_handshaker_service_api_test.cc diff --git a/BUILD b/BUILD index 7b7b4499a26..1835a909542 100644 --- a/BUILD +++ b/BUILD @@ -1861,24 +1861,6 @@ grpc_cc_library( ], ) -grpc_cc_library( - name = "alts_proto", - srcs = [ - "src/core/tsi/alts/handshaker/altscontext.pb.c", - "src/core/tsi/alts/handshaker/handshaker.pb.c", - "src/core/tsi/alts/handshaker/transport_security_common.pb.c", - ], - hdrs = [ - "src/core/tsi/alts/handshaker/altscontext.pb.h", - "src/core/tsi/alts/handshaker/handshaker.pb.h", - "src/core/tsi/alts/handshaker/transport_security_common.pb.h", - ], - external_deps = [ - "nanopb", - ], - language = "c++", -) - grpc_cc_library( name = "alts_util", srcs = [ @@ -1889,24 +1871,17 @@ grpc_cc_library( "src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc", "src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc", "src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc", "src/core/tsi/alts/handshaker/transport_security_common_api.cc", ], hdrs = [ "src/core/lib/security/credentials/alts/check_gcp_environment.h", "src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api.h", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h", "src/core/tsi/alts/handshaker/transport_security_common_api.h", ], - external_deps = [ - "nanopb", - ], language = "c++", public_hdrs = GRPC_SECURE_PUBLIC_HDRS, deps = [ - "alts_proto", + "alts_upb", "gpr", "grpc_base", ], diff --git a/BUILD.gn b/BUILD.gn index e63f7d2f2f1..18204a17c33 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -462,6 +462,12 @@ config("grpc_config") { "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h", "src/core/ext/upb-generated/google/rpc/status.upb.c", "src/core/ext/upb-generated/google/rpc/status.upb.h", + "src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h", + "src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h", + "src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c", + "src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h", "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c", "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h", "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c", @@ -865,10 +871,6 @@ config("grpc_config") { "src/core/tsi/alts/frame_protector/frame_handler.h", "src/core/tsi/alts/handshaker/alts_handshaker_client.cc", "src/core/tsi/alts/handshaker/alts_handshaker_client.h", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api.h", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h", "src/core/tsi/alts/handshaker/alts_shared_resource.cc", "src/core/tsi/alts/handshaker/alts_shared_resource.h", "src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc", @@ -876,12 +878,6 @@ config("grpc_config") { "src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h", "src/core/tsi/alts/handshaker/alts_tsi_utils.cc", "src/core/tsi/alts/handshaker/alts_tsi_utils.h", - "src/core/tsi/alts/handshaker/altscontext.pb.c", - "src/core/tsi/alts/handshaker/altscontext.pb.h", - "src/core/tsi/alts/handshaker/handshaker.pb.c", - "src/core/tsi/alts/handshaker/handshaker.pb.h", - "src/core/tsi/alts/handshaker/transport_security_common.pb.c", - "src/core/tsi/alts/handshaker/transport_security_common.pb.h", "src/core/tsi/alts/handshaker/transport_security_common_api.cc", "src/core/tsi/alts/handshaker/transport_security_common_api.h", "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc", @@ -934,7 +930,6 @@ config("grpc_config") { ":gpr", "//third_party/cares", ":address_sorting", - ":nanopb", ] public_configs = [ diff --git a/CMakeLists.txt b/CMakeLists.txt index b1c70db8fcf..70aaedd08a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -528,7 +528,6 @@ add_dependencies(buildtests_cxx alts_frame_handler_test) add_dependencies(buildtests_cxx alts_frame_protector_test) add_dependencies(buildtests_cxx alts_grpc_record_protocol_test) add_dependencies(buildtests_cxx alts_handshaker_client_test) -add_dependencies(buildtests_cxx alts_handshaker_service_api_test) add_dependencies(buildtests_cxx alts_iovec_record_protocol_test) add_dependencies(buildtests_cxx alts_security_connector_test) add_dependencies(buildtests_cxx alts_tsi_handshaker_test) @@ -1255,23 +1254,18 @@ add_library(grpc src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc - src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc - src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc src/core/tsi/alts/handshaker/alts_tsi_utils.cc src/core/tsi/alts/handshaker/transport_security_common_api.cc - src/core/tsi/alts/handshaker/altscontext.pb.c - src/core/tsi/alts/handshaker/handshaker.pb.c - src/core/tsi/alts/handshaker/transport_security_common.pb.c - third_party/nanopb/pb_common.c - third_party/nanopb/pb_decode.c - third_party/nanopb/pb_encode.c - src/core/tsi/transport_security.cc + src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c + src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c + src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c third_party/upb/upb/decode.c third_party/upb/upb/encode.c third_party/upb/upb/msg.c third_party/upb/upb/port.c third_party/upb/upb/table.c third_party/upb/upb/upb.c + src/core/tsi/transport_security.cc src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc src/core/ext/transport/chttp2/client/authority.cc @@ -1771,16 +1765,11 @@ add_library(grpc_cronet src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc - src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc - src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc src/core/tsi/alts/handshaker/alts_tsi_utils.cc src/core/tsi/alts/handshaker/transport_security_common_api.cc - src/core/tsi/alts/handshaker/altscontext.pb.c - src/core/tsi/alts/handshaker/handshaker.pb.c - src/core/tsi/alts/handshaker/transport_security_common.pb.c - third_party/nanopb/pb_common.c - third_party/nanopb/pb_decode.c - third_party/nanopb/pb_encode.c + src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c + src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c + src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c src/core/tsi/transport_security.cc src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc @@ -11269,47 +11258,6 @@ target_link_libraries(alts_handshaker_client_test ) -endif (gRPC_BUILD_TESTS) -if (gRPC_BUILD_TESTS) - -add_executable(alts_handshaker_service_api_test - test/core/tsi/alts/handshaker/alts_handshaker_service_api_test.cc - third_party/googletest/googletest/src/gtest-all.cc - third_party/googletest/googlemock/src/gmock-all.cc -) - - -target_include_directories(alts_handshaker_service_api_test - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} - PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} - PRIVATE ${_gRPC_CARES_INCLUDE_DIR} - PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_UPB_GENERATED_DIR} - PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} - PRIVATE ${_gRPC_UPB_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} - PRIVATE third_party/googletest/googletest/include - PRIVATE third_party/googletest/googletest - PRIVATE third_party/googletest/googlemock/include - PRIVATE third_party/googletest/googlemock - PRIVATE ${_gRPC_PROTO_GENS_DIR} -) - -target_link_libraries(alts_handshaker_service_api_test - ${_gRPC_PROTOBUF_LIBRARIES} - ${_gRPC_ALLTARGETS_LIBRARIES} - alts_test_util - gpr - grpc - ${_gRPC_GFLAGS_LIBRARIES} -) - - endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) diff --git a/Makefile b/Makefile index 51895104453..ef5963dc441 100644 --- a/Makefile +++ b/Makefile @@ -1146,7 +1146,6 @@ alts_frame_handler_test: $(BINDIR)/$(CONFIG)/alts_frame_handler_test alts_frame_protector_test: $(BINDIR)/$(CONFIG)/alts_frame_protector_test alts_grpc_record_protocol_test: $(BINDIR)/$(CONFIG)/alts_grpc_record_protocol_test alts_handshaker_client_test: $(BINDIR)/$(CONFIG)/alts_handshaker_client_test -alts_handshaker_service_api_test: $(BINDIR)/$(CONFIG)/alts_handshaker_service_api_test alts_iovec_record_protocol_test: $(BINDIR)/$(CONFIG)/alts_iovec_record_protocol_test alts_security_connector_test: $(BINDIR)/$(CONFIG)/alts_security_connector_test alts_tsi_handshaker_test: $(BINDIR)/$(CONFIG)/alts_tsi_handshaker_test @@ -1627,7 +1626,6 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/alts_frame_protector_test \ $(BINDIR)/$(CONFIG)/alts_grpc_record_protocol_test \ $(BINDIR)/$(CONFIG)/alts_handshaker_client_test \ - $(BINDIR)/$(CONFIG)/alts_handshaker_service_api_test \ $(BINDIR)/$(CONFIG)/alts_iovec_record_protocol_test \ $(BINDIR)/$(CONFIG)/alts_security_connector_test \ $(BINDIR)/$(CONFIG)/alts_tsi_handshaker_test \ @@ -1795,7 +1793,6 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/alts_frame_protector_test \ $(BINDIR)/$(CONFIG)/alts_grpc_record_protocol_test \ $(BINDIR)/$(CONFIG)/alts_handshaker_client_test \ - $(BINDIR)/$(CONFIG)/alts_handshaker_service_api_test \ $(BINDIR)/$(CONFIG)/alts_iovec_record_protocol_test \ $(BINDIR)/$(CONFIG)/alts_security_connector_test \ $(BINDIR)/$(CONFIG)/alts_tsi_handshaker_test \ @@ -2241,8 +2238,6 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/alts_grpc_record_protocol_test || ( echo test alts_grpc_record_protocol_test failed ; exit 1 ) $(E) "[RUN] Testing alts_handshaker_client_test" $(Q) $(BINDIR)/$(CONFIG)/alts_handshaker_client_test || ( echo test alts_handshaker_client_test failed ; exit 1 ) - $(E) "[RUN] Testing alts_handshaker_service_api_test" - $(Q) $(BINDIR)/$(CONFIG)/alts_handshaker_service_api_test || ( echo test alts_handshaker_service_api_test failed ; exit 1 ) $(E) "[RUN] Testing alts_iovec_record_protocol_test" $(Q) $(BINDIR)/$(CONFIG)/alts_iovec_record_protocol_test || ( echo test alts_iovec_record_protocol_test failed ; exit 1 ) $(E) "[RUN] Testing alts_security_connector_test" @@ -3762,23 +3757,18 @@ LIBGRPC_SRC = \ src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc \ src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc \ src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc \ - src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc \ - src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc \ src/core/tsi/alts/handshaker/alts_tsi_utils.cc \ src/core/tsi/alts/handshaker/transport_security_common_api.cc \ - src/core/tsi/alts/handshaker/altscontext.pb.c \ - src/core/tsi/alts/handshaker/handshaker.pb.c \ - src/core/tsi/alts/handshaker/transport_security_common.pb.c \ - third_party/nanopb/pb_common.c \ - third_party/nanopb/pb_decode.c \ - third_party/nanopb/pb_encode.c \ - src/core/tsi/transport_security.cc \ + src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \ third_party/upb/upb/decode.c \ third_party/upb/upb/encode.c \ third_party/upb/upb/msg.c \ third_party/upb/upb/port.c \ third_party/upb/upb/table.c \ third_party/upb/upb/upb.c \ + src/core/tsi/transport_security.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/authority.cc \ @@ -4266,16 +4256,11 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc \ src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc \ src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc \ - src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc \ - src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc \ src/core/tsi/alts/handshaker/alts_tsi_utils.cc \ src/core/tsi/alts/handshaker/transport_security_common_api.cc \ - src/core/tsi/alts/handshaker/altscontext.pb.c \ - src/core/tsi/alts/handshaker/handshaker.pb.c \ - src/core/tsi/alts/handshaker/transport_security_common.pb.c \ - third_party/nanopb/pb_common.c \ - third_party/nanopb/pb_decode.c \ - third_party/nanopb/pb_encode.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \ src/core/tsi/transport_security.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ @@ -13657,49 +13642,6 @@ endif endif -ALTS_HANDSHAKER_SERVICE_API_TEST_SRC = \ - test/core/tsi/alts/handshaker/alts_handshaker_service_api_test.cc \ - -ALTS_HANDSHAKER_SERVICE_API_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(ALTS_HANDSHAKER_SERVICE_API_TEST_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/alts_handshaker_service_api_test: openssl_dep_error - -else - - - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+. - -$(BINDIR)/$(CONFIG)/alts_handshaker_service_api_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/alts_handshaker_service_api_test: $(PROTOBUF_DEP) $(ALTS_HANDSHAKER_SERVICE_API_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libalts_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(ALTS_HANDSHAKER_SERVICE_API_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libalts_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/alts_handshaker_service_api_test - -endif - -endif - -$(OBJDIR)/$(CONFIG)/test/core/tsi/alts/handshaker/alts_handshaker_service_api_test.o: $(LIBDIR)/$(CONFIG)/libalts_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a - -deps_alts_handshaker_service_api_test: $(ALTS_HANDSHAKER_SERVICE_API_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(ALTS_HANDSHAKER_SERVICE_API_TEST_OBJS:.o=.dep) -endif -endif - - ALTS_IOVEC_RECORD_PROTOCOL_TEST_SRC = \ test/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol_test.cc \ @@ -22480,6 +22422,9 @@ src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc: $(OPENSSL_ src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc: $(OPENSSL_DEP) src/core/ext/transport/cronet/transport/cronet_api_dummy.cc: $(OPENSSL_DEP) src/core/ext/transport/cronet/transport/cronet_transport.cc: $(OPENSSL_DEP) +src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c: $(OPENSSL_DEP) +src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c: $(OPENSSL_DEP) +src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c: $(OPENSSL_DEP) src/core/lib/http/httpcli_security_connector.cc: $(OPENSSL_DEP) src/core/lib/security/context/security_context.cc: $(OPENSSL_DEP) src/core/lib/security/credentials/alts/alts_credentials.cc: $(OPENSSL_DEP) @@ -22534,14 +22479,9 @@ src/core/tsi/alts/frame_protector/alts_seal_privacy_integrity_crypter.cc: $(OPEN src/core/tsi/alts/frame_protector/alts_unseal_privacy_integrity_crypter.cc: $(OPENSSL_DEP) src/core/tsi/alts/frame_protector/frame_handler.cc: $(OPENSSL_DEP) src/core/tsi/alts/handshaker/alts_handshaker_client.cc: $(OPENSSL_DEP) -src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc: $(OPENSSL_DEP) -src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc: $(OPENSSL_DEP) src/core/tsi/alts/handshaker/alts_shared_resource.cc: $(OPENSSL_DEP) src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc: $(OPENSSL_DEP) src/core/tsi/alts/handshaker/alts_tsi_utils.cc: $(OPENSSL_DEP) -src/core/tsi/alts/handshaker/altscontext.pb.c: $(OPENSSL_DEP) -src/core/tsi/alts/handshaker/handshaker.pb.c: $(OPENSSL_DEP) -src/core/tsi/alts/handshaker/transport_security_common.pb.c: $(OPENSSL_DEP) src/core/tsi/alts/handshaker/transport_security_common_api.cc: $(OPENSSL_DEP) src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc: $(OPENSSL_DEP) src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc: $(OPENSSL_DEP) @@ -22620,9 +22560,6 @@ test/cpp/util/string_ref_helper.cc: $(OPENSSL_DEP) test/cpp/util/subprocess.cc: $(OPENSSL_DEP) test/cpp/util/test_config_cc.cc: $(OPENSSL_DEP) test/cpp/util/test_credentials_provider.cc: $(OPENSSL_DEP) -third_party/nanopb/pb_common.c: $(OPENSSL_DEP) -third_party/nanopb/pb_decode.c: $(OPENSSL_DEP) -third_party/nanopb/pb_encode.c: $(OPENSSL_DEP) endif .PHONY: all strip tools dep_error openssl_dep_error openssl_dep_message git_update stop buildtests buildtests_c buildtests_cxx test test_c test_cxx install install_c install_cxx install-headers install-headers_c install-headers_cxx install-shared install-shared_c install-shared_cxx install-static install-static_c install-static_cxx strip strip-shared strip-static strip_c strip-shared_c strip-static_c strip_cxx strip-shared_cxx strip-static_cxx dep_c dep_cxx bins_dep_c bins_dep_cxx clean diff --git a/build.yaml b/build.yaml index a18b916ec66..0b8c1955d27 100644 --- a/build.yaml +++ b/build.yaml @@ -17,17 +17,6 @@ settings: g_stands_for: ganges version: 1.24.0-dev filegroups: -- name: alts_proto - headers: - - src/core/tsi/alts/handshaker/altscontext.pb.h - - src/core/tsi/alts/handshaker/handshaker.pb.h - - src/core/tsi/alts/handshaker/transport_security_common.pb.h - src: - - src/core/tsi/alts/handshaker/altscontext.pb.c - - src/core/tsi/alts/handshaker/handshaker.pb.c - - src/core/tsi/alts/handshaker/transport_security_common.pb.c - uses: - - nanopb - name: alts_tsi headers: - src/core/tsi/alts/crypt/gsec.h @@ -80,14 +69,14 @@ filegroups: - src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c - src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c - src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c + uses: + - upb - name: alts_util public_headers: - include/grpc/grpc_security.h headers: - src/core/lib/security/credentials/alts/check_gcp_environment.h - src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h - - src/core/tsi/alts/handshaker/alts_handshaker_service_api.h - - src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h - src/core/tsi/alts/handshaker/alts_tsi_utils.h - src/core/tsi/alts/handshaker/transport_security_common_api.h src: @@ -98,14 +87,11 @@ filegroups: - src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc - src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc - src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc - - src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc - - src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc - src/core/tsi/alts/handshaker/alts_tsi_utils.cc - src/core/tsi/alts/handshaker/transport_security_common_api.cc uses: - - alts_proto + - alts_upb - grpc_base - - nanopb - tsi_interface - upb - name: census @@ -202,6 +188,8 @@ filegroups: - src/core/ext/upb-generated/google/protobuf/timestamp.upb.c - src/core/ext/upb-generated/google/protobuf/wrappers.upb.c - src/core/ext/upb-generated/google/rpc/status.upb.c + uses: + - upb - name: gpr_base src: - src/core/lib/gpr/alloc.cc @@ -878,6 +866,7 @@ filegroups: - src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c uses: - google_api_upb + - upb - name: grpc_max_age_filter headers: - src/core/ext/filters/max_age/max_age_filter.h @@ -4027,15 +4016,6 @@ targets: - alts_test_util - gpr - grpc -- name: alts_handshaker_service_api_test - build: test - language: c++ - src: - - test/core/tsi/alts/handshaker/alts_handshaker_service_api_test.cc - deps: - - alts_test_util - - gpr - - grpc - name: alts_iovec_record_protocol_test build: test language: c++ diff --git a/config.m4 b/config.m4 index 1bc581e6b67..72fd381fd53 100644 --- a/config.m4 +++ b/config.m4 @@ -334,23 +334,18 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc \ src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc \ src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc \ - src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc \ - src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc \ src/core/tsi/alts/handshaker/alts_tsi_utils.cc \ src/core/tsi/alts/handshaker/transport_security_common_api.cc \ - src/core/tsi/alts/handshaker/altscontext.pb.c \ - src/core/tsi/alts/handshaker/handshaker.pb.c \ - src/core/tsi/alts/handshaker/transport_security_common.pb.c \ - third_party/nanopb/pb_common.c \ - third_party/nanopb/pb_decode.c \ - third_party/nanopb/pb_encode.c \ - src/core/tsi/transport_security.cc \ + src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c \ + src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \ third_party/upb/upb/decode.c \ third_party/upb/upb/encode.c \ third_party/upb/upb/msg.c \ third_party/upb/upb/port.c \ third_party/upb/upb/table.c \ third_party/upb/upb/upb.c \ + src/core/tsi/transport_security.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/authority.cc \ @@ -767,6 +762,7 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/google/api) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/google/protobuf) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/google/rpc) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/gcp) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/health/v1) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/lb/v1) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/validate) @@ -853,6 +849,5 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/x509v3) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/ssl) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/third_party/fiat) - PHP_ADD_BUILD_DIR($ext_builddir/third_party/nanopb) PHP_ADD_BUILD_DIR($ext_builddir/third_party/upb/upb) fi diff --git a/config.w32 b/config.w32 index 52553fe5d5f..a2d0d0f6abf 100644 --- a/config.w32 +++ b/config.w32 @@ -307,23 +307,18 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\security\\credentials\\alts\\grpc_alts_credentials_client_options.cc " + "src\\core\\lib\\security\\credentials\\alts\\grpc_alts_credentials_options.cc " + "src\\core\\lib\\security\\credentials\\alts\\grpc_alts_credentials_server_options.cc " + - "src\\core\\tsi\\alts\\handshaker\\alts_handshaker_service_api.cc " + - "src\\core\\tsi\\alts\\handshaker\\alts_handshaker_service_api_util.cc " + "src\\core\\tsi\\alts\\handshaker\\alts_tsi_utils.cc " + "src\\core\\tsi\\alts\\handshaker\\transport_security_common_api.cc " + - "src\\core\\tsi\\alts\\handshaker\\altscontext.pb.c " + - "src\\core\\tsi\\alts\\handshaker\\handshaker.pb.c " + - "src\\core\\tsi\\alts\\handshaker\\transport_security_common.pb.c " + - "third_party\\nanopb\\pb_common.c " + - "third_party\\nanopb\\pb_decode.c " + - "third_party\\nanopb\\pb_encode.c " + - "src\\core\\tsi\\transport_security.cc " + + "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp\\altscontext.upb.c " + + "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp\\handshaker.upb.c " + + "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp\\transport_security_common.upb.c " + "third_party\\upb\\upb\\decode.c " + "third_party\\upb\\upb\\encode.c " + "third_party\\upb\\upb\\msg.c " + "third_party\\upb\\upb\\port.c " + "third_party\\upb\\upb\\table.c " + "third_party\\upb\\upb\\upb.c " + + "src\\core\\tsi\\transport_security.cc " + "src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create.cc " + "src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create_posix.cc " + "src\\core\\ext\\transport\\chttp2\\client\\authority.cc " + @@ -785,6 +780,7 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health\\v1"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb"); @@ -883,7 +879,6 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\ssl"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\third_party"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl\\third_party\\fiat"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\nanopb"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\upb"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\upb\\upb"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\zlib"); diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index e0c8a570d48..5f0b312227e 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -228,6 +228,10 @@ Pod::Spec.new do |s| 'src/cpp/server/health/default_health_check_service.h', 'src/cpp/server/thread_pool_interface.h', 'src/cpp/thread_manager/thread_manager.h', + 'third_party/nanopb/pb.h', + 'third_party/nanopb/pb_common.h', + 'third_party/nanopb/pb_decode.h', + 'third_party/nanopb/pb_encode.h', 'src/cpp/client/insecure_credentials.cc', 'src/cpp/client/secure_credentials.cc', 'src/cpp/common/auth_property_iterator.cc', @@ -380,15 +384,11 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h', 'src/core/lib/security/credentials/alts/check_gcp_environment.h', 'src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h', - 'src/core/tsi/alts/handshaker/alts_handshaker_service_api.h', - 'src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h', 'src/core/tsi/alts/handshaker/alts_tsi_utils.h', 'src/core/tsi/alts/handshaker/transport_security_common_api.h', - 'src/core/tsi/alts/handshaker/altscontext.pb.h', - 'src/core/tsi/alts/handshaker/handshaker.pb.h', - 'src/core/tsi/alts/handshaker/transport_security_common.pb.h', - 'src/core/tsi/transport_security.h', - 'src/core/tsi/transport_security_interface.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h', 'third_party/upb/upb/decode.h', 'third_party/upb/upb/encode.h', 'third_party/upb/upb/generated_util.h', @@ -397,6 +397,8 @@ Pod::Spec.new do |s| 'third_party/upb/upb/port_undef.inc', 'third_party/upb/upb/table.int.h', 'third_party/upb/upb/upb.h', + 'src/core/tsi/transport_security.h', + 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/ext/filters/client_channel/backup_poller.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 0d6a282a94a..2a35ca35fb5 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -336,15 +336,11 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h', 'src/core/lib/security/credentials/alts/check_gcp_environment.h', 'src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h', - 'src/core/tsi/alts/handshaker/alts_handshaker_service_api.h', - 'src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h', 'src/core/tsi/alts/handshaker/alts_tsi_utils.h', 'src/core/tsi/alts/handshaker/transport_security_common_api.h', - 'src/core/tsi/alts/handshaker/altscontext.pb.h', - 'src/core/tsi/alts/handshaker/handshaker.pb.h', - 'src/core/tsi/alts/handshaker/transport_security_common.pb.h', - 'src/core/tsi/transport_security.h', - 'src/core/tsi/transport_security_interface.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h', 'third_party/upb/upb/decode.h', 'third_party/upb/upb/encode.h', 'third_party/upb/upb/generated_util.h', @@ -353,6 +349,8 @@ Pod::Spec.new do |s| 'third_party/upb/upb/port_undef.inc', 'third_party/upb/upb/table.int.h', 'third_party/upb/upb/upb.h', + 'src/core/tsi/transport_security.h', + 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/ext/filters/client_channel/backup_poller.h', @@ -834,20 +832,18 @@ Pod::Spec.new do |s| 'src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc', 'src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc', 'src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc', - 'src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc', - 'src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc', 'src/core/tsi/alts/handshaker/alts_tsi_utils.cc', 'src/core/tsi/alts/handshaker/transport_security_common_api.cc', - 'src/core/tsi/alts/handshaker/altscontext.pb.c', - 'src/core/tsi/alts/handshaker/handshaker.pb.c', - 'src/core/tsi/alts/handshaker/transport_security_common.pb.c', - 'src/core/tsi/transport_security.cc', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c', 'third_party/upb/upb/decode.c', 'third_party/upb/upb/encode.c', 'third_party/upb/upb/msg.c', 'third_party/upb/upb/port.c', 'third_party/upb/upb/table.c', 'third_party/upb/upb/upb.c', + 'src/core/tsi/transport_security.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/authority.cc', @@ -1065,15 +1061,11 @@ Pod::Spec.new do |s| 'src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h', 'src/core/lib/security/credentials/alts/check_gcp_environment.h', 'src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h', - 'src/core/tsi/alts/handshaker/alts_handshaker_service_api.h', - 'src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h', 'src/core/tsi/alts/handshaker/alts_tsi_utils.h', 'src/core/tsi/alts/handshaker/transport_security_common_api.h', - 'src/core/tsi/alts/handshaker/altscontext.pb.h', - 'src/core/tsi/alts/handshaker/handshaker.pb.h', - 'src/core/tsi/alts/handshaker/transport_security_common.pb.h', - 'src/core/tsi/transport_security.h', - 'src/core/tsi/transport_security_interface.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h', 'third_party/upb/upb/decode.h', 'third_party/upb/upb/encode.h', 'third_party/upb/upb/generated_util.h', @@ -1082,6 +1074,8 @@ Pod::Spec.new do |s| 'third_party/upb/upb/port_undef.inc', 'third_party/upb/upb/table.int.h', 'third_party/upb/upb/upb.h', + 'src/core/tsi/transport_security.h', + 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/ext/filters/client_channel/backup_poller.h', @@ -1336,16 +1330,9 @@ Pod::Spec.new do |s| ss.source_files = 'src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc', 'src/core/ext/transport/cronet/transport/cronet_transport.cc', - 'third_party/nanopb/pb_common.c', - 'third_party/nanopb/pb_decode.c', - 'third_party/nanopb/pb_encode.c', 'src/core/ext/transport/cronet/client/secure/cronet_channel_create.h', 'src/core/ext/transport/cronet/transport/cronet_transport.h', - 'third_party/objective_c/Cronet/bidirectional_stream_c.h', - 'third_party/nanopb/pb.h', - 'third_party/nanopb/pb_common.h', - 'third_party/nanopb/pb_decode.h', - 'third_party/nanopb/pb_encode.h' + 'third_party/objective_c/Cronet/bidirectional_stream_c.h' end s.subspec 'Tests' do |ss| diff --git a/grpc.gemspec b/grpc.gemspec index 2c658f48d80..c817006b125 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -265,19 +265,11 @@ Gem::Specification.new do |s| s.files += %w( src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h ) s.files += %w( src/core/lib/security/credentials/alts/check_gcp_environment.h ) s.files += %w( src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h ) - s.files += %w( src/core/tsi/alts/handshaker/alts_handshaker_service_api.h ) - s.files += %w( src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h ) s.files += %w( src/core/tsi/alts/handshaker/alts_tsi_utils.h ) s.files += %w( src/core/tsi/alts/handshaker/transport_security_common_api.h ) - s.files += %w( src/core/tsi/alts/handshaker/altscontext.pb.h ) - s.files += %w( src/core/tsi/alts/handshaker/handshaker.pb.h ) - s.files += %w( src/core/tsi/alts/handshaker/transport_security_common.pb.h ) - s.files += %w( third_party/nanopb/pb.h ) - s.files += %w( third_party/nanopb/pb_common.h ) - s.files += %w( third_party/nanopb/pb_decode.h ) - s.files += %w( third_party/nanopb/pb_encode.h ) - s.files += %w( src/core/tsi/transport_security.h ) - s.files += %w( src/core/tsi/transport_security_interface.h ) + s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h ) + s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h ) + s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h ) s.files += %w( third_party/upb/upb/decode.h ) s.files += %w( third_party/upb/upb/encode.h ) s.files += %w( third_party/upb/upb/generated_util.h ) @@ -286,6 +278,8 @@ Gem::Specification.new do |s| s.files += %w( third_party/upb/upb/port_undef.inc ) s.files += %w( third_party/upb/upb/table.int.h ) s.files += %w( third_party/upb/upb/upb.h ) + s.files += %w( src/core/tsi/transport_security.h ) + s.files += %w( src/core/tsi/transport_security_interface.h ) s.files += %w( src/core/ext/transport/chttp2/client/authority.h ) s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.h ) s.files += %w( src/core/ext/filters/client_channel/backup_poller.h ) @@ -767,23 +761,18 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc ) s.files += %w( src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc ) s.files += %w( src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc ) - s.files += %w( src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc ) - s.files += %w( src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc ) s.files += %w( src/core/tsi/alts/handshaker/alts_tsi_utils.cc ) s.files += %w( src/core/tsi/alts/handshaker/transport_security_common_api.cc ) - s.files += %w( src/core/tsi/alts/handshaker/altscontext.pb.c ) - s.files += %w( src/core/tsi/alts/handshaker/handshaker.pb.c ) - s.files += %w( src/core/tsi/alts/handshaker/transport_security_common.pb.c ) - s.files += %w( third_party/nanopb/pb_common.c ) - s.files += %w( third_party/nanopb/pb_decode.c ) - s.files += %w( third_party/nanopb/pb_encode.c ) - s.files += %w( src/core/tsi/transport_security.cc ) + s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c ) + s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c ) + s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c ) s.files += %w( third_party/upb/upb/decode.c ) s.files += %w( third_party/upb/upb/encode.c ) s.files += %w( third_party/upb/upb/msg.c ) s.files += %w( third_party/upb/upb/port.c ) s.files += %w( third_party/upb/upb/table.c ) s.files += %w( third_party/upb/upb/upb.c ) + s.files += %w( src/core/tsi/transport_security.cc ) s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.cc ) s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc ) s.files += %w( src/core/ext/transport/chttp2/client/authority.cc ) diff --git a/grpc.gyp b/grpc.gyp index 5241a57007a..173aef52a79 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -544,23 +544,18 @@ 'src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc', 'src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc', 'src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc', - 'src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc', - 'src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc', 'src/core/tsi/alts/handshaker/alts_tsi_utils.cc', 'src/core/tsi/alts/handshaker/transport_security_common_api.cc', - 'src/core/tsi/alts/handshaker/altscontext.pb.c', - 'src/core/tsi/alts/handshaker/handshaker.pb.c', - 'src/core/tsi/alts/handshaker/transport_security_common.pb.c', - 'third_party/nanopb/pb_common.c', - 'third_party/nanopb/pb_decode.c', - 'third_party/nanopb/pb_encode.c', - 'src/core/tsi/transport_security.cc', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c', 'third_party/upb/upb/decode.c', 'third_party/upb/upb/encode.c', 'third_party/upb/upb/msg.c', 'third_party/upb/upb/port.c', 'third_party/upb/upb/table.c', 'third_party/upb/upb/upb.c', + 'src/core/tsi/transport_security.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/authority.cc', diff --git a/package.xml b/package.xml index 1e1bc3d4176..979bc465a75 100644 --- a/package.xml +++ b/package.xml @@ -270,19 +270,11 @@ - - - - - - - - - - - + + + @@ -291,6 +283,8 @@ + + @@ -772,23 +766,18 @@ - - - - - - - - - + + + + diff --git a/src/core/tsi/alts/handshaker/alts_handshaker_client.cc b/src/core/tsi/alts/handshaker/alts_handshaker_client.cc index 464de9e00d0..55fd066dba5 100644 --- a/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +++ b/src/core/tsi/alts/handshaker/alts_handshaker_client.cc @@ -27,7 +27,6 @@ #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/surface/call.h" #include "src/core/lib/surface/channel.h" -#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api.h" #include "src/core/tsi/alts/handshaker/alts_shared_resource.h" #include "src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h" #include "src/core/tsi/alts/handshaker/alts_tsi_utils.h" @@ -91,9 +90,9 @@ static void handshaker_client_send_buffer_destroy( client->send_buffer = nullptr; } -static bool is_handshake_finished_properly(grpc_gcp_handshaker_resp* resp) { +static bool is_handshake_finished_properly(grpc_gcp_HandshakerResp* resp) { GPR_ASSERT(resp != nullptr); - if (resp->has_result) { + if (grpc_gcp_HandshakerResp_result(resp)) { return true; } return false; @@ -140,8 +139,9 @@ void alts_handshaker_client_handle_response(alts_handshaker_client* c, cb(TSI_INTERNAL_ERROR, user_data, nullptr, 0, nullptr); return; } - grpc_gcp_handshaker_resp* resp = - alts_tsi_utils_deserialize_response(recv_buffer); + upb::Arena arena; + grpc_gcp_HandshakerResp* resp = + alts_tsi_utils_deserialize_response(recv_buffer, arena.ptr()); grpc_byte_buffer_destroy(client->recv_buffer); client->recv_buffer = nullptr; /* Invalid handshaker response check. */ @@ -150,35 +150,44 @@ void alts_handshaker_client_handle_response(alts_handshaker_client* c, cb(TSI_DATA_CORRUPTED, user_data, nullptr, 0, nullptr); return; } - grpc_slice* slice = static_cast(resp->out_frames.arg); + const grpc_gcp_HandshakerStatus* resp_status = + grpc_gcp_HandshakerResp_status(resp); + if (resp_status == nullptr) { + gpr_log(GPR_ERROR, "No status in HandshakerResp"); + cb(TSI_DATA_CORRUPTED, user_data, nullptr, 0, nullptr); + return; + } + upb_strview out_frames = grpc_gcp_HandshakerResp_out_frames(resp); unsigned char* bytes_to_send = nullptr; size_t bytes_to_send_size = 0; - if (slice != nullptr) { - bytes_to_send_size = GRPC_SLICE_LENGTH(*slice); + if (out_frames.size > 0) { + bytes_to_send_size = out_frames.size; while (bytes_to_send_size > client->buffer_size) { client->buffer_size *= 2; client->buffer = static_cast( gpr_realloc(client->buffer, client->buffer_size)); } - memcpy(client->buffer, GRPC_SLICE_START_PTR(*slice), bytes_to_send_size); + memcpy(client->buffer, out_frames.data, bytes_to_send_size); bytes_to_send = client->buffer; } tsi_handshaker_result* result = nullptr; if (is_handshake_finished_properly(resp)) { alts_tsi_handshaker_result_create(resp, client->is_client, &result); - alts_tsi_handshaker_result_set_unused_bytes(result, &client->recv_bytes, - resp->bytes_consumed); + alts_tsi_handshaker_result_set_unused_bytes( + result, &client->recv_bytes, + grpc_gcp_HandshakerResp_bytes_consumed(resp)); } - grpc_status_code code = static_cast(resp->status.code); + grpc_status_code code = static_cast( + grpc_gcp_HandshakerStatus_code(resp_status)); if (code != GRPC_STATUS_OK) { - grpc_slice* details = static_cast(resp->status.details.arg); - if (details != nullptr) { - char* error_details = grpc_slice_to_c_string(*details); + upb_strview details = grpc_gcp_HandshakerStatus_details(resp_status); + if (details.size > 0) { + char* error_details = (char*)gpr_zalloc(details.size + 1); + memcpy(error_details, details.data, details.size); gpr_log(GPR_ERROR, "Error from handshaker service:%s", error_details); gpr_free(error_details); } } - grpc_gcp_handshaker_resp_destroy(resp); cb(alts_tsi_utils_convert_to_tsi_result(code), user_data, bytes_to_send, bytes_to_send_size, result); } @@ -223,43 +232,59 @@ static tsi_result make_grpc_call(alts_handshaker_client* c, bool is_start) { return TSI_OK; } +/* Serializes a grpc_gcp_HandshakerReq message into a buffer and returns newly + * grpc_byte_buffer holding it. */ +static grpc_byte_buffer* get_serialized_handshaker_req( + grpc_gcp_HandshakerReq* req, upb_arena* arena) { + size_t buf_length; + char* buf = grpc_gcp_HandshakerReq_serialize(req, arena, &buf_length); + if (buf == nullptr) { + return nullptr; + } + grpc_slice slice = grpc_slice_from_copied_buffer(buf, buf_length); + grpc_byte_buffer* byte_buffer = grpc_raw_byte_buffer_create(&slice, 1); + grpc_slice_unref_internal(slice); + return byte_buffer; +} + /* Create and populate a client_start handshaker request, then serialize it. */ static grpc_byte_buffer* get_serialized_start_client( alts_handshaker_client* c) { GPR_ASSERT(c != nullptr); alts_grpc_handshaker_client* client = reinterpret_cast(c); - bool ok = true; - grpc_gcp_handshaker_req* req = - grpc_gcp_handshaker_req_create(CLIENT_START_REQ); - ok &= grpc_gcp_handshaker_req_set_handshake_protocol( - req, grpc_gcp_HandshakeProtocol_ALTS); - ok &= grpc_gcp_handshaker_req_add_application_protocol( - req, ALTS_APPLICATION_PROTOCOL); - ok &= grpc_gcp_handshaker_req_add_record_protocol(req, ALTS_RECORD_PROTOCOL); - grpc_gcp_rpc_protocol_versions* versions = &client->options->rpc_versions; - ok &= grpc_gcp_handshaker_req_set_rpc_versions( - req, versions->max_rpc_version.major, versions->max_rpc_version.minor, - versions->min_rpc_version.major, versions->min_rpc_version.minor); - char* target_name = grpc_slice_to_c_string(client->target_name); - ok &= grpc_gcp_handshaker_req_set_target_name(req, target_name); + upb::Arena arena; + grpc_gcp_HandshakerReq* req = grpc_gcp_HandshakerReq_new(arena.ptr()); + grpc_gcp_StartClientHandshakeReq* start_client = + grpc_gcp_HandshakerReq_mutable_client_start(req, arena.ptr()); + grpc_gcp_StartClientHandshakeReq_set_handshake_security_protocol( + start_client, grpc_gcp_ALTS); + grpc_gcp_StartClientHandshakeReq_add_application_protocols( + start_client, upb_strview_makez(ALTS_APPLICATION_PROTOCOL), arena.ptr()); + grpc_gcp_StartClientHandshakeReq_add_record_protocols( + start_client, upb_strview_makez(ALTS_RECORD_PROTOCOL), arena.ptr()); + grpc_gcp_RpcProtocolVersions* client_version = + grpc_gcp_StartClientHandshakeReq_mutable_rpc_versions(start_client, + arena.ptr()); + grpc_gcp_RpcProtocolVersions_assign_from_struct( + client_version, arena.ptr(), &client->options->rpc_versions); + grpc_gcp_StartClientHandshakeReq_set_target_name( + start_client, + upb_strview_make(reinterpret_cast( + GRPC_SLICE_START_PTR(client->target_name)), + GRPC_SLICE_LENGTH(client->target_name))); target_service_account* ptr = (reinterpret_cast(client->options)) ->target_account_list_head; while (ptr != nullptr) { - grpc_gcp_handshaker_req_add_target_identity_service_account(req, ptr->data); + grpc_gcp_Identity* target_identity = + grpc_gcp_StartClientHandshakeReq_add_target_identities(start_client, + arena.ptr()); + grpc_gcp_Identity_set_service_account(target_identity, + upb_strview_makez(ptr->data)); ptr = ptr->next; } - grpc_slice slice; - ok &= grpc_gcp_handshaker_req_encode(req, &slice); - grpc_byte_buffer* buffer = nullptr; - if (ok) { - buffer = grpc_raw_byte_buffer_create(&slice, 1 /* number of slices */); - } - grpc_slice_unref_internal(slice); - gpr_free(target_name); - grpc_gcp_handshaker_req_destroy(req); - return buffer; + return get_serialized_handshaker_req(req, arena.ptr()); } static tsi_result handshaker_client_start_client(alts_handshaker_client* c) { @@ -290,28 +315,35 @@ static grpc_byte_buffer* get_serialized_start_server( GPR_ASSERT(bytes_received != nullptr); alts_grpc_handshaker_client* client = reinterpret_cast(c); - grpc_gcp_handshaker_req* req = - grpc_gcp_handshaker_req_create(SERVER_START_REQ); - bool ok = grpc_gcp_handshaker_req_add_application_protocol( - req, ALTS_APPLICATION_PROTOCOL); - ok &= grpc_gcp_handshaker_req_param_add_record_protocol( - req, grpc_gcp_HandshakeProtocol_ALTS, ALTS_RECORD_PROTOCOL); - ok &= grpc_gcp_handshaker_req_set_in_bytes( - req, reinterpret_cast GRPC_SLICE_START_PTR(*bytes_received), - GRPC_SLICE_LENGTH(*bytes_received)); - grpc_gcp_rpc_protocol_versions* versions = &client->options->rpc_versions; - ok &= grpc_gcp_handshaker_req_set_rpc_versions( - req, versions->max_rpc_version.major, versions->max_rpc_version.minor, - versions->min_rpc_version.major, versions->min_rpc_version.minor); - grpc_slice req_slice; - ok &= grpc_gcp_handshaker_req_encode(req, &req_slice); - grpc_byte_buffer* buffer = nullptr; - if (ok) { - buffer = grpc_raw_byte_buffer_create(&req_slice, 1 /* number of slices */); - } - grpc_slice_unref_internal(req_slice); - grpc_gcp_handshaker_req_destroy(req); - return buffer; + + upb::Arena arena; + grpc_gcp_HandshakerReq* req = grpc_gcp_HandshakerReq_new(arena.ptr()); + + grpc_gcp_StartServerHandshakeReq* start_server = + grpc_gcp_HandshakerReq_mutable_server_start(req, arena.ptr()); + grpc_gcp_StartServerHandshakeReq_add_application_protocols( + start_server, upb_strview_makez(ALTS_APPLICATION_PROTOCOL), arena.ptr()); + grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry* param = + grpc_gcp_StartServerHandshakeReq_add_handshake_parameters(start_server, + arena.ptr()); + grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_set_key( + param, grpc_gcp_ALTS); + grpc_gcp_ServerHandshakeParameters* value = + grpc_gcp_ServerHandshakeParameters_new(arena.ptr()); + grpc_gcp_ServerHandshakeParameters_add_record_protocols( + value, upb_strview_makez(ALTS_RECORD_PROTOCOL), arena.ptr()); + grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_set_value(param, + value); + grpc_gcp_StartServerHandshakeReq_set_in_bytes( + start_server, upb_strview_make(reinterpret_cast( + GRPC_SLICE_START_PTR(*bytes_received)), + GRPC_SLICE_LENGTH(*bytes_received))); + grpc_gcp_RpcProtocolVersions* server_version = + grpc_gcp_StartServerHandshakeReq_mutable_rpc_versions(start_server, + arena.ptr()); + grpc_gcp_RpcProtocolVersions_assign_from_struct( + server_version, arena.ptr(), &client->options->rpc_versions); + return get_serialized_handshaker_req(req, arena.ptr()); } static tsi_result handshaker_client_start_server(alts_handshaker_client* c, @@ -339,19 +371,15 @@ static tsi_result handshaker_client_start_server(alts_handshaker_client* c, /* Create and populate a next handshaker request, then serialize it. */ static grpc_byte_buffer* get_serialized_next(grpc_slice* bytes_received) { GPR_ASSERT(bytes_received != nullptr); - grpc_gcp_handshaker_req* req = grpc_gcp_handshaker_req_create(NEXT_REQ); - bool ok = grpc_gcp_handshaker_req_set_in_bytes( - req, reinterpret_cast GRPC_SLICE_START_PTR(*bytes_received), - GRPC_SLICE_LENGTH(*bytes_received)); - grpc_slice req_slice; - ok &= grpc_gcp_handshaker_req_encode(req, &req_slice); - grpc_byte_buffer* buffer = nullptr; - if (ok) { - buffer = grpc_raw_byte_buffer_create(&req_slice, 1 /* number of slices */); - } - grpc_slice_unref_internal(req_slice); - grpc_gcp_handshaker_req_destroy(req); - return buffer; + upb::Arena arena; + grpc_gcp_HandshakerReq* req = grpc_gcp_HandshakerReq_new(arena.ptr()); + grpc_gcp_NextHandshakeMessageReq* next = + grpc_gcp_HandshakerReq_mutable_next(req, arena.ptr()); + grpc_gcp_NextHandshakeMessageReq_set_in_bytes( + next, upb_strview_make(reinterpret_cast GRPC_SLICE_START_PTR( + *bytes_received), + GRPC_SLICE_LENGTH(*bytes_received))); + return get_serialized_handshaker_req(req, arena.ptr()); } static tsi_result handshaker_client_next(alts_handshaker_client* c, diff --git a/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc b/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc deleted file mode 100644 index 256e414ae43..00000000000 --- a/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc +++ /dev/null @@ -1,520 +0,0 @@ -/* - * - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api.h" - -#include -#include - -#include "src/core/tsi/alts/handshaker/transport_security_common_api.h" - -/* HandshakerReq */ -grpc_gcp_handshaker_req* grpc_gcp_handshaker_req_create( - grpc_gcp_handshaker_req_type type) { - grpc_gcp_handshaker_req* req = - static_cast(gpr_zalloc(sizeof(*req))); - switch (type) { - case CLIENT_START_REQ: - req->has_client_start = true; - break; - case SERVER_START_REQ: - req->has_server_start = true; - break; - case NEXT_REQ: - req->has_next = true; - break; - } - return req; -} - -void grpc_gcp_handshaker_req_destroy(grpc_gcp_handshaker_req* req) { - if (req == nullptr) { - return; - } - if (req->has_client_start) { - /* Destroy client_start request. */ - destroy_repeated_field_list_identity( - static_cast(req->client_start.target_identities.arg)); - destroy_repeated_field_list_string(static_cast( - req->client_start.application_protocols.arg)); - destroy_repeated_field_list_string( - static_cast(req->client_start.record_protocols.arg)); - if (req->client_start.has_local_identity) { - destroy_slice(static_cast( - req->client_start.local_identity.hostname.arg)); - destroy_slice(static_cast( - req->client_start.local_identity.service_account.arg)); - } - if (req->client_start.has_local_endpoint) { - destroy_slice(static_cast( - req->client_start.local_endpoint.ip_address.arg)); - } - if (req->client_start.has_remote_endpoint) { - destroy_slice(static_cast( - req->client_start.remote_endpoint.ip_address.arg)); - } - destroy_slice(static_cast(req->client_start.target_name.arg)); - } else if (req->has_server_start) { - /* Destroy server_start request. */ - size_t i = 0; - for (i = 0; i < req->server_start.handshake_parameters_count; i++) { - destroy_repeated_field_list_identity( - static_cast(req->server_start.handshake_parameters[i] - .value.local_identities.arg)); - destroy_repeated_field_list_string( - static_cast(req->server_start.handshake_parameters[i] - .value.record_protocols.arg)); - } - destroy_repeated_field_list_string(static_cast( - req->server_start.application_protocols.arg)); - if (req->server_start.has_local_endpoint) { - destroy_slice(static_cast( - req->server_start.local_endpoint.ip_address.arg)); - } - if (req->server_start.has_remote_endpoint) { - destroy_slice(static_cast( - req->server_start.remote_endpoint.ip_address.arg)); - } - destroy_slice(static_cast(req->server_start.in_bytes.arg)); - } else { - /* Destroy next request. */ - destroy_slice(static_cast(req->next.in_bytes.arg)); - } - gpr_free(req); -} - -bool grpc_gcp_handshaker_req_set_handshake_protocol( - grpc_gcp_handshaker_req* req, - grpc_gcp_handshake_protocol handshake_protocol) { - if (req == nullptr || !req->has_client_start) { - gpr_log(GPR_ERROR, - "Invalid arguments to " - "grpc_gcp_handshaker_req_set_handshake_protocol()."); - return false; - } - req->client_start.has_handshake_security_protocol = true; - req->client_start.handshake_security_protocol = handshake_protocol; - return true; -} - -bool grpc_gcp_handshaker_req_set_target_name(grpc_gcp_handshaker_req* req, - const char* target_name) { - if (req == nullptr || target_name == nullptr || !req->has_client_start) { - gpr_log(GPR_ERROR, - "Invalid arguments to " - "grpc_gcp_handshaker_req_set_target_name()."); - return false; - } - grpc_slice* slice = create_slice(target_name, strlen(target_name)); - req->client_start.target_name.arg = slice; - req->client_start.target_name.funcs.encode = encode_string_or_bytes_cb; - return true; -} - -bool grpc_gcp_handshaker_req_add_application_protocol( - grpc_gcp_handshaker_req* req, const char* application_protocol) { - if (req == nullptr || application_protocol == nullptr || req->has_next) { - gpr_log(GPR_ERROR, - "Invalid arguments to " - "grpc_gcp_handshaker_req_add_application_protocol()."); - return false; - } - grpc_slice* slice = - create_slice(application_protocol, strlen(application_protocol)); - if (req->has_client_start) { - add_repeated_field(reinterpret_cast( - &req->client_start.application_protocols.arg), - slice); - req->client_start.application_protocols.funcs.encode = - encode_repeated_string_cb; - } else { - add_repeated_field(reinterpret_cast( - &req->server_start.application_protocols.arg), - slice); - req->server_start.application_protocols.funcs.encode = - encode_repeated_string_cb; - } - return true; -} - -bool grpc_gcp_handshaker_req_add_record_protocol(grpc_gcp_handshaker_req* req, - const char* record_protocol) { - if (req == nullptr || record_protocol == nullptr || !req->has_client_start) { - gpr_log(GPR_ERROR, - "Invalid arguments to " - "grpc_gcp_handshaker_req_add_record_protocol()."); - return false; - } - grpc_slice* slice = create_slice(record_protocol, strlen(record_protocol)); - add_repeated_field(reinterpret_cast( - &req->client_start.record_protocols.arg), - slice); - req->client_start.record_protocols.funcs.encode = encode_repeated_string_cb; - return true; -} - -static void set_identity_hostname(grpc_gcp_identity* identity, - const char* hostname) { - grpc_slice* slice = create_slice(hostname, strlen(hostname)); - identity->hostname.arg = slice; - identity->hostname.funcs.encode = encode_string_or_bytes_cb; -} - -static void set_identity_service_account(grpc_gcp_identity* identity, - const char* service_account) { - grpc_slice* slice = create_slice(service_account, strlen(service_account)); - identity->service_account.arg = slice; - identity->service_account.funcs.encode = encode_string_or_bytes_cb; -} - -bool grpc_gcp_handshaker_req_add_target_identity_hostname( - grpc_gcp_handshaker_req* req, const char* hostname) { - if (req == nullptr || hostname == nullptr || !req->has_client_start) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to " - "grpc_gcp_handshaker_req_add_target_identity_hostname()."); - return false; - } - grpc_gcp_identity* target_identity = - static_cast(gpr_zalloc(sizeof(*target_identity))); - set_identity_hostname(target_identity, hostname); - req->client_start.target_identities.funcs.encode = - encode_repeated_identity_cb; - add_repeated_field(reinterpret_cast( - &req->client_start.target_identities.arg), - target_identity); - return true; -} - -bool grpc_gcp_handshaker_req_add_target_identity_service_account( - grpc_gcp_handshaker_req* req, const char* service_account) { - if (req == nullptr || service_account == nullptr || !req->has_client_start) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to " - "grpc_gcp_handshaker_req_add_target_identity_service_account()."); - return false; - } - grpc_gcp_identity* target_identity = - static_cast(gpr_zalloc(sizeof(*target_identity))); - set_identity_service_account(target_identity, service_account); - req->client_start.target_identities.funcs.encode = - encode_repeated_identity_cb; - add_repeated_field(reinterpret_cast( - &req->client_start.target_identities.arg), - target_identity); - return true; -} - -bool grpc_gcp_handshaker_req_set_local_identity_hostname( - grpc_gcp_handshaker_req* req, const char* hostname) { - if (req == nullptr || hostname == nullptr || !req->has_client_start) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to " - "grpc_gcp_handshaker_req_set_local_identity_hostname()."); - return false; - } - req->client_start.has_local_identity = true; - set_identity_hostname(&req->client_start.local_identity, hostname); - return true; -} - -bool grpc_gcp_handshaker_req_set_local_identity_service_account( - grpc_gcp_handshaker_req* req, const char* service_account) { - if (req == nullptr || service_account == nullptr || !req->has_client_start) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to " - "grpc_gcp_handshaker_req_set_local_identity_service_account()."); - return false; - } - req->client_start.has_local_identity = true; - set_identity_service_account(&req->client_start.local_identity, - service_account); - return true; -} - -static void set_endpoint(grpc_gcp_endpoint* endpoint, const char* ip_address, - size_t port, grpc_gcp_network_protocol protocol) { - grpc_slice* slice = create_slice(ip_address, strlen(ip_address)); - endpoint->ip_address.arg = slice; - endpoint->ip_address.funcs.encode = encode_string_or_bytes_cb; - endpoint->has_port = true; - endpoint->port = static_cast(port); - endpoint->has_protocol = true; - endpoint->protocol = protocol; -} - -bool grpc_gcp_handshaker_req_set_rpc_versions(grpc_gcp_handshaker_req* req, - uint32_t max_major, - uint32_t max_minor, - uint32_t min_major, - uint32_t min_minor) { - if (req == nullptr || req->has_next) { - gpr_log(GPR_ERROR, - "Invalid arguments to " - "grpc_gcp_handshaker_req_set_rpc_versions()."); - return false; - } - if (req->has_client_start) { - req->client_start.has_rpc_versions = true; - grpc_gcp_rpc_protocol_versions_set_max(&req->client_start.rpc_versions, - max_major, max_minor); - grpc_gcp_rpc_protocol_versions_set_min(&req->client_start.rpc_versions, - min_major, min_minor); - } else { - req->server_start.has_rpc_versions = true; - grpc_gcp_rpc_protocol_versions_set_max(&req->server_start.rpc_versions, - max_major, max_minor); - grpc_gcp_rpc_protocol_versions_set_min(&req->server_start.rpc_versions, - min_major, min_minor); - } - return true; -} - -bool grpc_gcp_handshaker_req_set_local_endpoint( - grpc_gcp_handshaker_req* req, const char* ip_address, size_t port, - grpc_gcp_network_protocol protocol) { - if (req == nullptr || ip_address == nullptr || port > 65535 || - req->has_next) { - gpr_log(GPR_ERROR, - "Invalid arguments to " - "grpc_gcp_handshaker_req_set_local_endpoint()."); - return false; - } - if (req->has_client_start) { - req->client_start.has_local_endpoint = true; - set_endpoint(&req->client_start.local_endpoint, ip_address, port, protocol); - } else { - req->server_start.has_local_endpoint = true; - set_endpoint(&req->server_start.local_endpoint, ip_address, port, protocol); - } - return true; -} - -bool grpc_gcp_handshaker_req_set_remote_endpoint( - grpc_gcp_handshaker_req* req, const char* ip_address, size_t port, - grpc_gcp_network_protocol protocol) { - if (req == nullptr || ip_address == nullptr || port > 65535 || - req->has_next) { - gpr_log(GPR_ERROR, - "Invalid arguments to " - "grpc_gcp_handshaker_req_set_remote_endpoint()."); - return false; - } - if (req->has_client_start) { - req->client_start.has_remote_endpoint = true; - set_endpoint(&req->client_start.remote_endpoint, ip_address, port, - protocol); - } else { - req->server_start.has_remote_endpoint = true; - set_endpoint(&req->server_start.remote_endpoint, ip_address, port, - protocol); - } - return true; -} - -bool grpc_gcp_handshaker_req_set_in_bytes(grpc_gcp_handshaker_req* req, - const char* in_bytes, size_t size) { - if (req == nullptr || in_bytes == nullptr || req->has_client_start) { - gpr_log(GPR_ERROR, - "Invalid arguments to " - "grpc_gcp_handshaker_req_set_in_bytes()."); - return false; - } - grpc_slice* slice = create_slice(in_bytes, size); - if (req->has_next) { - req->next.in_bytes.arg = slice; - req->next.in_bytes.funcs.encode = &encode_string_or_bytes_cb; - } else { - req->server_start.in_bytes.arg = slice; - req->server_start.in_bytes.funcs.encode = &encode_string_or_bytes_cb; - } - return true; -} - -static grpc_gcp_server_handshake_parameters* server_start_find_param( - grpc_gcp_handshaker_req* req, int32_t key) { - size_t i = 0; - for (i = 0; i < req->server_start.handshake_parameters_count; i++) { - if (req->server_start.handshake_parameters[i].key == key) { - return &req->server_start.handshake_parameters[i].value; - } - } - req->server_start - .handshake_parameters[req->server_start.handshake_parameters_count] - .has_key = true; - req->server_start - .handshake_parameters[req->server_start.handshake_parameters_count] - .has_value = true; - req->server_start - .handshake_parameters[req->server_start.handshake_parameters_count++] - .key = key; - return &req->server_start - .handshake_parameters - [req->server_start.handshake_parameters_count - 1] - .value; -} - -bool grpc_gcp_handshaker_req_param_add_record_protocol( - grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key, - const char* record_protocol) { - if (req == nullptr || record_protocol == nullptr || !req->has_server_start) { - gpr_log(GPR_ERROR, - "Invalid arguments to " - "grpc_gcp_handshaker_req_param_add_record_protocol()."); - return false; - } - grpc_gcp_server_handshake_parameters* param = - server_start_find_param(req, key); - grpc_slice* slice = create_slice(record_protocol, strlen(record_protocol)); - add_repeated_field( - reinterpret_cast(¶m->record_protocols.arg), slice); - param->record_protocols.funcs.encode = &encode_repeated_string_cb; - return true; -} - -bool grpc_gcp_handshaker_req_param_add_local_identity_hostname( - grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key, - const char* hostname) { - if (req == nullptr || hostname == nullptr || !req->has_server_start) { - gpr_log(GPR_ERROR, - "Invalid arguments to " - "grpc_gcp_handshaker_req_param_add_local_identity_hostname()."); - return false; - } - grpc_gcp_server_handshake_parameters* param = - server_start_find_param(req, key); - grpc_gcp_identity* local_identity = - static_cast(gpr_zalloc(sizeof(*local_identity))); - set_identity_hostname(local_identity, hostname); - add_repeated_field( - reinterpret_cast(¶m->local_identities.arg), - local_identity); - param->local_identities.funcs.encode = &encode_repeated_identity_cb; - return true; -} - -bool grpc_gcp_handshaker_req_param_add_local_identity_service_account( - grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key, - const char* service_account) { - if (req == nullptr || service_account == nullptr || !req->has_server_start) { - gpr_log( - GPR_ERROR, - "Invalid arguments to " - "grpc_gcp_handshaker_req_param_add_local_identity_service_account()."); - return false; - } - grpc_gcp_server_handshake_parameters* param = - server_start_find_param(req, key); - grpc_gcp_identity* local_identity = - static_cast(gpr_zalloc(sizeof(*local_identity))); - set_identity_service_account(local_identity, service_account); - add_repeated_field( - reinterpret_cast(¶m->local_identities.arg), - local_identity); - param->local_identities.funcs.encode = &encode_repeated_identity_cb; - return true; -} - -bool grpc_gcp_handshaker_req_encode(grpc_gcp_handshaker_req* req, - grpc_slice* slice) { - if (req == nullptr || slice == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to grpc_gcp_handshaker_req_encode()."); - return false; - } - pb_ostream_t size_stream; - memset(&size_stream, 0, sizeof(pb_ostream_t)); - if (!pb_encode(&size_stream, grpc_gcp_HandshakerReq_fields, req)) { - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&size_stream)); - return false; - } - size_t encoded_length = size_stream.bytes_written; - *slice = grpc_slice_malloc(encoded_length); - pb_ostream_t output_stream = - pb_ostream_from_buffer(GRPC_SLICE_START_PTR(*slice), encoded_length); - if (!pb_encode(&output_stream, grpc_gcp_HandshakerReq_fields, req) != 0) { - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&output_stream)); - return false; - } - return true; -} - -/* HandshakerResp. */ -grpc_gcp_handshaker_resp* grpc_gcp_handshaker_resp_create(void) { - grpc_gcp_handshaker_resp* resp = - static_cast(gpr_zalloc(sizeof(*resp))); - return resp; -} - -void grpc_gcp_handshaker_resp_destroy(grpc_gcp_handshaker_resp* resp) { - if (resp != nullptr) { - destroy_slice(static_cast(resp->out_frames.arg)); - if (resp->has_status) { - destroy_slice(static_cast(resp->status.details.arg)); - } - if (resp->has_result) { - destroy_slice( - static_cast(resp->result.application_protocol.arg)); - destroy_slice(static_cast(resp->result.record_protocol.arg)); - destroy_slice(static_cast(resp->result.key_data.arg)); - if (resp->result.has_local_identity) { - destroy_slice( - static_cast(resp->result.local_identity.hostname.arg)); - destroy_slice(static_cast( - resp->result.local_identity.service_account.arg)); - } - if (resp->result.has_peer_identity) { - destroy_slice( - static_cast(resp->result.peer_identity.hostname.arg)); - destroy_slice(static_cast( - resp->result.peer_identity.service_account.arg)); - } - } - gpr_free(resp); - } -} - -bool grpc_gcp_handshaker_resp_decode(grpc_slice encoded_handshaker_resp, - grpc_gcp_handshaker_resp* resp) { - if (resp == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr argument to grpc_gcp_handshaker_resp_decode()."); - return false; - } - pb_istream_t stream = - pb_istream_from_buffer(GRPC_SLICE_START_PTR(encoded_handshaker_resp), - GRPC_SLICE_LENGTH(encoded_handshaker_resp)); - resp->out_frames.funcs.decode = decode_string_or_bytes_cb; - resp->status.details.funcs.decode = decode_string_or_bytes_cb; - resp->result.application_protocol.funcs.decode = decode_string_or_bytes_cb; - resp->result.record_protocol.funcs.decode = decode_string_or_bytes_cb; - resp->result.key_data.funcs.decode = decode_string_or_bytes_cb; - resp->result.peer_identity.hostname.funcs.decode = decode_string_or_bytes_cb; - resp->result.peer_identity.service_account.funcs.decode = - decode_string_or_bytes_cb; - resp->result.local_identity.hostname.funcs.decode = decode_string_or_bytes_cb; - resp->result.local_identity.service_account.funcs.decode = - decode_string_or_bytes_cb; - if (!pb_decode(&stream, grpc_gcp_HandshakerResp_fields, resp)) { - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream)); - return false; - } - return true; -} diff --git a/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h b/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h deleted file mode 100644 index 5df56a86fae..00000000000 --- a/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h +++ /dev/null @@ -1,323 +0,0 @@ -/* - * - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_H -#define GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_H - -#include - -#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h" - -/** - * An implementation of nanopb thin wrapper used to set/get and - * serialize/de-serialize of ALTS handshake requests and responses. - * - * All APIs in the header are thread-compatible. A typical usage of this API at - * the client side is as follows: - * - * ----------------------------------------------------------------------------- - * // Create, populate, and serialize an ALTS client_start handshake request to - * // send to the server. - * grpc_gcp_handshaker_req* req = - * grpc_gcp_handshaker_req_create(CLIENT_START_REQ); - * grpc_gcp_handshaker_req_set_handshake_protocol( - req, grpc_gcp_HandshakeProtocol_ALTS); - * grpc_gcp_handshaker_req_add_application_protocol(req, "grpc"); - * grpc_gcp_handshaker_req_add_record_protocol(req, "ALTSRP_GCM_AES128"); - * grpc_slice client_slice; - * if (!grpc_gcp_handshaker_req_encode(req, &client_slice)) { - * fprintf(stderr, "ALTS handshake request encoding failed."; - * } - * - * // De-serialize a data stream received from the server, and store the result - * // at ALTS handshake response. - * grpc_gcp_handshaker_resp* resp = grpc_gcp_handshaker_resp_create(); - * if (!grpc_gcp_handshaker_resp_decode(server_slice, resp)) { - * fprintf(stderr, "ALTS handshake response decoding failed."); - * } - * // To access a variable-length datatype field (i.e., pb_callback_t), - * // access its "arg" subfield (if it has been set). - * if (resp->out_frames.arg != nullptr) { - * grpc_slice* slice = resp->out_frames.arg; - * } - * // To access a fixed-length datatype field (i.e., not pb_calback_t), - * // access the field directly (if it has been set). - * if (resp->has_status && resp->status->has_code) { - * uint32_t code = resp->status->code; - * } - *------------------------------------------------------------------------------ - */ - -/** - * This method creates an ALTS handshake request. - * - * - type: an enum type value that can be either CLIENT_START_REQ, - * SERVER_START_REQ, or NEXT_REQ to indicate the created instance will be - * client_start, server_start, and next handshake request message - * respectively. - * - * The method returns a pointer to the created instance. - */ -grpc_gcp_handshaker_req* grpc_gcp_handshaker_req_create( - grpc_gcp_handshaker_req_type type); - -/** - * This method sets the value for handshake_security_protocol field of ALTS - * client_start handshake request. - * - * - req: an ALTS handshake request. - * - handshake_protocol: a enum type value representing the handshake security - * protocol. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_set_handshake_protocol( - grpc_gcp_handshaker_req* req, - grpc_gcp_handshake_protocol handshake_protocol); - -/** - * This method sets the value for target_name field of ALTS client_start - * handshake request. - * - * - req: an ALTS handshake request. - * - target_name: a target name to be set. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_set_target_name(grpc_gcp_handshaker_req* req, - const char* target_name); - -/** - * This method adds an application protocol supported by the server (or - * client) to ALTS server_start (or client_start) handshake request. - * - * - req: an ALTS handshake request. - * - application_protocol: an application protocol (e.g., grpc) to be added. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_add_application_protocol( - grpc_gcp_handshaker_req* req, const char* application_protocol); - -/** - * This method adds a record protocol supported by the client to ALTS - * client_start handshake request. - * - * - req: an ALTS handshake request. - * - record_protocol: a record protocol (e.g., ALTSRP_GCM_AES128) to be - * added. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_add_record_protocol(grpc_gcp_handshaker_req* req, - const char* record_protocol); - -/** - * This method adds a target server identity represented as hostname and - * acceptable by a client to ALTS client_start handshake request. - * - * - req: an ALTS handshake request. - * - hostname: a string representation of hostname at the connection - * endpoint to be added. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_add_target_identity_hostname( - grpc_gcp_handshaker_req* req, const char* hostname); - -/** - * This method adds a target server identity represented as service account and - * acceptable by a client to ALTS client_start handshake request. - * - * - req: an ALTS handshake request. - * - service_account: a string representation of service account at the - * connection endpoint to be added. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_add_target_identity_service_account( - grpc_gcp_handshaker_req* req, const char* service_account); - -/** - * This method sets the hostname for local_identity field of ALTS client_start - * handshake request. - * - * - req: an ALTS handshake request. - * - hostname: a string representation of hostname. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_set_local_identity_hostname( - grpc_gcp_handshaker_req* req, const char* hostname); - -/** - * This method sets the service account for local_identity field of ALTS - * client_start handshake request. - * - * - req: an ALTS handshake request. - * - service_account: a string representation of service account. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_set_local_identity_service_account( - grpc_gcp_handshaker_req* req, const char* service_account); - -/** - * This method sets the value for local_endpoint field of either ALTS - * client_start or server_start handshake request. - * - * - req: an ALTS handshake request. - * - ip_address: a string representation of ip address associated with the - * local endpoint, that could be either IPv4 or IPv6. - * - port: a port number associated with the local endpoint. - * - protocol: a network protocol (e.g., TCP or UDP) associated with the - * local endpoint. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_set_local_endpoint( - grpc_gcp_handshaker_req* req, const char* ip_address, size_t port, - grpc_gcp_network_protocol protocol); - -/** - * This method sets the value for remote_endpoint field of either ALTS - * client_start or server_start handshake request. - * - * - req: an ALTS handshake request. - * - ip_address: a string representation of ip address associated with the - * remote endpoint, that could be either IPv4 or IPv6. - * - port: a port number associated with the remote endpoint. - * - protocol: a network protocol (e.g., TCP or UDP) associated with the - * remote endpoint. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_set_remote_endpoint( - grpc_gcp_handshaker_req* req, const char* ip_address, size_t port, - grpc_gcp_network_protocol protocol); - -/** - * This method sets the value for in_bytes field of either ALTS server_start or - * next handshake request. - * - * - req: an ALTS handshake request. - * - in_bytes: a buffer containing bytes taken from out_frames of the peer's - * ALTS handshake response. It is possible that the peer's out_frames are - * split into multiple handshake request messages. - * - size: size of in_bytes buffer. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_set_in_bytes(grpc_gcp_handshaker_req* req, - const char* in_bytes, size_t size); - -/** - * This method adds a record protocol to handshake parameters mapped by the - * handshake protocol for ALTS server_start handshake request. - * - * - req: an ALTS handshake request. - * - key: an enum type value representing a handshake security protocol. - * - record_protocol: a record protocol to be added. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_param_add_record_protocol( - grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key, - const char* record_protocol); - -/** - * This method adds a local identity represented as hostname to handshake - * parameters mapped by the handshake protocol for ALTS server_start handshake - * request. - * - * - req: an ALTS handshake request. - * - key: an enum type value representing a handshake security protocol. - * - hostname: a string representation of hostname to be added. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_param_add_local_identity_hostname( - grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key, - const char* hostname); - -/** - * This method adds a local identity represented as service account to handshake - * parameters mapped by the handshake protocol for ALTS server_start handshake - * request. - * - * - req: an ALTS handshake request. - * - key: an enum type value representing a handshake security protocol. - * - service_account: a string representation of service account to be added. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_param_add_local_identity_service_account( - grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key, - const char* service_account); - -/** - * This method sets the value for rpc_versions field of either ALTS - * client_start or server_start handshake request. - * - * - req: an ALTS handshake request. - * - max_major: a major version of maximum supported RPC version. - * - max_minor: a minor version of maximum supported RPC version. - * - min_major: a major version of minimum supported RPC version. - * - min_minor: a minor version of minimum supported RPC version. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_set_rpc_versions(grpc_gcp_handshaker_req* req, - uint32_t max_major, - uint32_t max_minor, - uint32_t min_major, - uint32_t min_minor); - -/** - * This method serializes an ALTS handshake request and returns a data stream. - * - * - req: an ALTS handshake request. - * - slice: a data stream where the serialized result will be written. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_req_encode(grpc_gcp_handshaker_req* req, - grpc_slice* slice); - -/* This method destroys an ALTS handshake request. */ -void grpc_gcp_handshaker_req_destroy(grpc_gcp_handshaker_req* req); - -/* This method creates an ALTS handshake response. */ -grpc_gcp_handshaker_resp* grpc_gcp_handshaker_resp_create(void); - -/** - * This method de-serializes a data stream and stores the result - * in an ALTS handshake response. - * - * - slice: a data stream containing a serialized ALTS handshake response. - * - resp: an ALTS handshake response used to hold de-serialized result. - * - * The method returns true on success and false otherwise. - */ -bool grpc_gcp_handshaker_resp_decode(grpc_slice slice, - grpc_gcp_handshaker_resp* resp); - -/* This method destroys an ALTS handshake response. */ -void grpc_gcp_handshaker_resp_destroy(grpc_gcp_handshaker_resp* resp); - -#endif /* GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_H */ diff --git a/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc b/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc deleted file mode 100644 index d63d3538c56..00000000000 --- a/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc +++ /dev/null @@ -1,145 +0,0 @@ -/* - * - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h" - -#include "src/core/lib/slice/slice_internal.h" - -void add_repeated_field(repeated_field** head, const void* data) { - repeated_field* field = - static_cast(gpr_zalloc(sizeof(*field))); - field->data = data; - if (*head == nullptr) { - *head = field; - (*head)->next = nullptr; - } else { - field->next = *head; - *head = field; - } -} - -void destroy_repeated_field_list_identity(repeated_field* head) { - repeated_field* field = head; - while (field != nullptr) { - repeated_field* next_field = field->next; - const grpc_gcp_identity* identity = - static_cast(field->data); - destroy_slice(static_cast(identity->hostname.arg)); - destroy_slice(static_cast(identity->service_account.arg)); - gpr_free((void*)identity); - gpr_free(field); - field = next_field; - } -} - -void destroy_repeated_field_list_string(repeated_field* head) { - repeated_field* field = head; - while (field != nullptr) { - repeated_field* next_field = field->next; - destroy_slice((grpc_slice*)field->data); - gpr_free(field); - field = next_field; - } -} - -grpc_slice* create_slice(const char* data, size_t size) { - grpc_slice slice = grpc_slice_from_copied_buffer(data, size); - grpc_slice* cb_slice = - static_cast(gpr_zalloc(sizeof(*cb_slice))); - memcpy(cb_slice, &slice, sizeof(*cb_slice)); - return cb_slice; -} - -void destroy_slice(grpc_slice* slice) { - if (slice != nullptr) { - grpc_slice_unref_internal(*slice); - gpr_free(slice); - } -} - -bool encode_string_or_bytes_cb(pb_ostream_t* stream, const pb_field_t* field, - void* const* arg) { - grpc_slice* slice = static_cast(*arg); - if (!pb_encode_tag_for_field(stream, field)) return false; - return pb_encode_string(stream, GRPC_SLICE_START_PTR(*slice), - GRPC_SLICE_LENGTH(*slice)); -} - -bool encode_repeated_identity_cb(pb_ostream_t* stream, const pb_field_t* field, - void* const* arg) { - repeated_field* var = static_cast(*arg); - while (var != nullptr) { - if (!pb_encode_tag_for_field(stream, field)) return false; - if (!pb_encode_submessage(stream, grpc_gcp_Identity_fields, - (grpc_gcp_identity*)var->data)) - return false; - var = var->next; - } - return true; -} - -bool encode_repeated_string_cb(pb_ostream_t* stream, const pb_field_t* field, - void* const* arg) { - repeated_field* var = static_cast(*arg); - while (var != nullptr) { - if (!pb_encode_tag_for_field(stream, field)) return false; - const grpc_slice* slice = static_cast(var->data); - if (!pb_encode_string(stream, GRPC_SLICE_START_PTR(*slice), - GRPC_SLICE_LENGTH(*slice))) - return false; - var = var->next; - } - return true; -} - -bool decode_string_or_bytes_cb(pb_istream_t* stream, const pb_field_t* field, - void** arg) { - grpc_slice slice = grpc_slice_malloc(stream->bytes_left); - grpc_slice* cb_slice = - static_cast(gpr_zalloc(sizeof(*cb_slice))); - memcpy(cb_slice, &slice, sizeof(*cb_slice)); - if (!pb_read(stream, GRPC_SLICE_START_PTR(*cb_slice), stream->bytes_left)) - return false; - *arg = cb_slice; - return true; -} - -bool decode_repeated_identity_cb(pb_istream_t* stream, const pb_field_t* field, - void** arg) { - grpc_gcp_identity* identity = - static_cast(gpr_zalloc(sizeof(*identity))); - identity->hostname.funcs.decode = decode_string_or_bytes_cb; - identity->service_account.funcs.decode = decode_string_or_bytes_cb; - add_repeated_field(reinterpret_cast(arg), identity); - if (!pb_decode(stream, grpc_gcp_Identity_fields, identity)) return false; - return true; -} - -bool decode_repeated_string_cb(pb_istream_t* stream, const pb_field_t* field, - void** arg) { - grpc_slice slice = grpc_slice_malloc(stream->bytes_left); - grpc_slice* cb_slice = - static_cast(gpr_zalloc(sizeof(*cb_slice))); - memcpy(cb_slice, &slice, sizeof(grpc_slice)); - if (!pb_read(stream, GRPC_SLICE_START_PTR(*cb_slice), stream->bytes_left)) - return false; - add_repeated_field(reinterpret_cast(arg), cb_slice); - return true; -} diff --git a/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h b/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h deleted file mode 100644 index 966ea45617e..00000000000 --- a/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_UTIL_H -#define GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_UTIL_H - -#include - -#include "pb_decode.h" -#include "pb_encode.h" - -#include -#include -#include -#include - -#include "src/core/tsi/alts/handshaker/handshaker.pb.h" - -/** - * An implementation of utility functions used to serialize/ - * de-serialize ALTS handshake requests/responses. All APIs in the header - * are thread-compatible. - */ - -/* Renaming of message/field structs generated by nanopb compiler. */ -typedef grpc_gcp_HandshakeProtocol grpc_gcp_handshake_protocol; -typedef grpc_gcp_NetworkProtocol grpc_gcp_network_protocol; -typedef grpc_gcp_Identity grpc_gcp_identity; -typedef grpc_gcp_NextHandshakeMessageReq grpc_gcp_next_handshake_message_req; -typedef grpc_gcp_ServerHandshakeParameters grpc_gcp_server_handshake_parameters; -typedef grpc_gcp_Endpoint grpc_gcp_endpoint; -typedef grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry - grpc_gcp_handshake_parameters_entry; -typedef grpc_gcp_StartClientHandshakeReq grpc_gcp_start_client_handshake_req; -typedef grpc_gcp_StartServerHandshakeReq grpc_gcp_start_server_handshake_req; -typedef grpc_gcp_HandshakerReq grpc_gcp_handshaker_req; -typedef grpc_gcp_HandshakerResult grpc_gcp_handshaker_result; -typedef grpc_gcp_HandshakerStatus grpc_gcp_handshaker_status; -typedef grpc_gcp_HandshakerResp grpc_gcp_handshaker_resp; - -typedef enum { - CLIENT_START_REQ = 0, /* StartClientHandshakeReq. */ - SERVER_START_REQ = 1, /* StartServerHandshakeReq. */ - NEXT_REQ = 2, /* NextHandshakeMessageReq. */ -} grpc_gcp_handshaker_req_type; - -/** - * A struct representing a repeated field. The struct is used to organize all - * instances of a specific repeated field into a linked list, which then will - * be used at encode/decode phase. For instance at the encode phase, the encode - * function will iterate through the list, encode each field, and then output - * the result to the stream. - */ -typedef struct repeated_field_ { - struct repeated_field_* next; - const void* data; -} repeated_field; - -/** - * This method adds a repeated field to the head of repeated field list. - * - * - head: a head of repeated field list. - * - field: a repeated field to be added to the list. - */ -void add_repeated_field(repeated_field** head, const void* field); - -/** - * This method destroys a repeated field list that consists of string type - * fields. - * - * - head: a head of repeated field list. - */ -void destroy_repeated_field_list_string(repeated_field* head); - -/** - * This method destroys a repeated field list that consists of - * grpc_gcp_identity type fields. - * - * - head: a head of repeated field list. - */ -void destroy_repeated_field_list_identity(repeated_field* head); - -/** - * This method creates a grpc_slice instance by copying a data buffer. It is - * similar to grpc_slice_from_copied_buffer() except that it returns an instance - * allocated from the heap. - * - * - data: a data buffer to be copied to grpc_slice instance. - * - size: size of data buffer. - */ -grpc_slice* create_slice(const char* data, size_t size); - -/* This method destroys a grpc_slice instance. */ -void destroy_slice(grpc_slice* slice); - -/** - * The following encode/decode functions will be assigned to encode/decode - * function pointers of pb_callback_t struct (defined in - * //third_party/nanopb/pb.h), that represent a repeated field with a dynamic - * length (e.g., a string type or repeated field). - */ - -/* This method is an encode callback function for a string or byte array. */ -bool encode_string_or_bytes_cb(pb_ostream_t* stream, const pb_field_t* field, - void* const* arg); - -/** - * This method is an encode callback function for a repeated grpc_gcp_identity - * field. - */ -bool encode_repeated_identity_cb(pb_ostream_t* stream, const pb_field_t* field, - void* const* arg); - -/* This method is an encode callback function for a repeated string field. */ -bool encode_repeated_string_cb(pb_ostream_t* stream, const pb_field_t* field, - void* const* arg); - -/** - * This method is a decode callback function for a string or byte array field. - */ -bool decode_string_or_bytes_cb(pb_istream_t* stream, const pb_field_t* field, - void** arg); -/** - * This method is a decode callback function for a repeated grpc_gcp_identity - * field. - */ -bool decode_repeated_identity_cb(pb_istream_t* stream, const pb_field_t* field, - void** arg); - -/* This method is a decode callback function for a repeated string field. */ -bool decode_repeated_string_cb(pb_istream_t* stream, const pb_field_t* field, - void** arg); - -#endif /* GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_UTIL_H */ diff --git a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc index 0d28303e7dd..917d375fd82 100644 --- a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +++ b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc @@ -192,38 +192,49 @@ static const tsi_handshaker_result_vtable result_vtable = { handshaker_result_create_frame_protector, handshaker_result_get_unused_bytes, handshaker_result_destroy}; -tsi_result alts_tsi_handshaker_result_create(grpc_gcp_handshaker_resp* resp, +tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp* resp, bool is_client, tsi_handshaker_result** self) { if (self == nullptr || resp == nullptr) { gpr_log(GPR_ERROR, "Invalid arguments to create_handshaker_result()"); return TSI_INVALID_ARGUMENT; } - grpc_slice* key = static_cast(resp->result.key_data.arg); - GPR_ASSERT(key != nullptr); - grpc_slice* identity = - static_cast(resp->result.peer_identity.service_account.arg); + const grpc_gcp_HandshakerResult* hresult = + grpc_gcp_HandshakerResp_result(resp); + const grpc_gcp_Identity* identity = + grpc_gcp_HandshakerResult_peer_identity(hresult); if (identity == nullptr) { + gpr_log(GPR_ERROR, "Invalid identity"); + return TSI_FAILED_PRECONDITION; + } + upb_strview service_account = grpc_gcp_Identity_service_account(identity); + if (service_account.size == 0) { gpr_log(GPR_ERROR, "Invalid service account"); return TSI_FAILED_PRECONDITION; } - if (GRPC_SLICE_LENGTH(*key) < kAltsAes128GcmRekeyKeyLength) { + upb_strview key_data = grpc_gcp_HandshakerResult_key_data(hresult); + if (key_data.size < kAltsAes128GcmRekeyKeyLength) { gpr_log(GPR_ERROR, "Bad key length"); return TSI_FAILED_PRECONDITION; } + const grpc_gcp_RpcProtocolVersions* peer_rpc_version = + grpc_gcp_HandshakerResult_peer_rpc_versions(hresult); + if (peer_rpc_version == nullptr) { + gpr_log(GPR_ERROR, "Peer does not set RPC protocol versions."); + return TSI_FAILED_PRECONDITION; + } alts_tsi_handshaker_result* result = static_cast(gpr_zalloc(sizeof(*result))); result->key_data = static_cast(gpr_zalloc(kAltsAes128GcmRekeyKeyLength)); - memcpy(result->key_data, GRPC_SLICE_START_PTR(*key), - kAltsAes128GcmRekeyKeyLength); - result->peer_identity = grpc_slice_to_c_string(*identity); - if (!resp->result.has_peer_rpc_versions) { - gpr_log(GPR_ERROR, "Peer does not set RPC protocol versions."); - return TSI_FAILED_PRECONDITION; - } - if (!grpc_gcp_rpc_protocol_versions_encode(&resp->result.peer_rpc_versions, - &result->rpc_versions)) { + memcpy(result->key_data, key_data.data, kAltsAes128GcmRekeyKeyLength); + result->peer_identity = + static_cast(gpr_zalloc(service_account.size + 1)); + memcpy(result->peer_identity, service_account.data, service_account.size); + upb::Arena arena; + bool serialized = grpc_gcp_rpc_protocol_versions_encode( + peer_rpc_version, arena.ptr(), &result->rpc_versions); + if (!serialized) { gpr_log(GPR_ERROR, "Failed to serialize peer's RPC protocol versions."); return TSI_FAILED_PRECONDITION; } diff --git a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h index 32f94bc9d3f..6be45d7b447 100644 --- a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +++ b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h @@ -26,9 +26,9 @@ #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h" #include "src/core/tsi/alts/handshaker/alts_handshaker_client.h" -#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h" #include "src/core/tsi/transport_security.h" #include "src/core/tsi/transport_security_interface.h" +#include "src/proto/grpc/gcp/handshaker.upb.h" #define TSI_ALTS_SERVICE_ACCOUNT_PEER_PROPERTY "service_accont" #define TSI_ALTS_CERTIFICATE_TYPE "ALTS" @@ -70,7 +70,7 @@ tsi_result alts_tsi_handshaker_create( * client or not. * - result: address of ALTS TSI handshaker result instance. */ -tsi_result alts_tsi_handshaker_result_create(grpc_gcp_handshaker_resp* resp, +tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp* resp, bool is_client, tsi_handshaker_result** result); diff --git a/src/core/tsi/alts/handshaker/alts_tsi_utils.cc b/src/core/tsi/alts/handshaker/alts_tsi_utils.cc index 1747f1ad04f..f80498db990 100644 --- a/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +++ b/src/core/tsi/alts/handshaker/alts_tsi_utils.cc @@ -41,18 +41,22 @@ tsi_result alts_tsi_utils_convert_to_tsi_result(grpc_status_code code) { } } -grpc_gcp_handshaker_resp* alts_tsi_utils_deserialize_response( - grpc_byte_buffer* resp_buffer) { +grpc_gcp_HandshakerResp* alts_tsi_utils_deserialize_response( + grpc_byte_buffer* resp_buffer, upb_arena* arena) { GPR_ASSERT(resp_buffer != nullptr); + GPR_ASSERT(arena != nullptr); grpc_byte_buffer_reader bbr; grpc_byte_buffer_reader_init(&bbr, resp_buffer); grpc_slice slice = grpc_byte_buffer_reader_readall(&bbr); - grpc_gcp_handshaker_resp* resp = grpc_gcp_handshaker_resp_create(); - bool ok = grpc_gcp_handshaker_resp_decode(slice, resp); + size_t buf_size = GPR_SLICE_LENGTH(slice); + void* buf = upb_arena_malloc(arena, buf_size); + memcpy(buf, reinterpret_cast(GPR_SLICE_START_PTR(slice)), + buf_size); + grpc_gcp_HandshakerResp* resp = grpc_gcp_HandshakerResp_parse( + reinterpret_cast(buf), buf_size, arena); grpc_slice_unref_internal(slice); grpc_byte_buffer_reader_destroy(&bbr); - if (!ok) { - grpc_gcp_handshaker_resp_destroy(resp); + if (resp == nullptr) { gpr_log(GPR_ERROR, "grpc_gcp_handshaker_resp_decode() failed"); return nullptr; } diff --git a/src/core/tsi/alts/handshaker/alts_tsi_utils.h b/src/core/tsi/alts/handshaker/alts_tsi_utils.h index 9ef649de2b9..a20e5e9cd99 100644 --- a/src/core/tsi/alts/handshaker/alts_tsi_utils.h +++ b/src/core/tsi/alts/handshaker/alts_tsi_utils.h @@ -24,8 +24,8 @@ #include #include -#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api.h" #include "src/core/tsi/transport_security_interface.h" +#include "src/proto/grpc/gcp/handshaker.upb.h" /** * This method converts grpc_status_code code to the corresponding tsi_result @@ -42,11 +42,12 @@ tsi_result alts_tsi_utils_convert_to_tsi_result(grpc_status_code code); * service. * * - bytes_received: data returned from ALTS handshaker service. + * - arena: upb arena. * * It returns a deserialized handshaker response on success and nullptr on * failure. */ -grpc_gcp_handshaker_resp* alts_tsi_utils_deserialize_response( - grpc_byte_buffer* resp_buffer); +grpc_gcp_HandshakerResp* alts_tsi_utils_deserialize_response( + grpc_byte_buffer* resp_buffer, upb_arena* arena); #endif /* GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_TSI_UTILS_H */ diff --git a/src/core/tsi/alts/handshaker/altscontext.pb.c b/src/core/tsi/alts/handshaker/altscontext.pb.c deleted file mode 100644 index 5fb152a558e..00000000000 --- a/src/core/tsi/alts/handshaker/altscontext.pb.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.3.7-dev */ - -#include "src/core/tsi/alts/handshaker/altscontext.pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - - - -const pb_field_t grpc_gcp_AltsContext_fields[7] = { - PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, grpc_gcp_AltsContext, application_protocol, application_protocol, 0), - PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, grpc_gcp_AltsContext, record_protocol, application_protocol, 0), - PB_FIELD( 3, UENUM , OPTIONAL, STATIC , OTHER, grpc_gcp_AltsContext, security_level, record_protocol, 0), - PB_FIELD( 4, STRING , OPTIONAL, CALLBACK, OTHER, grpc_gcp_AltsContext, peer_service_account, security_level, 0), - PB_FIELD( 5, STRING , OPTIONAL, CALLBACK, OTHER, grpc_gcp_AltsContext, local_service_account, peer_service_account, 0), - PB_FIELD( 6, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_AltsContext, peer_rpc_versions, local_service_account, &grpc_gcp_RpcProtocolVersions_fields), - PB_LAST_FIELD -}; - - -/* Check that field information fits in pb_field_t */ -#if !defined(PB_FIELD_32BIT) -/* If you get an error here, it means that you need to define PB_FIELD_32BIT - * compile-time option. You can do that in pb.h or on compiler command line. - * - * The reason you need to do this is that some of your messages contain tag - * numbers or field sizes that are larger than what can fit in 8 or 16 bit - * field descriptors. - */ -PB_STATIC_ASSERT((pb_membersize(grpc_gcp_AltsContext, peer_rpc_versions) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_gcp_AltsContext) -#endif - -#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT) -/* If you get an error here, it means that you need to define PB_FIELD_16BIT - * compile-time option. You can do that in pb.h or on compiler command line. - * - * The reason you need to do this is that some of your messages contain tag - * numbers or field sizes that are larger than what can fit in the default - * 8 bit descriptors. - */ -PB_STATIC_ASSERT((pb_membersize(grpc_gcp_AltsContext, peer_rpc_versions) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_gcp_AltsContext) -#endif - - -/* @@protoc_insertion_point(eof) */ diff --git a/src/core/tsi/alts/handshaker/altscontext.pb.h b/src/core/tsi/alts/handshaker/altscontext.pb.h deleted file mode 100644 index 632b20c0e2a..00000000000 --- a/src/core/tsi/alts/handshaker/altscontext.pb.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Automatically generated nanopb header */ -/* Generated by nanopb-0.3.7-dev */ - -#ifndef PB_GRPC_GCP_ALTSCONTEXT_PB_H_INCLUDED -#define PB_GRPC_GCP_ALTSCONTEXT_PB_H_INCLUDED -#include "pb.h" -#include "src/core/tsi/alts/handshaker/transport_security_common.pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Struct definitions */ -typedef struct _grpc_gcp_AltsContext { - pb_callback_t application_protocol; - pb_callback_t record_protocol; - bool has_security_level; - grpc_gcp_SecurityLevel security_level; - pb_callback_t peer_service_account; - pb_callback_t local_service_account; - bool has_peer_rpc_versions; - grpc_gcp_RpcProtocolVersions peer_rpc_versions; -/* @@protoc_insertion_point(struct:grpc_gcp_AltsContext) */ -} grpc_gcp_AltsContext; - -/* Default values for struct fields */ - -/* Initializer values for message structs */ -#define grpc_gcp_AltsContext_init_default {{{NULL}, NULL}, {{NULL}, NULL}, false, (grpc_gcp_SecurityLevel)0, {{NULL}, NULL}, {{NULL}, NULL}, false, grpc_gcp_RpcProtocolVersions_init_default} -#define grpc_gcp_AltsContext_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, false, (grpc_gcp_SecurityLevel)0, {{NULL}, NULL}, {{NULL}, NULL}, false, grpc_gcp_RpcProtocolVersions_init_zero} - -/* Field tags (for use in manual encoding/decoding) */ -#define grpc_gcp_AltsContext_application_protocol_tag 1 -#define grpc_gcp_AltsContext_record_protocol_tag 2 -#define grpc_gcp_AltsContext_security_level_tag 3 -#define grpc_gcp_AltsContext_peer_service_account_tag 4 -#define grpc_gcp_AltsContext_local_service_account_tag 5 -#define grpc_gcp_AltsContext_peer_rpc_versions_tag 6 - -/* Struct field encoding specification for nanopb */ -extern const pb_field_t grpc_gcp_AltsContext_fields[7]; - -/* Maximum encoded size of messages (where known) */ -/* grpc_gcp_AltsContext_size depends on runtime parameters */ - -/* Message IDs (where set with "msgid" option) */ -#ifdef PB_MSGID - -#define ALTSCONTEXT_MESSAGES \ - - -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif -/* @@protoc_insertion_point(eof) */ - -#endif diff --git a/src/core/tsi/alts/handshaker/handshaker.pb.c b/src/core/tsi/alts/handshaker/handshaker.pb.c deleted file mode 100644 index 5450b1602d4..00000000000 --- a/src/core/tsi/alts/handshaker/handshaker.pb.c +++ /dev/null @@ -1,122 +0,0 @@ -/* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.3.7-dev */ - -#include "src/core/tsi/alts/handshaker/handshaker.pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - - - -const pb_field_t grpc_gcp_Endpoint_fields[4] = { - PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, grpc_gcp_Endpoint, ip_address, ip_address, 0), - PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, grpc_gcp_Endpoint, port, ip_address, 0), - PB_FIELD( 3, UENUM , OPTIONAL, STATIC , OTHER, grpc_gcp_Endpoint, protocol, port, 0), - PB_LAST_FIELD -}; - -const pb_field_t grpc_gcp_Identity_fields[3] = { - PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, grpc_gcp_Identity, service_account, service_account, 0), - PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, grpc_gcp_Identity, hostname, service_account, 0), - PB_LAST_FIELD -}; - -const pb_field_t grpc_gcp_StartClientHandshakeReq_fields[10] = { - PB_FIELD( 1, UENUM , OPTIONAL, STATIC , FIRST, grpc_gcp_StartClientHandshakeReq, handshake_security_protocol, handshake_security_protocol, 0), - PB_FIELD( 2, STRING , REPEATED, CALLBACK, OTHER, grpc_gcp_StartClientHandshakeReq, application_protocols, handshake_security_protocol, 0), - PB_FIELD( 3, STRING , REPEATED, CALLBACK, OTHER, grpc_gcp_StartClientHandshakeReq, record_protocols, application_protocols, 0), - PB_FIELD( 4, MESSAGE , REPEATED, CALLBACK, OTHER, grpc_gcp_StartClientHandshakeReq, target_identities, record_protocols, &grpc_gcp_Identity_fields), - PB_FIELD( 5, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_StartClientHandshakeReq, local_identity, target_identities, &grpc_gcp_Identity_fields), - PB_FIELD( 6, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_StartClientHandshakeReq, local_endpoint, local_identity, &grpc_gcp_Endpoint_fields), - PB_FIELD( 7, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_StartClientHandshakeReq, remote_endpoint, local_endpoint, &grpc_gcp_Endpoint_fields), - PB_FIELD( 8, STRING , OPTIONAL, CALLBACK, OTHER, grpc_gcp_StartClientHandshakeReq, target_name, remote_endpoint, 0), - PB_FIELD( 9, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_StartClientHandshakeReq, rpc_versions, target_name, &grpc_gcp_RpcProtocolVersions_fields), - PB_LAST_FIELD -}; - -const pb_field_t grpc_gcp_ServerHandshakeParameters_fields[3] = { - PB_FIELD( 1, STRING , REPEATED, CALLBACK, FIRST, grpc_gcp_ServerHandshakeParameters, record_protocols, record_protocols, 0), - PB_FIELD( 2, MESSAGE , REPEATED, CALLBACK, OTHER, grpc_gcp_ServerHandshakeParameters, local_identities, record_protocols, &grpc_gcp_Identity_fields), - PB_LAST_FIELD -}; - -const pb_field_t grpc_gcp_StartServerHandshakeReq_fields[7] = { - PB_FIELD( 1, STRING , REPEATED, CALLBACK, FIRST, grpc_gcp_StartServerHandshakeReq, application_protocols, application_protocols, 0), - PB_FIELD( 2, MESSAGE , REPEATED, STATIC , OTHER, grpc_gcp_StartServerHandshakeReq, handshake_parameters, application_protocols, &grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_fields), - PB_FIELD( 3, BYTES , OPTIONAL, CALLBACK, OTHER, grpc_gcp_StartServerHandshakeReq, in_bytes, handshake_parameters, 0), - PB_FIELD( 4, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_StartServerHandshakeReq, local_endpoint, in_bytes, &grpc_gcp_Endpoint_fields), - PB_FIELD( 5, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_StartServerHandshakeReq, remote_endpoint, local_endpoint, &grpc_gcp_Endpoint_fields), - PB_FIELD( 6, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_StartServerHandshakeReq, rpc_versions, remote_endpoint, &grpc_gcp_RpcProtocolVersions_fields), - PB_LAST_FIELD -}; - -const pb_field_t grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_fields[3] = { - PB_FIELD( 1, INT32 , OPTIONAL, STATIC , FIRST, grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry, key, key, 0), - PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry, value, key, &grpc_gcp_ServerHandshakeParameters_fields), - PB_LAST_FIELD -}; - -const pb_field_t grpc_gcp_NextHandshakeMessageReq_fields[2] = { - PB_FIELD( 1, BYTES , OPTIONAL, CALLBACK, FIRST, grpc_gcp_NextHandshakeMessageReq, in_bytes, in_bytes, 0), - PB_LAST_FIELD -}; - -const pb_field_t grpc_gcp_HandshakerReq_fields[4] = { - PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_gcp_HandshakerReq, client_start, client_start, &grpc_gcp_StartClientHandshakeReq_fields), - PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_HandshakerReq, server_start, client_start, &grpc_gcp_StartServerHandshakeReq_fields), - PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_HandshakerReq, next, server_start, &grpc_gcp_NextHandshakeMessageReq_fields), - PB_LAST_FIELD -}; - -const pb_field_t grpc_gcp_HandshakerResult_fields[8] = { - PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, grpc_gcp_HandshakerResult, application_protocol, application_protocol, 0), - PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, grpc_gcp_HandshakerResult, record_protocol, application_protocol, 0), - PB_FIELD( 3, BYTES , OPTIONAL, CALLBACK, OTHER, grpc_gcp_HandshakerResult, key_data, record_protocol, 0), - PB_FIELD( 4, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_HandshakerResult, peer_identity, key_data, &grpc_gcp_Identity_fields), - PB_FIELD( 5, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_HandshakerResult, local_identity, peer_identity, &grpc_gcp_Identity_fields), - PB_FIELD( 6, BOOL , OPTIONAL, STATIC , OTHER, grpc_gcp_HandshakerResult, keep_channel_open, local_identity, 0), - PB_FIELD( 7, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_HandshakerResult, peer_rpc_versions, keep_channel_open, &grpc_gcp_RpcProtocolVersions_fields), - PB_LAST_FIELD -}; - -const pb_field_t grpc_gcp_HandshakerStatus_fields[3] = { - PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, grpc_gcp_HandshakerStatus, code, code, 0), - PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, grpc_gcp_HandshakerStatus, details, code, 0), - PB_LAST_FIELD -}; - -const pb_field_t grpc_gcp_HandshakerResp_fields[5] = { - PB_FIELD( 1, BYTES , OPTIONAL, CALLBACK, FIRST, grpc_gcp_HandshakerResp, out_frames, out_frames, 0), - PB_FIELD( 2, UINT32 , OPTIONAL, STATIC , OTHER, grpc_gcp_HandshakerResp, bytes_consumed, out_frames, 0), - PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_HandshakerResp, result, bytes_consumed, &grpc_gcp_HandshakerResult_fields), - PB_FIELD( 4, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_HandshakerResp, status, result, &grpc_gcp_HandshakerStatus_fields), - PB_LAST_FIELD -}; - - -/* Check that field information fits in pb_field_t */ -#if !defined(PB_FIELD_32BIT) -/* If you get an error here, it means that you need to define PB_FIELD_32BIT - * compile-time option. You can do that in pb.h or on compiler command line. - * - * The reason you need to do this is that some of your messages contain tag - * numbers or field sizes that are larger than what can fit in 8 or 16 bit - * field descriptors. - */ -PB_STATIC_ASSERT((pb_membersize(grpc_gcp_StartClientHandshakeReq, target_identities) < 65536 && pb_membersize(grpc_gcp_StartClientHandshakeReq, local_identity) < 65536 && pb_membersize(grpc_gcp_StartClientHandshakeReq, local_endpoint) < 65536 && pb_membersize(grpc_gcp_StartClientHandshakeReq, remote_endpoint) < 65536 && pb_membersize(grpc_gcp_StartClientHandshakeReq, rpc_versions) < 65536 && pb_membersize(grpc_gcp_ServerHandshakeParameters, local_identities) < 65536 && pb_membersize(grpc_gcp_StartServerHandshakeReq, handshake_parameters[0]) < 65536 && pb_membersize(grpc_gcp_StartServerHandshakeReq, local_endpoint) < 65536 && pb_membersize(grpc_gcp_StartServerHandshakeReq, remote_endpoint) < 65536 && pb_membersize(grpc_gcp_StartServerHandshakeReq, rpc_versions) < 65536 && pb_membersize(grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry, value) < 65536 && pb_membersize(grpc_gcp_HandshakerReq, client_start) < 65536 && pb_membersize(grpc_gcp_HandshakerReq, server_start) < 65536 && pb_membersize(grpc_gcp_HandshakerReq, next) < 65536 && pb_membersize(grpc_gcp_HandshakerResult, peer_identity) < 65536 && pb_membersize(grpc_gcp_HandshakerResult, local_identity) < 65536 && pb_membersize(grpc_gcp_HandshakerResult, peer_rpc_versions) < 65536 && pb_membersize(grpc_gcp_HandshakerResp, result) < 65536 && pb_membersize(grpc_gcp_HandshakerResp, status) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_gcp_Endpoint_grpc_gcp_Identity_grpc_gcp_StartClientHandshakeReq_grpc_gcp_ServerHandshakeParameters_grpc_gcp_StartServerHandshakeReq_grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_grpc_gcp_NextHandshakeMessageReq_grpc_gcp_HandshakerReq_grpc_gcp_HandshakerResult_grpc_gcp_HandshakerStatus_grpc_gcp_HandshakerResp) -#endif - -#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT) -/* If you get an error here, it means that you need to define PB_FIELD_16BIT - * compile-time option. You can do that in pb.h or on compiler command line. - * - * The reason you need to do this is that some of your messages contain tag - * numbers or field sizes that are larger than what can fit in the default - * 8 bit descriptors. - */ -PB_STATIC_ASSERT((pb_membersize(grpc_gcp_StartClientHandshakeReq, target_identities) < 256 && pb_membersize(grpc_gcp_StartClientHandshakeReq, local_identity) < 256 && pb_membersize(grpc_gcp_StartClientHandshakeReq, local_endpoint) < 256 && pb_membersize(grpc_gcp_StartClientHandshakeReq, remote_endpoint) < 256 && pb_membersize(grpc_gcp_StartClientHandshakeReq, rpc_versions) < 256 && pb_membersize(grpc_gcp_ServerHandshakeParameters, local_identities) < 256 && pb_membersize(grpc_gcp_StartServerHandshakeReq, handshake_parameters[0]) < 256 && pb_membersize(grpc_gcp_StartServerHandshakeReq, local_endpoint) < 256 && pb_membersize(grpc_gcp_StartServerHandshakeReq, remote_endpoint) < 256 && pb_membersize(grpc_gcp_StartServerHandshakeReq, rpc_versions) < 256 && pb_membersize(grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry, value) < 256 && pb_membersize(grpc_gcp_HandshakerReq, client_start) < 256 && pb_membersize(grpc_gcp_HandshakerReq, server_start) < 256 && pb_membersize(grpc_gcp_HandshakerReq, next) < 256 && pb_membersize(grpc_gcp_HandshakerResult, peer_identity) < 256 && pb_membersize(grpc_gcp_HandshakerResult, local_identity) < 256 && pb_membersize(grpc_gcp_HandshakerResult, peer_rpc_versions) < 256 && pb_membersize(grpc_gcp_HandshakerResp, result) < 256 && pb_membersize(grpc_gcp_HandshakerResp, status) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_gcp_Endpoint_grpc_gcp_Identity_grpc_gcp_StartClientHandshakeReq_grpc_gcp_ServerHandshakeParameters_grpc_gcp_StartServerHandshakeReq_grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_grpc_gcp_NextHandshakeMessageReq_grpc_gcp_HandshakerReq_grpc_gcp_HandshakerResult_grpc_gcp_HandshakerStatus_grpc_gcp_HandshakerResp) -#endif - - -/* @@protoc_insertion_point(eof) */ diff --git a/src/core/tsi/alts/handshaker/handshaker.pb.h b/src/core/tsi/alts/handshaker/handshaker.pb.h deleted file mode 100644 index 5ee42a3c69f..00000000000 --- a/src/core/tsi/alts/handshaker/handshaker.pb.h +++ /dev/null @@ -1,254 +0,0 @@ -/* Automatically generated nanopb header */ -/* Generated by nanopb-0.3.7-dev */ - -#ifndef PB_GRPC_GCP_HANDSHAKER_PB_H_INCLUDED -#define PB_GRPC_GCP_HANDSHAKER_PB_H_INCLUDED -#include "pb.h" -#include "src/core/tsi/alts/handshaker/transport_security_common.pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Enum definitions */ -typedef enum _grpc_gcp_HandshakeProtocol { - grpc_gcp_HandshakeProtocol_HANDSHAKE_PROTOCOL_UNSPECIFIED = 0, - grpc_gcp_HandshakeProtocol_TLS = 1, - grpc_gcp_HandshakeProtocol_ALTS = 2 -} grpc_gcp_HandshakeProtocol; -#define _grpc_gcp_HandshakeProtocol_MIN grpc_gcp_HandshakeProtocol_HANDSHAKE_PROTOCOL_UNSPECIFIED -#define _grpc_gcp_HandshakeProtocol_MAX grpc_gcp_HandshakeProtocol_ALTS -#define _grpc_gcp_HandshakeProtocol_ARRAYSIZE ((grpc_gcp_HandshakeProtocol)(grpc_gcp_HandshakeProtocol_ALTS+1)) - -typedef enum _grpc_gcp_NetworkProtocol { - grpc_gcp_NetworkProtocol_NETWORK_PROTOCOL_UNSPECIFIED = 0, - grpc_gcp_NetworkProtocol_TCP = 1, - grpc_gcp_NetworkProtocol_UDP = 2 -} grpc_gcp_NetworkProtocol; -#define _grpc_gcp_NetworkProtocol_MIN grpc_gcp_NetworkProtocol_NETWORK_PROTOCOL_UNSPECIFIED -#define _grpc_gcp_NetworkProtocol_MAX grpc_gcp_NetworkProtocol_UDP -#define _grpc_gcp_NetworkProtocol_ARRAYSIZE ((grpc_gcp_NetworkProtocol)(grpc_gcp_NetworkProtocol_UDP+1)) - -/* Struct definitions */ -typedef struct _grpc_gcp_Identity { - pb_callback_t service_account; - pb_callback_t hostname; -/* @@protoc_insertion_point(struct:grpc_gcp_Identity) */ -} grpc_gcp_Identity; - -typedef struct _grpc_gcp_NextHandshakeMessageReq { - pb_callback_t in_bytes; -/* @@protoc_insertion_point(struct:grpc_gcp_NextHandshakeMessageReq) */ -} grpc_gcp_NextHandshakeMessageReq; - -typedef struct _grpc_gcp_ServerHandshakeParameters { - pb_callback_t record_protocols; - pb_callback_t local_identities; -/* @@protoc_insertion_point(struct:grpc_gcp_ServerHandshakeParameters) */ -} grpc_gcp_ServerHandshakeParameters; - -typedef struct _grpc_gcp_Endpoint { - pb_callback_t ip_address; - bool has_port; - int32_t port; - bool has_protocol; - grpc_gcp_NetworkProtocol protocol; -/* @@protoc_insertion_point(struct:grpc_gcp_Endpoint) */ -} grpc_gcp_Endpoint; - -typedef struct _grpc_gcp_HandshakerResult { - pb_callback_t application_protocol; - pb_callback_t record_protocol; - pb_callback_t key_data; - bool has_peer_identity; - grpc_gcp_Identity peer_identity; - bool has_local_identity; - grpc_gcp_Identity local_identity; - bool has_keep_channel_open; - bool keep_channel_open; - bool has_peer_rpc_versions; - grpc_gcp_RpcProtocolVersions peer_rpc_versions; -/* @@protoc_insertion_point(struct:grpc_gcp_HandshakerResult) */ -} grpc_gcp_HandshakerResult; - -typedef struct _grpc_gcp_HandshakerStatus { - bool has_code; - uint32_t code; - pb_callback_t details; -/* @@protoc_insertion_point(struct:grpc_gcp_HandshakerStatus) */ -} grpc_gcp_HandshakerStatus; - -typedef struct _grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry { - bool has_key; - int32_t key; - bool has_value; - grpc_gcp_ServerHandshakeParameters value; -/* @@protoc_insertion_point(struct:grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry) */ -} grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry; - -typedef struct _grpc_gcp_HandshakerResp { - pb_callback_t out_frames; - bool has_bytes_consumed; - uint32_t bytes_consumed; - bool has_result; - grpc_gcp_HandshakerResult result; - bool has_status; - grpc_gcp_HandshakerStatus status; -/* @@protoc_insertion_point(struct:grpc_gcp_HandshakerResp) */ -} grpc_gcp_HandshakerResp; - -typedef struct _grpc_gcp_StartClientHandshakeReq { - bool has_handshake_security_protocol; - grpc_gcp_HandshakeProtocol handshake_security_protocol; - pb_callback_t application_protocols; - pb_callback_t record_protocols; - pb_callback_t target_identities; - bool has_local_identity; - grpc_gcp_Identity local_identity; - bool has_local_endpoint; - grpc_gcp_Endpoint local_endpoint; - bool has_remote_endpoint; - grpc_gcp_Endpoint remote_endpoint; - pb_callback_t target_name; - bool has_rpc_versions; - grpc_gcp_RpcProtocolVersions rpc_versions; -/* @@protoc_insertion_point(struct:grpc_gcp_StartClientHandshakeReq) */ -} grpc_gcp_StartClientHandshakeReq; - -typedef struct _grpc_gcp_StartServerHandshakeReq { - pb_callback_t application_protocols; - pb_size_t handshake_parameters_count; - grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry handshake_parameters[3]; - pb_callback_t in_bytes; - bool has_local_endpoint; - grpc_gcp_Endpoint local_endpoint; - bool has_remote_endpoint; - grpc_gcp_Endpoint remote_endpoint; - bool has_rpc_versions; - grpc_gcp_RpcProtocolVersions rpc_versions; -/* @@protoc_insertion_point(struct:grpc_gcp_StartServerHandshakeReq) */ -} grpc_gcp_StartServerHandshakeReq; - -typedef struct _grpc_gcp_HandshakerReq { - bool has_client_start; - grpc_gcp_StartClientHandshakeReq client_start; - bool has_server_start; - grpc_gcp_StartServerHandshakeReq server_start; - bool has_next; - grpc_gcp_NextHandshakeMessageReq next; -/* @@protoc_insertion_point(struct:grpc_gcp_HandshakerReq) */ -} grpc_gcp_HandshakerReq; - -/* Default values for struct fields */ - -/* Initializer values for message structs */ -#define grpc_gcp_Endpoint_init_default {{{NULL}, NULL}, false, 0, false, (grpc_gcp_NetworkProtocol)0} -#define grpc_gcp_Identity_init_default {{{NULL}, NULL}, {{NULL}, NULL}} -#define grpc_gcp_StartClientHandshakeReq_init_default {false, (grpc_gcp_HandshakeProtocol)0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, false, grpc_gcp_Identity_init_default, false, grpc_gcp_Endpoint_init_default, false, grpc_gcp_Endpoint_init_default, {{NULL}, NULL}, false, grpc_gcp_RpcProtocolVersions_init_default} -#define grpc_gcp_ServerHandshakeParameters_init_default {{{NULL}, NULL}, {{NULL}, NULL}} -#define grpc_gcp_StartServerHandshakeReq_init_default {{{NULL}, NULL}, 0, {grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_default, grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_default, grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_default}, {{NULL}, NULL}, false, grpc_gcp_Endpoint_init_default, false, grpc_gcp_Endpoint_init_default, false, grpc_gcp_RpcProtocolVersions_init_default} -#define grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_default {false, 0, false, grpc_gcp_ServerHandshakeParameters_init_default} -#define grpc_gcp_NextHandshakeMessageReq_init_default {{{NULL}, NULL}} -#define grpc_gcp_HandshakerReq_init_default {false, grpc_gcp_StartClientHandshakeReq_init_default, false, grpc_gcp_StartServerHandshakeReq_init_default, false, grpc_gcp_NextHandshakeMessageReq_init_default} -#define grpc_gcp_HandshakerResult_init_default {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, false, grpc_gcp_Identity_init_default, false, grpc_gcp_Identity_init_default, false, 0, false, grpc_gcp_RpcProtocolVersions_init_default} -#define grpc_gcp_HandshakerStatus_init_default {false, 0, {{NULL}, NULL}} -#define grpc_gcp_HandshakerResp_init_default {{{NULL}, NULL}, false, 0, false, grpc_gcp_HandshakerResult_init_default, false, grpc_gcp_HandshakerStatus_init_default} -#define grpc_gcp_Endpoint_init_zero {{{NULL}, NULL}, false, 0, false, (grpc_gcp_NetworkProtocol)0} -#define grpc_gcp_Identity_init_zero {{{NULL}, NULL}, {{NULL}, NULL}} -#define grpc_gcp_StartClientHandshakeReq_init_zero {false, (grpc_gcp_HandshakeProtocol)0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, false, grpc_gcp_Identity_init_zero, false, grpc_gcp_Endpoint_init_zero, false, grpc_gcp_Endpoint_init_zero, {{NULL}, NULL}, false, grpc_gcp_RpcProtocolVersions_init_zero} -#define grpc_gcp_ServerHandshakeParameters_init_zero {{{NULL}, NULL}, {{NULL}, NULL}} -#define grpc_gcp_StartServerHandshakeReq_init_zero {{{NULL}, NULL}, 0, {grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_zero, grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_zero, grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_zero}, {{NULL}, NULL}, false, grpc_gcp_Endpoint_init_zero, false, grpc_gcp_Endpoint_init_zero, false, grpc_gcp_RpcProtocolVersions_init_zero} -#define grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_zero {false, 0, false, grpc_gcp_ServerHandshakeParameters_init_zero} -#define grpc_gcp_NextHandshakeMessageReq_init_zero {{{NULL}, NULL}} -#define grpc_gcp_HandshakerReq_init_zero {false, grpc_gcp_StartClientHandshakeReq_init_zero, false, grpc_gcp_StartServerHandshakeReq_init_zero, false, grpc_gcp_NextHandshakeMessageReq_init_zero} -#define grpc_gcp_HandshakerResult_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, false, grpc_gcp_Identity_init_zero, false, grpc_gcp_Identity_init_zero, false, 0, false, grpc_gcp_RpcProtocolVersions_init_zero} -#define grpc_gcp_HandshakerStatus_init_zero {false, 0, {{NULL}, NULL}} -#define grpc_gcp_HandshakerResp_init_zero {{{NULL}, NULL}, false, 0, false, grpc_gcp_HandshakerResult_init_zero, false, grpc_gcp_HandshakerStatus_init_zero} - -/* Field tags (for use in manual encoding/decoding) */ -#define grpc_gcp_Identity_service_account_tag 1 -#define grpc_gcp_Identity_hostname_tag 2 -#define grpc_gcp_NextHandshakeMessageReq_in_bytes_tag 1 -#define grpc_gcp_ServerHandshakeParameters_record_protocols_tag 1 -#define grpc_gcp_ServerHandshakeParameters_local_identities_tag 2 -#define grpc_gcp_Endpoint_ip_address_tag 1 -#define grpc_gcp_Endpoint_port_tag 2 -#define grpc_gcp_Endpoint_protocol_tag 3 -#define grpc_gcp_HandshakerResult_application_protocol_tag 1 -#define grpc_gcp_HandshakerResult_record_protocol_tag 2 -#define grpc_gcp_HandshakerResult_key_data_tag 3 -#define grpc_gcp_HandshakerResult_peer_identity_tag 4 -#define grpc_gcp_HandshakerResult_local_identity_tag 5 -#define grpc_gcp_HandshakerResult_keep_channel_open_tag 6 -#define grpc_gcp_HandshakerResult_peer_rpc_versions_tag 7 -#define grpc_gcp_HandshakerStatus_code_tag 1 -#define grpc_gcp_HandshakerStatus_details_tag 2 -#define grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_key_tag 1 -#define grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_value_tag 2 -#define grpc_gcp_HandshakerResp_out_frames_tag 1 -#define grpc_gcp_HandshakerResp_bytes_consumed_tag 2 -#define grpc_gcp_HandshakerResp_result_tag 3 -#define grpc_gcp_HandshakerResp_status_tag 4 -#define grpc_gcp_StartClientHandshakeReq_handshake_security_protocol_tag 1 -#define grpc_gcp_StartClientHandshakeReq_application_protocols_tag 2 -#define grpc_gcp_StartClientHandshakeReq_record_protocols_tag 3 -#define grpc_gcp_StartClientHandshakeReq_target_identities_tag 4 -#define grpc_gcp_StartClientHandshakeReq_local_identity_tag 5 -#define grpc_gcp_StartClientHandshakeReq_local_endpoint_tag 6 -#define grpc_gcp_StartClientHandshakeReq_remote_endpoint_tag 7 -#define grpc_gcp_StartClientHandshakeReq_target_name_tag 8 -#define grpc_gcp_StartClientHandshakeReq_rpc_versions_tag 9 -#define grpc_gcp_StartServerHandshakeReq_application_protocols_tag 1 -#define grpc_gcp_StartServerHandshakeReq_handshake_parameters_tag 2 -#define grpc_gcp_StartServerHandshakeReq_in_bytes_tag 3 -#define grpc_gcp_StartServerHandshakeReq_local_endpoint_tag 4 -#define grpc_gcp_StartServerHandshakeReq_remote_endpoint_tag 5 -#define grpc_gcp_StartServerHandshakeReq_rpc_versions_tag 6 -#define grpc_gcp_HandshakerReq_client_start_tag 1 -#define grpc_gcp_HandshakerReq_server_start_tag 2 -#define grpc_gcp_HandshakerReq_next_tag 3 - -/* Struct field encoding specification for nanopb */ -extern const pb_field_t grpc_gcp_Endpoint_fields[4]; -extern const pb_field_t grpc_gcp_Identity_fields[3]; -extern const pb_field_t grpc_gcp_StartClientHandshakeReq_fields[10]; -extern const pb_field_t grpc_gcp_ServerHandshakeParameters_fields[3]; -extern const pb_field_t grpc_gcp_StartServerHandshakeReq_fields[7]; -extern const pb_field_t grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_fields[3]; -extern const pb_field_t grpc_gcp_NextHandshakeMessageReq_fields[2]; -extern const pb_field_t grpc_gcp_HandshakerReq_fields[4]; -extern const pb_field_t grpc_gcp_HandshakerResult_fields[8]; -extern const pb_field_t grpc_gcp_HandshakerStatus_fields[3]; -extern const pb_field_t grpc_gcp_HandshakerResp_fields[5]; - -/* Maximum encoded size of messages (where known) */ -/* grpc_gcp_Endpoint_size depends on runtime parameters */ -/* grpc_gcp_Identity_size depends on runtime parameters */ -/* grpc_gcp_StartClientHandshakeReq_size depends on runtime parameters */ -/* grpc_gcp_ServerHandshakeParameters_size depends on runtime parameters */ -/* grpc_gcp_StartServerHandshakeReq_size depends on runtime parameters */ -#define grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_size (17 + grpc_gcp_ServerHandshakeParameters_size) -/* grpc_gcp_NextHandshakeMessageReq_size depends on runtime parameters */ -#define grpc_gcp_HandshakerReq_size (18 + grpc_gcp_StartClientHandshakeReq_size + grpc_gcp_StartServerHandshakeReq_size + grpc_gcp_NextHandshakeMessageReq_size) -/* grpc_gcp_HandshakerResult_size depends on runtime parameters */ -/* grpc_gcp_HandshakerStatus_size depends on runtime parameters */ -/* grpc_gcp_HandshakerResp_size depends on runtime parameters */ - -/* Message IDs (where set with "msgid" option) */ -#ifdef PB_MSGID - -#define HANDSHAKER_MESSAGES \ - - -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif -/* @@protoc_insertion_point(eof) */ - -#endif diff --git a/src/core/tsi/alts/handshaker/transport_security_common.pb.c b/src/core/tsi/alts/handshaker/transport_security_common.pb.c deleted file mode 100644 index 326b1b10ab7..00000000000 --- a/src/core/tsi/alts/handshaker/transport_security_common.pb.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.3.7-dev */ - -#include "src/core/tsi/alts/handshaker/transport_security_common.pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - - - -const pb_field_t grpc_gcp_RpcProtocolVersions_fields[3] = { - PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_gcp_RpcProtocolVersions, max_rpc_version, max_rpc_version, &grpc_gcp_RpcProtocolVersions_Version_fields), - PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_RpcProtocolVersions, min_rpc_version, max_rpc_version, &grpc_gcp_RpcProtocolVersions_Version_fields), - PB_LAST_FIELD -}; - -const pb_field_t grpc_gcp_RpcProtocolVersions_Version_fields[3] = { - PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, grpc_gcp_RpcProtocolVersions_Version, major, major, 0), - PB_FIELD( 2, UINT32 , OPTIONAL, STATIC , OTHER, grpc_gcp_RpcProtocolVersions_Version, minor, major, 0), - PB_LAST_FIELD -}; - - -/* Check that field information fits in pb_field_t */ -#if !defined(PB_FIELD_32BIT) -/* If you get an error here, it means that you need to define PB_FIELD_32BIT - * compile-time option. You can do that in pb.h or on compiler command line. - * - * The reason you need to do this is that some of your messages contain tag - * numbers or field sizes that are larger than what can fit in 8 or 16 bit - * field descriptors. - */ -PB_STATIC_ASSERT((pb_membersize(grpc_gcp_RpcProtocolVersions, max_rpc_version) < 65536 && pb_membersize(grpc_gcp_RpcProtocolVersions, min_rpc_version) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_gcp_RpcProtocolVersions_grpc_gcp_RpcProtocolVersions_Version) -#endif - -#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT) -/* If you get an error here, it means that you need to define PB_FIELD_16BIT - * compile-time option. You can do that in pb.h or on compiler command line. - * - * The reason you need to do this is that some of your messages contain tag - * numbers or field sizes that are larger than what can fit in the default - * 8 bit descriptors. - */ -PB_STATIC_ASSERT((pb_membersize(grpc_gcp_RpcProtocolVersions, max_rpc_version) < 256 && pb_membersize(grpc_gcp_RpcProtocolVersions, min_rpc_version) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_gcp_RpcProtocolVersions_grpc_gcp_RpcProtocolVersions_Version) -#endif - - -/* @@protoc_insertion_point(eof) */ diff --git a/src/core/tsi/alts/handshaker/transport_security_common.pb.h b/src/core/tsi/alts/handshaker/transport_security_common.pb.h deleted file mode 100644 index 87d9abf149f..00000000000 --- a/src/core/tsi/alts/handshaker/transport_security_common.pb.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Automatically generated nanopb header */ -/* Generated by nanopb-0.3.7-dev */ - -#ifndef PB_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PB_H_INCLUDED -#define PB_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PB_H_INCLUDED -#include "pb.h" -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Enum definitions */ -typedef enum _grpc_gcp_SecurityLevel { - grpc_gcp_SecurityLevel_SECURITY_NONE = 0, - grpc_gcp_SecurityLevel_INTEGRITY_ONLY = 1, - grpc_gcp_SecurityLevel_INTEGRITY_AND_PRIVACY = 2 -} grpc_gcp_SecurityLevel; -#define _grpc_gcp_SecurityLevel_MIN grpc_gcp_SecurityLevel_SECURITY_NONE -#define _grpc_gcp_SecurityLevel_MAX grpc_gcp_SecurityLevel_INTEGRITY_AND_PRIVACY -#define _grpc_gcp_SecurityLevel_ARRAYSIZE ((grpc_gcp_SecurityLevel)(grpc_gcp_SecurityLevel_INTEGRITY_AND_PRIVACY+1)) - -/* Struct definitions */ -typedef struct _grpc_gcp_RpcProtocolVersions_Version { - bool has_major; - uint32_t major; - bool has_minor; - uint32_t minor; -/* @@protoc_insertion_point(struct:grpc_gcp_RpcProtocolVersions_Version) */ -} grpc_gcp_RpcProtocolVersions_Version; - -typedef struct _grpc_gcp_RpcProtocolVersions { - bool has_max_rpc_version; - grpc_gcp_RpcProtocolVersions_Version max_rpc_version; - bool has_min_rpc_version; - grpc_gcp_RpcProtocolVersions_Version min_rpc_version; -/* @@protoc_insertion_point(struct:grpc_gcp_RpcProtocolVersions) */ -} grpc_gcp_RpcProtocolVersions; - -/* Default values for struct fields */ - -/* Initializer values for message structs */ -#define grpc_gcp_RpcProtocolVersions_init_default {false, grpc_gcp_RpcProtocolVersions_Version_init_default, false, grpc_gcp_RpcProtocolVersions_Version_init_default} -#define grpc_gcp_RpcProtocolVersions_Version_init_default {false, 0, false, 0} -#define grpc_gcp_RpcProtocolVersions_init_zero {false, grpc_gcp_RpcProtocolVersions_Version_init_zero, false, grpc_gcp_RpcProtocolVersions_Version_init_zero} -#define grpc_gcp_RpcProtocolVersions_Version_init_zero {false, 0, false, 0} - -/* Field tags (for use in manual encoding/decoding) */ -#define grpc_gcp_RpcProtocolVersions_Version_major_tag 1 -#define grpc_gcp_RpcProtocolVersions_Version_minor_tag 2 -#define grpc_gcp_RpcProtocolVersions_max_rpc_version_tag 1 -#define grpc_gcp_RpcProtocolVersions_min_rpc_version_tag 2 - -/* Struct field encoding specification for nanopb */ -extern const pb_field_t grpc_gcp_RpcProtocolVersions_fields[3]; -extern const pb_field_t grpc_gcp_RpcProtocolVersions_Version_fields[3]; - -/* Maximum encoded size of messages (where known) */ -#define grpc_gcp_RpcProtocolVersions_size 28 -#define grpc_gcp_RpcProtocolVersions_Version_size 12 - -/* Message IDs (where set with "msgid" option) */ -#ifdef PB_MSGID - -#define TRANSPORT_SECURITY_COMMON_MESSAGES \ - - -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif -/* @@protoc_insertion_point(eof) */ - -#endif diff --git a/src/core/tsi/alts/handshaker/transport_security_common_api.cc b/src/core/tsi/alts/handshaker/transport_security_common_api.cc index 6c518c1ff31..c7b9fafd935 100644 --- a/src/core/tsi/alts/handshaker/transport_security_common_api.cc +++ b/src/core/tsi/alts/handshaker/transport_security_common_api.cc @@ -29,9 +29,6 @@ bool grpc_gcp_rpc_protocol_versions_set_max( "grpc_gcp_rpc_protocol_versions_set_max()."); return false; } - versions->has_max_rpc_version = true; - versions->max_rpc_version.has_major = true; - versions->max_rpc_version.has_minor = true; versions->max_rpc_version.major = max_major; versions->max_rpc_version.minor = max_minor; return true; @@ -46,63 +43,45 @@ bool grpc_gcp_rpc_protocol_versions_set_min( "grpc_gcp_rpc_protocol_versions_set_min()."); return false; } - versions->has_min_rpc_version = true; - versions->min_rpc_version.has_major = true; - versions->min_rpc_version.has_minor = true; versions->min_rpc_version.major = min_major; versions->min_rpc_version.minor = min_minor; return true; } -size_t grpc_gcp_rpc_protocol_versions_encode_length( - const grpc_gcp_rpc_protocol_versions* versions) { - if (versions == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to " - "grpc_gcp_rpc_protocol_versions_encode_length()."); - return 0; - } - pb_ostream_t size_stream; - memset(&size_stream, 0, sizeof(pb_ostream_t)); - if (!pb_encode(&size_stream, grpc_gcp_RpcProtocolVersions_fields, versions)) { - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&size_stream)); - return 0; - } - return size_stream.bytes_written; -} - -bool grpc_gcp_rpc_protocol_versions_encode_to_raw_bytes( - const grpc_gcp_rpc_protocol_versions* versions, uint8_t* bytes, - size_t bytes_length) { - if (versions == nullptr || bytes == nullptr || bytes_length == 0) { +bool grpc_gcp_rpc_protocol_versions_encode( + const grpc_gcp_rpc_protocol_versions* versions, grpc_slice* slice) { + if (versions == nullptr || slice == nullptr) { gpr_log(GPR_ERROR, "Invalid nullptr arguments to " - "grpc_gcp_rpc_protocol_versions_encode_to_raw_bytes()."); - return false; - } - pb_ostream_t output_stream = pb_ostream_from_buffer(bytes, bytes_length); - if (!pb_encode(&output_stream, grpc_gcp_RpcProtocolVersions_fields, - versions)) { - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&output_stream)); + "grpc_gcp_rpc_protocol_versions_encode()."); return false; } - return true; + upb::Arena arena; + grpc_gcp_RpcProtocolVersions* versions_msg = + grpc_gcp_RpcProtocolVersions_new(arena.ptr()); + grpc_gcp_RpcProtocolVersions_assign_from_struct(versions_msg, arena.ptr(), + versions); + return grpc_gcp_rpc_protocol_versions_encode(versions_msg, arena.ptr(), + slice); } bool grpc_gcp_rpc_protocol_versions_encode( - const grpc_gcp_rpc_protocol_versions* versions, grpc_slice* slice) { - if (versions == nullptr || slice == nullptr) { + const grpc_gcp_RpcProtocolVersions* versions, upb_arena* arena, + grpc_slice* slice) { + if (versions == nullptr || arena == nullptr || slice == nullptr) { gpr_log(GPR_ERROR, "Invalid nullptr arguments to " "grpc_gcp_rpc_protocol_versions_encode()."); return false; } - size_t encoded_length = - grpc_gcp_rpc_protocol_versions_encode_length(versions); - if (encoded_length == 0) return false; - *slice = grpc_slice_malloc(encoded_length); - return grpc_gcp_rpc_protocol_versions_encode_to_raw_bytes( - versions, GRPC_SLICE_START_PTR(*slice), encoded_length); + size_t buf_length; + char* buf = + grpc_gcp_RpcProtocolVersions_serialize(versions, arena, &buf_length); + if (buf == nullptr) { + return false; + } + *slice = grpc_slice_from_copied_buffer(buf, buf_length); + return true; } bool grpc_gcp_rpc_protocol_versions_decode( @@ -113,16 +92,63 @@ bool grpc_gcp_rpc_protocol_versions_decode( "grpc_gcp_rpc_protocol_versions_decode()."); return false; } - pb_istream_t stream = - pb_istream_from_buffer(const_cast(GRPC_SLICE_START_PTR(slice)), - GRPC_SLICE_LENGTH(slice)); - if (!pb_decode(&stream, grpc_gcp_RpcProtocolVersions_fields, versions)) { - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream)); + upb::Arena arena; + grpc_gcp_RpcProtocolVersions* versions_msg = + grpc_gcp_RpcProtocolVersions_parse( + reinterpret_cast(GRPC_SLICE_START_PTR(slice)), + GRPC_SLICE_LENGTH(slice), arena.ptr()); + if (versions_msg == nullptr) { + gpr_log(GPR_ERROR, "cannot deserialize RpcProtocolVersions message"); return false; } + grpc_gcp_rpc_protocol_versions_assign_from_upb(versions, versions_msg); return true; } +void grpc_gcp_rpc_protocol_versions_assign_from_upb( + grpc_gcp_rpc_protocol_versions* versions, + const grpc_gcp_RpcProtocolVersions* value) { + const grpc_gcp_RpcProtocolVersions_Version* max_version_msg = + grpc_gcp_RpcProtocolVersions_max_rpc_version(value); + if (max_version_msg != nullptr) { + versions->max_rpc_version.major = + grpc_gcp_RpcProtocolVersions_Version_major(max_version_msg); + versions->max_rpc_version.minor = + grpc_gcp_RpcProtocolVersions_Version_minor(max_version_msg); + } else { + versions->max_rpc_version.major = 0; + versions->max_rpc_version.minor = 0; + } + const grpc_gcp_RpcProtocolVersions_Version* min_version_msg = + grpc_gcp_RpcProtocolVersions_min_rpc_version(value); + if (min_version_msg != nullptr) { + versions->min_rpc_version.major = + grpc_gcp_RpcProtocolVersions_Version_major(min_version_msg); + versions->min_rpc_version.minor = + grpc_gcp_RpcProtocolVersions_Version_minor(min_version_msg); + } else { + versions->min_rpc_version.major = 0; + versions->min_rpc_version.minor = 0; + } +} + +void grpc_gcp_RpcProtocolVersions_assign_from_struct( + grpc_gcp_RpcProtocolVersions* versions, upb_arena* arena, + const grpc_gcp_rpc_protocol_versions* value) { + grpc_gcp_RpcProtocolVersions_Version* max_version_msg = + grpc_gcp_RpcProtocolVersions_mutable_max_rpc_version(versions, arena); + grpc_gcp_RpcProtocolVersions_Version_set_major(max_version_msg, + value->max_rpc_version.major); + grpc_gcp_RpcProtocolVersions_Version_set_minor(max_version_msg, + value->max_rpc_version.minor); + grpc_gcp_RpcProtocolVersions_Version* min_version_msg = + grpc_gcp_RpcProtocolVersions_mutable_min_rpc_version(versions, arena); + grpc_gcp_RpcProtocolVersions_Version_set_major(min_version_msg, + value->min_rpc_version.major); + grpc_gcp_RpcProtocolVersions_Version_set_minor(min_version_msg, + value->min_rpc_version.minor); +} + bool grpc_gcp_rpc_protocol_versions_copy( const grpc_gcp_rpc_protocol_versions* src, grpc_gcp_rpc_protocol_versions* dst) { diff --git a/src/core/tsi/alts/handshaker/transport_security_common_api.h b/src/core/tsi/alts/handshaker/transport_security_common_api.h index 27942c8ae4c..75739e4fe76 100644 --- a/src/core/tsi/alts/handshaker/transport_security_common_api.h +++ b/src/core/tsi/alts/handshaker/transport_security_common_api.h @@ -21,20 +21,24 @@ #include -#include "pb_decode.h" -#include "pb_encode.h" - #include #include #include #include -#include "src/core/tsi/alts/handshaker/transport_security_common.pb.h" +#include "src/proto/grpc/gcp/transport_security_common.upb.h" -typedef grpc_gcp_RpcProtocolVersions grpc_gcp_rpc_protocol_versions; +// C struct coresponding to protobuf message RpcProtocolVersions.Version +typedef struct _grpc_gcp_RpcProtocolVersions_Version { + uint32_t major; + uint32_t minor; +} grpc_gcp_rpc_protocol_versions_version; -typedef grpc_gcp_RpcProtocolVersions_Version - grpc_gcp_rpc_protocol_versions_version; +// C struct coresponding to protobuf message RpcProtocolVersions +typedef struct _grpc_gcp_RpcProtocolVersions { + grpc_gcp_rpc_protocol_versions_version max_rpc_version; + grpc_gcp_rpc_protocol_versions_version min_rpc_version; +} grpc_gcp_rpc_protocol_versions; /** * This method sets the value for max_rpc_versions field of rpc protocol @@ -65,41 +69,30 @@ bool grpc_gcp_rpc_protocol_versions_set_min( uint32_t min_minor); /** - * This method computes serialized byte length of rpc protocol versions. - * - * - versions: an rpc protocol versions instance. - * - * The method returns serialized byte length. It returns 0 on failure. - */ -size_t grpc_gcp_rpc_protocol_versions_encode_length( - const grpc_gcp_rpc_protocol_versions* versions); - -/** - * This method serializes rpc protocol versions and writes the result to - * the memory buffer provided by the caller. Caller is responsible for - * allocating sufficient memory to store the serialized data. + * This method serializes an rpc protocol version and returns serialized rpc + * versions in grpc slice. * * - versions: an rpc protocol versions instance. - * - bytes: bytes buffer where the result will be written to. - * - bytes_length: length of the bytes buffer. + * - slice: grpc slice where the serialized result will be written. * * The method returns true on success and false otherwise. */ -bool grpc_gcp_rpc_protocol_versions_encode_to_raw_bytes( - const grpc_gcp_rpc_protocol_versions* versions, uint8_t* bytes, - size_t bytes_length); +bool grpc_gcp_rpc_protocol_versions_encode( + const grpc_gcp_rpc_protocol_versions* versions, grpc_slice* slice); /** * This method serializes an rpc protocol version and returns serialized rpc * versions in grpc slice. * * - versions: an rpc protocol versions instance. + * - arena: upb arena. * - slice: grpc slice where the serialized result will be written. * * The method returns true on success and false otherwise. */ bool grpc_gcp_rpc_protocol_versions_encode( - const grpc_gcp_rpc_protocol_versions* versions, grpc_slice* slice); + const grpc_gcp_RpcProtocolVersions* versions, upb_arena* arena, + grpc_slice* slice); /** * This method de-serializes input in grpc slice form and stores the result @@ -114,6 +107,21 @@ bool grpc_gcp_rpc_protocol_versions_encode( bool grpc_gcp_rpc_protocol_versions_decode( const grpc_slice& slice, grpc_gcp_rpc_protocol_versions* versions); +/** + * Assigns value of upb RpcProtocolVersions to grpc_gcp_rpc_protocol_versions. + */ +void grpc_gcp_rpc_protocol_versions_assign_from_upb( + grpc_gcp_rpc_protocol_versions* versions, + const grpc_gcp_RpcProtocolVersions* value); + +/** + * Assigns value of struct grpc_gcp_rpc_protocol_versions to + * RpcProtocolVersions. + */ +void grpc_gcp_RpcProtocolVersions_assign_from_struct( + grpc_gcp_RpcProtocolVersions* versions, upb_arena* arena, + const grpc_gcp_rpc_protocol_versions* value); + /** * This method performs a deep copy operation on rpc protocol versions * instance. diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index f1c1a72765b..58c1fd3daba 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -306,23 +306,18 @@ CORE_SOURCE_FILES = [ 'src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc', 'src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc', 'src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc', - 'src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc', - 'src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc', 'src/core/tsi/alts/handshaker/alts_tsi_utils.cc', 'src/core/tsi/alts/handshaker/transport_security_common_api.cc', - 'src/core/tsi/alts/handshaker/altscontext.pb.c', - 'src/core/tsi/alts/handshaker/handshaker.pb.c', - 'src/core/tsi/alts/handshaker/transport_security_common.pb.c', - 'third_party/nanopb/pb_common.c', - 'third_party/nanopb/pb_decode.c', - 'third_party/nanopb/pb_encode.c', - 'src/core/tsi/transport_security.cc', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c', + 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c', 'third_party/upb/upb/decode.c', 'third_party/upb/upb/encode.c', 'third_party/upb/upb/msg.c', 'third_party/upb/upb/port.c', 'third_party/upb/upb/table.c', 'third_party/upb/upb/upb.c', + 'src/core/tsi/transport_security.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/authority.cc', diff --git a/test/core/tsi/alts/handshaker/BUILD b/test/core/tsi/alts/handshaker/BUILD index 61ba16ad6db..ed97056c003 100644 --- a/test/core/tsi/alts/handshaker/BUILD +++ b/test/core/tsi/alts/handshaker/BUILD @@ -41,17 +41,6 @@ grpc_cc_test( ], ) -grpc_cc_test( - name = "alts_handshaker_service_api_test", - srcs = ["alts_handshaker_service_api_test.cc"], - language = "C++", - deps = [ - ":alts_handshaker_service_api_test_lib", - "//:grpc", - "//test/core/util:grpc_test_util", - ], -) - grpc_cc_test( name = "alts_tsi_handshaker_test", srcs = ["alts_tsi_handshaker_test.cc"], diff --git a/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc b/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc index 9a4541bb7d1..4d36c24d910 100644 --- a/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc +++ b/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc @@ -54,34 +54,34 @@ typedef struct alts_handshaker_client_test_config { } alts_handshaker_client_test_config; static void validate_rpc_protocol_versions( - grpc_gcp_rpc_protocol_versions* versions) { + const grpc_gcp_RpcProtocolVersions* versions) { GPR_ASSERT(versions != nullptr); - GPR_ASSERT(versions->max_rpc_version.major == kMaxRpcVersionMajor); - GPR_ASSERT(versions->max_rpc_version.minor == kMaxRpcVersionMinor); - GPR_ASSERT(versions->min_rpc_version.major == kMinRpcVersionMajor); - GPR_ASSERT(versions->min_rpc_version.minor == kMinRpcVersionMinor); + const grpc_gcp_RpcProtocolVersions_Version* max_version = + grpc_gcp_RpcProtocolVersions_max_rpc_version(versions); + const grpc_gcp_RpcProtocolVersions_Version* min_version = + grpc_gcp_RpcProtocolVersions_min_rpc_version(versions); + GPR_ASSERT(grpc_gcp_RpcProtocolVersions_Version_major(max_version) == + kMaxRpcVersionMajor); + GPR_ASSERT(grpc_gcp_RpcProtocolVersions_Version_minor(max_version) == + kMaxRpcVersionMinor); + GPR_ASSERT(grpc_gcp_RpcProtocolVersions_Version_major(min_version) == + kMinRpcVersionMajor); + GPR_ASSERT(grpc_gcp_RpcProtocolVersions_Version_minor(min_version) == + kMinRpcVersionMinor); } static void validate_target_identities( - const repeated_field* target_identity_head) { - grpc_gcp_identity* target_identity1 = static_cast( - const_cast(target_identity_head->next->data)); - grpc_gcp_identity* target_identity2 = static_cast( - const_cast(target_identity_head->data)); - grpc_slice* service_account1 = - static_cast(target_identity1->service_account.arg); - grpc_slice* service_account2 = - static_cast(target_identity2->service_account.arg); - GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(*service_account1), - ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT1, - GRPC_SLICE_LENGTH(*service_account1)) == 0); - GPR_ASSERT(strlen(ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT1) == - GRPC_SLICE_LENGTH(*service_account1)); - GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(*service_account2), - ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT2, - GRPC_SLICE_LENGTH(*service_account2)) == 0); - GPR_ASSERT(strlen(ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT2) == - GRPC_SLICE_LENGTH(*service_account2)); + const grpc_gcp_Identity* const* target_identities, + size_t target_identities_count) { + GPR_ASSERT(target_identities_count == 2); + const grpc_gcp_Identity* identity1 = target_identities[1]; + const grpc_gcp_Identity* identity2 = target_identities[0]; + GPR_ASSERT(upb_strview_eql( + grpc_gcp_Identity_service_account(identity1), + upb_strview_makez(ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT1))); + GPR_ASSERT(upb_strview_eql( + grpc_gcp_Identity_service_account(identity2), + upb_strview_makez(ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT2))); } /** @@ -117,14 +117,14 @@ static bool validate_op(alts_handshaker_client* c, const grpc_op* op, return ok; } -static grpc_gcp_handshaker_req* deserialize_handshaker_req( - grpc_gcp_handshaker_req_type type, grpc_byte_buffer* buffer) { +static grpc_gcp_HandshakerReq* deserialize_handshaker_req( + grpc_byte_buffer* buffer, upb_arena* arena) { GPR_ASSERT(buffer != nullptr); - grpc_gcp_handshaker_req* req = grpc_gcp_handshaker_decoded_req_create(type); grpc_byte_buffer_reader bbr; GPR_ASSERT(grpc_byte_buffer_reader_init(&bbr, buffer)); grpc_slice slice = grpc_byte_buffer_reader_readall(&bbr); - GPR_ASSERT(grpc_gcp_handshaker_req_decode(slice, req)); + grpc_gcp_HandshakerReq* req = grpc_gcp_handshaker_req_decode(slice, arena); + GPR_ASSERT(req != nullptr); grpc_slice_unref(slice); grpc_byte_buffer_reader_destroy(&bbr); return req; @@ -150,40 +150,38 @@ static grpc_call_error check_client_start_success(grpc_call* call, const grpc_op* op, size_t nops, grpc_closure* closure) { + upb::Arena arena; alts_handshaker_client* client = static_cast(closure->cb_arg); GPR_ASSERT(alts_handshaker_client_get_closure_for_testing(client) == closure); - grpc_gcp_handshaker_req* req = deserialize_handshaker_req( - CLIENT_START_REQ, - alts_handshaker_client_get_send_buffer_for_testing(client)); - GPR_ASSERT(req->client_start.handshake_security_protocol == - grpc_gcp_HandshakeProtocol_ALTS); - const void* data = (static_cast( - req->client_start.application_protocols.arg)) - ->data; - GPR_ASSERT(data != nullptr); - grpc_slice* application_protocol = (grpc_slice*)data; - data = (static_cast(req->client_start.record_protocols.arg)) - ->data; - grpc_slice* record_protocol = (grpc_slice*)data; - GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(*application_protocol), - ALTS_APPLICATION_PROTOCOL, - GRPC_SLICE_LENGTH(*application_protocol)) == 0); - GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(*record_protocol), - ALTS_RECORD_PROTOCOL, - GRPC_SLICE_LENGTH(*record_protocol)) == 0); - validate_rpc_protocol_versions(&req->client_start.rpc_versions); - validate_target_identities( - static_cast(req->client_start.target_identities.arg)); - grpc_slice* target_name = - static_cast(req->client_start.target_name.arg); - GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(*target_name), - ALTS_HANDSHAKER_CLIENT_TEST_TARGET_NAME, - GRPC_SLICE_LENGTH(*target_name)) == 0); - GPR_ASSERT(GRPC_SLICE_LENGTH(*target_name) == - strlen(ALTS_HANDSHAKER_CLIENT_TEST_TARGET_NAME)); + grpc_gcp_HandshakerReq* req = deserialize_handshaker_req( + alts_handshaker_client_get_send_buffer_for_testing(client), arena.ptr()); + const grpc_gcp_StartClientHandshakeReq* client_start = + grpc_gcp_HandshakerReq_client_start(req); + GPR_ASSERT(grpc_gcp_StartClientHandshakeReq_handshake_security_protocol( + client_start) == grpc_gcp_ALTS); + upb_strview const* application_protocols = + grpc_gcp_StartClientHandshakeReq_application_protocols(client_start, + nullptr); + GPR_ASSERT(upb_strview_eql(application_protocols[0], + upb_strview_makez(ALTS_APPLICATION_PROTOCOL))); + upb_strview const* record_protocols = + grpc_gcp_StartClientHandshakeReq_record_protocols(client_start, nullptr); + GPR_ASSERT(upb_strview_eql(record_protocols[0], + upb_strview_makez(ALTS_RECORD_PROTOCOL))); + const grpc_gcp_RpcProtocolVersions* rpc_protocol_versions = + grpc_gcp_StartClientHandshakeReq_rpc_versions(client_start); + validate_rpc_protocol_versions(rpc_protocol_versions); + size_t target_identities_count; + const grpc_gcp_Identity* const* target_identities = + grpc_gcp_StartClientHandshakeReq_target_identities( + client_start, &target_identities_count); + validate_target_identities(target_identities, target_identities_count); + GPR_ASSERT(upb_strview_eql( + grpc_gcp_StartClientHandshakeReq_target_name(client_start), + upb_strview_makez(ALTS_HANDSHAKER_CLIENT_TEST_TARGET_NAME))); + GPR_ASSERT(validate_op(client, op, nops, true /* is_start */)); - grpc_gcp_handshaker_req_destroy(req); return GRPC_CALL_OK; } @@ -197,34 +195,37 @@ static grpc_call_error check_server_start_success(grpc_call* call, const grpc_op* op, size_t nops, grpc_closure* closure) { + upb::Arena arena; alts_handshaker_client* client = static_cast(closure->cb_arg); GPR_ASSERT(alts_handshaker_client_get_closure_for_testing(client) == closure); - grpc_gcp_handshaker_req* req = deserialize_handshaker_req( - SERVER_START_REQ, - alts_handshaker_client_get_send_buffer_for_testing(client)); - const void* data = (static_cast( - req->server_start.application_protocols.arg)) - ->data; - GPR_ASSERT(data != nullptr); - grpc_slice* application_protocol = (grpc_slice*)data; - GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(*application_protocol), - ALTS_APPLICATION_PROTOCOL, - GRPC_SLICE_LENGTH(*application_protocol)) == 0); - GPR_ASSERT(req->server_start.handshake_parameters_count == 1); - GPR_ASSERT(req->server_start.handshake_parameters[0].key == - grpc_gcp_HandshakeProtocol_ALTS); - data = (static_cast(req->server_start.handshake_parameters[0] - .value.record_protocols.arg)) - ->data; - GPR_ASSERT(data != nullptr); - grpc_slice* record_protocol = (grpc_slice*)data; - GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(*record_protocol), - ALTS_RECORD_PROTOCOL, - GRPC_SLICE_LENGTH(*record_protocol)) == 0); - validate_rpc_protocol_versions(&req->server_start.rpc_versions); + grpc_gcp_HandshakerReq* req = deserialize_handshaker_req( + alts_handshaker_client_get_send_buffer_for_testing(client), arena.ptr()); + const grpc_gcp_StartServerHandshakeReq* server_start = + grpc_gcp_HandshakerReq_server_start(req); + upb_strview const* application_protocols = + grpc_gcp_StartServerHandshakeReq_application_protocols(server_start, + nullptr); + GPR_ASSERT(upb_strview_eql(application_protocols[0], + upb_strview_makez(ALTS_APPLICATION_PROTOCOL))); + size_t handshake_parameters_count; + const grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry* const* + handshake_parameters = + grpc_gcp_StartServerHandshakeReq_handshake_parameters( + server_start, &handshake_parameters_count); + GPR_ASSERT(handshake_parameters_count == 1); + GPR_ASSERT(grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_key( + handshake_parameters[0]) == grpc_gcp_ALTS); + const grpc_gcp_ServerHandshakeParameters* value = + grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_value( + handshake_parameters[0]); + upb_strview const* record_protocols = + grpc_gcp_ServerHandshakeParameters_record_protocols(value, nullptr); + GPR_ASSERT(upb_strview_eql(record_protocols[0], + upb_strview_makez(ALTS_RECORD_PROTOCOL))); + validate_rpc_protocol_versions( + grpc_gcp_StartServerHandshakeReq_rpc_versions(server_start)); GPR_ASSERT(validate_op(client, op, nops, true /* is_start */)); - grpc_gcp_handshaker_req_destroy(req); return GRPC_CALL_OK; } @@ -235,20 +236,21 @@ static grpc_call_error check_server_start_success(grpc_call* call, */ static grpc_call_error check_next_success(grpc_call* call, const grpc_op* op, size_t nops, grpc_closure* closure) { + upb::Arena arena; alts_handshaker_client* client = static_cast(closure->cb_arg); GPR_ASSERT(alts_handshaker_client_get_closure_for_testing(client) == closure); - grpc_gcp_handshaker_req* req = deserialize_handshaker_req( - NEXT_REQ, alts_handshaker_client_get_send_buffer_for_testing(client)); - grpc_slice* in_bytes = static_cast(req->next.in_bytes.arg); - GPR_ASSERT(in_bytes != nullptr); - GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(*in_bytes), - ALTS_HANDSHAKER_CLIENT_TEST_OUT_FRAME, - GRPC_SLICE_LENGTH(*in_bytes)) == 0); + grpc_gcp_HandshakerReq* req = deserialize_handshaker_req( + alts_handshaker_client_get_send_buffer_for_testing(client), arena.ptr()); + const grpc_gcp_NextHandshakeMessageReq* next = + grpc_gcp_HandshakerReq_next(req); + GPR_ASSERT(upb_strview_eql( + grpc_gcp_NextHandshakeMessageReq_in_bytes(next), + upb_strview_makez(ALTS_HANDSHAKER_CLIENT_TEST_OUT_FRAME))); GPR_ASSERT(validate_op(client, op, nops, false /* is_start */)); - grpc_gcp_handshaker_req_destroy(req); return GRPC_CALL_OK; } + /** * A mock grpc_caller used to check if client_start, server_start, and next * operations correctly handle the situation when the grpc call made to the diff --git a/test/core/tsi/alts/handshaker/alts_handshaker_service_api_test.cc b/test/core/tsi/alts/handshaker/alts_handshaker_service_api_test.cc deleted file mode 100644 index 3506264f528..00000000000 --- a/test/core/tsi/alts/handshaker/alts_handshaker_service_api_test.cc +++ /dev/null @@ -1,149 +0,0 @@ -/* - * - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include - -#include "test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.h" - -int main(int argc, char** argv) { - const char in_bytes[] = "HELLO GOOGLE!"; - const char out_frames[] = "HELLO WORLD!"; - const char key_data[] = "THIS IS KEY DATA."; - const char details[] = "DETAILS NEED TO BE POPULATED"; - const uint32_t max_rpc_version_major = 3; - const uint32_t max_rpc_version_minor = 2; - const uint32_t min_rpc_version_major = 2; - const uint32_t min_rpc_version_minor = 1; - - /* handshaker_req_next. */ - grpc_gcp_handshaker_req* req = grpc_gcp_handshaker_req_create(NEXT_REQ); - grpc_gcp_handshaker_req* decoded_req = - grpc_gcp_handshaker_decoded_req_create(NEXT_REQ); - GPR_ASSERT( - grpc_gcp_handshaker_req_set_in_bytes(req, in_bytes, strlen(in_bytes))); - grpc_slice encoded_req; - GPR_ASSERT(grpc_gcp_handshaker_req_encode(req, &encoded_req)); - GPR_ASSERT(grpc_gcp_handshaker_req_decode(encoded_req, decoded_req)); - GPR_ASSERT(grpc_gcp_handshaker_req_equals(req, decoded_req)); - grpc_gcp_handshaker_req_destroy(req); - grpc_gcp_handshaker_req_destroy(decoded_req); - grpc_slice_unref(encoded_req); - - /* handshaker_req_client_start. */ - req = grpc_gcp_handshaker_req_create(CLIENT_START_REQ); - decoded_req = grpc_gcp_handshaker_decoded_req_create(CLIENT_START_REQ); - GPR_ASSERT(grpc_gcp_handshaker_req_set_handshake_protocol( - req, grpc_gcp_HandshakeProtocol_TLS)); - GPR_ASSERT(grpc_gcp_handshaker_req_set_local_identity_hostname( - req, "www.google.com")); - GPR_ASSERT(grpc_gcp_handshaker_req_set_local_endpoint( - req, "2001:db8::8:800:200C:417a", 9876, grpc_gcp_NetworkProtocol_TCP)); - GPR_ASSERT(grpc_gcp_handshaker_req_set_remote_endpoint( - req, "2001:db8::bac5::fed0:84a2", 1234, grpc_gcp_NetworkProtocol_TCP)); - GPR_ASSERT(grpc_gcp_handshaker_req_add_application_protocol(req, "grpc")); - GPR_ASSERT(grpc_gcp_handshaker_req_add_application_protocol(req, "http2")); - GPR_ASSERT( - grpc_gcp_handshaker_req_add_record_protocol(req, "ALTSRP_GCM_AES256")); - GPR_ASSERT( - grpc_gcp_handshaker_req_add_record_protocol(req, "ALTSRP_GCM_AES384")); - GPR_ASSERT(grpc_gcp_handshaker_req_add_target_identity_service_account( - req, "foo@google.com")); - GPR_ASSERT(grpc_gcp_handshaker_req_set_target_name( - req, "google.example.library.service")); - GPR_ASSERT(grpc_gcp_handshaker_req_set_rpc_versions( - req, max_rpc_version_major, max_rpc_version_minor, min_rpc_version_major, - min_rpc_version_minor)); - GPR_ASSERT(grpc_gcp_handshaker_req_encode(req, &encoded_req)); - GPR_ASSERT(grpc_gcp_handshaker_req_decode(encoded_req, decoded_req)); - GPR_ASSERT(grpc_gcp_handshaker_req_equals(req, decoded_req)); - grpc_gcp_handshaker_req_destroy(req); - grpc_gcp_handshaker_req_destroy(decoded_req); - grpc_slice_unref(encoded_req); - - /* handshaker_req_server_start. */ - req = grpc_gcp_handshaker_req_create(SERVER_START_REQ); - decoded_req = grpc_gcp_handshaker_decoded_req_create(SERVER_START_REQ); - GPR_ASSERT(grpc_gcp_handshaker_req_add_application_protocol(req, "grpc")); - GPR_ASSERT(grpc_gcp_handshaker_req_add_application_protocol(req, "http2")); - GPR_ASSERT(grpc_gcp_handshaker_req_set_local_endpoint( - req, "2001:db8::8:800:200C:417a", 9876, grpc_gcp_NetworkProtocol_TCP)); - GPR_ASSERT(grpc_gcp_handshaker_req_set_remote_endpoint( - req, "2001:db8::bac5::fed0:84a2", 1234, grpc_gcp_NetworkProtocol_UDP)); - GPR_ASSERT( - grpc_gcp_handshaker_req_set_in_bytes(req, in_bytes, strlen(in_bytes))); - GPR_ASSERT(grpc_gcp_handshaker_req_param_add_record_protocol( - req, grpc_gcp_HandshakeProtocol_TLS, "ALTSRP_GCM_AES128")); - GPR_ASSERT(grpc_gcp_handshaker_req_param_add_local_identity_service_account( - req, grpc_gcp_HandshakeProtocol_TLS, "foo@google.com")); - GPR_ASSERT(grpc_gcp_handshaker_req_param_add_local_identity_hostname( - req, grpc_gcp_HandshakeProtocol_TLS, "yihuaz0.mtv.corp.google.com")); - GPR_ASSERT(grpc_gcp_handshaker_req_param_add_record_protocol( - req, grpc_gcp_HandshakeProtocol_ALTS, "ALTSRP_GCM_AES128")); - GPR_ASSERT(grpc_gcp_handshaker_req_param_add_local_identity_hostname( - req, grpc_gcp_HandshakeProtocol_ALTS, "www.amazon.com")); - GPR_ASSERT(grpc_gcp_handshaker_req_set_rpc_versions( - req, max_rpc_version_major, max_rpc_version_minor, min_rpc_version_major, - min_rpc_version_minor)); - - GPR_ASSERT(grpc_gcp_handshaker_req_encode(req, &encoded_req)); - GPR_ASSERT(grpc_gcp_handshaker_req_decode(encoded_req, decoded_req)); - GPR_ASSERT(grpc_gcp_handshaker_req_equals(req, decoded_req)); - grpc_gcp_handshaker_req_destroy(req); - grpc_gcp_handshaker_req_destroy(decoded_req); - grpc_slice_unref(encoded_req); - - /* handshaker_resp. */ - grpc_gcp_handshaker_resp* resp = grpc_gcp_handshaker_resp_create(); - grpc_gcp_handshaker_resp* decoded_resp = grpc_gcp_handshaker_resp_create(); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_out_frames(resp, out_frames, - strlen(out_frames))); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_bytes_consumed(resp, 1024)); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_application_protocol(resp, "http")); - GPR_ASSERT( - grpc_gcp_handshaker_resp_set_record_protocol(resp, "ALTSRP_GCM_AES128")); - GPR_ASSERT( - grpc_gcp_handshaker_resp_set_key_data(resp, key_data, strlen(key_data))); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_local_identity_hostname( - resp, "www.faceboook.com")); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_peer_identity_hostname( - resp, "www.amazon.com")); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_channel_open( - resp, false /* channel_open */)); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_code(resp, 1023)); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_details(resp, details)); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_peer_rpc_versions( - resp, max_rpc_version_major, max_rpc_version_minor, min_rpc_version_major, - min_rpc_version_minor)); - grpc_slice encoded_resp; - GPR_ASSERT(grpc_gcp_handshaker_resp_encode(resp, &encoded_resp)); - GPR_ASSERT(grpc_gcp_handshaker_resp_decode(encoded_resp, decoded_resp)); - GPR_ASSERT(grpc_gcp_handshaker_resp_equals(resp, decoded_resp)); - grpc_gcp_handshaker_resp_destroy(resp); - grpc_gcp_handshaker_resp_destroy(decoded_resp); - grpc_slice_unref(encoded_resp); - /* Test invalid arguments. */ - GPR_ASSERT(!grpc_gcp_handshaker_req_set_in_bytes(nullptr, in_bytes, - strlen(in_bytes))); - GPR_ASSERT(!grpc_gcp_handshaker_req_param_add_record_protocol( - req, grpc_gcp_HandshakeProtocol_TLS, nullptr)); - GPR_ASSERT(!grpc_gcp_handshaker_req_param_add_local_identity_service_account( - nullptr, grpc_gcp_HandshakeProtocol_TLS, nullptr)); - GPR_ASSERT(!grpc_gcp_handshaker_resp_set_record_protocol(nullptr, nullptr)); -} diff --git a/test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.cc b/test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.cc index ecca04defa5..2ab73a26ff5 100644 --- a/test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.cc +++ b/test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.cc @@ -18,625 +18,146 @@ #include "test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.h" -const size_t kHandshakeProtocolNum = 3; - -grpc_gcp_handshaker_req* grpc_gcp_handshaker_decoded_req_create( - grpc_gcp_handshaker_req_type type) { - grpc_gcp_handshaker_req* req = - static_cast(gpr_zalloc(sizeof(*req))); - switch (type) { - case CLIENT_START_REQ: - req->has_client_start = true; - req->client_start.target_identities.funcs.decode = - decode_repeated_identity_cb; - req->client_start.application_protocols.funcs.decode = - decode_repeated_string_cb; - req->client_start.record_protocols.funcs.decode = - decode_repeated_string_cb; - req->client_start.local_identity.hostname.funcs.decode = - decode_string_or_bytes_cb; - req->client_start.local_identity.service_account.funcs.decode = - decode_string_or_bytes_cb; - req->client_start.local_endpoint.ip_address.funcs.decode = - decode_string_or_bytes_cb; - req->client_start.remote_endpoint.ip_address.funcs.decode = - decode_string_or_bytes_cb; - req->client_start.target_name.funcs.decode = decode_string_or_bytes_cb; - break; - case SERVER_START_REQ: - req->has_server_start = true; - req->server_start.application_protocols.funcs.decode = - &decode_repeated_string_cb; - for (size_t i = 0; i < kHandshakeProtocolNum; i++) { - req->server_start.handshake_parameters[i] - .value.local_identities.funcs.decode = &decode_repeated_identity_cb; - req->server_start.handshake_parameters[i] - .value.record_protocols.funcs.decode = &decode_repeated_string_cb; - } - req->server_start.in_bytes.funcs.decode = decode_string_or_bytes_cb; - req->server_start.local_endpoint.ip_address.funcs.decode = - decode_string_or_bytes_cb; - req->server_start.remote_endpoint.ip_address.funcs.decode = - decode_string_or_bytes_cb; - break; - case NEXT_REQ: - req->has_next = true; - break; - } - return req; -} - -bool grpc_gcp_handshaker_resp_set_application_protocol( - grpc_gcp_handshaker_resp* resp, const char* application_protocol) { - if (resp == nullptr || application_protocol == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to " - "handshaker_resp_set_application_protocol()."); - return false; - } - resp->has_result = true; - grpc_slice* slice = - create_slice(application_protocol, strlen(application_protocol)); - resp->result.application_protocol.arg = slice; - resp->result.application_protocol.funcs.encode = encode_string_or_bytes_cb; - return true; -} - -bool grpc_gcp_handshaker_resp_set_record_protocol( - grpc_gcp_handshaker_resp* resp, const char* record_protocol) { - if (resp == nullptr || record_protocol == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to " - "handshaker_resp_set_record_protocol()."); - return false; - } - resp->has_result = true; - grpc_slice* slice = create_slice(record_protocol, strlen(record_protocol)); - resp->result.record_protocol.arg = slice; - resp->result.record_protocol.funcs.encode = encode_string_or_bytes_cb; - return true; -} - -bool grpc_gcp_handshaker_resp_set_key_data(grpc_gcp_handshaker_resp* resp, - const char* key_data, size_t size) { - if (resp == nullptr || key_data == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to handshaker_resp_set_key_data()."); - return false; - } - resp->has_result = true; - grpc_slice* slice = create_slice(key_data, size); - resp->result.key_data.arg = slice; - resp->result.key_data.funcs.encode = encode_string_or_bytes_cb; - return true; -} - -static void set_identity_hostname(grpc_gcp_identity* identity, - const char* hostname) { - grpc_slice* slice = create_slice(hostname, strlen(hostname)); - identity->hostname.arg = slice; - identity->hostname.funcs.encode = encode_string_or_bytes_cb; -} - -static void set_identity_service_account(grpc_gcp_identity* identity, - const char* service_account) { - grpc_slice* slice = create_slice(service_account, strlen(service_account)); - identity->service_account.arg = slice; - identity->service_account.funcs.encode = encode_string_or_bytes_cb; -} - -bool grpc_gcp_handshaker_resp_set_local_identity_hostname( - grpc_gcp_handshaker_resp* resp, const char* hostname) { - if (resp == nullptr || hostname == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to " - "grpc_gcp_handshaker_resp_set_local_identity_hostname()."); - return false; - } - resp->has_result = true; - resp->result.has_local_identity = true; - set_identity_hostname(&resp->result.local_identity, hostname); - return true; -} - -bool grpc_gcp_handshaker_resp_set_local_identity_service_account( - grpc_gcp_handshaker_resp* resp, const char* service_account) { - if (resp == nullptr || service_account == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to " - "grpc_gcp_handshaker_resp_set_local_identity_service_account()."); - return false; - } - resp->has_result = true; - resp->result.has_local_identity = true; - set_identity_service_account(&resp->result.local_identity, service_account); - return true; -} - -bool grpc_gcp_handshaker_resp_set_peer_identity_hostname( - grpc_gcp_handshaker_resp* resp, const char* hostname) { - if (resp == nullptr || hostname == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to " - "grpc_gcp_handshaker_resp_set_peer_identity_hostname()."); - return false; - } - resp->has_result = true; - resp->result.has_peer_identity = true; - set_identity_hostname(&resp->result.peer_identity, hostname); - return true; -} - -bool grpc_gcp_handshaker_resp_set_peer_identity_service_account( - grpc_gcp_handshaker_resp* resp, const char* service_account) { - if (resp == nullptr || service_account == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to " - "grpc_gcp_handshaker_resp_set_peer_identity_service_account()."); - return false; - } - resp->has_result = true; - resp->result.has_peer_identity = true; - set_identity_service_account(&resp->result.peer_identity, service_account); - return true; -} - -bool grpc_gcp_handshaker_resp_set_channel_open(grpc_gcp_handshaker_resp* resp, - bool keep_channel_open) { - if (resp == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr argument to " - "grpc_gcp_handshaker_resp_set_channel_open()."); - return false; - } - resp->has_result = true; - resp->result.has_keep_channel_open = true; - resp->result.keep_channel_open = keep_channel_open; - return true; -} - -bool grpc_gcp_handshaker_resp_set_code(grpc_gcp_handshaker_resp* resp, - uint32_t code) { - if (resp == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr argument to grpc_gcp_handshaker_resp_set_code()."); - return false; - } - resp->has_status = true; - resp->status.has_code = true; - resp->status.code = code; - return true; -} - -bool grpc_gcp_handshaker_resp_set_details(grpc_gcp_handshaker_resp* resp, - const char* details) { - if (resp == nullptr || details == nullptr) { - gpr_log( - GPR_ERROR, - "Invalid nullptr arguments to grpc_gcp_handshaker_resp_set_details()."); - return false; - } - resp->has_status = true; - grpc_slice* slice = create_slice(details, strlen(details)); - resp->status.details.arg = slice; - resp->status.details.funcs.encode = encode_string_or_bytes_cb; - return true; -} - -bool grpc_gcp_handshaker_resp_set_out_frames(grpc_gcp_handshaker_resp* resp, - const char* out_frames, - size_t size) { - if (resp == nullptr || out_frames == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to " - "grpc_gcp_handshaker_resp_set_out_frames()."); - return false; - } - grpc_slice* slice = create_slice(out_frames, size); - resp->out_frames.arg = slice; - resp->out_frames.funcs.encode = encode_string_or_bytes_cb; - return true; -} - -bool grpc_gcp_handshaker_resp_set_bytes_consumed(grpc_gcp_handshaker_resp* resp, - int32_t bytes_consumed) { - if (resp == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr argument to " - "grpc_gcp_handshaker_resp_set_bytes_consumed()."); - return false; - } - resp->has_bytes_consumed = true; - resp->bytes_consumed = bytes_consumed; - return true; -} - bool grpc_gcp_handshaker_resp_set_peer_rpc_versions( - grpc_gcp_handshaker_resp* resp, uint32_t max_major, uint32_t max_minor, - uint32_t min_major, uint32_t min_minor) { + grpc_gcp_HandshakerResp* resp, upb_arena* arena, uint32_t max_major, + uint32_t max_minor, uint32_t min_major, uint32_t min_minor) { if (resp == nullptr) { gpr_log(GPR_ERROR, "Invalid nullptr argument to " "grpc_gcp_handshaker_resp_set_peer_rpc_versions()."); return false; } - resp->has_result = true; - resp->result.has_peer_rpc_versions = true; - grpc_gcp_rpc_protocol_versions* versions = &resp->result.peer_rpc_versions; - versions->has_max_rpc_version = true; - versions->has_min_rpc_version = true; - versions->max_rpc_version.has_major = true; - versions->max_rpc_version.has_minor = true; - versions->min_rpc_version.has_major = true; - versions->min_rpc_version.has_minor = true; - versions->max_rpc_version.major = max_major; - versions->max_rpc_version.minor = max_minor; - versions->min_rpc_version.major = min_major; - versions->min_rpc_version.minor = min_minor; + grpc_gcp_rpc_protocol_versions versions; + versions.max_rpc_version.major = max_major; + versions.max_rpc_version.minor = max_minor; + versions.min_rpc_version.major = min_major; + versions.min_rpc_version.minor = min_minor; + grpc_gcp_HandshakerResult* result = + grpc_gcp_HandshakerResp_mutable_result(resp, arena); + grpc_gcp_RpcProtocolVersions* upb_versions = + grpc_gcp_HandshakerResult_mutable_peer_rpc_versions(result, arena); + grpc_gcp_RpcProtocolVersions_assign_from_struct(upb_versions, arena, + &versions); return true; } -bool grpc_gcp_handshaker_resp_encode(grpc_gcp_handshaker_resp* resp, - grpc_slice* slice) { - if (resp == nullptr || slice == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr arguments to grpc_gcp_handshaker_resp_encode()."); - return false; +grpc_gcp_HandshakerReq* grpc_gcp_handshaker_req_decode(grpc_slice slice, + upb_arena* arena) { + size_t buf_size = GPR_SLICE_LENGTH(slice); + void* buf = upb_arena_malloc(arena, buf_size); + memcpy(buf, reinterpret_cast(GPR_SLICE_START_PTR(slice)), + buf_size); + grpc_gcp_HandshakerReq* resp = grpc_gcp_HandshakerReq_parse( + reinterpret_cast(buf), buf_size, arena); + if (!resp) { + gpr_log(GPR_ERROR, "grpc_gcp_HandshakerReq decode error"); + return nullptr; } - pb_ostream_t size_stream; - memset(&size_stream, 0, sizeof(pb_ostream_t)); - if (!pb_encode(&size_stream, grpc_gcp_HandshakerResp_fields, resp)) { - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&size_stream)); - return false; - } - size_t encoded_length = size_stream.bytes_written; - *slice = grpc_slice_malloc(encoded_length); - pb_ostream_t output_stream = - pb_ostream_from_buffer(GRPC_SLICE_START_PTR(*slice), encoded_length); - if (!pb_encode(&output_stream, grpc_gcp_HandshakerResp_fields, resp)) { - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&size_stream)); - return false; - } - return true; -} - -bool grpc_gcp_handshaker_req_decode(grpc_slice slice, - grpc_gcp_handshaker_req* req) { - if (req == nullptr) { - gpr_log(GPR_ERROR, - "Invalid nullptr argument to grpc_gcp_handshaker_req_decode()."); - return false; - } - pb_istream_t stream = pb_istream_from_buffer(GRPC_SLICE_START_PTR(slice), - GRPC_SLICE_LENGTH(slice)); - req->next.in_bytes.funcs.decode = decode_string_or_bytes_cb; - if (!pb_decode(&stream, grpc_gcp_HandshakerReq_fields, req)) { - gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream)); - return false; - } - return true; -} - -/* Check equality of a pair of grpc_slice fields. */ -static bool slice_equals(grpc_slice* l_slice, grpc_slice* r_slice) { - if (l_slice == nullptr && r_slice == nullptr) { - return true; - } - if (l_slice != nullptr && r_slice != nullptr) { - return grpc_slice_eq(*l_slice, *r_slice); - } - return false; + return resp; } /* Check equality of a pair of grpc_gcp_identity fields. */ -static bool handshaker_identity_equals(const grpc_gcp_identity* l_id, - const grpc_gcp_identity* r_id) { - if (!((l_id->hostname.arg != nullptr) != (r_id->hostname.arg != nullptr))) { - if (l_id->hostname.arg != nullptr) { - return slice_equals(static_cast(l_id->hostname.arg), - static_cast(r_id->hostname.arg)); - } - } else { - return false; - } - if (!((l_id->service_account.arg != nullptr) != - (r_id->service_account.arg != nullptr))) { - if (l_id->service_account.arg != nullptr) { - return slice_equals(static_cast(l_id->service_account.arg), - static_cast(r_id->service_account.arg)); - } - } else { +static bool handshaker_identity_equals(const grpc_gcp_Identity* l_id, + const grpc_gcp_Identity* r_id) { + if ((grpc_gcp_Identity_has_service_account(l_id) != + grpc_gcp_Identity_has_service_account(r_id)) || + (grpc_gcp_Identity_has_hostname(l_id) != + grpc_gcp_Identity_has_hostname(r_id))) { return false; } - return true; -} - -static bool handshaker_rpc_versions_equals( - const grpc_gcp_rpc_protocol_versions* l_version, - const grpc_gcp_rpc_protocol_versions* r_version) { - bool result = true; - result &= - (l_version->max_rpc_version.major == r_version->max_rpc_version.major); - result &= - (l_version->max_rpc_version.minor == r_version->max_rpc_version.minor); - result &= - (l_version->min_rpc_version.major == r_version->min_rpc_version.major); - result &= - (l_version->min_rpc_version.minor == r_version->min_rpc_version.minor); - return result; -} - -/* Check equality of a pair of grpc_gcp_endpoint fields. */ -static bool handshaker_endpoint_equals(const grpc_gcp_endpoint* l_end, - const grpc_gcp_endpoint* r_end) { - bool result = true; - result &= (l_end->port == r_end->port); - result &= (l_end->protocol == r_end->protocol); - if (!((l_end->ip_address.arg != nullptr) != - (r_end->ip_address.arg != nullptr))) { - if (l_end->ip_address.arg != nullptr) { - result &= slice_equals(static_cast(l_end->ip_address.arg), - static_cast(r_end->ip_address.arg)); - } - } else { - return false; - } - return result; -} -/** - * Check if a specific repeated field (i.e., target) is contained in a repeated - * field list (i.e., head). - */ -static bool repeated_field_list_contains_identity( - const repeated_field* head, const repeated_field* target) { - repeated_field* field = const_cast(head); - while (field != nullptr) { - if (handshaker_identity_equals( - static_cast(field->data), - static_cast(target->data))) { - return true; - } - field = field->next; - } - return false; -} - -static bool repeated_field_list_contains_string(const repeated_field* head, - const repeated_field* target) { - repeated_field* field = const_cast(head); - while (field != nullptr) { - if (slice_equals((grpc_slice*)field->data, (grpc_slice*)target->data)) { - return true; - } - field = field->next; - } - return false; -} - -/* Return a length of repeated field list. */ -static size_t repeated_field_list_get_length(const repeated_field* head) { - repeated_field* field = const_cast(head); - size_t len = 0; - while (field != nullptr) { - len++; - field = field->next; - } - return len; -} -/** - * Check if a pair of repeated field lists contain the same set of repeated - * fields. - */ -static bool repeated_field_list_equals_identity(const repeated_field* l_head, - const repeated_field* r_head) { - if (repeated_field_list_get_length(l_head) != - repeated_field_list_get_length(r_head)) { - return false; - } - repeated_field* field = const_cast(l_head); - repeated_field* head = const_cast(r_head); - while (field != nullptr) { - if (!repeated_field_list_contains_identity(head, field)) { + if (grpc_gcp_Identity_has_service_account(l_id)) { + if (!upb_strview_eql(grpc_gcp_Identity_service_account(l_id), + grpc_gcp_Identity_service_account(r_id))) { return false; } - field = field->next; - } - return true; -} - -static bool repeated_field_list_equals_string(const repeated_field* l_head, - const repeated_field* r_head) { - if (repeated_field_list_get_length(l_head) != - repeated_field_list_get_length(r_head)) { - return false; - } - repeated_field* field = const_cast(l_head); - repeated_field* head = const_cast(r_head); - while (field != nullptr) { - if (!repeated_field_list_contains_string(head, field)) { + } else if (grpc_gcp_Identity_has_hostname(l_id)) { + if (!upb_strview_eql(grpc_gcp_Identity_hostname(l_id), + grpc_gcp_Identity_hostname(r_id))) { return false; } - field = field->next; } return true; } -/* Check equality of a pair of ALTS client_start handshake requests. */ -bool grpc_gcp_handshaker_client_start_req_equals( - grpc_gcp_start_client_handshake_req* l_req, - grpc_gcp_start_client_handshake_req* r_req) { - bool result = true; - /* Compare handshake_security_protocol. */ - result &= - l_req->handshake_security_protocol == r_req->handshake_security_protocol; - /* Compare application_protocols, record_protocols, and target_identities. */ - result &= repeated_field_list_equals_string( - static_cast(l_req->application_protocols.arg), - static_cast(r_req->application_protocols.arg)); - result &= repeated_field_list_equals_string( - static_cast(l_req->record_protocols.arg), - static_cast(r_req->record_protocols.arg)); - result &= repeated_field_list_equals_identity( - static_cast(l_req->target_identities.arg), - static_cast(r_req->target_identities.arg)); - if ((l_req->has_local_identity ^ r_req->has_local_identity) | - (l_req->has_local_endpoint ^ r_req->has_local_endpoint) | - ((l_req->has_remote_endpoint ^ r_req->has_remote_endpoint)) | - (l_req->has_rpc_versions ^ r_req->has_rpc_versions)) { - return false; - } - /* Compare local_identity, local_endpoint, and remote_endpoint. */ - if (l_req->has_local_identity) { - result &= handshaker_identity_equals(&l_req->local_identity, - &r_req->local_identity); - } - if (l_req->has_local_endpoint) { - result &= handshaker_endpoint_equals(&l_req->local_endpoint, - &r_req->local_endpoint); - } - if (l_req->has_remote_endpoint) { - result &= handshaker_endpoint_equals(&l_req->remote_endpoint, - &r_req->remote_endpoint); - } - if (l_req->has_rpc_versions) { - result &= handshaker_rpc_versions_equals(&l_req->rpc_versions, - &r_req->rpc_versions); - } - return result; -} - -/* Check equality of a pair of ALTS server_start handshake requests. */ -bool grpc_gcp_handshaker_server_start_req_equals( - grpc_gcp_start_server_handshake_req* l_req, - grpc_gcp_start_server_handshake_req* r_req) { - bool result = true; - /* Compare application_protocols. */ - result &= repeated_field_list_equals_string( - static_cast(l_req->application_protocols.arg), - static_cast(r_req->application_protocols.arg)); - /* Compare handshake_parameters. */ - size_t i = 0, j = 0; - result &= - (l_req->handshake_parameters_count == r_req->handshake_parameters_count); - for (i = 0; i < l_req->handshake_parameters_count; i++) { - bool found = false; - for (j = 0; j < r_req->handshake_parameters_count; j++) { - if (l_req->handshake_parameters[i].key == - r_req->handshake_parameters[j].key) { - found = true; - result &= repeated_field_list_equals_string( - static_cast( - l_req->handshake_parameters[i].value.record_protocols.arg), - static_cast( - r_req->handshake_parameters[j].value.record_protocols.arg)); - result &= repeated_field_list_equals_identity( - static_cast( - l_req->handshake_parameters[i].value.local_identities.arg), - static_cast( - r_req->handshake_parameters[j].value.local_identities.arg)); - } - } - if (!found) { - return false; - } - } - /* Compare in_bytes, local_endpoint, remote_endpoint. */ - result &= slice_equals(static_cast(l_req->in_bytes.arg), - static_cast(r_req->in_bytes.arg)); - if ((l_req->has_local_endpoint ^ r_req->has_local_endpoint) | - (l_req->has_remote_endpoint ^ r_req->has_remote_endpoint) | - (l_req->has_rpc_versions ^ r_req->has_rpc_versions)) - return false; - if (l_req->has_local_endpoint) { - result &= handshaker_endpoint_equals(&l_req->local_endpoint, - &r_req->local_endpoint); - } - if (l_req->has_remote_endpoint) { - result &= handshaker_endpoint_equals(&l_req->remote_endpoint, - &r_req->remote_endpoint); - } - if (l_req->has_rpc_versions) { - result &= handshaker_rpc_versions_equals(&l_req->rpc_versions, - &r_req->rpc_versions); - } - return result; -} - -/* Check equality of a pair of ALTS handshake requests. */ -bool grpc_gcp_handshaker_req_equals(grpc_gcp_handshaker_req* l_req, - grpc_gcp_handshaker_req* r_req) { - if (l_req->has_next && r_req->has_next) { - return slice_equals(static_cast(l_req->next.in_bytes.arg), - static_cast(r_req->next.in_bytes.arg)); - } else if (l_req->has_client_start && r_req->has_client_start) { - return grpc_gcp_handshaker_client_start_req_equals(&l_req->client_start, - &r_req->client_start); - } else if (l_req->has_server_start && r_req->has_server_start) { - return grpc_gcp_handshaker_server_start_req_equals(&l_req->server_start, - &r_req->server_start); - } - return false; -} - -/* Check equality of a pair of ALTS handshake results. */ -bool grpc_gcp_handshaker_resp_result_equals( - grpc_gcp_handshaker_result* l_result, - grpc_gcp_handshaker_result* r_result) { - bool result = true; - /* Compare application_protocol, record_protocol, and key_data. */ - result &= slice_equals( - static_cast(l_result->application_protocol.arg), - static_cast(r_result->application_protocol.arg)); - result &= - slice_equals(static_cast(l_result->record_protocol.arg), - static_cast(r_result->record_protocol.arg)); - result &= slice_equals(static_cast(l_result->key_data.arg), - static_cast(r_result->key_data.arg)); - /* Compare local_identity, peer_identity, and keep_channel_open. */ - if ((l_result->has_local_identity ^ r_result->has_local_identity) | - (l_result->has_peer_identity ^ r_result->has_peer_identity) | - (l_result->has_peer_rpc_versions ^ r_result->has_peer_rpc_versions)) { - return false; - } - if (l_result->has_local_identity) { - result &= handshaker_identity_equals(&l_result->local_identity, - &r_result->local_identity); - } - if (l_result->has_peer_identity) { - result &= handshaker_identity_equals(&l_result->peer_identity, - &r_result->peer_identity); - } - if (l_result->has_peer_rpc_versions) { - result &= handshaker_rpc_versions_equals(&l_result->peer_rpc_versions, - &r_result->peer_rpc_versions); - } - result &= (l_result->keep_channel_open == r_result->keep_channel_open); - return result; +static bool handshaker_rpc_versions_equals( + const grpc_gcp_RpcProtocolVersions* l_version, + const grpc_gcp_RpcProtocolVersions* r_version) { + const grpc_gcp_RpcProtocolVersions_Version* l_maxver = + grpc_gcp_RpcProtocolVersions_max_rpc_version(l_version); + const grpc_gcp_RpcProtocolVersions_Version* r_maxver = + grpc_gcp_RpcProtocolVersions_max_rpc_version(r_version); + const grpc_gcp_RpcProtocolVersions_Version* l_minver = + grpc_gcp_RpcProtocolVersions_min_rpc_version(l_version); + const grpc_gcp_RpcProtocolVersions_Version* r_minver = + grpc_gcp_RpcProtocolVersions_min_rpc_version(r_version); + return (grpc_gcp_RpcProtocolVersions_Version_major(l_maxver) == + grpc_gcp_RpcProtocolVersions_Version_major(r_maxver)) && + (grpc_gcp_RpcProtocolVersions_Version_minor(l_maxver) == + grpc_gcp_RpcProtocolVersions_Version_minor(r_maxver)) && + (grpc_gcp_RpcProtocolVersions_Version_major(l_minver) == + grpc_gcp_RpcProtocolVersions_Version_major(r_minver)) && + (grpc_gcp_RpcProtocolVersions_Version_minor(l_minver) == + grpc_gcp_RpcProtocolVersions_Version_minor(r_minver)); } /* Check equality of a pair of ALTS handshake responses. */ -bool grpc_gcp_handshaker_resp_equals(grpc_gcp_handshaker_resp* l_resp, - grpc_gcp_handshaker_resp* r_resp) { - bool result = true; - /* Compare out_frames and bytes_consumed. */ - result &= slice_equals(static_cast(l_resp->out_frames.arg), - static_cast(r_resp->out_frames.arg)); - result &= (l_resp->bytes_consumed == r_resp->bytes_consumed); - /* Compare result and status. */ - if ((l_resp->has_result ^ r_resp->has_result) | - (l_resp->has_status ^ r_resp->has_status)) { +bool grpc_gcp_handshaker_resp_equals(const grpc_gcp_HandshakerResp* l_resp, + const grpc_gcp_HandshakerResp* r_resp) { + return upb_strview_eql(grpc_gcp_HandshakerResp_out_frames(l_resp), + grpc_gcp_HandshakerResp_out_frames(r_resp)) && + (grpc_gcp_HandshakerResp_bytes_consumed(l_resp) == + grpc_gcp_HandshakerResp_bytes_consumed(l_resp)) && + grpc_gcp_handshaker_resp_result_equals( + grpc_gcp_HandshakerResp_result(l_resp), + grpc_gcp_HandshakerResp_result(r_resp)) && + grpc_gcp_handshaker_resp_status_equals( + grpc_gcp_HandshakerResp_status(l_resp), + grpc_gcp_HandshakerResp_status(r_resp)); +} + +/* This method checks equality of two handshaker response results. */ +bool grpc_gcp_handshaker_resp_result_equals( + const grpc_gcp_HandshakerResult* l_result, + const grpc_gcp_HandshakerResult* r_result) { + if (l_result == nullptr && r_result == nullptr) { + return true; + } else if ((l_result != nullptr && r_result == nullptr) || + (l_result == nullptr && r_result != nullptr)) { + return false; + } + return upb_strview_eql( + grpc_gcp_HandshakerResult_application_protocol(l_result), + grpc_gcp_HandshakerResult_application_protocol(r_result)) && + upb_strview_eql(grpc_gcp_HandshakerResult_record_protocol(l_result), + grpc_gcp_HandshakerResult_record_protocol(r_result)) && + upb_strview_eql(grpc_gcp_HandshakerResult_key_data(l_result), + grpc_gcp_HandshakerResult_key_data(r_result)) && + handshaker_identity_equals( + grpc_gcp_HandshakerResult_peer_identity(l_result), + grpc_gcp_HandshakerResult_peer_identity(r_result)) && + handshaker_identity_equals( + grpc_gcp_HandshakerResult_local_identity(l_result), + grpc_gcp_HandshakerResult_local_identity(r_result)) && + (grpc_gcp_HandshakerResult_keep_channel_open(l_result) == + grpc_gcp_HandshakerResult_keep_channel_open(r_result)) && + handshaker_rpc_versions_equals( + grpc_gcp_HandshakerResult_peer_rpc_versions(l_result), + grpc_gcp_HandshakerResult_peer_rpc_versions(r_result)); +} + +/* This method checks equality of two handshaker response statuses. */ +bool grpc_gcp_handshaker_resp_status_equals( + const grpc_gcp_HandshakerStatus* l_status, + const grpc_gcp_HandshakerStatus* r_status) { + if (l_status == nullptr && r_status == nullptr) { + return true; + } else if ((l_status != nullptr && r_status == nullptr) || + (l_status == nullptr && r_status != nullptr)) { return false; } - if (l_resp->has_result) { - result &= grpc_gcp_handshaker_resp_result_equals(&l_resp->result, - &r_resp->result); - } - if (l_resp->has_status) { - result &= (l_resp->status.code == r_resp->status.code); - result &= - slice_equals(static_cast(l_resp->status.details.arg), - static_cast(r_resp->status.details.arg)); - } - return result; + return (grpc_gcp_HandshakerStatus_code(l_status) == + grpc_gcp_HandshakerStatus_code(r_status)) && + upb_strview_eql(grpc_gcp_HandshakerStatus_details(l_status), + grpc_gcp_HandshakerStatus_details(r_status)); } diff --git a/test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.h b/test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.h index 2fcbb4ea99a..d0a7cc836cd 100644 --- a/test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.h +++ b/test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.h @@ -19,9 +19,8 @@ #ifndef GRPC_TEST_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_TEST_LIB_H #define GRPC_TEST_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_TEST_LIB_H -#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api.h" -#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h" #include "src/core/tsi/alts/handshaker/transport_security_common_api.h" +#include "src/proto/grpc/gcp/handshaker.upb.h" /** * The first part of this file contains function signatures for de-serializing @@ -30,114 +29,27 @@ * service. */ -/** - * This method creates a ALTS handshaker request that is used to hold - * de-serialized result. - */ -grpc_gcp_handshaker_req* grpc_gcp_handshaker_decoded_req_create( - grpc_gcp_handshaker_req_type type); - -/* This method de-serializes a ALTS handshaker request. */ -bool grpc_gcp_handshaker_req_decode(grpc_slice slice, - grpc_gcp_handshaker_req* req); - -/* This method serializes a ALTS handshaker response. */ -bool grpc_gcp_handshaker_resp_encode(grpc_gcp_handshaker_resp* resp, - grpc_slice* slice); - -/* This method sets application protocol of ALTS handshaker response. */ -bool grpc_gcp_handshaker_resp_set_application_protocol( - grpc_gcp_handshaker_resp* resp, const char* application_protocol); - -/* This method sets record protocol of ALTS handshaker response. */ -bool grpc_gcp_handshaker_resp_set_record_protocol( - grpc_gcp_handshaker_resp* resp, const char* record_protocol); - -/* This method sets key_data of ALTS handshaker response. */ -bool grpc_gcp_handshaker_resp_set_key_data(grpc_gcp_handshaker_resp* resp, - const char* key_data, size_t size); - -/* This method sets local identity's hostname for ALTS handshaker response. */ -bool grpc_gcp_handshaker_resp_set_local_identity_hostname( - grpc_gcp_handshaker_resp* resp, const char* hostname); - -/** - * This method sets local identity's service account for ALTS handshaker - * response. - */ -bool grpc_gcp_handshaker_resp_set_local_identity_service_account( - grpc_gcp_handshaker_resp* resp, const char* service_account); - -/* This method sets peer identity's hostname for ALTS handshaker response. */ -bool grpc_gcp_handshaker_resp_set_peer_identity_hostname( - grpc_gcp_handshaker_resp* resp, const char* hostname); - -/** - * This method sets peer identity's service account for ALTS handshaker - * response. - */ -bool grpc_gcp_handshaker_resp_set_peer_identity_service_account( - grpc_gcp_handshaker_resp* resp, const char* service_account); - -/* This method sets keep_channel_open for ALTS handshaker response. */ -bool grpc_gcp_handshaker_resp_set_channel_open(grpc_gcp_handshaker_resp* resp, - bool keep_channel_open); - -/* This method sets code for ALTS handshaker response. */ -bool grpc_gcp_handshaker_resp_set_code(grpc_gcp_handshaker_resp* resp, - uint32_t code); - -/* This method sets details for ALTS handshaker response. */ -bool grpc_gcp_handshaker_resp_set_details(grpc_gcp_handshaker_resp* resp, - const char* details); - -/* This method sets out_frames for ALTS handshaker response. */ -bool grpc_gcp_handshaker_resp_set_out_frames(grpc_gcp_handshaker_resp* resp, - const char* out_frames, - size_t size); - /* This method sets peer_rpc_versions for ALTS handshaker response. */ bool grpc_gcp_handshaker_resp_set_peer_rpc_versions( - grpc_gcp_handshaker_resp* resp, uint32_t max_major, uint32_t max_minor, - uint32_t min_major, uint32_t min_minor); - -/* This method sets bytes_consumed for ALTS handshaker response. */ -bool grpc_gcp_handshaker_resp_set_bytes_consumed(grpc_gcp_handshaker_resp* resp, - int32_t bytes_consumed); - -/* This method serializes ALTS handshaker response. */ -bool grpc_gcp_handshaker_resp_encode(grpc_gcp_handshaker_resp* resp, - grpc_slice* slice); + grpc_gcp_HandshakerResp* resp, upb_arena* arena, uint32_t max_major, + uint32_t max_minor, uint32_t min_major, uint32_t min_minor); /* This method de-serializes ALTS handshaker request. */ -bool grpc_gcp_handshaker_req_decode(grpc_slice slice, - grpc_gcp_handshaker_req* req); +grpc_gcp_HandshakerReq* grpc_gcp_handshaker_req_decode(grpc_slice slice, + upb_arena* arena); -/** - * The second part contains function signatures for checking equality of a pair - * of ALTS handshake requests/responses. - */ - -/* This method checks equality of two client_start handshaker requests. */ -bool grpc_gcp_handshaker_client_start_req_equals( - grpc_gcp_start_client_handshake_req* l_req, - grpc_gcp_start_client_handshake_req* r_req); - -/* This method checks equality of two server_start handshaker requests. */ -bool grpc_gcp_handshaker_server_start_req_equals( - grpc_gcp_start_server_handshake_req* l_req, - grpc_gcp_start_server_handshake_req* r_req); - -/* This method checks equality of two ALTS handshaker requests. */ -bool grpc_gcp_handshaker_req_equals(grpc_gcp_handshaker_req* l_req, - grpc_gcp_handshaker_req* r_req); +/* This method checks equality of two ALTS handshaker responses. */ +bool grpc_gcp_handshaker_resp_equals(const grpc_gcp_HandshakerResp* l_resp, + const grpc_gcp_HandshakerResp* r_resp); /* This method checks equality of two handshaker response results. */ bool grpc_gcp_handshaker_resp_result_equals( - grpc_gcp_handshaker_result* l_result, grpc_gcp_handshaker_result* r_result); + const grpc_gcp_HandshakerResult* l_result, + const grpc_gcp_HandshakerResult* r_result); -/* This method checks equality of two ALTS handshaker responses. */ -bool grpc_gcp_handshaker_resp_equals(grpc_gcp_handshaker_resp* l_resp, - grpc_gcp_handshaker_resp* r_resp); +/* This method checks equality of two handshaker response statuses. */ +bool grpc_gcp_handshaker_resp_status_equals( + const grpc_gcp_HandshakerStatus* l_status, + const grpc_gcp_HandshakerStatus* r_status); #endif // GRPC_TEST_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_TEST_LIB_H diff --git a/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc b/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc index 316ff138160..37731379f22 100644 --- a/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc +++ b/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc @@ -110,55 +110,64 @@ static void wait(notification* n) { */ static grpc_byte_buffer* generate_handshaker_response( alts_handshaker_response_type type) { - grpc_gcp_handshaker_resp* resp = grpc_gcp_handshaker_resp_create(); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_code(resp, 0)); + upb::Arena arena; + grpc_gcp_HandshakerResult* result; + grpc_gcp_Identity* peer_identity; + grpc_gcp_HandshakerResp* resp = grpc_gcp_HandshakerResp_new(arena.ptr()); + grpc_gcp_HandshakerStatus* status = + grpc_gcp_HandshakerResp_mutable_status(resp, arena.ptr()); + grpc_gcp_HandshakerStatus_set_code(status, 0); switch (type) { case INVALID: break; case CLIENT_START: case SERVER_START: - GPR_ASSERT(grpc_gcp_handshaker_resp_set_out_frames( - resp, ALTS_TSI_HANDSHAKER_TEST_OUT_FRAME, - strlen(ALTS_TSI_HANDSHAKER_TEST_OUT_FRAME))); + grpc_gcp_HandshakerResp_set_out_frames( + resp, upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_OUT_FRAME)); break; case CLIENT_NEXT: - GPR_ASSERT(grpc_gcp_handshaker_resp_set_out_frames( - resp, ALTS_TSI_HANDSHAKER_TEST_OUT_FRAME, - strlen(ALTS_TSI_HANDSHAKER_TEST_OUT_FRAME))); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_peer_identity_service_account( - resp, ALTS_TSI_HANDSHAKER_TEST_PEER_IDENTITY)); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_bytes_consumed( - resp, strlen(ALTS_TSI_HANDSHAKER_TEST_CONSUMED_BYTES))); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_key_data( - resp, ALTS_TSI_HANDSHAKER_TEST_KEY_DATA, - strlen(ALTS_TSI_HANDSHAKER_TEST_KEY_DATA))); + grpc_gcp_HandshakerResp_set_out_frames( + resp, upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_OUT_FRAME)); + grpc_gcp_HandshakerResp_set_bytes_consumed( + resp, strlen(ALTS_TSI_HANDSHAKER_TEST_CONSUMED_BYTES)); + result = grpc_gcp_HandshakerResp_mutable_result(resp, arena.ptr()); + peer_identity = + grpc_gcp_HandshakerResult_mutable_peer_identity(result, arena.ptr()); + grpc_gcp_Identity_set_service_account( + peer_identity, + upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_PEER_IDENTITY)); + grpc_gcp_HandshakerResult_set_key_data( + result, upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_KEY_DATA)); GPR_ASSERT(grpc_gcp_handshaker_resp_set_peer_rpc_versions( - resp, ALTS_TSI_HANDSHAKER_TEST_MAX_RPC_VERSION_MAJOR, + resp, arena.ptr(), ALTS_TSI_HANDSHAKER_TEST_MAX_RPC_VERSION_MAJOR, ALTS_TSI_HANDSHAKER_TEST_MAX_RPC_VERSION_MINOR, ALTS_TSI_HANDSHAKER_TEST_MIN_RPC_VERSION_MAJOR, ALTS_TSI_HANDSHAKER_TEST_MIN_RPC_VERSION_MINOR)); break; case SERVER_NEXT: - GPR_ASSERT(grpc_gcp_handshaker_resp_set_peer_identity_service_account( - resp, ALTS_TSI_HANDSHAKER_TEST_PEER_IDENTITY)); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_bytes_consumed( - resp, strlen(ALTS_TSI_HANDSHAKER_TEST_OUT_FRAME))); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_key_data( - resp, ALTS_TSI_HANDSHAKER_TEST_KEY_DATA, - strlen(ALTS_TSI_HANDSHAKER_TEST_KEY_DATA))); + grpc_gcp_HandshakerResp_set_bytes_consumed( + resp, strlen(ALTS_TSI_HANDSHAKER_TEST_OUT_FRAME)); + result = grpc_gcp_HandshakerResp_mutable_result(resp, arena.ptr()); + peer_identity = + grpc_gcp_HandshakerResult_mutable_peer_identity(result, arena.ptr()); + grpc_gcp_Identity_set_service_account( + peer_identity, + upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_PEER_IDENTITY)); + grpc_gcp_HandshakerResult_set_key_data( + result, upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_KEY_DATA)); GPR_ASSERT(grpc_gcp_handshaker_resp_set_peer_rpc_versions( - resp, ALTS_TSI_HANDSHAKER_TEST_MAX_RPC_VERSION_MAJOR, + resp, arena.ptr(), ALTS_TSI_HANDSHAKER_TEST_MAX_RPC_VERSION_MAJOR, ALTS_TSI_HANDSHAKER_TEST_MAX_RPC_VERSION_MINOR, ALTS_TSI_HANDSHAKER_TEST_MIN_RPC_VERSION_MAJOR, ALTS_TSI_HANDSHAKER_TEST_MIN_RPC_VERSION_MINOR)); break; case FAILED: - GPR_ASSERT( - grpc_gcp_handshaker_resp_set_code(resp, 3 /* INVALID ARGUMENT */)); + grpc_gcp_HandshakerStatus_set_code(status, 3 /* INVALID ARGUMENT */); break; } - grpc_slice slice; - GPR_ASSERT(grpc_gcp_handshaker_resp_encode(resp, &slice)); + size_t buf_len; + char* buf = grpc_gcp_HandshakerResp_serialize(resp, arena.ptr(), &buf_len); + grpc_slice slice = gpr_slice_from_copied_buffer(buf, buf_len); if (type == INVALID) { grpc_slice bad_slice = grpc_slice_split_head(&slice, GRPC_SLICE_LENGTH(slice) - 1); @@ -169,7 +178,6 @@ static grpc_byte_buffer* generate_handshaker_response( grpc_byte_buffer* buffer = grpc_raw_byte_buffer_create(&slice, 1 /* number of slices */); grpc_slice_unref(slice); - grpc_gcp_handshaker_resp_destroy(resp); return buffer; } diff --git a/test/core/tsi/alts/handshaker/alts_tsi_utils_test.cc b/test/core/tsi/alts/handshaker/alts_tsi_utils_test.cc index 8d75d35368d..9b4c9f87d3e 100644 --- a/test/core/tsi/alts/handshaker/alts_tsi_utils_test.cc +++ b/test/core/tsi/alts/handshaker/alts_tsi_utils_test.cc @@ -36,18 +36,20 @@ static void convert_to_tsi_result_test() { } static void deserialize_response_test() { - grpc_gcp_handshaker_resp* resp = grpc_gcp_handshaker_resp_create(); - GPR_ASSERT(grpc_gcp_handshaker_resp_set_out_frames( - resp, ALTS_TSI_UTILS_TEST_OUT_FRAME, - strlen(ALTS_TSI_UTILS_TEST_OUT_FRAME))); - grpc_slice slice; - GPR_ASSERT(grpc_gcp_handshaker_resp_encode(resp, &slice)); + upb::Arena arena; + grpc_gcp_HandshakerResp* resp = grpc_gcp_HandshakerResp_new(arena.ptr()); + grpc_gcp_HandshakerResp_set_out_frames( + resp, upb_strview_makez(ALTS_TSI_UTILS_TEST_OUT_FRAME)); + size_t buf_len; + char* buf = grpc_gcp_HandshakerResp_serialize(resp, arena.ptr(), &buf_len); + grpc_slice slice = grpc_slice_from_copied_buffer(buf, buf_len); /* Valid serialization. */ + upb::Arena arena2; grpc_byte_buffer* buffer = grpc_raw_byte_buffer_create(&slice, 1 /* number of slices */); - grpc_gcp_handshaker_resp* decoded_resp = - alts_tsi_utils_deserialize_response(buffer); + grpc_gcp_HandshakerResp* decoded_resp = + alts_tsi_utils_deserialize_response(buffer, arena2.ptr()); GPR_ASSERT(grpc_gcp_handshaker_resp_equals(resp, decoded_resp)); grpc_byte_buffer_destroy(buffer); @@ -55,14 +57,13 @@ static void deserialize_response_test() { grpc_slice bad_slice = grpc_slice_split_head(&slice, GRPC_SLICE_LENGTH(slice) - 1); buffer = grpc_raw_byte_buffer_create(&bad_slice, 1 /* number of slices */); - GPR_ASSERT(alts_tsi_utils_deserialize_response(buffer) == nullptr); + GPR_ASSERT(alts_tsi_utils_deserialize_response(buffer, arena2.ptr()) == + nullptr); /* Clean up. */ grpc_slice_unref(slice); grpc_slice_unref(bad_slice); grpc_byte_buffer_destroy(buffer); - grpc_gcp_handshaker_resp_destroy(resp); - grpc_gcp_handshaker_resp_destroy(decoded_resp); } int main(int argc, char** argv) { diff --git a/test/core/tsi/alts/handshaker/transport_security_common_api_test.cc b/test/core/tsi/alts/handshaker/transport_security_common_api_test.cc index 6ff1357c270..a2c3d48ca53 100644 --- a/test/core/tsi/alts/handshaker/transport_security_common_api_test.cc +++ b/test/core/tsi/alts/handshaker/transport_security_common_api_test.cc @@ -31,25 +31,17 @@ static bool grpc_gcp_rpc_protocol_versions_equal( grpc_gcp_rpc_protocol_versions* l_versions, grpc_gcp_rpc_protocol_versions* r_versions) { GPR_ASSERT(l_versions != nullptr && r_versions != nullptr); - if ((l_versions->has_max_rpc_version ^ r_versions->has_max_rpc_version) | - (l_versions->has_min_rpc_version ^ r_versions->has_min_rpc_version)) { + if ((l_versions->max_rpc_version.major != + r_versions->max_rpc_version.major) || + (l_versions->max_rpc_version.minor != + r_versions->max_rpc_version.minor)) { return false; } - if (l_versions->has_max_rpc_version) { - if ((l_versions->max_rpc_version.major != - r_versions->max_rpc_version.major) || - (l_versions->max_rpc_version.minor != - r_versions->max_rpc_version.minor)) { - return false; - } - } - if (l_versions->has_min_rpc_version) { - if ((l_versions->min_rpc_version.major != - r_versions->min_rpc_version.major) || - (l_versions->min_rpc_version.minor != - r_versions->min_rpc_version.minor)) { - return false; - } + if ((l_versions->min_rpc_version.major != + r_versions->min_rpc_version.major) || + (l_versions->min_rpc_version.minor != + r_versions->min_rpc_version.minor)) { + return false; } return true; } @@ -61,25 +53,14 @@ static void test_success() { &version, kMaxRpcVersionMajor, kMaxRpcVersionMinor)); GPR_ASSERT(grpc_gcp_rpc_protocol_versions_set_min( &version, kMinRpcVersionMajor, kMinRpcVersionMinor)); - /* Serializes to raw bytes. */ - size_t encoded_length = - grpc_gcp_rpc_protocol_versions_encode_length(&version); - uint8_t* encoded_bytes = static_cast(gpr_malloc(encoded_length)); - GPR_ASSERT(grpc_gcp_rpc_protocol_versions_encode_to_raw_bytes( - &version, encoded_bytes, encoded_length)); - grpc_slice encoded_slice; /* Serializes to grpc slice. */ + grpc_slice encoded_slice; GPR_ASSERT(grpc_gcp_rpc_protocol_versions_encode(&version, &encoded_slice)); - /* Checks serialized raw bytes and serialized grpc slice have same content. */ - GPR_ASSERT(encoded_length == GRPC_SLICE_LENGTH(encoded_slice)); - GPR_ASSERT(memcmp(encoded_bytes, GRPC_SLICE_START_PTR(encoded_slice), - encoded_length) == 0); /* Deserializes and compares with the original version. */ GPR_ASSERT( grpc_gcp_rpc_protocol_versions_decode(encoded_slice, &decoded_version)); GPR_ASSERT(grpc_gcp_rpc_protocol_versions_equal(&version, &decoded_version)); grpc_slice_unref(encoded_slice); - gpr_free(encoded_bytes); } static void test_failure() { @@ -90,24 +71,14 @@ static void test_failure() { nullptr, kMaxRpcVersionMajor, kMaxRpcVersionMinor)); GPR_ASSERT(!grpc_gcp_rpc_protocol_versions_set_min( nullptr, kMinRpcVersionMajor, kMinRpcVersionMinor)); - GPR_ASSERT(grpc_gcp_rpc_protocol_versions_encode_length(nullptr) == 0); GPR_ASSERT(grpc_gcp_rpc_protocol_versions_set_max( &version, kMaxRpcVersionMajor, kMaxRpcVersionMinor)); GPR_ASSERT(grpc_gcp_rpc_protocol_versions_set_min( &version, kMinRpcVersionMajor, kMinRpcVersionMinor)); - size_t encoded_length = - grpc_gcp_rpc_protocol_versions_encode_length(&version); - uint8_t* encoded_bytes = static_cast(gpr_malloc(encoded_length)); - GPR_ASSERT(!grpc_gcp_rpc_protocol_versions_encode_to_raw_bytes( - nullptr, encoded_bytes, encoded_length)); - GPR_ASSERT(!grpc_gcp_rpc_protocol_versions_encode_to_raw_bytes( - &version, nullptr, encoded_length)); - GPR_ASSERT(!grpc_gcp_rpc_protocol_versions_encode_to_raw_bytes( - &version, encoded_bytes, 0)); GPR_ASSERT(!grpc_gcp_rpc_protocol_versions_encode(nullptr, &encoded_slice)); GPR_ASSERT(!grpc_gcp_rpc_protocol_versions_encode(&version, nullptr)); GPR_ASSERT(!grpc_gcp_rpc_protocol_versions_decode(encoded_slice, nullptr)); - /* Test for nanopb decode. */ + /* Test for upb decode. */ GPR_ASSERT(grpc_gcp_rpc_protocol_versions_encode(&version, &encoded_slice)); grpc_slice bad_slice = grpc_slice_split_head( &encoded_slice, GRPC_SLICE_LENGTH(encoded_slice) - 1); @@ -115,7 +86,6 @@ static void test_failure() { GPR_ASSERT( !grpc_gcp_rpc_protocol_versions_decode(bad_slice, &decoded_version)); grpc_slice_unref(bad_slice); - gpr_free(encoded_bytes); } static void test_copy() { diff --git a/tools/distrib/check_nanopb_output.sh b/tools/distrib/check_nanopb_output.sh index 7317e842b89..573e02e98ff 100755 --- a/tools/distrib/check_nanopb_output.sh +++ b/tools/distrib/check_nanopb_output.sh @@ -15,7 +15,6 @@ set -ex -readonly NANOPB_ALTS_TMP_OUTPUT="$(mktemp -d)" readonly NANOPB_HEALTH_TMP_OUTPUT="$(mktemp -d)" readonly NANOPB_TMP_OUTPUT="$(mktemp -d)" readonly PROTOBUF_INSTALL_PREFIX="$(mktemp -d)" @@ -58,29 +57,3 @@ for NANOPB_OUTPUT_FILE in $NANOPB_HEALTH_TMP_OUTPUT/*.pb.*; do exit 2 fi done - -# -# Checks for handshaker.proto and transport_security_common.proto -# -readonly HANDSHAKER_GRPC_OUTPUT_PATH='src/core/tsi/alts/handshaker' -# nanopb-compile the proto to a temp location -./tools/codegen/core/gen_nano_proto.sh \ - src/core/tsi/alts/handshaker/proto/handshaker.proto \ - "$NANOPB_ALTS_TMP_OUTPUT" \ - "$HANDSHAKER_GRPC_OUTPUT_PATH" -./tools/codegen/core/gen_nano_proto.sh \ - src/core/tsi/alts/handshaker/proto/transport_security_common.proto \ - "$NANOPB_ALTS_TMP_OUTPUT" \ - "$HANDSHAKER_GRPC_OUTPUT_PATH" -./tools/codegen/core/gen_nano_proto.sh \ - src/core/tsi/alts/handshaker/proto/altscontext.proto \ - "$NANOPB_ALTS_TMP_OUTPUT" \ - "$HANDSHAKER_GRPC_OUTPUT_PATH" - -# compare outputs to checked compiled code -for NANOPB_OUTPUT_FILE in $NANOPB_ALTS_TMP_OUTPUT/*.pb.*; do - if ! diff "$NANOPB_OUTPUT_FILE" "src/core/tsi/alts/handshaker/$(basename $NANOPB_OUTPUT_FILE)"; then - echo "Outputs differ: $NANOPB_ALTS_TMP_OUTPUT vs $HANDSHAKER_GRPC_OUTPUT_PATH" - exit 2 - fi -done diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 4579af50ee9..5180fab8635 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1116,6 +1116,12 @@ src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ src/core/ext/upb-generated/google/protobuf/wrappers.upb.h \ src/core/ext/upb-generated/google/rpc/status.upb.c \ src/core/ext/upb-generated/google/rpc/status.upb.h \ +src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c \ +src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h \ +src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c \ +src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h \ +src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \ +src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h \ src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ @@ -1598,10 +1604,6 @@ src/core/tsi/alts/frame_protector/frame_handler.cc \ src/core/tsi/alts/frame_protector/frame_handler.h \ src/core/tsi/alts/handshaker/alts_handshaker_client.cc \ src/core/tsi/alts/handshaker/alts_handshaker_client.h \ -src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc \ -src/core/tsi/alts/handshaker/alts_handshaker_service_api.h \ -src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc \ -src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h \ src/core/tsi/alts/handshaker/alts_shared_resource.cc \ src/core/tsi/alts/handshaker/alts_shared_resource.h \ src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc \ @@ -1609,12 +1611,6 @@ src/core/tsi/alts/handshaker/alts_tsi_handshaker.h \ src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h \ src/core/tsi/alts/handshaker/alts_tsi_utils.cc \ src/core/tsi/alts/handshaker/alts_tsi_utils.h \ -src/core/tsi/alts/handshaker/altscontext.pb.c \ -src/core/tsi/alts/handshaker/altscontext.pb.h \ -src/core/tsi/alts/handshaker/handshaker.pb.c \ -src/core/tsi/alts/handshaker/handshaker.pb.h \ -src/core/tsi/alts/handshaker/transport_security_common.pb.c \ -src/core/tsi/alts/handshaker/transport_security_common.pb.h \ src/core/tsi/alts/handshaker/transport_security_common_api.cc \ src/core/tsi/alts/handshaker/transport_security_common_api.h \ src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc \ @@ -1646,13 +1642,6 @@ src/core/tsi/transport_security.h \ src/core/tsi/transport_security_grpc.cc \ src/core/tsi/transport_security_grpc.h \ src/core/tsi/transport_security_interface.h \ -third_party/nanopb/pb.h \ -third_party/nanopb/pb_common.c \ -third_party/nanopb/pb_common.h \ -third_party/nanopb/pb_decode.c \ -third_party/nanopb/pb_decode.h \ -third_party/nanopb/pb_encode.c \ -third_party/nanopb/pb_encode.h \ third_party/upb/upb/decode.c \ third_party/upb/upb/decode.h \ third_party/upb/upb/encode.c \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 60ba4d7fa18..36e6ef1d48c 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -2575,22 +2575,6 @@ "third_party": false, "type": "target" }, - { - "deps": [ - "alts_test_util", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alts_handshaker_service_api_test", - "src": [ - "test/core/tsi/alts/handshaker/alts_handshaker_service_api_test.cc" - ], - "third_party": false, - "type": "target" - }, { "deps": [ "alts_test_util", @@ -8112,29 +8096,6 @@ "third_party": false, "type": "lib" }, - { - "deps": [ - "nanopb" - ], - "headers": [ - "src/core/tsi/alts/handshaker/altscontext.pb.h", - "src/core/tsi/alts/handshaker/handshaker.pb.h", - "src/core/tsi/alts/handshaker/transport_security_common.pb.h" - ], - "is_filegroup": true, - "language": "c", - "name": "alts_proto", - "src": [ - "src/core/tsi/alts/handshaker/altscontext.pb.c", - "src/core/tsi/alts/handshaker/altscontext.pb.h", - "src/core/tsi/alts/handshaker/handshaker.pb.c", - "src/core/tsi/alts/handshaker/handshaker.pb.h", - "src/core/tsi/alts/handshaker/transport_security_common.pb.c", - "src/core/tsi/alts/handshaker/transport_security_common.pb.h" - ], - "third_party": false, - "type": "filegroup" - }, { "deps": [ "alts_util", @@ -8205,7 +8166,9 @@ "type": "filegroup" }, { - "deps": [], + "deps": [ + "upb" + ], "headers": [ "src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h", "src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h", @@ -8227,10 +8190,9 @@ }, { "deps": [ - "alts_proto", + "alts_upb", "gpr", "grpc_base", - "nanopb", "tsi_interface", "upb" ], @@ -8238,8 +8200,6 @@ "include/grpc/grpc_security.h", "src/core/lib/security/credentials/alts/check_gcp_environment.h", "src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api.h", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h", "src/core/tsi/alts/handshaker/alts_tsi_utils.h", "src/core/tsi/alts/handshaker/transport_security_common_api.h" ], @@ -8257,10 +8217,6 @@ "src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc", "src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h", "src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api.h", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc", - "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h", "src/core/tsi/alts/handshaker/alts_tsi_utils.cc", "src/core/tsi/alts/handshaker/alts_tsi_utils.h", "src/core/tsi/alts/handshaker/transport_security_common_api.cc", @@ -8407,7 +8363,9 @@ "type": "filegroup" }, { - "deps": [], + "deps": [ + "upb" + ], "headers": [ "src/core/ext/upb-generated/google/api/annotations.upb.h", "src/core/ext/upb-generated/google/api/http.upb.h", @@ -9586,7 +9544,8 @@ }, { "deps": [ - "google_api_upb" + "google_api_upb", + "upb" ], "headers": [ "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h" diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 255db94a179..cb5093d586f 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -3251,30 +3251,6 @@ ], "uses_polling": true }, - { - "args": [], - "benchmark": false, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "gtest": false, - "language": "c++", - "name": "alts_handshaker_service_api_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "uses_polling": true - }, { "args": [], "benchmark": false, From e00d7fc179a6eabaf7febe6e1468bff5a0078a98 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 8 Aug 2019 17:53:27 -0700 Subject: [PATCH 254/661] Run executable from bazel instead of bazel run (which did not seem to work) Increased timout limit because no interop_server was make'd b4 hand --- src/objective-c/tests/run_one_test.sh | 10 ++++++++-- src/objective-c/tests/run_one_test_bazel.sh | 12 ++++++++---- src/objective-c/tests/run_tests.sh | 19 +++++++++++++++++-- tools/run_tests/run_tests.py | 4 ++-- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/objective-c/tests/run_one_test.sh b/src/objective-c/tests/run_one_test.sh index 8fb26d75b72..2453072a9d5 100755 --- a/src/objective-c/tests/run_one_test.sh +++ b/src/objective-c/tests/run_one_test.sh @@ -22,10 +22,16 @@ cd $(dirname $0) BAZEL=../../../tools/bazel +INTEROP=../../../bazel-out/darwin-fastbuild/bin/test/cpp/interop/interop_server + [ -d Tests.xcworkspace ] || { ./build_tests.sh } +[ -f $INTEROP ] || { + BAZEL build //test/cpp/interop:interop_server +} + [ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { echo >&2 "Can't find the port server. Start port server with tools/run_tests/start_port_server.py." exit 1 @@ -34,8 +40,8 @@ BAZEL=../../../tools/bazel PLAIN_PORT=$(curl localhost:32766/get) TLS_PORT=$(curl localhost:32766/get) -BAZEL run -- //test/cpp/interop:interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & -BAZEL run -- //test/cpp/interop:interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & +$INTEROP --port=$PLAIN_PORT --max_send_message_size=8388608 & +$INTEROP --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT diff --git a/src/objective-c/tests/run_one_test_bazel.sh b/src/objective-c/tests/run_one_test_bazel.sh index 39c28fb28a5..97065e8545a 100755 --- a/src/objective-c/tests/run_one_test_bazel.sh +++ b/src/objective-c/tests/run_one_test_bazel.sh @@ -20,14 +20,18 @@ set -ev cd $(dirname $0) -BINDIR=../../../bins/$CONFIG - BAZEL=../../../tools/bazel +INTEROP=../../../bazel-out/darwin-fastbuild/bin/test/cpp/interop/interop_server + [ -d Tests.xcworkspace ] || { ./build_tests.sh } +[ -f $INTEROP ] || { + BAZEL build //test/cpp/interop:interop_server +} + [ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { echo >&2 "Can't find the port server. Start port server with tools/run_tests/start_port_server.py." exit 1 @@ -36,8 +40,8 @@ BAZEL=../../../tools/bazel PLAIN_PORT=$(curl localhost:32766/get) TLS_PORT=$(curl localhost:32766/get) -BAZEL run -- //test/cpp/interop:interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & -BAZEL run -- //test/cpp/interop:interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & +$INTEROP --port=$PLAIN_PORT --max_send_message_size=8388608 & +$INTEROP --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh index 916ca15b39f..4ffb0e072d9 100755 --- a/src/objective-c/tests/run_tests.sh +++ b/src/objective-c/tests/run_tests.sh @@ -24,11 +24,26 @@ cd $(dirname $0) BAZEL=../../../tools/bazel +INTEROP=../../../bazel-out/darwin-fastbuild/bin/test/cpp/interop/interop_server + [ -d Tests.xcworkspace ] || { ./build_tests.sh } -BAZEL run -- //test/cpp/interop:interop_server --port=5050 --max_send_message_size=8388608 & -BAZEL run -- //test/cpp/interop:interop_server --port=5051 --max_send_message_size=8388608 --use_tls & + +[ -f $INTEROP ] || { + BAZEL build //test/cpp/interop:interop_server +} + +[ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { + echo >&2 "Can't find the port server. Start port server with tools/run_tests/start_port_server.py." + exit 1 +} + +PLAIN_PORT=$(curl localhost:32766/get) +TLS_PORT=$(curl localhost:32766/get) + +$INTEROP --port=$PLAIN_PORT --max_send_message_size=8388608 & +$INTEROP --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & # Kill them when this script exits. trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 0c3ef0bd57f..c0b87d38087 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1072,7 +1072,7 @@ class ObjCLanguage(object): out.append( self.config.job_spec( ['src/objective-c/tests/build_one_example.sh'], - timeout_seconds=10 * 60, + timeout_seconds=20 * 60, shortname='ios-buildtest-example-sample-frameworks', cpu_cost=1e6, environ={ @@ -1083,7 +1083,7 @@ class ObjCLanguage(object): out.append( self.config.job_spec( ['src/objective-c/tests/build_one_example.sh'], - timeout_seconds=10 * 60, + timeout_seconds=20 * 60, shortname='ios-buildtest-example-switftsample', cpu_cost=1e6, environ={ From f789cffec6bd83d7de60f26a40c1f1ef9883c198 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Thu, 8 Aug 2019 23:44:44 -0700 Subject: [PATCH 255/661] Comment deprecated macros --- src/core/lib/gprpp/memory.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/lib/gprpp/memory.h b/src/core/lib/gprpp/memory.h index 2e7658e4866..be158d118a1 100644 --- a/src/core/lib/gprpp/memory.h +++ b/src/core/lib/gprpp/memory.h @@ -30,6 +30,9 @@ // Add this to a class that want to use Delete(), but has a private or // protected destructor. +// Should not be used in new code. +// TODO(juanlishen): Remove this macro, and instead comment that the public dtor +// should not be used directly. #define GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE \ template \ friend void ::grpc_core::Delete(_Delete_T*); \ @@ -38,6 +41,9 @@ // Add this to a class that want to use New(), but has a private or // protected constructor. +// Should not be used in new code. +// TODO(juanlishen): Remove this macro, and instead comment that the public dtor +// should not be used directly. #define GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_NEW \ template \ friend _New_T* grpc_core::New(_New_Args&&...); From 78a01a5782924d29254ad5f7fed80a1d438b5cd5 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 9 Aug 2019 09:12:18 -0700 Subject: [PATCH 256/661] Update upb to the latest --- bazel/grpc_deps.bzl | 6 +++--- third_party/upb | 2 +- tools/run_tests/sanity/check_submodules.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 7752ab814e5..da7fba2bb45 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -208,9 +208,9 @@ def grpc_deps(): if "upb" not in native.existing_rules(): http_archive( name = "upb", - sha256 = "6e3c81c9e6c609d918b399110a88d10efeab73b2c8eb3131de15658b1ec86141", - strip_prefix = "upb-b70f68269a7d51c5ce372a93742bf6960215ffef", - url = "https://github.com/protocolbuffers/upb/archive/b70f68269a7d51c5ce372a93742bf6960215ffef.tar.gz", + sha256 = "95150db57b51b65f3422c38953956e0f786945d842d76f8ab685fbcd93ab5caa", + strip_prefix = "upb-931bbecbd3230ae7f22efa5d203639facc47f719", + url = "https://github.com/protocolbuffers/upb/archive/931bbecbd3230ae7f22efa5d203639facc47f719.tar.gz", ) if "envoy_api" not in native.existing_rules(): http_archive( diff --git a/third_party/upb b/third_party/upb index b70f68269a7..931bbecbd32 160000 --- a/third_party/upb +++ b/third_party/upb @@ -1 +1 @@ -Subproject commit b70f68269a7d51c5ce372a93742bf6960215ffef +Subproject commit 931bbecbd3230ae7f22efa5d203639facc47f719 diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index 3ed6ebc40ef..d5eb6677796 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -40,7 +40,7 @@ cat << EOF | awk '{ print $1 }' | sort > "$want_submodules" 9245d481eb3e890f708ff2d7dadf2a10c04748ba third_party/libcxxabi (heads/release_60) 09745575a923640154bcf307fba8aedff47f240a third_party/protobuf (v3.7.0-rc.2-247-g09745575) e143189bf6f37b3957fb31743df6a1bcf4a8c685 third_party/protoc-gen-validate (v0.0.10) - b70f68269a7d51c5ce372a93742bf6960215ffef third_party/upb (heads/master) + 931bbecbd3230ae7f22efa5d203639facc47f719 third_party/upb (heads/master) cacf7f1d4e3d44d871b605da3b647f07d718623f third_party/zlib (v1.2.11) EOF From 9d7703710668edf3f04e2363b7c3f6a9a3b063d0 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 9 Aug 2019 10:02:00 -0700 Subject: [PATCH 257/661] clang-format --- gRPC-ProtoRPC.podspec | 2 +- src/compiler/objective_c_plugin.cc | 4 +--- src/objective-c/BUILD | 3 --- src/objective-c/GRPCClient/GRPCCallOptions.h | 13 ------------- src/objective-c/GRPCClient/GRPCTypes.h | 13 +++++++++++++ src/objective-c/ProtoRPC/ProtoService.h | 13 +++++++++++++ src/objective-c/ProtoRPC/ProtoServiceLegacy.h | 13 ------------- src/objective-c/ProtoRPC/ProtoServiceLegacy.m | 2 +- templates/gRPC-ProtoRPC.podspec.template | 2 +- 9 files changed, 30 insertions(+), 35 deletions(-) diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 4a4e5beb9ca..723180be19b 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -69,7 +69,7 @@ Pod::Spec.new do |s| ss.dependency 'Protobuf', '~> 3.0' ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.m", - "src/objective-c/ProtoRPC/ProtoServiceLegacy.{h,m}" + "src/objective-c/ProtoRPC/ProtoServiceLegacy.m" end # CFStream is now default. Leaving this subspec only for compatibility purpose. diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index 682cc28b739..a08064a08bd 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -138,9 +138,7 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { } ::grpc::string system_imports = - (generator_params.no_v1_compatibility - ? SystemImport("ProtoRPC/ProtoService.h") - : SystemImport("ProtoRPC/ProtoServiceLegacy.h")) + + SystemImport("ProtoRPC/ProtoService.h") + (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoRPC.h") : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index 9e0181d9e98..2af1d85f290 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -168,9 +168,6 @@ grpc_objc_library( "ProtoRPC/ProtoRPCLegacy.m", "ProtoRPC/ProtoServiceLegacy.m", ], - hdrs = [ - "ProtoRPC/ProtoServiceLegacy.h", - ], deps = [ ":rx_library", ":proto_objc_rpc_v2", diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.h b/src/objective-c/GRPCClient/GRPCCallOptions.h index d4a60a2a1c7..d01c8285662 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.h +++ b/src/objective-c/GRPCClient/GRPCCallOptions.h @@ -24,19 +24,6 @@ NS_ASSUME_NONNULL_BEGIN @protocol GRPCInterceptorFactory; -/** - * Implement this protocol to provide a token to gRPC when a call is initiated. - */ -@protocol GRPCAuthorizationProtocol - -/** - * This method is called when gRPC is about to start the call. When OAuth token is acquired, - * \a handler is expected to be called with \a token being the new token to be used for this call. - */ -- (void)getTokenWithHandler:(void (^)(NSString *_Nullable token))handler; - -@end - @interface GRPCCallOptions : NSObject // Call parameters diff --git a/src/objective-c/GRPCClient/GRPCTypes.h b/src/objective-c/GRPCClient/GRPCTypes.h index 0aacf0f9d15..8e66d3d3acb 100644 --- a/src/objective-c/GRPCClient/GRPCTypes.h +++ b/src/objective-c/GRPCClient/GRPCTypes.h @@ -172,3 +172,16 @@ extern NSString* const kGRPCTrailersKey; /** The id of a transport implementation. */ typedef char* GRPCTransportId; + +/** + * Implement this protocol to provide a token to gRPC when a call is initiated. + */ +@protocol GRPCAuthorizationProtocol + +/** + * This method is called when gRPC is about to start the call. When OAuth token is acquired, + * \a handler is expected to be called with \a token being the new token to be used for this call. + */ +- (void)getTokenWithHandler:(void (^)(NSString* _Nullable token))handler; + +@end diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index 34aea380668..8543f5dee43 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -26,6 +26,7 @@ @class GRPCUnaryProtoCall; @class GRPCStreamingProtoCall; @protocol GRPCProtoResponseHandler; +@protocol GRXWriteable; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-completeness" @@ -49,6 +50,18 @@ __attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoServ callOptions:(nullable GRPCCallOptions *)callOptions responseClass:(nonnull Class)responseClass; +@end + + @interface ProtoService(Legacy) + + - (instancetype)initWithHost : (NSString *)host packageName + : (NSString *)packageName serviceName : (NSString *)serviceName; + +- (GRPCProtoCall *)RPCToMethod:(NSString *)method + requestsWriter:(GRXWriter *)requestsWriter + responseClass:(Class)responseClass + responsesWriteable:(id)responsesWriteable; + @end #pragma clang diagnostic pop diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.h b/src/objective-c/ProtoRPC/ProtoServiceLegacy.h index 28686f51e37..7b0b7a4de7e 100644 --- a/src/objective-c/ProtoRPC/ProtoServiceLegacy.h +++ b/src/objective-c/ProtoRPC/ProtoServiceLegacy.h @@ -21,16 +21,3 @@ @class GRPCProtoCall; @class GRXWriter; @protocol GRXWriteable; - -@interface ProtoService (Legacy) - -- (instancetype)initWithHost:(NSString *)host - packageName:(NSString *)packageName - serviceName:(NSString *)serviceName; - -- (GRPCProtoCall *)RPCToMethod:(NSString *)method - requestsWriter:(GRXWriter *)requestsWriter - responseClass:(Class)responseClass - responsesWriteable:(id)responsesWriteable; - -@end diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m index b8b2766cdb0..6aa64955381 100644 --- a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m +++ b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m @@ -20,7 +20,7 @@ #import "ProtoMethod.h" #import "ProtoRPCLegacy.h" -#import "ProtoServiceLegacy.h" +#import "ProtoService.h" #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-implementations" diff --git a/templates/gRPC-ProtoRPC.podspec.template b/templates/gRPC-ProtoRPC.podspec.template index b8a881c06a9..6222ea5611a 100644 --- a/templates/gRPC-ProtoRPC.podspec.template +++ b/templates/gRPC-ProtoRPC.podspec.template @@ -71,7 +71,7 @@ ss.dependency 'Protobuf', '~> 3.0' ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.m", - "src/objective-c/ProtoRPC/ProtoServiceLegacy.{h,m}" + "src/objective-c/ProtoRPC/ProtoServiceLegacy.m" end # CFStream is now default. Leaving this subspec only for compatibility purpose. From 3e8e0373d080c676e62efbb3040c3091e919937f Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 9 Aug 2019 10:41:30 -0700 Subject: [PATCH 258/661] add nullability annotation --- src/objective-c/GRPCClient/GRPCTypes.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCTypes.h b/src/objective-c/GRPCClient/GRPCTypes.h index 8e66d3d3acb..c804bca4eaa 100644 --- a/src/objective-c/GRPCClient/GRPCTypes.h +++ b/src/objective-c/GRPCClient/GRPCTypes.h @@ -161,17 +161,17 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) { }; /** Domain of NSError objects produced by gRPC. */ -extern NSString* const kGRPCErrorDomain; +extern NSString* _Nonnull const kGRPCErrorDomain; /** * Keys used in |NSError|'s |userInfo| dictionary to store the response headers * and trailers sent by the server. */ -extern NSString* const kGRPCHeadersKey; -extern NSString* const kGRPCTrailersKey; +extern NSString* _Nonnull const kGRPCHeadersKey; +extern NSString* _Nonnull const kGRPCTrailersKey; /** The id of a transport implementation. */ -typedef char* GRPCTransportId; +typedef char* _Nonnull GRPCTransportId; /** * Implement this protocol to provide a token to gRPC when a call is initiated. @@ -182,6 +182,6 @@ typedef char* GRPCTransportId; * This method is called when gRPC is about to start the call. When OAuth token is acquired, * \a handler is expected to be called with \a token being the new token to be used for this call. */ -- (void)getTokenWithHandler:(void (^)(NSString* _Nullable token))handler; +- (void)getTokenWithHandler:(void (^_Nonnull)(NSString* _Nullable token))handler; @end From eaf26b7ac3f089d3ae75b72ee56a15fb57051ff4 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Fri, 9 Aug 2019 10:47:16 -0700 Subject: [PATCH 259/661] Added missing configs for tvos tests --- src/objective-c/tests/Podfile | 2 +- src/objective-c/tests/run_one_test.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index 442f3599bb1..be935732935 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -103,7 +103,7 @@ post_install do |installer| # the test target 'InteropTestsRemoteWithCronet' # Activate GRPCCall+InternalTests functions for the dedicated build configuration 'Test', which will # be used by all test targets using it. - if /gRPC-(mac|i)OS/.match(target.name) + if /gRPC-(mac|i|tv)OS/.match(target.name) target.build_configurations.each do |config| if config.name == 'Cronet' config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_COMPILE_WITH_CRONET=1 GRPC_TEST_OBJC=1' diff --git a/src/objective-c/tests/run_one_test.sh b/src/objective-c/tests/run_one_test.sh index b74107e4a66..ee83c67a72e 100755 --- a/src/objective-c/tests/run_one_test.sh +++ b/src/objective-c/tests/run_one_test.sh @@ -51,6 +51,8 @@ elif [ $PLATFORM == ios ]; then DESTINATION='name=iPhone 8' elif [ $PLATFORM == macos ]; then DESTINATION='platform=macOS' +elif [ $PLATFORM == tvos ]; then +DESTINATION='platform=tvOS Simulator,name=Apple TV' fi xcodebuild \ From 45dd8be4421b7f1311aea91a5d9628ddeb3d6d53 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Fri, 9 Aug 2019 11:43:21 -0700 Subject: [PATCH 260/661] Use LRS in xds policy --- BUILD | 2 - CMakeLists.txt | 17 +- Makefile | 33 +- build.yaml | 5 +- .../filters/client_channel/client_channel.cc | 6 +- .../ext/filters/client_channel/lb_policy.h | 5 +- .../client_channel/lb_policy/xds/xds.cc | 1245 +++++++++++------ .../lb_policy/xds/xds_client_stats.cc | 183 ++- .../lb_policy/xds/xds_client_stats.h | 210 ++- .../lb_policy/xds/xds_load_balancer_api.cc | 192 ++- .../lb_policy/xds/xds_load_balancer_api.h | 66 +- src/core/lib/gprpp/atomic.h | 4 + src/core/lib/gprpp/map.h | 2 +- src/core/lib/transport/static_metadata.cc | 614 ++++---- src/core/lib/transport/static_metadata.h | 151 +- src/proto/grpc/lb/v2/BUILD | 14 +- ...{xds_for_test.proto => eds_for_test.proto} | 0 src/proto/grpc/lb/v2/lrs_for_test.proto | 180 +++ test/core/end2end/fuzzers/hpack.dictionary | 1 + test/core/util/test_lb_policies.cc | 2 +- test/cpp/end2end/BUILD | 4 +- test/cpp/end2end/xds_end2end_test.cc | 914 ++++++++---- tools/codegen/core/gen_static_metadata.py | 1 + .../generated/sources_and_headers.json | 11 +- 24 files changed, 2574 insertions(+), 1288 deletions(-) rename src/proto/grpc/lb/v2/{xds_for_test.proto => eds_for_test.proto} (100%) create mode 100644 src/proto/grpc/lb/v2/lrs_for_test.proto diff --git a/BUILD b/BUILD index 7d5be55a332..d5e863c552d 100644 --- a/BUILD +++ b/BUILD @@ -1262,7 +1262,6 @@ grpc_cc_library( "envoy_ads_upb", "grpc_base", "grpc_client_channel", - "grpc_lb_upb", "grpc_resolver_fake", ], ) @@ -1286,7 +1285,6 @@ grpc_cc_library( "envoy_ads_upb", "grpc_base", "grpc_client_channel", - "grpc_lb_upb", "grpc_resolver_fake", "grpc_secure", ], diff --git a/CMakeLists.txt b/CMakeLists.txt index 70aaedd08a4..21511bb9738 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17674,17 +17674,24 @@ endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) add_executable(xds_end2end_test - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/xds_for_test.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/xds_for_test.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/xds_for_test.pb.h - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/xds_for_test.grpc.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/eds_for_test.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/eds_for_test.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/lrs_for_test.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/lrs_for_test.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.h test/cpp/end2end/xds_end2end_test.cc third_party/googletest/googletest/src/gtest-all.cc third_party/googletest/googlemock/src/gmock-all.cc ) protobuf_generate_grpc_cpp( - src/proto/grpc/lb/v2/xds_for_test.proto + src/proto/grpc/lb/v2/eds_for_test.proto +) +protobuf_generate_grpc_cpp( + src/proto/grpc/lb/v2/lrs_for_test.proto ) target_include_directories(xds_end2end_test diff --git a/Makefile b/Makefile index ef5963dc441..df0dfa30b40 100644 --- a/Makefile +++ b/Makefile @@ -2700,16 +2700,32 @@ $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc: src/proto/grpc/lb/v1/lo endif ifeq ($(NO_PROTOC),true) -$(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.pb.cc: protoc_dep_error -$(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.grpc.pb.cc: protoc_dep_error +$(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc: protoc_dep_error +$(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.cc: protoc_dep_error else -$(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.pb.cc: src/proto/grpc/lb/v2/xds_for_test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) +$(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc: src/proto/grpc/lb/v2/eds_for_test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $< -$(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.grpc.pb.cc: src/proto/grpc/lb/v2/xds_for_test.proto $(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.pb.cc $(PROTOBUF_DEP) $(PROTOC_PLUGINS) +$(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.cc: src/proto/grpc/lb/v2/eds_for_test.proto $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< +endif + +ifeq ($(NO_PROTOC),true) +$(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.pb.cc: protoc_dep_error +$(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.cc: protoc_dep_error +else + +$(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.pb.cc: src/proto/grpc/lb/v2/lrs_for_test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc + $(E) "[PROTOC] Generating protobuf CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $< + +$(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.cc: src/proto/grpc/lb/v2/lrs_for_test.proto $(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.pb.cc $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.cc $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(Q) mkdir -p `dirname $@` $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< @@ -19744,7 +19760,8 @@ endif XDS_END2END_TEST_SRC = \ - $(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.grpc.pb.cc \ + $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.cc \ + $(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.cc \ test/cpp/end2end/xds_end2end_test.cc \ XDS_END2END_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(XDS_END2END_TEST_SRC)))) @@ -19776,7 +19793,9 @@ endif endif -$(OBJDIR)/$(CONFIG)/src/proto/grpc/lb/v2/xds_for_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(OBJDIR)/$(CONFIG)/src/proto/grpc/lb/v2/eds_for_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a + +$(OBJDIR)/$(CONFIG)/src/proto/grpc/lb/v2/lrs_for_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/cpp/end2end/xds_end2end_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -19787,7 +19806,7 @@ ifneq ($(NO_DEPS),true) -include $(XDS_END2END_TEST_OBJS:.o=.dep) endif endif -$(OBJDIR)/$(CONFIG)/test/cpp/end2end/xds_end2end_test.o: $(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/xds_for_test.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/end2end/xds_end2end_test.o: $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.cc PUBLIC_HEADERS_MUST_BE_C89_SRC = \ diff --git a/build.yaml b/build.yaml index 0b8c1955d27..4bb2e401457 100644 --- a/build.yaml +++ b/build.yaml @@ -833,7 +833,6 @@ filegroups: - grpc_base - grpc_client_channel - grpc_resolver_fake - - grpc_lb_upb - name: grpc_lb_policy_xds_secure headers: - src/core/ext/filters/client_channel/lb_policy/xds/xds.h @@ -852,7 +851,6 @@ filegroups: - grpc_client_channel - grpc_resolver_fake - grpc_secure - - grpc_lb_upb - name: grpc_lb_subchannel_list headers: - src/core/ext/filters/client_channel/lb_policy/subchannel_list.h @@ -6027,7 +6025,8 @@ targets: build: test language: c++ src: - - src/proto/grpc/lb/v2/xds_for_test.proto + - src/proto/grpc/lb/v2/eds_for_test.proto + - src/proto/grpc/lb/v2/lrs_for_test.proto - test/cpp/end2end/xds_end2end_test.cc deps: - grpc++_test_util diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index ac79ae92d5a..767a22e9e59 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -708,7 +708,7 @@ class CallData { LbCallState lb_call_state_; RefCountedPtr connected_subchannel_; void (*lb_recv_trailing_metadata_ready_)( - void* user_data, + void* user_data, grpc_error* error, LoadBalancingPolicy::MetadataInterface* recv_trailing_metadata, LoadBalancingPolicy::CallState* call_state) = nullptr; void* lb_recv_trailing_metadata_ready_user_data_ = nullptr; @@ -2160,8 +2160,8 @@ void CallData::RecvTrailingMetadataReadyForLoadBalancingPolicy( // Invoke callback to LB policy. Metadata trailing_metadata(calld, calld->recv_trailing_metadata_); calld->lb_recv_trailing_metadata_ready_( - calld->lb_recv_trailing_metadata_ready_user_data_, &trailing_metadata, - &calld->lb_call_state_); + calld->lb_recv_trailing_metadata_ready_user_data_, error, + &trailing_metadata, &calld->lb_call_state_); // Chain to original callback. GRPC_CLOSURE_RUN(calld->original_recv_trailing_metadata_ready_, GRPC_ERROR_REF(error)); diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h index a205d333ae8..ea4962cdb77 100644 --- a/src/core/ext/filters/client_channel/lb_policy.h +++ b/src/core/ext/filters/client_channel/lb_policy.h @@ -174,8 +174,11 @@ class LoadBalancingPolicy : public InternallyRefCounted { /// modified by the callback. The callback does not take ownership, /// however, so any data that needs to be used after returning must /// be copied. + // TODO(roth): Replace grpc_error with something better before we allow + // people outside of gRPC team to use this API. void (*recv_trailing_metadata_ready)( - void* user_data, MetadataInterface* recv_trailing_metadata, + void* user_data, grpc_error* error, + MetadataInterface* recv_trailing_metadata, CallState* call_state) = nullptr; void* recv_trailing_metadata_ready_user_data = nullptr; }; diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 851b84b2a71..58c1ebad39e 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -108,6 +108,7 @@ #define GRPC_XDS_RECONNECT_MAX_BACKOFF_SECONDS 120 #define GRPC_XDS_RECONNECT_JITTER 0.2 #define GRPC_XDS_DEFAULT_FALLBACK_TIMEOUT_MS 10000 +#define GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS 1000 namespace grpc_core { @@ -154,95 +155,192 @@ class XdsLb : public LoadBalancingPolicy { void ResetBackoffLocked() override; private: - /// Contains a channel to the LB server and all the data related to the - /// channel. - class BalancerChannelState - : public InternallyRefCounted { + // Contains a channel to the LB server and all the data related to the + // channel. Holds a ref to the xds policy. + class LbChannelState : public InternallyRefCounted { public: - /// Contains a call to the LB server and all the data related to the call. - class BalancerCallState : public InternallyRefCounted { + // An LB call wrapper that can restart a call upon failure. Holds a ref to + // the LB channel. The template parameter is the kind of wrapped LB call. + template + class RetryableLbCall : public InternallyRefCounted> { public: - explicit BalancerCallState(RefCountedPtr lb_chand); + explicit RetryableLbCall(RefCountedPtr lb_chand); - // It's the caller's responsibility to ensure that Orphan() is called from - // inside the combiner. void Orphan() override; - void StartQuery(); + void OnCallFinishedLocked(); - RefCountedPtr client_stats() const { - return client_stats_; - } + T* lb_calld() const { return lb_calld_.get(); } + LbChannelState* lb_chand() const { return lb_chand_.get(); } + + private: + void StartNewCallLocked(); + void StartRetryTimerLocked(); + static void OnRetryTimerLocked(void* arg, grpc_error* error); + + // The wrapped LB call that talks to the LB server. It's instantiated + // every time we start a new call. It's null during call retry backoff. + OrphanablePtr lb_calld_; + // The owing LB channel. + RefCountedPtr lb_chand_; + + // Retry state. + BackOff backoff_; + grpc_timer retry_timer_; + grpc_closure on_retry_timer_; + bool retry_timer_callback_pending_ = false; + + bool shutting_down_ = false; + }; + + // Contains an EDS call to the LB server. + class EdsCallState : public InternallyRefCounted { + public: + // The ctor and dtor should not be used directly. + explicit EdsCallState( + RefCountedPtr> parent); + ~EdsCallState() override; + void Orphan() override; + + RetryableLbCall* parent() const { return parent_.get(); } + LbChannelState* lb_chand() const { return parent_->lb_chand(); } + XdsLb* xdslb_policy() const { return lb_chand()->xdslb_policy(); } bool seen_response() const { return seen_response_; } private: - GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE + static void OnResponseReceivedLocked(void* arg, grpc_error* error); + static void OnStatusReceivedLocked(void* arg, grpc_error* error); + + bool IsCurrentCallOnChannel() const; - ~BalancerCallState(); + // The owning RetryableLbCall<>. + RefCountedPtr> parent_; + bool seen_response_ = false; - XdsLb* xdslb_policy() const { return lb_chand_->xdslb_policy_.get(); } + // Always non-NULL. + grpc_call* lb_call_; - bool IsCurrentCallOnChannel() const { - return this == lb_chand_->lb_calld_.get(); - } + // recv_initial_metadata + grpc_metadata_array initial_metadata_recv_; + + // send_message + grpc_byte_buffer* send_message_payload_ = nullptr; + + // recv_message + grpc_byte_buffer* recv_message_payload_ = nullptr; + grpc_closure on_response_received_; + + // recv_trailing_metadata + grpc_metadata_array trailing_metadata_recv_; + grpc_status_code status_code_; + grpc_slice status_details_; + grpc_closure on_status_received_; + }; + + // Contains an LRS call to the LB server. + class LrsCallState : public InternallyRefCounted { + public: + // The ctor and dtor should not be used directly. + explicit LrsCallState( + RefCountedPtr> parent); + ~LrsCallState() override; - void ScheduleNextClientLoadReportLocked(); - void SendClientLoadReportLocked(); + void Orphan() override; + + void MaybeStartReportingLocked(); + + RetryableLbCall* parent() { return parent_.get(); } + LbChannelState* lb_chand() const { return parent_->lb_chand(); } + XdsLb* xdslb_policy() const { return lb_chand()->xdslb_policy(); } + bool seen_response() const { return seen_response_; } + + private: + // Reports client-side load stats according to a fixed interval. + class Reporter : public InternallyRefCounted { + public: + Reporter(RefCountedPtr parent, + grpc_millis report_interval) + : parent_(std::move(parent)), report_interval_(report_interval) { + GRPC_CLOSURE_INIT( + &on_next_report_timer_, OnNextReportTimerLocked, this, + grpc_combiner_scheduler(xdslb_policy()->combiner())); + GRPC_CLOSURE_INIT( + &on_report_done_, OnReportDoneLocked, this, + grpc_combiner_scheduler(xdslb_policy()->combiner())); + ScheduleNextReportLocked(); + } + + void Orphan() override; - static bool LoadReportCountersAreZero(xds_grpclb_request* request); + private: + void ScheduleNextReportLocked(); + static void OnNextReportTimerLocked(void* arg, grpc_error* error); + void SendReportLocked(); + static void OnReportDoneLocked(void* arg, grpc_error* error); + + bool IsCurrentReporterOnCall() const { + return this == parent_->reporter_.get(); + } + XdsLb* xdslb_policy() const { return parent_->xdslb_policy(); } + + // The owning LRS call. + RefCountedPtr parent_; + + // The load reporting state. + const grpc_millis report_interval_; + bool last_report_counters_were_zero_ = false; + bool next_report_timer_callback_pending_ = false; + grpc_timer next_report_timer_; + grpc_closure on_next_report_timer_; + grpc_closure on_report_done_; + }; - static void MaybeSendClientLoadReportLocked(void* arg, grpc_error* error); static void OnInitialRequestSentLocked(void* arg, grpc_error* error); - static void OnBalancerMessageReceivedLocked(void* arg, grpc_error* error); - static void OnBalancerStatusReceivedLocked(void* arg, grpc_error* error); + static void OnResponseReceivedLocked(void* arg, grpc_error* error); + static void OnStatusReceivedLocked(void* arg, grpc_error* error); + + bool IsCurrentCallOnChannel() const; - // The owning LB channel. - RefCountedPtr lb_chand_; + // The owning RetryableLbCall<>. + RefCountedPtr> parent_; + bool seen_response_ = false; - // The streaming call to the LB server. Always non-NULL. - grpc_call* lb_call_ = nullptr; + // Always non-NULL. + grpc_call* lb_call_; // recv_initial_metadata - grpc_metadata_array lb_initial_metadata_recv_; + grpc_metadata_array initial_metadata_recv_; // send_message grpc_byte_buffer* send_message_payload_ = nullptr; - grpc_closure lb_on_initial_request_sent_; + grpc_closure on_initial_request_sent_; // recv_message grpc_byte_buffer* recv_message_payload_ = nullptr; - grpc_closure lb_on_balancer_message_received_; - bool seen_response_ = false; + grpc_closure on_response_received_; // recv_trailing_metadata - grpc_closure lb_on_balancer_status_received_; - grpc_metadata_array lb_trailing_metadata_recv_; - grpc_status_code lb_call_status_; - grpc_slice lb_call_status_details_; - - // The stats for client-side load reporting associated with this LB call. - // Created after the first serverlist is received. - RefCountedPtr client_stats_; - grpc_millis client_stats_report_interval_ = 0; - grpc_timer client_load_report_timer_; - bool client_load_report_timer_callback_pending_ = false; - bool last_client_load_report_counters_were_zero_ = false; - bool client_load_report_is_due_ = false; - // The closure used for either the load report timer or the callback for - // completion of sending the load report. - grpc_closure client_load_report_closure_; + grpc_metadata_array trailing_metadata_recv_; + grpc_status_code status_code_; + grpc_slice status_details_; + grpc_closure on_status_received_; + + // Load reporting state. + grpc_millis load_reporting_interval_ = 0; + OrphanablePtr reporter_; }; - BalancerChannelState(const char* balancer_name, - const grpc_channel_args& args, - RefCountedPtr parent_xdslb_policy); - ~BalancerChannelState(); + LbChannelState(RefCountedPtr xdslb_policy, const char* balancer_name, + const grpc_channel_args& args); + ~LbChannelState(); void Orphan() override; grpc_channel* channel() const { return channel_; } - BalancerCallState* lb_calld() const { return lb_calld_.get(); } + XdsLb* xdslb_policy() const { return xdslb_policy_.get(); } + EdsCallState* eds_calld() const { return eds_calld_->lb_calld(); } + LrsCallState* lrs_calld() const { return lrs_calld_->lb_calld(); } bool IsCurrentChannel() const { return this == xdslb_policy_->lb_chand_.get(); @@ -250,11 +348,7 @@ class XdsLb : public LoadBalancingPolicy { bool IsPendingChannel() const { return this == xdslb_policy_->pending_lb_chand_.get(); } - bool HasActiveCall() const { return lb_calld_ != nullptr; } - - void StartCallRetryTimerLocked(); - static void OnCallRetryTimerLocked(void* arg, grpc_error* error); - void StartCallLocked(); + bool HasActiveEdsCall() const { return eds_calld_->lb_calld() != nullptr; } void StartConnectivityWatchLocked(); void CancelConnectivityWatchLocked(); @@ -270,29 +364,35 @@ class XdsLb : public LoadBalancingPolicy { grpc_connectivity_state connectivity_ = GRPC_CHANNEL_IDLE; grpc_closure on_connectivity_changed_; - // The data associated with the current LB call. It holds a ref to this LB - // channel. It's instantiated every time we query for backends. It's reset - // whenever the current LB call is no longer needed (e.g., the LB policy is - // shutting down, or the LB call has ended). A non-NULL lb_calld_ always - // contains a non-NULL lb_call_. - OrphanablePtr lb_calld_; - BackOff lb_call_backoff_; - grpc_timer lb_call_retry_timer_; - grpc_closure lb_on_call_retry_; - bool retry_timer_callback_pending_ = false; + // The retryable XDS calls to the LB server. + OrphanablePtr> eds_calld_; + OrphanablePtr> lrs_calld_; }; - // Since pickers are UniquePtrs we use this RefCounted wrapper - // to control references to it by the xds picker and the locality - // entry - class PickerRef : public RefCounted { + // We need this wrapper for the following reasons: + // 1. To process per-locality load reporting. + // 2. Since pickers are UniquePtrs we use this RefCounted wrapper to control + // references to it by the xds picker and the locality entry. + class PickerWrapper : public RefCounted { public: - explicit PickerRef(UniquePtr picker) - : picker_(std::move(picker)) {} - PickResult Pick(PickArgs args) { return picker_->Pick(args); } + PickerWrapper(UniquePtr picker, + RefCountedPtr locality_stats) + : picker_(std::move(picker)), + locality_stats_(std::move(locality_stats)) { + locality_stats_->RefByPicker(); + } + ~PickerWrapper() { locality_stats_->UnrefByPicker(); } + + PickResult Pick(PickArgs args); private: + static void RecordCallCompletion( + void* arg, grpc_error* error, + LoadBalancingPolicy::MetadataInterface* recv_trailing_metadata, + LoadBalancingPolicy::CallState* call_state); + UniquePtr picker_; + RefCountedPtr locality_stats_; }; // The picker will use a stateless weighting algorithm to pick the locality to @@ -304,17 +404,15 @@ class XdsLb : public LoadBalancingPolicy { // proportional to the locality's weight. The start of the range is the // previous value in the vector and is 0 for the first element. using PickerList = - InlinedVector>, 1>; - Picker(RefCountedPtr client_stats, PickerList pickers) - : client_stats_(std::move(client_stats)), - pickers_(std::move(pickers)) {} + InlinedVector>, 1>; + explicit Picker(PickerList pickers) : pickers_(std::move(pickers)) {} PickResult Pick(PickArgs args) override; private: - // Calls the picker of the locality that the key falls within + // Calls the picker of the locality that the key falls within. PickResult PickFromLocality(const uint32_t key, PickArgs args); - RefCountedPtr client_stats_; + PickerList pickers_; }; @@ -386,6 +484,7 @@ class XdsLb : public LoadBalancingPolicy { RefCountedPtr entry_; LoadBalancingPolicy* child_ = nullptr; }; + // Methods for dealing with the child policy. OrphanablePtr CreateChildPolicyLocked( const char* name, const grpc_channel_args* args); @@ -396,7 +495,7 @@ class XdsLb : public LoadBalancingPolicy { RefCountedPtr name_; OrphanablePtr child_policy_; OrphanablePtr pending_child_policy_; - RefCountedPtr picker_ref_; + RefCountedPtr picker_wrapper_; grpc_connectivity_state connectivity_state_; uint32_t locality_weight_; }; @@ -409,6 +508,7 @@ class XdsLb : public LoadBalancingPolicy { private: void PruneLocalities(const XdsLocalityList& locality_list); + Map, OrphanablePtr, XdsLocalityName::Less> map_; @@ -428,7 +528,7 @@ class XdsLb : public LoadBalancingPolicy { // found. Does nothing upon failure. void ParseLbConfig(const ParsedXdsConfig* xds_config); - BalancerChannelState* LatestLbChannel() const { + LbChannelState* LatestLbChannel() const { return pending_lb_chand_ != nullptr ? pending_lb_chand_.get() : lb_chand_.get(); } @@ -454,8 +554,8 @@ class XdsLb : public LoadBalancingPolicy { bool shutting_down_ = false; // The channel for communicating with the LB server. - OrphanablePtr lb_chand_; - OrphanablePtr pending_lb_chand_; + OrphanablePtr lb_chand_; + OrphanablePtr pending_lb_chand_; // Timeout in milliseconds for the LB call. 0 means no deadline. int lb_call_timeout_ms_ = 0; @@ -493,8 +593,45 @@ class XdsLb : public LoadBalancingPolicy { // TODO(mhaidry) : Add a pending locality map that may be swapped with the // the current one when new localities in the pending map are ready // to accept connections + + // The stats for client-side load reporting. + XdsClientStats client_stats_; }; +// +// XdsLb::PickerWrapper::Pick +// + +LoadBalancingPolicy::PickResult XdsLb::PickerWrapper::Pick( + LoadBalancingPolicy::PickArgs args) { + // Forward the pick to the picker returned from the child policy. + PickResult result = picker_->Pick(args); + if (result.type != PickResult::PICK_COMPLETE || + result.subchannel == nullptr || locality_stats_ == nullptr) { + return result; + } + // Record a call started. + locality_stats_->AddCallStarted(); + // Intercept the recv_trailing_metadata op to record call completion. + result.recv_trailing_metadata_ready = RecordCallCompletion; + result.recv_trailing_metadata_ready_user_data = + locality_stats_->Ref(DEBUG_LOCATION, "LocalityStats+call").release(); + return result; +} + +// Note that the following callback does not run in either the control plane +// combiner or the data plane combiner. +void XdsLb::PickerWrapper::RecordCallCompletion( + void* arg, grpc_error* error, + LoadBalancingPolicy::MetadataInterface* recv_trailing_metadata, + LoadBalancingPolicy::CallState* call_state) { + XdsClientStats::LocalityStats* locality_stats = + static_cast(arg); + const bool call_failed = error != GRPC_ERROR_NONE; + locality_stats->AddCallFinished(call_failed); + locality_stats->Unref(DEBUG_LOCATION, "LocalityStats+call"); +} + // // XdsLb::Picker // @@ -506,13 +643,7 @@ XdsLb::PickResult XdsLb::Picker::Pick(PickArgs args) { (rand() * pickers_[pickers_.size() - 1].first) / RAND_MAX; // Forward pick to whichever locality maps to the range in which the // random number falls in. - PickResult result = PickFromLocality(key, args); - // If pick succeeded, add client stats. - if (result.type == PickResult::PICK_COMPLETE && - result.subchannel != nullptr && client_stats_ != nullptr) { - // TODO(roth): Add support for client stats. - } - return result; + return PickFromLocality(key, args); } XdsLb::PickResult XdsLb::Picker::PickFromLocality(const uint32_t key, @@ -620,99 +751,46 @@ void XdsLb::FallbackHelper::AddTraceEvent(TraceSeverity severity, } // -// XdsLb::BalancerChannelState +// XdsLb::LbChannelState // -XdsLb::BalancerChannelState::BalancerChannelState( - const char* balancer_name, const grpc_channel_args& args, - RefCountedPtr parent_xdslb_policy) - : InternallyRefCounted(&grpc_lb_xds_trace), - xdslb_policy_(std::move(parent_xdslb_policy)), - lb_call_backoff_( - BackOff::Options() - .set_initial_backoff(GRPC_XDS_INITIAL_CONNECT_BACKOFF_SECONDS * - 1000) - .set_multiplier(GRPC_XDS_RECONNECT_BACKOFF_MULTIPLIER) - .set_jitter(GRPC_XDS_RECONNECT_JITTER) - .set_max_backoff(GRPC_XDS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)) { - GRPC_CLOSURE_INIT(&on_connectivity_changed_, - &XdsLb::BalancerChannelState::OnConnectivityChangedLocked, +XdsLb::LbChannelState::LbChannelState(RefCountedPtr xdslb_policy, + const char* balancer_name, + const grpc_channel_args& args) + : InternallyRefCounted(&grpc_lb_xds_trace), + xdslb_policy_(std::move(xdslb_policy)) { + GRPC_CLOSURE_INIT(&on_connectivity_changed_, OnConnectivityChangedLocked, this, grpc_combiner_scheduler(xdslb_policy_->combiner())); channel_ = xdslb_policy_->channel_control_helper()->CreateChannel( balancer_name, args); GPR_ASSERT(channel_ != nullptr); - StartCallLocked(); -} - -XdsLb::BalancerChannelState::~BalancerChannelState() { - xdslb_policy_.reset(DEBUG_LOCATION, "BalancerChannelState"); - grpc_channel_destroy(channel_); -} - -void XdsLb::BalancerChannelState::Orphan() { - shutting_down_ = true; - lb_calld_.reset(); - if (retry_timer_callback_pending_) grpc_timer_cancel(&lb_call_retry_timer_); - Unref(DEBUG_LOCATION, "lb_channel_orphaned"); + eds_calld_.reset(New>( + Ref(DEBUG_LOCATION, "LbChannelState+eds"))); + lrs_calld_.reset(New>( + Ref(DEBUG_LOCATION, "LbChannelState+lrs"))); } -void XdsLb::BalancerChannelState::StartCallRetryTimerLocked() { - grpc_millis next_try = lb_call_backoff_.NextAttemptTime(); +XdsLb::LbChannelState::~LbChannelState() { if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { - gpr_log(GPR_INFO, - "[xdslb %p] Failed to connect to LB server (lb_chand: %p)...", - xdslb_policy_.get(), this); - grpc_millis timeout = next_try - ExecCtx::Get()->Now(); - if (timeout > 0) { - gpr_log(GPR_INFO, "[xdslb %p] ... retry_timer_active in %" PRId64 "ms.", - xdslb_policy_.get(), timeout); - } else { - gpr_log(GPR_INFO, "[xdslb %p] ... retry_timer_active immediately.", - xdslb_policy_.get()); - } - } - Ref(DEBUG_LOCATION, "on_balancer_call_retry_timer").release(); - GRPC_CLOSURE_INIT(&lb_on_call_retry_, &OnCallRetryTimerLocked, this, - grpc_combiner_scheduler(xdslb_policy_->combiner())); - grpc_timer_init(&lb_call_retry_timer_, next_try, &lb_on_call_retry_); - retry_timer_callback_pending_ = true; -} - -void XdsLb::BalancerChannelState::OnCallRetryTimerLocked(void* arg, - grpc_error* error) { - BalancerChannelState* lb_chand = static_cast(arg); - lb_chand->retry_timer_callback_pending_ = false; - if (!lb_chand->shutting_down_ && error == GRPC_ERROR_NONE && - lb_chand->lb_calld_ == nullptr) { - if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { - gpr_log(GPR_INFO, - "[xdslb %p] Restarting call to LB server (lb_chand: %p)", - lb_chand->xdslb_policy_.get(), lb_chand); - } - lb_chand->StartCallLocked(); + gpr_log(GPR_INFO, "[xdslb %p] Destroying LB channel %p", xdslb_policy(), + this); } - lb_chand->Unref(DEBUG_LOCATION, "on_balancer_call_retry_timer"); + grpc_channel_destroy(channel_); } -void XdsLb::BalancerChannelState::StartCallLocked() { - if (shutting_down_) return; - GPR_ASSERT(channel_ != nullptr); - GPR_ASSERT(lb_calld_ == nullptr); - lb_calld_ = MakeOrphanable(Ref()); - if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { - gpr_log(GPR_INFO, - "[xdslb %p] Query for backends (lb_chand: %p, lb_calld: %p)", - xdslb_policy_.get(), this, lb_calld_.get()); - } - lb_calld_->StartQuery(); +void XdsLb::LbChannelState::Orphan() { + shutting_down_ = true; + eds_calld_.reset(); + lrs_calld_.reset(); + Unref(DEBUG_LOCATION, "LbChannelState+orphaned"); } -void XdsLb::BalancerChannelState::StartConnectivityWatchLocked() { +void XdsLb::LbChannelState::StartConnectivityWatchLocked() { grpc_channel_element* client_channel_elem = grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel_)); GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter); // Ref held by callback. - Ref(DEBUG_LOCATION, "watch_lb_channel_connectivity").release(); + Ref(DEBUG_LOCATION, "LbChannelState+start_watch").release(); grpc_client_channel_watch_connectivity_state( client_channel_elem, grpc_polling_entity_create_from_pollset_set( @@ -720,7 +798,7 @@ void XdsLb::BalancerChannelState::StartConnectivityWatchLocked() { &connectivity_, &on_connectivity_changed_, nullptr); } -void XdsLb::BalancerChannelState::CancelConnectivityWatchLocked() { +void XdsLb::LbChannelState::CancelConnectivityWatchLocked() { grpc_channel_element* client_channel_elem = grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel_)); GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter); @@ -731,9 +809,9 @@ void XdsLb::BalancerChannelState::CancelConnectivityWatchLocked() { nullptr, &on_connectivity_changed_, nullptr); } -void XdsLb::BalancerChannelState::OnConnectivityChangedLocked( - void* arg, grpc_error* error) { - BalancerChannelState* self = static_cast(arg); +void XdsLb::LbChannelState::OnConnectivityChangedLocked(void* arg, + grpc_error* error) { + LbChannelState* self = static_cast(arg); if (!self->shutting_down_ && self->xdslb_policy_->fallback_at_startup_checks_pending_) { if (self->connectivity_ != GRPC_CHANNEL_TRANSIENT_FAILURE) { @@ -760,22 +838,113 @@ void XdsLb::BalancerChannelState::OnConnectivityChangedLocked( self->xdslb_policy_->UpdateFallbackPolicyLocked(); } // Done watching connectivity state, so drop ref. - self->Unref(DEBUG_LOCATION, "watch_lb_channel_connectivity"); + self->Unref(DEBUG_LOCATION, "LbChannelState+watch_done"); } // -// XdsLb::BalancerChannelState::BalancerCallState +// XdsLb::LbChannelState::RetryableLbCall<> // -XdsLb::BalancerChannelState::BalancerCallState::BalancerCallState( - RefCountedPtr lb_chand) - : InternallyRefCounted(&grpc_lb_xds_trace), - lb_chand_(std::move(lb_chand)) { - GPR_ASSERT(xdslb_policy() != nullptr); - GPR_ASSERT(!xdslb_policy()->shutting_down_); +template +XdsLb::LbChannelState::RetryableLbCall::RetryableLbCall( + RefCountedPtr lb_chand) + : lb_chand_(std::move(lb_chand)), + backoff_( + BackOff::Options() + .set_initial_backoff(GRPC_XDS_INITIAL_CONNECT_BACKOFF_SECONDS * + 1000) + .set_multiplier(GRPC_XDS_RECONNECT_BACKOFF_MULTIPLIER) + .set_jitter(GRPC_XDS_RECONNECT_JITTER) + .set_max_backoff(GRPC_XDS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)) { + GRPC_CLOSURE_INIT( + &on_retry_timer_, OnRetryTimerLocked, this, + grpc_combiner_scheduler(lb_chand_->xdslb_policy()->combiner())); + StartNewCallLocked(); +} + +template +void XdsLb::LbChannelState::RetryableLbCall::Orphan() { + shutting_down_ = true; + lb_calld_.reset(); + if (retry_timer_callback_pending_) grpc_timer_cancel(&retry_timer_); + this->Unref(DEBUG_LOCATION, "RetryableLbCall+orphaned"); +} + +template +void XdsLb::LbChannelState::RetryableLbCall::OnCallFinishedLocked() { + const bool seen_response = lb_calld_->seen_response(); + lb_calld_.reset(); + if (seen_response) { + // If we lost connection to the LB server, reset backoff and restart the LB + // call immediately. + backoff_.Reset(); + StartNewCallLocked(); + } else { + // If we failed to connect to the LB server, retry later. + StartRetryTimerLocked(); + } +} + +template +void XdsLb::LbChannelState::RetryableLbCall::StartNewCallLocked() { + if (shutting_down_) return; + GPR_ASSERT(lb_chand_->channel_ != nullptr); + GPR_ASSERT(lb_calld_ == nullptr); + if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { + gpr_log(GPR_INFO, + "[xdslb %p] Start new call from retryable call (lb_chand: %p, " + "retryable call: %p)", + lb_chand()->xdslb_policy(), lb_chand(), this); + } + lb_calld_ = MakeOrphanable( + this->Ref(DEBUG_LOCATION, "RetryableLbCall+start_new_call")); +} + +template +void XdsLb::LbChannelState::RetryableLbCall::StartRetryTimerLocked() { + if (shutting_down_) return; + const grpc_millis next_attempt_time = backoff_.NextAttemptTime(); + if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { + grpc_millis timeout = GPR_MAX(next_attempt_time - ExecCtx::Get()->Now(), 0); + gpr_log(GPR_INFO, + "[xdslb %p] Failed to connect to LB server (lb_chand: %p) " + "retry timer will fire in %" PRId64 "ms.", + lb_chand()->xdslb_policy(), lb_chand(), timeout); + } + this->Ref(DEBUG_LOCATION, "RetryableLbCall+retry_timer_start").release(); + grpc_timer_init(&retry_timer_, next_attempt_time, &on_retry_timer_); + retry_timer_callback_pending_ = true; +} + +template +void XdsLb::LbChannelState::RetryableLbCall::OnRetryTimerLocked( + void* arg, grpc_error* error) { + RetryableLbCall* lb_calld = static_cast(arg); + lb_calld->retry_timer_callback_pending_ = false; + if (!lb_calld->shutting_down_ && error == GRPC_ERROR_NONE) { + if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { + gpr_log(GPR_INFO, + "[xdslb %p] Retry timer fires (lb_chand: %p, retryable call: %p)", + lb_calld->lb_chand()->xdslb_policy(), lb_calld->lb_chand(), + lb_calld); + } + lb_calld->StartNewCallLocked(); + } + lb_calld->Unref(DEBUG_LOCATION, "RetryableLbCall+retry_timer_done"); +} + +// +// XdsLb::LbChannelState::EdsCallState +// + +XdsLb::LbChannelState::EdsCallState::EdsCallState( + RefCountedPtr> parent) + : InternallyRefCounted(&grpc_lb_xds_trace), + parent_(std::move(parent)) { // Init the LB call. Note that the LB call will progress every time there's - // activity in xdslb_policy_->interested_parties(), which is comprised of + // activity in xdslb_policy()->interested_parties(), which is comprised of // the polling entities from client_channel. + GPR_ASSERT(xdslb_policy() != nullptr); GPR_ASSERT(xdslb_policy()->server_name_ != nullptr); GPR_ASSERT(xdslb_policy()->server_name_[0] != '\0'); const grpc_millis deadline = @@ -784,10 +953,11 @@ XdsLb::BalancerChannelState::BalancerCallState::BalancerCallState( : ExecCtx::Get()->Now() + xdslb_policy()->lb_call_timeout_ms_; // Create an LB call with the specified method name. lb_call_ = grpc_channel_create_pollset_set_call( - lb_chand_->channel_, nullptr, GRPC_PROPAGATE_DEFAULTS, + lb_chand()->channel_, nullptr, GRPC_PROPAGATE_DEFAULTS, xdslb_policy()->interested_parties(), GRPC_MDSTR_SLASH_ENVOY_DOT_API_DOT_V2_DOT_ENDPOINTDISCOVERYSERVICE_SLASH_STREAMENDPOINTS, nullptr, deadline, nullptr); + GPR_ASSERT(lb_call_ != nullptr); // Init the LB call request payload. grpc_slice request_payload_slice = XdsEdsRequestCreateAndEncode(xdslb_policy()->server_name_); @@ -795,48 +965,18 @@ XdsLb::BalancerChannelState::BalancerCallState::BalancerCallState( grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_slice_unref_internal(request_payload_slice); // Init other data associated with the LB call. - grpc_metadata_array_init(&lb_initial_metadata_recv_); - grpc_metadata_array_init(&lb_trailing_metadata_recv_); - GRPC_CLOSURE_INIT(&lb_on_initial_request_sent_, OnInitialRequestSentLocked, - this, grpc_combiner_scheduler(xdslb_policy()->combiner())); - GRPC_CLOSURE_INIT(&lb_on_balancer_message_received_, - OnBalancerMessageReceivedLocked, this, + grpc_metadata_array_init(&initial_metadata_recv_); + grpc_metadata_array_init(&trailing_metadata_recv_); + GRPC_CLOSURE_INIT(&on_response_received_, OnResponseReceivedLocked, this, grpc_combiner_scheduler(xdslb_policy()->combiner())); - GRPC_CLOSURE_INIT(&lb_on_balancer_status_received_, - OnBalancerStatusReceivedLocked, this, + GRPC_CLOSURE_INIT(&on_status_received_, OnStatusReceivedLocked, this, grpc_combiner_scheduler(xdslb_policy()->combiner())); -} - -XdsLb::BalancerChannelState::BalancerCallState::~BalancerCallState() { - GPR_ASSERT(lb_call_ != nullptr); - grpc_call_unref(lb_call_); - grpc_metadata_array_destroy(&lb_initial_metadata_recv_); - grpc_metadata_array_destroy(&lb_trailing_metadata_recv_); - grpc_byte_buffer_destroy(send_message_payload_); - grpc_byte_buffer_destroy(recv_message_payload_); - grpc_slice_unref_internal(lb_call_status_details_); -} - -void XdsLb::BalancerChannelState::BalancerCallState::Orphan() { - GPR_ASSERT(lb_call_ != nullptr); - // If we are here because xdslb_policy wants to cancel the call, - // lb_on_balancer_status_received_ will complete the cancellation and clean - // up. Otherwise, we are here because xdslb_policy has to orphan a failed - // call, then the following cancellation will be a no-op. - grpc_call_cancel(lb_call_, nullptr); - if (client_load_report_timer_callback_pending_) { - grpc_timer_cancel(&client_load_report_timer_); - } - // Note that the initial ref is hold by lb_on_balancer_status_received_ - // instead of the caller of this function. So the corresponding unref happens - // in lb_on_balancer_status_received_ instead of here. -} - -void XdsLb::BalancerChannelState::BalancerCallState::StartQuery() { - GPR_ASSERT(lb_call_ != nullptr); + // Start the call. if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { - gpr_log(GPR_INFO, "[xdslb %p] Starting LB call (lb_calld: %p, lb_call: %p)", - xdslb_policy(), this, lb_call_); + gpr_log(GPR_INFO, + "[xdslb %p] Starting EDS call (lb_chand: %p, lb_calld: %p, " + "lb_call: %p)", + xdslb_policy(), lb_chand(), this, lb_call_); } // Create the ops. grpc_call_error call_error; @@ -856,19 +996,14 @@ void XdsLb::BalancerChannelState::BalancerCallState::StartQuery() { op->flags = 0; op->reserved = nullptr; op++; - // TODO(roth): We currently track this ref manually. Once the - // ClosureRef API is ready, we should pass the RefCountedPtr<> along - // with the callback. - auto self = Ref(DEBUG_LOCATION, "on_initial_request_sent"); - self.release(); - call_error = grpc_call_start_batch_and_execute( - lb_call_, ops, (size_t)(op - ops), &lb_on_initial_request_sent_); + call_error = grpc_call_start_batch_and_execute(lb_call_, ops, + (size_t)(op - ops), nullptr); GPR_ASSERT(GRPC_CALL_OK == call_error); // Op: recv initial metadata. op = ops; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata.recv_initial_metadata = - &lb_initial_metadata_recv_; + &initial_metadata_recv_; op->flags = 0; op->reserved = nullptr; op++; @@ -878,21 +1013,16 @@ void XdsLb::BalancerChannelState::BalancerCallState::StartQuery() { op->flags = 0; op->reserved = nullptr; op++; - // TODO(roth): We currently track this ref manually. Once the - // ClosureRef API is ready, we should pass the RefCountedPtr<> along - // with the callback. - self = Ref(DEBUG_LOCATION, "on_message_received"); - self.release(); + Ref(DEBUG_LOCATION, "EDS+OnResponseReceivedLocked").release(); call_error = grpc_call_start_batch_and_execute( - lb_call_, ops, (size_t)(op - ops), &lb_on_balancer_message_received_); + lb_call_, ops, (size_t)(op - ops), &on_response_received_); GPR_ASSERT(GRPC_CALL_OK == call_error); // Op: recv server status. op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; - op->data.recv_status_on_client.trailing_metadata = - &lb_trailing_metadata_recv_; - op->data.recv_status_on_client.status = &lb_call_status_; - op->data.recv_status_on_client.status_details = &lb_call_status_details_; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv_; + op->data.recv_status_on_client.status = &status_code_; + op->data.recv_status_on_client.status_details = &status_details_; op->flags = 0; op->reserved = nullptr; op++; @@ -900,113 +1030,49 @@ void XdsLb::BalancerChannelState::BalancerCallState::StartQuery() { // ref instead of a new ref. When it's invoked, it's the initial ref that is // unreffed. call_error = grpc_call_start_batch_and_execute( - lb_call_, ops, (size_t)(op - ops), &lb_on_balancer_status_received_); + lb_call_, ops, (size_t)(op - ops), &on_status_received_); GPR_ASSERT(GRPC_CALL_OK == call_error); } -void XdsLb::BalancerChannelState::BalancerCallState:: - ScheduleNextClientLoadReportLocked() { - const grpc_millis next_client_load_report_time = - ExecCtx::Get()->Now() + client_stats_report_interval_; - GRPC_CLOSURE_INIT(&client_load_report_closure_, - MaybeSendClientLoadReportLocked, this, - grpc_combiner_scheduler(xdslb_policy()->combiner())); - grpc_timer_init(&client_load_report_timer_, next_client_load_report_time, - &client_load_report_closure_); - client_load_report_timer_callback_pending_ = true; +XdsLb::LbChannelState::EdsCallState::~EdsCallState() { + grpc_metadata_array_destroy(&initial_metadata_recv_); + grpc_metadata_array_destroy(&trailing_metadata_recv_); + grpc_byte_buffer_destroy(send_message_payload_); + grpc_byte_buffer_destroy(recv_message_payload_); + grpc_slice_unref_internal(status_details_); + GPR_ASSERT(lb_call_ != nullptr); + grpc_call_unref(lb_call_); } -void XdsLb::BalancerChannelState::BalancerCallState:: - MaybeSendClientLoadReportLocked(void* arg, grpc_error* error) { - BalancerCallState* lb_calld = static_cast(arg); - lb_calld->client_load_report_timer_callback_pending_ = false; - if (error != GRPC_ERROR_NONE || !lb_calld->IsCurrentCallOnChannel()) { - lb_calld->Unref(DEBUG_LOCATION, "client_load_report"); - return; - } - // If we've already sent the initial request, then we can go ahead and send - // the load report. Otherwise, we need to wait until the initial request has - // been sent to send this (see OnInitialRequestSentLocked()). - if (lb_calld->send_message_payload_ == nullptr) { - lb_calld->SendClientLoadReportLocked(); - } else { - lb_calld->client_load_report_is_due_ = true; - } -} - -bool XdsLb::BalancerChannelState::BalancerCallState::LoadReportCountersAreZero( - xds_grpclb_request* request) { - const grpc_lb_v1_ClientStats* cstats = - grpc_lb_v1_LoadBalanceRequest_client_stats(request); - if (cstats == nullptr) { - return true; - } - size_t drop_count; - grpc_lb_v1_ClientStats_calls_finished_with_drop(cstats, &drop_count); - return grpc_lb_v1_ClientStats_num_calls_started(cstats) == 0 && - grpc_lb_v1_ClientStats_num_calls_finished(cstats) == 0 && - grpc_lb_v1_ClientStats_num_calls_finished_with_client_failed_to_send( - cstats) == 0 && - grpc_lb_v1_ClientStats_num_calls_finished_known_received(cstats) == - 0 && - drop_count == 0; -} - -// TODO(vpowar): Use LRS to send the client Load Report. -void XdsLb::BalancerChannelState::BalancerCallState:: - SendClientLoadReportLocked() { - // Construct message payload. - GPR_ASSERT(send_message_payload_ == nullptr); - upb::Arena arena; - xds_grpclb_request* request = xds_grpclb_load_report_request_create_locked( - client_stats_.get(), arena.ptr()); - // Skip client load report if the counters were all zero in the last - // report and they are still zero in this one. - if (LoadReportCountersAreZero(request)) { - if (last_client_load_report_counters_were_zero_) { - ScheduleNextClientLoadReportLocked(); - return; - } - last_client_load_report_counters_were_zero_ = true; - } else { - last_client_load_report_counters_were_zero_ = false; - } - // TODO(vpowar): Send the report on LRS stream. +void XdsLb::LbChannelState::EdsCallState::Orphan() { + GPR_ASSERT(lb_call_ != nullptr); + // If we are here because xdslb_policy wants to cancel the call, + // on_status_received_ will complete the cancellation and clean up. Otherwise, + // we are here because xdslb_policy has to orphan a failed call, then the + // following cancellation will be a no-op. + grpc_call_cancel(lb_call_, nullptr); + // Note that the initial ref is hold by on_status_received_. So the + // corresponding unref happens in on_status_received_ instead of here. } -void XdsLb::BalancerChannelState::BalancerCallState::OnInitialRequestSentLocked( +void XdsLb::LbChannelState::EdsCallState::OnResponseReceivedLocked( void* arg, grpc_error* error) { - BalancerCallState* lb_calld = static_cast(arg); - grpc_byte_buffer_destroy(lb_calld->send_message_payload_); - lb_calld->send_message_payload_ = nullptr; - // If we attempted to send a client load report before the initial request was - // sent (and this lb_calld is still in use), send the load report now. - if (lb_calld->client_load_report_is_due_ && - lb_calld->IsCurrentCallOnChannel()) { - lb_calld->SendClientLoadReportLocked(); - lb_calld->client_load_report_is_due_ = false; - } - lb_calld->Unref(DEBUG_LOCATION, "on_initial_request_sent"); -} - -void XdsLb::BalancerChannelState::BalancerCallState:: - OnBalancerMessageReceivedLocked(void* arg, grpc_error* error) { - BalancerCallState* lb_calld = static_cast(arg); - XdsLb* xdslb_policy = lb_calld->xdslb_policy(); + EdsCallState* eds_calld = static_cast(arg); + LbChannelState* lb_chand = eds_calld->lb_chand(); + XdsLb* xdslb_policy = eds_calld->xdslb_policy(); // Empty payload means the LB call was cancelled. - if (!lb_calld->IsCurrentCallOnChannel() || - lb_calld->recv_message_payload_ == nullptr) { - lb_calld->Unref(DEBUG_LOCATION, "on_message_received"); + if (!eds_calld->IsCurrentCallOnChannel() || + eds_calld->recv_message_payload_ == nullptr) { + eds_calld->Unref(DEBUG_LOCATION, "EDS+OnResponseReceivedLocked"); return; } - lb_calld->seen_response_ = true; // Read the response. grpc_byte_buffer_reader bbr; - grpc_byte_buffer_reader_init(&bbr, lb_calld->recv_message_payload_); + grpc_byte_buffer_reader_init(&bbr, eds_calld->recv_message_payload_); grpc_slice response_slice = grpc_byte_buffer_reader_readall(&bbr); grpc_byte_buffer_reader_destroy(&bbr); - grpc_byte_buffer_destroy(lb_calld->recv_message_payload_); - lb_calld->recv_message_payload_ = nullptr; + grpc_byte_buffer_destroy(eds_calld->recv_message_payload_); + eds_calld->recv_message_payload_ = nullptr; // TODO(juanlishen): When we convert this to use the xds protocol, the // balancer will send us a fallback timeout such that we should go into // fallback mode if we have lost contact with the balancer after a certain @@ -1037,6 +1103,7 @@ void XdsLb::BalancerChannelState::BalancerCallState:: gpr_free(response_slice_str); return; } + eds_calld->seen_response_ = true; if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { gpr_log(GPR_INFO, "[xdslb %p] EDS response with %" PRIuPTR " localities received", @@ -1066,25 +1133,21 @@ void XdsLb::BalancerChannelState::BalancerCallState:: // Note that this call can't be on a discarded pending channel, because // such channels don't have any current call but we have checked this call // is a current call. - if (!lb_calld->lb_chand_->IsCurrentChannel()) { + if (!lb_chand->IsCurrentChannel()) { if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { gpr_log(GPR_INFO, - "[xdslb %p] Promoting pending LB channel %p to replace " - "current LB channel %p", - xdslb_policy, lb_calld->lb_chand_.get(), - lb_calld->xdslb_policy()->lb_chand_.get()); + "[xdslb %p] Pending LB channel %p receives EDS response; " + "promoting it to replace current LB channel %p", + xdslb_policy, lb_chand, xdslb_policy->lb_chand_.get()); } - lb_calld->xdslb_policy()->lb_chand_ = - std::move(lb_calld->xdslb_policy()->pending_lb_chand_); - } - // Start sending client load report only after we start using the - // serverlist returned from the current LB call. - if (lb_calld->client_stats_report_interval_ > 0 && - lb_calld->client_stats_ == nullptr) { - lb_calld->client_stats_ = MakeRefCounted(); - lb_calld->Ref(DEBUG_LOCATION, "client_load_report").release(); - lb_calld->ScheduleNextClientLoadReportLocked(); + // TODO(juanlishen): Maybe promote the pending LB channel when the + // response results a READY locality map. + xdslb_policy->lb_chand_ = std::move(xdslb_policy->pending_lb_chand_); } + // At this point, lb_chand must be the current LB channel, so try to start + // load reporting. + LrsCallState* lrs_calld = lb_chand->lrs_calld_->lb_calld(); + if (lrs_calld != nullptr) lrs_calld->MaybeStartReportingLocked(); // Ignore identical update. if (xdslb_policy->locality_list_ == update.locality_list) { if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { @@ -1111,45 +1174,43 @@ void XdsLb::BalancerChannelState::BalancerCallState:: }(); grpc_slice_unref_internal(response_slice); if (xdslb_policy->shutting_down_) { - lb_calld->Unref(DEBUG_LOCATION, "on_message_received+xds_shutdown"); + eds_calld->Unref(DEBUG_LOCATION, + "EDS+OnResponseReceivedLocked+xds_shutdown"); return; } // Keep listening for serverlist updates. grpc_op op; memset(&op, 0, sizeof(op)); op.op = GRPC_OP_RECV_MESSAGE; - op.data.recv_message.recv_message = &lb_calld->recv_message_payload_; + op.data.recv_message.recv_message = &eds_calld->recv_message_payload_; op.flags = 0; op.reserved = nullptr; - GPR_ASSERT(lb_calld->lb_call_ != nullptr); - // Reuse the "OnBalancerMessageReceivedLocked" ref taken in StartQuery(). + GPR_ASSERT(eds_calld->lb_call_ != nullptr); + // Reuse the "EDS+OnResponseReceivedLocked" ref taken in ctor. const grpc_call_error call_error = grpc_call_start_batch_and_execute( - lb_calld->lb_call_, &op, 1, &lb_calld->lb_on_balancer_message_received_); + eds_calld->lb_call_, &op, 1, &eds_calld->on_response_received_); GPR_ASSERT(GRPC_CALL_OK == call_error); } -void XdsLb::BalancerChannelState::BalancerCallState:: - OnBalancerStatusReceivedLocked(void* arg, grpc_error* error) { - BalancerCallState* lb_calld = static_cast(arg); - XdsLb* xdslb_policy = lb_calld->xdslb_policy(); - BalancerChannelState* lb_chand = lb_calld->lb_chand_.get(); - GPR_ASSERT(lb_calld->lb_call_ != nullptr); +void XdsLb::LbChannelState::EdsCallState::OnStatusReceivedLocked( + void* arg, grpc_error* error) { + EdsCallState* eds_calld = static_cast(arg); + LbChannelState* lb_chand = eds_calld->lb_chand(); + XdsLb* xdslb_policy = eds_calld->xdslb_policy(); if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { - char* status_details = - grpc_slice_to_c_string(lb_calld->lb_call_status_details_); + char* status_details = grpc_slice_to_c_string(eds_calld->status_details_); gpr_log(GPR_INFO, - "[xdslb %p] Status from LB server received. Status = %d, details " - "= '%s', (lb_chand: %p, lb_calld: %p, lb_call: %p), error '%s'", - xdslb_policy, lb_calld->lb_call_status_, status_details, lb_chand, - lb_calld, lb_calld->lb_call_, grpc_error_string(error)); + "[xdslb %p] EDS call status received. Status = %d, details " + "= '%s', (lb_chand: %p, eds_calld: %p, lb_call: %p), error '%s'", + xdslb_policy, eds_calld->status_code_, status_details, lb_chand, + eds_calld, eds_calld->lb_call_, grpc_error_string(error)); gpr_free(status_details); } // Ignore status from a stale call. - if (lb_calld->IsCurrentCallOnChannel()) { + if (eds_calld->IsCurrentCallOnChannel()) { // Because this call is the current one on the channel, the channel can't // have been swapped out; otherwise, the call should have been reset. GPR_ASSERT(lb_chand->IsCurrentChannel() || lb_chand->IsPendingChannel()); - GPR_ASSERT(!xdslb_policy->shutting_down_); if (lb_chand != xdslb_policy->LatestLbChannel()) { // This channel must be the current one and there is a pending one. Swap // in the pending one and we are done. @@ -1157,23 +1218,13 @@ void XdsLb::BalancerChannelState::BalancerCallState:: gpr_log(GPR_INFO, "[xdslb %p] Promoting pending LB channel %p to replace " "current LB channel %p", - xdslb_policy, lb_calld->lb_chand_.get(), - lb_calld->xdslb_policy()->lb_chand_.get()); + xdslb_policy, lb_chand, xdslb_policy->lb_chand_.get()); } xdslb_policy->lb_chand_ = std::move(xdslb_policy->pending_lb_chand_); } else { // This channel is the most recently created one. Try to restart the call // and reresolve. - lb_chand->lb_calld_.reset(); - if (lb_calld->seen_response_) { - // If we lost connection to the LB server, reset the backoff and restart - // the LB call immediately. - lb_chand->lb_call_backoff_.Reset(); - lb_chand->StartCallLocked(); - } else { - // If we failed to connect to the LB server, retry later. - lb_chand->StartCallRetryTimerLocked(); - } + eds_calld->parent_->OnCallFinishedLocked(); xdslb_policy->channel_control_helper()->RequestReresolution(); // If the fallback-at-startup checks are pending, go into fallback mode // immediately. This short-circuits the timeout for the @@ -1189,7 +1240,369 @@ void XdsLb::BalancerChannelState::BalancerCallState:: } } } - lb_calld->Unref(DEBUG_LOCATION, "lb_call_ended"); + eds_calld->Unref(DEBUG_LOCATION, "EDS+OnStatusReceivedLocked"); +} + +bool XdsLb::LbChannelState::EdsCallState::IsCurrentCallOnChannel() const { + // If the retryable EDS call is null (which only happens when the LB channel + // is shutting down), all the EDS calls are stale. + if (lb_chand()->eds_calld_ == nullptr) return false; + return this == lb_chand()->eds_calld_->lb_calld(); +} + +// +// XdsLb::LbChannelState::LrsCallState::Reporter +// + +void XdsLb::LbChannelState::LrsCallState::Reporter::Orphan() { + if (next_report_timer_callback_pending_) { + grpc_timer_cancel(&next_report_timer_); + } +} + +void XdsLb::LbChannelState::LrsCallState::Reporter::ScheduleNextReportLocked() { + const grpc_millis next_report_time = ExecCtx::Get()->Now() + report_interval_; + grpc_timer_init(&next_report_timer_, next_report_time, + &on_next_report_timer_); + next_report_timer_callback_pending_ = true; +} + +void XdsLb::LbChannelState::LrsCallState::Reporter::OnNextReportTimerLocked( + void* arg, grpc_error* error) { + Reporter* self = static_cast(arg); + self->next_report_timer_callback_pending_ = false; + if (error != GRPC_ERROR_NONE || !self->IsCurrentReporterOnCall()) { + self->Unref(DEBUG_LOCATION, "Reporter+timer"); + return; + } + self->SendReportLocked(); +} + +void XdsLb::LbChannelState::LrsCallState::Reporter::SendReportLocked() { + // Create a request that contains the load report. + grpc_slice request_payload_slice = XdsLrsRequestCreateAndEncode( + xdslb_policy()->server_name_, &xdslb_policy()->client_stats_); + // Skip client load report if the counters were all zero in the last + // report and they are still zero in this one. + const bool old_val = last_report_counters_were_zero_; + last_report_counters_were_zero_ = static_cast( + grpc_slice_eq(request_payload_slice, grpc_empty_slice())); + if (old_val && last_report_counters_were_zero_) { + ScheduleNextReportLocked(); + return; + } + parent_->send_message_payload_ = + grpc_raw_byte_buffer_create(&request_payload_slice, 1); + grpc_slice_unref_internal(request_payload_slice); + // Send the report. + grpc_op op; + memset(&op, 0, sizeof(op)); + op.op = GRPC_OP_SEND_MESSAGE; + op.data.send_message.send_message = parent_->send_message_payload_; + grpc_call_error call_error = grpc_call_start_batch_and_execute( + parent_->lb_call_, &op, 1, &on_report_done_); + if (GPR_UNLIKELY(call_error != GRPC_CALL_OK)) { + gpr_log(GPR_ERROR, + "[xdslb %p] lb_calld=%p call_error=%d sending client load report", + xdslb_policy(), this, call_error); + GPR_ASSERT(GRPC_CALL_OK == call_error); + } +} + +void XdsLb::LbChannelState::LrsCallState::Reporter::OnReportDoneLocked( + void* arg, grpc_error* error) { + Reporter* self = static_cast(arg); + grpc_byte_buffer_destroy(self->parent_->send_message_payload_); + self->parent_->send_message_payload_ = nullptr; + if (error != GRPC_ERROR_NONE || !self->IsCurrentReporterOnCall()) { + // If this reporter is no longer the current one on the call, the reason + // might be that it was orphaned for a new one due to config update. + if (!self->IsCurrentReporterOnCall()) { + self->parent_->MaybeStartReportingLocked(); + } + self->Unref(DEBUG_LOCATION, "Reporter+report_done"); + return; + } + self->ScheduleNextReportLocked(); +} + +// +// XdsLb::LbChannelState::LrsCallState +// + +XdsLb::LbChannelState::LrsCallState::LrsCallState( + RefCountedPtr> parent) + : InternallyRefCounted(&grpc_lb_xds_trace), + parent_(std::move(parent)) { + // Init the LB call. Note that the LB call will progress every time there's + // activity in xdslb_policy()->interested_parties(), which is comprised of + // the polling entities from client_channel. + GPR_ASSERT(xdslb_policy() != nullptr); + GPR_ASSERT(xdslb_policy()->server_name_ != nullptr); + GPR_ASSERT(xdslb_policy()->server_name_[0] != '\0'); + const grpc_millis deadline = + xdslb_policy()->lb_call_timeout_ms_ == 0 + ? GRPC_MILLIS_INF_FUTURE + : ExecCtx::Get()->Now() + xdslb_policy()->lb_call_timeout_ms_; + lb_call_ = grpc_channel_create_pollset_set_call( + lb_chand()->channel_, nullptr, GRPC_PROPAGATE_DEFAULTS, + xdslb_policy()->interested_parties(), + GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS, + nullptr, deadline, nullptr); + GPR_ASSERT(lb_call_ != nullptr); + // Init the LB call request payload. + grpc_slice request_payload_slice = + XdsLrsRequestCreateAndEncode(xdslb_policy()->server_name_); + send_message_payload_ = + grpc_raw_byte_buffer_create(&request_payload_slice, 1); + grpc_slice_unref_internal(request_payload_slice); + // Init other data associated with the LRS call. + grpc_metadata_array_init(&initial_metadata_recv_); + grpc_metadata_array_init(&trailing_metadata_recv_); + GRPC_CLOSURE_INIT(&on_initial_request_sent_, OnInitialRequestSentLocked, this, + grpc_combiner_scheduler(xdslb_policy()->combiner())); + GRPC_CLOSURE_INIT(&on_response_received_, OnResponseReceivedLocked, this, + grpc_combiner_scheduler(xdslb_policy()->combiner())); + GRPC_CLOSURE_INIT(&on_status_received_, OnStatusReceivedLocked, this, + grpc_combiner_scheduler(xdslb_policy()->combiner())); + // Start the call. + if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { + gpr_log(GPR_INFO, + "[xdslb %p] Starting LRS call (lb_chand: %p, lb_calld: %p, " + "lb_call: %p)", + xdslb_policy(), lb_chand(), this, lb_call_); + } + // Create the ops. + grpc_call_error call_error; + grpc_op ops[3]; + memset(ops, 0, sizeof(ops)); + // Op: send initial metadata. + grpc_op* op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = nullptr; + op++; + // Op: send request message. + GPR_ASSERT(send_message_payload_ != nullptr); + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = send_message_payload_; + op->flags = 0; + op->reserved = nullptr; + op++; + Ref(DEBUG_LOCATION, "LRS+OnInitialRequestSentLocked").release(); + call_error = grpc_call_start_batch_and_execute( + lb_call_, ops, (size_t)(op - ops), &on_initial_request_sent_); + GPR_ASSERT(GRPC_CALL_OK == call_error); + // Op: recv initial metadata. + op = ops; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata.recv_initial_metadata = + &initial_metadata_recv_; + op->flags = 0; + op->reserved = nullptr; + op++; + // Op: recv response. + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &recv_message_payload_; + op->flags = 0; + op->reserved = nullptr; + op++; + Ref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked").release(); + call_error = grpc_call_start_batch_and_execute( + lb_call_, ops, (size_t)(op - ops), &on_response_received_); + GPR_ASSERT(GRPC_CALL_OK == call_error); + // Op: recv server status. + op = ops; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv_; + op->data.recv_status_on_client.status = &status_code_; + op->data.recv_status_on_client.status_details = &status_details_; + op->flags = 0; + op->reserved = nullptr; + op++; + // This callback signals the end of the LB call, so it relies on the initial + // ref instead of a new ref. When it's invoked, it's the initial ref that is + // unreffed. + call_error = grpc_call_start_batch_and_execute( + lb_call_, ops, (size_t)(op - ops), &on_status_received_); + GPR_ASSERT(GRPC_CALL_OK == call_error); +} + +XdsLb::LbChannelState::LrsCallState::~LrsCallState() { + grpc_metadata_array_destroy(&initial_metadata_recv_); + grpc_metadata_array_destroy(&trailing_metadata_recv_); + grpc_byte_buffer_destroy(send_message_payload_); + grpc_byte_buffer_destroy(recv_message_payload_); + grpc_slice_unref_internal(status_details_); + GPR_ASSERT(lb_call_ != nullptr); + grpc_call_unref(lb_call_); +} + +void XdsLb::LbChannelState::LrsCallState::Orphan() { + reporter_.reset(); + GPR_ASSERT(lb_call_ != nullptr); + // If we are here because xdslb_policy wants to cancel the call, + // on_status_received_ will complete the cancellation and clean up. Otherwise, + // we are here because xdslb_policy has to orphan a failed call, then the + // following cancellation will be a no-op. + grpc_call_cancel(lb_call_, nullptr); + // Note that the initial ref is hold by on_status_received_. So the + // corresponding unref happens in on_status_received_ instead of here. +} + +void XdsLb::LbChannelState::LrsCallState::MaybeStartReportingLocked() { + // Don't start if this is not the current call on the current channel. + if (!IsCurrentCallOnChannel() || !lb_chand()->IsCurrentChannel()) return; + // Don't start again if already started. + if (reporter_ != nullptr) return; + // Don't start if the previous send_message op (of the initial request or the + // last report of the previous reporter) hasn't completed. + if (send_message_payload_ != nullptr) return; + // Don't start if no LRS response has arrived. + if (!seen_response()) return; + // Don't start if the EDS call hasn't received any valid response. Note that + // this must be the first channel because it is the current channel but its + // EDS call hasn't seen any response. + EdsCallState* eds_calld = lb_chand()->eds_calld_->lb_calld(); + if (eds_calld == nullptr || !eds_calld->seen_response()) return; + // Start reporting. + lb_chand()->xdslb_policy_->client_stats_.MaybeInitLastReportTime(); + reporter_ = MakeOrphanable( + Ref(DEBUG_LOCATION, "LRS+load_report+start"), load_reporting_interval_); +} + +void XdsLb::LbChannelState::LrsCallState::OnInitialRequestSentLocked( + void* arg, grpc_error* error) { + LrsCallState* lrs_calld = static_cast(arg); + // Clear the send_message_payload_. + grpc_byte_buffer_destroy(lrs_calld->send_message_payload_); + lrs_calld->send_message_payload_ = nullptr; + lrs_calld->MaybeStartReportingLocked(); + lrs_calld->Unref(DEBUG_LOCATION, "LRS+OnInitialRequestSentLocked"); +} + +void XdsLb::LbChannelState::LrsCallState::OnResponseReceivedLocked( + void* arg, grpc_error* error) { + LrsCallState* lrs_calld = static_cast(arg); + XdsLb* xdslb_policy = lrs_calld->xdslb_policy(); + // Empty payload means the LB call was cancelled. + if (!lrs_calld->IsCurrentCallOnChannel() || + lrs_calld->recv_message_payload_ == nullptr) { + lrs_calld->Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked"); + return; + } + // Read the response. + grpc_byte_buffer_reader bbr; + grpc_byte_buffer_reader_init(&bbr, lrs_calld->recv_message_payload_); + grpc_slice response_slice = grpc_byte_buffer_reader_readall(&bbr); + grpc_byte_buffer_reader_destroy(&bbr); + grpc_byte_buffer_destroy(lrs_calld->recv_message_payload_); + lrs_calld->recv_message_payload_ = nullptr; + // This anonymous lambda is a hack to avoid the usage of goto. + [&]() { + // Parse the response. + grpc_millis new_load_reporting_interval; + grpc_error* parse_error = XdsLrsResponseDecodeAndParse( + response_slice, &new_load_reporting_interval, + xdslb_policy->server_name_); + if (parse_error != GRPC_ERROR_NONE) { + gpr_log(GPR_ERROR, "[xdslb %p] LRS response parsing failed. error=%s", + xdslb_policy, grpc_error_string(parse_error)); + GRPC_ERROR_UNREF(parse_error); + return; + } + lrs_calld->seen_response_ = true; + if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { + gpr_log(GPR_INFO, + "[xdslb %p] LRS response received, load_report_interval=%" PRId64 + "ms", + xdslb_policy, new_load_reporting_interval); + } + if (new_load_reporting_interval < + GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS) { + new_load_reporting_interval = + GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS; + if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { + gpr_log( + GPR_INFO, + "[xdslb %p] Increased load_report_interval to minimum value %dms", + xdslb_policy, GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS); + } + } + // Ignore identical update. + if (lrs_calld->load_reporting_interval_ == new_load_reporting_interval) { + if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { + gpr_log(GPR_INFO, + "[xdslb %p] Incoming LRS response identical to current, " + "ignoring.", + xdslb_policy); + } + return; + } + // Stop current load reporting (if any) to adopt the new reporting interval. + lrs_calld->reporter_.reset(); + // Record the new config. + lrs_calld->load_reporting_interval_ = new_load_reporting_interval; + // Try starting sending load report. + lrs_calld->MaybeStartReportingLocked(); + }(); + grpc_slice_unref_internal(response_slice); + if (xdslb_policy->shutting_down_) { + lrs_calld->Unref(DEBUG_LOCATION, + "LRS+OnResponseReceivedLocked+xds_shutdown"); + return; + } + // Keep listening for LRS config updates. + grpc_op op; + memset(&op, 0, sizeof(op)); + op.op = GRPC_OP_RECV_MESSAGE; + op.data.recv_message.recv_message = &lrs_calld->recv_message_payload_; + op.flags = 0; + op.reserved = nullptr; + GPR_ASSERT(lrs_calld->lb_call_ != nullptr); + // Reuse the "OnResponseReceivedLocked" ref taken in ctor. + const grpc_call_error call_error = grpc_call_start_batch_and_execute( + lrs_calld->lb_call_, &op, 1, &lrs_calld->on_response_received_); + GPR_ASSERT(GRPC_CALL_OK == call_error); +} + +void XdsLb::LbChannelState::LrsCallState::OnStatusReceivedLocked( + void* arg, grpc_error* error) { + LrsCallState* lrs_calld = static_cast(arg); + XdsLb* xdslb_policy = lrs_calld->xdslb_policy(); + LbChannelState* lb_chand = lrs_calld->lb_chand(); + GPR_ASSERT(lrs_calld->lb_call_ != nullptr); + if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { + char* status_details = grpc_slice_to_c_string(lrs_calld->status_details_); + gpr_log(GPR_INFO, + "[xdslb %p] LRS call status received. Status = %d, details " + "= '%s', (lb_chand: %p, lb_calld: %p, lb_call: %p), error '%s'", + xdslb_policy, lrs_calld->status_code_, status_details, lb_chand, + lrs_calld, lrs_calld->lb_call_, grpc_error_string(error)); + gpr_free(status_details); + } + // Ignore status from a stale call. + if (lrs_calld->IsCurrentCallOnChannel()) { + // Because this call is the current one on the channel, the channel can't + // have been swapped out; otherwise, the call should have been reset. + GPR_ASSERT(lb_chand->IsCurrentChannel() || lb_chand->IsPendingChannel()); + GPR_ASSERT(!xdslb_policy->shutting_down_); + if (lb_chand == xdslb_policy->LatestLbChannel()) { + // This channel is the most recently created one. Try to restart the call + // and reresolve. + lrs_calld->parent_->OnCallFinishedLocked(); + xdslb_policy->channel_control_helper()->RequestReresolution(); + } + } + lrs_calld->Unref(DEBUG_LOCATION, "LRS+OnStatusReceivedLocked"); +} + +bool XdsLb::LbChannelState::LrsCallState::IsCurrentCallOnChannel() const { + // If the retryable LRS call is null (which only happens when the LB channel + // is shutting down), all the LRS calls are stale. + if (lb_chand()->lrs_calld_ == nullptr) return false; + return this == lb_chand()->lrs_calld_->lb_calld(); } // @@ -1249,8 +1662,7 @@ grpc_channel_args* BuildBalancerChannelArgs(const grpc_channel_args* args) { // ctor and dtor // -XdsLb::XdsLb(Args args) - : LoadBalancingPolicy(std::move(args)), locality_map_(), locality_list_() { +XdsLb::XdsLb(Args args) : LoadBalancingPolicy(std::move(args)) { // Record server name. const grpc_arg* arg = grpc_channel_args_find(args.args, GRPC_ARG_SERVER_URI); const char* server_uri = grpc_channel_arg_get_string(arg); @@ -1351,11 +1763,10 @@ void XdsLb::ProcessAddressesAndChannelArgsLocked( strcmp(last_balancer_name.get(), balancer_name_.get()) != 0; } if (create_lb_channel) { - OrphanablePtr lb_chand = - MakeOrphanable( - balancer_name_.get(), *lb_channel_args, - Ref(DEBUG_LOCATION, "BalancerChannelState")); - if (lb_chand_ == nullptr || !lb_chand_->HasActiveCall()) { + OrphanablePtr lb_chand = MakeOrphanable( + Ref(DEBUG_LOCATION, "XdsLb+LbChannelState"), balancer_name_.get(), + *lb_channel_args); + if (lb_chand_ == nullptr || !lb_chand_->HasActiveEdsCall()) { GPR_ASSERT(pending_lb_chand_ == nullptr); // If we do not have a working LB channel yet, use the newly created one. lb_chand_ = std::move(lb_chand); @@ -1604,15 +2015,15 @@ void XdsLb::LocalityMap::UpdateLocked( const grpc_channel_args* args, XdsLb* parent) { if (parent->shutting_down_) return; for (size_t i = 0; i < locality_list.size(); i++) { - auto iter = map_.find(locality_list[i].locality_name); + auto& locality_name = locality_list[i].locality_name; + auto iter = map_.find(locality_name); // Add a new entry in the locality map if a new locality is received in the // locality list. if (iter == map_.end()) { OrphanablePtr new_entry = MakeOrphanable( - parent->Ref(DEBUG_LOCATION, "LocalityEntry"), - locality_list[i].locality_name, locality_list[i].lb_weight); - iter = map_.emplace(locality_list[i].locality_name, std::move(new_entry)) - .first; + parent->Ref(DEBUG_LOCATION, "LocalityEntry"), locality_name, + locality_list[i].lb_weight); + iter = map_.emplace(locality_name, std::move(new_entry)).first; } // Keep a copy of serverlist in locality_list_ so that we can compare it // with the future ones. @@ -1834,7 +2245,7 @@ void XdsLb::LocalityMap::LocalityEntry::ShutdownLocked() { } // Drop our ref to the child's picker, in case it's holding a ref to // the child. - picker_ref_.reset(); + picker_wrapper_.reset(); } void XdsLb::LocalityMap::LocalityEntry::ResetBackoffLocked() { @@ -1911,12 +2322,10 @@ void XdsLb::LocalityMap::LocalityEntry::Helper::UpdateState( // If we are in fallback mode, ignore update request from the child policy. if (entry_->parent_->fallback_policy_ != nullptr) return; GPR_ASSERT(entry_->parent_->lb_chand_ != nullptr); - RefCountedPtr client_stats = - entry_->parent_->lb_chand_->lb_calld() == nullptr - ? nullptr - : entry_->parent_->lb_chand_->lb_calld()->client_stats(); - // Cache the picker and its state in the entry - entry_->picker_ref_ = MakeRefCounted(std::move(picker)); + // Cache the picker and its state in the entry. + entry_->picker_wrapper_ = MakeRefCounted( + std::move(picker), + entry_->parent_->client_stats_.FindLocalityStats(entry_->name_)); entry_->connectivity_state_ = state; // Construct a new xds picker which maintains a map of all locality pickers // that are ready. Each locality is represented by a portion of the range @@ -1926,15 +2335,30 @@ void XdsLb::LocalityMap::LocalityEntry::Helper::UpdateState( size_t num_connecting = 0; size_t num_idle = 0; size_t num_transient_failures = 0; - auto& locality_map = this->entry_->parent_->locality_map_.map_; Picker::PickerList pickers; - for (auto& p : locality_map) { + for (auto& p : entry_->parent_->locality_map_.map_) { + // TODO(juanlishen): We should prune a locality (and kill its stats) after + // we know we won't pick from it. We need to improve our update logic to + // make that easier. Consider the following situation: the current map has + // two READY localities A and B, and the update only contains B with the + // same addresses as before. Without the following hack, we will generate + // the same picker containing A and B because we haven't pruned A when the + // update happens. Remove the for loop below once we implement the locality + // map update. + bool in_locality_list = false; + for (size_t i = 0; i < entry_->parent_->locality_list_.size(); ++i) { + if (*entry_->parent_->locality_list_[i].locality_name == *p.first) { + in_locality_list = true; + break; + } + } + if (!in_locality_list) continue; const LocalityEntry* entry = p.second.get(); grpc_connectivity_state connectivity_state = entry->connectivity_state_; switch (connectivity_state) { case GRPC_CHANNEL_READY: { end += entry->locality_weight_; - pickers.push_back(MakePair(end, entry->picker_ref_)); + pickers.push_back(MakePair(end, entry->picker_wrapper_)); break; } case GRPC_CHANNEL_CONNECTING: { @@ -1959,29 +2383,30 @@ void XdsLb::LocalityMap::LocalityEntry::Helper::UpdateState( // otherwise pass a QueuePicker if any of the locality pickers are in a // connecting or idle state, finally return a transient failure picker if all // locality pickers are in transient failure - if (pickers.size() > 0) { + if (!pickers.empty()) { entry_->parent_->channel_control_helper()->UpdateState( - GRPC_CHANNEL_READY, - UniquePtr( - New(std::move(client_stats), std::move(pickers)))); + GRPC_CHANNEL_READY, UniquePtr( + New(std::move(pickers)))); } else if (num_connecting > 0) { entry_->parent_->channel_control_helper()->UpdateState( GRPC_CHANNEL_CONNECTING, UniquePtr(New( - this->entry_->parent_->Ref(DEBUG_LOCATION, "QueuePicker")))); + entry_->parent_->Ref(DEBUG_LOCATION, "QueuePicker")))); } else if (num_idle > 0) { entry_->parent_->channel_control_helper()->UpdateState( GRPC_CHANNEL_IDLE, UniquePtr(New( - this->entry_->parent_->Ref(DEBUG_LOCATION, "QueuePicker")))); + entry_->parent_->Ref(DEBUG_LOCATION, "QueuePicker")))); } else { - GPR_ASSERT(num_transient_failures == locality_map.size()); + GPR_ASSERT(num_transient_failures == + entry_->parent_->locality_map_.map_.size()); grpc_error* error = grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING( "connections to all localities failing"), GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE); entry_->parent_->channel_control_helper()->UpdateState( - state, UniquePtr(New(error))); + GRPC_CHANNEL_TRANSIENT_FAILURE, + UniquePtr(New(error))); } } @@ -2003,8 +2428,8 @@ void XdsLb::LocalityMap::LocalityEntry::Helper::RequestReresolution() { // from the balancer, so we can ignore the re-resolution request from // the child policy. Otherwise, pass the re-resolution request up to the // channel. - if (entry_->parent_->lb_chand_->lb_calld() == nullptr || - !entry_->parent_->lb_chand_->lb_calld()->seen_response()) { + if (entry_->parent_->lb_chand_->eds_calld() == nullptr || + !entry_->parent_->lb_chand_->eds_calld()->seen_response()) { entry_->parent_->channel_control_helper()->RequestReresolution(); } } diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc index cdf5408be36..5057e614c68 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc @@ -26,60 +26,163 @@ namespace grpc_core { -void XdsLbClientStats::AddCallStarted() { - gpr_atm_full_fetch_add(&num_calls_started_, (gpr_atm)1); +namespace { + +template +T GetAndResetCounter(Atomic* from) { + return from->Exchange(0, MemoryOrder::RELAXED); +} + +} // namespace + +// +// XdsClientStats::LocalityStats::LoadMetric::Snapshot +// + +bool XdsClientStats::LocalityStats::LoadMetric::Snapshot::IsAllZero() const { + return total_metric_value == 0 && num_requests_finished_with_metric == 0; +} + +// +// XdsClientStats::LocalityStats::LoadMetric +// + +XdsClientStats::LocalityStats::LoadMetric::Snapshot +XdsClientStats::LocalityStats::LoadMetric::GetSnapshotAndReset() { + Snapshot metric = {num_requests_finished_with_metric_, total_metric_value_}; + num_requests_finished_with_metric_ = 0; + total_metric_value_ = 0; + return metric; } -void XdsLbClientStats::AddCallFinished(bool finished_with_client_failed_to_send, - bool finished_known_received) { - gpr_atm_full_fetch_add(&num_calls_finished_, (gpr_atm)1); - if (finished_with_client_failed_to_send) { - gpr_atm_full_fetch_add(&num_calls_finished_with_client_failed_to_send_, - (gpr_atm)1); +// +// XdsClientStats::LocalityStats::Snapshot +// + +bool XdsClientStats::LocalityStats::Snapshot::IsAllZero() { + if (total_successful_requests != 0 || total_requests_in_progress != 0 || + total_error_requests != 0 || total_issued_requests != 0) { + return false; } - if (finished_known_received) { - gpr_atm_full_fetch_add(&num_calls_finished_known_received_, (gpr_atm)1); + for (auto& p : load_metric_stats) { + const LoadMetric::Snapshot& metric_value = p.second; + if (!metric_value.IsAllZero()) return false; } + return true; } -void XdsLbClientStats::AddCallDroppedLocked(char* token) { - // Increment num_calls_started and num_calls_finished. - gpr_atm_full_fetch_add(&num_calls_started_, (gpr_atm)1); - gpr_atm_full_fetch_add(&num_calls_finished_, (gpr_atm)1); - // Record the drop. - if (drop_token_counts_ == nullptr) { - drop_token_counts_.reset(New()); - } - for (size_t i = 0; i < drop_token_counts_->size(); ++i) { - if (strcmp((*drop_token_counts_)[i].token.get(), token) == 0) { - ++(*drop_token_counts_)[i].count; - return; +// +// XdsClientStats::LocalityStats +// + +XdsClientStats::LocalityStats::Snapshot +XdsClientStats::LocalityStats::GetSnapshotAndReset() { + Snapshot snapshot = { + GetAndResetCounter(&total_successful_requests_), + // Don't reset total_requests_in_progress because it's not + // related to a single reporting interval. + total_requests_in_progress_.Load(MemoryOrder::RELAXED), + GetAndResetCounter(&total_error_requests_), + GetAndResetCounter(&total_issued_requests_)}; + { + MutexLock lock(&load_metric_stats_mu_); + for (auto& p : load_metric_stats_) { + const char* metric_name = p.first.get(); + LoadMetric& metric_value = p.second; + snapshot.load_metric_stats.emplace( + UniquePtr(gpr_strdup(metric_name)), + metric_value.GetSnapshotAndReset()); } } - // Not found, so add a new entry. - drop_token_counts_->emplace_back(UniquePtr(gpr_strdup(token)), 1); + return snapshot; } -namespace { +void XdsClientStats::LocalityStats::AddCallStarted() { + total_issued_requests_.FetchAdd(1, MemoryOrder::RELAXED); + total_requests_in_progress_.FetchAdd(1, MemoryOrder::RELAXED); +} -void AtomicGetAndResetCounter(int64_t* value, gpr_atm* counter) { - *value = static_cast(gpr_atm_full_xchg(counter, (gpr_atm)0)); +void XdsClientStats::LocalityStats::AddCallFinished(bool fail) { + Atomic& to_increment = + fail ? total_error_requests_ : total_successful_requests_; + to_increment.FetchAdd(1, MemoryOrder::RELAXED); + total_requests_in_progress_.FetchAdd(-1, MemoryOrder::ACQ_REL); } -} // namespace +// +// XdsClientStats::Snapshot +// -void XdsLbClientStats::GetLocked( - int64_t* num_calls_started, int64_t* num_calls_finished, - int64_t* num_calls_finished_with_client_failed_to_send, - int64_t* num_calls_finished_known_received, - UniquePtr* drop_token_counts) { - AtomicGetAndResetCounter(num_calls_started, &num_calls_started_); - AtomicGetAndResetCounter(num_calls_finished, &num_calls_finished_); - AtomicGetAndResetCounter(num_calls_finished_with_client_failed_to_send, - &num_calls_finished_with_client_failed_to_send_); - AtomicGetAndResetCounter(num_calls_finished_known_received, - &num_calls_finished_known_received_); - *drop_token_counts = std::move(drop_token_counts_); +bool XdsClientStats::Snapshot::IsAllZero() { + for (auto& p : upstream_locality_stats) { + if (!p.second.IsAllZero()) return false; + } + for (auto& p : dropped_requests) { + if (p.second != 0) return false; + } + return total_dropped_requests == 0; +} + +// +// XdsClientStats +// + +XdsClientStats::Snapshot XdsClientStats::GetSnapshotAndReset() { + grpc_millis now = ExecCtx::Get()->Now(); + // Record total_dropped_requests and reporting interval in the snapshot. + Snapshot snapshot; + snapshot.total_dropped_requests = + GetAndResetCounter(&total_dropped_requests_); + snapshot.load_report_interval = now - last_report_time_; + // Update last report time. + last_report_time_ = now; + // Snapshot all the other stats. + for (auto& p : upstream_locality_stats_) { + snapshot.upstream_locality_stats.emplace(p.first, + p.second->GetSnapshotAndReset()); + } + { + MutexLock lock(&dropped_requests_mu_); + snapshot.dropped_requests = std::move(dropped_requests_); + } + return snapshot; +} + +void XdsClientStats::MaybeInitLastReportTime() { + if (last_report_time_ == -1) last_report_time_ = ExecCtx::Get()->Now(); +} + +RefCountedPtr XdsClientStats::FindLocalityStats( + const RefCountedPtr& locality_name) { + auto iter = upstream_locality_stats_.find(locality_name); + if (iter == upstream_locality_stats_.end()) { + iter = upstream_locality_stats_ + .emplace(locality_name, MakeRefCounted()) + .first; + } + return iter->second; +} + +void XdsClientStats::PruneLocalityStats() { + auto iter = upstream_locality_stats_.begin(); + while (iter != upstream_locality_stats_.end()) { + if (iter->second->IsSafeToDelete()) { + iter = upstream_locality_stats_.erase(iter); + } else { + ++iter; + } + } +} + +void XdsClientStats::AddCallDropped(UniquePtr category) { + total_dropped_requests_.FetchAdd(1, MemoryOrder::RELAXED); + MutexLock lock(&dropped_requests_mu_); + auto iter = dropped_requests_.find(category); + if (iter == dropped_requests_.end()) { + dropped_requests_.emplace(UniquePtr(gpr_strdup(category.get())), 1); + } else { + ++iter->second; + } } } // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h b/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h index fa0b9f4b635..445675a4dcf 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h @@ -21,49 +21,207 @@ #include -#include +#include +#include "src/core/lib/gprpp/atomic.h" #include "src/core/lib/gprpp/inlined_vector.h" +#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/ref_counted.h" +#include "src/core/lib/gprpp/sync.h" +#include "src/core/lib/iomgr/exec_ctx.h" namespace grpc_core { -class XdsLbClientStats : public RefCounted { +class XdsLocalityName : public RefCounted { public: - struct DropTokenCount { - UniquePtr token; - int64_t count; + struct Less { + bool operator()(const RefCountedPtr& lhs, + const RefCountedPtr& rhs) { + int cmp_result = strcmp(lhs->region_.get(), rhs->region_.get()); + if (cmp_result != 0) return cmp_result < 0; + cmp_result = strcmp(lhs->zone_.get(), rhs->zone_.get()); + if (cmp_result != 0) return cmp_result < 0; + return strcmp(lhs->sub_zone_.get(), rhs->sub_zone_.get()) < 0; + } + }; + + XdsLocalityName(UniquePtr region, UniquePtr zone, + UniquePtr subzone) + : region_(std::move(region)), + zone_(std::move(zone)), + sub_zone_(std::move(subzone)) {} + + bool operator==(const XdsLocalityName& other) const { + return strcmp(region_.get(), other.region_.get()) == 0 && + strcmp(zone_.get(), other.zone_.get()) == 0 && + strcmp(sub_zone_.get(), other.sub_zone_.get()) == 0; + } + + const char* region() const { return region_.get(); } + const char* zone() const { return zone_.get(); } + const char* sub_zone() const { return sub_zone_.get(); } + + const char* AsHumanReadableString() { + if (human_readable_string_ == nullptr) { + char* tmp; + gpr_asprintf(&tmp, "{region=\"%s\", zone=\"%s\", sub_zone=\"%s\"}", + region_.get(), zone_.get(), sub_zone_.get()); + human_readable_string_.reset(tmp); + } + return human_readable_string_.get(); + } + + private: + UniquePtr region_; + UniquePtr zone_; + UniquePtr sub_zone_; + UniquePtr human_readable_string_; +}; + +// The stats classes (i.e., XdsClientStats, LocalityStats, and LoadMetric) can +// be taken a snapshot (and reset) to populate the load report. The snapshots +// are contained in the respective Snapshot structs. The Snapshot structs have +// no synchronization. The stats classes use several different synchronization +// methods. 1. Most of the counters are Atomic<>s for performance. 2. Some of +// the Map<>s are protected by Mutex if we are not guaranteed that the accesses +// to them are synchronized by the callers. 3. The Map<>s to which the accesses +// are already synchronized by the callers do not have additional +// synchronization here. Note that the Map<>s we mentioned in 2 and 3 refer to +// the map's tree structure rather than the content in each tree node. +class XdsClientStats { + public: + class LocalityStats : public RefCounted { + public: + class LoadMetric { + public: + struct Snapshot { + bool IsAllZero() const; - DropTokenCount(UniquePtr token, int64_t count) - : token(std::move(token)), count(count) {} + uint64_t num_requests_finished_with_metric; + double total_metric_value; + }; + + // Returns a snapshot of this instance and reset all the accumulative + // counters. + Snapshot GetSnapshotAndReset(); + + private: + uint64_t num_requests_finished_with_metric_{0}; + double total_metric_value_{0}; + }; + + using LoadMetricMap = Map, LoadMetric, StringLess>; + using LoadMetricSnapshotMap = + Map, LoadMetric::Snapshot, StringLess>; + + struct Snapshot { + // TODO(juanlishen): Change this to const method when const_iterator is + // added to Map<>. + bool IsAllZero(); + + uint64_t total_successful_requests; + uint64_t total_requests_in_progress; + uint64_t total_error_requests; + uint64_t total_issued_requests; + LoadMetricSnapshotMap load_metric_stats; + }; + + // Returns a snapshot of this instance and reset all the accumulative + // counters. + Snapshot GetSnapshotAndReset(); + + // Each XdsLb::PickerWrapper holds a ref to the perspective LocalityStats. + // If the refcount is 0, there won't be new calls recorded to the + // LocalityStats, so the LocalityStats can be safely deleted when all the + // in-progress calls have finished. + // Only be called from the control plane combiner. + void RefByPicker() { picker_refcount_.FetchAdd(1, MemoryOrder::ACQ_REL); } + // Might be called from the control plane combiner or the data plane + // combiner. + // TODO(juanlishen): Once https://github.com/grpc/grpc/pull/19390 is merged, + // this method will also only be invoked in the control plane combiner. + // We may then be able to simplify the LocalityStats' lifetime by making it + // RefCounted<> and populating the protobuf in its dtor. + void UnrefByPicker() { picker_refcount_.FetchSub(1, MemoryOrder::ACQ_REL); } + // Only be called from the control plane combiner. + // The only place where the picker_refcount_ can be increased is + // RefByPicker(), which also can only be called from the control plane + // combiner. Also, if the picker_refcount_ is 0, total_requests_in_progress_ + // can't be increased from 0. So it's safe to delete the LocalityStats right + // after this method returns true. + bool IsSafeToDelete() { + return picker_refcount_.FetchAdd(0, MemoryOrder::ACQ_REL) == 0 && + total_requests_in_progress_.FetchAdd(0, MemoryOrder::ACQ_REL) == 0; + } + + void AddCallStarted(); + void AddCallFinished(bool fail = false); + + private: + Atomic total_successful_requests_{0}; + Atomic total_requests_in_progress_{0}; + // Requests that were issued (not dropped) but failed. + Atomic total_error_requests_{0}; + Atomic total_issued_requests_{0}; + // Protects load_metric_stats_. A mutex is necessary because the length of + // load_metric_stats_ can be accessed by both the callback intercepting the + // call's recv_trailing_metadata (not from any combiner) and the load + // reporting thread (from the control plane combiner). + Mutex load_metric_stats_mu_; + LoadMetricMap load_metric_stats_; + // Can be accessed from either the control plane combiner or the data plane + // combiner. + Atomic picker_refcount_{0}; }; - typedef InlinedVector DroppedCallCounts; + // TODO(juanlishen): The value type of Map<> must be movable in current + // implementation. To avoid making LocalityStats movable, we wrap it by + // UniquePtr<>. We should remove this wrapper if the value type of Map<> + // doesn't have to be movable. + using LocalityStatsMap = + Map, RefCountedPtr, + XdsLocalityName::Less>; + using LocalityStatsSnapshotMap = + Map, LocalityStats::Snapshot, + XdsLocalityName::Less>; + using DroppedRequestsMap = Map, uint64_t, StringLess>; + using DroppedRequestsSnapshotMap = DroppedRequestsMap; - XdsLbClientStats() {} + struct Snapshot { + // TODO(juanlishen): Change this to const method when const_iterator is + // added to Map<>. + bool IsAllZero(); - void AddCallStarted(); - void AddCallFinished(bool finished_with_client_failed_to_send, - bool finished_known_received); + LocalityStatsSnapshotMap upstream_locality_stats; + uint64_t total_dropped_requests; + DroppedRequestsSnapshotMap dropped_requests; + // The actual load report interval. + grpc_millis load_report_interval; + }; - // This method is not thread-safe; caller must synchronize. - void AddCallDroppedLocked(char* token); + // Returns a snapshot of this instance and reset all the accumulative + // counters. + Snapshot GetSnapshotAndReset(); - // This method is not thread-safe; caller must synchronize. - void GetLocked(int64_t* num_calls_started, int64_t* num_calls_finished, - int64_t* num_calls_finished_with_client_failed_to_send, - int64_t* num_calls_finished_known_received, - UniquePtr* drop_token_counts); + void MaybeInitLastReportTime(); + RefCountedPtr FindLocalityStats( + const RefCountedPtr& locality_name); + void PruneLocalityStats(); + void AddCallDropped(UniquePtr category); private: - // This field must only be accessed via *_locked() methods. - UniquePtr drop_token_counts_; - // These fields may be accessed from multiple threads at a time. - gpr_atm num_calls_started_ = 0; - gpr_atm num_calls_finished_ = 0; - gpr_atm num_calls_finished_with_client_failed_to_send_ = 0; - gpr_atm num_calls_finished_known_received_ = 0; + // The stats for each locality. + LocalityStatsMap upstream_locality_stats_; + Atomic total_dropped_requests_{0}; + // Protects dropped_requests_. A mutex is necessary because the length of + // dropped_requests_ can be accessed by both the picker (from data plane + // combiner) and the load reporting thread (from the control plane combiner). + Mutex dropped_requests_mu_; + DroppedRequestsMap dropped_requests_; + // The timestamp of last reporting. For the LB-policy-wide first report, the + // last_report_time is the time we scheduled the first reporting timer. + grpc_millis last_report_time_ = -1; }; } // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc index 8ae6a5e7590..b2615f319b9 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc @@ -33,7 +33,10 @@ #include "envoy/api/v2/discovery.upb.h" #include "envoy/api/v2/eds.upb.h" #include "envoy/api/v2/endpoint/endpoint.upb.h" +#include "envoy/api/v2/endpoint/load_report.upb.h" +#include "envoy/service/load_stats/v2/lrs.upb.h" #include "google/protobuf/any.upb.h" +#include "google/protobuf/duration.upb.h" #include "google/protobuf/struct.upb.h" #include "google/protobuf/timestamp.upb.h" #include "google/protobuf/wrappers.upb.h" @@ -209,54 +212,163 @@ grpc_error* XdsEdsResponseDecodeAndParse(const grpc_slice& encoded_response, namespace { -void google_protobuf_Timestamp_assign(google_protobuf_Timestamp* timestamp, - const gpr_timespec& value) { - google_protobuf_Timestamp_set_seconds(timestamp, value.tv_sec); - google_protobuf_Timestamp_set_nanos(timestamp, value.tv_nsec); +grpc_slice LrsRequestEncode( + const envoy_service_load_stats_v2_LoadStatsRequest* request, + upb_arena* arena) { + size_t output_length; + char* output = envoy_service_load_stats_v2_LoadStatsRequest_serialize( + request, arena, &output_length); + return grpc_slice_from_copied_buffer(output, output_length); } } // namespace -xds_grpclb_request* xds_grpclb_load_report_request_create_locked( - grpc_core::XdsLbClientStats* client_stats, upb_arena* arena) { - xds_grpclb_request* req = grpc_lb_v1_LoadBalanceRequest_new(arena); - grpc_lb_v1_ClientStats* req_stats = - grpc_lb_v1_LoadBalanceRequest_mutable_client_stats(req, arena); - google_protobuf_Timestamp_assign( - grpc_lb_v1_ClientStats_mutable_timestamp(req_stats, arena), - gpr_now(GPR_CLOCK_REALTIME)); +grpc_slice XdsLrsRequestCreateAndEncode(const char* server_name) { + upb::Arena arena; + // Create a request. + envoy_service_load_stats_v2_LoadStatsRequest* request = + envoy_service_load_stats_v2_LoadStatsRequest_new(arena.ptr()); + // Add cluster stats. There is only one because we only use one server name in + // one channel. + envoy_api_v2_endpoint_ClusterStats* cluster_stats = + envoy_service_load_stats_v2_LoadStatsRequest_add_cluster_stats( + request, arena.ptr()); + // Set the cluster name. + envoy_api_v2_endpoint_ClusterStats_set_cluster_name( + cluster_stats, upb_strview_makez(server_name)); + return LrsRequestEncode(request, arena.ptr()); +} + +namespace { + +void LocalityStatsPopulate(envoy_api_v2_endpoint_UpstreamLocalityStats* output, + Pair, + XdsClientStats::LocalityStats::Snapshot>& input, + upb_arena* arena) { + // Set sub_zone. + envoy_api_v2_core_Locality* locality = + envoy_api_v2_endpoint_UpstreamLocalityStats_mutable_locality(output, + arena); + envoy_api_v2_core_Locality_set_sub_zone( + locality, upb_strview_makez(input.first->sub_zone())); + // Set total counts. + XdsClientStats::LocalityStats::Snapshot& snapshot = input.second; + envoy_api_v2_endpoint_UpstreamLocalityStats_set_total_successful_requests( + output, snapshot.total_successful_requests); + envoy_api_v2_endpoint_UpstreamLocalityStats_set_total_requests_in_progress( + output, snapshot.total_requests_in_progress); + envoy_api_v2_endpoint_UpstreamLocalityStats_set_total_error_requests( + output, snapshot.total_error_requests); + envoy_api_v2_endpoint_UpstreamLocalityStats_set_total_issued_requests( + output, snapshot.total_issued_requests); + // Add load metric stats. + for (auto& p : snapshot.load_metric_stats) { + const char* metric_name = p.first.get(); + const XdsClientStats::LocalityStats::LoadMetric::Snapshot& metric_value = + p.second; + envoy_api_v2_endpoint_EndpointLoadMetricStats* load_metric = + envoy_api_v2_endpoint_UpstreamLocalityStats_add_load_metric_stats( + output, arena); + envoy_api_v2_endpoint_EndpointLoadMetricStats_set_metric_name( + load_metric, upb_strview_makez(metric_name)); + envoy_api_v2_endpoint_EndpointLoadMetricStats_set_num_requests_finished_with_metric( + load_metric, metric_value.num_requests_finished_with_metric); + envoy_api_v2_endpoint_EndpointLoadMetricStats_set_total_metric_value( + load_metric, metric_value.total_metric_value); + } +} - int64_t num_calls_started; - int64_t num_calls_finished; - int64_t num_calls_finished_with_client_failed_to_send; - int64_t num_calls_finished_known_received; - UniquePtr drop_token_counts; - client_stats->GetLocked(&num_calls_started, &num_calls_finished, - &num_calls_finished_with_client_failed_to_send, - &num_calls_finished_known_received, - &drop_token_counts); - grpc_lb_v1_ClientStats_set_num_calls_started(req_stats, num_calls_started); - grpc_lb_v1_ClientStats_set_num_calls_finished(req_stats, num_calls_finished); - grpc_lb_v1_ClientStats_set_num_calls_finished_with_client_failed_to_send( - req_stats, num_calls_finished_with_client_failed_to_send); - grpc_lb_v1_ClientStats_set_num_calls_finished_known_received( - req_stats, num_calls_finished_known_received); - if (drop_token_counts != nullptr) { - for (size_t i = 0; i < drop_token_counts->size(); ++i) { - XdsLbClientStats::DropTokenCount& cur = (*drop_token_counts)[i]; - grpc_lb_v1_ClientStatsPerToken* cur_msg = - grpc_lb_v1_ClientStats_add_calls_finished_with_drop(req_stats, arena); +} // namespace - const size_t token_len = strlen(cur.token.get()); - char* token = reinterpret_cast(upb_arena_malloc(arena, token_len)); - memcpy(token, cur.token.get(), token_len); +grpc_slice XdsLrsRequestCreateAndEncode(const char* server_name, + XdsClientStats* client_stats) { + upb::Arena arena; + XdsClientStats::Snapshot snapshot = client_stats->GetSnapshotAndReset(); + // Prune unused locality stats. + client_stats->PruneLocalityStats(); + // When all the counts are zero, return empty slice. + if (snapshot.IsAllZero()) return grpc_empty_slice(); + // Create a request. + envoy_service_load_stats_v2_LoadStatsRequest* request = + envoy_service_load_stats_v2_LoadStatsRequest_new(arena.ptr()); + // Add cluster stats. There is only one because we only use one server name in + // one channel. + envoy_api_v2_endpoint_ClusterStats* cluster_stats = + envoy_service_load_stats_v2_LoadStatsRequest_add_cluster_stats( + request, arena.ptr()); + // Set the cluster name. + envoy_api_v2_endpoint_ClusterStats_set_cluster_name( + cluster_stats, upb_strview_makez(server_name)); + // Add locality stats. + for (auto& p : snapshot.upstream_locality_stats) { + envoy_api_v2_endpoint_UpstreamLocalityStats* locality_stats = + envoy_api_v2_endpoint_ClusterStats_add_upstream_locality_stats( + cluster_stats, arena.ptr()); + LocalityStatsPopulate(locality_stats, p, arena.ptr()); + } + // Add dropped requests. + for (auto& p : snapshot.dropped_requests) { + const char* category = p.first.get(); + const uint64_t count = p.second; + envoy_api_v2_endpoint_ClusterStats_DroppedRequests* dropped_requests = + envoy_api_v2_endpoint_ClusterStats_add_dropped_requests(cluster_stats, + arena.ptr()); + envoy_api_v2_endpoint_ClusterStats_DroppedRequests_set_category( + dropped_requests, upb_strview_makez(category)); + envoy_api_v2_endpoint_ClusterStats_DroppedRequests_set_dropped_count( + dropped_requests, count); + } + // Set total dropped requests. + envoy_api_v2_endpoint_ClusterStats_set_total_dropped_requests( + cluster_stats, snapshot.total_dropped_requests); + // Set real load report interval. + gpr_timespec timespec = + grpc_millis_to_timespec(snapshot.load_report_interval, GPR_TIMESPAN); + google_protobuf_Duration* load_report_interval = + envoy_api_v2_endpoint_ClusterStats_mutable_load_report_interval( + cluster_stats, arena.ptr()); + google_protobuf_Duration_set_seconds(load_report_interval, timespec.tv_sec); + google_protobuf_Duration_set_nanos(load_report_interval, timespec.tv_nsec); + return LrsRequestEncode(request, arena.ptr()); +} - grpc_lb_v1_ClientStatsPerToken_set_load_balance_token( - cur_msg, upb_strview_make(token, token_len)); - grpc_lb_v1_ClientStatsPerToken_set_num_calls(cur_msg, cur.count); - } +grpc_error* XdsLrsResponseDecodeAndParse(const grpc_slice& encoded_response, + grpc_millis* load_reporting_interval, + const char* expected_server_name) { + upb::Arena arena; + // Decode the response. + const envoy_service_load_stats_v2_LoadStatsResponse* decoded_response = + envoy_service_load_stats_v2_LoadStatsResponse_parse( + reinterpret_cast(GRPC_SLICE_START_PTR(encoded_response)), + GRPC_SLICE_LENGTH(encoded_response), arena.ptr()); + // Parse the response. + if (decoded_response == nullptr) { + return GRPC_ERROR_CREATE_FROM_STATIC_STRING("No response found."); + } + // Check the cluster size in the response. + size_t size; + const upb_strview* clusters = + envoy_service_load_stats_v2_LoadStatsResponse_clusters(decoded_response, + &size); + if (size != 1) { + return GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "The number of clusters (server names) is not 1."); } - return req; + // Check the cluster name in the response + if (strncmp(expected_server_name, clusters[0].data, clusters[0].size) != 0) { + return GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "Unexpected cluster (server name)."); + } + // Get the load report interval. + const google_protobuf_Duration* load_reporting_interval_duration = + envoy_service_load_stats_v2_LoadStatsResponse_load_reporting_interval( + decoded_response); + gpr_timespec timespec{ + google_protobuf_Duration_seconds(load_reporting_interval_duration), + google_protobuf_Duration_nanos(load_reporting_interval_duration), + GPR_TIMESPAN}; + *load_reporting_interval = gpr_time_to_millis(timespec); + return GRPC_ERROR_NONE; } } // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h index 8e31584e257..ed3b49ff836 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h @@ -25,58 +25,9 @@ #include "src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h" #include "src/core/ext/filters/client_channel/server_address.h" -#include "src/proto/grpc/lb/v1/load_balancer.upb.h" namespace grpc_core { -typedef grpc_lb_v1_LoadBalanceRequest xds_grpclb_request; - -class XdsLocalityName : public RefCounted { - public: - struct Less { - bool operator()(const RefCountedPtr& lhs, - const RefCountedPtr& rhs) { - int cmp_result = strcmp(lhs->region_.get(), rhs->region_.get()); - if (cmp_result != 0) return cmp_result < 0; - cmp_result = strcmp(lhs->zone_.get(), rhs->zone_.get()); - if (cmp_result != 0) return cmp_result < 0; - return strcmp(lhs->sub_zone_.get(), rhs->sub_zone_.get()) < 0; - } - }; - - XdsLocalityName(UniquePtr region, UniquePtr zone, - UniquePtr sub_zone) - : region_(std::move(region)), - zone_(std::move(zone)), - sub_zone_(std::move(sub_zone)) {} - - bool operator==(const XdsLocalityName& other) const { - return strcmp(region_.get(), other.region_.get()) == 0 && - strcmp(zone_.get(), other.zone_.get()) == 0 && - strcmp(sub_zone_.get(), other.sub_zone_.get()) == 0; - } - - const char* region() const { return region_.get(); } - const char* zone() const { return zone_.get(); } - const char* sub_zone() const { return sub_zone_.get(); } - - const char* AsHumanReadableString() { - if (human_readable_string_ == nullptr) { - char* tmp; - gpr_asprintf(&tmp, "{region=\"%s\", zone=\"%s\", sub_zone=\"%s\"}", - region_.get(), zone_.get(), sub_zone_.get()); - human_readable_string_.reset(tmp); - } - return human_readable_string_.get(); - } - - private: - UniquePtr region_; - UniquePtr zone_; - UniquePtr sub_zone_; - UniquePtr human_readable_string_; -}; - struct XdsLocalityInfo { bool operator==(const XdsLocalityInfo& other) const { return *locality_name == *other.locality_name && @@ -112,9 +63,20 @@ grpc_slice XdsEdsRequestCreateAndEncode(const char* service_name); grpc_error* XdsEdsResponseDecodeAndParse(const grpc_slice& encoded_response, XdsUpdate* update); -// TODO(juanlishen): Delete these when LRS is added. -xds_grpclb_request* xds_grpclb_load_report_request_create_locked( - grpc_core::XdsLbClientStats* client_stats, upb_arena* arena); +// Creates an LRS request querying \a server_name. +grpc_slice XdsLrsRequestCreateAndEncode(const char* server_name); + +// Creates an LRS request sending client-side load reports. If all the counters +// in \a client_stats are zero, returns empty slice. +grpc_slice XdsLrsRequestCreateAndEncode(const char* server_name, + XdsClientStats* client_stats); + +// Parses the LRS response and returns the client-side load reporting interval. +// If there is any error (e.g., the found server name doesn't match \a +// expected_server_name), the output config is invalid. +grpc_error* XdsLrsResponseDecodeAndParse(const grpc_slice& encoded_response, + grpc_millis* load_reporting_interval, + const char* expected_server_name); } // namespace grpc_core diff --git a/src/core/lib/gprpp/atomic.h b/src/core/lib/gprpp/atomic.h index 80412ef9583..095ebf12565 100644 --- a/src/core/lib/gprpp/atomic.h +++ b/src/core/lib/gprpp/atomic.h @@ -49,6 +49,10 @@ class Atomic { storage_.store(val, static_cast(order)); } + T Exchange(T desired, MemoryOrder order) { + return storage_.exchange(desired, static_cast(order)); + } + bool CompareExchangeWeak(T* expected, T desired, MemoryOrder success, MemoryOrder failure) { return GPR_ATM_INC_CAS_THEN(storage_.compare_exchange_weak( diff --git a/src/core/lib/gprpp/map.h b/src/core/lib/gprpp/map.h index 5238f43469f..d133a89fb43 100644 --- a/src/core/lib/gprpp/map.h +++ b/src/core/lib/gprpp/map.h @@ -89,7 +89,7 @@ class Map { // Removes the current entry and points to the next one iterator erase(iterator iter); - size_t size() { return size_; } + size_t size() const { return size_; } template Pair emplace(Args&&... args); diff --git a/src/core/lib/transport/static_metadata.cc b/src/core/lib/transport/static_metadata.cc index d72ea3f63ae..e2e618726f1 100644 --- a/src/core/lib/transport/static_metadata.cc +++ b/src/core/lib/transport/static_metadata.cc @@ -63,61 +63,66 @@ static uint8_t g_bytes[] = { 116, 101, 115, 47, 103, 114, 112, 99, 46, 108, 98, 46, 118, 49, 46, 76, 111, 97, 100, 66, 97, 108, 97, 110, 99, 101, 114, 47, 66, 97, 108, 97, 110, 99, 101, 76, 111, 97, 100, 47, 101, 110, 118, 111, 121, - 46, 97, 112, 105, 46, 118, 50, 46, 69, 110, 100, 112, 111, 105, 110, - 116, 68, 105, 115, 99, 111, 118, 101, 114, 121, 83, 101, 114, 118, 105, - 99, 101, 47, 83, 116, 114, 101, 97, 109, 69, 110, 100, 112, 111, 105, - 110, 116, 115, 47, 103, 114, 112, 99, 46, 104, 101, 97, 108, 116, 104, - 46, 118, 49, 46, 72, 101, 97, 108, 116, 104, 47, 87, 97, 116, 99, - 104, 47, 101, 110, 118, 111, 121, 46, 115, 101, 114, 118, 105, 99, 101, - 46, 100, 105, 115, 99, 111, 118, 101, 114, 121, 46, 118, 50, 46, 65, - 103, 103, 114, 101, 103, 97, 116, 101, 100, 68, 105, 115, 99, 111, 118, - 101, 114, 121, 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, 114, 101, - 97, 109, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 82, 101, 115, - 111, 117, 114, 99, 101, 115, 100, 101, 102, 108, 97, 116, 101, 103, 122, - 105, 112, 115, 116, 114, 101, 97, 109, 47, 103, 122, 105, 112, 71, 69, - 84, 80, 79, 83, 84, 47, 47, 105, 110, 100, 101, 120, 46, 104, 116, - 109, 108, 104, 116, 116, 112, 104, 116, 116, 112, 115, 50, 48, 48, 50, - 48, 52, 50, 48, 54, 51, 48, 52, 52, 48, 48, 52, 48, 52, 53, - 48, 48, 97, 99, 99, 101, 112, 116, 45, 99, 104, 97, 114, 115, 101, - 116, 103, 122, 105, 112, 44, 32, 100, 101, 102, 108, 97, 116, 101, 97, - 99, 99, 101, 112, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 97, - 99, 99, 101, 112, 116, 45, 114, 97, 110, 103, 101, 115, 97, 99, 99, - 101, 112, 116, 97, 99, 99, 101, 115, 115, 45, 99, 111, 110, 116, 114, - 111, 108, 45, 97, 108, 108, 111, 119, 45, 111, 114, 105, 103, 105, 110, - 97, 103, 101, 97, 108, 108, 111, 119, 97, 117, 116, 104, 111, 114, 105, - 122, 97, 116, 105, 111, 110, 99, 97, 99, 104, 101, 45, 99, 111, 110, - 116, 114, 111, 108, 99, 111, 110, 116, 101, 110, 116, 45, 100, 105, 115, - 112, 111, 115, 105, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, - 45, 108, 97, 110, 103, 117, 97, 103, 101, 99, 111, 110, 116, 101, 110, - 116, 45, 108, 101, 110, 103, 116, 104, 99, 111, 110, 116, 101, 110, 116, - 45, 108, 111, 99, 97, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, - 116, 45, 114, 97, 110, 103, 101, 99, 111, 111, 107, 105, 101, 100, 97, - 116, 101, 101, 116, 97, 103, 101, 120, 112, 101, 99, 116, 101, 120, 112, - 105, 114, 101, 115, 102, 114, 111, 109, 105, 102, 45, 109, 97, 116, 99, - 104, 105, 102, 45, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, - 110, 99, 101, 105, 102, 45, 110, 111, 110, 101, 45, 109, 97, 116, 99, - 104, 105, 102, 45, 114, 97, 110, 103, 101, 105, 102, 45, 117, 110, 109, - 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 108, 97, - 115, 116, 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 105, 110, 107, - 108, 111, 99, 97, 116, 105, 111, 110, 109, 97, 120, 45, 102, 111, 114, - 119, 97, 114, 100, 115, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, - 101, 110, 116, 105, 99, 97, 116, 101, 112, 114, 111, 120, 121, 45, 97, - 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 114, 97, 110, - 103, 101, 114, 101, 102, 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, - 104, 114, 101, 116, 114, 121, 45, 97, 102, 116, 101, 114, 115, 101, 114, - 118, 101, 114, 115, 101, 116, 45, 99, 111, 111, 107, 105, 101, 115, 116, - 114, 105, 99, 116, 45, 116, 114, 97, 110, 115, 112, 111, 114, 116, 45, - 115, 101, 99, 117, 114, 105, 116, 121, 116, 114, 97, 110, 115, 102, 101, - 114, 45, 101, 110, 99, 111, 100, 105, 110, 103, 118, 97, 114, 121, 118, - 105, 97, 119, 119, 119, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, - 97, 116, 101, 48, 105, 100, 101, 110, 116, 105, 116, 121, 116, 114, 97, - 105, 108, 101, 114, 115, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, - 110, 47, 103, 114, 112, 99, 103, 114, 112, 99, 80, 85, 84, 108, 98, - 45, 99, 111, 115, 116, 45, 98, 105, 110, 105, 100, 101, 110, 116, 105, - 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, 100, 101, 110, 116, - 105, 116, 121, 44, 103, 122, 105, 112, 100, 101, 102, 108, 97, 116, 101, - 44, 103, 122, 105, 112, 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, - 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112}; + 46, 115, 101, 114, 118, 105, 99, 101, 46, 108, 111, 97, 100, 95, 115, + 116, 97, 116, 115, 46, 118, 50, 46, 76, 111, 97, 100, 82, 101, 112, + 111, 114, 116, 105, 110, 103, 83, 101, 114, 118, 105, 99, 101, 47, 83, + 116, 114, 101, 97, 109, 76, 111, 97, 100, 83, 116, 97, 116, 115, 47, + 101, 110, 118, 111, 121, 46, 97, 112, 105, 46, 118, 50, 46, 69, 110, + 100, 112, 111, 105, 110, 116, 68, 105, 115, 99, 111, 118, 101, 114, 121, + 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, 114, 101, 97, 109, 69, + 110, 100, 112, 111, 105, 110, 116, 115, 47, 103, 114, 112, 99, 46, 104, + 101, 97, 108, 116, 104, 46, 118, 49, 46, 72, 101, 97, 108, 116, 104, + 47, 87, 97, 116, 99, 104, 47, 101, 110, 118, 111, 121, 46, 115, 101, + 114, 118, 105, 99, 101, 46, 100, 105, 115, 99, 111, 118, 101, 114, 121, + 46, 118, 50, 46, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 68, + 105, 115, 99, 111, 118, 101, 114, 121, 83, 101, 114, 118, 105, 99, 101, + 47, 83, 116, 114, 101, 97, 109, 65, 103, 103, 114, 101, 103, 97, 116, + 101, 100, 82, 101, 115, 111, 117, 114, 99, 101, 115, 100, 101, 102, 108, + 97, 116, 101, 103, 122, 105, 112, 115, 116, 114, 101, 97, 109, 47, 103, + 122, 105, 112, 71, 69, 84, 80, 79, 83, 84, 47, 47, 105, 110, 100, + 101, 120, 46, 104, 116, 109, 108, 104, 116, 116, 112, 104, 116, 116, 112, + 115, 50, 48, 48, 50, 48, 52, 50, 48, 54, 51, 48, 52, 52, 48, + 48, 52, 48, 52, 53, 48, 48, 97, 99, 99, 101, 112, 116, 45, 99, + 104, 97, 114, 115, 101, 116, 103, 122, 105, 112, 44, 32, 100, 101, 102, + 108, 97, 116, 101, 97, 99, 99, 101, 112, 116, 45, 108, 97, 110, 103, + 117, 97, 103, 101, 97, 99, 99, 101, 112, 116, 45, 114, 97, 110, 103, + 101, 115, 97, 99, 99, 101, 112, 116, 97, 99, 99, 101, 115, 115, 45, + 99, 111, 110, 116, 114, 111, 108, 45, 97, 108, 108, 111, 119, 45, 111, + 114, 105, 103, 105, 110, 97, 103, 101, 97, 108, 108, 111, 119, 97, 117, + 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 99, 97, 99, 104, + 101, 45, 99, 111, 110, 116, 114, 111, 108, 99, 111, 110, 116, 101, 110, + 116, 45, 100, 105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 99, 111, + 110, 116, 101, 110, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 99, + 111, 110, 116, 101, 110, 116, 45, 108, 101, 110, 103, 116, 104, 99, 111, + 110, 116, 101, 110, 116, 45, 108, 111, 99, 97, 116, 105, 111, 110, 99, + 111, 110, 116, 101, 110, 116, 45, 114, 97, 110, 103, 101, 99, 111, 111, + 107, 105, 101, 100, 97, 116, 101, 101, 116, 97, 103, 101, 120, 112, 101, + 99, 116, 101, 120, 112, 105, 114, 101, 115, 102, 114, 111, 109, 105, 102, + 45, 109, 97, 116, 99, 104, 105, 102, 45, 109, 111, 100, 105, 102, 105, + 101, 100, 45, 115, 105, 110, 99, 101, 105, 102, 45, 110, 111, 110, 101, + 45, 109, 97, 116, 99, 104, 105, 102, 45, 114, 97, 110, 103, 101, 105, + 102, 45, 117, 110, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, + 110, 99, 101, 108, 97, 115, 116, 45, 109, 111, 100, 105, 102, 105, 101, + 100, 108, 105, 110, 107, 108, 111, 99, 97, 116, 105, 111, 110, 109, 97, + 120, 45, 102, 111, 114, 119, 97, 114, 100, 115, 112, 114, 111, 120, 121, + 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 112, 114, + 111, 120, 121, 45, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, + 111, 110, 114, 97, 110, 103, 101, 114, 101, 102, 101, 114, 101, 114, 114, + 101, 102, 114, 101, 115, 104, 114, 101, 116, 114, 121, 45, 97, 102, 116, + 101, 114, 115, 101, 114, 118, 101, 114, 115, 101, 116, 45, 99, 111, 111, + 107, 105, 101, 115, 116, 114, 105, 99, 116, 45, 116, 114, 97, 110, 115, + 112, 111, 114, 116, 45, 115, 101, 99, 117, 114, 105, 116, 121, 116, 114, + 97, 110, 115, 102, 101, 114, 45, 101, 110, 99, 111, 100, 105, 110, 103, + 118, 97, 114, 121, 118, 105, 97, 119, 119, 119, 45, 97, 117, 116, 104, + 101, 110, 116, 105, 99, 97, 116, 101, 48, 105, 100, 101, 110, 116, 105, + 116, 121, 116, 114, 97, 105, 108, 101, 114, 115, 97, 112, 112, 108, 105, + 99, 97, 116, 105, 111, 110, 47, 103, 114, 112, 99, 103, 114, 112, 99, + 80, 85, 84, 108, 98, 45, 99, 111, 115, 116, 45, 98, 105, 110, 105, + 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, + 105, 100, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100, 101, + 102, 108, 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, 116, + 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, + 112}; grpc_slice_refcount grpc_core::StaticSliceRefcount::kStaticSubRefcount; grpc_core::StaticSliceRefcount @@ -229,6 +234,7 @@ grpc_core::StaticSliceRefcount grpc_core::StaticSliceRefcount(104), grpc_core::StaticSliceRefcount(105), grpc_core::StaticSliceRefcount(106), + grpc_core::StaticSliceRefcount(107), }; const grpc_core::StaticMetadataSlice @@ -302,151 +308,153 @@ const grpc_core::StaticMetadataSlice grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[33].base, 36, g_bytes + 438), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[34].base, - 54, g_bytes + 474), + 65, g_bytes + 474), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[35].base, - 28, g_bytes + 528), + 54, g_bytes + 539), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36].base, - 80, g_bytes + 556), + 28, g_bytes + 593), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, - 7, g_bytes + 636), + 80, g_bytes + 621), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, - 4, g_bytes + 643), + 7, g_bytes + 701), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, - 11, g_bytes + 647), + 4, g_bytes + 708), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40].base, - 3, g_bytes + 658), + 11, g_bytes + 712), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41].base, - 4, g_bytes + 661), + 3, g_bytes + 723), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42].base, - 1, g_bytes + 665), + 4, g_bytes + 726), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43].base, - 11, g_bytes + 666), + 1, g_bytes + 730), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44].base, - 4, g_bytes + 677), + 11, g_bytes + 731), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45].base, - 5, g_bytes + 681), + 4, g_bytes + 742), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46].base, - 3, g_bytes + 686), + 5, g_bytes + 746), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47].base, - 3, g_bytes + 689), + 3, g_bytes + 751), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48].base, - 3, g_bytes + 692), + 3, g_bytes + 754), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49].base, - 3, g_bytes + 695), + 3, g_bytes + 757), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50].base, - 3, g_bytes + 698), + 3, g_bytes + 760), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51].base, - 3, g_bytes + 701), + 3, g_bytes + 763), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52].base, - 3, g_bytes + 704), + 3, g_bytes + 766), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53].base, - 14, g_bytes + 707), + 3, g_bytes + 769), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54].base, - 13, g_bytes + 721), + 14, g_bytes + 772), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55].base, - 15, g_bytes + 734), + 13, g_bytes + 786), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56].base, - 13, g_bytes + 749), + 15, g_bytes + 799), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57].base, - 6, g_bytes + 762), + 13, g_bytes + 814), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58].base, - 27, g_bytes + 768), + 6, g_bytes + 827), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59].base, - 3, g_bytes + 795), + 27, g_bytes + 833), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60].base, - 5, g_bytes + 798), + 3, g_bytes + 860), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61].base, - 13, g_bytes + 803), + 5, g_bytes + 863), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62].base, - 13, g_bytes + 816), + 13, g_bytes + 868), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63].base, - 19, g_bytes + 829), + 13, g_bytes + 881), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64].base, - 16, g_bytes + 848), + 19, g_bytes + 894), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65].base, - 14, g_bytes + 864), + 16, g_bytes + 913), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66].base, - 16, g_bytes + 878), + 14, g_bytes + 929), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67].base, - 13, g_bytes + 894), + 16, g_bytes + 943), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68].base, - 6, g_bytes + 907), + 13, g_bytes + 959), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69].base, - 4, g_bytes + 913), + 6, g_bytes + 972), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70].base, - 4, g_bytes + 917), + 4, g_bytes + 978), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71].base, - 6, g_bytes + 921), + 4, g_bytes + 982), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72].base, - 7, g_bytes + 927), + 6, g_bytes + 986), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73].base, - 4, g_bytes + 934), + 7, g_bytes + 992), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74].base, - 8, g_bytes + 938), + 4, g_bytes + 999), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75].base, - 17, g_bytes + 946), + 8, g_bytes + 1003), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76].base, - 13, g_bytes + 963), + 17, g_bytes + 1011), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77].base, - 8, g_bytes + 976), + 13, g_bytes + 1028), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78].base, - 19, g_bytes + 984), + 8, g_bytes + 1041), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79].base, - 13, g_bytes + 1003), + 19, g_bytes + 1049), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80].base, - 4, g_bytes + 1016), + 13, g_bytes + 1068), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81].base, - 8, g_bytes + 1020), + 4, g_bytes + 1081), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82].base, - 12, g_bytes + 1028), + 8, g_bytes + 1085), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83].base, - 18, g_bytes + 1040), + 12, g_bytes + 1093), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84].base, - 19, g_bytes + 1058), + 18, g_bytes + 1105), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85].base, - 5, g_bytes + 1077), + 19, g_bytes + 1123), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86].base, - 7, g_bytes + 1082), + 5, g_bytes + 1142), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87].base, - 7, g_bytes + 1089), + 7, g_bytes + 1147), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88].base, - 11, g_bytes + 1096), + 7, g_bytes + 1154), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89].base, - 6, g_bytes + 1107), + 11, g_bytes + 1161), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90].base, - 10, g_bytes + 1113), + 6, g_bytes + 1172), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91].base, - 25, g_bytes + 1123), + 10, g_bytes + 1178), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92].base, - 17, g_bytes + 1148), + 25, g_bytes + 1188), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93].base, - 4, g_bytes + 1165), + 17, g_bytes + 1213), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94].base, - 3, g_bytes + 1169), + 4, g_bytes + 1230), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95].base, - 16, g_bytes + 1172), + 3, g_bytes + 1234), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, - 1, g_bytes + 1188), + 16, g_bytes + 1237), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, - 8, g_bytes + 1189), + 1, g_bytes + 1253), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, - 8, g_bytes + 1197), + 8, g_bytes + 1254), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99].base, - 16, g_bytes + 1205), + 8, g_bytes + 1262), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[100].base, 4, g_bytes + 1221), + &grpc_static_metadata_refcounts[100].base, 16, g_bytes + 1270), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[101].base, 3, g_bytes + 1225), + &grpc_static_metadata_refcounts[101].base, 4, g_bytes + 1286), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[102].base, 11, g_bytes + 1228), + &grpc_static_metadata_refcounts[102].base, 3, g_bytes + 1290), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[103].base, 16, g_bytes + 1239), + &grpc_static_metadata_refcounts[103].base, 11, g_bytes + 1293), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[104].base, 13, g_bytes + 1255), + &grpc_static_metadata_refcounts[104].base, 16, g_bytes + 1304), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[105].base, 12, g_bytes + 1268), + &grpc_static_metadata_refcounts[105].base, 13, g_bytes + 1320), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[106].base, 21, g_bytes + 1280), + &grpc_static_metadata_refcounts[106].base, 12, g_bytes + 1333), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[107].base, 21, g_bytes + 1345), }; /* Warning: the core static metadata currently operates under the soft @@ -892,17 +900,17 @@ uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8, 2, 4, 4}; static const int8_t elems_r[] = { - 15, 10, -8, 0, 2, -43, -81, -43, 0, 4, -8, 0, 0, 0, 8, - -2, -9, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -64, 0, -67, -68, -69, -51, -72, - 0, 32, 31, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, - 19, 18, 17, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, - 5, 4, 3, 4, 3, 3, 8, 0, 0, 0, 0, 0, 0, -5, 0}; + 15, 10, -8, 0, 2, -43, -80, -44, 0, 4, -8, 0, 0, 0, 6, -1, + -8, 0, 0, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -65, 0, -68, -69, -50, -72, -73, 0, 32, 31, + 30, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 17, + 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 4, 3, + 3, 7, 0, 0, 0, 0, 0, 0, -5, 0}; static uint32_t elems_phash(uint32_t i) { - i -= 42; - uint32_t x = i % 105; - uint32_t y = i / 105; + i -= 43; + uint32_t x = i % 106; + uint32_t y = i / 106; uint32_t h = x; if (y < GPR_ARRAY_SIZE(elems_r)) { uint32_t delta = (uint32_t)elems_r[y]; @@ -912,29 +920,29 @@ static uint32_t elems_phash(uint32_t i) { } static const uint16_t elem_keys[] = { - 260, 261, 262, 263, 264, 265, 266, 1107, 1108, 1740, 147, 148, - 472, 473, 1633, 42, 43, 1000, 1001, 1750, 773, 774, 1526, 633, - 1643, 845, 2061, 2168, 5699, 5913, 6020, 6127, 6341, 6448, 6555, 1766, - 6662, 6769, 6876, 6983, 7090, 7197, 7304, 7411, 7518, 7625, 7732, 7839, - 7946, 8053, 8160, 6234, 8267, 8374, 8481, 8588, 8695, 8802, 8909, 9016, - 9123, 9230, 9337, 9444, 9551, 9658, 9765, 1167, 528, 9872, 9979, 208, - 10086, 1173, 1174, 1175, 1176, 1060, 1809, 10193, 10942, 0, 0, 1702, - 0, 1816, 0, 0, 0, 349, 0, 0, 0, 1597, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0}; + 263, 264, 265, 266, 267, 268, 269, 1118, 1119, 1756, 149, 150, + 477, 478, 1648, 43, 44, 1010, 1011, 1540, 1767, 780, 781, 639, + 853, 1659, 2080, 2188, 5860, 6076, 6184, 6400, 6508, 6616, 6724, 6832, + 1783, 6940, 7048, 7156, 7264, 7372, 7480, 7588, 7696, 7804, 7912, 8020, + 8128, 8236, 8344, 6292, 8452, 8560, 8668, 8776, 8884, 8992, 9100, 9208, + 9316, 9424, 9532, 9640, 9748, 9856, 9964, 1178, 533, 10072, 10180, 210, + 10288, 1184, 1185, 1186, 1187, 1070, 10396, 1826, 11152, 0, 0, 0, + 1718, 0, 1833, 0, 0, 352, 0, 1612, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0}; static const uint8_t elem_idxs[] = { - 7, 8, 9, 10, 11, 12, 13, 76, 78, 71, 1, 2, 5, 6, 25, 3, - 4, 66, 65, 83, 62, 63, 30, 67, 73, 61, 57, 37, 14, 16, 17, 18, - 20, 21, 22, 15, 23, 24, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, - 38, 39, 40, 19, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 75, 69, 56, 58, 70, 59, 77, 79, 80, 81, 64, 82, 60, - 74, 255, 255, 72, 255, 84, 255, 255, 255, 0, 255, 255, 255, 68}; + 7, 8, 9, 10, 11, 12, 13, 76, 78, 71, 1, 2, 5, 6, 25, 3, + 4, 66, 65, 30, 83, 62, 63, 67, 61, 73, 57, 37, 14, 16, 17, 19, + 20, 21, 22, 23, 15, 24, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, + 38, 39, 40, 18, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 75, 69, 56, 58, 70, 59, 77, 79, 80, 81, 64, 60, 82, + 74, 255, 255, 255, 72, 255, 84, 255, 255, 0, 255, 68}; grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b) { if (a == -1 || b == -1) return GRPC_MDNULL; - uint32_t k = static_cast(a * 107 + b); + uint32_t k = static_cast(a * 108 + b); uint32_t h = elems_phash(k); return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k && elem_idxs[h] != 255 @@ -953,144 +961,144 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, 7, g_bytes + 5), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40].base, - 3, g_bytes + 658), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41].base, + 3, g_bytes + 723), 1), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, 7, g_bytes + 5), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41].base, - 4, g_bytes + 661), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42].base, + 4, g_bytes + 726), 2), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0].base, 5, g_bytes + 0), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42].base, - 1, g_bytes + 665), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43].base, + 1, g_bytes + 730), 3), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0].base, 5, g_bytes + 0), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43].base, - 11, g_bytes + 666), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44].base, + 11, g_bytes + 731), 4), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, 7, g_bytes + 29), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44].base, - 4, g_bytes + 677), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45].base, + 4, g_bytes + 742), 5), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, 7, g_bytes + 29), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45].base, - 5, g_bytes + 681), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46].base, + 5, g_bytes + 746), 6), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46].base, - 3, g_bytes + 686), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47].base, + 3, g_bytes + 751), 7), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47].base, - 3, g_bytes + 689), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48].base, + 3, g_bytes + 754), 8), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48].base, - 3, g_bytes + 692), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49].base, + 3, g_bytes + 757), 9), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49].base, - 3, g_bytes + 695), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50].base, + 3, g_bytes + 760), 10), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50].base, - 3, g_bytes + 698), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51].base, + 3, g_bytes + 763), 11), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51].base, - 3, g_bytes + 701), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52].base, + 3, g_bytes + 766), 12), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52].base, - 3, g_bytes + 704), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53].base, + 3, g_bytes + 769), 13), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53].base, - 14, g_bytes + 707), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54].base, + 14, g_bytes + 772), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 14), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54].base, - 13, g_bytes + 721), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55].base, + 13, g_bytes + 786), 15), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55].base, - 15, g_bytes + 734), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56].base, + 15, g_bytes + 799), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 16), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56].base, - 13, g_bytes + 749), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57].base, + 13, g_bytes + 814), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 17), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57].base, - 6, g_bytes + 762), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58].base, + 6, g_bytes + 827), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 18), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58].base, - 27, g_bytes + 768), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59].base, + 27, g_bytes + 833), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 19), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59].base, - 3, g_bytes + 795), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60].base, + 3, g_bytes + 860), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 20), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60].base, - 5, g_bytes + 798), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61].base, + 5, g_bytes + 863), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 21), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61].base, - 13, g_bytes + 803), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62].base, + 13, g_bytes + 868), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 22), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62].base, - 13, g_bytes + 816), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63].base, + 13, g_bytes + 881), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 23), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63].base, - 19, g_bytes + 829), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64].base, + 19, g_bytes + 894), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 24), @@ -1101,26 +1109,26 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { 0, g_bytes + 346), 25), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64].base, - 16, g_bytes + 848), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65].base, + 16, g_bytes + 913), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 26), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65].base, - 14, g_bytes + 864), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66].base, + 14, g_bytes + 929), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 27), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66].base, - 16, g_bytes + 878), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67].base, + 16, g_bytes + 943), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 28), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67].base, - 13, g_bytes + 894), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68].base, + 13, g_bytes + 959), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 29), @@ -1131,38 +1139,38 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { 0, g_bytes + 346), 30), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68].base, - 6, g_bytes + 907), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69].base, + 6, g_bytes + 972), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 31), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69].base, - 4, g_bytes + 913), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70].base, + 4, g_bytes + 978), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 32), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70].base, - 4, g_bytes + 917), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71].base, + 4, g_bytes + 982), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 33), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71].base, - 6, g_bytes + 921), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72].base, + 6, g_bytes + 986), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 34), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72].base, - 7, g_bytes + 927), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73].base, + 7, g_bytes + 992), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 35), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73].base, - 4, g_bytes + 934), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74].base, + 4, g_bytes + 999), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 36), @@ -1173,116 +1181,116 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { 0, g_bytes + 346), 37), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74].base, - 8, g_bytes + 938), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75].base, + 8, g_bytes + 1003), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 38), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75].base, - 17, g_bytes + 946), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76].base, + 17, g_bytes + 1011), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 39), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76].base, - 13, g_bytes + 963), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77].base, + 13, g_bytes + 1028), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 40), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77].base, - 8, g_bytes + 976), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78].base, + 8, g_bytes + 1041), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 41), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78].base, - 19, g_bytes + 984), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79].base, + 19, g_bytes + 1049), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 42), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79].base, - 13, g_bytes + 1003), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80].base, + 13, g_bytes + 1068), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 43), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80].base, - 4, g_bytes + 1016), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81].base, + 4, g_bytes + 1081), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 44), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81].base, - 8, g_bytes + 1020), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82].base, + 8, g_bytes + 1085), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 45), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82].base, - 12, g_bytes + 1028), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83].base, + 12, g_bytes + 1093), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 46), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83].base, - 18, g_bytes + 1040), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84].base, + 18, g_bytes + 1105), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 47), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84].base, - 19, g_bytes + 1058), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85].base, + 19, g_bytes + 1123), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 48), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85].base, - 5, g_bytes + 1077), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86].base, + 5, g_bytes + 1142), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 49), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86].base, - 7, g_bytes + 1082), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87].base, + 7, g_bytes + 1147), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 50), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87].base, - 7, g_bytes + 1089), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88].base, + 7, g_bytes + 1154), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 51), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88].base, - 11, g_bytes + 1096), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89].base, + 11, g_bytes + 1161), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 52), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89].base, - 6, g_bytes + 1107), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90].base, + 6, g_bytes + 1172), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 53), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90].base, - 10, g_bytes + 1113), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91].base, + 10, g_bytes + 1178), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 54), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91].base, - 25, g_bytes + 1123), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92].base, + 25, g_bytes + 1188), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 55), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92].base, - 17, g_bytes + 1148), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93].base, + 17, g_bytes + 1213), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 56), @@ -1293,28 +1301,28 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { 0, g_bytes + 346), 57), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93].base, - 4, g_bytes + 1165), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94].base, + 4, g_bytes + 1230), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 58), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94].base, - 3, g_bytes + 1169), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95].base, + 3, g_bytes + 1234), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 59), grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95].base, - 16, g_bytes + 1172), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, + 16, g_bytes + 1237), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 60), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7].base, 11, g_bytes + 50), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, - 1, g_bytes + 1188), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, + 1, g_bytes + 1253), 61), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7].base, @@ -1331,44 +1339,44 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, 13, g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, - 8, g_bytes + 1189), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, + 8, g_bytes + 1254), 64), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, 13, g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, - 4, g_bytes + 643), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, + 4, g_bytes + 708), 65), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, 13, g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, - 7, g_bytes + 636), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, + 7, g_bytes + 701), 66), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[5].base, 2, g_bytes + 36), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, - 8, g_bytes + 1197), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99].base, + 8, g_bytes + 1262), 67), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14].base, 12, g_bytes + 158), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99].base, - 16, g_bytes + 1205), + grpc_core::StaticMetadataSlice( + &grpc_static_metadata_refcounts[100].base, 16, g_bytes + 1270), 68), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, 7, g_bytes + 29), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[100].base, 4, g_bytes + 1221), + &grpc_static_metadata_refcounts[101].base, 4, g_bytes + 1286), 69), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, 7, g_bytes + 5), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[101].base, 3, g_bytes + 1225), + &grpc_static_metadata_refcounts[102].base, 3, g_bytes + 1290), 70), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, @@ -1379,80 +1387,80 @@ grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15].base, 16, g_bytes + 170), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, - 8, g_bytes + 1189), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, + 8, g_bytes + 1254), 72), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15].base, 16, g_bytes + 170), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, - 4, g_bytes + 643), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, + 4, g_bytes + 708), 73), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[102].base, 11, g_bytes + 1228), + &grpc_static_metadata_refcounts[103].base, 11, g_bytes + 1293), grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, 0, g_bytes + 346), 74), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, - 8, g_bytes + 1189), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, + 8, g_bytes + 1254), 75), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, - 7, g_bytes + 636), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, + 7, g_bytes + 701), 76), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[103].base, 16, g_bytes + 1239), + &grpc_static_metadata_refcounts[104].base, 16, g_bytes + 1304), 77), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, - 4, g_bytes + 643), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, + 4, g_bytes + 708), 78), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[104].base, 13, g_bytes + 1255), + &grpc_static_metadata_refcounts[105].base, 13, g_bytes + 1320), 79), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[105].base, 12, g_bytes + 1268), + &grpc_static_metadata_refcounts[106].base, 12, g_bytes + 1333), 80), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, 20, g_bytes + 90), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[106].base, 21, g_bytes + 1280), + &grpc_static_metadata_refcounts[107].base, 21, g_bytes + 1345), 81), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, - 8, g_bytes + 1189), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, + 8, g_bytes + 1254), 82), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, - 4, g_bytes + 643), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, + 4, g_bytes + 708), 83), grpc_core::StaticMetadata( grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, 15, g_bytes + 186), grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[104].base, 13, g_bytes + 1255), + &grpc_static_metadata_refcounts[105].base, 13, g_bytes + 1320), 84), }; const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 75, 76, 77, diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index 787bae7ede5..7ea000e1066 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -36,7 +36,7 @@ static_assert( std::is_trivially_destructible::value, "grpc_core::StaticMetadataSlice must be trivially destructible."); -#define GRPC_STATIC_MDSTR_COUNT 107 +#define GRPC_STATIC_MDSTR_COUNT 108 extern const grpc_core::StaticMetadataSlice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; /* ":path" */ @@ -111,157 +111,160 @@ extern const grpc_core::StaticMetadataSlice /* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \ (grpc_static_slice_table[33]) +/* "/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats" */ +#define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS \ + (grpc_static_slice_table[34]) /* "/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints" */ #define GRPC_MDSTR_SLASH_ENVOY_DOT_API_DOT_V2_DOT_ENDPOINTDISCOVERYSERVICE_SLASH_STREAMENDPOINTS \ - (grpc_static_slice_table[34]) + (grpc_static_slice_table[35]) /* "/grpc.health.v1.Health/Watch" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH \ - (grpc_static_slice_table[35]) + (grpc_static_slice_table[36]) /* "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources" */ #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \ - (grpc_static_slice_table[36]) + (grpc_static_slice_table[37]) /* "deflate" */ -#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[37]) +#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[38]) /* "gzip" */ -#define GRPC_MDSTR_GZIP (grpc_static_slice_table[38]) +#define GRPC_MDSTR_GZIP (grpc_static_slice_table[39]) /* "stream/gzip" */ -#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[39]) +#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[40]) /* "GET" */ -#define GRPC_MDSTR_GET (grpc_static_slice_table[40]) +#define GRPC_MDSTR_GET (grpc_static_slice_table[41]) /* "POST" */ -#define GRPC_MDSTR_POST (grpc_static_slice_table[41]) +#define GRPC_MDSTR_POST (grpc_static_slice_table[42]) /* "/" */ -#define GRPC_MDSTR_SLASH (grpc_static_slice_table[42]) +#define GRPC_MDSTR_SLASH (grpc_static_slice_table[43]) /* "/index.html" */ -#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[43]) +#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[44]) /* "http" */ -#define GRPC_MDSTR_HTTP (grpc_static_slice_table[44]) +#define GRPC_MDSTR_HTTP (grpc_static_slice_table[45]) /* "https" */ -#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[45]) +#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[46]) /* "200" */ -#define GRPC_MDSTR_200 (grpc_static_slice_table[46]) +#define GRPC_MDSTR_200 (grpc_static_slice_table[47]) /* "204" */ -#define GRPC_MDSTR_204 (grpc_static_slice_table[47]) +#define GRPC_MDSTR_204 (grpc_static_slice_table[48]) /* "206" */ -#define GRPC_MDSTR_206 (grpc_static_slice_table[48]) +#define GRPC_MDSTR_206 (grpc_static_slice_table[49]) /* "304" */ -#define GRPC_MDSTR_304 (grpc_static_slice_table[49]) +#define GRPC_MDSTR_304 (grpc_static_slice_table[50]) /* "400" */ -#define GRPC_MDSTR_400 (grpc_static_slice_table[50]) +#define GRPC_MDSTR_400 (grpc_static_slice_table[51]) /* "404" */ -#define GRPC_MDSTR_404 (grpc_static_slice_table[51]) +#define GRPC_MDSTR_404 (grpc_static_slice_table[52]) /* "500" */ -#define GRPC_MDSTR_500 (grpc_static_slice_table[52]) +#define GRPC_MDSTR_500 (grpc_static_slice_table[53]) /* "accept-charset" */ -#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[53]) +#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[54]) /* "gzip, deflate" */ -#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[54]) +#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[55]) /* "accept-language" */ -#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[55]) +#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[56]) /* "accept-ranges" */ -#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[56]) +#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[57]) /* "accept" */ -#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[57]) +#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[58]) /* "access-control-allow-origin" */ -#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[58]) +#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[59]) /* "age" */ -#define GRPC_MDSTR_AGE (grpc_static_slice_table[59]) +#define GRPC_MDSTR_AGE (grpc_static_slice_table[60]) /* "allow" */ -#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[60]) +#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[61]) /* "authorization" */ -#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[61]) +#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[62]) /* "cache-control" */ -#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[62]) +#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[63]) /* "content-disposition" */ -#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[63]) +#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[64]) /* "content-language" */ -#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[64]) +#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[65]) /* "content-length" */ -#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[65]) +#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[66]) /* "content-location" */ -#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[66]) +#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[67]) /* "content-range" */ -#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[67]) +#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[68]) /* "cookie" */ -#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[68]) +#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[69]) /* "date" */ -#define GRPC_MDSTR_DATE (grpc_static_slice_table[69]) +#define GRPC_MDSTR_DATE (grpc_static_slice_table[70]) /* "etag" */ -#define GRPC_MDSTR_ETAG (grpc_static_slice_table[70]) +#define GRPC_MDSTR_ETAG (grpc_static_slice_table[71]) /* "expect" */ -#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[71]) +#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[72]) /* "expires" */ -#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[72]) +#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[73]) /* "from" */ -#define GRPC_MDSTR_FROM (grpc_static_slice_table[73]) +#define GRPC_MDSTR_FROM (grpc_static_slice_table[74]) /* "if-match" */ -#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[74]) +#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[75]) /* "if-modified-since" */ -#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[75]) +#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[76]) /* "if-none-match" */ -#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[76]) +#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[77]) /* "if-range" */ -#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[77]) +#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[78]) /* "if-unmodified-since" */ -#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[78]) +#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[79]) /* "last-modified" */ -#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[79]) +#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[80]) /* "link" */ -#define GRPC_MDSTR_LINK (grpc_static_slice_table[80]) +#define GRPC_MDSTR_LINK (grpc_static_slice_table[81]) /* "location" */ -#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[81]) +#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[82]) /* "max-forwards" */ -#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[82]) +#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[83]) /* "proxy-authenticate" */ -#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[83]) +#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[84]) /* "proxy-authorization" */ -#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[84]) +#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[85]) /* "range" */ -#define GRPC_MDSTR_RANGE (grpc_static_slice_table[85]) +#define GRPC_MDSTR_RANGE (grpc_static_slice_table[86]) /* "referer" */ -#define GRPC_MDSTR_REFERER (grpc_static_slice_table[86]) +#define GRPC_MDSTR_REFERER (grpc_static_slice_table[87]) /* "refresh" */ -#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[87]) +#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[88]) /* "retry-after" */ -#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[88]) +#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[89]) /* "server" */ -#define GRPC_MDSTR_SERVER (grpc_static_slice_table[89]) +#define GRPC_MDSTR_SERVER (grpc_static_slice_table[90]) /* "set-cookie" */ -#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[90]) +#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[91]) /* "strict-transport-security" */ -#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[91]) +#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[92]) /* "transfer-encoding" */ -#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[92]) +#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[93]) /* "vary" */ -#define GRPC_MDSTR_VARY (grpc_static_slice_table[93]) +#define GRPC_MDSTR_VARY (grpc_static_slice_table[94]) /* "via" */ -#define GRPC_MDSTR_VIA (grpc_static_slice_table[94]) +#define GRPC_MDSTR_VIA (grpc_static_slice_table[95]) /* "www-authenticate" */ -#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[95]) +#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[96]) /* "0" */ -#define GRPC_MDSTR_0 (grpc_static_slice_table[96]) +#define GRPC_MDSTR_0 (grpc_static_slice_table[97]) /* "identity" */ -#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[97]) +#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[98]) /* "trailers" */ -#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[98]) +#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[99]) /* "application/grpc" */ -#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[99]) +#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[100]) /* "grpc" */ -#define GRPC_MDSTR_GRPC (grpc_static_slice_table[100]) +#define GRPC_MDSTR_GRPC (grpc_static_slice_table[101]) /* "PUT" */ -#define GRPC_MDSTR_PUT (grpc_static_slice_table[101]) +#define GRPC_MDSTR_PUT (grpc_static_slice_table[102]) /* "lb-cost-bin" */ -#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[102]) +#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[103]) /* "identity,deflate" */ -#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[103]) +#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[104]) /* "identity,gzip" */ -#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[104]) +#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[105]) /* "deflate,gzip" */ -#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[105]) +#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[106]) /* "identity,deflate,gzip" */ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (grpc_static_slice_table[106]) + (grpc_static_slice_table[107]) namespace grpc_core { struct StaticSliceRefcount; diff --git a/src/proto/grpc/lb/v2/BUILD b/src/proto/grpc/lb/v2/BUILD index bf0f1a78b1c..0b46b2892ed 100644 --- a/src/proto/grpc/lb/v2/BUILD +++ b/src/proto/grpc/lb/v2/BUILD @@ -22,10 +22,20 @@ grpc_package( ) grpc_proto_library( - name = "xds_for_test_proto", + name = "eds_for_test_proto", srcs = [ - "xds_for_test.proto", + "eds_for_test.proto", ], has_services = True, well_known_protos = True, ) + +grpc_proto_library( + name = "lrs_for_test_proto", + srcs = [ + "lrs_for_test.proto", + ], + has_services = True, + well_known_protos = True, + deps = [":eds_for_test_proto"], +) diff --git a/src/proto/grpc/lb/v2/xds_for_test.proto b/src/proto/grpc/lb/v2/eds_for_test.proto similarity index 100% rename from src/proto/grpc/lb/v2/xds_for_test.proto rename to src/proto/grpc/lb/v2/eds_for_test.proto diff --git a/src/proto/grpc/lb/v2/lrs_for_test.proto b/src/proto/grpc/lb/v2/lrs_for_test.proto new file mode 100644 index 00000000000..76c560a99cf --- /dev/null +++ b/src/proto/grpc/lb/v2/lrs_for_test.proto @@ -0,0 +1,180 @@ +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file contains the eds protocol and its dependency. +// +// TODO(juanlishen): It's a workaround and should be removed once we have a +// clean solution to the circular dependency between the envoy data plane APIs +// and gRPC. We can't check in this file due to conflict with internal code. + +syntax = "proto3"; + +package envoy.service.load_stats.v2; + +import "google/protobuf/duration.proto"; +import "src/proto/grpc/lb/v2/eds_for_test.proto"; + +// [#not-implemented-hide:] Not configuration. TBD how to doc proto APIs. +message EndpointLoadMetricStats { + // Name of the metric; may be empty. + string metric_name = 1; + + // Number of calls that finished and included this metric. + uint64 num_requests_finished_with_metric = 2; + + // Sum of metric values across all calls that finished with this metric for + // load_reporting_interval. + double total_metric_value = 3; +} + +message UpstreamLocalityStats { + // Name of zone, region and optionally endpoint group these metrics were + // collected from. Zone and region names could be empty if unknown. + envoy.api.v2.Locality locality = 1; + + // The total number of requests successfully completed by the endpoints in the + // locality. + uint64 total_successful_requests = 2; + + // The total number of unfinished requests + uint64 total_requests_in_progress = 3; + + // The total number of requests that failed due to errors at the endpoint, + // aggregated over all endpoints in the locality. + uint64 total_error_requests = 4; + + // The total number of requests that were issued by this Envoy since + // the last report. This information is aggregated over all the + // upstream endpoints in the locality. + uint64 total_issued_requests = 8; + + // Stats for multi-dimensional load balancing. + repeated EndpointLoadMetricStats load_metric_stats = 5; + +// // Endpoint granularity stats information for this locality. This information +// // is populated if the Server requests it by setting +// // :ref:`LoadStatsResponse.report_endpoint_granularity`. +// repeated UpstreamEndpointStats upstream_endpoint_stats = 7; + + // [#not-implemented-hide:] The priority of the endpoint group these metrics + // were collected from. + uint32 priority = 6; +} + +// Per cluster load stats. Envoy reports these stats a management server in a +// :ref:`LoadStatsRequest` +// [#not-implemented-hide:] Not configuration. TBD how to doc proto APIs. +// Next ID: 7 +message ClusterStats { + // The name of the cluster. + string cluster_name = 1; + + // The eds_cluster_config service_name of the cluster. + // It's possible that two clusters send the same service_name to EDS, + // in that case, the management server is supposed to do aggregation on the load reports. + string cluster_service_name = 6; + + // Need at least one. + repeated UpstreamLocalityStats upstream_locality_stats = 2; + + // Cluster-level stats such as total_successful_requests may be computed by + // summing upstream_locality_stats. In addition, below there are additional + // cluster-wide stats. + // + // The total number of dropped requests. This covers requests + // deliberately dropped by the drop_overload policy and circuit breaking. + uint64 total_dropped_requests = 3; + + message DroppedRequests { + // Identifier for the policy specifying the drop. + string category = 1; + // Total number of deliberately dropped requests for the category. + uint64 dropped_count = 2; + } + // Information about deliberately dropped requests for each category specified + // in the DropOverload policy. + repeated DroppedRequests dropped_requests = 5; + + // Period over which the actual load report occurred. This will be guaranteed to include every + // request reported. Due to system load and delays between the *LoadStatsRequest* sent from Envoy + // and the *LoadStatsResponse* message sent from the management server, this may be longer than + // the requested load reporting interval in the *LoadStatsResponse*. + google.protobuf.Duration load_report_interval = 4; +} + +// [#protodoc-title: Load reporting service] + +service LoadReportingService { + // Advanced API to allow for multi-dimensional load balancing by remote + // server. For receiving LB assignments, the steps are: + // 1, The management server is configured with per cluster/zone/load metric + // capacity configuration. The capacity configuration definition is + // outside of the scope of this document. + // 2. Envoy issues a standard {Stream,Fetch}Endpoints request for the clusters + // to balance. + // + // Independently, Envoy will initiate a StreamLoadStats bidi stream with a + // management server: + // 1. Once a connection establishes, the management server publishes a + // LoadStatsResponse for all clusters it is interested in learning load + // stats about. + // 2. For each cluster, Envoy load balances incoming traffic to upstream hosts + // based on per-zone weights and/or per-instance weights (if specified) + // based on intra-zone LbPolicy. This information comes from the above + // {Stream,Fetch}Endpoints. + // 3. When upstream hosts reply, they optionally add header with ASCII representation of EndpointLoadMetricStats. + // 4. Envoy aggregates load reports over the period of time given to it in + // LoadStatsResponse.load_reporting_interval. This includes aggregation + // stats Envoy maintains by itself (total_requests, rpc_errors etc.) as + // well as load metrics from upstream hosts. + // 5. When the timer of load_reporting_interval expires, Envoy sends new + // LoadStatsRequest filled with load reports for each cluster. + // 6. The management server uses the load reports from all reported Envoys + // from around the world, computes global assignment and prepares traffic + // assignment destined for each zone Envoys are located in. Goto 2. + rpc StreamLoadStats(stream LoadStatsRequest) returns (stream LoadStatsResponse) { + } +} + +// A load report Envoy sends to the management server. +// [#not-implemented-hide:] Not configuration. TBD how to doc proto APIs. +message LoadStatsRequest { + // Node identifier for Envoy instance. + envoy.api.v2.Node node = 1; + + // A list of load stats to report. + repeated ClusterStats cluster_stats = 2; +} + +// The management server sends envoy a LoadStatsResponse with all clusters it +// is interested in learning load stats about. +// [#not-implemented-hide:] Not configuration. TBD how to doc proto APIs. +message LoadStatsResponse { + // Clusters to report stats for. + repeated string clusters = 1; + + // The minimum interval of time to collect stats over. This is only a minimum for two reasons: + // 1. There may be some delay from when the timer fires until stats sampling occurs. + // 2. For clusters that were already feature in the previous *LoadStatsResponse*, any traffic + // that is observed in between the corresponding previous *LoadStatsRequest* and this + // *LoadStatsResponse* will also be accumulated and billed to the cluster. This avoids a period + // of inobservability that might otherwise exists between the messages. New clusters are not + // subject to this consideration. + google.protobuf.Duration load_reporting_interval = 2; + + // Set to *true* if the management server supports endpoint granularity + // report. + bool report_endpoint_granularity = 3; +} diff --git a/test/core/end2end/fuzzers/hpack.dictionary b/test/core/end2end/fuzzers/hpack.dictionary index 24e3320dd71..921018db7f8 100644 --- a/test/core/end2end/fuzzers/hpack.dictionary +++ b/test/core/end2end/fuzzers/hpack.dictionary @@ -33,6 +33,7 @@ "\x1Egrpc.max_request_message_bytes" "\x1Fgrpc.max_response_message_bytes" "$/grpc.lb.v1.LoadBalancer/BalanceLoad" +"A/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats" "6/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints" "\x1C/grpc.health.v1.Health/Watch" "P/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources" diff --git a/test/core/util/test_lb_policies.cc b/test/core/util/test_lb_policies.cc index 12a042ab827..5ee2f5fe049 100644 --- a/test/core/util/test_lb_policies.cc +++ b/test/core/util/test_lb_policies.cc @@ -188,7 +188,7 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy private: static void RecordRecvTrailingMetadata( - void* arg, MetadataInterface* recv_trailing_metadata, + void* arg, grpc_error* error, MetadataInterface* recv_trailing_metadata, CallState* call_state) { TrailingMetadataHandler* self = static_cast(arg); diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index 4b83d0615af..f3cc14cb848 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -491,8 +491,8 @@ grpc_cc_test( "//:grpc", "//:grpc++", "//:grpc_resolver_fake", - "//src/proto/grpc/lb/v1:load_balancer_proto", - "//src/proto/grpc/lb/v2:xds_for_test_proto", + "//src/proto/grpc/lb/v2:eds_for_test_proto", + "//src/proto/grpc/lb/v2:lrs_for_test_proto", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 5aa20e27a49..d62dc828818 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -38,7 +38,9 @@ #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" #include "src/core/ext/filters/client_channel/server_address.h" #include "src/core/lib/gpr/env.h" +#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" +#include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/security/credentials/fake/fake_credentials.h" #include "src/cpp/client/secure_credentials.h" @@ -48,7 +50,8 @@ #include "test/core/util/test_config.h" #include "test/cpp/end2end/test_service_impl.h" -#include "src/proto/grpc/lb/v2/xds_for_test.grpc.pb.h" +#include "src/proto/grpc/lb/v2/eds_for_test.grpc.pb.h" +#include "src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include @@ -81,6 +84,11 @@ using ::envoy::api::v2::ClusterLoadAssignment; using ::envoy::api::v2::DiscoveryRequest; using ::envoy::api::v2::DiscoveryResponse; using ::envoy::api::v2::EndpointDiscoveryService; +using ::envoy::service::load_stats::v2::ClusterStats; +using ::envoy::service::load_stats::v2::LoadReportingService; +using ::envoy::service::load_stats::v2::LoadStatsRequest; +using ::envoy::service::load_stats::v2::LoadStatsResponse; +using ::envoy::service::load_stats::v2::UpstreamLocalityStats; constexpr char kEdsTypeUrl[] = "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment"; @@ -92,32 +100,32 @@ template class CountedService : public ServiceType { public: size_t request_count() { - grpc::internal::MutexLock lock(&mu_); + grpc_core::MutexLock lock(&mu_); return request_count_; } size_t response_count() { - grpc::internal::MutexLock lock(&mu_); + grpc_core::MutexLock lock(&mu_); return response_count_; } void IncreaseResponseCount() { - grpc::internal::MutexLock lock(&mu_); + grpc_core::MutexLock lock(&mu_); ++response_count_; } void IncreaseRequestCount() { - grpc::internal::MutexLock lock(&mu_); + grpc_core::MutexLock lock(&mu_); ++request_count_; } void ResetCounters() { - grpc::internal::MutexLock lock(&mu_); + grpc_core::MutexLock lock(&mu_); request_count_ = 0; response_count_ = 0; } protected: - grpc::internal::Mutex mu_; + grpc_core::Mutex mu_; private: size_t request_count_ = 0; @@ -125,7 +133,8 @@ class CountedService : public ServiceType { }; using BackendService = CountedService; -using BalancerService = CountedService; +using EdsService = CountedService; +using LrsService = CountedService; const char g_kCallCredsMdKey[] = "Balancer should not ..."; const char g_kCallCredsMdValue[] = "... receive me"; @@ -150,130 +159,169 @@ class BackendServiceImpl : public BackendService { return status; } + void Start() {} void Shutdown() {} std::set clients() { - grpc::internal::MutexLock lock(&clients_mu_); + grpc_core::MutexLock lock(&clients_mu_); return clients_; } private: void AddClient(const grpc::string& client) { - grpc::internal::MutexLock lock(&clients_mu_); + grpc_core::MutexLock lock(&clients_mu_); clients_.insert(client); } - grpc::internal::Mutex mu_; - grpc::internal::Mutex clients_mu_; + grpc_core::Mutex mu_; + grpc_core::Mutex clients_mu_; std::set clients_; }; -struct ClientStats { - size_t num_calls_started = 0; - size_t num_calls_finished = 0; - size_t num_calls_finished_with_client_failed_to_send = 0; - size_t num_calls_finished_known_received = 0; - std::map drop_token_counts; - - ClientStats& operator+=(const ClientStats& other) { - num_calls_started += other.num_calls_started; - num_calls_finished += other.num_calls_finished; - num_calls_finished_with_client_failed_to_send += - other.num_calls_finished_with_client_failed_to_send; - num_calls_finished_known_received += - other.num_calls_finished_known_received; - for (const auto& p : other.drop_token_counts) { - drop_token_counts[p.first] += p.second; +class ClientStats { + public: + struct LocalityStats { + // Converts from proto message class. + LocalityStats(const UpstreamLocalityStats& upstream_locality_stats) + : total_successful_requests( + upstream_locality_stats.total_successful_requests()), + total_requests_in_progress( + upstream_locality_stats.total_requests_in_progress()), + total_error_requests(upstream_locality_stats.total_error_requests()), + total_issued_requests( + upstream_locality_stats.total_issued_requests()) {} + + uint64_t total_successful_requests; + uint64_t total_requests_in_progress; + uint64_t total_error_requests; + uint64_t total_issued_requests; + }; + + // Converts from proto message class. + ClientStats(const ClusterStats& cluster_stats) + : total_dropped_requests_(cluster_stats.total_dropped_requests()) { + for (const auto& input_locality_stats : + cluster_stats.upstream_locality_stats()) { + locality_stats_.emplace(input_locality_stats.locality().sub_zone(), + LocalityStats(input_locality_stats)); } - return *this; } - void Reset() { - num_calls_started = 0; - num_calls_finished = 0; - num_calls_finished_with_client_failed_to_send = 0; - num_calls_finished_known_received = 0; - drop_token_counts.clear(); + uint64_t total_successful_requests() const { + uint64_t sum = 0; + for (auto& p : locality_stats_) { + sum += p.second.total_successful_requests; + } + return sum; + } + uint64_t total_requests_in_progress() const { + uint64_t sum = 0; + for (auto& p : locality_stats_) { + sum += p.second.total_requests_in_progress; + } + return sum; + } + uint64_t total_error_requests() const { + uint64_t sum = 0; + for (auto& p : locality_stats_) { + sum += p.second.total_error_requests; + } + return sum; } + uint64_t total_issued_requests() const { + uint64_t sum = 0; + for (auto& p : locality_stats_) { + sum += p.second.total_issued_requests; + } + return sum; + } + uint64_t total_dropped_requests() const { return total_dropped_requests_; } + + private: + std::map locality_stats_; + uint64_t total_dropped_requests_; }; -class BalancerServiceImpl : public BalancerService { +class EdsServiceImpl : public EdsService { public: using Stream = ServerReaderWriter; using ResponseDelayPair = std::pair; - explicit BalancerServiceImpl(int client_load_reporting_interval_seconds) - : client_load_reporting_interval_seconds_( - client_load_reporting_interval_seconds) {} - Status StreamEndpoints(ServerContext* context, Stream* stream) override { - // TODO(juanlishen): Clean up the scoping. - gpr_log(GPR_INFO, "LB[%p]: EDS starts", this); - { - grpc::internal::MutexLock lock(&mu_); - if (serverlist_done_) goto done; - } - { + gpr_log(GPR_INFO, "LB[%p]: EDS StreamEndpoints starts", this); + [&]() { + { + grpc_core::MutexLock lock(&eds_mu_); + if (eds_done_) return; + } // Balancer shouldn't receive the call credentials metadata. EXPECT_EQ(context->client_metadata().find(g_kCallCredsMdKey), context->client_metadata().end()); + // Read request. DiscoveryRequest request; - std::vector responses_and_delays; - if (!stream->Read(&request)) goto done; + if (!stream->Read(&request)) return; IncreaseRequestCount(); gpr_log(GPR_INFO, "LB[%p]: received initial message '%s'", this, request.DebugString().c_str()); + // Send response. + std::vector responses_and_delays; { - grpc::internal::MutexLock lock(&mu_); + grpc_core::MutexLock lock(&eds_mu_); responses_and_delays = responses_and_delays_; } for (const auto& response_and_delay : responses_and_delays) { SendResponse(stream, response_and_delay.first, response_and_delay.second); } - { - grpc::internal::MutexLock lock(&mu_); - serverlist_cond_.WaitUntil(&mu_, [this] { return serverlist_done_; }); - } - if (client_load_reporting_interval_seconds_ > 0) { - // TODO(juanlishen): Use LRS to receive load report. - } - } - done: - gpr_log(GPR_INFO, "LB[%p]: done", this); + // Wait until notified done. + grpc_core::MutexLock lock(&eds_mu_); + eds_cond_.WaitUntil(&eds_mu_, [this] { return eds_done_; }); + }(); + gpr_log(GPR_INFO, "LB[%p]: EDS StreamEndpoints done", this); return Status::OK; } void add_response(const DiscoveryResponse& response, int send_after_ms) { - grpc::internal::MutexLock lock(&mu_); + grpc_core::MutexLock lock(&eds_mu_); responses_and_delays_.push_back(std::make_pair(response, send_after_ms)); } - void Shutdown() { - grpc::internal::MutexLock lock(&mu_); - NotifyDoneWithServerlistsLocked(); + void Start() { + grpc_core::MutexLock lock(&eds_mu_); + eds_done_ = false; responses_and_delays_.clear(); + } + + void Shutdown() { + { + grpc_core::MutexLock lock(&eds_mu_); + NotifyDoneWithEdsCallLocked(); + responses_and_delays_.clear(); + } gpr_log(GPR_INFO, "LB[%p]: shut down", this); } static DiscoveryResponse BuildResponseForBackends( - const std::vector& backend_ports, - const std::map& drop_token_counts) { + const std::vector>& backend_ports) { ClusterLoadAssignment assignment; assignment.set_cluster_name("service name"); - auto* endpoints = assignment.add_endpoints(); - endpoints->mutable_load_balancing_weight()->set_value(3); - endpoints->set_priority(0); - endpoints->mutable_locality()->set_region(kDefaultLocalityRegion); - endpoints->mutable_locality()->set_zone(kDefaultLocalityZone); - endpoints->mutable_locality()->set_sub_zone(kDefaultLocalitySubzone); - for (const int& backend_port : backend_ports) { - auto* lb_endpoints = endpoints->add_lb_endpoints(); - auto* endpoint = lb_endpoints->mutable_endpoint(); - auto* address = endpoint->mutable_address(); - auto* socket_address = address->mutable_socket_address(); - socket_address->set_address("127.0.0.1"); - socket_address->set_port_value(backend_port); + for (size_t i = 0; i < backend_ports.size(); ++i) { + auto* endpoints = assignment.add_endpoints(); + endpoints->mutable_load_balancing_weight()->set_value(3); + endpoints->set_priority(0); + endpoints->mutable_locality()->set_region(kDefaultLocalityRegion); + endpoints->mutable_locality()->set_zone(kDefaultLocalityZone); + std::ostringstream sub_zone; + sub_zone << kDefaultLocalitySubzone << '_' << i; + endpoints->mutable_locality()->set_sub_zone(sub_zone.str()); + for (const int& backend_port : backend_ports[i]) { + auto* lb_endpoints = endpoints->add_lb_endpoints(); + auto* endpoint = lb_endpoints->mutable_endpoint(); + auto* address = endpoint->mutable_address(); + auto* socket_address = address->mutable_socket_address(); + socket_address->set_address("127.0.0.1"); + socket_address->set_port_value(backend_port); + } } DiscoveryResponse response; response.set_type_url(kEdsTypeUrl); @@ -281,15 +329,15 @@ class BalancerServiceImpl : public BalancerService { return response; } - void NotifyDoneWithServerlists() { - grpc::internal::MutexLock lock(&mu_); - NotifyDoneWithServerlistsLocked(); + void NotifyDoneWithEdsCall() { + grpc_core::MutexLock lock(&eds_mu_); + NotifyDoneWithEdsCallLocked(); } - void NotifyDoneWithServerlistsLocked() { - if (!serverlist_done_) { - serverlist_done_ = true; - serverlist_cond_.Broadcast(); + void NotifyDoneWithEdsCallLocked() { + if (!eds_done_) { + eds_done_ = true; + eds_cond_.Broadcast(); } } @@ -306,11 +354,108 @@ class BalancerServiceImpl : public BalancerService { stream->Write(response); } - const int client_load_reporting_interval_seconds_; + grpc_core::CondVar eds_cond_; + // Protect the members below. + grpc_core::Mutex eds_mu_; + bool eds_done_ = false; std::vector responses_and_delays_; - grpc::internal::Mutex mu_; - grpc::internal::CondVar serverlist_cond_; - bool serverlist_done_ = false; +}; + +class LrsServiceImpl : public LrsService { + public: + using Stream = ServerReaderWriter; + + explicit LrsServiceImpl(int client_load_reporting_interval_seconds) + : client_load_reporting_interval_seconds_( + client_load_reporting_interval_seconds) {} + + Status StreamLoadStats(ServerContext* context, Stream* stream) override { + gpr_log(GPR_INFO, "LB[%p]: LRS StreamLoadStats starts", this); + // Read request. + LoadStatsRequest request; + if (stream->Read(&request)) { + if (client_load_reporting_interval_seconds_ > 0) { + IncreaseRequestCount(); + // Send response. + LoadStatsResponse response; + auto server_name = request.cluster_stats()[0].cluster_name(); + GPR_ASSERT(server_name != ""); + response.add_clusters(server_name); + response.mutable_load_reporting_interval()->set_seconds( + client_load_reporting_interval_seconds_); + stream->Write(response); + IncreaseResponseCount(); + // Wait for report. + request.Clear(); + if (stream->Read(&request)) { + gpr_log(GPR_INFO, "LB[%p]: received client load report message '%s'", + this, request.DebugString().c_str()); + GPR_ASSERT(request.cluster_stats().size() == 1); + const ClusterStats& cluster_stats = request.cluster_stats()[0]; + // We need to acquire the lock here in order to prevent the notify_one + // below from firing before its corresponding wait is executed. + grpc_core::MutexLock lock(&load_report_mu_); + GPR_ASSERT(client_stats_ == nullptr); + client_stats_.reset(new ClientStats(cluster_stats)); + load_report_ready_ = true; + load_report_cond_.Signal(); + } + } + // Wait until notified done. + grpc_core::MutexLock lock(&lrs_mu_); + lrs_cv_.WaitUntil(&lrs_mu_, [this] { return lrs_done; }); + } + gpr_log(GPR_INFO, "LB[%p]: LRS done", this); + return Status::OK; + } + + void Start() { + lrs_done = false; + load_report_ready_ = false; + client_stats_.reset(); + } + + void Shutdown() { + { + grpc_core::MutexLock lock(&lrs_mu_); + NotifyDoneWithLrsCallLocked(); + } + gpr_log(GPR_INFO, "LB[%p]: shut down", this); + } + + ClientStats* WaitForLoadReport() { + grpc_core::MutexLock lock(&load_report_mu_); + load_report_cond_.WaitUntil(&load_report_mu_, + [this] { return load_report_ready_; }); + load_report_ready_ = false; + return client_stats_.get(); + } + + void NotifyDoneWithLrsCall() { + grpc_core::MutexLock lock(&lrs_mu_); + NotifyDoneWithLrsCallLocked(); + } + + void NotifyDoneWithLrsCallLocked() { + if (!lrs_done) { + lrs_done = true; + lrs_cv_.Broadcast(); + } + } + + private: + const int client_load_reporting_interval_seconds_; + + grpc_core::CondVar lrs_cv_; + // Protect lrs_done. + grpc_core::Mutex lrs_mu_; + bool lrs_done = false; + + grpc_core::CondVar load_report_cond_; + // Protect the members below. + grpc_core::Mutex load_report_mu_; + std::unique_ptr client_stats_; + bool load_report_ready_ = false; }; class XdsEnd2endTest : public ::testing::Test { @@ -339,13 +484,13 @@ class XdsEnd2endTest : public ::testing::Test { grpc_core::MakeRefCounted(); // Start the backends. for (size_t i = 0; i < num_backends_; ++i) { - backends_.emplace_back(new ServerThread("backend")); + backends_.emplace_back(new BackendServerThread); backends_.back()->Start(server_host_); } // Start the load balancers. for (size_t i = 0; i < num_balancers_; ++i) { - balancers_.emplace_back(new ServerThread( - "balancer", client_load_reporting_interval_seconds_)); + balancers_.emplace_back( + new BalancerServerThread(client_load_reporting_interval_seconds_)); balancers_.back()->Start(server_host_); } ResetStub(); @@ -398,19 +543,13 @@ class XdsEnd2endTest : public ::testing::Test { } void ResetBackendCounters() { - for (auto& backend : backends_) backend->service_.ResetCounters(); - } - - ClientStats WaitForLoadReports() { - ClientStats client_stats; - // TODO(juanlishen): Wait in LRS. - return client_stats; + for (auto& backend : backends_) backend->backend_service()->ResetCounters(); } bool SeenAllBackends(size_t start_index = 0, size_t stop_index = 0) { if (stop_index == 0) stop_index = backends_.size(); for (size_t i = start_index; i < stop_index; ++i) { - if (backends_[i]->service_.request_count() == 0) return false; + if (backends_[i]->backend_service()->request_count() == 0) return false; } return true; } @@ -455,7 +594,7 @@ class XdsEnd2endTest : public ::testing::Test { void WaitForBackend(size_t backend_idx) { do { (void)SendRpc(); - } while (backends_[backend_idx]->service_.request_count() == 0); + } while (backends_[backend_idx]->backend_service()->request_count() == 0); ResetBackendCounters(); } @@ -506,7 +645,7 @@ class XdsEnd2endTest : public ::testing::Test { nullptr) { std::vector ports; for (size_t i = 0; i < balancers_.size(); ++i) { - ports.emplace_back(balancers_[i]->port_); + ports.emplace_back(balancers_[i]->port()); } SetNextResolutionForLbChannel(ports, service_config_json, lb_channel_response_generator); @@ -543,14 +682,32 @@ class XdsEnd2endTest : public ::testing::Test { if (stop_index == 0) stop_index = backends_.size(); std::vector backend_ports; for (size_t i = start_index; i < stop_index; ++i) { - backend_ports.push_back(backends_[i]->port_); + backend_ports.push_back(backends_[i]->port()); + } + return backend_ports; + } + + const std::vector> GetBackendPortsInGroups( + size_t start_index = 0, size_t stop_index = 0, + size_t num_group = 1) const { + if (stop_index == 0) stop_index = backends_.size(); + size_t group_size = (stop_index - start_index) / num_group; + std::vector> backend_ports; + for (size_t i = 0; i < num_group; ++i) { + backend_ports.emplace_back(); + size_t group_start = group_size * i + start_index; + size_t group_stop = + i == num_group - 1 ? stop_index : group_start + group_size; + for (size_t j = group_start; j < group_stop; ++j) { + backend_ports[i].push_back(backends_[j]->port()); + } } return backend_ports; } void ScheduleResponseForBalancer(size_t i, const DiscoveryResponse& response, int delay_ms) { - balancers_[i]->service_.add_response(response, delay_ms); + balancers_[i]->eds_service()->add_response(response, delay_ms); } Status SendRpc(EchoResponse* response = nullptr, int timeout_ms = 1000, @@ -583,71 +740,124 @@ class XdsEnd2endTest : public ::testing::Test { EXPECT_FALSE(status.ok()); } - template - struct ServerThread { - template - explicit ServerThread(const grpc::string& type, Args&&... args) - : port_(grpc_pick_unused_port_or_die()), - type_(type), - service_(std::forward(args)...) {} + class ServerThread { + public: + ServerThread() : port_(grpc_pick_unused_port_or_die()) {} + virtual ~ServerThread(){}; void Start(const grpc::string& server_host) { - gpr_log(GPR_INFO, "starting %s server on port %d", type_.c_str(), port_); + gpr_log(GPR_INFO, "starting %s server on port %d", Type(), port_); GPR_ASSERT(!running_); running_ = true; - grpc::internal::Mutex mu; + StartAllServices(); + grpc_core::Mutex mu; // We need to acquire the lock here in order to prevent the notify_one // by ServerThread::Serve from firing before the wait below is hit. - grpc::internal::MutexLock lock(&mu); - grpc::internal::CondVar cond; + grpc_core::MutexLock lock(&mu); + grpc_core::CondVar cond; thread_.reset(new std::thread( std::bind(&ServerThread::Serve, this, server_host, &mu, &cond))); cond.Wait(&mu); - gpr_log(GPR_INFO, "%s server startup complete", type_.c_str()); + gpr_log(GPR_INFO, "%s server startup complete", Type()); } - void Serve(const grpc::string& server_host, grpc::internal::Mutex* mu, - grpc::internal::CondVar* cond) { + void Serve(const grpc::string& server_host, grpc_core::Mutex* mu, + grpc_core::CondVar* cond) { // We need to acquire the lock here in order to prevent the notify_one // below from firing before its corresponding wait is executed. - grpc::internal::MutexLock lock(mu); + grpc_core::MutexLock lock(mu); std::ostringstream server_address; server_address << server_host << ":" << port_; ServerBuilder builder; std::shared_ptr creds(new SecureServerCredentials( grpc_fake_transport_security_server_credentials_create())); builder.AddListeningPort(server_address.str(), creds); - builder.RegisterService(&service_); + RegisterAllServices(&builder); server_ = builder.BuildAndStart(); cond->Signal(); } void Shutdown() { if (!running_) return; - gpr_log(GPR_INFO, "%s about to shutdown", type_.c_str()); - service_.Shutdown(); + gpr_log(GPR_INFO, "%s about to shutdown", Type()); + ShutdownAllServices(); server_->Shutdown(grpc_timeout_milliseconds_to_deadline(0)); thread_->join(); - gpr_log(GPR_INFO, "%s shutdown completed", type_.c_str()); + gpr_log(GPR_INFO, "%s shutdown completed", Type()); running_ = false; } + int port() const { return port_; } + + private: + virtual void RegisterAllServices(ServerBuilder* builder) = 0; + virtual void StartAllServices() = 0; + virtual void ShutdownAllServices() = 0; + + virtual const char* Type() = 0; + const int port_; - grpc::string type_; - T service_; std::unique_ptr server_; std::unique_ptr thread_; bool running_ = false; }; + class BackendServerThread : public ServerThread { + public: + BackendServiceImpl* backend_service() { return &backend_service_; } + + private: + void RegisterAllServices(ServerBuilder* builder) override { + builder->RegisterService(&backend_service_); + } + + void StartAllServices() override { backend_service_.Start(); } + + void ShutdownAllServices() override { backend_service_.Shutdown(); } + + const char* Type() override { return "Backend"; } + + BackendServiceImpl backend_service_; + }; + + class BalancerServerThread : public ServerThread { + public: + explicit BalancerServerThread(int client_load_reporting_interval = 0) + : lrs_service_(client_load_reporting_interval) {} + + EdsServiceImpl* eds_service() { return &eds_service_; } + LrsServiceImpl* lrs_service() { return &lrs_service_; } + + private: + void RegisterAllServices(ServerBuilder* builder) override { + builder->RegisterService(&eds_service_); + builder->RegisterService(&lrs_service_); + } + + void StartAllServices() override { + eds_service_.Start(); + lrs_service_.Start(); + } + + void ShutdownAllServices() override { + eds_service_.Shutdown(); + lrs_service_.Shutdown(); + } + + const char* Type() override { return "Balancer"; } + + EdsServiceImpl eds_service_; + LrsServiceImpl lrs_service_; + }; + const grpc::string server_host_; const size_t num_backends_; const size_t num_balancers_; const int client_load_reporting_interval_seconds_; std::shared_ptr channel_; std::unique_ptr stub_; - std::vector>> backends_; - std::vector>> balancers_; + std::vector> backends_; + std::vector> balancers_; grpc_core::RefCountedPtr response_generator_; grpc_core::RefCountedPtr @@ -673,7 +883,7 @@ TEST_F(SingleBalancerTest, Vanilla) { SetNextResolutionForLbChannelAllBalancers(); const size_t kNumRpcsPerAddress = 100; ScheduleResponseForBalancer( - 0, BalancerServiceImpl::BuildResponseForBackends(GetBackendPorts(), {}), + 0, EdsServiceImpl::BuildResponseForBackends(GetBackendPortsInGroups()), 0); // Make sure that trying to connect works without a call. channel_->GetState(true /* try_to_connect */); @@ -683,14 +893,13 @@ TEST_F(SingleBalancerTest, Vanilla) { CheckRpcSendOk(kNumRpcsPerAddress * num_backends_); // Each backend should have gotten 100 requests. for (size_t i = 0; i < backends_.size(); ++i) { - EXPECT_EQ(kNumRpcsPerAddress, backends_[i]->service_.request_count()); + EXPECT_EQ(kNumRpcsPerAddress, + backends_[i]->backend_service()->request_count()); } - balancers_[0]->service_.NotifyDoneWithServerlists(); - // The balancer got a single request. - EXPECT_EQ(1U, balancers_[0]->service_.request_count()); - // and sent a single response. - EXPECT_EQ(1U, balancers_[0]->service_.response_count()); - + balancers_[0]->eds_service()->NotifyDoneWithEdsCall(); + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); // Check LB policy name for the channel. EXPECT_EQ("xds_experimental", channel_->GetLoadBalancingPolicyName()); } @@ -700,31 +909,32 @@ TEST_F(SingleBalancerTest, SameBackendListedMultipleTimes) { SetNextResolutionForLbChannelAllBalancers(); // Same backend listed twice. std::vector ports; - ports.push_back(backends_[0]->port_); - ports.push_back(backends_[0]->port_); + ports.push_back(backends_[0]->port()); + ports.push_back(backends_[0]->port()); const size_t kNumRpcsPerAddress = 10; ScheduleResponseForBalancer( - 0, BalancerServiceImpl::BuildResponseForBackends(ports, {}), 0); + 0, EdsServiceImpl::BuildResponseForBackends({ports}), 0); // We need to wait for the backend to come online. WaitForBackend(0); // Send kNumRpcsPerAddress RPCs per server. CheckRpcSendOk(kNumRpcsPerAddress * ports.size()); // Backend should have gotten 20 requests. - EXPECT_EQ(kNumRpcsPerAddress * 2, backends_[0]->service_.request_count()); + EXPECT_EQ(kNumRpcsPerAddress * 2, + backends_[0]->backend_service()->request_count()); // And they should have come from a single client port, because of // subchannel sharing. - EXPECT_EQ(1UL, backends_[0]->service_.clients().size()); - balancers_[0]->service_.NotifyDoneWithServerlists(); + EXPECT_EQ(1UL, backends_[0]->backend_service()->clients().size()); + balancers_[0]->eds_service()->NotifyDoneWithEdsCall(); } TEST_F(SingleBalancerTest, SecureNaming) { // TODO(juanlishen): Use separate fake creds for the balancer channel. ResetStub(0, kApplicationTargetName_ + ";lb"); SetNextResolution({}, kDefaultServiceConfig_.c_str()); - SetNextResolutionForLbChannel({balancers_[0]->port_}); + SetNextResolutionForLbChannel({balancers_[0]->port()}); const size_t kNumRpcsPerAddress = 100; ScheduleResponseForBalancer( - 0, BalancerServiceImpl::BuildResponseForBackends(GetBackendPorts(), {}), + 0, EdsServiceImpl::BuildResponseForBackends(GetBackendPortsInGroups()), 0); // Make sure that trying to connect works without a call. channel_->GetState(true /* try_to_connect */); @@ -735,12 +945,12 @@ TEST_F(SingleBalancerTest, SecureNaming) { // Each backend should have gotten 100 requests. for (size_t i = 0; i < backends_.size(); ++i) { - EXPECT_EQ(kNumRpcsPerAddress, backends_[i]->service_.request_count()); + EXPECT_EQ(kNumRpcsPerAddress, + backends_[i]->backend_service()->request_count()); } - // The balancer got a single request. - EXPECT_EQ(1U, balancers_[0]->service_.request_count()); - // and sent a single response. - EXPECT_EQ(1U, balancers_[0]->service_.response_count()); + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } TEST_F(SingleBalancerTest, SecureNamingDeathTest) { @@ -758,7 +968,7 @@ TEST_F(SingleBalancerTest, SecureNamingDeathTest) { "\"fake:///wrong_lb\" } }\n" " ]\n" "}"); - SetNextResolutionForLbChannel({balancers_[0]->port_}); + SetNextResolutionForLbChannel({balancers_[0]->port()}); channel_->WaitForConnected(grpc_timeout_seconds_to_deadline(1)); }, ""); @@ -770,11 +980,11 @@ TEST_F(SingleBalancerTest, InitiallyEmptyServerlist) { const int kServerlistDelayMs = 500 * grpc_test_slowdown_factor(); const int kCallDeadlineMs = kServerlistDelayMs * 2; // First response is an empty serverlist, sent right away. - ScheduleResponseForBalancer( - 0, BalancerServiceImpl::BuildResponseForBackends({}, {}), 0); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponseForBackends({{}}), + 0); // Send non-empty serverlist only after kServerlistDelayMs ScheduleResponseForBalancer( - 0, BalancerServiceImpl::BuildResponseForBackends(GetBackendPorts(), {}), + 0, EdsServiceImpl::BuildResponseForBackends(GetBackendPortsInGroups()), kServerlistDelayMs); const auto t0 = system_clock::now(); // Client will block: LB will initially send empty serverlist. @@ -787,11 +997,11 @@ TEST_F(SingleBalancerTest, InitiallyEmptyServerlist) { // populated serverlist but under the call's deadline (which is enforced by // the call's deadline). EXPECT_GT(ellapsed_ms.count(), kServerlistDelayMs); - balancers_[0]->service_.NotifyDoneWithServerlists(); - // The balancer got a single request. - EXPECT_EQ(1U, balancers_[0]->service_.request_count()); + balancers_[0]->eds_service()->NotifyDoneWithEdsCall(); + // The EDS service got a single request. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); // and sent two responses. - EXPECT_EQ(2U, balancers_[0]->service_.response_count()); + EXPECT_EQ(2U, balancers_[0]->eds_service()->response_count()); } TEST_F(SingleBalancerTest, AllServersUnreachableFailFast) { @@ -803,15 +1013,14 @@ TEST_F(SingleBalancerTest, AllServersUnreachableFailFast) { ports.push_back(grpc_pick_unused_port_or_die()); } ScheduleResponseForBalancer( - 0, BalancerServiceImpl::BuildResponseForBackends(ports, {}), 0); + 0, EdsServiceImpl::BuildResponseForBackends({ports}), 0); const Status status = SendRpc(); // The error shouldn't be DEADLINE_EXCEEDED. EXPECT_EQ(StatusCode::UNAVAILABLE, status.error_code()); - balancers_[0]->service_.NotifyDoneWithServerlists(); - // The balancer got a single request. - EXPECT_EQ(1U, balancers_[0]->service_.request_count()); - // and sent a single response. - EXPECT_EQ(1U, balancers_[0]->service_.response_count()); + balancers_[0]->eds_service()->NotifyDoneWithEdsCall(); + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } TEST_F(SingleBalancerTest, Fallback) { @@ -825,8 +1034,8 @@ TEST_F(SingleBalancerTest, Fallback) { // Send non-empty serverlist only after kServerlistDelayMs. ScheduleResponseForBalancer( 0, - BalancerServiceImpl::BuildResponseForBackends( - GetBackendPorts(kNumBackendsInResolution /* start_index */), {}), + EdsServiceImpl::BuildResponseForBackends( + GetBackendPortsInGroups(kNumBackendsInResolution /* start_index */)), kServerlistDelayMs); // Wait until all the fallback backends are reachable. WaitForAllBackends(1 /* num_requests_multiple_of */, 0 /* start_index */, @@ -837,10 +1046,10 @@ TEST_F(SingleBalancerTest, Fallback) { // Fallback is used: each backend returned by the resolver should have // gotten one request. for (size_t i = 0; i < kNumBackendsInResolution; ++i) { - EXPECT_EQ(1U, backends_[i]->service_.request_count()); + EXPECT_EQ(1U, backends_[i]->backend_service()->request_count()); } for (size_t i = kNumBackendsInResolution; i < backends_.size(); ++i) { - EXPECT_EQ(0U, backends_[i]->service_.request_count()); + EXPECT_EQ(0U, backends_[i]->backend_service()->request_count()); } // Wait until the serverlist reception has been processed and all backends // in the serverlist are reachable. @@ -852,15 +1061,14 @@ TEST_F(SingleBalancerTest, Fallback) { // Serverlist is used: each backend returned by the balancer should // have gotten one request. for (size_t i = 0; i < kNumBackendsInResolution; ++i) { - EXPECT_EQ(0U, backends_[i]->service_.request_count()); + EXPECT_EQ(0U, backends_[i]->backend_service()->request_count()); } for (size_t i = kNumBackendsInResolution; i < backends_.size(); ++i) { - EXPECT_EQ(1U, backends_[i]->service_.request_count()); + EXPECT_EQ(1U, backends_[i]->backend_service()->request_count()); } - // The balancer got a single request. - EXPECT_EQ(1U, balancers_[0]->service_.request_count()); - // and sent a single response. - EXPECT_EQ(1U, balancers_[0]->service_.response_count()); + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } TEST_F(SingleBalancerTest, FallbackUpdate) { @@ -875,10 +1083,9 @@ TEST_F(SingleBalancerTest, FallbackUpdate) { // Send non-empty serverlist only after kServerlistDelayMs. ScheduleResponseForBalancer( 0, - BalancerServiceImpl::BuildResponseForBackends( - GetBackendPorts(kNumBackendsInResolution + - kNumBackendsInResolutionUpdate /* start_index */), - {}), + EdsServiceImpl::BuildResponseForBackends(GetBackendPortsInGroups( + kNumBackendsInResolution + + kNumBackendsInResolutionUpdate /* start_index */)), kServerlistDelayMs); // Wait until all the fallback backends are reachable. WaitForAllBackends(1 /* num_requests_multiple_of */, 0 /* start_index */, @@ -889,10 +1096,10 @@ TEST_F(SingleBalancerTest, FallbackUpdate) { // Fallback is used: each backend returned by the resolver should have // gotten one request. for (size_t i = 0; i < kNumBackendsInResolution; ++i) { - EXPECT_EQ(1U, backends_[i]->service_.request_count()); + EXPECT_EQ(1U, backends_[i]->backend_service()->request_count()); } for (size_t i = kNumBackendsInResolution; i < backends_.size(); ++i) { - EXPECT_EQ(0U, backends_[i]->service_.request_count()); + EXPECT_EQ(0U, backends_[i]->backend_service()->request_count()); } SetNextResolution(GetBackendPorts(kNumBackendsInResolution, kNumBackendsInResolution + @@ -910,15 +1117,15 @@ TEST_F(SingleBalancerTest, FallbackUpdate) { // The resolution update is used: each backend in the resolution update should // have gotten one request. for (size_t i = 0; i < kNumBackendsInResolution; ++i) { - EXPECT_EQ(0U, backends_[i]->service_.request_count()); + EXPECT_EQ(0U, backends_[i]->backend_service()->request_count()); } for (size_t i = kNumBackendsInResolution; i < kNumBackendsInResolution + kNumBackendsInResolutionUpdate; ++i) { - EXPECT_EQ(1U, backends_[i]->service_.request_count()); + EXPECT_EQ(1U, backends_[i]->backend_service()->request_count()); } for (size_t i = kNumBackendsInResolution + kNumBackendsInResolutionUpdate; i < backends_.size(); ++i) { - EXPECT_EQ(0U, backends_[i]->service_.request_count()); + EXPECT_EQ(0U, backends_[i]->backend_service()->request_count()); } // Wait until the serverlist reception has been processed and all backends // in the serverlist are reachable. @@ -933,23 +1140,22 @@ TEST_F(SingleBalancerTest, FallbackUpdate) { // have gotten one request. for (size_t i = 0; i < kNumBackendsInResolution + kNumBackendsInResolutionUpdate; ++i) { - EXPECT_EQ(0U, backends_[i]->service_.request_count()); + EXPECT_EQ(0U, backends_[i]->backend_service()->request_count()); } for (size_t i = kNumBackendsInResolution + kNumBackendsInResolutionUpdate; i < backends_.size(); ++i) { - EXPECT_EQ(1U, backends_[i]->service_.request_count()); + EXPECT_EQ(1U, backends_[i]->backend_service()->request_count()); } - // The balancer got a single request. - EXPECT_EQ(1U, balancers_[0]->service_.request_count()); - // and sent a single response. - EXPECT_EQ(1U, balancers_[0]->service_.response_count()); + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } TEST_F(SingleBalancerTest, FallbackEarlyWhenBalancerChannelFails) { const int kFallbackTimeoutMs = 10000 * grpc_test_slowdown_factor(); ResetStub(kFallbackTimeoutMs); // Return an unreachable balancer and one fallback backend. - SetNextResolution({backends_[0]->port_}, kDefaultServiceConfig_.c_str()); + SetNextResolution({backends_[0]->port()}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannel({grpc_pick_unused_port_or_die()}); // Send RPC with deadline less than the fallback timeout and make sure it // succeeds. @@ -961,10 +1167,10 @@ TEST_F(SingleBalancerTest, FallbackEarlyWhenBalancerCallFails) { const int kFallbackTimeoutMs = 10000 * grpc_test_slowdown_factor(); ResetStub(kFallbackTimeoutMs); // Return one balancer and one fallback backend. - SetNextResolution({backends_[0]->port_}, kDefaultServiceConfig_.c_str()); + SetNextResolution({backends_[0]->port()}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); // Balancer drops call without sending a serverlist. - balancers_[0]->service_.NotifyDoneWithServerlists(); + balancers_[0]->eds_service()->NotifyDoneWithEdsCall(); // Send RPC with deadline less than the fallback timeout and make sure it // succeeds. CheckRpcSendOk(/* times */ 1, /* timeout_ms */ 1000, @@ -974,13 +1180,13 @@ TEST_F(SingleBalancerTest, FallbackEarlyWhenBalancerCallFails) { TEST_F(SingleBalancerTest, FallbackIfResponseReceivedButChildNotReady) { const int kFallbackTimeoutMs = 500 * grpc_test_slowdown_factor(); ResetStub(kFallbackTimeoutMs); - SetNextResolution({backends_[0]->port_}, kDefaultServiceConfig_.c_str()); + SetNextResolution({backends_[0]->port()}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); // Send a serverlist that only contains an unreachable backend before fallback // timeout. ScheduleResponseForBalancer(0, - BalancerServiceImpl::BuildResponseForBackends( - {grpc_pick_unused_port_or_die()}, {}), + EdsServiceImpl::BuildResponseForBackends( + {{grpc_pick_unused_port_or_die()}}), 0); // Because no child policy is ready before fallback timeout, we enter fallback // mode. @@ -989,13 +1195,13 @@ TEST_F(SingleBalancerTest, FallbackIfResponseReceivedButChildNotReady) { TEST_F(SingleBalancerTest, FallbackModeIsExitedWhenBalancerSaysToDropAllCalls) { // Return an unreachable balancer and one fallback backend. - SetNextResolution({backends_[0]->port_}, kDefaultServiceConfig_.c_str()); + SetNextResolution({backends_[0]->port()}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannel({grpc_pick_unused_port_or_die()}); // Enter fallback mode because the LB channel fails to connect. WaitForBackend(0); // Return a new balancer that sends an empty serverlist. - ScheduleResponseForBalancer( - 0, BalancerServiceImpl::BuildResponseForBackends({}, {}), 0); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponseForBackends({{}}), + 0); SetNextResolutionForLbChannelAllBalancers(); // Send RPCs until failure. gpr_timespec deadline = gpr_time_add( @@ -1009,16 +1215,14 @@ TEST_F(SingleBalancerTest, FallbackModeIsExitedWhenBalancerSaysToDropAllCalls) { TEST_F(SingleBalancerTest, FallbackModeIsExitedAfterChildRready) { // Return an unreachable balancer and one fallback backend. - SetNextResolution({backends_[0]->port_}, kDefaultServiceConfig_.c_str()); + SetNextResolution({backends_[0]->port()}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannel({grpc_pick_unused_port_or_die()}); // Enter fallback mode because the LB channel fails to connect. WaitForBackend(0); // Return a new balancer that sends a dead backend. ShutdownBackend(1); ScheduleResponseForBalancer( - 0, - BalancerServiceImpl::BuildResponseForBackends({backends_[1]->port_}, {}), - 0); + 0, EdsServiceImpl::BuildResponseForBackends({{backends_[1]->port()}}), 0); SetNextResolutionForLbChannelAllBalancers(); // The state (TRANSIENT_FAILURE) update from the child policy will be ignored // because we are still in fallback mode. @@ -1035,15 +1239,15 @@ TEST_F(SingleBalancerTest, FallbackModeIsExitedAfterChildRready) { // We have exited fallback mode, so calls will go to the child policy // exclusively. CheckRpcSendOk(100); - EXPECT_EQ(0U, backends_[0]->service_.request_count()); - EXPECT_EQ(100U, backends_[1]->service_.request_count()); + EXPECT_EQ(0U, backends_[0]->backend_service()->request_count()); + EXPECT_EQ(100U, backends_[1]->backend_service()->request_count()); } TEST_F(SingleBalancerTest, BackendsRestart) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); ScheduleResponseForBalancer( - 0, BalancerServiceImpl::BuildResponseForBackends(GetBackendPorts(), {}), + 0, EdsServiceImpl::BuildResponseForBackends(GetBackendPortsInGroups()), 0); WaitForAllBackends(); // Stop backends. RPCs should fail. @@ -1063,12 +1267,12 @@ class UpdatesTest : public XdsEnd2endTest { TEST_F(UpdatesTest, UpdateBalancersButKeepUsingOriginalBalancer) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); - const std::vector first_backend{GetBackendPorts()[0]}; - const std::vector second_backend{GetBackendPorts()[1]}; + auto first_backend = GetBackendPortsInGroups(0, 1); + auto second_backend = GetBackendPortsInGroups(1, 2); ScheduleResponseForBalancer( - 0, BalancerServiceImpl::BuildResponseForBackends(first_backend, {}), 0); + 0, EdsServiceImpl::BuildResponseForBackends(first_backend), 0); ScheduleResponseForBalancer( - 1, BalancerServiceImpl::BuildResponseForBackends(second_backend, {}), 0); + 1, EdsServiceImpl::BuildResponseForBackends(second_backend), 0); // Wait until the first backend is ready. WaitForBackend(0); @@ -1079,22 +1283,22 @@ TEST_F(UpdatesTest, UpdateBalancersButKeepUsingOriginalBalancer) { gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH =========="); // All 10 requests should have gone to the first backend. - EXPECT_EQ(10U, backends_[0]->service_.request_count()); + EXPECT_EQ(10U, backends_[0]->backend_service()->request_count()); - // Balancer 0 got a single request. - EXPECT_EQ(1U, balancers_[0]->service_.request_count()); - // and sent a single response. - EXPECT_EQ(1U, balancers_[0]->service_.response_count()); - EXPECT_EQ(0U, balancers_[1]->service_.request_count()); - EXPECT_EQ(0U, balancers_[1]->service_.response_count()); - EXPECT_EQ(0U, balancers_[2]->service_.request_count()); - EXPECT_EQ(0U, balancers_[2]->service_.response_count()); + // The EDS service of balancer 0 got a single request, and sent a single + // response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); + EXPECT_EQ(0U, balancers_[1]->eds_service()->request_count()); + EXPECT_EQ(0U, balancers_[1]->eds_service()->response_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->request_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 1 =========="); - SetNextResolutionForLbChannel({balancers_[1]->port_}); + SetNextResolutionForLbChannel({balancers_[1]->port()}); gpr_log(GPR_INFO, "========= UPDATE 1 DONE =========="); - EXPECT_EQ(0U, backends_[1]->service_.request_count()); + EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); gpr_timespec deadline = gpr_time_add( gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(10000, GPR_TIMESPAN)); // Send 10 seconds worth of RPCs @@ -1103,25 +1307,25 @@ TEST_F(UpdatesTest, UpdateBalancersButKeepUsingOriginalBalancer) { } while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0); // The current LB call is still working, so xds continued using it to the // first balancer, which doesn't assign the second backend. - EXPECT_EQ(0U, backends_[1]->service_.request_count()); - - EXPECT_EQ(1U, balancers_[0]->service_.request_count()); - EXPECT_EQ(1U, balancers_[0]->service_.response_count()); - EXPECT_EQ(0U, balancers_[1]->service_.request_count()); - EXPECT_EQ(0U, balancers_[1]->service_.response_count()); - EXPECT_EQ(0U, balancers_[2]->service_.request_count()); - EXPECT_EQ(0U, balancers_[2]->service_.response_count()); + EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); + + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); + EXPECT_EQ(0U, balancers_[1]->eds_service()->request_count()); + EXPECT_EQ(0U, balancers_[1]->eds_service()->response_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->request_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); } TEST_F(UpdatesTest, UpdateBalancerName) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); - const std::vector first_backend{GetBackendPorts()[0]}; - const std::vector second_backend{GetBackendPorts()[1]}; + auto first_backend = GetBackendPortsInGroups(0, 1); + auto second_backend = GetBackendPortsInGroups(1, 2); ScheduleResponseForBalancer( - 0, BalancerServiceImpl::BuildResponseForBackends(first_backend, {}), 0); + 0, EdsServiceImpl::BuildResponseForBackends(first_backend), 0); ScheduleResponseForBalancer( - 1, BalancerServiceImpl::BuildResponseForBackends(second_backend, {}), 0); + 1, EdsServiceImpl::BuildResponseForBackends(second_backend), 0); // Wait until the first backend is ready. WaitForBackend(0); @@ -1132,19 +1336,19 @@ TEST_F(UpdatesTest, UpdateBalancerName) { gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH =========="); // All 10 requests should have gone to the first backend. - EXPECT_EQ(10U, backends_[0]->service_.request_count()); + EXPECT_EQ(10U, backends_[0]->backend_service()->request_count()); - // Balancer 0 got a single request. - EXPECT_EQ(1U, balancers_[0]->service_.request_count()); - // and sent a single response. - EXPECT_EQ(1U, balancers_[0]->service_.response_count()); - EXPECT_EQ(0U, balancers_[1]->service_.request_count()); - EXPECT_EQ(0U, balancers_[1]->service_.response_count()); - EXPECT_EQ(0U, balancers_[2]->service_.request_count()); - EXPECT_EQ(0U, balancers_[2]->service_.response_count()); + // The EDS service of balancer 0 got a single request, and sent a single + // response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); + EXPECT_EQ(0U, balancers_[1]->eds_service()->request_count()); + EXPECT_EQ(0U, balancers_[1]->eds_service()->response_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->request_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); std::vector ports; - ports.emplace_back(balancers_[1]->port_); + ports.emplace_back(balancers_[1]->port()); auto new_lb_channel_response_generator = grpc_core::MakeRefCounted(); SetNextResolutionForLbChannel(ports, nullptr, @@ -1163,22 +1367,22 @@ TEST_F(UpdatesTest, UpdateBalancerName) { // Wait until update has been processed, as signaled by the second backend // receiving a request. - EXPECT_EQ(0U, backends_[1]->service_.request_count()); + EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); WaitForBackend(1); - backends_[1]->service_.ResetCounters(); + backends_[1]->backend_service()->ResetCounters(); gpr_log(GPR_INFO, "========= BEFORE SECOND BATCH =========="); CheckRpcSendOk(10); gpr_log(GPR_INFO, "========= DONE WITH SECOND BATCH =========="); // All 10 requests should have gone to the second backend. - EXPECT_EQ(10U, backends_[1]->service_.request_count()); - - EXPECT_EQ(1U, balancers_[0]->service_.request_count()); - EXPECT_EQ(1U, balancers_[0]->service_.response_count()); - EXPECT_EQ(1U, balancers_[1]->service_.request_count()); - EXPECT_EQ(1U, balancers_[1]->service_.response_count()); - EXPECT_EQ(0U, balancers_[2]->service_.request_count()); - EXPECT_EQ(0U, balancers_[2]->service_.response_count()); + EXPECT_EQ(10U, backends_[1]->backend_service()->request_count()); + + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); + EXPECT_EQ(1U, balancers_[1]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[1]->eds_service()->response_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->request_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); } // Send an update with the same set of LBs as the one in SetUp() in order to @@ -1187,13 +1391,12 @@ TEST_F(UpdatesTest, UpdateBalancerName) { TEST_F(UpdatesTest, UpdateBalancersRepeated) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); - const std::vector first_backend{GetBackendPorts()[0]}; - const std::vector second_backend{GetBackendPorts()[0]}; - + auto first_backend = GetBackendPortsInGroups(0, 1); + auto second_backend = GetBackendPortsInGroups(1, 2); ScheduleResponseForBalancer( - 0, BalancerServiceImpl::BuildResponseForBackends(first_backend, {}), 0); + 0, EdsServiceImpl::BuildResponseForBackends(first_backend), 0); ScheduleResponseForBalancer( - 1, BalancerServiceImpl::BuildResponseForBackends(second_backend, {}), 0); + 1, EdsServiceImpl::BuildResponseForBackends(second_backend), 0); // Wait until the first backend is ready. WaitForBackend(0); @@ -1204,26 +1407,26 @@ TEST_F(UpdatesTest, UpdateBalancersRepeated) { gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH =========="); // All 10 requests should have gone to the first backend. - EXPECT_EQ(10U, backends_[0]->service_.request_count()); + EXPECT_EQ(10U, backends_[0]->backend_service()->request_count()); - // Balancer 0 got a single request. - EXPECT_EQ(1U, balancers_[0]->service_.request_count()); - // and sent a single response. - EXPECT_EQ(1U, balancers_[0]->service_.response_count()); - EXPECT_EQ(0U, balancers_[1]->service_.request_count()); - EXPECT_EQ(0U, balancers_[1]->service_.response_count()); - EXPECT_EQ(0U, balancers_[2]->service_.request_count()); - EXPECT_EQ(0U, balancers_[2]->service_.response_count()); + // The EDS service of balancer 0 got a single request, and sent a single + // response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); + EXPECT_EQ(0U, balancers_[1]->eds_service()->request_count()); + EXPECT_EQ(0U, balancers_[1]->eds_service()->response_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->request_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); std::vector ports; - ports.emplace_back(balancers_[0]->port_); - ports.emplace_back(balancers_[1]->port_); - ports.emplace_back(balancers_[2]->port_); + ports.emplace_back(balancers_[0]->port()); + ports.emplace_back(balancers_[1]->port()); + ports.emplace_back(balancers_[2]->port()); gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 1 =========="); SetNextResolutionForLbChannel(ports); gpr_log(GPR_INFO, "========= UPDATE 1 DONE =========="); - EXPECT_EQ(0U, backends_[1]->service_.request_count()); + EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); gpr_timespec deadline = gpr_time_add( gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(10000, GPR_TIMESPAN)); // Send 10 seconds worth of RPCs @@ -1232,16 +1435,16 @@ TEST_F(UpdatesTest, UpdateBalancersRepeated) { } while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0); // xds continued using the original LB call to the first balancer, which // doesn't assign the second backend. - EXPECT_EQ(0U, backends_[1]->service_.request_count()); + EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); ports.clear(); - ports.emplace_back(balancers_[0]->port_); - ports.emplace_back(balancers_[1]->port_); + ports.emplace_back(balancers_[0]->port()); + ports.emplace_back(balancers_[1]->port()); gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 2 =========="); SetNextResolutionForLbChannel(ports); gpr_log(GPR_INFO, "========= UPDATE 2 DONE =========="); - EXPECT_EQ(0U, backends_[1]->service_.request_count()); + EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(10000, GPR_TIMESPAN)); // Send 10 seconds worth of RPCs @@ -1250,26 +1453,25 @@ TEST_F(UpdatesTest, UpdateBalancersRepeated) { } while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0); // xds continued using the original LB call to the first balancer, which // doesn't assign the second backend. - EXPECT_EQ(0U, backends_[1]->service_.request_count()); + EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); } TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); - SetNextResolutionForLbChannel({balancers_[0]->port_}); - const std::vector first_backend{GetBackendPorts()[0]}; - const std::vector second_backend{GetBackendPorts()[1]}; - + SetNextResolutionForLbChannel({balancers_[0]->port()}); + auto first_backend = GetBackendPortsInGroups(0, 1); + auto second_backend = GetBackendPortsInGroups(1, 2); ScheduleResponseForBalancer( - 0, BalancerServiceImpl::BuildResponseForBackends(first_backend, {}), 0); + 0, EdsServiceImpl::BuildResponseForBackends(first_backend), 0); ScheduleResponseForBalancer( - 1, BalancerServiceImpl::BuildResponseForBackends(second_backend, {}), 0); + 1, EdsServiceImpl::BuildResponseForBackends(second_backend), 0); // Start servers and send 10 RPCs per server. gpr_log(GPR_INFO, "========= BEFORE FIRST BATCH =========="); CheckRpcSendOk(10); gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH =========="); // All 10 requests should have gone to the first backend. - EXPECT_EQ(10U, backends_[0]->service_.request_count()); + EXPECT_EQ(10U, backends_[0]->backend_service()->request_count()); // Kill balancer 0 gpr_log(GPR_INFO, "********** ABOUT TO KILL BALANCER 0 *************"); @@ -1281,48 +1483,48 @@ TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) { CheckRpcSendOk(10); gpr_log(GPR_INFO, "========= DONE WITH SECOND BATCH =========="); // All 10 requests should again have gone to the first backend. - EXPECT_EQ(20U, backends_[0]->service_.request_count()); - EXPECT_EQ(0U, backends_[1]->service_.request_count()); - - // Balancer 0 got a single request. - EXPECT_EQ(1U, balancers_[0]->service_.request_count()); - // and sent a single response. - EXPECT_EQ(1U, balancers_[0]->service_.response_count()); - EXPECT_EQ(0U, balancers_[1]->service_.request_count()); - EXPECT_EQ(0U, balancers_[1]->service_.response_count()); - EXPECT_EQ(0U, balancers_[2]->service_.request_count()); - EXPECT_EQ(0U, balancers_[2]->service_.response_count()); + EXPECT_EQ(20U, backends_[0]->backend_service()->request_count()); + EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); + + // The EDS service of balancer 0 got a single request, and sent a single + // response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); + EXPECT_EQ(0U, balancers_[1]->eds_service()->request_count()); + EXPECT_EQ(0U, balancers_[1]->eds_service()->response_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->request_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 1 =========="); - SetNextResolutionForLbChannel({balancers_[1]->port_}); + SetNextResolutionForLbChannel({balancers_[1]->port()}); gpr_log(GPR_INFO, "========= UPDATE 1 DONE =========="); // Wait until update has been processed, as signaled by the second backend // receiving a request. In the meantime, the client continues to be serviced // (by the first backend) without interruption. - EXPECT_EQ(0U, backends_[1]->service_.request_count()); + EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); WaitForBackend(1); // This is serviced by the updated RR policy - backends_[1]->service_.ResetCounters(); + backends_[1]->backend_service()->ResetCounters(); gpr_log(GPR_INFO, "========= BEFORE THIRD BATCH =========="); CheckRpcSendOk(10); gpr_log(GPR_INFO, "========= DONE WITH THIRD BATCH =========="); // All 10 requests should have gone to the second backend. - EXPECT_EQ(10U, backends_[1]->service_.request_count()); + EXPECT_EQ(10U, backends_[1]->backend_service()->request_count()); - EXPECT_EQ(1U, balancers_[0]->service_.request_count()); - EXPECT_EQ(1U, balancers_[0]->service_.response_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); // The second balancer, published as part of the first update, may end up // getting two requests (that is, 1 <= #req <= 2) if the LB call retry timer // firing races with the arrival of the update containing the second // balancer. - EXPECT_GE(balancers_[1]->service_.request_count(), 1U); - EXPECT_GE(balancers_[1]->service_.response_count(), 1U); - EXPECT_LE(balancers_[1]->service_.request_count(), 2U); - EXPECT_LE(balancers_[1]->service_.response_count(), 2U); - EXPECT_EQ(0U, balancers_[2]->service_.request_count()); - EXPECT_EQ(0U, balancers_[2]->service_.response_count()); + EXPECT_GE(balancers_[1]->eds_service()->request_count(), 1U); + EXPECT_GE(balancers_[1]->eds_service()->response_count(), 1U); + EXPECT_LE(balancers_[1]->eds_service()->request_count(), 2U); + EXPECT_LE(balancers_[1]->eds_service()->response_count(), 2U); + EXPECT_EQ(0U, balancers_[2]->eds_service()->request_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); } // The re-resolution tests are deferred because they rely on the fallback mode, @@ -1346,15 +1548,105 @@ class SingleBalancerWithClientLoadReportingTest : public XdsEnd2endTest { SingleBalancerWithClientLoadReportingTest() : XdsEnd2endTest(4, 1, 3) {} }; -// The client load reporting tests are deferred because the client load -// reporting hasn't been supported yet. - -// TODO(vpowar): Add TEST_F(SingleBalancerWithClientLoadReportingTest, Vanilla) +TEST_F(SingleBalancerWithClientLoadReportingTest, Vanilla) { + SetNextResolution({}, kDefaultServiceConfig_.c_str()); + SetNextResolutionForLbChannel({balancers_[0]->port()}); + const size_t kNumRpcsPerAddress = 100; + // TODO(juanlishen): Partition the backends after multiple localities is + // tested. + ScheduleResponseForBalancer(0, + EdsServiceImpl::BuildResponseForBackends( + GetBackendPortsInGroups(0, backends_.size())), + 0); + // Wait until all backends are ready. + int num_ok = 0; + int num_failure = 0; + int num_drops = 0; + std::tie(num_ok, num_failure, num_drops) = WaitForAllBackends(); + // Send kNumRpcsPerAddress RPCs per server. + CheckRpcSendOk(kNumRpcsPerAddress * num_backends_); + // Each backend should have gotten 100 requests. + for (size_t i = 0; i < backends_.size(); ++i) { + EXPECT_EQ(kNumRpcsPerAddress, + backends_[i]->backend_service()->request_count()); + } + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); + // The LRS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->lrs_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->lrs_service()->response_count()); + // The load report received at the balancer should be correct. + ClientStats* client_stats = balancers_[0]->lrs_service()->WaitForLoadReport(); + EXPECT_EQ(kNumRpcsPerAddress * num_backends_ + num_ok, + client_stats->total_successful_requests()); + EXPECT_EQ(0U, client_stats->total_requests_in_progress()); + EXPECT_EQ(kNumRpcsPerAddress * num_backends_ + num_ok, + client_stats->total_issued_requests()); + EXPECT_EQ(0U, client_stats->total_error_requests()); + EXPECT_EQ(0U, client_stats->total_dropped_requests()); +} -// TODO(roth): Add TEST_F(SingleBalancerWithClientLoadReportingTest, -// BalancerRestart) +TEST_F(SingleBalancerWithClientLoadReportingTest, BalancerRestart) { + SetNextResolution({}, kDefaultServiceConfig_.c_str()); + SetNextResolutionForLbChannel({balancers_[0]->port()}); + const size_t kNumBackendsFirstPass = backends_.size() / 2; + const size_t kNumBackendsSecondPass = + backends_.size() - kNumBackendsFirstPass; + ScheduleResponseForBalancer( + 0, + EdsServiceImpl::BuildResponseForBackends( + GetBackendPortsInGroups(0, kNumBackendsFirstPass)), + 0); + // Wait until all backends returned by the balancer are ready. + int num_ok = 0; + int num_failure = 0; + int num_drops = 0; + std::tie(num_ok, num_failure, num_drops) = + WaitForAllBackends(/* num_requests_multiple_of */ 1, /* start_index */ 0, + /* stop_index */ kNumBackendsFirstPass); + ClientStats* client_stats = balancers_[0]->lrs_service()->WaitForLoadReport(); + EXPECT_EQ(static_cast(num_ok), + client_stats->total_successful_requests()); + EXPECT_EQ(0U, client_stats->total_requests_in_progress()); + EXPECT_EQ(0U, client_stats->total_error_requests()); + EXPECT_EQ(0U, client_stats->total_dropped_requests()); + // Shut down the balancer. + balancers_[0]->Shutdown(); + // Send 1 more request per backend. This will continue using the + // last serverlist we received from the balancer before it was shut down. + ResetBackendCounters(); + CheckRpcSendOk(kNumBackendsFirstPass); + int num_started = kNumBackendsFirstPass; + // Each backend should have gotten 1 request. + for (size_t i = 0; i < kNumBackendsFirstPass; ++i) { + EXPECT_EQ(1UL, backends_[i]->backend_service()->request_count()); + } + // Now restart the balancer, this time pointing to the new backends. + balancers_[0]->Start(server_host_); + ScheduleResponseForBalancer( + 0, + EdsServiceImpl::BuildResponseForBackends( + GetBackendPortsInGroups(kNumBackendsFirstPass)), + 0); + // Wait for queries to start going to one of the new backends. + // This tells us that we're now using the new serverlist. + std::tie(num_ok, num_failure, num_drops) = + WaitForAllBackends(/* num_requests_multiple_of */ 1, + /* start_index */ kNumBackendsFirstPass); + num_started += num_ok + num_failure + num_drops; + // Send one RPC per backend. + CheckRpcSendOk(kNumBackendsSecondPass); + num_started += kNumBackendsSecondPass; + // Check client stats. + client_stats = balancers_[0]->lrs_service()->WaitForLoadReport(); + EXPECT_EQ(num_started, client_stats->total_successful_requests()); + EXPECT_EQ(0U, client_stats->total_requests_in_progress()); + EXPECT_EQ(0U, client_stats->total_error_requests()); + EXPECT_EQ(0U, client_stats->total_dropped_requests()); +} -// TODO(roth): Add TEST_F(SingleBalancerWithClientLoadReportingTest, Drop) +// TODO(juanlishen): Add TEST_F(SingleBalancerWithClientLoadReportingTest, Drop) } // namespace } // namespace testing diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index f0f94c00466..fc1bfe99934 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -63,6 +63,7 @@ CONFIG = [ 'grpc.max_response_message_bytes', # well known method names '/grpc.lb.v1.LoadBalancer/BalanceLoad', + '/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats', '/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints', '/grpc.health.v1.Health/Watch', '/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources', diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 36e6ef1d48c..f39c72c4d5e 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -5307,9 +5307,12 @@ "grpc_test_util" ], "headers": [ - "src/proto/grpc/lb/v2/xds_for_test.grpc.pb.h", - "src/proto/grpc/lb/v2/xds_for_test.pb.h", - "src/proto/grpc/lb/v2/xds_for_test_mock.grpc.pb.h" + "src/proto/grpc/lb/v2/eds_for_test.grpc.pb.h", + "src/proto/grpc/lb/v2/eds_for_test.pb.h", + "src/proto/grpc/lb/v2/eds_for_test_mock.grpc.pb.h", + "src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.h", + "src/proto/grpc/lb/v2/lrs_for_test.pb.h", + "src/proto/grpc/lb/v2/lrs_for_test_mock.grpc.pb.h" ], "is_filegroup": false, "language": "c++", @@ -9467,7 +9470,6 @@ "gpr", "grpc_base", "grpc_client_channel", - "grpc_lb_upb", "grpc_resolver_fake" ], "headers": [ @@ -9498,7 +9500,6 @@ "gpr", "grpc_base", "grpc_client_channel", - "grpc_lb_upb", "grpc_resolver_fake", "grpc_secure" ], From 13896f8bd184b91327cbb532c8d93076d0169376 Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Wed, 5 Jun 2019 23:37:11 -0400 Subject: [PATCH 261/661] Mandate static string for host and method passed to grpc_channel_register_call This is for the gRFC being prepared. Bump the major version of core to 8.0.0. --- Makefile | 34 ++++++++++++++-------------- build.yaml | 2 +- build_config.rb | 2 +- include/grpc/grpc.h | 4 +++- src/core/lib/surface/channel.cc | 4 ++-- src/core/lib/surface/version.cc | 2 +- src/objective-c/tests/version.h | 2 +- tools/doxygen/Doxyfile.core | 2 +- tools/doxygen/Doxyfile.core.internal | 2 +- 9 files changed, 28 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index ef5963dc441..083790f4b5b 100644 --- a/Makefile +++ b/Makefile @@ -454,7 +454,7 @@ E = @echo Q = @ endif -CORE_VERSION = 7.0.0 +CORE_VERSION = 8.0.0 CPP_VERSION = 1.24.0-dev CSHARP_VERSION = 2.24.0-dev @@ -504,7 +504,7 @@ SHARED_EXT_CORE = dll SHARED_EXT_CPP = dll SHARED_EXT_CSHARP = dll SHARED_PREFIX = -SHARED_VERSION_CORE = -7 +SHARED_VERSION_CORE = -8 SHARED_VERSION_CPP = -1 SHARED_VERSION_CSHARP = -2 else ifeq ($(SYSTEM),Darwin) @@ -3104,7 +3104,7 @@ install-shared_c: shared_c strip-shared_c install-pkg-config_c ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libaddress_sorting.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libaddress_sorting.so.7 + $(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libaddress_sorting.so.8 $(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libaddress_sorting.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" @@ -3113,7 +3113,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgpr.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgpr.so.7 + $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgpr.so.8 $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgpr.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" @@ -3122,7 +3122,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgrpc.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc.so.7 + $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc.so.8 $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" @@ -3131,7 +3131,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgrpc_cronet.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_cronet.so.7 + $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_cronet.so.8 $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_cronet.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" @@ -3140,7 +3140,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgrpc_unsecure.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_unsecure.so.7 + $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_unsecure.so.8 $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_unsecure.so endif ifneq ($(SYSTEM),MINGW32) @@ -3301,8 +3301,8 @@ $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): ifeq ($(SYSTEM),Darwin) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBADDRESS_SORTING_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libaddress_sorting.so.7 -o $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBADDRESS_SORTING_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) - $(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).so.7 + $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libaddress_sorting.so.8 -o $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBADDRESS_SORTING_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).so.8 $(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).so endif endif @@ -3497,8 +3497,8 @@ $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGPR_OB ifeq ($(SYSTEM),Darwin) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgpr.so.7 -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) - $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so.7 + $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgpr.so.8 -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so.8 $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so endif endif @@ -3954,8 +3954,8 @@ $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_ ifeq ($(SYSTEM),Darwin) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.7 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) - $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.7 + $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.8 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.8 $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so endif endif @@ -4338,8 +4338,8 @@ $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(L ifeq ($(SYSTEM),Darwin) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_cronet.so.7 -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) - $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).so.7 + $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_cronet.so.8 -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).so.8 $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).so endif endif @@ -5348,8 +5348,8 @@ $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $ ifeq ($(SYSTEM),Darwin) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_unsecure.so.7 -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) - $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so.7 + $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_unsecure.so.8 -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so.8 $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so endif endif diff --git a/build.yaml b/build.yaml index 0b8c1955d27..122e3dceb4c 100644 --- a/build.yaml +++ b/build.yaml @@ -12,7 +12,7 @@ settings: '#08': Use "-preN" suffixes to identify pre-release versions '#09': Per-language overrides are possible with (eg) ruby_version tag here '#10': See the expand_version.py for all the quirks here - core_version: 7.0.0 + core_version: 8.0.0 csharp_major_version: 2 g_stands_for: ganges version: 1.24.0-dev diff --git a/build_config.rb b/build_config.rb index ab06a137473..7bd312cd2b6 100644 --- a/build_config.rb +++ b/build_config.rb @@ -13,5 +13,5 @@ # limitations under the License. module GrpcBuildConfig - CORE_WINDOWS_DLL = '/tmp/libs/opt/grpc-7.dll' + CORE_WINDOWS_DLL = '/tmp/libs/opt/grpc-8.dll' end diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 9a99e016a93..cb46477c19d 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -224,7 +224,9 @@ GRPCAPI grpc_call* grpc_channel_create_call( GRPCAPI void grpc_channel_ping(grpc_channel* channel, grpc_completion_queue* cq, void* tag, void* reserved); -/** Pre-register a method/host pair on a channel. */ +/** Pre-register a method/host pair on a channel. + method and host are not owned and must remain alive while the server is + running. */ GRPCAPI void* grpc_channel_register_call(grpc_channel* channel, const char* method, const char* host, void* reserved); diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index 942af37a830..24813407e28 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -417,10 +417,10 @@ void* grpc_channel_register_call(grpc_channel* channel, const char* method, grpc_core::ExecCtx exec_ctx; rc->path = grpc_mdelem_from_slices(GRPC_MDSTR_PATH, - grpc_core::ManagedMemorySlice(method)); + grpc_core::ExternallyManagedSlice(method)); rc->authority = host ? grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY, - grpc_core::ManagedMemorySlice(host)) + grpc_core::ExternallyManagedSlice(host)) : GRPC_MDNULL; gpr_mu_lock(&channel->registered_call_mu); rc->next = channel->registered_calls; diff --git a/src/core/lib/surface/version.cc b/src/core/lib/surface/version.cc index 182eed2ced2..71eb89a1b42 100644 --- a/src/core/lib/surface/version.cc +++ b/src/core/lib/surface/version.cc @@ -23,6 +23,6 @@ #include -const char* grpc_version_string(void) { return "7.0.0"; } +const char* grpc_version_string(void) { return "8.0.0"; } const char* grpc_g_stands_for(void) { return "ganges"; } diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index d724fdd8e07..9182189f4c8 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -23,4 +23,4 @@ // `tools/buildgen/generate_projects.sh`. #define GRPC_OBJC_VERSION_STRING @"1.24.0-dev" -#define GRPC_C_VERSION_STRING @"7.0.0" +#define GRPC_C_VERSION_STRING @"8.0.0" diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index 2836412b031..f4533f240bd 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 7.0.0 +PROJECT_NUMBER = 8.0.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 5180fab8635..e9bd8e463ba 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 7.0.0 +PROJECT_NUMBER = 8.0.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From 422a7773aeb60e5847e1964089d842a1c93db6e2 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Fri, 9 Aug 2019 12:27:39 -0700 Subject: [PATCH 262/661] Replace making protoc and plugins with bazel build Fixed templates and plugin-tests --- .../!ProtoCompiler-gRPCCppPlugin.podspec | 12 +-- .../!ProtoCompiler-gRPCPlugin.podspec | 12 +-- src/objective-c/!ProtoCompiler.podspec | 17 +--- .../RemoteTestClient/RemoteTest.podspec | 6 +- .../tests/RemoteTestClient/RemoteTest.podspec | 34 +++---- src/objective-c/tests/run_plugin_tests.sh | 12 ++- ...otoCompiler-gRPCCppPlugin.podspec.template | 12 +-- ...!ProtoCompiler-gRPCPlugin.podspec.template | 12 +-- .../RemoteTestClientCpp/RemoteTestCpp.podspec | 89 ++++++------------- 9 files changed, 58 insertions(+), 148 deletions(-) diff --git a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec index 56ca7ce6ae4..67faaeb2567 100644 --- a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec @@ -94,6 +94,7 @@ Pod::Spec.new do |s| } repo_root = '../..' + bazel = "#{repo_root}/tools/bazel" plugin = 'grpc_cpp_plugin' s.preserve_paths = plugin @@ -111,15 +112,6 @@ Pod::Spec.new do |s| # present in this pod's directory. We use that knowledge to check for the existence of the file # and, if absent, compile the plugin from the local sources. s.prepare_command = <<-CMD - if [ ! -f #{plugin} ]; then - cd #{repo_root} - # This will build the plugin and put it in #{repo_root}/bins/opt. - # - # TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and - # library binary) if found, which _we do not want_. Find a way for this to always use the - # sources in the repo. - make #{plugin} - cd - - fi + #{bazel} build //src/compiler:grpc_cpp_plugin CMD end diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 8509d465901..f65086b6df5 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -96,6 +96,7 @@ Pod::Spec.new do |s| } repo_root = '../..' + bazel = "#{repo_root}/tools/bazel" plugin = 'grpc_objective_c_plugin' s.preserve_paths = plugin @@ -115,15 +116,6 @@ Pod::Spec.new do |s| # present in this pod's directory. We use that knowledge to check for the existence of the file # and, if absent, compile the plugin from the local sources. s.prepare_command = <<-CMD - if [ ! -f #{plugin} ]; then - cd #{repo_root} - # This will build the plugin and put it in #{repo_root}/bins/opt. - # - # TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and - # library binary) if found, which _we do not want_. Find a way for this to always use the - # sources in the repo. - make #{plugin} - cd - - fi + #{bazel} build //src/compiler:grpc_objective_c_plugin CMD end diff --git a/src/objective-c/!ProtoCompiler.podspec b/src/objective-c/!ProtoCompiler.podspec index b75d93a58be..9d036ac0b5b 100644 --- a/src/objective-c/!ProtoCompiler.podspec +++ b/src/objective-c/!ProtoCompiler.podspec @@ -120,20 +120,9 @@ Pod::Spec.new do |s| # present in this pod's directory. We use that knowledge to check for the existence of the file # and, if absent, build it from the local sources. repo_root = '../..' - plugin = 'grpc_objective_c_plugin' + bazel = "#{repo_root}/tools/bazel" + s.prepare_command = <<-CMD - if [ ! -f bin/protoc ]; then - cd #{repo_root} - # This will build protoc from the Protobuf submodule of gRPC, and put it in - # #{repo_root}/bins/opt/protobuf. - # - # TODO(jcanizales): Make won't build protoc from sources if one's locally installed, which - # _we do not want_. Find a way for this to always build from source. - make #{plugin} - cd - - else - mv bin/protoc . - mv include/google . - fi + #{bazel} build @com_google_protobuf//:protoc CMD end diff --git a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec index e3dbf4fe7ef..ca45fd063bd 100644 --- a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec @@ -16,11 +16,11 @@ Pod::Spec.new do |s| s.dependency "!ProtoCompiler-gRPCPlugin" repo_root = '../../../..' - bin_dir = "#{repo_root}/bins/$CONFIG" + bazel_exec_root = "#{repo_root}/bazel-out/darwin-fastbuild/bin" - protoc = "#{bin_dir}/protobuf/protoc" + protoc = "#{bazel_exec_root}/external/com_google_protobuf/protoc" well_known_types_dir = "#{repo_root}/third_party/protobuf/src" - plugin = "#{bin_dir}/grpc_objective_c_plugin" + plugin = "#{bazel_exec_root}/src/compiler/grpc_objective_c_plugin" # Since we switched to importing full path, -I needs to be set to the directory # from which the imported file can be found, which is the grpc's root here diff --git a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec index d772163e117..4a35328f73f 100644 --- a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec @@ -16,34 +16,20 @@ Pod::Spec.new do |s| s.dependency "!ProtoCompiler-gRPCPlugin" repo_root = '../../../..' - config = ENV['CONFIG'] || 'opt' - bin_dir = "#{repo_root}/bins/#{config}" + bazel_exec_root = "#{repo_root}/bazel-out/darwin-fastbuild/bin" - protoc = "#{bin_dir}/protobuf/protoc" + protoc = "#{bazel_exec_root}/external/com_google_protobuf/protoc" well_known_types_dir = "#{repo_root}/third_party/protobuf/src" - plugin = "#{bin_dir}/grpc_objective_c_plugin" + plugin = "#{bazel_exec_root}/src/compiler/grpc_objective_c_plugin" s.prepare_command = <<-CMD - if [ -f #{protoc} ]; then - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --objc_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{well_known_types_dir} \ - #{repo_root}/src/objective-c/tests/RemoteTestClient/*.proto - else - # protoc was not found bin_dir, use installed version instead - (>&2 echo "\nWARNING: Using installed version of protoc. It might be incompatible with gRPC") - - protoc \ - --plugin=protoc-gen-grpc=#{plugin} \ - --objc_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{well_known_types_dir} \ - #{repo_root}/src/objective-c/tests/RemoteTestClient/*.proto - fi + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --objc_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{well_known_types_dir} \ + #{repo_root}/src/objective-c/tests/RemoteTestClient/*.proto CMD s.subspec "Messages" do |ms| diff --git a/src/objective-c/tests/run_plugin_tests.sh b/src/objective-c/tests/run_plugin_tests.sh index bcab3bb9cff..760103eb7cd 100755 --- a/src/objective-c/tests/run_plugin_tests.sh +++ b/src/objective-c/tests/run_plugin_tests.sh @@ -22,9 +22,15 @@ cd $(dirname $0) # Run the tests server. -BINDIR=../../../bins/$CONFIG -PROTOC=$BINDIR/protobuf/protoc -PLUGIN=$BINDIR/grpc_objective_c_plugin +ROOT_DIR=../../.. +BAZEL=$ROOT_DIR/tools/bazel +BAZEL_EXEC_ROOT=$ROOT_DIR/bazel-out/darwin-fastbuild/bin +PROTOC=$BAZEL_EXEC_ROOT/external/com_google_protobuf/protoc +PLUGIN=$BAZEL_EXEC_ROOT/src/compiler/grpc_objective_c_plugin + +[ -f $PROTOC ] && [ -f $PLUGIN ] || { + BAZEL build @com_google_protobuf//:protoc //src/compiler:grpc_objective_c_plugin +} rm -rf PluginTest/*pb* diff --git a/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template b/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template index 259a5c54f24..072a59657da 100644 --- a/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template +++ b/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template @@ -96,6 +96,7 @@ } repo_root = '../..' + bazel = "#{repo_root}/tools/bazel" plugin = 'grpc_cpp_plugin' s.preserve_paths = plugin @@ -113,15 +114,6 @@ # present in this pod's directory. We use that knowledge to check for the existence of the file # and, if absent, compile the plugin from the local sources. s.prepare_command = <<-CMD - if [ ! -f #{plugin} ]; then - cd #{repo_root} - # This will build the plugin and put it in #{repo_root}/bins/opt. - # - # TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and - # library binary) if found, which _we do not want_. Find a way for this to always use the - # sources in the repo. - make #{plugin} - cd - - fi + #{bazel} build //src/compiler:grpc_cpp_plugin CMD end diff --git a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template index f612bd56cff..6286e3369e2 100644 --- a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template +++ b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template @@ -98,6 +98,7 @@ } repo_root = '../..' + bazel = "#{repo_root}/tools/bazel" plugin = 'grpc_objective_c_plugin' s.preserve_paths = plugin @@ -117,15 +118,6 @@ # present in this pod's directory. We use that knowledge to check for the existence of the file # and, if absent, compile the plugin from the local sources. s.prepare_command = <<-CMD - if [ ! -f #{plugin} ]; then - cd #{repo_root} - # This will build the plugin and put it in #{repo_root}/bins/opt. - # - # TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and - # library binary) if found, which _we do not want_. Find a way for this to always use the - # sources in the repo. - make #{plugin} - cd - - fi + #{bazel} build //src/compiler:grpc_objective_c_plugin CMD end diff --git a/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec b/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec index 0d51fdab31e..a0f0e2e436a 100644 --- a/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec +++ b/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec @@ -15,78 +15,39 @@ Pod::Spec.new do |s| s.dependency "Protobuf-C++" s.dependency "gRPC-C++" s.source_files = "src/proto/grpc/testing/*.pb.{h,cc}" - s.header_mappings_dir = "RemoteTestCpp" + s.header_mappings_dir = "." s.requires_arc = false repo_root = '../../../..' - config = ENV['CONFIG'] || 'opt' - bin_dir = "#{repo_root}/bins/#{config}" + bazel_exec_root = "#{repo_root}/bazel-out/darwin-fastbuild/bin" - protoc = "#{bin_dir}/protobuf/protoc" + protoc = "#{bazel_exec_root}/external/com_google_protobuf/protoc" well_known_types_dir = "#{repo_root}/third_party/protobuf/src" - plugin = "#{bin_dir}/grpc_cpp_plugin" + plugin = "#{bazel_exec_root}/src/compiler/grpc_cpp_plugin" proto_dir = "#{repo_root}/src/proto/grpc/testing" s.prepare_command = <<-CMD - if [ -f #{protoc} ]; then - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{proto_dir} \ - -I #{well_known_types_dir} \ - #{proto_dir}/echo.proto - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{proto_dir} \ - -I #{well_known_types_dir} \ - #{proto_dir}/echo_messages.proto - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{proto_dir} \ - -I #{well_known_types_dir} \ - #{proto_dir}/simple_messages.proto - else - # protoc was not found bin_dir, use installed version instead - - if ! [ -x "$(command -v protoc)" ]; then - (>&2 echo "\nERROR: protoc not found") - exit 1 - fi - (>&2 echo "\nWARNING: Using installed version of protoc. It might be incompatible with gRPC") - - protoc \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{proto_dir} \ - -I #{well_known_types_dir} \ - #{proto_dir}/echo.proto - protoc \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{proto_dir} \ - -I #{well_known_types_dir} \ - #{proto_dir}/echo_messages.proto - protoc \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{proto_dir} \ - -I #{well_known_types_dir} \ - #{proto_dir}/simple_messages.proto - fi + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{well_known_types_dir} \ + #{proto_dir}/echo.proto + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{well_known_types_dir} \ + #{proto_dir}/echo_messages.proto + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{well_known_types_dir} \ + #{proto_dir}/simple_messages.proto CMD s.pod_target_xcconfig = { From 988ca514b9cd87c7010bfafe329b9495603e9b7b Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 29 Jul 2019 18:53:00 -0700 Subject: [PATCH 263/661] serialization to IBufferWriter attempt 1 --- .../Grpc.Core.Api/SerializationContext.cs | 18 +++++ .../Internal/DefaultSerializationContext.cs | 74 +++++++++++++++++-- .../Internal/NativeMethods.Generated.cs | 33 +++++++++ src/csharp/ext/grpc_csharp_ext.c | 61 +++++++++++++++ .../runtimes/grpc_csharp_ext_dummy_stubs.c | 12 +++ .../Grpc.Core/Internal/native_methods.include | 3 + 6 files changed, 196 insertions(+), 5 deletions(-) diff --git a/src/csharp/Grpc.Core.Api/SerializationContext.cs b/src/csharp/Grpc.Core.Api/SerializationContext.cs index 9aef2adbcd5..79107040411 100644 --- a/src/csharp/Grpc.Core.Api/SerializationContext.cs +++ b/src/csharp/Grpc.Core.Api/SerializationContext.cs @@ -17,6 +17,7 @@ #endregion using System; +using System.Buffers; namespace Grpc.Core { @@ -35,5 +36,22 @@ namespace Grpc.Core { throw new NotImplementedException(); } + + /// + /// Expose serializer as buffer writer + /// + public virtual IBufferWriter GetBufferWriter() + { + throw new NotImplementedException(); + } + + /// + /// Complete the payload written so far. + /// + public virtual void Complete() + { + throw new NotImplementedException(); + + } } } diff --git a/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs b/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs index cceb194879e..9098850a52e 100644 --- a/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs +++ b/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs @@ -17,6 +17,8 @@ #endregion using Grpc.Core.Utils; +using System; +using System.Buffers; using System.Threading; namespace Grpc.Core.Internal @@ -27,7 +29,8 @@ namespace Grpc.Core.Internal new ThreadLocal(() => new DefaultSerializationContext(), false); bool isComplete; - byte[] payload; + //byte[] payload; + NativeBufferWriter bufferWriter; public DefaultSerializationContext() { @@ -38,18 +41,48 @@ namespace Grpc.Core.Internal { GrpcPreconditions.CheckState(!isComplete); this.isComplete = true; - this.payload = payload; + + GetBufferWriter(); + var destSpan = bufferWriter.GetSpan(payload.Length); + payload.AsSpan().CopyTo(destSpan); + bufferWriter.Advance(payload.Length); + bufferWriter.Complete(); + //this.payload = payload; + } + + /// + /// Expose serializer as buffer writer + /// + public override IBufferWriter GetBufferWriter() + { + if (bufferWriter == null) + { + // TODO: avoid allocation.. + bufferWriter = new NativeBufferWriter(); + } + return bufferWriter; + } + + /// + /// Complete the payload written so far. + /// + public override void Complete() + { + GrpcPreconditions.CheckState(!isComplete); + bufferWriter.Complete(); + this.isComplete = true; } - internal byte[] GetPayload() + internal SliceBufferSafeHandle GetPayload() { - return this.payload; + return bufferWriter.GetSliceBuffer(); } public void Reset() { this.isComplete = false; - this.payload = null; + //this.payload = null; + this.bufferWriter = null; } public static DefaultSerializationContext GetInitializedThreadLocal() @@ -58,5 +91,36 @@ namespace Grpc.Core.Internal instance.Reset(); return instance; } + + private class NativeBufferWriter : IBufferWriter + { + private SliceBufferSafeHandle sliceBuffer = SliceBufferSafeHandle.Create(); + + public void Advance(int count) + { + sliceBuffer.Advance(count); + } + + public Memory GetMemory(int sizeHint = 0) + { + // TODO: implement + throw new NotImplementedException(); + } + + public Span GetSpan(int sizeHint = 0) + { + return sliceBuffer.GetSpan(sizeHint); + } + + public void Complete() + { + sliceBuffer.Complete(); + } + + public SliceBufferSafeHandle GetSliceBuffer() + { + return sliceBuffer; + } + } } } diff --git a/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs b/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs index ca3dfe97ce1..b23170376d4 100644 --- a/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs +++ b/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs @@ -122,6 +122,9 @@ namespace Grpc.Core.Internal public readonly Delegates.grpcsharp_auth_context_property_iterator_delegate grpcsharp_auth_context_property_iterator; public readonly Delegates.grpcsharp_auth_property_iterator_next_delegate grpcsharp_auth_property_iterator_next; public readonly Delegates.grpcsharp_auth_context_release_delegate grpcsharp_auth_context_release; + public readonly Delegates.grpcsharp_slice_buffer_create_delegate grpcsharp_slice_buffer_create; + public readonly Delegates.grpcsharp_slice_buffer_adjust_tail_space_delegate grpcsharp_slice_buffer_adjust_tail_space; + public readonly Delegates.grpcsharp_slice_buffer_destroy_delegate grpcsharp_slice_buffer_destroy; public readonly Delegates.gprsharp_now_delegate gprsharp_now; public readonly Delegates.gprsharp_inf_future_delegate gprsharp_inf_future; public readonly Delegates.gprsharp_inf_past_delegate gprsharp_inf_past; @@ -224,6 +227,9 @@ namespace Grpc.Core.Internal this.grpcsharp_auth_context_property_iterator = GetMethodDelegate(library); this.grpcsharp_auth_property_iterator_next = GetMethodDelegate(library); this.grpcsharp_auth_context_release = GetMethodDelegate(library); + this.grpcsharp_slice_buffer_create = GetMethodDelegate(library); + this.grpcsharp_slice_buffer_adjust_tail_space = GetMethodDelegate(library); + this.grpcsharp_slice_buffer_destroy = GetMethodDelegate(library); this.gprsharp_now = GetMethodDelegate(library); this.gprsharp_inf_future = GetMethodDelegate(library); this.gprsharp_inf_past = GetMethodDelegate(library); @@ -325,6 +331,9 @@ namespace Grpc.Core.Internal this.grpcsharp_auth_context_property_iterator = DllImportsFromStaticLib.grpcsharp_auth_context_property_iterator; this.grpcsharp_auth_property_iterator_next = DllImportsFromStaticLib.grpcsharp_auth_property_iterator_next; this.grpcsharp_auth_context_release = DllImportsFromStaticLib.grpcsharp_auth_context_release; + this.grpcsharp_slice_buffer_create = DllImportsFromStaticLib.grpcsharp_slice_buffer_create; + this.grpcsharp_slice_buffer_adjust_tail_space = DllImportsFromStaticLib.grpcsharp_slice_buffer_adjust_tail_space; + this.grpcsharp_slice_buffer_destroy = DllImportsFromStaticLib.grpcsharp_slice_buffer_destroy; this.gprsharp_now = DllImportsFromStaticLib.gprsharp_now; this.gprsharp_inf_future = DllImportsFromStaticLib.gprsharp_inf_future; this.gprsharp_inf_past = DllImportsFromStaticLib.gprsharp_inf_past; @@ -426,6 +435,9 @@ namespace Grpc.Core.Internal this.grpcsharp_auth_context_property_iterator = DllImportsFromSharedLib.grpcsharp_auth_context_property_iterator; this.grpcsharp_auth_property_iterator_next = DllImportsFromSharedLib.grpcsharp_auth_property_iterator_next; this.grpcsharp_auth_context_release = DllImportsFromSharedLib.grpcsharp_auth_context_release; + this.grpcsharp_slice_buffer_create = DllImportsFromSharedLib.grpcsharp_slice_buffer_create; + this.grpcsharp_slice_buffer_adjust_tail_space = DllImportsFromSharedLib.grpcsharp_slice_buffer_adjust_tail_space; + this.grpcsharp_slice_buffer_destroy = DllImportsFromSharedLib.grpcsharp_slice_buffer_destroy; this.gprsharp_now = DllImportsFromSharedLib.gprsharp_now; this.gprsharp_inf_future = DllImportsFromSharedLib.gprsharp_inf_future; this.gprsharp_inf_past = DllImportsFromSharedLib.gprsharp_inf_past; @@ -530,6 +542,9 @@ namespace Grpc.Core.Internal public delegate AuthContextSafeHandle.NativeAuthPropertyIterator grpcsharp_auth_context_property_iterator_delegate(AuthContextSafeHandle authContext); public delegate IntPtr grpcsharp_auth_property_iterator_next_delegate(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator); // returns const auth_property* public delegate void grpcsharp_auth_context_release_delegate(IntPtr authContext); + public delegate SliceBufferSafeHandle grpcsharp_slice_buffer_create_delegate(); + public delegate IntPtr grpcsharp_slice_buffer_adjust_tail_space_delegate(SliceBufferSafeHandle sliceBuffer, UIntPtr availableTailSpace, UIntPtr requestedTailSpace); + public delegate void grpcsharp_slice_buffer_destroy_delegate(IntPtr sliceBuffer); public delegate Timespec gprsharp_now_delegate(ClockType clockType); public delegate Timespec gprsharp_inf_future_delegate(ClockType clockType); public delegate Timespec gprsharp_inf_past_delegate(ClockType clockType); @@ -812,6 +827,15 @@ namespace Grpc.Core.Internal [DllImport(ImportName)] public static extern void grpcsharp_auth_context_release(IntPtr authContext); + [DllImport(ImportName)] + public static extern SliceBufferSafeHandle grpcsharp_slice_buffer_create(); + + [DllImport(ImportName)] + public static extern IntPtr grpcsharp_slice_buffer_adjust_tail_space(SliceBufferSafeHandle sliceBuffer, UIntPtr availableTailSpace, UIntPtr requestedTailSpace); + + [DllImport(ImportName)] + public static extern void grpcsharp_slice_buffer_destroy(IntPtr sliceBuffer); + [DllImport(ImportName)] public static extern Timespec gprsharp_now(ClockType clockType); @@ -1111,6 +1135,15 @@ namespace Grpc.Core.Internal [DllImport(ImportName)] public static extern void grpcsharp_auth_context_release(IntPtr authContext); + [DllImport(ImportName)] + public static extern SliceBufferSafeHandle grpcsharp_slice_buffer_create(); + + [DllImport(ImportName)] + public static extern IntPtr grpcsharp_slice_buffer_adjust_tail_space(SliceBufferSafeHandle sliceBuffer, UIntPtr availableTailSpace, UIntPtr requestedTailSpace); + + [DllImport(ImportName)] + public static extern void grpcsharp_slice_buffer_destroy(IntPtr sliceBuffer); + [DllImport(ImportName)] public static extern Timespec gprsharp_now(ClockType clockType); diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 02e219ead87..e271494c942 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -1182,6 +1182,67 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_redirect_log(grpcsharp_log_func func) { typedef void(GPR_CALLTYPE* test_callback_funcptr)(int32_t success); +/* Slice buffer functionality */ +GPR_EXPORT grpc_slice_buffer* GPR_CALLTYPE +grpcsharp_slice_buffer_create() { + grpc_slice_buffer* slice_buffer = (grpc_slice_buffer*)gpr_malloc(sizeof(grpc_slice_buffer)); + grpc_slice_buffer_init(slice_buffer); + return slice_buffer; +} + +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_slice_buffer_destroy(grpc_slice_buffer* buffer) { + grpc_slice_buffer_destroy(buffer); + gpr_free(buffer); +} + +GPR_EXPORT grpc_byte_buffer* GPR_CALLTYPE +grpcsharp_create_byte_buffer_from_stolen_slices(grpc_slice_buffer* slice_buffer) { + grpc_byte_buffer* bb = + (grpc_byte_buffer*)gpr_malloc(sizeof(grpc_byte_buffer)); + memset(bb, 0, sizeof(grpc_byte_buffer)); + bb->type = GRPC_BB_RAW; + bb->data.raw.compression = GRPC_COMPRESS_NONE; + bb->data.raw.slice_buffer = *slice_buffer; + // TODO: just use move slice_buffer... + + // we transferred the ownership of members from the slice buffer to the + // the internals of byte buffer, so we just overwrite the original slice buffer with + // default values. + grpc_slice_buffer_init(slice_buffer); // TODO: need to reset available_tail_space after this.. + return bb; +} + +GPR_EXPORT void* GPR_CALLTYPE +grpcsharp_slice_buffer_adjust_tail_space(grpc_slice_buffer* buffer, size_t available_tail_space, + size_t requested_tail_space) { + + // TODO: what if available_tail_space == requested_tail_space == 0 + + if (available_tail_space >= requested_tail_space) + { + // TODO: should this be allowed at all? + grpc_slice_buffer garbage; + grpc_slice_buffer_trim_end(buffer, available_tail_space - requested_tail_space, &garbage); + grpc_slice_buffer_reset_and_unref(&garbage); + } + else + { + if (available_tail_space > 0) + { + grpc_slice_buffer garbage; + grpc_slice_buffer_trim_end(buffer, available_tail_space, &garbage); + grpc_slice_buffer_reset_and_unref(&garbage); + } + + grpc_slice new_slice = grpc_slice_malloc(requested_tail_space); + grpc_slice_buffer_add(buffer, new_slice); + } + + grpc_slice* last_slice = &(buffer->slices[buffer->count - 1]); + return GRPC_SLICE_END_PTR(*last_slice) - requested_tail_space; +} + /* Version info */ GPR_EXPORT const char* GPR_CALLTYPE grpcsharp_version_string() { return grpc_version_string(); diff --git a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c index 8ff26e4ca4d..bc312bc6daf 100644 --- a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c +++ b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c @@ -374,6 +374,18 @@ void grpcsharp_auth_context_release() { fprintf(stderr, "Should never reach here"); abort(); } +void grpcsharp_slice_buffer_create() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_slice_buffer_adjust_tail_space() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_slice_buffer_destroy() { + fprintf(stderr, "Should never reach here"); + abort(); +} void gprsharp_now() { fprintf(stderr, "Should never reach here"); abort(); diff --git a/templates/src/csharp/Grpc.Core/Internal/native_methods.include b/templates/src/csharp/Grpc.Core/Internal/native_methods.include index ed7c93a7479..d8f94744723 100644 --- a/templates/src/csharp/Grpc.Core/Internal/native_methods.include +++ b/templates/src/csharp/Grpc.Core/Internal/native_methods.include @@ -88,6 +88,9 @@ native_method_signatures = [ 'AuthContextSafeHandle.NativeAuthPropertyIterator grpcsharp_auth_context_property_iterator(AuthContextSafeHandle authContext)', 'IntPtr grpcsharp_auth_property_iterator_next(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator) // returns const auth_property*', 'void grpcsharp_auth_context_release(IntPtr authContext)', + 'SliceBufferSafeHandle grpcsharp_slice_buffer_create()', + 'IntPtr grpcsharp_slice_buffer_adjust_tail_space(SliceBufferSafeHandle sliceBuffer, UIntPtr availableTailSpace, UIntPtr requestedTailSpace)', + 'void grpcsharp_slice_buffer_destroy(IntPtr sliceBuffer)', 'Timespec gprsharp_now(ClockType clockType)', 'Timespec gprsharp_inf_future(ClockType clockType)', 'Timespec gprsharp_inf_past(ClockType clockType)', From 36e46234f72f0de72602931a546b8f8495072ddd Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 29 Jul 2019 19:57:08 -0700 Subject: [PATCH 264/661] IBufferWriter: tests now passing with a hack --- .../Grpc.Core/Internal/AsyncCallBase.cs | 2 +- .../Internal/NativeMethods.Generated.cs | 22 +++++++++++++++++++ src/csharp/ext/grpc_csharp_ext.c | 17 ++++++++++++++ .../runtimes/grpc_csharp_ext_dummy_stubs.c | 8 +++++++ .../Grpc.Core/Internal/native_methods.include | 2 ++ 5 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs index ac1f9066516..23cb5ccffc7 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs @@ -220,7 +220,7 @@ namespace Grpc.Core.Internal { context = DefaultSerializationContext.GetInitializedThreadLocal(); serializer(msg, context); - return context.GetPayload(); + return context.GetPayload().GetPayload(); } finally { diff --git a/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs b/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs index b23170376d4..dcb0f84649c 100644 --- a/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs +++ b/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs @@ -124,6 +124,8 @@ namespace Grpc.Core.Internal public readonly Delegates.grpcsharp_auth_context_release_delegate grpcsharp_auth_context_release; public readonly Delegates.grpcsharp_slice_buffer_create_delegate grpcsharp_slice_buffer_create; public readonly Delegates.grpcsharp_slice_buffer_adjust_tail_space_delegate grpcsharp_slice_buffer_adjust_tail_space; + public readonly Delegates.grpcsharp_slice_buffer_slice_count_delegate grpcsharp_slice_buffer_slice_count; + public readonly Delegates.grpcsharp_slice_buffer_slice_peek_delegate grpcsharp_slice_buffer_slice_peek; public readonly Delegates.grpcsharp_slice_buffer_destroy_delegate grpcsharp_slice_buffer_destroy; public readonly Delegates.gprsharp_now_delegate gprsharp_now; public readonly Delegates.gprsharp_inf_future_delegate gprsharp_inf_future; @@ -229,6 +231,8 @@ namespace Grpc.Core.Internal this.grpcsharp_auth_context_release = GetMethodDelegate(library); this.grpcsharp_slice_buffer_create = GetMethodDelegate(library); this.grpcsharp_slice_buffer_adjust_tail_space = GetMethodDelegate(library); + this.grpcsharp_slice_buffer_slice_count = GetMethodDelegate(library); + this.grpcsharp_slice_buffer_slice_peek = GetMethodDelegate(library); this.grpcsharp_slice_buffer_destroy = GetMethodDelegate(library); this.gprsharp_now = GetMethodDelegate(library); this.gprsharp_inf_future = GetMethodDelegate(library); @@ -333,6 +337,8 @@ namespace Grpc.Core.Internal this.grpcsharp_auth_context_release = DllImportsFromStaticLib.grpcsharp_auth_context_release; this.grpcsharp_slice_buffer_create = DllImportsFromStaticLib.grpcsharp_slice_buffer_create; this.grpcsharp_slice_buffer_adjust_tail_space = DllImportsFromStaticLib.grpcsharp_slice_buffer_adjust_tail_space; + this.grpcsharp_slice_buffer_slice_count = DllImportsFromStaticLib.grpcsharp_slice_buffer_slice_count; + this.grpcsharp_slice_buffer_slice_peek = DllImportsFromStaticLib.grpcsharp_slice_buffer_slice_peek; this.grpcsharp_slice_buffer_destroy = DllImportsFromStaticLib.grpcsharp_slice_buffer_destroy; this.gprsharp_now = DllImportsFromStaticLib.gprsharp_now; this.gprsharp_inf_future = DllImportsFromStaticLib.gprsharp_inf_future; @@ -437,6 +443,8 @@ namespace Grpc.Core.Internal this.grpcsharp_auth_context_release = DllImportsFromSharedLib.grpcsharp_auth_context_release; this.grpcsharp_slice_buffer_create = DllImportsFromSharedLib.grpcsharp_slice_buffer_create; this.grpcsharp_slice_buffer_adjust_tail_space = DllImportsFromSharedLib.grpcsharp_slice_buffer_adjust_tail_space; + this.grpcsharp_slice_buffer_slice_count = DllImportsFromSharedLib.grpcsharp_slice_buffer_slice_count; + this.grpcsharp_slice_buffer_slice_peek = DllImportsFromSharedLib.grpcsharp_slice_buffer_slice_peek; this.grpcsharp_slice_buffer_destroy = DllImportsFromSharedLib.grpcsharp_slice_buffer_destroy; this.gprsharp_now = DllImportsFromSharedLib.gprsharp_now; this.gprsharp_inf_future = DllImportsFromSharedLib.gprsharp_inf_future; @@ -544,6 +552,8 @@ namespace Grpc.Core.Internal public delegate void grpcsharp_auth_context_release_delegate(IntPtr authContext); public delegate SliceBufferSafeHandle grpcsharp_slice_buffer_create_delegate(); public delegate IntPtr grpcsharp_slice_buffer_adjust_tail_space_delegate(SliceBufferSafeHandle sliceBuffer, UIntPtr availableTailSpace, UIntPtr requestedTailSpace); + public delegate UIntPtr grpcsharp_slice_buffer_slice_count_delegate(SliceBufferSafeHandle sliceBuffer); + public delegate void grpcsharp_slice_buffer_slice_peek_delegate(SliceBufferSafeHandle sliceBuffer, UIntPtr index, out UIntPtr sliceLen, out IntPtr sliceDataPtr); public delegate void grpcsharp_slice_buffer_destroy_delegate(IntPtr sliceBuffer); public delegate Timespec gprsharp_now_delegate(ClockType clockType); public delegate Timespec gprsharp_inf_future_delegate(ClockType clockType); @@ -833,6 +843,12 @@ namespace Grpc.Core.Internal [DllImport(ImportName)] public static extern IntPtr grpcsharp_slice_buffer_adjust_tail_space(SliceBufferSafeHandle sliceBuffer, UIntPtr availableTailSpace, UIntPtr requestedTailSpace); + [DllImport(ImportName)] + public static extern UIntPtr grpcsharp_slice_buffer_slice_count(SliceBufferSafeHandle sliceBuffer); + + [DllImport(ImportName)] + public static extern void grpcsharp_slice_buffer_slice_peek(SliceBufferSafeHandle sliceBuffer, UIntPtr index, out UIntPtr sliceLen, out IntPtr sliceDataPtr); + [DllImport(ImportName)] public static extern void grpcsharp_slice_buffer_destroy(IntPtr sliceBuffer); @@ -1141,6 +1157,12 @@ namespace Grpc.Core.Internal [DllImport(ImportName)] public static extern IntPtr grpcsharp_slice_buffer_adjust_tail_space(SliceBufferSafeHandle sliceBuffer, UIntPtr availableTailSpace, UIntPtr requestedTailSpace); + [DllImport(ImportName)] + public static extern UIntPtr grpcsharp_slice_buffer_slice_count(SliceBufferSafeHandle sliceBuffer); + + [DllImport(ImportName)] + public static extern void grpcsharp_slice_buffer_slice_peek(SliceBufferSafeHandle sliceBuffer, UIntPtr index, out UIntPtr sliceLen, out IntPtr sliceDataPtr); + [DllImport(ImportName)] public static extern void grpcsharp_slice_buffer_destroy(IntPtr sliceBuffer); diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index e271494c942..1f115b1caf2 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -1196,6 +1196,19 @@ grpcsharp_slice_buffer_destroy(grpc_slice_buffer* buffer) { gpr_free(buffer); } +GPR_EXPORT size_t GPR_CALLTYPE +grpcsharp_slice_buffer_slice_count(grpc_slice_buffer* buffer) { + return buffer->count; +} + +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_slice_buffer_slice_peek(grpc_slice_buffer* buffer, size_t index, size_t* slice_len, uint8_t** slice_data_ptr) { + GPR_ASSERT(buffer->count > index); + grpc_slice* slice_ptr = &buffer->slices[index]; + *slice_len = GRPC_SLICE_LENGTH(*slice_ptr); + *slice_data_ptr = GRPC_SLICE_START_PTR(*slice_ptr); +} + GPR_EXPORT grpc_byte_buffer* GPR_CALLTYPE grpcsharp_create_byte_buffer_from_stolen_slices(grpc_slice_buffer* slice_buffer) { grpc_byte_buffer* bb = @@ -1217,6 +1230,10 @@ GPR_EXPORT void* GPR_CALLTYPE grpcsharp_slice_buffer_adjust_tail_space(grpc_slice_buffer* buffer, size_t available_tail_space, size_t requested_tail_space) { + if (available_tail_space == 0 && requested_tail_space == 0) + { + return NULL; + } // TODO: what if available_tail_space == requested_tail_space == 0 if (available_tail_space >= requested_tail_space) diff --git a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c index bc312bc6daf..9007d7f3ad0 100644 --- a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c +++ b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c @@ -382,6 +382,14 @@ void grpcsharp_slice_buffer_adjust_tail_space() { fprintf(stderr, "Should never reach here"); abort(); } +void grpcsharp_slice_buffer_slice_count() { + fprintf(stderr, "Should never reach here"); + abort(); +} +void grpcsharp_slice_buffer_slice_peek() { + fprintf(stderr, "Should never reach here"); + abort(); +} void grpcsharp_slice_buffer_destroy() { fprintf(stderr, "Should never reach here"); abort(); diff --git a/templates/src/csharp/Grpc.Core/Internal/native_methods.include b/templates/src/csharp/Grpc.Core/Internal/native_methods.include index d8f94744723..055af4a7a27 100644 --- a/templates/src/csharp/Grpc.Core/Internal/native_methods.include +++ b/templates/src/csharp/Grpc.Core/Internal/native_methods.include @@ -90,6 +90,8 @@ native_method_signatures = [ 'void grpcsharp_auth_context_release(IntPtr authContext)', 'SliceBufferSafeHandle grpcsharp_slice_buffer_create()', 'IntPtr grpcsharp_slice_buffer_adjust_tail_space(SliceBufferSafeHandle sliceBuffer, UIntPtr availableTailSpace, UIntPtr requestedTailSpace)', + 'UIntPtr grpcsharp_slice_buffer_slice_count(SliceBufferSafeHandle sliceBuffer)', + 'void grpcsharp_slice_buffer_slice_peek(SliceBufferSafeHandle sliceBuffer, UIntPtr index, out UIntPtr sliceLen, out IntPtr sliceDataPtr)', 'void grpcsharp_slice_buffer_destroy(IntPtr sliceBuffer)', 'Timespec gprsharp_now(ClockType clockType)', 'Timespec gprsharp_inf_future(ClockType clockType)', From 1154c2d17ea07d0b95dd6f4ac8776c4f3841570e Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 29 Jul 2019 19:58:36 -0700 Subject: [PATCH 265/661] fixup: add SliceBufferSafeHandle --- .../Internal/SliceBufferSafeHandle.cs | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs diff --git a/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs new file mode 100644 index 00000000000..ef9e7fbce37 --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs @@ -0,0 +1,122 @@ +#region Copyright notice and license + +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Runtime.InteropServices; +using Grpc.Core; +using Grpc.Core.Logging; +using Grpc.Core.Utils; + +namespace Grpc.Core.Internal +{ + /// + /// grpc_slice_buffer + /// + internal class SliceBufferSafeHandle : SafeHandleZeroIsInvalid + { + static readonly NativeMethods Native = NativeMethods.Get(); + static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); + + private IntPtr tailSpacePtr; + private UIntPtr tailSpaceLen; + + + private SliceBufferSafeHandle() + { + } + + public static SliceBufferSafeHandle Create() + { + return Native.grpcsharp_slice_buffer_create(); + } + + public IntPtr Handle + { + get + { + return handle; + } + } + + public void Advance(int count) + { + GrpcPreconditions.CheckArgument(count >= 0); + GrpcPreconditions.CheckArgument(tailSpacePtr != IntPtr.Zero || count == 0); + GrpcPreconditions.CheckArgument(tailSpaceLen.ToUInt64() >= (ulong)count); + tailSpaceLen = new UIntPtr(tailSpaceLen.ToUInt64() - (ulong)count); + tailSpacePtr += count; + } + + public unsafe Span GetSpan(int sizeHint) + { + GrpcPreconditions.CheckArgument(sizeHint >= 0); + if (tailSpaceLen.ToUInt64() < (ulong) sizeHint) + { + // TODO: should we ignore the hint sometimes when + // available tail space is close enough to the sizeHint? + AdjustTailSpace(sizeHint); + } + return new Span(tailSpacePtr.ToPointer(), (int) tailSpaceLen.ToUInt64()); + } + + public void Complete() + { + AdjustTailSpace(0); + } + + public byte[] GetPayload() + { + ulong sliceCount = Native.grpcsharp_slice_buffer_slice_count(this).ToUInt64(); + + Slice[] slices = new Slice[sliceCount]; + int totalLen = 0; + for (int i = 0; i < (int) sliceCount; i++) + { + Native.grpcsharp_slice_buffer_slice_peek(this, new UIntPtr((ulong) i), out UIntPtr sliceLen, out IntPtr dataPtr); + slices[i] = new Slice(dataPtr, (int) sliceLen.ToUInt64()); + totalLen += (int) sliceLen.ToUInt64(); + + } + var result = new byte[totalLen]; + int offset = 0; + for (int i = 0; i < (int) sliceCount; i++) + { + slices[i].ToSpanUnsafe().CopyTo(result.AsSpan(offset, slices[i].Length)); + offset += slices[i].Length; + } + GrpcPreconditions.CheckState(totalLen == offset); + return result; + } + // TODO: converting contents to byte[] + + // Gets data of server_rpc_new completion. + private void AdjustTailSpace(int requestedSize) + { + GrpcPreconditions.CheckArgument(requestedSize >= 0); + var requestedTailSpaceLen = new UIntPtr((ulong) requestedSize); + tailSpacePtr = Native.grpcsharp_slice_buffer_adjust_tail_space(this, tailSpaceLen, requestedTailSpaceLen); + tailSpaceLen = requestedTailSpaceLen; + } + + protected override bool ReleaseHandle() + { + Native.grpcsharp_slice_buffer_destroy(handle); + return true; + } + } +} From b9183153211d109ba57598812ee8d90a12236443 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 30 Jul 2019 16:16:56 -0700 Subject: [PATCH 266/661] a bit of refactor --- src/csharp/Grpc.Core/Internal/AsyncCallBase.cs | 2 +- src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs index 23cb5ccffc7..b26b7921955 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs @@ -220,7 +220,7 @@ namespace Grpc.Core.Internal { context = DefaultSerializationContext.GetInitializedThreadLocal(); serializer(msg, context); - return context.GetPayload().GetPayload(); + return context.GetPayload().ToByteArray(); } finally { diff --git a/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs index ef9e7fbce37..5b540c69d44 100644 --- a/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs @@ -79,7 +79,9 @@ namespace Grpc.Core.Internal AdjustTailSpace(0); } - public byte[] GetPayload() + // copies the content of the slice buffer to a newly allocated byte array + // due to its overhead, this method should only be used for testing. + public byte[] ToByteArray() { ulong sliceCount = Native.grpcsharp_slice_buffer_slice_count(this).ToUInt64(); @@ -102,7 +104,6 @@ namespace Grpc.Core.Internal GrpcPreconditions.CheckState(totalLen == offset); return result; } - // TODO: converting contents to byte[] // Gets data of server_rpc_new completion. private void AdjustTailSpace(int requestedSize) @@ -112,7 +113,6 @@ namespace Grpc.Core.Internal tailSpacePtr = Native.grpcsharp_slice_buffer_adjust_tail_space(this, tailSpaceLen, requestedTailSpaceLen); tailSpaceLen = requestedTailSpaceLen; } - protected override bool ReleaseHandle() { Native.grpcsharp_slice_buffer_destroy(handle); From 31eff3e679f12f3db28c80527f7f376c1beb8efd Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 30 Jul 2019 17:16:49 -0700 Subject: [PATCH 267/661] stuff builds but tests crash --- .../Internal/FakeNativeCall.cs | 10 +-- src/csharp/Grpc.Core/Internal/AsyncCall.cs | 6 +- .../Grpc.Core/Internal/AsyncCallBase.cs | 6 +- .../Grpc.Core/Internal/AsyncCallServer.cs | 2 +- .../Grpc.Core/Internal/CallSafeHandle.cs | 26 +++---- src/csharp/Grpc.Core/Internal/INativeCall.cs | 10 +-- .../Internal/NativeMethods.Generated.cs | 30 ++++----- .../SendMessageBenchmark.cs | 5 +- .../UnaryCallOverheadBenchmark.cs | 4 +- src/csharp/Grpc.Microbenchmarks/Utf8Encode.cs | 2 +- src/csharp/ext/grpc_csharp_ext.c | 67 ++++++++++--------- .../Grpc.Core/Internal/native_methods.include | 10 +-- 12 files changed, 91 insertions(+), 87 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/Internal/FakeNativeCall.cs b/src/csharp/Grpc.Core.Tests/Internal/FakeNativeCall.cs index ef67918dabb..c16b55ca941 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/FakeNativeCall.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/FakeNativeCall.cs @@ -101,13 +101,13 @@ namespace Grpc.Core.Internal.Tests return "PEER"; } - public void StartUnary(IUnaryResponseClientCallback callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags) + public void StartUnary(IUnaryResponseClientCallback callback, SliceBufferSafeHandle payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags) { StartCallMaybeFail(); UnaryResponseClientCallback = callback; } - public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags) + public void StartUnary(BatchContextSafeHandle ctx, SliceBufferSafeHandle payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags) { StartCallMaybeFail(); throw new NotImplementedException(); @@ -119,7 +119,7 @@ namespace Grpc.Core.Internal.Tests UnaryResponseClientCallback = callback; } - public void StartServerStreaming(IReceivedStatusOnClientCallback callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags) + public void StartServerStreaming(IReceivedStatusOnClientCallback callback, SliceBufferSafeHandle payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags) { StartCallMaybeFail(); ReceivedStatusOnClientCallback = callback; @@ -146,7 +146,7 @@ namespace Grpc.Core.Internal.Tests SendCompletionCallback = callback; } - public void StartSendMessage(ISendCompletionCallback callback, byte[] payload, WriteFlags writeFlags, bool sendEmptyInitialMetadata) + public void StartSendMessage(ISendCompletionCallback callback, SliceBufferSafeHandle payload, WriteFlags writeFlags, bool sendEmptyInitialMetadata) { SendCompletionCallback = callback; } @@ -157,7 +157,7 @@ namespace Grpc.Core.Internal.Tests } public void StartSendStatusFromServer(ISendStatusFromServerCompletionCallback callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata, - byte[] optionalPayload, WriteFlags writeFlags) + SliceBufferSafeHandle payload, WriteFlags writeFlags) { SendStatusFromServerCallback = callback; } diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs index ce3508d398e..aefa58a0cee 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs @@ -95,7 +95,7 @@ namespace Grpc.Core.Internal readingDone = true; } - byte[] payload = UnsafeSerialize(msg); + var payload = UnsafeSerialize(msg); using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers)) { @@ -160,7 +160,7 @@ namespace Grpc.Core.Internal halfcloseRequested = true; readingDone = true; - byte[] payload = UnsafeSerialize(msg); + var payload = UnsafeSerialize(msg); unaryResponseTcs = new TaskCompletionSource(); using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers)) @@ -235,7 +235,7 @@ namespace Grpc.Core.Internal halfcloseRequested = true; - byte[] payload = UnsafeSerialize(msg); + var payload = UnsafeSerialize(msg); streamingResponseCallFinishedTcs = new TaskCompletionSource(); using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers)) diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs index b26b7921955..07f9ecf23e9 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs @@ -115,7 +115,7 @@ namespace Grpc.Core.Internal /// protected Task SendMessageInternalAsync(TWrite msg, WriteFlags writeFlags) { - byte[] payload = UnsafeSerialize(msg); + var payload = UnsafeSerialize(msg); lock (myLock) { @@ -213,14 +213,14 @@ namespace Grpc.Core.Internal /// protected abstract Task CheckSendAllowedOrEarlyResult(); - protected byte[] UnsafeSerialize(TWrite msg) + protected SliceBufferSafeHandle UnsafeSerialize(TWrite msg) { DefaultSerializationContext context = null; try { context = DefaultSerializationContext.GetInitializedThreadLocal(); serializer(msg, context); - return context.GetPayload().ToByteArray(); + return context.GetPayload(); } finally { diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs index 0bf1fb3b7dd..e1c3a215422 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs @@ -129,7 +129,7 @@ namespace Grpc.Core.Internal /// public Task SendStatusFromServerAsync(Status status, Metadata trailers, ResponseWithFlags? optionalWrite) { - byte[] payload = optionalWrite.HasValue ? UnsafeSerialize(optionalWrite.Value.Response) : null; + var payload = optionalWrite.HasValue ? UnsafeSerialize(optionalWrite.Value.Response) : null; var writeFlags = optionalWrite.HasValue ? optionalWrite.Value.WriteFlags : default(WriteFlags); lock (myLock) diff --git a/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs b/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs index 2e637c9704b..6208f45a00a 100644 --- a/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs @@ -67,19 +67,19 @@ namespace Grpc.Core.Internal Native.grpcsharp_call_set_credentials(this, credentials).CheckOk(); } - public void StartUnary(IUnaryResponseClientCallback callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags) + public void StartUnary(IUnaryResponseClientCallback callback, SliceBufferSafeHandle payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags) { using (completionQueue.NewScope()) { var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_IUnaryResponseClientCallback, callback); - Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, metadataArray, callFlags) + Native.grpcsharp_call_start_unary(this, ctx, payload, writeFlags, metadataArray, callFlags) .CheckOk(); } } - public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags) + public void StartUnary(BatchContextSafeHandle ctx, SliceBufferSafeHandle payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags) { - Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, metadataArray, callFlags) + Native.grpcsharp_call_start_unary(this, ctx, payload, writeFlags, metadataArray, callFlags) .CheckOk(); } @@ -92,12 +92,12 @@ namespace Grpc.Core.Internal } } - public void StartServerStreaming(IReceivedStatusOnClientCallback callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags) + public void StartServerStreaming(IReceivedStatusOnClientCallback callback, SliceBufferSafeHandle payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags) { using (completionQueue.NewScope()) { var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_IReceivedStatusOnClientCallback, callback); - Native.grpcsharp_call_start_server_streaming(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, metadataArray, callFlags).CheckOk(); + Native.grpcsharp_call_start_server_streaming(this, ctx, payload, writeFlags, metadataArray, callFlags).CheckOk(); } } @@ -110,12 +110,12 @@ namespace Grpc.Core.Internal } } - public void StartSendMessage(ISendCompletionCallback callback, byte[] payload, WriteFlags writeFlags, bool sendEmptyInitialMetadata) + public void StartSendMessage(ISendCompletionCallback callback, SliceBufferSafeHandle payload, WriteFlags writeFlags, bool sendEmptyInitialMetadata) { using (completionQueue.NewScope()) { var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_ISendCompletionCallback, callback); - Native.grpcsharp_call_send_message(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, sendEmptyInitialMetadata ? 1 : 0).CheckOk(); + Native.grpcsharp_call_send_message(this, ctx, payload, writeFlags, sendEmptyInitialMetadata ? 1 : 0).CheckOk(); } } @@ -129,13 +129,13 @@ namespace Grpc.Core.Internal } public void StartSendStatusFromServer(ISendStatusFromServerCompletionCallback callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata, - byte[] optionalPayload, WriteFlags writeFlags) + SliceBufferSafeHandle optionalPayload, WriteFlags writeFlags) { + // TODO: optionalPayload == null -> pass null SliceBufferSafeHandle using (completionQueue.NewScope()) { var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_ISendStatusFromServerCompletionCallback, callback); - var optionalPayloadLength = optionalPayload != null ? new UIntPtr((ulong)optionalPayload.Length) : UIntPtr.Zero; - + const int MaxStackAllocBytes = 256; int maxBytes = MarshalUtils.GetMaxByteCountUTF8(status.Detail); if (maxBytes > MaxStackAllocBytes) @@ -156,7 +156,7 @@ namespace Grpc.Core.Internal byte* ptr = stackalloc byte[maxBytes]; int statusBytes = MarshalUtils.GetBytesUTF8(status.Detail, ptr, maxBytes); Native.grpcsharp_call_send_status_from_server(this, ctx, status.StatusCode, new IntPtr(ptr), new UIntPtr((ulong)statusBytes), metadataArray, sendEmptyInitialMetadata ? 1 : 0, - optionalPayload, optionalPayloadLength, writeFlags).CheckOk(); + optionalPayload, writeFlags).CheckOk(); } else { // for larger status (rare), rent a buffer from the pool and @@ -168,7 +168,7 @@ namespace Grpc.Core.Internal { int statusBytes = MarshalUtils.GetBytesUTF8(status.Detail, ptr, maxBytes); Native.grpcsharp_call_send_status_from_server(this, ctx, status.StatusCode, new IntPtr(ptr), new UIntPtr((ulong)statusBytes), metadataArray, sendEmptyInitialMetadata ? 1 : 0, - optionalPayload, optionalPayloadLength, writeFlags).CheckOk(); + optionalPayload, writeFlags).CheckOk(); } } finally diff --git a/src/csharp/Grpc.Core/Internal/INativeCall.cs b/src/csharp/Grpc.Core/Internal/INativeCall.cs index 98117c6988a..70e98bfc9af 100644 --- a/src/csharp/Grpc.Core/Internal/INativeCall.cs +++ b/src/csharp/Grpc.Core/Internal/INativeCall.cs @@ -67,13 +67,13 @@ namespace Grpc.Core.Internal string GetPeer(); - void StartUnary(IUnaryResponseClientCallback callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags); + void StartUnary(IUnaryResponseClientCallback callback, SliceBufferSafeHandle payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags); - void StartUnary(BatchContextSafeHandle ctx, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags); + void StartUnary(BatchContextSafeHandle ctx, SliceBufferSafeHandle payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags); void StartClientStreaming(IUnaryResponseClientCallback callback, MetadataArraySafeHandle metadataArray, CallFlags callFlags); - void StartServerStreaming(IReceivedStatusOnClientCallback callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags); + void StartServerStreaming(IReceivedStatusOnClientCallback callback, SliceBufferSafeHandle payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags); void StartDuplexStreaming(IReceivedStatusOnClientCallback callback, MetadataArraySafeHandle metadataArray, CallFlags callFlags); @@ -83,11 +83,11 @@ namespace Grpc.Core.Internal void StartSendInitialMetadata(ISendCompletionCallback callback, MetadataArraySafeHandle metadataArray); - void StartSendMessage(ISendCompletionCallback callback, byte[] payload, WriteFlags writeFlags, bool sendEmptyInitialMetadata); + void StartSendMessage(ISendCompletionCallback callback, SliceBufferSafeHandle payload, WriteFlags writeFlags, bool sendEmptyInitialMetadata); void StartSendCloseFromClient(ISendCompletionCallback callback); - void StartSendStatusFromServer(ISendStatusFromServerCompletionCallback callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata, byte[] optionalPayload, WriteFlags writeFlags); + void StartSendStatusFromServer(ISendStatusFromServerCompletionCallback callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata, SliceBufferSafeHandle optionalPayload, WriteFlags writeFlags); void StartServerSide(IReceivedCloseOnServerCallback callback); } diff --git a/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs b/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs index dcb0f84649c..d492d0c9525 100644 --- a/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs +++ b/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs @@ -487,13 +487,13 @@ namespace Grpc.Core.Internal public delegate void grpcsharp_call_credentials_release_delegate(IntPtr credentials); public delegate CallError grpcsharp_call_cancel_delegate(CallSafeHandle call); public delegate CallError grpcsharp_call_cancel_with_status_delegate(CallSafeHandle call, StatusCode status, string description); - public delegate CallError grpcsharp_call_start_unary_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); + public delegate CallError grpcsharp_call_start_unary_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); public delegate CallError grpcsharp_call_start_client_streaming_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); - public delegate CallError grpcsharp_call_start_server_streaming_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); + public delegate CallError grpcsharp_call_start_server_streaming_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); public delegate CallError grpcsharp_call_start_duplex_streaming_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); - public delegate CallError grpcsharp_call_send_message_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata); + public delegate CallError grpcsharp_call_send_message_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, int sendEmptyInitialMetadata); public delegate CallError grpcsharp_call_send_close_from_client_delegate(CallSafeHandle call, BatchContextSafeHandle ctx); - public delegate CallError grpcsharp_call_send_status_from_server_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, IntPtr statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags); + public delegate CallError grpcsharp_call_send_status_from_server_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, IntPtr statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, SliceBufferSafeHandle optionalSendBuffer, WriteFlags writeFlags); public delegate CallError grpcsharp_call_recv_message_delegate(CallSafeHandle call, BatchContextSafeHandle ctx); public delegate CallError grpcsharp_call_recv_initial_metadata_delegate(CallSafeHandle call, BatchContextSafeHandle ctx); public delegate CallError grpcsharp_call_start_serverside_delegate(CallSafeHandle call, BatchContextSafeHandle ctx); @@ -563,7 +563,7 @@ namespace Grpc.Core.Internal public delegate CallError grpcsharp_test_callback_delegate([MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackTestDelegate callback); public delegate IntPtr grpcsharp_test_nop_delegate(IntPtr ptr); public delegate void grpcsharp_test_override_method_delegate(string methodName, string variant); - public delegate CallError grpcsharp_test_call_start_unary_echo_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); + public delegate CallError grpcsharp_test_call_start_unary_echo_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); } /// @@ -649,25 +649,25 @@ namespace Grpc.Core.Internal public static extern CallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description); [DllImport(ImportName)] - public static extern CallError grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); + public static extern CallError grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); [DllImport(ImportName)] public static extern CallError grpcsharp_call_start_client_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); [DllImport(ImportName)] - public static extern CallError grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); + public static extern CallError grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); [DllImport(ImportName)] public static extern CallError grpcsharp_call_start_duplex_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); [DllImport(ImportName)] - public static extern CallError grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata); + public static extern CallError grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, int sendEmptyInitialMetadata); [DllImport(ImportName)] public static extern CallError grpcsharp_call_send_close_from_client(CallSafeHandle call, BatchContextSafeHandle ctx); [DllImport(ImportName)] - public static extern CallError grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, IntPtr statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags); + public static extern CallError grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, IntPtr statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, SliceBufferSafeHandle optionalSendBuffer, WriteFlags writeFlags); [DllImport(ImportName)] public static extern CallError grpcsharp_call_recv_message(CallSafeHandle call, BatchContextSafeHandle ctx); @@ -877,7 +877,7 @@ namespace Grpc.Core.Internal public static extern void grpcsharp_test_override_method(string methodName, string variant); [DllImport(ImportName)] - public static extern CallError grpcsharp_test_call_start_unary_echo(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); + public static extern CallError grpcsharp_test_call_start_unary_echo(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); } /// @@ -963,25 +963,25 @@ namespace Grpc.Core.Internal public static extern CallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description); [DllImport(ImportName)] - public static extern CallError grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); + public static extern CallError grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); [DllImport(ImportName)] public static extern CallError grpcsharp_call_start_client_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); [DllImport(ImportName)] - public static extern CallError grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); + public static extern CallError grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); [DllImport(ImportName)] public static extern CallError grpcsharp_call_start_duplex_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); [DllImport(ImportName)] - public static extern CallError grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata); + public static extern CallError grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, int sendEmptyInitialMetadata); [DllImport(ImportName)] public static extern CallError grpcsharp_call_send_close_from_client(CallSafeHandle call, BatchContextSafeHandle ctx); [DllImport(ImportName)] - public static extern CallError grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, IntPtr statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags); + public static extern CallError grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, IntPtr statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, SliceBufferSafeHandle optionalSendBuffer, WriteFlags writeFlags); [DllImport(ImportName)] public static extern CallError grpcsharp_call_recv_message(CallSafeHandle call, BatchContextSafeHandle ctx); @@ -1191,7 +1191,7 @@ namespace Grpc.Core.Internal public static extern void grpcsharp_test_override_method(string methodName, string variant); [DllImport(ImportName)] - public static extern CallError grpcsharp_test_call_start_unary_echo(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); + public static extern CallError grpcsharp_test_call_start_unary_echo(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags); } } } diff --git a/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs index 8496813efb0..76c59ca579c 100644 --- a/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs +++ b/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs @@ -50,11 +50,14 @@ namespace Grpc.Microbenchmarks var call = CreateFakeCall(cq); var sendCompletionCallback = new NopSendCompletionCallback(); - var payload = new byte[PayloadSize]; + var payload = SliceBufferSafeHandle.Create(); + payload.GetSpan(PayloadSize); + payload.Advance(PayloadSize); var writeFlags = default(WriteFlags); for (int i = 0; i < Iterations; i++) { + // TODO: sending for the first time actually steals the slices... call.StartSendMessage(sendCompletionCallback, payload, writeFlags, false); var callback = completionRegistry.Extract(completionRegistry.LastRegisteredKey); callback.OnComplete(true); diff --git a/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs index 8448f03dd62..177a49d9223 100644 --- a/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs +++ b/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs @@ -70,8 +70,8 @@ namespace Grpc.Microbenchmarks var native = NativeMethods.Get(); // replace the implementation of a native method with a fake - NativeMethods.Delegates.grpcsharp_call_start_unary_delegate fakeCallStartUnary = (CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags) => { - return native.grpcsharp_test_call_start_unary_echo(call, ctx, sendBuffer, sendBufferLen, writeFlags, metadataArray, metadataFlags); + NativeMethods.Delegates.grpcsharp_call_start_unary_delegate fakeCallStartUnary = (CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags) => { + return native.grpcsharp_test_call_start_unary_echo(call, ctx, sendBuffer, writeFlags, metadataArray, metadataFlags); }; native.GetType().GetField(nameof(native.grpcsharp_call_start_unary)).SetValue(native, fakeCallStartUnary); diff --git a/src/csharp/Grpc.Microbenchmarks/Utf8Encode.cs b/src/csharp/Grpc.Microbenchmarks/Utf8Encode.cs index a59afa19118..e5bac1967c9 100644 --- a/src/csharp/Grpc.Microbenchmarks/Utf8Encode.cs +++ b/src/csharp/Grpc.Microbenchmarks/Utf8Encode.cs @@ -61,7 +61,7 @@ namespace Grpc.Microbenchmarks var native = NativeMethods.Get(); // nop the native-call via reflection - NativeMethods.Delegates.grpcsharp_call_send_status_from_server_delegate nop = (CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, IntPtr statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags) => { + NativeMethods.Delegates.grpcsharp_call_send_status_from_server_delegate nop = (CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, IntPtr statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, SliceBufferSafeHandle optionalSendBuffer, WriteFlags writeFlags) => { completionRegistry.Extract(ctx.Handle).OnComplete(true); // drain the dictionary as we go return CallError.OK; }; diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 1f115b1caf2..abddbc0e7a1 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -41,10 +41,26 @@ #define GPR_CALLTYPE #endif -grpc_byte_buffer* string_to_byte_buffer(const char* buffer, size_t len) { - grpc_slice slice = grpc_slice_from_copied_buffer(buffer, len); - grpc_byte_buffer* bb = grpc_raw_byte_buffer_create(&slice, 1); - grpc_slice_unref(slice); +//grpc_byte_buffer* string_to_byte_buffer(const char* buffer, size_t len) { +// grpc_slice slice = grpc_slice_from_copied_buffer(buffer, len); +// grpc_byte_buffer* bb = grpc_raw_byte_buffer_create(&slice, 1); +// grpc_slice_unref(slice); +// return bb; +//} + +static grpc_byte_buffer* grpcsharp_create_byte_buffer_from_stolen_slices(grpc_slice_buffer* slice_buffer) { + grpc_byte_buffer* bb = + (grpc_byte_buffer*)gpr_malloc(sizeof(grpc_byte_buffer)); + memset(bb, 0, sizeof(grpc_byte_buffer)); + bb->type = GRPC_BB_RAW; + bb->data.raw.compression = GRPC_COMPRESS_NONE; + bb->data.raw.slice_buffer = *slice_buffer; + // TODO: just use move slice_buffer... + + // we transferred the ownership of members from the slice buffer to the + // the internals of byte buffer, so we just overwrite the original slice buffer with + // default values. + grpc_slice_buffer_init(slice_buffer); // TODO: need to reset available_tail_space after this.. return bb; } @@ -582,8 +598,8 @@ static grpc_call_error grpcsharp_call_start_batch(grpc_call* call, } GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary( - grpc_call* call, grpcsharp_batch_context* ctx, const char* send_buffer, - size_t send_buffer_len, uint32_t write_flags, + grpc_call* call, grpcsharp_batch_context* ctx, grpc_slice_buffer* send_buffer, + uint32_t write_flags, grpc_metadata_array* initial_metadata, uint32_t initial_metadata_flags) { /* TODO: don't use magic number */ grpc_op ops[6]; @@ -598,7 +614,7 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary( ops[0].reserved = NULL; ops[1].op = GRPC_OP_SEND_MESSAGE; - ctx->send_message = string_to_byte_buffer(send_buffer, send_buffer_len); + ctx->send_message = grpcsharp_create_byte_buffer_from_stolen_slices(send_buffer); ops[1].data.send_message.send_message = ctx->send_message; ops[1].flags = write_flags; ops[1].reserved = NULL; @@ -635,12 +651,12 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary( /* Only for testing. Shortcircuits the unary call logic and only echoes the message as if it was received from the server */ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_test_call_start_unary_echo( - grpc_call* call, grpcsharp_batch_context* ctx, const char* send_buffer, - size_t send_buffer_len, uint32_t write_flags, + grpc_call* call, grpcsharp_batch_context* ctx, grpc_slice_buffer* send_buffer, + uint32_t write_flags, grpc_metadata_array* initial_metadata, uint32_t initial_metadata_flags) { // prepare as if we were performing a normal RPC. grpc_byte_buffer* send_message = - string_to_byte_buffer(send_buffer, send_buffer_len); + grpcsharp_create_byte_buffer_from_stolen_slices(send_buffer); ctx->recv_message = send_message; // echo message sent by the client as if // received from server. @@ -693,8 +709,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_client_streaming( } GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_server_streaming( - grpc_call* call, grpcsharp_batch_context* ctx, const char* send_buffer, - size_t send_buffer_len, uint32_t write_flags, + grpc_call* call, grpcsharp_batch_context* ctx, grpc_slice_buffer* send_buffer, + uint32_t write_flags, grpc_metadata_array* initial_metadata, uint32_t initial_metadata_flags) { /* TODO: don't use magic number */ grpc_op ops[4]; @@ -709,7 +725,7 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_server_streaming( ops[0].reserved = NULL; ops[1].op = GRPC_OP_SEND_MESSAGE; - ctx->send_message = string_to_byte_buffer(send_buffer, send_buffer_len); + ctx->send_message = grpcsharp_create_byte_buffer_from_stolen_slices(send_buffer); ops[1].data.send_message.send_message = ctx->send_message; ops[1].flags = write_flags; ops[1].reserved = NULL; @@ -776,15 +792,15 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_recv_initial_metadata( } GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_message( - grpc_call* call, grpcsharp_batch_context* ctx, const char* send_buffer, - size_t send_buffer_len, uint32_t write_flags, + grpc_call* call, grpcsharp_batch_context* ctx, grpc_slice_buffer* send_buffer, + uint32_t write_flags, int32_t send_empty_initial_metadata) { /* TODO: don't use magic number */ grpc_op ops[2]; memset(ops, 0, sizeof(ops)); size_t nops = send_empty_initial_metadata ? 2 : 1; ops[0].op = GRPC_OP_SEND_MESSAGE; - ctx->send_message = string_to_byte_buffer(send_buffer, send_buffer_len); + ctx->send_message = grpcsharp_create_byte_buffer_from_stolen_slices(send_buffer); ops[0].data.send_message.send_message = ctx->send_message; ops[0].flags = write_flags; ops[0].reserved = NULL; @@ -811,7 +827,7 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server( grpc_call* call, grpcsharp_batch_context* ctx, grpc_status_code status_code, const char* status_details, size_t status_details_len, grpc_metadata_array* trailing_metadata, int32_t send_empty_initial_metadata, - const char* optional_send_buffer, size_t optional_send_buffer_len, + grpc_slice_buffer* optional_send_buffer, uint32_t write_flags) { /* TODO: don't use magic number */ grpc_op ops[3]; @@ -833,7 +849,7 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server( if (optional_send_buffer) { ops[nops].op = GRPC_OP_SEND_MESSAGE; ctx->send_message = - string_to_byte_buffer(optional_send_buffer, optional_send_buffer_len); + grpcsharp_create_byte_buffer_from_stolen_slices(optional_send_buffer); ops[nops].data.send_message.send_message = ctx->send_message; ops[nops].flags = write_flags; ops[nops].reserved = NULL; @@ -1209,22 +1225,7 @@ grpcsharp_slice_buffer_slice_peek(grpc_slice_buffer* buffer, size_t index, size_ *slice_data_ptr = GRPC_SLICE_START_PTR(*slice_ptr); } -GPR_EXPORT grpc_byte_buffer* GPR_CALLTYPE -grpcsharp_create_byte_buffer_from_stolen_slices(grpc_slice_buffer* slice_buffer) { - grpc_byte_buffer* bb = - (grpc_byte_buffer*)gpr_malloc(sizeof(grpc_byte_buffer)); - memset(bb, 0, sizeof(grpc_byte_buffer)); - bb->type = GRPC_BB_RAW; - bb->data.raw.compression = GRPC_COMPRESS_NONE; - bb->data.raw.slice_buffer = *slice_buffer; - // TODO: just use move slice_buffer... - // we transferred the ownership of members from the slice buffer to the - // the internals of byte buffer, so we just overwrite the original slice buffer with - // default values. - grpc_slice_buffer_init(slice_buffer); // TODO: need to reset available_tail_space after this.. - return bb; -} GPR_EXPORT void* GPR_CALLTYPE grpcsharp_slice_buffer_adjust_tail_space(grpc_slice_buffer* buffer, size_t available_tail_space, diff --git a/templates/src/csharp/Grpc.Core/Internal/native_methods.include b/templates/src/csharp/Grpc.Core/Internal/native_methods.include index 055af4a7a27..4f5f61d332c 100644 --- a/templates/src/csharp/Grpc.Core/Internal/native_methods.include +++ b/templates/src/csharp/Grpc.Core/Internal/native_methods.include @@ -25,13 +25,13 @@ native_method_signatures = [ 'void grpcsharp_call_credentials_release(IntPtr credentials)', 'CallError grpcsharp_call_cancel(CallSafeHandle call)', 'CallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description)', - 'CallError grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', + 'CallError grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', 'CallError grpcsharp_call_start_client_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', - 'CallError grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', + 'CallError grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', 'CallError grpcsharp_call_start_duplex_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', - 'CallError grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata)', + 'CallError grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, int sendEmptyInitialMetadata)', 'CallError grpcsharp_call_send_close_from_client(CallSafeHandle call, BatchContextSafeHandle ctx)', - 'CallError grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, IntPtr statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags)', + 'CallError grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, IntPtr statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, SliceBufferSafeHandle optionalSendBuffer, WriteFlags writeFlags)', 'CallError grpcsharp_call_recv_message(CallSafeHandle call, BatchContextSafeHandle ctx)', 'CallError grpcsharp_call_recv_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx)', 'CallError grpcsharp_call_start_serverside(CallSafeHandle call, BatchContextSafeHandle ctx)', @@ -101,7 +101,7 @@ native_method_signatures = [ 'CallError grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackTestDelegate callback)', 'IntPtr grpcsharp_test_nop(IntPtr ptr)', 'void grpcsharp_test_override_method(string methodName, string variant)', - 'CallError grpcsharp_test_call_start_unary_echo(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', + 'CallError grpcsharp_test_call_start_unary_echo(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', ] import re From 8ad2b146ed5caa995c89726de59c375935145cb4 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 30 Jul 2019 17:38:08 -0700 Subject: [PATCH 268/661] fix grpcsharp_create_byte_buffer_from_stolen_slices --- src/csharp/ext/grpc_csharp_ext.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index abddbc0e7a1..82fa81abf7d 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -41,26 +41,15 @@ #define GPR_CALLTYPE #endif -//grpc_byte_buffer* string_to_byte_buffer(const char* buffer, size_t len) { -// grpc_slice slice = grpc_slice_from_copied_buffer(buffer, len); -// grpc_byte_buffer* bb = grpc_raw_byte_buffer_create(&slice, 1); -// grpc_slice_unref(slice); -// return bb; -//} - static grpc_byte_buffer* grpcsharp_create_byte_buffer_from_stolen_slices(grpc_slice_buffer* slice_buffer) { grpc_byte_buffer* bb = - (grpc_byte_buffer*)gpr_malloc(sizeof(grpc_byte_buffer)); + (grpc_byte_buffer*)gpr_malloc(sizeof(grpc_byte_buffer)); memset(bb, 0, sizeof(grpc_byte_buffer)); bb->type = GRPC_BB_RAW; bb->data.raw.compression = GRPC_COMPRESS_NONE; - bb->data.raw.slice_buffer = *slice_buffer; - // TODO: just use move slice_buffer... + grpc_slice_buffer_init(&bb->data.raw.slice_buffer); - // we transferred the ownership of members from the slice buffer to the - // the internals of byte buffer, so we just overwrite the original slice buffer with - // default values. - grpc_slice_buffer_init(slice_buffer); // TODO: need to reset available_tail_space after this.. + grpc_slice_buffer_swap(&bb->data.raw.slice_buffer, slice_buffer); return bb; } From 70c7aa162354188f25aa790bdc7a7443c00f2af1 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 30 Jul 2019 18:07:12 -0700 Subject: [PATCH 269/661] stuff now works --- src/csharp/Grpc.Core/Internal/CallSafeHandle.cs | 6 ++++++ src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs b/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs index 6208f45a00a..cfcab5dc692 100644 --- a/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs @@ -132,6 +132,12 @@ namespace Grpc.Core.Internal SliceBufferSafeHandle optionalPayload, WriteFlags writeFlags) { // TODO: optionalPayload == null -> pass null SliceBufferSafeHandle + // do this properly + if (optionalPayload == null) + { + optionalPayload = SliceBufferSafeHandle.NullInstance; + } + using (completionQueue.NewScope()) { var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_ISendStatusFromServerCompletionCallback, callback); diff --git a/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs index 5b540c69d44..5ea4432684c 100644 --- a/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs @@ -32,6 +32,8 @@ namespace Grpc.Core.Internal static readonly NativeMethods Native = NativeMethods.Get(); static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); + public static readonly SliceBufferSafeHandle NullInstance = new SliceBufferSafeHandle(); + private IntPtr tailSpacePtr; private UIntPtr tailSpaceLen; From 1c177fff1e9cba4fc3632e12d39572a31fa2704f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 31 Jul 2019 16:22:50 -0700 Subject: [PATCH 270/661] refactoring and simplifications --- .../Internal/DefaultSerializationContext.cs | 51 ++++--------------- .../Internal/NativeMethods.Generated.cs | 11 ++++ .../Internal/SliceBufferSafeHandle.cs | 44 +++++++++++----- src/csharp/ext/grpc_csharp_ext.c | 7 ++- .../runtimes/grpc_csharp_ext_dummy_stubs.c | 4 ++ .../Grpc.Core/Internal/native_methods.include | 1 + 6 files changed, 63 insertions(+), 55 deletions(-) diff --git a/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs b/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs index 9098850a52e..db5e78a608d 100644 --- a/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs +++ b/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs @@ -30,7 +30,7 @@ namespace Grpc.Core.Internal bool isComplete; //byte[] payload; - NativeBufferWriter bufferWriter; + SliceBufferSafeHandle sliceBuffer; public DefaultSerializationContext() { @@ -43,10 +43,10 @@ namespace Grpc.Core.Internal this.isComplete = true; GetBufferWriter(); - var destSpan = bufferWriter.GetSpan(payload.Length); + var destSpan = sliceBuffer.GetSpan(payload.Length); payload.AsSpan().CopyTo(destSpan); - bufferWriter.Advance(payload.Length); - bufferWriter.Complete(); + sliceBuffer.Advance(payload.Length); + sliceBuffer.Complete(); //this.payload = payload; } @@ -55,12 +55,12 @@ namespace Grpc.Core.Internal /// public override IBufferWriter GetBufferWriter() { - if (bufferWriter == null) + if (sliceBuffer == null) { // TODO: avoid allocation.. - bufferWriter = new NativeBufferWriter(); + sliceBuffer = SliceBufferSafeHandle.Create(); } - return bufferWriter; + return sliceBuffer; } /// @@ -69,20 +69,20 @@ namespace Grpc.Core.Internal public override void Complete() { GrpcPreconditions.CheckState(!isComplete); - bufferWriter.Complete(); + sliceBuffer.Complete(); this.isComplete = true; } internal SliceBufferSafeHandle GetPayload() { - return bufferWriter.GetSliceBuffer(); + return sliceBuffer; } public void Reset() { this.isComplete = false; //this.payload = null; - this.bufferWriter = null; + this.sliceBuffer = null; // reset instead... } public static DefaultSerializationContext GetInitializedThreadLocal() @@ -92,35 +92,6 @@ namespace Grpc.Core.Internal return instance; } - private class NativeBufferWriter : IBufferWriter - { - private SliceBufferSafeHandle sliceBuffer = SliceBufferSafeHandle.Create(); - - public void Advance(int count) - { - sliceBuffer.Advance(count); - } - - public Memory GetMemory(int sizeHint = 0) - { - // TODO: implement - throw new NotImplementedException(); - } - - public Span GetSpan(int sizeHint = 0) - { - return sliceBuffer.GetSpan(sizeHint); - } - - public void Complete() - { - sliceBuffer.Complete(); - } - - public SliceBufferSafeHandle GetSliceBuffer() - { - return sliceBuffer; - } - } + } } diff --git a/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs b/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs index d492d0c9525..c724b30ca8f 100644 --- a/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs +++ b/src/csharp/Grpc.Core/Internal/NativeMethods.Generated.cs @@ -126,6 +126,7 @@ namespace Grpc.Core.Internal public readonly Delegates.grpcsharp_slice_buffer_adjust_tail_space_delegate grpcsharp_slice_buffer_adjust_tail_space; public readonly Delegates.grpcsharp_slice_buffer_slice_count_delegate grpcsharp_slice_buffer_slice_count; public readonly Delegates.grpcsharp_slice_buffer_slice_peek_delegate grpcsharp_slice_buffer_slice_peek; + public readonly Delegates.grpcsharp_slice_buffer_reset_and_unref_delegate grpcsharp_slice_buffer_reset_and_unref; public readonly Delegates.grpcsharp_slice_buffer_destroy_delegate grpcsharp_slice_buffer_destroy; public readonly Delegates.gprsharp_now_delegate gprsharp_now; public readonly Delegates.gprsharp_inf_future_delegate gprsharp_inf_future; @@ -233,6 +234,7 @@ namespace Grpc.Core.Internal this.grpcsharp_slice_buffer_adjust_tail_space = GetMethodDelegate(library); this.grpcsharp_slice_buffer_slice_count = GetMethodDelegate(library); this.grpcsharp_slice_buffer_slice_peek = GetMethodDelegate(library); + this.grpcsharp_slice_buffer_reset_and_unref = GetMethodDelegate(library); this.grpcsharp_slice_buffer_destroy = GetMethodDelegate(library); this.gprsharp_now = GetMethodDelegate(library); this.gprsharp_inf_future = GetMethodDelegate(library); @@ -339,6 +341,7 @@ namespace Grpc.Core.Internal this.grpcsharp_slice_buffer_adjust_tail_space = DllImportsFromStaticLib.grpcsharp_slice_buffer_adjust_tail_space; this.grpcsharp_slice_buffer_slice_count = DllImportsFromStaticLib.grpcsharp_slice_buffer_slice_count; this.grpcsharp_slice_buffer_slice_peek = DllImportsFromStaticLib.grpcsharp_slice_buffer_slice_peek; + this.grpcsharp_slice_buffer_reset_and_unref = DllImportsFromStaticLib.grpcsharp_slice_buffer_reset_and_unref; this.grpcsharp_slice_buffer_destroy = DllImportsFromStaticLib.grpcsharp_slice_buffer_destroy; this.gprsharp_now = DllImportsFromStaticLib.gprsharp_now; this.gprsharp_inf_future = DllImportsFromStaticLib.gprsharp_inf_future; @@ -445,6 +448,7 @@ namespace Grpc.Core.Internal this.grpcsharp_slice_buffer_adjust_tail_space = DllImportsFromSharedLib.grpcsharp_slice_buffer_adjust_tail_space; this.grpcsharp_slice_buffer_slice_count = DllImportsFromSharedLib.grpcsharp_slice_buffer_slice_count; this.grpcsharp_slice_buffer_slice_peek = DllImportsFromSharedLib.grpcsharp_slice_buffer_slice_peek; + this.grpcsharp_slice_buffer_reset_and_unref = DllImportsFromSharedLib.grpcsharp_slice_buffer_reset_and_unref; this.grpcsharp_slice_buffer_destroy = DllImportsFromSharedLib.grpcsharp_slice_buffer_destroy; this.gprsharp_now = DllImportsFromSharedLib.gprsharp_now; this.gprsharp_inf_future = DllImportsFromSharedLib.gprsharp_inf_future; @@ -554,6 +558,7 @@ namespace Grpc.Core.Internal public delegate IntPtr grpcsharp_slice_buffer_adjust_tail_space_delegate(SliceBufferSafeHandle sliceBuffer, UIntPtr availableTailSpace, UIntPtr requestedTailSpace); public delegate UIntPtr grpcsharp_slice_buffer_slice_count_delegate(SliceBufferSafeHandle sliceBuffer); public delegate void grpcsharp_slice_buffer_slice_peek_delegate(SliceBufferSafeHandle sliceBuffer, UIntPtr index, out UIntPtr sliceLen, out IntPtr sliceDataPtr); + public delegate void grpcsharp_slice_buffer_reset_and_unref_delegate(SliceBufferSafeHandle sliceBuffer); public delegate void grpcsharp_slice_buffer_destroy_delegate(IntPtr sliceBuffer); public delegate Timespec gprsharp_now_delegate(ClockType clockType); public delegate Timespec gprsharp_inf_future_delegate(ClockType clockType); @@ -849,6 +854,9 @@ namespace Grpc.Core.Internal [DllImport(ImportName)] public static extern void grpcsharp_slice_buffer_slice_peek(SliceBufferSafeHandle sliceBuffer, UIntPtr index, out UIntPtr sliceLen, out IntPtr sliceDataPtr); + [DllImport(ImportName)] + public static extern void grpcsharp_slice_buffer_reset_and_unref(SliceBufferSafeHandle sliceBuffer); + [DllImport(ImportName)] public static extern void grpcsharp_slice_buffer_destroy(IntPtr sliceBuffer); @@ -1163,6 +1171,9 @@ namespace Grpc.Core.Internal [DllImport(ImportName)] public static extern void grpcsharp_slice_buffer_slice_peek(SliceBufferSafeHandle sliceBuffer, UIntPtr index, out UIntPtr sliceLen, out IntPtr sliceDataPtr); + [DllImport(ImportName)] + public static extern void grpcsharp_slice_buffer_reset_and_unref(SliceBufferSafeHandle sliceBuffer); + [DllImport(ImportName)] public static extern void grpcsharp_slice_buffer_destroy(IntPtr sliceBuffer); diff --git a/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs index 5ea4432684c..76a97f4a0a2 100644 --- a/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs @@ -17,6 +17,7 @@ #endregion using System; +using System.Buffers; using System.Runtime.InteropServices; using Grpc.Core; using Grpc.Core.Logging; @@ -25,9 +26,10 @@ using Grpc.Core.Utils; namespace Grpc.Core.Internal { /// - /// grpc_slice_buffer + /// Represents grpc_slice_buffer with some extra utility functions to allow + /// writing data to it using the IBufferWriter interface. /// - internal class SliceBufferSafeHandle : SafeHandleZeroIsInvalid + internal class SliceBufferSafeHandle : SafeHandleZeroIsInvalid, IBufferWriter { static readonly NativeMethods Native = NativeMethods.Get(); static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); @@ -35,8 +37,7 @@ namespace Grpc.Core.Internal public static readonly SliceBufferSafeHandle NullInstance = new SliceBufferSafeHandle(); private IntPtr tailSpacePtr; - private UIntPtr tailSpaceLen; - + private int tailSpaceLen; private SliceBufferSafeHandle() { @@ -59,21 +60,30 @@ namespace Grpc.Core.Internal { GrpcPreconditions.CheckArgument(count >= 0); GrpcPreconditions.CheckArgument(tailSpacePtr != IntPtr.Zero || count == 0); - GrpcPreconditions.CheckArgument(tailSpaceLen.ToUInt64() >= (ulong)count); - tailSpaceLen = new UIntPtr(tailSpaceLen.ToUInt64() - (ulong)count); + GrpcPreconditions.CheckArgument(tailSpaceLen >= count); + tailSpaceLen = tailSpaceLen - count; tailSpacePtr += count; } - public unsafe Span GetSpan(int sizeHint) + // provides access to the "tail space" of this buffer. + // Use GetSpan when possible for better efficiency. + public Memory GetMemory(int sizeHint = 0) + { + // TODO: implement + throw new NotImplementedException(); + } + + // provides access to the "tail space" of this buffer. + public unsafe Span GetSpan(int sizeHint = 0) { GrpcPreconditions.CheckArgument(sizeHint >= 0); - if (tailSpaceLen.ToUInt64() < (ulong) sizeHint) + if (tailSpaceLen < sizeHint) { // TODO: should we ignore the hint sometimes when // available tail space is close enough to the sizeHint? AdjustTailSpace(sizeHint); } - return new Span(tailSpacePtr.ToPointer(), (int) tailSpaceLen.ToUInt64()); + return new Span(tailSpacePtr.ToPointer(), tailSpaceLen); } public void Complete() @@ -81,8 +91,17 @@ namespace Grpc.Core.Internal AdjustTailSpace(0); } + // resets the data contained by this slice buffer + public void Reset() + { + // deletes all the data in the slice buffer + tailSpacePtr = IntPtr.Zero; + tailSpaceLen = 0; + Native.grpcsharp_slice_buffer_reset_and_unref(this); + } + // copies the content of the slice buffer to a newly allocated byte array - // due to its overhead, this method should only be used for testing. + // Note that this method has a relatively high overhead and should maily be used for testing. public byte[] ToByteArray() { ulong sliceCount = Native.grpcsharp_slice_buffer_slice_count(this).ToUInt64(); @@ -111,9 +130,8 @@ namespace Grpc.Core.Internal private void AdjustTailSpace(int requestedSize) { GrpcPreconditions.CheckArgument(requestedSize >= 0); - var requestedTailSpaceLen = new UIntPtr((ulong) requestedSize); - tailSpacePtr = Native.grpcsharp_slice_buffer_adjust_tail_space(this, tailSpaceLen, requestedTailSpaceLen); - tailSpaceLen = requestedTailSpaceLen; + tailSpacePtr = Native.grpcsharp_slice_buffer_adjust_tail_space(this, new UIntPtr((ulong) tailSpaceLen), new UIntPtr((ulong) requestedSize)); + tailSpaceLen = requestedSize; } protected override bool ReleaseHandle() { diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 82fa81abf7d..78027d270dc 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -1195,6 +1195,11 @@ grpcsharp_slice_buffer_create() { return slice_buffer; } +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_slice_buffer_reset_and_unref(grpc_slice_buffer* buffer) { + grpc_slice_buffer_reset_and_unref(buffer); +} + GPR_EXPORT void GPR_CALLTYPE grpcsharp_slice_buffer_destroy(grpc_slice_buffer* buffer) { grpc_slice_buffer_destroy(buffer); @@ -1214,8 +1219,6 @@ grpcsharp_slice_buffer_slice_peek(grpc_slice_buffer* buffer, size_t index, size_ *slice_data_ptr = GRPC_SLICE_START_PTR(*slice_ptr); } - - GPR_EXPORT void* GPR_CALLTYPE grpcsharp_slice_buffer_adjust_tail_space(grpc_slice_buffer* buffer, size_t available_tail_space, size_t requested_tail_space) { diff --git a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c index 9007d7f3ad0..58a7c58e91a 100644 --- a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c +++ b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/grpc_csharp_ext_dummy_stubs.c @@ -390,6 +390,10 @@ void grpcsharp_slice_buffer_slice_peek() { fprintf(stderr, "Should never reach here"); abort(); } +void grpcsharp_slice_buffer_reset_and_unref() { + fprintf(stderr, "Should never reach here"); + abort(); +} void grpcsharp_slice_buffer_destroy() { fprintf(stderr, "Should never reach here"); abort(); diff --git a/templates/src/csharp/Grpc.Core/Internal/native_methods.include b/templates/src/csharp/Grpc.Core/Internal/native_methods.include index 4f5f61d332c..f2b3a165a3b 100644 --- a/templates/src/csharp/Grpc.Core/Internal/native_methods.include +++ b/templates/src/csharp/Grpc.Core/Internal/native_methods.include @@ -92,6 +92,7 @@ native_method_signatures = [ 'IntPtr grpcsharp_slice_buffer_adjust_tail_space(SliceBufferSafeHandle sliceBuffer, UIntPtr availableTailSpace, UIntPtr requestedTailSpace)', 'UIntPtr grpcsharp_slice_buffer_slice_count(SliceBufferSafeHandle sliceBuffer)', 'void grpcsharp_slice_buffer_slice_peek(SliceBufferSafeHandle sliceBuffer, UIntPtr index, out UIntPtr sliceLen, out IntPtr sliceDataPtr)', + 'void grpcsharp_slice_buffer_reset_and_unref(SliceBufferSafeHandle sliceBuffer)', 'void grpcsharp_slice_buffer_destroy(IntPtr sliceBuffer)', 'Timespec gprsharp_now(ClockType clockType)', 'Timespec gprsharp_inf_future(ClockType clockType)', From aaddd42c00647a0fea619d7dfda090c038f6d7fa Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 31 Jul 2019 17:29:04 -0700 Subject: [PATCH 271/661] add serializationScope and refactoring for efficiency --- .../ContextualMarshallerTest.cs | 2 + src/csharp/Grpc.Core/Internal/AsyncCall.cs | 15 +++++-- .../Grpc.Core/Internal/AsyncCallBase.cs | 44 ++++++++----------- .../Grpc.Core/Internal/AsyncCallServer.cs | 39 ++++++++-------- .../Internal/DefaultSerializationContext.cs | 40 ++++++++++------- 5 files changed, 78 insertions(+), 62 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/ContextualMarshallerTest.cs b/src/csharp/Grpc.Core.Tests/ContextualMarshallerTest.cs index c3aee726f26..99f92e12628 100644 --- a/src/csharp/Grpc.Core.Tests/ContextualMarshallerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ContextualMarshallerTest.cs @@ -52,6 +52,8 @@ namespace Grpc.Core.Tests } if (str == "SERIALIZE_TO_NULL") { + // TODO: test for not calling complete Complete() (that resulted in null payload before...) + // TODO: test for calling Complete(null byte array) return; } var bytes = System.Text.Encoding.UTF8.GetBytes(str); diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs index aefa58a0cee..4111c5347ce 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs @@ -95,10 +95,10 @@ namespace Grpc.Core.Internal readingDone = true; } - var payload = UnsafeSerialize(msg); - + using (var serializationScope = DefaultSerializationContext.GetInitializedThreadLocalScope()) using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers)) { + var payload = UnsafeSerialize(msg, serializationScope.Context); // do before metadata array? var ctx = details.Channel.Environment.BatchContextPool.Lease(); try { @@ -160,11 +160,14 @@ namespace Grpc.Core.Internal halfcloseRequested = true; readingDone = true; - var payload = UnsafeSerialize(msg); + //var payload = UnsafeSerialize(msg); unaryResponseTcs = new TaskCompletionSource(); + using (var serializationScope = DefaultSerializationContext.GetInitializedThreadLocalScope()) using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers)) { + var payload = UnsafeSerialize(msg, serializationScope.Context); // do before metadata array? + call.StartUnary(UnaryResponseClientCallback, payload, GetWriteFlagsForCall(), metadataArray, details.Options.Flags); callStartedOk = true; } @@ -235,11 +238,15 @@ namespace Grpc.Core.Internal halfcloseRequested = true; - var payload = UnsafeSerialize(msg); + //var payload = UnsafeSerialize(msg); streamingResponseCallFinishedTcs = new TaskCompletionSource(); + + using (var serializationScope = DefaultSerializationContext.GetInitializedThreadLocalScope()) using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers)) { + var payload = UnsafeSerialize(msg, serializationScope.Context); // do before metadata array? + call.StartServerStreaming(ReceivedStatusOnClientCallback, payload, GetWriteFlagsForCall(), metadataArray, details.Options.Flags); callStartedOk = true; } diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs index 07f9ecf23e9..bd4b0d81832 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs @@ -115,23 +115,25 @@ namespace Grpc.Core.Internal /// protected Task SendMessageInternalAsync(TWrite msg, WriteFlags writeFlags) { - var payload = UnsafeSerialize(msg); - - lock (myLock) + using (var serializationScope = DefaultSerializationContext.GetInitializedThreadLocalScope()) { - GrpcPreconditions.CheckState(started); - var earlyResult = CheckSendAllowedOrEarlyResult(); - if (earlyResult != null) + var payload = UnsafeSerialize(msg, serializationScope.Context); // do before metadata array? + lock (myLock) { - return earlyResult; - } + GrpcPreconditions.CheckState(started); + var earlyResult = CheckSendAllowedOrEarlyResult(); + if (earlyResult != null) + { + return earlyResult; + } - call.StartSendMessage(SendCompletionCallback, payload, writeFlags, !initialMetadataSent); + call.StartSendMessage(SendCompletionCallback, payload, writeFlags, !initialMetadataSent); - initialMetadataSent = true; - streamingWritesCounter++; - streamingWriteTcs = new TaskCompletionSource(); - return streamingWriteTcs.Task; + initialMetadataSent = true; + streamingWritesCounter++; + streamingWriteTcs = new TaskCompletionSource(); + return streamingWriteTcs.Task; + } } } @@ -213,19 +215,11 @@ namespace Grpc.Core.Internal /// protected abstract Task CheckSendAllowedOrEarlyResult(); - protected SliceBufferSafeHandle UnsafeSerialize(TWrite msg) + // runs the serializer, propagating any exceptions being thrown without modifying them + protected SliceBufferSafeHandle UnsafeSerialize(TWrite msg, DefaultSerializationContext context) { - DefaultSerializationContext context = null; - try - { - context = DefaultSerializationContext.GetInitializedThreadLocal(); - serializer(msg, context); - return context.GetPayload(); - } - finally - { - context?.Reset(); - } + serializer(msg, context); + return context.GetPayload(); } protected Exception TryDeserialize(IBufferReader reader, out TRead msg) diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs index e1c3a215422..e0bb41e15dc 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs @@ -129,28 +129,31 @@ namespace Grpc.Core.Internal /// public Task SendStatusFromServerAsync(Status status, Metadata trailers, ResponseWithFlags? optionalWrite) { - var payload = optionalWrite.HasValue ? UnsafeSerialize(optionalWrite.Value.Response) : null; - var writeFlags = optionalWrite.HasValue ? optionalWrite.Value.WriteFlags : default(WriteFlags); - - lock (myLock) + using (var serializationScope = DefaultSerializationContext.GetInitializedThreadLocalScope()) { - GrpcPreconditions.CheckState(started); - GrpcPreconditions.CheckState(!disposed); - GrpcPreconditions.CheckState(!halfcloseRequested, "Can only send status from server once."); + var payload = optionalWrite.HasValue ? UnsafeSerialize(optionalWrite.Value.Response, serializationScope.Context) : null; + var writeFlags = optionalWrite.HasValue ? optionalWrite.Value.WriteFlags : default(WriteFlags); - using (var metadataArray = MetadataArraySafeHandle.Create(trailers)) - { - call.StartSendStatusFromServer(SendStatusFromServerCompletionCallback, status, metadataArray, !initialMetadataSent, - payload, writeFlags); - } - halfcloseRequested = true; - initialMetadataSent = true; - sendStatusFromServerTcs = new TaskCompletionSource(); - if (optionalWrite.HasValue) + lock (myLock) { - streamingWritesCounter++; + GrpcPreconditions.CheckState(started); + GrpcPreconditions.CheckState(!disposed); + GrpcPreconditions.CheckState(!halfcloseRequested, "Can only send status from server once."); + + using (var metadataArray = MetadataArraySafeHandle.Create(trailers)) + { + call.StartSendStatusFromServer(SendStatusFromServerCompletionCallback, status, metadataArray, !initialMetadataSent, + payload, writeFlags); + } + halfcloseRequested = true; + initialMetadataSent = true; + sendStatusFromServerTcs = new TaskCompletionSource(); + if (optionalWrite.HasValue) + { + streamingWritesCounter++; + } + return sendStatusFromServerTcs.Task; } - return sendStatusFromServerTcs.Task; } } diff --git a/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs b/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs index db5e78a608d..6bf9da56264 100644 --- a/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs +++ b/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs @@ -29,8 +29,7 @@ namespace Grpc.Core.Internal new ThreadLocal(() => new DefaultSerializationContext(), false); bool isComplete; - //byte[] payload; - SliceBufferSafeHandle sliceBuffer; + SliceBufferSafeHandle sliceBuffer = SliceBufferSafeHandle.Create(); public DefaultSerializationContext() { @@ -42,12 +41,10 @@ namespace Grpc.Core.Internal GrpcPreconditions.CheckState(!isComplete); this.isComplete = true; - GetBufferWriter(); var destSpan = sliceBuffer.GetSpan(payload.Length); payload.AsSpan().CopyTo(destSpan); sliceBuffer.Advance(payload.Length); sliceBuffer.Complete(); - //this.payload = payload; } /// @@ -55,11 +52,6 @@ namespace Grpc.Core.Internal /// public override IBufferWriter GetBufferWriter() { - if (sliceBuffer == null) - { - // TODO: avoid allocation.. - sliceBuffer = SliceBufferSafeHandle.Create(); - } return sliceBuffer; } @@ -81,17 +73,35 @@ namespace Grpc.Core.Internal public void Reset() { this.isComplete = false; - //this.payload = null; - this.sliceBuffer = null; // reset instead... + this.sliceBuffer.Reset(); } - public static DefaultSerializationContext GetInitializedThreadLocal() + // Get a cached thread local instance of deserialization context + // and wrap it in a disposable struct that allows easy resetting + // via "using" statement. + public static UsageScope GetInitializedThreadLocalScope() { var instance = threadLocalInstance.Value; - instance.Reset(); - return instance; + return new UsageScope(instance); } - + public struct UsageScope : IDisposable + { + readonly DefaultSerializationContext context; + + public UsageScope(DefaultSerializationContext context) + { + this.context = context; + } + + public DefaultSerializationContext Context => context; + + // TODO: add Serialize method... + + public void Dispose() + { + context.Reset(); + } + } } } From 74dcdbb3c39619c1a725dc9a7e62c2cb5b62eda4 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 7 Aug 2019 12:57:38 -0700 Subject: [PATCH 272/661] fix adjust_tail_space --- src/csharp/ext/grpc_csharp_ext.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 78027d270dc..89391e67e15 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -1223,32 +1223,30 @@ GPR_EXPORT void* GPR_CALLTYPE grpcsharp_slice_buffer_adjust_tail_space(grpc_slice_buffer* buffer, size_t available_tail_space, size_t requested_tail_space) { - if (available_tail_space == 0 && requested_tail_space == 0) - { - return NULL; + if (available_tail_space == requested_tail_space) { + // nothing to do } - // TODO: what if available_tail_space == requested_tail_space == 0 - - if (available_tail_space >= requested_tail_space) + else if (available_tail_space >= requested_tail_space) { - // TODO: should this be allowed at all? - grpc_slice_buffer garbage; - grpc_slice_buffer_trim_end(buffer, available_tail_space - requested_tail_space, &garbage); - grpc_slice_buffer_reset_and_unref(&garbage); + grpc_slice_buffer_trim_end(buffer, available_tail_space - requested_tail_space, NULL); } else { if (available_tail_space > 0) { - grpc_slice_buffer garbage; - grpc_slice_buffer_trim_end(buffer, available_tail_space, &garbage); - grpc_slice_buffer_reset_and_unref(&garbage); + grpc_slice_buffer_trim_end(buffer, available_tail_space, NULL); } grpc_slice new_slice = grpc_slice_malloc(requested_tail_space); - grpc_slice_buffer_add(buffer, new_slice); + // TODO: this always adds as a new slice entry into the sb, but it doesn't have the problem of + // sometimes splitting the continguous new_slice across two different slices (like grpc_slice_buffer_add would) + grpc_slice_buffer_add_indexed(buffer, new_slice); } + if (buffer->count == 0) + { + return NULL; + } grpc_slice* last_slice = &(buffer->slices[buffer->count - 1]); return GRPC_SLICE_END_PTR(*last_slice) - requested_tail_space; } From f32bd8b091669f2ce1056d2ddbae694dbb54cb18 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 7 Aug 2019 12:59:57 -0700 Subject: [PATCH 273/661] add default serialization context test --- .../DefaultSerializationContextTest.cs | 144 ++++++++++++++++++ src/csharp/tests.json | 1 + 2 files changed, 145 insertions(+) create mode 100644 src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs diff --git a/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs b/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs new file mode 100644 index 00000000000..4d09d80bb72 --- /dev/null +++ b/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs @@ -0,0 +1,144 @@ +#region Copyright notice and license + +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Buffers; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using Grpc.Core; +using Grpc.Core.Internal; +using Grpc.Core.Utils; +using NUnit.Framework; + +namespace Grpc.Core.Internal.Tests +{ + public class DefaultSerializationContextTest + { + [TestCase] + public void CompleteAllowedOnlyOnce() + { + var context = new DefaultSerializationContext(); + var buffer = GetTestBuffer(10); + + context.Complete(buffer); + Assert.Throws(typeof(InvalidOperationException), () => context.Complete(buffer)); + Assert.Throws(typeof(InvalidOperationException), () => context.Complete()); + } + + [TestCase] + public void CompleteAllowedOnlyOnce2() + { + var context = new DefaultSerializationContext(); + + context.Complete(); + Assert.Throws(typeof(InvalidOperationException), () => context.Complete(GetTestBuffer(10))); + Assert.Throws(typeof(InvalidOperationException), () => context.Complete()); + } + + [TestCase(0)] + [TestCase(1)] + [TestCase(10)] + [TestCase(100)] + [TestCase(1000)] + public void ByteArrayPayload(int payloadSize) + { + var context = new DefaultSerializationContext(); + var origPayload = GetTestBuffer(payloadSize); + + context.Complete(origPayload); + + var nativePayload = context.GetPayload().ToByteArray(); + CollectionAssert.AreEqual(origPayload, nativePayload); + } + + [TestCase(0)] + [TestCase(1)] + [TestCase(10)] + [TestCase(100)] + [TestCase(1000)] + public void BufferWriter_OneSegment(int payloadSize) + { + var context = new DefaultSerializationContext(); + var origPayload = GetTestBuffer(payloadSize); + + var bufferWriter = context.GetBufferWriter(); + origPayload.AsSpan().CopyTo(bufferWriter.GetSpan(payloadSize)); + bufferWriter.Advance(payloadSize); + // TODO: test that call to Complete() is required. + + var nativePayload = context.GetPayload().ToByteArray(); + CollectionAssert.AreEqual(origPayload, nativePayload); + } + + [TestCase(1, 4)] // small slice size tests grpc_slice with inline data + [TestCase(10, 4)] + [TestCase(100, 4)] + [TestCase(1000, 4)] + [TestCase(1, 64)] // larger slice size tests allocated grpc_slices + [TestCase(10, 64)] + [TestCase(1000, 50)] + [TestCase(1000, 64)] + public void BufferWriter_MultipleSegments(int payloadSize, int maxSliceSize) + { + var context = new DefaultSerializationContext(); + var origPayload = GetTestBuffer(payloadSize); + + var bufferWriter = context.GetBufferWriter(); + for (int offset = 0; offset < payloadSize; offset += maxSliceSize) + { + var sliceSize = Math.Min(maxSliceSize, payloadSize - offset); + // we allocate last slice as too big intentionally to test that shrinking works + var dest = bufferWriter.GetSpan(maxSliceSize); + + origPayload.AsSpan(offset, sliceSize).CopyTo(dest); + bufferWriter.Advance(sliceSize); + } + context.Complete(); + + var nativePayload = context.GetPayload().ToByteArray(); + CollectionAssert.AreEqual(origPayload, nativePayload); + + context.GetPayload().Dispose(); // TODO: do it better.. (use the scope...) + } + + // AdjustTailSpace(0) if previous tail size is 0.... + + // test that context.Complete() call is required... + + // BufferWriter.GetMemory... (add refs to the original memory?) + + // TODO: set payload and then get IBufferWriter should throw? + + // TODO: test Reset()... + + // TODO: destroy SliceBufferSafeHandles... (use usagescope...) + + + + + private byte[] GetTestBuffer(int length) + { + var testBuffer = new byte[length]; + for (int i = 0; i < testBuffer.Length; i++) + { + testBuffer[i] = (byte) i; + } + return testBuffer; + } + } +} diff --git a/src/csharp/tests.json b/src/csharp/tests.json index 2eb786e0983..75bda4c25ea 100644 --- a/src/csharp/tests.json +++ b/src/csharp/tests.json @@ -9,6 +9,7 @@ "Grpc.Core.Internal.Tests.CompletionQueueSafeHandleTest", "Grpc.Core.Internal.Tests.DefaultDeserializationContextTest", "Grpc.Core.Internal.Tests.DefaultObjectPoolTest", + "Grpc.Core.Internal.Tests.DefaultSerializationContextTest", "Grpc.Core.Internal.Tests.FakeBufferReaderManagerTest", "Grpc.Core.Internal.Tests.MetadataArraySafeHandleTest", "Grpc.Core.Internal.Tests.ReusableSliceBufferTest", From d57dec1c7dc19a245ddc74971781b53610bda4cc Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 9 Aug 2019 14:03:18 -0700 Subject: [PATCH 274/661] improve DefaultSerializationContextTest --- .../DefaultSerializationContextTest.cs | 151 ++++++++++++------ 1 file changed, 104 insertions(+), 47 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs b/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs index 4d09d80bb72..aa7631587be 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs @@ -17,9 +17,6 @@ #endregion using System; -using System.Buffers; -using System.Collections.Generic; -using System.Runtime.InteropServices; using Grpc.Core; using Grpc.Core.Internal; using Grpc.Core.Utils; @@ -32,22 +29,28 @@ namespace Grpc.Core.Internal.Tests [TestCase] public void CompleteAllowedOnlyOnce() { - var context = new DefaultSerializationContext(); - var buffer = GetTestBuffer(10); + using (var scope = NewDefaultSerializationContextScope()) + { + var context = scope.Context; + var buffer = GetTestBuffer(10); - context.Complete(buffer); - Assert.Throws(typeof(InvalidOperationException), () => context.Complete(buffer)); - Assert.Throws(typeof(InvalidOperationException), () => context.Complete()); + context.Complete(buffer); + Assert.Throws(typeof(InvalidOperationException), () => context.Complete(buffer)); + Assert.Throws(typeof(InvalidOperationException), () => context.Complete()); + } } [TestCase] public void CompleteAllowedOnlyOnce2() { - var context = new DefaultSerializationContext(); + using (var scope = NewDefaultSerializationContextScope()) + { + var context = scope.Context; - context.Complete(); - Assert.Throws(typeof(InvalidOperationException), () => context.Complete(GetTestBuffer(10))); - Assert.Throws(typeof(InvalidOperationException), () => context.Complete()); + context.Complete(); + Assert.Throws(typeof(InvalidOperationException), () => context.Complete(GetTestBuffer(10))); + Assert.Throws(typeof(InvalidOperationException), () => context.Complete()); + } } [TestCase(0)] @@ -57,13 +60,16 @@ namespace Grpc.Core.Internal.Tests [TestCase(1000)] public void ByteArrayPayload(int payloadSize) { - var context = new DefaultSerializationContext(); - var origPayload = GetTestBuffer(payloadSize); + using (var scope = NewDefaultSerializationContextScope()) + { + var context = scope.Context; + var origPayload = GetTestBuffer(payloadSize); - context.Complete(origPayload); + context.Complete(origPayload); - var nativePayload = context.GetPayload().ToByteArray(); - CollectionAssert.AreEqual(origPayload, nativePayload); + var nativePayload = context.GetPayload().ToByteArray(); + CollectionAssert.AreEqual(origPayload, nativePayload); + } } [TestCase(0)] @@ -73,16 +79,40 @@ namespace Grpc.Core.Internal.Tests [TestCase(1000)] public void BufferWriter_OneSegment(int payloadSize) { - var context = new DefaultSerializationContext(); - var origPayload = GetTestBuffer(payloadSize); + using (var scope = NewDefaultSerializationContextScope()) + { + var context = scope.Context; + var origPayload = GetTestBuffer(payloadSize); - var bufferWriter = context.GetBufferWriter(); - origPayload.AsSpan().CopyTo(bufferWriter.GetSpan(payloadSize)); - bufferWriter.Advance(payloadSize); - // TODO: test that call to Complete() is required. + var bufferWriter = context.GetBufferWriter(); + origPayload.AsSpan().CopyTo(bufferWriter.GetSpan(payloadSize)); + bufferWriter.Advance(payloadSize); + // TODO: test that call to Complete() is required. - var nativePayload = context.GetPayload().ToByteArray(); - CollectionAssert.AreEqual(origPayload, nativePayload); + var nativePayload = context.GetPayload().ToByteArray(); + CollectionAssert.AreEqual(origPayload, nativePayload); + } + } + + [TestCase(0)] + [TestCase(1)] + [TestCase(10)] + [TestCase(100)] + [TestCase(1000)] + public void BufferWriter_OneSegment_GetMemory(int payloadSize) + { + using (var scope = NewDefaultSerializationContextScope()) + { + var context = scope.Context; + var origPayload = GetTestBuffer(payloadSize); + + var bufferWriter = context.GetBufferWriter(); + origPayload.AsSpan().CopyTo(bufferWriter.GetMemory(payloadSize).Span); + bufferWriter.Advance(payloadSize); + + var nativePayload = context.GetPayload().ToByteArray(); + CollectionAssert.AreEqual(origPayload, nativePayload); + } } [TestCase(1, 4)] // small slice size tests grpc_slice with inline data @@ -95,41 +125,68 @@ namespace Grpc.Core.Internal.Tests [TestCase(1000, 64)] public void BufferWriter_MultipleSegments(int payloadSize, int maxSliceSize) { - var context = new DefaultSerializationContext(); - var origPayload = GetTestBuffer(payloadSize); - - var bufferWriter = context.GetBufferWriter(); - for (int offset = 0; offset < payloadSize; offset += maxSliceSize) + using (var scope = NewDefaultSerializationContextScope()) { - var sliceSize = Math.Min(maxSliceSize, payloadSize - offset); - // we allocate last slice as too big intentionally to test that shrinking works - var dest = bufferWriter.GetSpan(maxSliceSize); + var context = scope.Context; + var origPayload = GetTestBuffer(payloadSize); + + var bufferWriter = context.GetBufferWriter(); + for (int offset = 0; offset < payloadSize; offset += maxSliceSize) + { + var sliceSize = Math.Min(maxSliceSize, payloadSize - offset); + // we allocate last slice as too big intentionally to test that shrinking works + var dest = bufferWriter.GetSpan(maxSliceSize); + + origPayload.AsSpan(offset, sliceSize).CopyTo(dest); + bufferWriter.Advance(sliceSize); + } + context.Complete(); - origPayload.AsSpan(offset, sliceSize).CopyTo(dest); - bufferWriter.Advance(sliceSize); + var nativePayload = context.GetPayload().ToByteArray(); + CollectionAssert.AreEqual(origPayload, nativePayload); } - context.Complete(); - - var nativePayload = context.GetPayload().ToByteArray(); - CollectionAssert.AreEqual(origPayload, nativePayload); - - context.GetPayload().Dispose(); // TODO: do it better.. (use the scope...) } - // AdjustTailSpace(0) if previous tail size is 0.... + [TestCase] + public void ContextIsReusable() + { + using (var scope = NewDefaultSerializationContextScope()) + { + var context = scope.Context; + + var origPayload1 = GetTestBuffer(10); + context.Complete(origPayload1); + CollectionAssert.AreEqual(origPayload1, context.GetPayload().ToByteArray()); - // test that context.Complete() call is required... + context.Reset(); - // BufferWriter.GetMemory... (add refs to the original memory?) + var origPayload2 = GetTestBuffer(20); + + var bufferWriter = context.GetBufferWriter(); + origPayload2.AsSpan().CopyTo(bufferWriter.GetMemory(origPayload2.Length).Span); + bufferWriter.Advance(origPayload2.Length); + CollectionAssert.AreEqual(origPayload2, context.GetPayload().ToByteArray()); - // TODO: set payload and then get IBufferWriter should throw? + context.Reset(); + + // TODO: that's should be a null payload... + CollectionAssert.AreEqual(new byte[0], context.GetPayload().ToByteArray()); + } + } - // TODO: test Reset()... + //test ideas: - // TODO: destroy SliceBufferSafeHandles... (use usagescope...) + // test that context.Complete() call is required... + // set payload with Complete([]) and then get IBufferWriter should throw (because it's been completed already?) + // other ideas: + // AdjustTailSpace(0) if previous tail size is 0... (better for SliceBufferSafeHandle) + private DefaultSerializationContext.UsageScope NewDefaultSerializationContextScope() + { + return new DefaultSerializationContext.UsageScope(new DefaultSerializationContext()); + } private byte[] GetTestBuffer(int length) { From 389d759344a58e8ae2be85623905b11da0b8e969 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 9 Aug 2019 14:19:33 -0700 Subject: [PATCH 275/661] improve doc comments for SerializationContext --- src/csharp/Grpc.Core.Api/SerializationContext.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/csharp/Grpc.Core.Api/SerializationContext.cs b/src/csharp/Grpc.Core.Api/SerializationContext.cs index 79107040411..76f1951b68e 100644 --- a/src/csharp/Grpc.Core.Api/SerializationContext.cs +++ b/src/csharp/Grpc.Core.Api/SerializationContext.cs @@ -28,7 +28,7 @@ namespace Grpc.Core { /// /// Use the byte array as serialized form of current message and mark serialization process as complete. - /// Complete() can only be called once. By calling this method the caller gives up the ownership of the + /// Complete() can only be called once. By calling this method the caller gives up the ownership of the /// payload which must not be accessed afterwards. /// /// the serialized form of current message @@ -38,7 +38,8 @@ namespace Grpc.Core } /// - /// Expose serializer as buffer writer + /// Gets buffer writer that can be used to write the serialized data. Once serialization is finished, + /// Complete() needs to be called. /// public virtual IBufferWriter GetBufferWriter() { @@ -46,7 +47,7 @@ namespace Grpc.Core } /// - /// Complete the payload written so far. + /// Complete the payload written to the buffer writer. Complete() can only be called once. /// public virtual void Complete() { From 891dc61d8e238fa07e5323164bf00189bff42d3f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 9 Aug 2019 14:28:29 -0700 Subject: [PATCH 276/661] move slice memory manager --- .../Grpc.Core/Internal/ReusableSliceBuffer.cs | 41 +-------- .../Grpc.Core/Internal/SliceMemoryManager.cs | 87 +++++++++++++++++++ 2 files changed, 88 insertions(+), 40 deletions(-) create mode 100644 src/csharp/Grpc.Core/Internal/SliceMemoryManager.cs diff --git a/src/csharp/Grpc.Core/Internal/ReusableSliceBuffer.cs b/src/csharp/Grpc.Core/Internal/ReusableSliceBuffer.cs index 078e59e9d1b..eed6ba4ae15 100644 --- a/src/csharp/Grpc.Core/Internal/ReusableSliceBuffer.cs +++ b/src/csharp/Grpc.Core/Internal/ReusableSliceBuffer.cs @@ -101,45 +101,6 @@ namespace Grpc.Core.Internal { Next = next; } - } - - // Allow creating instances of Memory from Slice. - // Represents a chunk of native memory, but doesn't manage its lifetime. - // Instances of this class are reuseable - they can be reset to point to a different memory chunk. - // That is important to make the instances cacheable (rather then creating new instances - // the old ones will be reused to reduce GC pressure). - private class SliceMemoryManager : MemoryManager - { - private Slice slice; - - public void Reset(Slice slice) - { - this.slice = slice; - } - - public void Reset() - { - Reset(new Slice(IntPtr.Zero, 0)); - } - - public override Span GetSpan() - { - return slice.ToSpanUnsafe(); - } - - public override MemoryHandle Pin(int elementIndex = 0) - { - throw new NotSupportedException(); - } - - public override void Unpin() - { - } - - protected override void Dispose(bool disposing) - { - // NOP - } - } + } } } diff --git a/src/csharp/Grpc.Core/Internal/SliceMemoryManager.cs b/src/csharp/Grpc.Core/Internal/SliceMemoryManager.cs new file mode 100644 index 00000000000..342d90df36c --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/SliceMemoryManager.cs @@ -0,0 +1,87 @@ +#region Copyright notice and license + +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using Grpc.Core.Utils; +using System; +using System.Threading; + +using System.Buffers; + +namespace Grpc.Core.Internal +{ + internal class ReusableSliceBuffer + { + public const int MaxCachedSegments = 1024; // ~4MB payload for 4K slices + + readonly SliceSegment[] cachedSegments = new SliceSegment[MaxCachedSegments]; + int populatedSegmentCount; + + public ReadOnlySequence PopulateFrom(IBufferReader bufferReader) + { + populatedSegmentCount = 0; + long offset = 0; + SliceSegment prevSegment = null; + while (bufferReader.TryGetNextSlice(out Slice slice)) + { + // Initialize cached segment if still null or just allocate a new segment if we already reached MaxCachedSegments + var current = populatedSegmentCount < cachedSegments.Length ? cachedSegments[populatedSegmentCount] : new SliceSegment(); + if (current == null) + { + current = cachedSegments[populatedSegmentCount] = new SliceSegment(); + } + + current.Reset(slice, offset); + prevSegment?.SetNext(current); + + populatedSegmentCount ++; + offset += slice.Length; + prevSegment = current; + } + + // Not necessary for ending the ReadOnlySequence, but for making sure we + // don't keep more than MaxCachedSegments alive. + prevSegment?.SetNext(null); + + if (populatedSegmentCount == 0) + { + return ReadOnlySequence.Empty; + } + + var firstSegment = cachedSegments[0]; + var lastSegment = prevSegment; + return new ReadOnlySequence(firstSegment, 0, lastSegment, lastSegment.Memory.Length); + } + + public void Invalidate() + { + if (populatedSegmentCount == 0) + { + return; + } + var segment = cachedSegments[0]; + while (segment != null) + { + segment.Reset(new Slice(IntPtr.Zero, 0), 0); + var nextSegment = (SliceSegment) segment.Next; + segment.SetNext(null); + segment = nextSegment; + } + populatedSegmentCount = 0; + } + } +} From fb5411fba9d91f73814b6c107a268c374ad58721 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 9 Aug 2019 14:30:28 -0700 Subject: [PATCH 277/661] support GetMemory() --- .../Grpc.Core/Internal/SliceBufferSafeHandle.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs index 76a97f4a0a2..0ce37317f1a 100644 --- a/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs @@ -39,6 +39,8 @@ namespace Grpc.Core.Internal private IntPtr tailSpacePtr; private int tailSpaceLen; + private SliceMemoryManager memoryManagerLazy; + private SliceBufferSafeHandle() { } @@ -63,14 +65,20 @@ namespace Grpc.Core.Internal GrpcPreconditions.CheckArgument(tailSpaceLen >= count); tailSpaceLen = tailSpaceLen - count; tailSpacePtr += count; + memoryManagerLazy?.Reset(); } // provides access to the "tail space" of this buffer. // Use GetSpan when possible for better efficiency. public Memory GetMemory(int sizeHint = 0) { - // TODO: implement - throw new NotImplementedException(); + GetSpan(sizeHint); + if (memoryManagerLazy == null) + { + memoryManagerLazy = new SliceMemoryManager(); + } + memoryManagerLazy.Reset(new Slice(tailSpacePtr, tailSpaceLen)); + return memoryManagerLazy.Memory; } // provides access to the "tail space" of this buffer. @@ -97,6 +105,7 @@ namespace Grpc.Core.Internal // deletes all the data in the slice buffer tailSpacePtr = IntPtr.Zero; tailSpaceLen = 0; + memoryManagerLazy?.Reset(); Native.grpcsharp_slice_buffer_reset_and_unref(this); } From 66cd7cbb8fce6136ead7fd05fe79356c2cf072c9 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 9 Aug 2019 14:31:01 -0700 Subject: [PATCH 278/661] improve default serialization context tests --- .../DefaultSerializationContextTest.cs | 23 +++++++++++++------ .../Internal/DefaultSerializationContext.cs | 9 +++++--- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs b/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs index aa7631587be..fcb12ae6656 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs @@ -87,7 +87,7 @@ namespace Grpc.Core.Internal.Tests var bufferWriter = context.GetBufferWriter(); origPayload.AsSpan().CopyTo(bufferWriter.GetSpan(payloadSize)); bufferWriter.Advance(payloadSize); - // TODO: test that call to Complete() is required. + context.Complete(); var nativePayload = context.GetPayload().ToByteArray(); CollectionAssert.AreEqual(origPayload, nativePayload); @@ -109,6 +109,7 @@ namespace Grpc.Core.Internal.Tests var bufferWriter = context.GetBufferWriter(); origPayload.AsSpan().CopyTo(bufferWriter.GetMemory(payloadSize).Span); bufferWriter.Advance(payloadSize); + context.Complete(); var nativePayload = context.GetPayload().ToByteArray(); CollectionAssert.AreEqual(origPayload, nativePayload); @@ -154,6 +155,8 @@ namespace Grpc.Core.Internal.Tests { var context = scope.Context; + Assert.Throws(typeof(NullReferenceException), () => context.GetPayload()); + var origPayload1 = GetTestBuffer(10); context.Complete(origPayload1); CollectionAssert.AreEqual(origPayload1, context.GetPayload().ToByteArray()); @@ -165,20 +168,26 @@ namespace Grpc.Core.Internal.Tests var bufferWriter = context.GetBufferWriter(); origPayload2.AsSpan().CopyTo(bufferWriter.GetMemory(origPayload2.Length).Span); bufferWriter.Advance(origPayload2.Length); + context.Complete(); CollectionAssert.AreEqual(origPayload2, context.GetPayload().ToByteArray()); context.Reset(); - // TODO: that's should be a null payload... - CollectionAssert.AreEqual(new byte[0], context.GetPayload().ToByteArray()); + Assert.Throws(typeof(NullReferenceException), () => context.GetPayload()); } } - //test ideas: - - // test that context.Complete() call is required... + [TestCase] + public void GetBufferWriterThrowsForCompletedContext() + { + using (var scope = NewDefaultSerializationContextScope()) + { + var context = scope.Context; + context.Complete(GetTestBuffer(10)); - // set payload with Complete([]) and then get IBufferWriter should throw (because it's been completed already?) + Assert.Throws(typeof(InvalidOperationException), () => context.GetBufferWriter()); + } + } // other ideas: // AdjustTailSpace(0) if previous tail size is 0... (better for SliceBufferSafeHandle) diff --git a/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs b/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs index 6bf9da56264..4d45b5c684f 100644 --- a/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs +++ b/src/csharp/Grpc.Core/Internal/DefaultSerializationContext.cs @@ -52,6 +52,7 @@ namespace Grpc.Core.Internal /// public override IBufferWriter GetBufferWriter() { + GrpcPreconditions.CheckState(!isComplete); return sliceBuffer; } @@ -67,6 +68,11 @@ namespace Grpc.Core.Internal internal SliceBufferSafeHandle GetPayload() { + if (!isComplete) + { + // mimic the legacy behavior when byte[] was used to represent the payload. + throw new NullReferenceException("No payload was set. Complete() needs to be called before payload can be used."); + } return sliceBuffer; } @@ -95,9 +101,6 @@ namespace Grpc.Core.Internal } public DefaultSerializationContext Context => context; - - // TODO: add Serialize method... - public void Dispose() { context.Reset(); From 532bdf7cd29f613fdfe2184b4c7035398def5353 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 9 Aug 2019 14:35:00 -0700 Subject: [PATCH 279/661] fixup SliceMemoryManager --- .../Grpc.Core/Internal/SliceMemoryManager.cs | 74 +++++++------------ 1 file changed, 26 insertions(+), 48 deletions(-) diff --git a/src/csharp/Grpc.Core/Internal/SliceMemoryManager.cs b/src/csharp/Grpc.Core/Internal/SliceMemoryManager.cs index 342d90df36c..dad2d96bd75 100644 --- a/src/csharp/Grpc.Core/Internal/SliceMemoryManager.cs +++ b/src/csharp/Grpc.Core/Internal/SliceMemoryManager.cs @@ -24,64 +24,42 @@ using System.Buffers; namespace Grpc.Core.Internal { - internal class ReusableSliceBuffer + // Allow creating instances of Memory from Slice. + // Represents a chunk of native memory, but doesn't manage its lifetime. + // Instances of this class are reuseable - they can be reset to point to a different memory chunk. + // That is important to make the instances cacheable (rather then creating new instances + // the old ones will be reused to reduce GC pressure). + internal class SliceMemoryManager : MemoryManager { - public const int MaxCachedSegments = 1024; // ~4MB payload for 4K slices + private Slice slice; - readonly SliceSegment[] cachedSegments = new SliceSegment[MaxCachedSegments]; - int populatedSegmentCount; - - public ReadOnlySequence PopulateFrom(IBufferReader bufferReader) + public void Reset(Slice slice) { - populatedSegmentCount = 0; - long offset = 0; - SliceSegment prevSegment = null; - while (bufferReader.TryGetNextSlice(out Slice slice)) - { - // Initialize cached segment if still null or just allocate a new segment if we already reached MaxCachedSegments - var current = populatedSegmentCount < cachedSegments.Length ? cachedSegments[populatedSegmentCount] : new SliceSegment(); - if (current == null) - { - current = cachedSegments[populatedSegmentCount] = new SliceSegment(); - } - - current.Reset(slice, offset); - prevSegment?.SetNext(current); + this.slice = slice; + } - populatedSegmentCount ++; - offset += slice.Length; - prevSegment = current; - } + public void Reset() + { + Reset(new Slice(IntPtr.Zero, 0)); + } - // Not necessary for ending the ReadOnlySequence, but for making sure we - // don't keep more than MaxCachedSegments alive. - prevSegment?.SetNext(null); + public override Span GetSpan() + { + return slice.ToSpanUnsafe(); + } - if (populatedSegmentCount == 0) - { - return ReadOnlySequence.Empty; - } + public override MemoryHandle Pin(int elementIndex = 0) + { + throw new NotSupportedException(); + } - var firstSegment = cachedSegments[0]; - var lastSegment = prevSegment; - return new ReadOnlySequence(firstSegment, 0, lastSegment, lastSegment.Memory.Length); + public override void Unpin() + { } - public void Invalidate() + protected override void Dispose(bool disposing) { - if (populatedSegmentCount == 0) - { - return; - } - var segment = cachedSegments[0]; - while (segment != null) - { - segment.Reset(new Slice(IntPtr.Zero, 0), 0); - var nextSegment = (SliceSegment) segment.Next; - segment.SetNext(null); - segment = nextSegment; - } - populatedSegmentCount = 0; + // NOP } } } From 79c9aa081d7ee9cc6368edc66be8428fe54f0dc6 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 9 Aug 2019 14:38:45 -0700 Subject: [PATCH 280/661] add slice buffer safe handle tests --- .../Internal/SliceBufferSafeHandleTest.cs | 38 +++++++++++++++++++ src/csharp/tests.json | 1 + 2 files changed, 39 insertions(+) create mode 100644 src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs diff --git a/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs b/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs new file mode 100644 index 00000000000..563187948d2 --- /dev/null +++ b/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs @@ -0,0 +1,38 @@ +#region Copyright notice and license + +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using Grpc.Core; +using Grpc.Core.Internal; +using Grpc.Core.Utils; +using NUnit.Framework; + +namespace Grpc.Core.Internal.Tests +{ + public class SliceBufferSafeHandleTest + { + [TestCase] + public void BasicTest() + { + + } + + // other ideas: + // AdjustTailSpace(0) if previous tail size is 0... (better for SliceBufferSafeHandle) + } +} diff --git a/src/csharp/tests.json b/src/csharp/tests.json index 75bda4c25ea..e18266ab9d7 100644 --- a/src/csharp/tests.json +++ b/src/csharp/tests.json @@ -13,6 +13,7 @@ "Grpc.Core.Internal.Tests.FakeBufferReaderManagerTest", "Grpc.Core.Internal.Tests.MetadataArraySafeHandleTest", "Grpc.Core.Internal.Tests.ReusableSliceBufferTest", + "Grpc.Core.Internal.Tests.SliceBufferSafeHandleTest", "Grpc.Core.Internal.Tests.SliceTest", "Grpc.Core.Internal.Tests.TimespecTest", "Grpc.Core.Internal.Tests.WellKnownStringsTest", From ec14872fc283ac36b6898ab1f9d0fad758d6329e Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 9 Aug 2019 14:48:36 -0700 Subject: [PATCH 281/661] address TODO" --- src/csharp/Grpc.Core.Tests/ContextualMarshallerTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/ContextualMarshallerTest.cs b/src/csharp/Grpc.Core.Tests/ContextualMarshallerTest.cs index 99f92e12628..dbceb27baf9 100644 --- a/src/csharp/Grpc.Core.Tests/ContextualMarshallerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ContextualMarshallerTest.cs @@ -52,8 +52,8 @@ namespace Grpc.Core.Tests } if (str == "SERIALIZE_TO_NULL") { - // TODO: test for not calling complete Complete() (that resulted in null payload before...) - // TODO: test for calling Complete(null byte array) + // for contextual marshaller, serializing to null payload corresponds + // to not calling the Complete() method in the serializer. return; } var bytes = System.Text.Encoding.UTF8.GetBytes(str); From ded29be883e888081174a9be88de4ce2618303af Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 9 Aug 2019 15:43:57 -0700 Subject: [PATCH 282/661] slice buffer improvements --- .../Internal/SliceBufferSafeHandleTest.cs | 95 ++++++++++++++++++- .../Internal/SliceBufferSafeHandle.cs | 33 +++++-- 2 files changed, 115 insertions(+), 13 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs b/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs index 563187948d2..61c817dafc9 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs @@ -27,12 +27,99 @@ namespace Grpc.Core.Internal.Tests public class SliceBufferSafeHandleTest { [TestCase] - public void BasicTest() + public void Complete_EmptyBuffer() { - + using (var sliceBuffer = SliceBufferSafeHandle.Create()) + { + sliceBuffer.Complete(); + CollectionAssert.AreEqual(new byte[0], sliceBuffer.ToByteArray()); + } } - // other ideas: - // AdjustTailSpace(0) if previous tail size is 0... (better for SliceBufferSafeHandle) + [TestCase] + public void Complete_TailSizeZero() + { + using (var sliceBuffer = SliceBufferSafeHandle.Create()) + { + var origPayload = GetTestBuffer(10); + origPayload.AsSpan().CopyTo(sliceBuffer.GetSpan(origPayload.Length)); + sliceBuffer.Advance(origPayload.Length); + // call complete where tail space size == 0 + sliceBuffer.Complete(); + CollectionAssert.AreEqual(origPayload, sliceBuffer.ToByteArray()); + } + } + + [TestCase] + public void Complete_TruncateTailSpace() + { + using (var sliceBuffer = SliceBufferSafeHandle.Create()) + { + var origPayload = GetTestBuffer(10); + var dest = sliceBuffer.GetSpan(origPayload.Length + 10); + origPayload.AsSpan().CopyTo(dest); + sliceBuffer.Advance(origPayload.Length); + // call complete where tail space needs to be truncated + sliceBuffer.Complete(); + CollectionAssert.AreEqual(origPayload, sliceBuffer.ToByteArray()); + } + } + + [TestCase] + public void SliceBufferIsReusable() + { + using (var sliceBuffer = SliceBufferSafeHandle.Create()) + { + var origPayload = GetTestBuffer(10); + origPayload.AsSpan().CopyTo(sliceBuffer.GetSpan(origPayload.Length)); + sliceBuffer.Advance(origPayload.Length); + sliceBuffer.Complete(); + CollectionAssert.AreEqual(origPayload, sliceBuffer.ToByteArray()); + + sliceBuffer.Reset(); + + var origPayload2 = GetTestBuffer(20); + origPayload2.AsSpan().CopyTo(sliceBuffer.GetSpan(origPayload2.Length)); + sliceBuffer.Advance(origPayload2.Length); + sliceBuffer.Complete(); + CollectionAssert.AreEqual(origPayload2, sliceBuffer.ToByteArray()); + + sliceBuffer.Reset(); + + CollectionAssert.AreEqual(new byte[0], sliceBuffer.ToByteArray()); + } + } + + [TestCase] + public void SliceBuffer_SizeHintZero() + { + using (var sliceBuffer = SliceBufferSafeHandle.Create()) + { + var destSpan = sliceBuffer.GetSpan(0); + Assert.IsTrue(destSpan.Length > 0); // some non-zero size memory is made available + + sliceBuffer.Reset(); + + var destMemory = sliceBuffer.GetMemory(0); + Assert.IsTrue(destMemory.Length > 0); + } + } + + // Advance() - multiple chunks... + + // other TODOS: + + // -- provide a null instance of SliceBufferSafeHandle + //-- order of UnsafeSerialize in AsyncCall methods... + + private byte[] GetTestBuffer(int length) + { + var testBuffer = new byte[length]; + for (int i = 0; i < testBuffer.Length; i++) + { + testBuffer[i] = (byte) i; + } + return testBuffer; + } } } diff --git a/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs index 0ce37317f1a..77c14f1d9fb 100644 --- a/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs @@ -31,6 +31,7 @@ namespace Grpc.Core.Internal /// internal class SliceBufferSafeHandle : SafeHandleZeroIsInvalid, IBufferWriter { + const int DefaultTailSpaceSize = 4096; // default buffer to allocate if no size hint is provided static readonly NativeMethods Native = NativeMethods.Get(); static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); @@ -72,7 +73,7 @@ namespace Grpc.Core.Internal // Use GetSpan when possible for better efficiency. public Memory GetMemory(int sizeHint = 0) { - GetSpan(sizeHint); + EnsureBufferSpace(sizeHint); if (memoryManagerLazy == null) { memoryManagerLazy = new SliceMemoryManager(); @@ -84,13 +85,7 @@ namespace Grpc.Core.Internal // provides access to the "tail space" of this buffer. public unsafe Span GetSpan(int sizeHint = 0) { - GrpcPreconditions.CheckArgument(sizeHint >= 0); - if (tailSpaceLen < sizeHint) - { - // TODO: should we ignore the hint sometimes when - // available tail space is close enough to the sizeHint? - AdjustTailSpace(sizeHint); - } + EnsureBufferSpace(sizeHint); return new Span(tailSpacePtr.ToPointer(), tailSpaceLen); } @@ -135,7 +130,27 @@ namespace Grpc.Core.Internal return result; } - // Gets data of server_rpc_new completion. + private void EnsureBufferSpace(int sizeHint) + { + GrpcPreconditions.CheckArgument(sizeHint >= 0); + if (sizeHint == 0) + { + // if no hint is provided, keep the available space within some "reasonable" boundaries. + // This is quite a naive approach which could use some fine-tuning, but currently in most case we know + // the required buffer size in advance anyway, so this approach seems good enough for now. + if (tailSpaceLen < DefaultTailSpaceSize /2 ) + { + AdjustTailSpace(DefaultTailSpaceSize); + } + } + else if (tailSpaceLen < sizeHint) + { + // if hint is provided, always make sure we provide at least that much space + AdjustTailSpace(sizeHint); + } + } + + // make sure there's exactly requestedSize bytes of continguous buffer space at the end of this slice buffer private void AdjustTailSpace(int requestedSize) { GrpcPreconditions.CheckArgument(requestedSize >= 0); From 127d69383abc0c442625038be6d57522b35f20c6 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 9 Aug 2019 16:00:41 -0700 Subject: [PATCH 283/661] better tests --- .../Internal/SliceBufferSafeHandleTest.cs | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs b/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs index 61c817dafc9..5feb9a711da 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs @@ -105,10 +105,52 @@ namespace Grpc.Core.Internal.Tests } } - // Advance() - multiple chunks... + [TestCase(0)] + [TestCase(1000)] + public void SliceBuffer_BigPayload(int sizeHint) + { + using (var sliceBuffer = SliceBufferSafeHandle.Create()) + { + var bigPayload = GetTestBuffer(4 * 1024 * 1024); + + int offset = 0; + while (offset < bigPayload.Length) + { + var destSpan = sliceBuffer.GetSpan(sizeHint); + int copySize = Math.Min(destSpan.Length, bigPayload.Length - offset); + bigPayload.AsSpan(offset, copySize).CopyTo(destSpan); + sliceBuffer.Advance(copySize); + offset += copySize; + } + + sliceBuffer.Complete(); + CollectionAssert.AreEqual(bigPayload, sliceBuffer.ToByteArray()); + } + } - // other TODOS: + [TestCase] + public void SliceBuffer_NegativeSizeHint() + { + using (var sliceBuffer = SliceBufferSafeHandle.Create()) + { + Assert.Throws(typeof(ArgumentException), () => sliceBuffer.GetSpan(-1)); + Assert.Throws(typeof(ArgumentException), () => sliceBuffer.GetMemory(-1)); + } + } + + [TestCase] + public void SliceBuffer_AdvanceBadArg() + { + using (var sliceBuffer = SliceBufferSafeHandle.Create()) + { + int size = 10; + var destSpan = sliceBuffer.GetSpan(size); + Assert.Throws(typeof(ArgumentException), () => sliceBuffer.Advance(size + 1)); + Assert.Throws(typeof(ArgumentException), () => sliceBuffer.Advance(-1)); + } + } + // TODO: other TODOs // -- provide a null instance of SliceBufferSafeHandle //-- order of UnsafeSerialize in AsyncCall methods... From 0f1a8a84b5ae12a3a201a0d477614073e448e85a Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Fri, 9 Aug 2019 16:51:52 -0700 Subject: [PATCH 284/661] Don't use : prefix --- src/proto/grpc/lb/v2/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/proto/grpc/lb/v2/BUILD b/src/proto/grpc/lb/v2/BUILD index 0b46b2892ed..e47f170e14b 100644 --- a/src/proto/grpc/lb/v2/BUILD +++ b/src/proto/grpc/lb/v2/BUILD @@ -37,5 +37,5 @@ grpc_proto_library( ], has_services = True, well_known_protos = True, - deps = [":eds_for_test_proto"], + deps = ["eds_for_test_proto"], ) From 47d95ef26626a81cfe2b96acf372764a08e12b36 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 9 Aug 2019 12:45:08 -0700 Subject: [PATCH 285/661] address comments --- gRPC.podspec | 6 +++-- src/compiler/objective_c_generator.cc | 2 +- src/objective-c/BUILD | 3 +-- src/objective-c/GRPCClient/GRPCCallLegacy.m | 9 +++---- src/objective-c/GRPCClient/GRPCInterceptor.m | 5 +--- .../GRPCClient/private/GRPCCore/GRPCChannel.m | 2 +- .../private/GRPCCore/GRPCChannelPool.m | 1 - .../GRPCClient/private/GRPCCore/GRPCHost.m | 11 ++++++-- .../GRPCClient/private/GRPCCore/version.h | 25 ------------------- .../GRPCClient/{private => }/version.h | 2 +- .../tests/InteropTests/InteropTestsLocalSSL.m | 4 --- src/objective-c/tests/UnitTests/APIv2Tests.m | 2 +- .../tests/UnitTests/GRPCClientTests.m | 3 +-- templates/gRPC.podspec.template | 6 +++-- .../{private => }/version.h.template | 2 +- 15 files changed, 28 insertions(+), 55 deletions(-) delete mode 100644 src/objective-c/GRPCClient/private/GRPCCore/version.h rename src/objective-c/GRPCClient/{private => }/version.h (96%) rename templates/src/objective-c/GRPCClient/{private => }/version.h.template (96%) diff --git a/gRPC.podspec b/gRPC.podspec index f329f3b3333..a44f207ed54 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -77,7 +77,8 @@ Pod::Spec.new do |s| 'src/objective-c/GRPCClient/GRPCCallOptions.h', 'src/objective-c/GRPCClient/GRPCInterceptor.h', 'src/objective-c/GRPCClient/GRPCTransport.h', - 'src/objective-c/GRPCClient/GRPCDispatchable.h' + 'src/objective-c/GRPCClient/GRPCDispatchable.h', + 'src/objective-c/GRPCClient/version.h' ss.source_files = 'src/objective-c/GRPCClient/GRPCCall.h', 'src/objective-c/GRPCClient/GRPCCall.m', @@ -92,7 +93,8 @@ Pod::Spec.new do |s| 'src/objective-c/GRPCClient/GRPCTransport.m', 'src/objective-c/GRPCClient/internal/*.h', 'src/objective-c/GRPCClient/private/GRPCTransport+Private.h', - 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m' + 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m', + 'src/objective-c/GRPCClient/version.h' ss.dependency "#{s.name}/Interface-Legacy", version end diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 122ea3c3b69..ed262308aba 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -297,7 +297,7 @@ void PrintMethodImplementations(Printer* printer, "that have been deprecated. They do not\n" " * recognize call options provided in the initializer. Using " "the v2 protocol is recommended.\n" - " */\n\n"); + " */\n"); printer.Print(vars, "@protocol $service_class$ \n\n"); for (int i = 0; i < service->method_count(); i++) { PrintMethodDeclarations(&printer, service->method(i)); diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index 2af1d85f290..322c84bb9bb 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -28,7 +28,6 @@ grpc_objc_library( name = "rx_library_headers", hdrs = glob([ "RxLibrary/*.h", - "RxLibrary/transformations/*.h", ]), includes = ["."], ) @@ -37,7 +36,6 @@ grpc_objc_library( name = "rx_library", srcs = glob([ "RxLibrary/*.m", - "RxLibrary/transformations/*.m", ]), includes = ["."], deps = [ @@ -83,6 +81,7 @@ grpc_objc_library( "GRPCClient/GRPCTransport.h", "GRPCClient/GRPCDispatchable.h", "GRPCClient/internal/GRPCCallOptions+Internal.h", + "GRPCClient/version.h", ], srcs = [ "GRPCClient/GRPCCall.m", diff --git a/src/objective-c/GRPCClient/GRPCCallLegacy.m b/src/objective-c/GRPCClient/GRPCCallLegacy.m index b1220999741..d06048c3a89 100644 --- a/src/objective-c/GRPCClient/GRPCCallLegacy.m +++ b/src/objective-c/GRPCClient/GRPCCallLegacy.m @@ -18,7 +18,6 @@ #import "GRPCCallLegacy.h" -#import "GRPCCall+Cronet.h" #import "GRPCCall+OAuth2.h" #import "GRPCCallOptions.h" #import "GRPCTypes.h" @@ -588,13 +587,11 @@ static NSString *const kBearerPrefix = @"Bearer "; // retain cycle. _retainSelf = self; + // If _callOptions is nil, people must be using the deprecated v1 interface. In this case, + // generate the call options from the corresponding GRPCHost configs and apply other options + // that are not covered by GRPCHost. if (_callOptions == nil) { GRPCMutableCallOptions *callOptions = [[GRPCHost callOptionsForHost:_host] mutableCopy]; - // By v1 API logic, insecure channel precedes Cronet channel; Cronet channel preceeds default - // channel. We maintain backwards compatibility here with v1 API by keep this logic. - if (callOptions.transport == GRPCTransportTypeDefault && [GRPCCall isUsingCronet]) { - callOptions.transport = gGRPCCoreCronetId; - } if (_serverName.length != 0) { callOptions.serverAuthority = _serverName; } diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.m b/src/objective-c/GRPCClient/GRPCInterceptor.m index b18f7550260..9a41c395148 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.m +++ b/src/objective-c/GRPCClient/GRPCInterceptor.m @@ -174,10 +174,7 @@ /** Forward initial metadata to the previous interceptor in the chain */ - (void)forwardPreviousInterceptorWithInitialMetadata:(NSDictionary *)initialMetadata { - if (_nextInterceptor == nil && !_shutDown) { - [self createNextInterceptor]; - } - if (_nextInterceptor == nil) { + if (_previousInterceptor == nil) { return; } id copiedPreviousInterceptor = _previousInterceptor; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m index e0fd4c18e78..cd2b4313acd 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m @@ -29,10 +29,10 @@ #import "GRPCCoreFactory.h" #import "GRPCInsecureChannelFactory.h" #import "GRPCSecureChannelFactory.h" -#import "version.h" #import #import +#import @implementation GRPCChannelConfiguration diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m index faabb3ae336..92f52e67b75 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m @@ -27,7 +27,6 @@ #import "GRPCInsecureChannelFactory.h" #import "GRPCSecureChannelFactory.h" #import "GRPCWrappedCall.h" -#import "version.h" #include diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m index 98f46062786..04f91e494a7 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m @@ -31,7 +31,6 @@ #import "GRPCCompletionQueue.h" #import "GRPCSecureChannelFactory.h" #import "NSDictionary+GRPC.h" -#import "version.h" NS_ASSUME_NONNULL_BEGIN @@ -115,6 +114,8 @@ static NSMutableDictionary *gHostCache; options.hostNameOverride = _hostNameOverride; if (_transportType == GRPCTransportTypeInsecure) { options.transport = GRPCDefaultTransportImplList.core_insecure; + } else if ([GRPCCall isUsingCronet]){ + options.transport = gGRPCCoreCronetId; } else { options.transport = GRPCDefaultTransportImplList.core_secure; } @@ -132,9 +133,15 @@ static NSMutableDictionary *gHostCache; GRPCCallOptions *callOptions = nil; @synchronized(gHostCache) { - callOptions = [gHostCache[host] callOptions]; + GRPCHost *hostConfig = gHostCache[host]; + if (hostConfig == nil) { + hostConfig = [GRPCHost hostWithAddress:host]; + } + callOptions = [hostConfig callOptions]; } + NSAssert(callOptions != nil, @"Unable to create call options object"); if (callOptions == nil) { + NSLog(@"Unable to create call options object"); callOptions = [[GRPCCallOptions alloc] init]; } return callOptions; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/version.h b/src/objective-c/GRPCClient/private/GRPCCore/version.h deleted file mode 100644 index 3b248db0148..00000000000 --- a/src/objective-c/GRPCClient/private/GRPCCore/version.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// This file is autogenerated from a template file. Please make -// modifications to -// `templates/src/objective-c/GRPCClient/private/version.h.template` -// instead. This file can be regenerated from the template by running -// `tools/buildgen/generate_projects.sh`. - -#define GRPC_OBJC_VERSION_STRING @"1.23.0-dev" diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/version.h similarity index 96% rename from src/objective-c/GRPCClient/private/version.h rename to src/objective-c/GRPCClient/version.h index fc6982c55d6..64781185ac7 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/version.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015 gRPC authors. + * Copyright 2019 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m index 1c1c1ddeb1e..30d8f4c34af 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m +++ b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m @@ -57,10 +57,6 @@ static int32_t kLocalInteropServerOverhead = 10; return kLocalInteropServerOverhead; // bytes } -+ (GRPCTransportType)transportType { - return GRPCTransportTypeDefault; -} - + (GRPCTransportId)transport { return GRPCDefaultTransportImplList.core_secure; } diff --git a/src/objective-c/tests/UnitTests/APIv2Tests.m b/src/objective-c/tests/UnitTests/APIv2Tests.m index 86d4e8b3619..6d99f3be44f 100644 --- a/src/objective-c/tests/UnitTests/APIv2Tests.m +++ b/src/objective-c/tests/UnitTests/APIv2Tests.m @@ -17,6 +17,7 @@ */ #import +#import #import #import #import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" @@ -24,7 +25,6 @@ #include #include -#import "../version.h" // The server address is derived from preprocessor macro, which is // in turn derived from environment variable of the same name. diff --git a/src/objective-c/tests/UnitTests/GRPCClientTests.m b/src/objective-c/tests/UnitTests/GRPCClientTests.m index 3d144c33b06..5dbea09ca85 100644 --- a/src/objective-c/tests/UnitTests/GRPCClientTests.m +++ b/src/objective-c/tests/UnitTests/GRPCClientTests.m @@ -25,6 +25,7 @@ #import #import #import +#import #import #import #import @@ -33,8 +34,6 @@ #include -#import "../version.h" - #define TEST_TIMEOUT 16 // The server address is derived from preprocessor macro, which is diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index 6bea89d93a4..a9b6dc63738 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -79,7 +79,8 @@ 'src/objective-c/GRPCClient/GRPCCallOptions.h', 'src/objective-c/GRPCClient/GRPCInterceptor.h', 'src/objective-c/GRPCClient/GRPCTransport.h', - 'src/objective-c/GRPCClient/GRPCDispatchable.h' + 'src/objective-c/GRPCClient/GRPCDispatchable.h', + 'src/objective-c/GRPCClient/version.h' ss.source_files = 'src/objective-c/GRPCClient/GRPCCall.h', 'src/objective-c/GRPCClient/GRPCCall.m', @@ -94,7 +95,8 @@ 'src/objective-c/GRPCClient/GRPCTransport.m', 'src/objective-c/GRPCClient/internal/*.h', 'src/objective-c/GRPCClient/private/GRPCTransport+Private.h', - 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m' + 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m', + 'src/objective-c/GRPCClient/version.h' ss.dependency "#{s.name}/Interface-Legacy", version end diff --git a/templates/src/objective-c/GRPCClient/private/version.h.template b/templates/src/objective-c/GRPCClient/version.h.template similarity index 96% rename from templates/src/objective-c/GRPCClient/private/version.h.template rename to templates/src/objective-c/GRPCClient/version.h.template index 22b3bb25d48..5623dddb502 100644 --- a/templates/src/objective-c/GRPCClient/private/version.h.template +++ b/templates/src/objective-c/GRPCClient/version.h.template @@ -2,7 +2,7 @@ --- | /* * - * Copyright 2015 gRPC authors. + * Copyright 2019 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 1291ece848880ed64c712c557dd1d03430beeb1c Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Fri, 9 Aug 2019 19:55:11 -0700 Subject: [PATCH 286/661] Add drop in xds policy --- .../client_channel/lb_policy/xds/xds.cc | 250 ++++++---- .../lb_policy/xds/xds_client_stats.cc | 2 +- .../lb_policy/xds/xds_client_stats.h | 2 +- .../lb_policy/xds/xds_load_balancer_api.cc | 68 +++ .../lb_policy/xds/xds_load_balancer_api.h | 44 +- test/cpp/end2end/xds_end2end_test.cc | 438 +++++++++++++++--- 6 files changed, 648 insertions(+), 156 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 279f480946f..4f119edefce 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -405,7 +405,10 @@ class XdsLb : public LoadBalancingPolicy { // previous value in the vector and is 0 for the first element. using PickerList = InlinedVector>, 1>; - explicit Picker(PickerList pickers) : pickers_(std::move(pickers)) {} + Picker(RefCountedPtr xds_policy, PickerList pickers) + : xds_policy_(std::move(xds_policy)), + pickers_(std::move(pickers)), + drop_config_(xds_policy_->drop_config_) {} PickResult Pick(PickArgs args) override; @@ -413,7 +416,9 @@ class XdsLb : public LoadBalancingPolicy { // Calls the picker of the locality that the key falls within. PickResult PickFromLocality(const uint32_t key, PickArgs args); + RefCountedPtr xds_policy_; PickerList pickers_; + RefCountedPtr drop_config_; }; class FallbackHelper : public ChannelControlHelper { @@ -458,6 +463,14 @@ class XdsLb : public LoadBalancingPolicy { void ResetBackoffLocked(); void Orphan() override; + grpc_connectivity_state connectivity_state() const { + return connectivity_state_; + } + uint32_t locality_weight() const { return locality_weight_; } + RefCountedPtr picker_wrapper() const { + return picker_wrapper_; + } + private: class Helper : public ChannelControlHelper { public: @@ -500,15 +513,19 @@ class XdsLb : public LoadBalancingPolicy { uint32_t locality_weight_; }; + explicit LocalityMap(XdsLb* xds_policy) : xds_policy_(xds_policy) {} + void UpdateLocked(const XdsLocalityList& locality_list, LoadBalancingPolicy::Config* child_policy_config, const grpc_channel_args* args, XdsLb* parent); + void UpdateXdsPickerLocked(); void ShutdownLocked(); void ResetBackoffLocked(); private: void PruneLocalities(const XdsLocalityList& locality_list); + XdsLb* xds_policy_; Map, OrphanablePtr, XdsLocalityName::Less> map_; @@ -594,6 +611,9 @@ class XdsLb : public LoadBalancingPolicy { // the current one when new localities in the pending map are ready // to accept connections + // The config for dropping calls. + RefCountedPtr drop_config_; + // The stats for client-side load reporting. XdsClientStats client_stats_; }; @@ -637,7 +657,14 @@ void XdsLb::PickerWrapper::RecordCallCompletion( // XdsLb::PickResult XdsLb::Picker::Pick(PickArgs args) { - // TODO(roth): Add support for drop handling. + // Handle drop. + const UniquePtr* drop_category; + if (drop_config_->ShouldDrop(&drop_category)) { + xds_policy_->client_stats_.AddCallDropped(*drop_category); + PickResult result; + result.type = PickResult::PICK_COMPLETE; + return result; + } // Generate a random number in [0, total weight). const uint32_t key = rand() % pickers_[pickers_.size() - 1].first; // Forward pick to whichever locality maps to the range in which the @@ -1092,12 +1119,12 @@ void XdsLb::LbChannelState::EdsCallState::OnResponseReceivedLocked( GRPC_ERROR_UNREF(parse_error); return; } - if (update.locality_list.empty()) { + if (update.locality_list.empty() && !update.drop_all) { char* response_slice_str = grpc_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX); gpr_log(GPR_ERROR, "[xdslb %p] EDS response '%s' doesn't contain any valid locality " - "update. Ignoring.", + "but doesn't require to drop all calls. Ignoring.", xdslb_policy, response_slice_str); gpr_free(response_slice_str); return; @@ -1105,8 +1132,11 @@ void XdsLb::LbChannelState::EdsCallState::OnResponseReceivedLocked( eds_calld->seen_response_ = true; if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { gpr_log(GPR_INFO, - "[xdslb %p] EDS response with %" PRIuPTR " localities received", - xdslb_policy, update.locality_list.size()); + "[xdslb %p] EDS response with %" PRIuPTR + " localities and %" PRIuPTR + " drop categories received (drop_all=%d)", + xdslb_policy, update.locality_list.size(), + update.drop_config->drop_category_list().size(), update.drop_all); for (size_t i = 0; i < update.locality_list.size(); ++i) { const XdsLocalityInfo& locality = update.locality_list[i]; gpr_log(GPR_INFO, @@ -1127,8 +1157,17 @@ void XdsLb::LbChannelState::EdsCallState::OnResponseReceivedLocked( gpr_free(ipport); } } + for (size_t i = 0; i < update.drop_config->drop_category_list().size(); + ++i) { + const XdsDropConfig::DropCategory& drop_category = + update.drop_config->drop_category_list()[i]; + gpr_log(GPR_INFO, + "[xdslb %p] Drop category %s has drop rate %d per million", + xdslb_policy, drop_category.name.get(), + drop_category.parts_per_million); + } } - // Pending LB channel receives a serverlist; promote it. + // Pending LB channel receives a response; promote it. // Note that this call can't be on a discarded pending channel, because // such channels don't have any current call but we have checked this call // is a current call. @@ -1147,23 +1186,27 @@ void XdsLb::LbChannelState::EdsCallState::OnResponseReceivedLocked( // load reporting. LrsCallState* lrs_calld = lb_chand->lrs_calld_->lb_calld(); if (lrs_calld != nullptr) lrs_calld->MaybeStartReportingLocked(); - // Ignore identical update. + // If the balancer tells us to drop all the calls, we should exit fallback + // mode immediately. + if (update.drop_all) xdslb_policy->MaybeExitFallbackMode(); + // Update the drop config. + const bool drop_config_changed = + xdslb_policy->drop_config_ == nullptr || + *xdslb_policy->drop_config_ != *update.drop_config; + xdslb_policy->drop_config_ = std::move(update.drop_config); + // Ignore identical locality update. if (xdslb_policy->locality_list_ == update.locality_list) { if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { gpr_log(GPR_INFO, - "[xdslb %p] Incoming server list identical to current, " - "ignoring.", - xdslb_policy); + "[xdslb %p] Incoming locality list identical to current, " + "ignoring. (drop_config_changed=%d)", + xdslb_policy, drop_config_changed); + } + if (drop_config_changed) { + xdslb_policy->locality_map_.UpdateXdsPickerLocked(); } return; } - // If the balancer tells us to drop all the calls, we should exit fallback - // mode immediately. - // TODO(juanlishen): When we add EDS drop, we should change to check - // drop_percentage. - if (update.locality_list[0].serverlist.empty()) { - xdslb_policy->MaybeExitFallbackMode(); - } // Update the locality list. xdslb_policy->locality_list_ = std::move(update.locality_list); // Update the locality map. @@ -1661,7 +1704,8 @@ grpc_channel_args* BuildBalancerChannelArgs(const grpc_channel_args* args) { // ctor and dtor // -XdsLb::XdsLb(Args args) : LoadBalancingPolicy(std::move(args)) { +XdsLb::XdsLb(Args args) + : LoadBalancingPolicy(std::move(args)), locality_map_(this) { // Record server name. const grpc_arg* arg = grpc_channel_args_find(args.args, GRPC_ARG_SERVER_URI); const char* server_uri = grpc_channel_arg_get_string(arg); @@ -2032,6 +2076,91 @@ void XdsLb::LocalityMap::UpdateLocked( PruneLocalities(locality_list); } +void XdsLb::LocalityMap::UpdateXdsPickerLocked() { + // Construct a new xds picker which maintains a map of all locality pickers + // that are ready. Each locality is represented by a portion of the range + // proportional to its weight, such that the total range is the sum of the + // weights of all localities. + uint32_t end = 0; + size_t num_connecting = 0; + size_t num_idle = 0; + size_t num_transient_failures = 0; + Picker::PickerList pickers; + for (auto& p : map_) { + // TODO(juanlishen): We should prune a locality (and kill its stats) after + // we know we won't pick from it. We need to improve our update logic to + // make that easier. Consider the following situation: the current map has + // two READY localities A and B, and the update only contains B with the + // same addresses as before. Without the following hack, we will generate + // the same picker containing A and B because we haven't pruned A when the + // update happens. Remove the for loop below once we implement the locality + // map update. + bool in_locality_list = false; + for (size_t i = 0; i < xds_policy_->locality_list_.size(); ++i) { + if (*xds_policy_->locality_list_[i].locality_name == *p.first) { + in_locality_list = true; + break; + } + } + if (!in_locality_list) continue; + const LocalityEntry* entry = p.second.get(); + switch (entry->connectivity_state()) { + case GRPC_CHANNEL_READY: { + end += entry->locality_weight(); + pickers.push_back(MakePair(end, entry->picker_wrapper())); + break; + } + case GRPC_CHANNEL_CONNECTING: { + num_connecting++; + break; + } + case GRPC_CHANNEL_IDLE: { + num_idle++; + break; + } + case GRPC_CHANNEL_TRANSIENT_FAILURE: { + num_transient_failures++; + break; + } + default: { + gpr_log(GPR_ERROR, "Invalid locality connectivity state - %d", + entry->connectivity_state()); + } + } + } + // Pass on the constructed xds picker if it has any ready pickers in their map + // otherwise pass a QueuePicker if any of the locality pickers are in a + // connecting or idle state, finally return a transient failure picker if all + // locality pickers are in transient failure. + if (!pickers.empty()) { + xds_policy_->channel_control_helper()->UpdateState( + GRPC_CHANNEL_READY, + UniquePtr( + New(xds_policy_->Ref(DEBUG_LOCATION, "XdsLb+Picker"), + std::move(pickers)))); + } else if (num_connecting > 0) { + xds_policy_->channel_control_helper()->UpdateState( + GRPC_CHANNEL_CONNECTING, + UniquePtr( + New(xds_policy_->Ref(DEBUG_LOCATION, "QueuePicker")))); + } else if (num_idle > 0) { + xds_policy_->channel_control_helper()->UpdateState( + GRPC_CHANNEL_IDLE, + UniquePtr( + New(xds_policy_->Ref(DEBUG_LOCATION, "QueuePicker")))); + } else { + GPR_ASSERT(num_transient_failures == + xds_policy_->locality_map_.map_.size()); + grpc_error* error = + grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "connections to all localities failing"), + GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE); + xds_policy_->channel_control_helper()->UpdateState( + GRPC_CHANNEL_TRANSIENT_FAILURE, + UniquePtr(New(error))); + } +} + void XdsLb::LocalityMap::ShutdownLocked() { map_.clear(); } void XdsLb::LocalityMap::ResetBackoffLocked() { @@ -2326,87 +2455,8 @@ void XdsLb::LocalityMap::LocalityEntry::Helper::UpdateState( std::move(picker), entry_->parent_->client_stats_.FindLocalityStats(entry_->name_)); entry_->connectivity_state_ = state; - // Construct a new xds picker which maintains a map of all locality pickers - // that are ready. Each locality is represented by a portion of the range - // proportional to its weight, such that the total range is the sum of the - // weights of all localities - uint32_t end = 0; - size_t num_connecting = 0; - size_t num_idle = 0; - size_t num_transient_failures = 0; - Picker::PickerList pickers; - for (auto& p : entry_->parent_->locality_map_.map_) { - // TODO(juanlishen): We should prune a locality (and kill its stats) after - // we know we won't pick from it. We need to improve our update logic to - // make that easier. Consider the following situation: the current map has - // two READY localities A and B, and the update only contains B with the - // same addresses as before. Without the following hack, we will generate - // the same picker containing A and B because we haven't pruned A when the - // update happens. Remove the for loop below once we implement the locality - // map update. - bool in_locality_list = false; - for (size_t i = 0; i < entry_->parent_->locality_list_.size(); ++i) { - if (*entry_->parent_->locality_list_[i].locality_name == *p.first) { - in_locality_list = true; - break; - } - } - if (!in_locality_list) continue; - const LocalityEntry* entry = p.second.get(); - grpc_connectivity_state connectivity_state = entry->connectivity_state_; - switch (connectivity_state) { - case GRPC_CHANNEL_READY: { - end += entry->locality_weight_; - pickers.push_back(MakePair(end, entry->picker_wrapper_)); - break; - } - case GRPC_CHANNEL_CONNECTING: { - num_connecting++; - break; - } - case GRPC_CHANNEL_IDLE: { - num_idle++; - break; - } - case GRPC_CHANNEL_TRANSIENT_FAILURE: { - num_transient_failures++; - break; - } - default: { - gpr_log(GPR_ERROR, "Invalid locality connectivity state - %d", - connectivity_state); - } - } - } - // Pass on the constructed xds picker if it has any ready pickers in their map - // otherwise pass a QueuePicker if any of the locality pickers are in a - // connecting or idle state, finally return a transient failure picker if all - // locality pickers are in transient failure - if (!pickers.empty()) { - entry_->parent_->channel_control_helper()->UpdateState( - GRPC_CHANNEL_READY, UniquePtr( - New(std::move(pickers)))); - } else if (num_connecting > 0) { - entry_->parent_->channel_control_helper()->UpdateState( - GRPC_CHANNEL_CONNECTING, - UniquePtr(New( - entry_->parent_->Ref(DEBUG_LOCATION, "QueuePicker")))); - } else if (num_idle > 0) { - entry_->parent_->channel_control_helper()->UpdateState( - GRPC_CHANNEL_IDLE, - UniquePtr(New( - entry_->parent_->Ref(DEBUG_LOCATION, "QueuePicker")))); - } else { - GPR_ASSERT(num_transient_failures == - entry_->parent_->locality_map_.map_.size()); - grpc_error* error = - grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING( - "connections to all localities failing"), - GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE); - entry_->parent_->channel_control_helper()->UpdateState( - GRPC_CHANNEL_TRANSIENT_FAILURE, - UniquePtr(New(error))); - } + // Construct a new xds picker and pass it to the channel. + entry_->parent_->locality_map_.UpdateXdsPickerLocked(); } void XdsLb::LocalityMap::LocalityEntry::Helper::RequestReresolution() { diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc index 5057e614c68..85f7d669ec0 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc @@ -174,7 +174,7 @@ void XdsClientStats::PruneLocalityStats() { } } -void XdsClientStats::AddCallDropped(UniquePtr category) { +void XdsClientStats::AddCallDropped(const UniquePtr& category) { total_dropped_requests_.FetchAdd(1, MemoryOrder::RELAXED); MutexLock lock(&dropped_requests_mu_); auto iter = dropped_requests_.find(category); diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h b/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h index 445675a4dcf..8f04272da75 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h @@ -208,7 +208,7 @@ class XdsClientStats { RefCountedPtr FindLocalityStats( const RefCountedPtr& locality_name); void PruneLocalityStats(); - void AddCallDropped(UniquePtr category); + void AddCallDropped(const UniquePtr& category); private: // The stats for each locality. diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc index b2615f319b9..bd8a7142e38 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc @@ -35,6 +35,7 @@ #include "envoy/api/v2/endpoint/endpoint.upb.h" #include "envoy/api/v2/endpoint/load_report.upb.h" #include "envoy/service/load_stats/v2/lrs.upb.h" +#include "envoy/type/percent.upb.h" #include "google/protobuf/any.upb.h" #include "google/protobuf/duration.upb.h" #include "google/protobuf/struct.upb.h" @@ -52,6 +53,19 @@ constexpr char kEndpointRequired[] = "endpointRequired"; } // namespace +bool XdsDropConfig::ShouldDrop(const UniquePtr** category_name) const { + for (size_t i = 0; i < drop_category_list_.size(); ++i) { + const auto& drop_category = drop_category_list_[i]; + // Generate a random number in [0, 1000000). + const int random = rand() % 1000000; + if (random < drop_category.parts_per_million) { + *category_name = &drop_category.name; + return true; + } + } + return false; +} + grpc_slice XdsEdsRequestCreateAndEncode(const char* service_name) { upb::Arena arena; // Create a request. @@ -153,6 +167,44 @@ grpc_error* LocalityParse( return GRPC_ERROR_NONE; } +grpc_error* DropParseAndAppend( + const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* drop_overload, + XdsDropConfig* drop_config, bool* drop_all) { + // Get the category. + upb_strview category = + envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_category( + drop_overload); + if (category.size == 0) { + return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty drop category name"); + } + // Get the drop rate (per million). + const envoy_type_FractionalPercent* drop_percentage = + envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_drop_percentage( + drop_overload); + uint32_t numerator = envoy_type_FractionalPercent_numerator(drop_percentage); + const auto denominator = + static_cast( + envoy_type_FractionalPercent_denominator(drop_percentage)); + // Normalize to million. + switch (denominator) { + case envoy_type_FractionalPercent_HUNDRED: + numerator *= 10000; + break; + case envoy_type_FractionalPercent_TEN_THOUSAND: + numerator *= 100; + break; + case envoy_type_FractionalPercent_MILLION: + break; + default: + return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Unknown denominator type"); + } + // Cap numerator to 1000000. + numerator = GPR_MIN(numerator, 1000000); + if (numerator == 1000000) *drop_all = true; + drop_config->AddCategory(StringCopy(category), numerator); + return GRPC_ERROR_NONE; +} + } // namespace grpc_error* XdsEdsResponseDecodeAndParse(const grpc_slice& encoded_response, @@ -193,6 +245,7 @@ grpc_error* XdsEdsResponseDecodeAndParse(const grpc_slice& encoded_response, envoy_api_v2_ClusterLoadAssignment_parse( encoded_cluster_load_assignment.data, encoded_cluster_load_assignment.size, arena.ptr()); + // Get the endpoints. const envoy_api_v2_endpoint_LocalityLbEndpoints* const* endpoints = envoy_api_v2_ClusterLoadAssignment_endpoints(cluster_load_assignment, &size); @@ -207,6 +260,21 @@ grpc_error* XdsEdsResponseDecodeAndParse(const grpc_slice& encoded_response, std::sort(update->locality_list.data(), update->locality_list.data() + update->locality_list.size(), XdsLocalityInfo::Less()); + // Get the drop config. + update->drop_config = MakeRefCounted(); + const envoy_api_v2_ClusterLoadAssignment_Policy* policy = + envoy_api_v2_ClusterLoadAssignment_policy(cluster_load_assignment); + if (policy != nullptr) { + const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* const* + drop_overload = + envoy_api_v2_ClusterLoadAssignment_Policy_drop_overloads(policy, + &size); + for (size_t i = 0; i < size; ++i) { + grpc_error* error = DropParseAndAppend( + drop_overload[i], update->drop_config.get(), &update->drop_all); + if (error != GRPC_ERROR_NONE) return error; + } + } return GRPC_ERROR_NONE; } diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h index ed3b49ff836..cea5b50b9ba 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h @@ -50,9 +50,51 @@ struct XdsLocalityInfo { using XdsLocalityList = InlinedVector; +// There are two phases of accessing this class's content: +// 1. to initialize in the control plane combiner; +// 2. to use in the data plane combiner. +// So no additional synchronization is needed. +class XdsDropConfig : public RefCounted { + public: + struct DropCategory { + bool operator==(const DropCategory& other) const { + return strcmp(name.get(), other.name.get()) == 0 && + parts_per_million == other.parts_per_million; + } + + UniquePtr name; + const uint32_t parts_per_million; + }; + + using DropCategoryList = InlinedVector; + + void AddCategory(UniquePtr name, uint32_t parts_per_million) { + drop_category_list_.emplace_back( + DropCategory{std::move(name), parts_per_million}); + } + + // The only method invoked from the data plane combiner. + bool ShouldDrop(const UniquePtr** category_name) const; + + const DropCategoryList& drop_category_list() const { + return drop_category_list_; + } + + bool operator==(const XdsDropConfig& other) const { + return drop_category_list_ == other.drop_category_list_; + } + bool operator!=(const XdsDropConfig& other) const { + return !(*this == other); + } + + private: + DropCategoryList drop_category_list_; +}; + struct XdsUpdate { XdsLocalityList locality_list; - // TODO(juanlishen): Pass drop_per_million when adding drop support. + RefCountedPtr drop_config; + bool drop_all = false; }; // Creates an EDS request querying \a service_name. diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index d62dc828818..5d114c0ef2b 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -84,6 +84,7 @@ using ::envoy::api::v2::ClusterLoadAssignment; using ::envoy::api::v2::DiscoveryRequest; using ::envoy::api::v2::DiscoveryResponse; using ::envoy::api::v2::EndpointDiscoveryService; +using ::envoy::api::v2::FractionalPercent; using ::envoy::service::load_stats::v2::ClusterStats; using ::envoy::service::load_stats::v2::LoadReportingService; using ::envoy::service::load_stats::v2::LoadStatsRequest; @@ -95,6 +96,8 @@ constexpr char kEdsTypeUrl[] = constexpr char kDefaultLocalityRegion[] = "xds_default_locality_region"; constexpr char kDefaultLocalityZone[] = "xds_default_locality_zone"; constexpr char kDefaultLocalitySubzone[] = "xds_default_locality_subzone"; +constexpr char kLbDropType[] = "lb"; +constexpr char kThrottleDropType[] = "throttle"; template class CountedService : public ServiceType { @@ -205,6 +208,11 @@ class ClientStats { locality_stats_.emplace(input_locality_stats.locality().sub_zone(), LocalityStats(input_locality_stats)); } + for (const auto& input_dropped_requests : + cluster_stats.dropped_requests()) { + dropped_requests_.emplace(input_dropped_requests.category(), + input_dropped_requests.dropped_count()); + } } uint64_t total_successful_requests() const { @@ -236,10 +244,16 @@ class ClientStats { return sum; } uint64_t total_dropped_requests() const { return total_dropped_requests_; } + uint64_t dropped_requests(const grpc::string& category) const { + auto iter = dropped_requests_.find(category); + GPR_ASSERT(iter != dropped_requests_.end()); + return iter->second; + } private: std::map locality_stats_; uint64_t total_dropped_requests_; + std::map dropped_requests_; }; class EdsServiceImpl : public EdsService { @@ -301,8 +315,11 @@ class EdsServiceImpl : public EdsService { gpr_log(GPR_INFO, "LB[%p]: shut down", this); } - static DiscoveryResponse BuildResponseForBackends( - const std::vector>& backend_ports) { + static DiscoveryResponse BuildResponse( + const std::vector>& backend_ports, + const std::map& drop_categories = {}, + const FractionalPercent::DenominatorType denominator = + FractionalPercent::MILLION) { ClusterLoadAssignment assignment; assignment.set_cluster_name("service name"); for (size_t i = 0; i < backend_ports.size(); ++i) { @@ -323,6 +340,18 @@ class EdsServiceImpl : public EdsService { socket_address->set_port_value(backend_port); } } + if (!drop_categories.empty()) { + auto* policy = assignment.mutable_policy(); + for (const auto& p : drop_categories) { + const grpc::string& name = p.first; + const uint32_t parts_per_million = p.second; + auto* drop_overload = policy->add_drop_overloads(); + drop_overload->set_category(name); + auto* drop_percentage = drop_overload->mutable_drop_percentage(); + drop_percentage->set_numerator(parts_per_million); + drop_percentage->set_denominator(denominator); + } + } DiscoveryResponse response; response.set_type_url(kEdsTypeUrl); response.add_resources()->PackFrom(assignment); @@ -883,8 +912,7 @@ TEST_F(SingleBalancerTest, Vanilla) { SetNextResolutionForLbChannelAllBalancers(); const size_t kNumRpcsPerAddress = 100; ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponseForBackends(GetBackendPortsInGroups()), - 0); + 0, EdsServiceImpl::BuildResponse(GetBackendPortsInGroups()), 0); // Make sure that trying to connect works without a call. channel_->GetState(true /* try_to_connect */); // We need to wait for all backends to come online. @@ -912,8 +940,7 @@ TEST_F(SingleBalancerTest, SameBackendListedMultipleTimes) { ports.push_back(backends_[0]->port()); ports.push_back(backends_[0]->port()); const size_t kNumRpcsPerAddress = 10; - ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponseForBackends({ports}), 0); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse({ports}), 0); // We need to wait for the backend to come online. WaitForBackend(0); // Send kNumRpcsPerAddress RPCs per server. @@ -934,8 +961,7 @@ TEST_F(SingleBalancerTest, SecureNaming) { SetNextResolutionForLbChannel({balancers_[0]->port()}); const size_t kNumRpcsPerAddress = 100; ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponseForBackends(GetBackendPortsInGroups()), - 0); + 0, EdsServiceImpl::BuildResponse(GetBackendPortsInGroups()), 0); // Make sure that trying to connect works without a call. channel_->GetState(true /* try_to_connect */); // We need to wait for all backends to come online. @@ -980,11 +1006,10 @@ TEST_F(SingleBalancerTest, InitiallyEmptyServerlist) { const int kServerlistDelayMs = 500 * grpc_test_slowdown_factor(); const int kCallDeadlineMs = kServerlistDelayMs * 2; // First response is an empty serverlist, sent right away. - ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponseForBackends({{}}), - 0); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse({{}}), 0); // Send non-empty serverlist only after kServerlistDelayMs ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponseForBackends(GetBackendPortsInGroups()), + 0, EdsServiceImpl::BuildResponse(GetBackendPortsInGroups()), kServerlistDelayMs); const auto t0 = system_clock::now(); // Client will block: LB will initially send empty serverlist. @@ -1012,8 +1037,7 @@ TEST_F(SingleBalancerTest, AllServersUnreachableFailFast) { for (size_t i = 0; i < kNumUnreachableServers; ++i) { ports.push_back(grpc_pick_unused_port_or_die()); } - ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponseForBackends({ports}), 0); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse({ports}), 0); const Status status = SendRpc(); // The error shouldn't be DEADLINE_EXCEEDED. EXPECT_EQ(StatusCode::UNAVAILABLE, status.error_code()); @@ -1023,6 +1047,254 @@ TEST_F(SingleBalancerTest, AllServersUnreachableFailFast) { EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } +TEST_F(SingleBalancerTest, Drop) { + SetNextResolution({}, kDefaultServiceConfig_.c_str()); + SetNextResolutionForLbChannelAllBalancers(); + const size_t kNumRpcs = 5000; + const uint32_t kDropPerMillionForLb = 100000; + const uint32_t kDropPerMillionForThrottle = 200000; + const double kDropRateForLb = kDropPerMillionForLb / 1000000.0; + const double kDropRateForThrottle = kDropPerMillionForThrottle / 1000000.0; + const double KDropRateForLbAndThrottle = + kDropRateForLb + (1 - kDropRateForLb) * kDropRateForThrottle; + // The EDS response contains two drop categories. + ScheduleResponseForBalancer( + 0, + EdsServiceImpl::BuildResponse( + GetBackendPortsInGroups(), + {{kLbDropType, kDropPerMillionForLb}, + {kThrottleDropType, kDropPerMillionForThrottle}}), + 0); + WaitForAllBackends(); + // Send kNumRpcs RPCs and count the drops. + size_t num_drops = 0; + for (size_t i = 0; i < kNumRpcs; ++i) { + EchoResponse response; + const Status status = SendRpc(&response); + if (!status.ok() && + status.error_message() == "Call dropped by load balancing policy") { + ++num_drops; + } else { + EXPECT_TRUE(status.ok()) << "code=" << status.error_code() + << " message=" << status.error_message(); + EXPECT_EQ(response.message(), kRequestMessage_); + } + } + // The drop rate should be roughly equal to the expectation. + const double seen_drop_rate = static_cast(num_drops) / kNumRpcs; + const double kErrorTolerance = 0.2; + EXPECT_THAT( + seen_drop_rate, + ::testing::AllOf( + ::testing::Ge(KDropRateForLbAndThrottle * (1 - kErrorTolerance)), + ::testing::Le(KDropRateForLbAndThrottle * (1 + kErrorTolerance)))); + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); +} + +TEST_F(SingleBalancerTest, DropPerHundred) { + SetNextResolution({}, kDefaultServiceConfig_.c_str()); + SetNextResolutionForLbChannelAllBalancers(); + const size_t kNumRpcs = 5000; + const uint32_t kDropPerHundredForLb = 10; + const double kDropRateForLb = kDropPerHundredForLb / 100.0; + // The EDS response contains one drop category. + ScheduleResponseForBalancer( + 0, + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), + {{kLbDropType, kDropPerHundredForLb}}, + FractionalPercent::HUNDRED), + 0); + WaitForAllBackends(); + // Send kNumRpcs RPCs and count the drops. + size_t num_drops = 0; + for (size_t i = 0; i < kNumRpcs; ++i) { + EchoResponse response; + const Status status = SendRpc(&response); + if (!status.ok() && + status.error_message() == "Call dropped by load balancing policy") { + ++num_drops; + } else { + EXPECT_TRUE(status.ok()) << "code=" << status.error_code() + << " message=" << status.error_message(); + EXPECT_EQ(response.message(), kRequestMessage_); + } + } + // The drop rate should be roughly equal to the expectation. + const double seen_drop_rate = static_cast(num_drops) / kNumRpcs; + const double kErrorTolerance = 0.2; + EXPECT_THAT( + seen_drop_rate, + ::testing::AllOf(::testing::Ge(kDropRateForLb * (1 - kErrorTolerance)), + ::testing::Le(kDropRateForLb * (1 + kErrorTolerance)))); + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); +} + +TEST_F(SingleBalancerTest, DropPerTenThousand) { + SetNextResolution({}, kDefaultServiceConfig_.c_str()); + SetNextResolutionForLbChannelAllBalancers(); + const size_t kNumRpcs = 5000; + const uint32_t kDropPerTenThousandForLb = 1000; + const double kDropRateForLb = kDropPerTenThousandForLb / 10000.0; + // The EDS response contains one drop category. + ScheduleResponseForBalancer( + 0, + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), + {{kLbDropType, kDropPerTenThousandForLb}}, + FractionalPercent::TEN_THOUSAND), + 0); + WaitForAllBackends(); + // Send kNumRpcs RPCs and count the drops. + size_t num_drops = 0; + for (size_t i = 0; i < kNumRpcs; ++i) { + EchoResponse response; + const Status status = SendRpc(&response); + if (!status.ok() && + status.error_message() == "Call dropped by load balancing policy") { + ++num_drops; + } else { + EXPECT_TRUE(status.ok()) << "code=" << status.error_code() + << " message=" << status.error_message(); + EXPECT_EQ(response.message(), kRequestMessage_); + } + } + // The drop rate should be roughly equal to the expectation. + const double seen_drop_rate = static_cast(num_drops) / kNumRpcs; + const double kErrorTolerance = 0.2; + EXPECT_THAT( + seen_drop_rate, + ::testing::AllOf(::testing::Ge(kDropRateForLb * (1 - kErrorTolerance)), + ::testing::Le(kDropRateForLb * (1 + kErrorTolerance)))); + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); +} + +TEST_F(SingleBalancerTest, DropUpdate) { + SetNextResolution({}, kDefaultServiceConfig_.c_str()); + SetNextResolutionForLbChannelAllBalancers(); + const size_t kNumRpcs = 5000; + const uint32_t kDropPerMillionForLb = 100000; + const uint32_t kDropPerMillionForThrottle = 200000; + const double kDropRateForLb = kDropPerMillionForLb / 1000000.0; + const double kDropRateForThrottle = kDropPerMillionForThrottle / 1000000.0; + const double KDropRateForLbAndThrottle = + kDropRateForLb + (1 - kDropRateForLb) * kDropRateForThrottle; + // The first EDS response contains one drop category. + ScheduleResponseForBalancer( + 0, + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), + {{kLbDropType, kDropPerMillionForLb}}), + 0); + // The second EDS response contains two drop categories. + ScheduleResponseForBalancer( + 0, + EdsServiceImpl::BuildResponse( + GetBackendPortsInGroups(), + {{kLbDropType, kDropPerMillionForLb}, + {kThrottleDropType, kDropPerMillionForThrottle}}), + 5000); + WaitForAllBackends(); + // Send kNumRpcs RPCs and count the drops. + size_t num_drops = 0; + gpr_log(GPR_INFO, "========= BEFORE FIRST BATCH =========="); + for (size_t i = 0; i < kNumRpcs; ++i) { + EchoResponse response; + const Status status = SendRpc(&response); + if (!status.ok() && + status.error_message() == "Call dropped by load balancing policy") { + ++num_drops; + } else { + EXPECT_TRUE(status.ok()) << "code=" << status.error_code() + << " message=" << status.error_message(); + EXPECT_EQ(response.message(), kRequestMessage_); + } + } + gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH =========="); + // The drop rate should be roughly equal to the expectation. + double seen_drop_rate = static_cast(num_drops) / kNumRpcs; + const double kErrorTolerance = 0.2; + EXPECT_THAT( + seen_drop_rate, + ::testing::AllOf(::testing::Ge(kDropRateForLb * (1 - kErrorTolerance)), + ::testing::Le(kDropRateForLb * (1 + kErrorTolerance)))); + // Wait until the drop rate increases to the middle of the two configs, which + // implies that the update has been in effect. + const double kDropRateThreshold = + (kDropRateForLb + KDropRateForLbAndThrottle) / 2; + size_t num_rpcs = kNumRpcs; + while (seen_drop_rate < kDropRateThreshold) { + EchoResponse response; + const Status status = SendRpc(&response); + ++num_rpcs; + if (!status.ok() && + status.error_message() == "Call dropped by load balancing policy") { + ++num_drops; + } else { + EXPECT_TRUE(status.ok()) << "code=" << status.error_code() + << " message=" << status.error_message(); + EXPECT_EQ(response.message(), kRequestMessage_); + } + seen_drop_rate = static_cast(num_drops) / num_rpcs; + } + // Send kNumRpcs RPCs and count the drops. + num_drops = 0; + gpr_log(GPR_INFO, "========= BEFORE SECOND BATCH =========="); + for (size_t i = 0; i < kNumRpcs; ++i) { + EchoResponse response; + const Status status = SendRpc(&response); + if (!status.ok() && + status.error_message() == "Call dropped by load balancing policy") { + ++num_drops; + } else { + EXPECT_TRUE(status.ok()) << "code=" << status.error_code() + << " message=" << status.error_message(); + EXPECT_EQ(response.message(), kRequestMessage_); + } + } + gpr_log(GPR_INFO, "========= DONE WITH SECOND BATCH =========="); + // The new drop rate should be roughly equal to the expectation. + seen_drop_rate = static_cast(num_drops) / kNumRpcs; + EXPECT_THAT( + seen_drop_rate, + ::testing::AllOf( + ::testing::Ge(KDropRateForLbAndThrottle * (1 - kErrorTolerance)), + ::testing::Le(KDropRateForLbAndThrottle * (1 + kErrorTolerance)))); + // The EDS service got a single request, + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + // and sent two responses + EXPECT_EQ(2U, balancers_[0]->eds_service()->response_count()); +} + +TEST_F(SingleBalancerTest, DropAll) { + SetNextResolution({}, kDefaultServiceConfig_.c_str()); + SetNextResolutionForLbChannelAllBalancers(); + const size_t kNumRpcs = 1000; + const uint32_t kDropPerMillionForLb = 100000; + const uint32_t kDropPerMillionForThrottle = 1000000; + // The EDS response contains two drop categories. + ScheduleResponseForBalancer( + 0, + EdsServiceImpl::BuildResponse( + GetBackendPortsInGroups(), + {{kLbDropType, kDropPerMillionForLb}, + {kThrottleDropType, kDropPerMillionForThrottle}}), + 0); + // Send kNumRpcs RPCs and all of them are dropped. + for (size_t i = 0; i < kNumRpcs; ++i) { + EchoResponse response; + const Status status = SendRpc(&response); + EXPECT_TRUE(!status.ok() && status.error_message() == + "Call dropped by load balancing policy"); + } + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); +} + TEST_F(SingleBalancerTest, Fallback) { const int kFallbackTimeoutMs = 200 * grpc_test_slowdown_factor(); const int kServerlistDelayMs = 500 * grpc_test_slowdown_factor(); @@ -1034,7 +1306,7 @@ TEST_F(SingleBalancerTest, Fallback) { // Send non-empty serverlist only after kServerlistDelayMs. ScheduleResponseForBalancer( 0, - EdsServiceImpl::BuildResponseForBackends( + EdsServiceImpl::BuildResponse( GetBackendPortsInGroups(kNumBackendsInResolution /* start_index */)), kServerlistDelayMs); // Wait until all the fallback backends are reachable. @@ -1083,7 +1355,7 @@ TEST_F(SingleBalancerTest, FallbackUpdate) { // Send non-empty serverlist only after kServerlistDelayMs. ScheduleResponseForBalancer( 0, - EdsServiceImpl::BuildResponseForBackends(GetBackendPortsInGroups( + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups( kNumBackendsInResolution + kNumBackendsInResolutionUpdate /* start_index */)), kServerlistDelayMs); @@ -1184,10 +1456,8 @@ TEST_F(SingleBalancerTest, FallbackIfResponseReceivedButChildNotReady) { SetNextResolutionForLbChannelAllBalancers(); // Send a serverlist that only contains an unreachable backend before fallback // timeout. - ScheduleResponseForBalancer(0, - EdsServiceImpl::BuildResponseForBackends( - {{grpc_pick_unused_port_or_die()}}), - 0); + ScheduleResponseForBalancer( + 0, EdsServiceImpl::BuildResponse({{grpc_pick_unused_port_or_die()}}), 0); // Because no child policy is ready before fallback timeout, we enter fallback // mode. WaitForBackend(0); @@ -1199,9 +1469,12 @@ TEST_F(SingleBalancerTest, FallbackModeIsExitedWhenBalancerSaysToDropAllCalls) { SetNextResolutionForLbChannel({grpc_pick_unused_port_or_die()}); // Enter fallback mode because the LB channel fails to connect. WaitForBackend(0); - // Return a new balancer that sends an empty serverlist. - ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponseForBackends({{}}), - 0); + // Return a new balancer that sends a response to drop all calls. + ScheduleResponseForBalancer( + 0, + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), + {{kLbDropType, 1000000}}), + 0); SetNextResolutionForLbChannelAllBalancers(); // Send RPCs until failure. gpr_timespec deadline = gpr_time_add( @@ -1222,7 +1495,7 @@ TEST_F(SingleBalancerTest, FallbackModeIsExitedAfterChildRready) { // Return a new balancer that sends a dead backend. ShutdownBackend(1); ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponseForBackends({{backends_[1]->port()}}), 0); + 0, EdsServiceImpl::BuildResponse({{backends_[1]->port()}}), 0); SetNextResolutionForLbChannelAllBalancers(); // The state (TRANSIENT_FAILURE) update from the child policy will be ignored // because we are still in fallback mode. @@ -1247,8 +1520,7 @@ TEST_F(SingleBalancerTest, BackendsRestart) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponseForBackends(GetBackendPortsInGroups()), - 0); + 0, EdsServiceImpl::BuildResponse(GetBackendPortsInGroups()), 0); WaitForAllBackends(); // Stop backends. RPCs should fail. ShutdownAllBackends(); @@ -1269,10 +1541,10 @@ TEST_F(UpdatesTest, UpdateBalancersButKeepUsingOriginalBalancer) { SetNextResolutionForLbChannelAllBalancers(); auto first_backend = GetBackendPortsInGroups(0, 1); auto second_backend = GetBackendPortsInGroups(1, 2); - ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponseForBackends(first_backend), 0); - ScheduleResponseForBalancer( - 1, EdsServiceImpl::BuildResponseForBackends(second_backend), 0); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(first_backend), + 0); + ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(second_backend), + 0); // Wait until the first backend is ready. WaitForBackend(0); @@ -1322,10 +1594,10 @@ TEST_F(UpdatesTest, UpdateBalancerName) { SetNextResolutionForLbChannelAllBalancers(); auto first_backend = GetBackendPortsInGroups(0, 1); auto second_backend = GetBackendPortsInGroups(1, 2); - ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponseForBackends(first_backend), 0); - ScheduleResponseForBalancer( - 1, EdsServiceImpl::BuildResponseForBackends(second_backend), 0); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(first_backend), + 0); + ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(second_backend), + 0); // Wait until the first backend is ready. WaitForBackend(0); @@ -1393,10 +1665,10 @@ TEST_F(UpdatesTest, UpdateBalancersRepeated) { SetNextResolutionForLbChannelAllBalancers(); auto first_backend = GetBackendPortsInGroups(0, 1); auto second_backend = GetBackendPortsInGroups(1, 2); - ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponseForBackends(first_backend), 0); - ScheduleResponseForBalancer( - 1, EdsServiceImpl::BuildResponseForBackends(second_backend), 0); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(first_backend), + 0); + ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(second_backend), + 0); // Wait until the first backend is ready. WaitForBackend(0); @@ -1461,10 +1733,10 @@ TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) { SetNextResolutionForLbChannel({balancers_[0]->port()}); auto first_backend = GetBackendPortsInGroups(0, 1); auto second_backend = GetBackendPortsInGroups(1, 2); - ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponseForBackends(first_backend), 0); - ScheduleResponseForBalancer( - 1, EdsServiceImpl::BuildResponseForBackends(second_backend), 0); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(first_backend), + 0); + ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(second_backend), + 0); // Start servers and send 10 RPCs per server. gpr_log(GPR_INFO, "========= BEFORE FIRST BATCH =========="); @@ -1535,14 +1807,6 @@ TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) { // TODO(juanlishen): Add TEST_F(UpdatesWithClientLoadReportingTest, // ReresolveDeadBalancer) -// The drop tests are deferred because the drop handling hasn't been added yet. - -// TODO(roth): Add TEST_F(SingleBalancerTest, Drop) - -// TODO(roth): Add TEST_F(SingleBalancerTest, DropAllFirst) - -// TODO(roth): Add TEST_F(SingleBalancerTest, DropAll) - class SingleBalancerWithClientLoadReportingTest : public XdsEnd2endTest { public: SingleBalancerWithClientLoadReportingTest() : XdsEnd2endTest(4, 1, 3) {} @@ -1555,7 +1819,7 @@ TEST_F(SingleBalancerWithClientLoadReportingTest, Vanilla) { // TODO(juanlishen): Partition the backends after multiple localities is // tested. ScheduleResponseForBalancer(0, - EdsServiceImpl::BuildResponseForBackends( + EdsServiceImpl::BuildResponse( GetBackendPortsInGroups(0, backends_.size())), 0); // Wait until all backends are ready. @@ -1595,7 +1859,7 @@ TEST_F(SingleBalancerWithClientLoadReportingTest, BalancerRestart) { backends_.size() - kNumBackendsFirstPass; ScheduleResponseForBalancer( 0, - EdsServiceImpl::BuildResponseForBackends( + EdsServiceImpl::BuildResponse( GetBackendPortsInGroups(0, kNumBackendsFirstPass)), 0); // Wait until all backends returned by the balancer are ready. @@ -1626,7 +1890,7 @@ TEST_F(SingleBalancerWithClientLoadReportingTest, BalancerRestart) { balancers_[0]->Start(server_host_); ScheduleResponseForBalancer( 0, - EdsServiceImpl::BuildResponseForBackends( + EdsServiceImpl::BuildResponse( GetBackendPortsInGroups(kNumBackendsFirstPass)), 0); // Wait for queries to start going to one of the new backends. @@ -1646,7 +1910,75 @@ TEST_F(SingleBalancerWithClientLoadReportingTest, BalancerRestart) { EXPECT_EQ(0U, client_stats->total_dropped_requests()); } -// TODO(juanlishen): Add TEST_F(SingleBalancerWithClientLoadReportingTest, Drop) +class SingleBalancerWithClientLoadReportingAndDropTest : public XdsEnd2endTest { + public: + SingleBalancerWithClientLoadReportingAndDropTest() + : XdsEnd2endTest(4, 1, 20) {} +}; + +TEST_F(SingleBalancerWithClientLoadReportingAndDropTest, Vanilla) { + SetNextResolution({}, kDefaultServiceConfig_.c_str()); + SetNextResolutionForLbChannelAllBalancers(); + const size_t kNumRpcs = 3000; + const uint32_t kDropPerMillionForLb = 100000; + const uint32_t kDropPerMillionForThrottle = 200000; + const double kDropRateForLb = kDropPerMillionForLb / 1000000.0; + const double kDropRateForThrottle = kDropPerMillionForThrottle / 1000000.0; + const double KDropRateForLbAndThrottle = + kDropRateForLb + (1 - kDropRateForLb) * kDropRateForThrottle; + // The EDS response contains two drop categories. + ScheduleResponseForBalancer( + 0, + EdsServiceImpl::BuildResponse( + GetBackendPortsInGroups(), + {{kLbDropType, kDropPerMillionForLb}, + {kThrottleDropType, kDropPerMillionForThrottle}}), + 0); + int num_ok = 0; + int num_failure = 0; + int num_drops = 0; + std::tie(num_ok, num_failure, num_drops) = WaitForAllBackends(); + const size_t num_warmup = num_ok + num_failure + num_drops; + // Send kNumRpcs RPCs and count the drops. + for (size_t i = 0; i < kNumRpcs; ++i) { + EchoResponse response; + const Status status = SendRpc(&response); + if (!status.ok() && + status.error_message() == "Call dropped by load balancing policy") { + ++num_drops; + } else { + EXPECT_TRUE(status.ok()) << "code=" << status.error_code() + << " message=" << status.error_message(); + EXPECT_EQ(response.message(), kRequestMessage_); + } + } + // The drop rate should be roughly equal to the expectation. + const double seen_drop_rate = static_cast(num_drops) / kNumRpcs; + const double kErrorTolerance = 0.2; + EXPECT_THAT( + seen_drop_rate, + ::testing::AllOf( + ::testing::Ge(KDropRateForLbAndThrottle * (1 - kErrorTolerance)), + ::testing::Le(KDropRateForLbAndThrottle * (1 + kErrorTolerance)))); + // Check client stats. + ClientStats* client_stats = balancers_[0]->lrs_service()->WaitForLoadReport(); + EXPECT_EQ(num_drops, client_stats->total_dropped_requests()); + const size_t total_rpc = num_warmup + kNumRpcs; + EXPECT_THAT( + client_stats->dropped_requests(kLbDropType), + ::testing::AllOf( + ::testing::Ge(total_rpc * kDropRateForLb * (1 - kErrorTolerance)), + ::testing::Le(total_rpc * kDropRateForLb * (1 + kErrorTolerance)))); + EXPECT_THAT(client_stats->dropped_requests(kThrottleDropType), + ::testing::AllOf( + ::testing::Ge(total_rpc * (1 - kDropRateForLb) * + kDropRateForThrottle * (1 - kErrorTolerance)), + ::testing::Le(total_rpc * (1 - kDropRateForLb) * + kDropRateForThrottle * (1 + kErrorTolerance)))); + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); +} } // namespace } // namespace testing From 58ef8943a597bd19ebb568a1a18f73f8113225ab Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Sat, 10 Aug 2019 13:45:13 -0700 Subject: [PATCH 287/661] Added missing resources --- src/objective-c/tests/Podfile | 2 +- src/objective-c/tests/Tests.xcodeproj/project.pbxproj | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index be935732935..c2297aa00fd 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -114,7 +114,7 @@ post_install do |installer| end # Enable NSAssert on gRPC - if /(gRPC|ProtoRPC|RxLibrary)-(mac|i)OS/.match(target.name) + if /(gRPC|ProtoRPC|RxLibrary)-(mac|i|tv)OS/.match(target.name) target.build_configurations.each do |config| if config.name != 'Release' config.build_settings['ENABLE_NS_ASSERTIONS'] = 'YES' diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 8548620522d..a54dca59b9c 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -37,6 +37,7 @@ 65EB19E418B39A8374D407BB /* libPods-CronetTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B1511C20E16A8422B58D61A /* libPods-CronetTests.a */; }; 903163C7FE885838580AEC7A /* libPods-InteropTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D457AD9797664CFA191C3280 /* libPods-InteropTests.a */; }; 953CD2942A3A6D6CE695BE87 /* libPods-MacTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 276873A05AC5479B60DF6079 /* libPods-MacTests.a */; }; + ABA946DC22FF62FC00577AEF /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; ABCB3EE422F23BEF00F0FECE /* InteropTestsRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F488822778B04006656AD /* InteropTestsRemote.m */; }; ABCB3EE522F23BEF00F0FECE /* InteropTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F488222778A88006656AD /* InteropTests.m */; }; ABCB3EE622F23BEF00F0FECE /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; }; @@ -644,6 +645,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + ABA946DC22FF62FC00577AEF /* TestCertificates.bundle in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; From 7a6c4213128b81639f6e0c68c55a5a332d1ddbe8 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Sat, 10 Aug 2019 13:45:32 -0700 Subject: [PATCH 288/661] Clarified exception --- src/objective-c/GRPCClient/GRPCCall+Tests.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCCall+Tests.m b/src/objective-c/GRPCClient/GRPCCall+Tests.m index ac3b6a658f9..20f5cba4178 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Tests.m +++ b/src/objective-c/GRPCClient/GRPCCall+Tests.m @@ -27,8 +27,14 @@ + (void)useTestCertsPath:(NSString *)certsPath testName:(NSString *)testName forHost:(NSString *)host { - if (!host || !certsPath || !testName) { - [NSException raise:NSInvalidArgumentException format:@"host, path and name must be provided."]; + if (!host) { + [NSException raise:NSInvalidArgumentException format:@"host must be provided."]; + } + if (!certsPath) { + [NSException raise:NSInvalidArgumentException format:@"certpath be provided."]; + } + if (!testName) { + [NSException raise:NSInvalidArgumentException format:@"testname must be provided."]; } NSError *error = nil; NSString *certs = From 249f793a7b600644f7e31c2df50f3fbe06effbd0 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sat, 10 Aug 2019 21:20:10 -0700 Subject: [PATCH 289/661] fix unit tests --- src/objective-c/tests/UnitTests/APIv2Tests.m | 2 +- src/objective-c/tests/UnitTests/GRPCClientTests.m | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/objective-c/tests/UnitTests/APIv2Tests.m b/src/objective-c/tests/UnitTests/APIv2Tests.m index 6d99f3be44f..86d4e8b3619 100644 --- a/src/objective-c/tests/UnitTests/APIv2Tests.m +++ b/src/objective-c/tests/UnitTests/APIv2Tests.m @@ -17,7 +17,6 @@ */ #import -#import #import #import #import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" @@ -25,6 +24,7 @@ #include #include +#import "../version.h" // The server address is derived from preprocessor macro, which is // in turn derived from environment variable of the same name. diff --git a/src/objective-c/tests/UnitTests/GRPCClientTests.m b/src/objective-c/tests/UnitTests/GRPCClientTests.m index 5dbea09ca85..3d144c33b06 100644 --- a/src/objective-c/tests/UnitTests/GRPCClientTests.m +++ b/src/objective-c/tests/UnitTests/GRPCClientTests.m @@ -25,7 +25,6 @@ #import #import #import -#import #import #import #import @@ -34,6 +33,8 @@ #include +#import "../version.h" + #define TEST_TIMEOUT 16 // The server address is derived from preprocessor macro, which is From 955a74925ac094757f5da207deb5ddadccb4fd72 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sat, 10 Aug 2019 22:24:58 -0700 Subject: [PATCH 290/661] Bug fix --- src/objective-c/BUILD | 4 ++-- src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m | 10 +--------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index 322c84bb9bb..a79f73c265f 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -109,7 +109,7 @@ grpc_objc_library( "GRPCClient/GRPCCall+Tests.h", "GRPCClient/GRPCCall+ChannelArg.h", ], - textual_hdrs = native.glob(["GRPCClient/private/GRPCCore/*.h"]), + textual_hdrs = glob(["GRPCClient/private/GRPCCore/*.h"]), srcs = [ "GRPCClient/GRPCCall+ChannelArg.m", "GRPCClient/GRPCCall+ChannelCredentials.m", @@ -117,7 +117,7 @@ grpc_objc_library( "GRPCClient/GRPCCall+OAuth2.m", "GRPCClient/GRPCCall+Tests.m", "GRPCClient/GRPCCallLegacy.m", - ] + native.glob(["GRPCClient/private/GRPCCore/*.m"]), + ] + glob(["GRPCClient/private/GRPCCore/*.m"]), data = [":gRPCCertificates"], includes = ["."], deps = [ diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m index 04f91e494a7..691521ae7bb 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m @@ -126,17 +126,9 @@ static NSMutableDictionary *gHostCache; + (GRPCCallOptions *)callOptionsForHost:(NSString *)host { // TODO (mxyan): Remove when old API is deprecated - NSURL *hostURL = [NSURL URLWithString:[@"https://" stringByAppendingString:host]]; - if (hostURL.host && hostURL.port == nil) { - host = [hostURL.host stringByAppendingString:@":443"]; - } - GRPCCallOptions *callOptions = nil; @synchronized(gHostCache) { - GRPCHost *hostConfig = gHostCache[host]; - if (hostConfig == nil) { - hostConfig = [GRPCHost hostWithAddress:host]; - } + GRPCHost *hostConfig = [GRPCHost hostWithAddress:host]; callOptions = [hostConfig callOptions]; } NSAssert(callOptions != nil, @"Unable to create call options object"); From c8225c461bde8fb3bfa0853af4135dc00cb920fe Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sat, 10 Aug 2019 22:47:44 -0700 Subject: [PATCH 291/661] Build fix --- src/objective-c/BUILD | 4 ++++ src/objective-c/ProtoRPC/ProtoRPCLegacy.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index a79f73c265f..8fb253ca4c0 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -167,6 +167,10 @@ grpc_objc_library( "ProtoRPC/ProtoRPCLegacy.m", "ProtoRPC/ProtoServiceLegacy.m", ], + hdrs = [ + "ProtoRPC/ProtoRPCLegacy.h", + "ProtoRPC/ProtoService.h", + ], deps = [ ":rx_library", ":proto_objc_rpc_v2", diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h index 54823ab90db..b8d4003f695 100644 --- a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h @@ -24,6 +24,7 @@ #import #import #import +#import @class GRPCProtoMethod; @class GRXWriter; From dd2dc23d63b0050d6ec51ceeeae5c09b66edaf2a Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 11 Aug 2019 11:38:45 -0700 Subject: [PATCH 292/661] swift build fix --- src/objective-c/BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index 8fb253ca4c0..296f5255732 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -168,6 +168,7 @@ grpc_objc_library( "ProtoRPC/ProtoServiceLegacy.m", ], hdrs = [ + "ProtoRPC/ProtoMethod.h", "ProtoRPC/ProtoRPCLegacy.h", "ProtoRPC/ProtoService.h", ], From 68d61994435d80b70fcb43a7779d615d6224f839 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 11 Aug 2019 19:04:52 -0700 Subject: [PATCH 293/661] Fix samples --- .../examples/tvOS-sample/tvOS-sample/ViewController.m | 2 ++ .../watchOS-sample/WatchKit-Extension/InterfaceController.m | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m index c94ee8c2569..3081b28f0ea 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m @@ -25,6 +25,8 @@ #import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" #endif +#import +#import @interface ViewController () diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m index 3e97767cf0c..050234cb947 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m @@ -24,6 +24,8 @@ #import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" #endif +#import +#import @interface InterfaceController () From 1c9fb855d7134a196c9d5e8b65f8be2abe277a73 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Sun, 11 Aug 2019 19:12:28 -0700 Subject: [PATCH 294/661] Add locality map tests --- .../client_channel/lb_policy/xds/xds.cc | 2 +- test/cpp/end2end/xds_end2end_test.cc | 98 ++++++++++++++++--- 2 files changed, 88 insertions(+), 12 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 4f119edefce..468c9d84591 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -509,7 +509,7 @@ class XdsLb : public LoadBalancingPolicy { OrphanablePtr child_policy_; OrphanablePtr pending_child_policy_; RefCountedPtr picker_wrapper_; - grpc_connectivity_state connectivity_state_; + grpc_connectivity_state connectivity_state_ = GRPC_CHANNEL_IDLE; uint32_t locality_weight_; }; diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 5d114c0ef2b..dda5bdf58d0 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -98,6 +98,7 @@ constexpr char kDefaultLocalityZone[] = "xds_default_locality_zone"; constexpr char kDefaultLocalitySubzone[] = "xds_default_locality_subzone"; constexpr char kLbDropType[] = "lb"; constexpr char kThrottleDropType[] = "throttle"; +constexpr int kDefaultLocalityWeight = 3; template class CountedService : public ServiceType { @@ -317,6 +318,7 @@ class EdsServiceImpl : public EdsService { static DiscoveryResponse BuildResponse( const std::vector>& backend_ports, + const std::vector& lb_weights = {}, const std::map& drop_categories = {}, const FractionalPercent::DenominatorType denominator = FractionalPercent::MILLION) { @@ -324,7 +326,9 @@ class EdsServiceImpl : public EdsService { assignment.set_cluster_name("service name"); for (size_t i = 0; i < backend_ports.size(); ++i) { auto* endpoints = assignment.add_endpoints(); - endpoints->mutable_load_balancing_weight()->set_value(3); + const int lb_weight = + lb_weights.empty() ? kDefaultLocalityWeight : lb_weights[i]; + endpoints->mutable_load_balancing_weight()->set_value(lb_weight); endpoints->set_priority(0); endpoints->mutable_locality()->set_region(kDefaultLocalityRegion); endpoints->mutable_locality()->set_zone(kDefaultLocalityZone); @@ -620,11 +624,14 @@ class XdsEnd2endTest : public ::testing::Test { return std::make_tuple(num_ok, num_failure, num_drops); } - void WaitForBackend(size_t backend_idx) { + void WaitForBackend(size_t backend_idx, bool reset_counters = true) { + gpr_log(GPR_INFO, + "========= WAITING FOR BACKEND %lu ==========", backend_idx); do { (void)SendRpc(); } while (backends_[backend_idx]->backend_service()->request_count() == 0); - ResetBackendCounters(); + if (reset_counters) ResetBackendCounters(); + gpr_log(GPR_INFO, "========= BACKEND %lu READY ==========", backend_idx); } grpc_core::ServerAddressList CreateLbAddressesFromPortList( @@ -1047,6 +1054,75 @@ TEST_F(SingleBalancerTest, AllServersUnreachableFailFast) { EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } +TEST_F(SingleBalancerTest, LocalityMapWeightedRoundRobin) { + SetNextResolution({}, kDefaultServiceConfig_.c_str()); + SetNextResolutionForLbChannelAllBalancers(); + const size_t kNumRpcs = 5000; + const int kLocalityWeight0 = 2; + const int kLocalityWeight1 = 8; + const int kTotalLocalityWeight = kLocalityWeight0 + kLocalityWeight1; + const double kLocalityWeightRate0 = + static_cast(kLocalityWeight0) / kTotalLocalityWeight; + const double kLocalityWeightRate1 = + static_cast(kLocalityWeight1) / kTotalLocalityWeight; + // EDS response contains 2 localities, each of which contains 1 backend. + ScheduleResponseForBalancer( + 0, + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(0, 2, 2), + {kLocalityWeight0, kLocalityWeight1}), + 0); + // Wait for both backends to be ready. + WaitForAllBackends(1, 0, 2); + // Send kNumRpcs RPCs. + CheckRpcSendOk(kNumRpcs); + // The locality picking rates should be roughly equal to the expectation. + const double locality_picked_rate_0 = + static_cast(backends_[0]->backend_service()->request_count()) / + kNumRpcs; + const double locality_picked_rate_1 = + static_cast(backends_[1]->backend_service()->request_count()) / + kNumRpcs; + const double kErrorTolerance = 0.2; + EXPECT_THAT(locality_picked_rate_0, + ::testing::AllOf( + ::testing::Ge(kLocalityWeightRate0 * (1 - kErrorTolerance)), + ::testing::Le(kLocalityWeightRate0 * (1 + kErrorTolerance)))); + EXPECT_THAT(locality_picked_rate_1, + ::testing::AllOf( + ::testing::Ge(kLocalityWeightRate1 * (1 - kErrorTolerance)), + ::testing::Le(kLocalityWeightRate1 * (1 + kErrorTolerance)))); + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); +} + +TEST_F(SingleBalancerTest, LocalityMapStressTest) { + SetNextResolution({}, kDefaultServiceConfig_.c_str()); + SetNextResolutionForLbChannelAllBalancers(); + const size_t kNumLocalities = 100; + // The first EDS response contains kNumLocalities localities, each of which + // contains backend 0. + const std::vector> locality_list_0(kNumLocalities, + {backends_[0]->port()}); + // The second EDS response contains 1 locality, which contains backend 1. + const std::vector> locality_list_1 = + GetBackendPortsInGroups(1, 2); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(locality_list_0), + 0); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(locality_list_1), + 60 * 1000); + // Wait until backend 0 is ready, before which kNumLocalities localities are + // received and handled by the xds policy. + WaitForBackend(0, /*reset_counters=*/false); + EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); + // Wait until backend 1 is ready, before which kNumLocalities localities are + // removed by the xds policy. + WaitForBackend(1); + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(2U, balancers_[0]->eds_service()->response_count()); +} + TEST_F(SingleBalancerTest, Drop) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); @@ -1061,7 +1137,7 @@ TEST_F(SingleBalancerTest, Drop) { ScheduleResponseForBalancer( 0, EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(), + GetBackendPortsInGroups(), {}, {{kLbDropType, kDropPerMillionForLb}, {kThrottleDropType, kDropPerMillionForThrottle}}), 0); @@ -1102,7 +1178,7 @@ TEST_F(SingleBalancerTest, DropPerHundred) { // The EDS response contains one drop category. ScheduleResponseForBalancer( 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, {{kLbDropType, kDropPerHundredForLb}}, FractionalPercent::HUNDRED), 0); @@ -1142,7 +1218,7 @@ TEST_F(SingleBalancerTest, DropPerTenThousand) { // The EDS response contains one drop category. ScheduleResponseForBalancer( 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, {{kLbDropType, kDropPerTenThousandForLb}}, FractionalPercent::TEN_THOUSAND), 0); @@ -1186,14 +1262,14 @@ TEST_F(SingleBalancerTest, DropUpdate) { // The first EDS response contains one drop category. ScheduleResponseForBalancer( 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, {{kLbDropType, kDropPerMillionForLb}}), 0); // The second EDS response contains two drop categories. ScheduleResponseForBalancer( 0, EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(), + GetBackendPortsInGroups(), {}, {{kLbDropType, kDropPerMillionForLb}, {kThrottleDropType, kDropPerMillionForThrottle}}), 5000); @@ -1279,7 +1355,7 @@ TEST_F(SingleBalancerTest, DropAll) { ScheduleResponseForBalancer( 0, EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(), + GetBackendPortsInGroups(), {}, {{kLbDropType, kDropPerMillionForLb}, {kThrottleDropType, kDropPerMillionForThrottle}}), 0); @@ -1472,7 +1548,7 @@ TEST_F(SingleBalancerTest, FallbackModeIsExitedWhenBalancerSaysToDropAllCalls) { // Return a new balancer that sends a response to drop all calls. ScheduleResponseForBalancer( 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, {{kLbDropType, 1000000}}), 0); SetNextResolutionForLbChannelAllBalancers(); @@ -1930,7 +2006,7 @@ TEST_F(SingleBalancerWithClientLoadReportingAndDropTest, Vanilla) { ScheduleResponseForBalancer( 0, EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(), + GetBackendPortsInGroups(), {}, {{kLbDropType, kDropPerMillionForLb}, {kThrottleDropType, kDropPerMillionForThrottle}}), 0); From fd2122c6e34063981d43af4d5423d57334658e5c Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 12 Aug 2019 10:57:37 -0700 Subject: [PATCH 295/661] Add gnossen and remove vjpai as bazel/** owner. --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1fcdb6ba53c..be1a1329780 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,7 +2,7 @@ # Uses OWNERS files in different modules throughout the # repository as the source of truth for module ownership. /**/OWNERS @markdroth @nicolasnoble @a11r -/bazel/** @nicolasnoble @jtattermusch @a11r @vjpai +/bazel/** @nicolasnoble @jtattermusch @a11r @gnossen /cmake/** @jtattermusch @nicolasnoble @apolcyn /src/core/ext/filters/client_channel/** @markdroth @apolcyn @AspirinSJL /tools/dockerfile/** @jtattermusch @apolcyn @nicolasnoble From 4509af86d71782404d30c385c2cbff59d8bc5e64 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 12 Aug 2019 11:19:28 -0700 Subject: [PATCH 296/661] Update source of truth. --- bazel/OWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazel/OWNERS b/bazel/OWNERS index 30813d1e7a8..aac9668bbd1 100644 --- a/bazel/OWNERS +++ b/bazel/OWNERS @@ -2,5 +2,5 @@ set noparent @nicolasnoble @jtattermusch @a11r -@vjpai +@gnossen From 6c0acf733094f53b86b2ff13a36b0d0b9bfdb17d Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 12 Aug 2019 12:20:20 -0700 Subject: [PATCH 297/661] Swap a11r with veblush. --- .github/CODEOWNERS | 2 +- bazel/OWNERS | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index be1a1329780..f491176bf88 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,7 +2,7 @@ # Uses OWNERS files in different modules throughout the # repository as the source of truth for module ownership. /**/OWNERS @markdroth @nicolasnoble @a11r -/bazel/** @nicolasnoble @jtattermusch @a11r @gnossen +/bazel/** @nicolasnoble @jtattermusch @veblush @gnossen /cmake/** @jtattermusch @nicolasnoble @apolcyn /src/core/ext/filters/client_channel/** @markdroth @apolcyn @AspirinSJL /tools/dockerfile/** @jtattermusch @apolcyn @nicolasnoble diff --git a/bazel/OWNERS b/bazel/OWNERS index aac9668bbd1..b6e63d63996 100644 --- a/bazel/OWNERS +++ b/bazel/OWNERS @@ -1,6 +1,6 @@ set noparent @nicolasnoble @jtattermusch -@a11r +@veblush @gnossen From 8d101f1071fe1e25f41d89e06be54f55ed7fe7a0 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 12 Aug 2019 12:35:58 -0700 Subject: [PATCH 298/661] Wait longer before sending the drop update --- test/cpp/end2end/xds_end2end_test.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 5d114c0ef2b..94f4af0b173 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -1190,13 +1190,16 @@ TEST_F(SingleBalancerTest, DropUpdate) { {{kLbDropType, kDropPerMillionForLb}}), 0); // The second EDS response contains two drop categories. + // TODO(juanlishen): Change the EDS response sending to deterministic style + // (e.g., by using condition variable) so that we can shorten the test + // duration. ScheduleResponseForBalancer( 0, EdsServiceImpl::BuildResponse( GetBackendPortsInGroups(), {{kLbDropType, kDropPerMillionForLb}, {kThrottleDropType, kDropPerMillionForThrottle}}), - 5000); + 10000); WaitForAllBackends(); // Send kNumRpcs RPCs and count the drops. size_t num_drops = 0; From 70eb692a0b525fb53b3dc516bc36a55f1d9f77ed Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 12 Aug 2019 13:19:33 -0700 Subject: [PATCH 299/661] Update copyright --- src/objective-c/GRPCClient/version.h | 2 +- templates/src/objective-c/GRPCClient/version.h.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/objective-c/GRPCClient/version.h b/src/objective-c/GRPCClient/version.h index 64781185ac7..fc6982c55d6 100644 --- a/src/objective-c/GRPCClient/version.h +++ b/src/objective-c/GRPCClient/version.h @@ -1,6 +1,6 @@ /* * - * Copyright 2019 gRPC authors. + * Copyright 2015 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/templates/src/objective-c/GRPCClient/version.h.template b/templates/src/objective-c/GRPCClient/version.h.template index 5623dddb502..22b3bb25d48 100644 --- a/templates/src/objective-c/GRPCClient/version.h.template +++ b/templates/src/objective-c/GRPCClient/version.h.template @@ -2,7 +2,7 @@ --- | /* * - * Copyright 2019 gRPC authors. + * Copyright 2015 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From ae863630d5f96c9581d050c08ad47dd58562b16f Mon Sep 17 00:00:00 2001 From: Yihua Zhang Date: Mon, 12 Aug 2019 14:12:13 -0700 Subject: [PATCH 300/661] Add spiffe client-side credential reload --- CMakeLists.txt | 44 +++ Makefile | 48 +++ build.yaml | 14 + grpc.def | 2 + include/grpc/grpc_security.h | 24 +- .../tls/grpc_tls_credentials_options.cc | 23 ++ .../tls/grpc_tls_credentials_options.h | 3 + .../credentials/tls/spiffe_credentials.cc | 6 +- .../security/security_connector/ssl_utils.h | 12 +- .../tls/spiffe_security_connector.cc | 210 ++++++++++--- .../tls/spiffe_security_connector.h | 35 ++- src/ruby/ext/grpc/rb_grpc_imports.generated.c | 4 + src/ruby/ext/grpc/rb_grpc_imports.generated.h | 6 + test/core/end2end/fixtures/h2_spiffe.cc | 8 + test/core/security/BUILD | 16 + .../spiffe_security_connector_test.cc | 282 ++++++++++++++++++ .../core/surface/public_headers_must_be_c89.c | 2 + .../generated/sources_and_headers.json | 19 ++ tools/run_tests/generated/tests.json | 24 ++ 19 files changed, 722 insertions(+), 60 deletions(-) create mode 100644 test/core/security/spiffe_security_connector_test.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 21511bb9738..678ad9bdbb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -641,6 +641,7 @@ add_dependencies(buildtests_cxx grpc_cli) add_dependencies(buildtests_cxx grpc_core_map_test) add_dependencies(buildtests_cxx grpc_fetch_oauth2) add_dependencies(buildtests_cxx grpc_linux_system_roots_test) +add_dependencies(buildtests_cxx grpc_spiffe_security_connector_test) add_dependencies(buildtests_cxx grpc_tool_test) add_dependencies(buildtests_cxx grpclb_api_test) add_dependencies(buildtests_cxx grpclb_end2end_test) @@ -14722,6 +14723,49 @@ endif() endif (gRPC_BUILD_CODEGEN) if (gRPC_BUILD_TESTS) +add_executable(grpc_spiffe_security_connector_test + test/core/security/spiffe_security_connector_test.cc + third_party/googletest/googletest/src/gtest-all.cc + third_party/googletest/googlemock/src/gmock-all.cc +) + + +target_include_directories(grpc_spiffe_security_connector_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} + PRIVATE ${_gRPC_CARES_INCLUDE_DIR} + PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} + PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest + PRIVATE third_party/googletest/googlemock/include + PRIVATE third_party/googletest/googlemock + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(grpc_spiffe_security_connector_test + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc_test_util + grpc++_test_util + grpc++ + grpc + gpr + ${_gRPC_GFLAGS_LIBRARIES} +) + + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + add_executable(grpc_tool_test ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.pb.cc ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.grpc.pb.cc diff --git a/Makefile b/Makefile index 268e454761c..66c4f4489ed 100644 --- a/Makefile +++ b/Makefile @@ -1222,6 +1222,7 @@ grpc_objective_c_plugin: $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin grpc_php_plugin: $(BINDIR)/$(CONFIG)/grpc_php_plugin grpc_python_plugin: $(BINDIR)/$(CONFIG)/grpc_python_plugin grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin +grpc_spiffe_security_connector_test: $(BINDIR)/$(CONFIG)/grpc_spiffe_security_connector_test grpc_tool_test: $(BINDIR)/$(CONFIG)/grpc_tool_test grpclb_api_test: $(BINDIR)/$(CONFIG)/grpclb_api_test grpclb_end2end_test: $(BINDIR)/$(CONFIG)/grpclb_end2end_test @@ -1695,6 +1696,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/grpc_core_map_test \ $(BINDIR)/$(CONFIG)/grpc_fetch_oauth2 \ $(BINDIR)/$(CONFIG)/grpc_linux_system_roots_test \ + $(BINDIR)/$(CONFIG)/grpc_spiffe_security_connector_test \ $(BINDIR)/$(CONFIG)/grpc_tool_test \ $(BINDIR)/$(CONFIG)/grpclb_api_test \ $(BINDIR)/$(CONFIG)/grpclb_end2end_test \ @@ -1862,6 +1864,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/grpc_core_map_test \ $(BINDIR)/$(CONFIG)/grpc_fetch_oauth2 \ $(BINDIR)/$(CONFIG)/grpc_linux_system_roots_test \ + $(BINDIR)/$(CONFIG)/grpc_spiffe_security_connector_test \ $(BINDIR)/$(CONFIG)/grpc_tool_test \ $(BINDIR)/$(CONFIG)/grpclb_api_test \ $(BINDIR)/$(CONFIG)/grpclb_end2end_test \ @@ -2370,6 +2373,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/grpc_core_map_test || ( echo test grpc_core_map_test failed ; exit 1 ) $(E) "[RUN] Testing grpc_linux_system_roots_test" $(Q) $(BINDIR)/$(CONFIG)/grpc_linux_system_roots_test || ( echo test grpc_linux_system_roots_test failed ; exit 1 ) + $(E) "[RUN] Testing grpc_spiffe_security_connector_test" + $(Q) $(BINDIR)/$(CONFIG)/grpc_spiffe_security_connector_test || ( echo test grpc_spiffe_security_connector_test failed ; exit 1 ) $(E) "[RUN] Testing grpc_tool_test" $(Q) $(BINDIR)/$(CONFIG)/grpc_tool_test || ( echo test grpc_tool_test failed ; exit 1 ) $(E) "[RUN] Testing grpclb_api_test" @@ -16944,6 +16949,49 @@ ifneq ($(NO_DEPS),true) endif +GRPC_SPIFFE_SECURITY_CONNECTOR_TEST_SRC = \ + test/core/security/spiffe_security_connector_test.cc \ + +GRPC_SPIFFE_SECURITY_CONNECTOR_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_SPIFFE_SECURITY_CONNECTOR_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/grpc_spiffe_security_connector_test: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+. + +$(BINDIR)/$(CONFIG)/grpc_spiffe_security_connector_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/grpc_spiffe_security_connector_test: $(PROTOBUF_DEP) $(GRPC_SPIFFE_SECURITY_CONNECTOR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_SPIFFE_SECURITY_CONNECTOR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/grpc_spiffe_security_connector_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/core/security/spiffe_security_connector_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_grpc_spiffe_security_connector_test: $(GRPC_SPIFFE_SECURITY_CONNECTOR_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(GRPC_SPIFFE_SECURITY_CONNECTOR_TEST_OBJS:.o=.dep) +endif +endif + + GRPC_TOOL_TEST_SRC = \ $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc \ $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc \ diff --git a/build.yaml b/build.yaml index f8375eaf61f..c7f638495f8 100644 --- a/build.yaml +++ b/build.yaml @@ -5112,6 +5112,20 @@ targets: deps: - grpc_plugin_support secure: false +- name: grpc_spiffe_security_connector_test + gtest: true + build: test + language: c++ + src: + - test/core/security/spiffe_security_connector_test.cc + deps: + - grpc_test_util + - grpc++_test_util + - grpc++ + - grpc + - gpr + uses: + - grpc++_test - name: grpc_tool_test gtest: true build: test diff --git a/grpc.def b/grpc.def index f451775dba6..fa4d73c9252 100644 --- a/grpc.def +++ b/grpc.def @@ -141,6 +141,8 @@ EXPORTS grpc_tls_credentials_options_set_server_authorization_check_config grpc_tls_key_materials_config_create grpc_tls_key_materials_config_set_key_materials + grpc_tls_key_materials_config_set_version + grpc_tls_key_materials_config_get_version grpc_tls_credential_reload_config_create grpc_tls_server_authorization_check_config_create grpc_raw_byte_buffer_create diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index 777142f38c6..794900b3b16 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -778,6 +778,21 @@ GRPCAPI int grpc_tls_key_materials_config_set_key_materials( const grpc_ssl_pem_key_cert_pair** pem_key_cert_pairs, size_t num_key_cert_pairs); +/** Set grpc_tls_key_materials_config instance with a provided version number, + which is used to keep track of the version of key materials. + It returns 1 on success and 0 on failure. It is used for + experimental purpose for now and subject to change. + */ +GRPCAPI int grpc_tls_key_materials_config_set_version( + grpc_tls_key_materials_config* config, int version); + +/** Get the version number of a grpc_tls_key_materials_config instance. + It returns the version number on success and -1 on failure. + It is used for experimental purpose for now and subject to change. + */ +GRPCAPI int grpc_tls_key_materials_config_get_version( + grpc_tls_key_materials_config* config); + /** --- TLS credential reload config. --- It is used for experimental purpose for now and subject to change.*/ @@ -793,10 +808,11 @@ typedef void (*grpc_tls_on_credential_reload_done_cb)( /** A struct containing all information necessary to schedule/cancel a credential reload request. cb and cb_user_data represent a gRPC-provided callback and an argument passed to it. key_materials is an in/output - parameter containing currently used/newly reloaded credentials. status and - error_details are used to hold information about errors occurred when a - credential reload request is scheduled/cancelled. It is used for - experimental purpose for now and subject to change. */ + parameter containing currently used/newly reloaded credentials. If + credential reload does not result in a new credential, key_materials should + not be modified. status and error_details are used to hold information about + errors occurred when a credential reload request is scheduled/cancelled. It + is used for experimental purpose for now and subject to change. */ struct grpc_tls_credential_reload_arg { grpc_tls_on_credential_reload_done_cb cb; void* cb_user_data; diff --git a/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc b/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc index a6169a1b586..7e0af3dcc17 100644 --- a/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +++ b/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc @@ -157,6 +157,29 @@ int grpc_tls_key_materials_config_set_key_materials( return 1; } +int grpc_tls_key_materials_config_set_version( + grpc_tls_key_materials_config* config, int version) { + if (config == nullptr) { + gpr_log(GPR_ERROR, + "Invalid arguments to " + "grpc_tls_key_materials_config_set_version()"); + return 0; + } + config->set_version(version); + return 1; +} + +int grpc_tls_key_materials_config_get_version( + grpc_tls_key_materials_config* config) { + if (config == nullptr) { + gpr_log(GPR_ERROR, + "Invalid arguments to " + "grpc_tls_key_materials_config_get_version()"); + return -1; + } + return config->version(); +} + grpc_tls_credential_reload_config* grpc_tls_credential_reload_config_create( const void* config_user_data, int (*schedule)(void* config_user_data, diff --git a/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h b/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h index aee9292acb8..af4074138cf 100644 --- a/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +++ b/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h @@ -39,12 +39,15 @@ struct grpc_tls_key_materials_config const PemKeyCertPairList& pem_key_cert_pair_list() const { return pem_key_cert_pair_list_; } + int version() const { return version_; } /** Setters for member fields. **/ void set_key_materials(grpc_core::UniquePtr pem_root_certs, PemKeyCertPairList pem_key_cert_pair_list); + void set_version(int version) { version_ = version; } private: + int version_ = 0; PemKeyCertPairList pem_key_cert_pair_list_; grpc_core::UniquePtr pem_root_certs_; }; diff --git a/src/core/lib/security/credentials/tls/spiffe_credentials.cc b/src/core/lib/security/credentials/tls/spiffe_credentials.cc index da764936c76..e8433bf09b8 100644 --- a/src/core/lib/security/credentials/tls/spiffe_credentials.cc +++ b/src/core/lib/security/credentials/tls/spiffe_credentials.cc @@ -84,7 +84,7 @@ SpiffeCredentials::create_security_connector( static_cast(arg->value.pointer.p); } } - grpc_core::RefCountedPtr sc = + grpc_core::RefCountedPtr sc = grpc_core:: SpiffeChannelSecurityConnector::CreateSpiffeChannelSecurityConnector( this->Ref(), std::move(call_creds), target_name, overridden_target_name, ssl_session_cache); @@ -106,8 +106,8 @@ SpiffeServerCredentials::~SpiffeServerCredentials() {} grpc_core::RefCountedPtr SpiffeServerCredentials::create_security_connector() { - return SpiffeServerSecurityConnector::CreateSpiffeServerSecurityConnector( - this->Ref()); + return grpc_core::SpiffeServerSecurityConnector:: + CreateSpiffeServerSecurityConnector(this->Ref()); } grpc_channel_credentials* grpc_tls_spiffe_credentials_create( diff --git a/src/core/lib/security/security_connector/ssl_utils.h b/src/core/lib/security/security_connector/ssl_utils.h index bf8c1de3aae..29366b309e8 100644 --- a/src/core/lib/security/security_connector/ssl_utils.h +++ b/src/core/lib/security/security_connector/ssl_utils.h @@ -149,9 +149,15 @@ class PemKeyCertPair { return *this; } - // Not copyable. - PemKeyCertPair(const PemKeyCertPair&) = delete; - PemKeyCertPair& operator=(const PemKeyCertPair&) = delete; + // Copyable. + PemKeyCertPair(const PemKeyCertPair& other) + : private_key_(gpr_strdup(other.private_key())), + cert_chain_(gpr_strdup(other.cert_chain())) {} + PemKeyCertPair& operator=(const PemKeyCertPair& other) { + private_key_ = grpc_core::UniquePtr(gpr_strdup(other.private_key())); + cert_chain_ = grpc_core::UniquePtr(gpr_strdup(other.cert_chain())); + return *this; + } char* private_key() const { return private_key_.get(); } char* cert_chain() const { return cert_chain_.get(); } diff --git a/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc b/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc index 5853de4fc13..be20b60645b 100644 --- a/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +++ b/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc @@ -38,6 +38,8 @@ #include "src/core/tsi/ssl_transport_security.h" #include "src/core/tsi/transport_security.h" +namespace grpc_core { + namespace { tsi_ssl_pem_key_cert_pair* ConvertToTsiPemKeyCertPair( @@ -58,42 +60,55 @@ tsi_ssl_pem_key_cert_pair* ConvertToTsiPemKeyCertPair( return tsi_pairs; } -/** -- Util function to populate SPIFFE server/channel credentials. -- */ -grpc_core::RefCountedPtr -PopulateSpiffeCredentials(const grpc_tls_credentials_options& options) { - GPR_ASSERT(options.credential_reload_config() != nullptr || - options.key_materials_config() != nullptr); - grpc_core::RefCountedPtr key_materials_config; +} // namespace + +/** -- Util function to fetch SPIFFE server/channel credentials. -- */ +grpc_status_code TlsFetchKeyMaterials( + const grpc_core::RefCountedPtr& + key_materials_config, + const grpc_tls_credentials_options& options, + grpc_ssl_certificate_config_reload_status* reload_status) { + GPR_ASSERT(key_materials_config != nullptr); + bool is_key_materials_empty = + key_materials_config->pem_key_cert_pair_list().empty(); + if (options.credential_reload_config() == nullptr && is_key_materials_empty) { + gpr_log(GPR_ERROR, + "Either credential reload config or key materials should be " + "provisioned."); + return GRPC_STATUS_FAILED_PRECONDITION; + } + grpc_status_code status = GRPC_STATUS_OK; /* Use credential reload config to fetch credentials. */ if (options.credential_reload_config() != nullptr) { grpc_tls_credential_reload_arg* arg = grpc_core::New(); - key_materials_config = grpc_tls_key_materials_config_create()->Ref(); arg->key_materials_config = key_materials_config.get(); int result = options.credential_reload_config()->Schedule(arg); if (result) { /* Do not support async credential reload. */ gpr_log(GPR_ERROR, "Async credential reload is unsupported now."); + status = + is_key_materials_empty ? GRPC_STATUS_UNIMPLEMENTED : GRPC_STATUS_OK; } else { - grpc_ssl_certificate_config_reload_status status = arg->status; - if (status == GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED) { + GPR_ASSERT(reload_status != nullptr); + *reload_status = arg->status; + if (arg->status == GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED) { + /* Key materials is not empty. */ gpr_log(GPR_DEBUG, "Credential does not change after reload."); - } else if (status == GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL) { - gpr_log(GPR_ERROR, "Credential reload failed with an error: %s", - arg->error_details); + } else if (arg->status == GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL) { + gpr_log(GPR_ERROR, "Credential reload failed with an error:"); + if (arg->error_details != nullptr) { + gpr_log(GPR_ERROR, "%s", arg->error_details); + } + status = is_key_materials_empty ? GRPC_STATUS_INTERNAL : GRPC_STATUS_OK; } } gpr_free((void*)arg->error_details); grpc_core::Delete(arg); - /* Use existing key materials config. */ - } else { - key_materials_config = options.key_materials_config()->Ref(); } - return key_materials_config; + return status; } -} // namespace - SpiffeChannelSecurityConnector::SpiffeChannelSecurityConnector( grpc_core::RefCountedPtr channel_creds, grpc_core::RefCountedPtr request_metadata_creds, @@ -104,6 +119,7 @@ SpiffeChannelSecurityConnector::SpiffeChannelSecurityConnector( overridden_target_name_(overridden_target_name == nullptr ? nullptr : gpr_strdup(overridden_target_name)) { + key_materials_config_ = grpc_tls_key_materials_config_create()->Ref(); check_arg_ = ServerAuthorizationCheckArgCreate(this); grpc_core::StringView host; grpc_core::StringView port; @@ -115,12 +131,19 @@ SpiffeChannelSecurityConnector::~SpiffeChannelSecurityConnector() { if (client_handshaker_factory_ != nullptr) { tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory_); } + if (key_materials_config_.get() != nullptr) { + key_materials_config_.get()->Unref(); + } ServerAuthorizationCheckArgDestroy(check_arg_); } void SpiffeChannelSecurityConnector::add_handshakers( grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_mgr) { + if (RefreshHandshakerFactory() != GRPC_SECURITY_OK) { + gpr_log(GPR_ERROR, "Handshaker factory refresh failed."); + return; + } // Instantiate TSI handshaker. tsi_handshaker* tsi_hs = nullptr; tsi_result result = tsi_ssl_client_handshaker_factory_create_handshaker( @@ -239,32 +262,75 @@ SpiffeChannelSecurityConnector::CreateSpiffeChannelSecurityConnector( std::move(channel_creds), std::move(request_metadata_creds), target_name, overridden_target_name); if (c->InitializeHandshakerFactory(ssl_session_cache) != GRPC_SECURITY_OK) { + gpr_log(GPR_ERROR, "Could not initialize client handshaker factory."); return nullptr; } return c; } -grpc_security_status -SpiffeChannelSecurityConnector::InitializeHandshakerFactory( +grpc_security_status SpiffeChannelSecurityConnector::ReplaceHandshakerFactory( tsi_ssl_session_cache* ssl_session_cache) { - const SpiffeCredentials* creds = - static_cast(channel_creds()); - auto key_materials_config = PopulateSpiffeCredentials(creds->options()); - if (key_materials_config->pem_key_cert_pair_list().empty()) { - key_materials_config->Unref(); - return GRPC_SECURITY_ERROR; + /* Free the client handshaker factory if exists. */ + if (client_handshaker_factory_) { + tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory_); } + GPR_ASSERT(!key_materials_config_->pem_key_cert_pair_list().empty()); tsi_ssl_pem_key_cert_pair* pem_key_cert_pair = ConvertToTsiPemKeyCertPair( - key_materials_config->pem_key_cert_pair_list()); + key_materials_config_->pem_key_cert_pair_list()); grpc_security_status status = grpc_ssl_tsi_client_handshaker_factory_init( - pem_key_cert_pair, key_materials_config->pem_root_certs(), + pem_key_cert_pair, key_materials_config_->pem_root_certs(), ssl_session_cache, &client_handshaker_factory_); - // Free memory. - key_materials_config->Unref(); + /* Free memory. */ grpc_tsi_ssl_pem_key_cert_pairs_destroy(pem_key_cert_pair, 1); return status; } +grpc_security_status +SpiffeChannelSecurityConnector::InitializeHandshakerFactory( + tsi_ssl_session_cache* ssl_session_cache) { + grpc_core::MutexLock lock(&mu_); + const SpiffeCredentials* creds = + static_cast(channel_creds()); + grpc_tls_key_materials_config* key_materials_config = + creds->options().key_materials_config(); + /* Copy key materials config from credential options. */ + if (key_materials_config != nullptr) { + grpc_tls_key_materials_config::PemKeyCertPairList cert_pair_list = + key_materials_config->pem_key_cert_pair_list(); + auto pem_root_certs = grpc_core::UniquePtr( + gpr_strdup(key_materials_config->pem_root_certs())); + key_materials_config_->set_key_materials(std::move(pem_root_certs), + std::move(cert_pair_list)); + } + grpc_ssl_certificate_config_reload_status reload_status = + GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED; + if (TlsFetchKeyMaterials(key_materials_config_, creds->options(), + &reload_status) != GRPC_STATUS_OK) { + /* Raise an error if key materials are not populated. */ + return GRPC_SECURITY_ERROR; + } + return ReplaceHandshakerFactory(ssl_session_cache); +} + +grpc_security_status +SpiffeChannelSecurityConnector::RefreshHandshakerFactory() { + grpc_core::MutexLock lock(&mu_); + const SpiffeCredentials* creds = + static_cast(channel_creds()); + grpc_ssl_certificate_config_reload_status reload_status = + GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED; + if (TlsFetchKeyMaterials(key_materials_config_, creds->options(), + &reload_status) != GRPC_STATUS_OK) { + return GRPC_SECURITY_ERROR; + } + if (reload_status != GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW) { + // Re-use existing handshaker factory. + return GRPC_SECURITY_OK; + } else { + return ReplaceHandshakerFactory(nullptr); + } +} + void SpiffeChannelSecurityConnector::ServerAuthorizationCheckDone( grpc_tls_server_authorization_check_arg* arg) { GPR_ASSERT(arg != nullptr); @@ -332,19 +398,28 @@ void SpiffeChannelSecurityConnector::ServerAuthorizationCheckArgDestroy( SpiffeServerSecurityConnector::SpiffeServerSecurityConnector( grpc_core::RefCountedPtr server_creds) : grpc_server_security_connector(GRPC_SSL_URL_SCHEME, - std::move(server_creds)) {} + std::move(server_creds)) { + key_materials_config_ = grpc_tls_key_materials_config_create()->Ref(); +} SpiffeServerSecurityConnector::~SpiffeServerSecurityConnector() { if (server_handshaker_factory_ != nullptr) { tsi_ssl_server_handshaker_factory_unref(server_handshaker_factory_); } + if (key_materials_config_.get() != nullptr) { + key_materials_config_.get()->Unref(); + } } void SpiffeServerSecurityConnector::add_handshakers( grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_mgr) { + /* Refresh handshaker factory if needed. */ + if (RefreshHandshakerFactory() != GRPC_SECURITY_OK) { + gpr_log(GPR_ERROR, "Handshaker factory refresh failed."); + return; + } /* Create a TLS SPIFFE TSI handshaker for server. */ - RefreshServerHandshakerFactory(); tsi_handshaker* tsi_hs = nullptr; tsi_result result = tsi_ssl_server_handshaker_factory_create_handshaker( server_handshaker_factory_, &tsi_hs); @@ -384,39 +459,76 @@ SpiffeServerSecurityConnector::CreateSpiffeServerSecurityConnector( grpc_core::RefCountedPtr c = grpc_core::MakeRefCounted( std::move(server_creds)); - if (c->RefreshServerHandshakerFactory() != GRPC_SECURITY_OK) { + if (c->InitializeHandshakerFactory() != GRPC_SECURITY_OK) { + gpr_log(GPR_ERROR, "Could not initialize server handshaker factory."); return nullptr; } return c; } -grpc_security_status -SpiffeServerSecurityConnector::RefreshServerHandshakerFactory() { +grpc_security_status SpiffeServerSecurityConnector::ReplaceHandshakerFactory() { const SpiffeServerCredentials* creds = static_cast(server_creds()); - auto key_materials_config = PopulateSpiffeCredentials(creds->options()); - /* Credential reload does NOT take effect and we need to keep using - * the existing handshaker factory. */ - if (key_materials_config->pem_key_cert_pair_list().empty()) { - key_materials_config->Unref(); - return GRPC_SECURITY_ERROR; - } - /* Credential reload takes effect and we need to free the existing - * handshaker library. */ + /* Free the server handshaker factory if exists. */ if (server_handshaker_factory_) { tsi_ssl_server_handshaker_factory_unref(server_handshaker_factory_); } + GPR_ASSERT(!key_materials_config_->pem_key_cert_pair_list().empty()); tsi_ssl_pem_key_cert_pair* pem_key_cert_pairs = ConvertToTsiPemKeyCertPair( - key_materials_config->pem_key_cert_pair_list()); + key_materials_config_->pem_key_cert_pair_list()); size_t num_key_cert_pairs = - key_materials_config->pem_key_cert_pair_list().size(); + key_materials_config_->pem_key_cert_pair_list().size(); grpc_security_status status = grpc_ssl_tsi_server_handshaker_factory_init( pem_key_cert_pairs, num_key_cert_pairs, - key_materials_config->pem_root_certs(), + key_materials_config_->pem_root_certs(), creds->options().cert_request_type(), &server_handshaker_factory_); - // Free memory. - key_materials_config->Unref(); + /* Free memory. */ grpc_tsi_ssl_pem_key_cert_pairs_destroy(pem_key_cert_pairs, num_key_cert_pairs); return status; } + +grpc_security_status +SpiffeServerSecurityConnector::InitializeHandshakerFactory() { + grpc_core::MutexLock lock(&mu_); + const SpiffeServerCredentials* creds = + static_cast(server_creds()); + grpc_tls_key_materials_config* key_materials_config = + creds->options().key_materials_config(); + if (key_materials_config != nullptr) { + grpc_tls_key_materials_config::PemKeyCertPairList cert_pair_list = + key_materials_config->pem_key_cert_pair_list(); + auto pem_root_certs = grpc_core::UniquePtr( + gpr_strdup(key_materials_config->pem_root_certs())); + key_materials_config_->set_key_materials(std::move(pem_root_certs), + std::move(cert_pair_list)); + } + grpc_ssl_certificate_config_reload_status reload_status = + GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED; + if (TlsFetchKeyMaterials(key_materials_config_, creds->options(), + &reload_status) != GRPC_STATUS_OK) { + /* Raise an error if key materials are not populated. */ + return GRPC_SECURITY_ERROR; + } + return ReplaceHandshakerFactory(); +} + +grpc_security_status SpiffeServerSecurityConnector::RefreshHandshakerFactory() { + grpc_core::MutexLock lock(&mu_); + const SpiffeServerCredentials* creds = + static_cast(server_creds()); + grpc_ssl_certificate_config_reload_status reload_status = + GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED; + if (TlsFetchKeyMaterials(key_materials_config_, creds->options(), + &reload_status) != GRPC_STATUS_OK) { + return GRPC_SECURITY_ERROR; + } + if (reload_status != GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW) { + /* At this point, we should have key materials populated. */ + return GRPC_SECURITY_OK; + } else { + return ReplaceHandshakerFactory(); + } +} + +} // namespace grpc_core diff --git a/src/core/lib/security/security_connector/tls/spiffe_security_connector.h b/src/core/lib/security/security_connector/tls/spiffe_security_connector.h index 5ea00ee85b6..3739b463159 100644 --- a/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +++ b/src/core/lib/security/security_connector/tls/spiffe_security_connector.h @@ -21,11 +21,14 @@ #include +#include "src/core/lib/gprpp/sync.h" #include "src/core/lib/security/context/security_context.h" #include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h" #define GRPC_TLS_SPIFFE_TRANSPORT_SECURITY_TYPE "spiffe" +namespace grpc_core { + // Spiffe channel security connector. class SpiffeChannelSecurityConnector final : public grpc_channel_security_connector { @@ -66,6 +69,11 @@ class SpiffeChannelSecurityConnector final grpc_security_status InitializeHandshakerFactory( tsi_ssl_session_cache* ssl_session_cache); + // A util function to create a new client handshaker factory to replace + // the existing one if exists. + grpc_security_status ReplaceHandshakerFactory( + tsi_ssl_session_cache* ssl_session_cache); + // gRPC-provided callback executed by application, which servers to bring the // control back to gRPC core. static void ServerAuthorizationCheckDone( @@ -83,11 +91,17 @@ class SpiffeChannelSecurityConnector final static void ServerAuthorizationCheckArgDestroy( grpc_tls_server_authorization_check_arg* arg); + // A util function to refresh SSL TSI client handshaker factory with a valid + // credential. + grpc_security_status RefreshHandshakerFactory(); + + grpc_core::Mutex mu_; grpc_closure* on_peer_checked_; grpc_core::UniquePtr target_name_; grpc_core::UniquePtr overridden_target_name_; tsi_ssl_client_handshaker_factory* client_handshaker_factory_ = nullptr; grpc_tls_server_authorization_check_arg* check_arg_; + grpc_core::RefCountedPtr key_materials_config_; }; // Spiffe server security connector. @@ -113,11 +127,30 @@ class SpiffeServerSecurityConnector final int cmp(const grpc_security_connector* other) const override; private: + // Initialize SSL TSI server handshaker factory. + grpc_security_status InitializeHandshakerFactory(); + + // A util function to create a new server handshaker factory to replace the + // existing once if exists. + grpc_security_status ReplaceHandshakerFactory(); + // A util function to refresh SSL TSI server handshaker factory with a valid // credential. - grpc_security_status RefreshServerHandshakerFactory(); + grpc_security_status RefreshHandshakerFactory(); + + grpc_core::Mutex mu_; tsi_ssl_server_handshaker_factory* server_handshaker_factory_ = nullptr; + grpc_core::RefCountedPtr key_materials_config_; }; +// Exposed for testing only. +grpc_status_code TlsFetchKeyMaterials( + const grpc_core::RefCountedPtr& + key_materials_config, + const grpc_tls_credentials_options& options, + grpc_ssl_certificate_config_reload_status* status); + +} // namespace grpc_core + #endif /* GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_TLS_SPIFFE_SECURITY_CONNECTOR_H \ */ diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index fa275c75419..6cb10c9126c 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -164,6 +164,8 @@ grpc_tls_credentials_options_set_credential_reload_config_type grpc_tls_credenti grpc_tls_credentials_options_set_server_authorization_check_config_type grpc_tls_credentials_options_set_server_authorization_check_config_import; grpc_tls_key_materials_config_create_type grpc_tls_key_materials_config_create_import; grpc_tls_key_materials_config_set_key_materials_type grpc_tls_key_materials_config_set_key_materials_import; +grpc_tls_key_materials_config_set_version_type grpc_tls_key_materials_config_set_version_import; +grpc_tls_key_materials_config_get_version_type grpc_tls_key_materials_config_get_version_import; grpc_tls_credential_reload_config_create_type grpc_tls_credential_reload_config_create_import; grpc_tls_server_authorization_check_config_create_type grpc_tls_server_authorization_check_config_create_import; grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import; @@ -435,6 +437,8 @@ void grpc_rb_load_imports(HMODULE library) { grpc_tls_credentials_options_set_server_authorization_check_config_import = (grpc_tls_credentials_options_set_server_authorization_check_config_type) GetProcAddress(library, "grpc_tls_credentials_options_set_server_authorization_check_config"); grpc_tls_key_materials_config_create_import = (grpc_tls_key_materials_config_create_type) GetProcAddress(library, "grpc_tls_key_materials_config_create"); grpc_tls_key_materials_config_set_key_materials_import = (grpc_tls_key_materials_config_set_key_materials_type) GetProcAddress(library, "grpc_tls_key_materials_config_set_key_materials"); + grpc_tls_key_materials_config_set_version_import = (grpc_tls_key_materials_config_set_version_type) GetProcAddress(library, "grpc_tls_key_materials_config_set_version"); + grpc_tls_key_materials_config_get_version_import = (grpc_tls_key_materials_config_get_version_type) GetProcAddress(library, "grpc_tls_key_materials_config_get_version"); grpc_tls_credential_reload_config_create_import = (grpc_tls_credential_reload_config_create_type) GetProcAddress(library, "grpc_tls_credential_reload_config_create"); grpc_tls_server_authorization_check_config_create_import = (grpc_tls_server_authorization_check_config_create_type) GetProcAddress(library, "grpc_tls_server_authorization_check_config_create"); grpc_raw_byte_buffer_create_import = (grpc_raw_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_byte_buffer_create"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index 1389c301728..46912af5f5a 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -467,6 +467,12 @@ extern grpc_tls_key_materials_config_create_type grpc_tls_key_materials_config_c typedef int(*grpc_tls_key_materials_config_set_key_materials_type)(grpc_tls_key_materials_config* config, const char* pem_root_certs, const grpc_ssl_pem_key_cert_pair** pem_key_cert_pairs, size_t num_key_cert_pairs); extern grpc_tls_key_materials_config_set_key_materials_type grpc_tls_key_materials_config_set_key_materials_import; #define grpc_tls_key_materials_config_set_key_materials grpc_tls_key_materials_config_set_key_materials_import +typedef int(*grpc_tls_key_materials_config_set_version_type)(grpc_tls_key_materials_config* config, int version); +extern grpc_tls_key_materials_config_set_version_type grpc_tls_key_materials_config_set_version_import; +#define grpc_tls_key_materials_config_set_version grpc_tls_key_materials_config_set_version_import +typedef int(*grpc_tls_key_materials_config_get_version_type)(grpc_tls_key_materials_config* config); +extern grpc_tls_key_materials_config_get_version_type grpc_tls_key_materials_config_get_version_import; +#define grpc_tls_key_materials_config_get_version grpc_tls_key_materials_config_get_version_import typedef grpc_tls_credential_reload_config*(*grpc_tls_credential_reload_config_create_type)(const void* config_user_data, int (*schedule)(void* config_user_data, grpc_tls_credential_reload_arg* arg), void (*cancel)(void* config_user_data, grpc_tls_credential_reload_arg* arg), void (*destruct)(void* config_user_data)); extern grpc_tls_credential_reload_config_create_type grpc_tls_credential_reload_config_create_import; #define grpc_tls_credential_reload_config_create grpc_tls_credential_reload_config_create_import diff --git a/test/core/end2end/fixtures/h2_spiffe.cc b/test/core/end2end/fixtures/h2_spiffe.cc index 4352ef640cd..37fb44b5ad6 100644 --- a/test/core/end2end/fixtures/h2_spiffe.cc +++ b/test/core/end2end/fixtures/h2_spiffe.cc @@ -138,6 +138,10 @@ static int server_authz_check_async( // grpc_tls_credentials_options instance. static int client_cred_reload_sync(void* config_user_data, grpc_tls_credential_reload_arg* arg) { + if (!arg->key_materials_config->pem_key_cert_pair_list().empty()) { + arg->status = GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED; + return 0; + } grpc_ssl_pem_key_cert_pair** key_cert_pair = static_cast( gpr_zalloc(sizeof(grpc_ssl_pem_key_cert_pair*))); @@ -160,6 +164,10 @@ static int client_cred_reload_sync(void* config_user_data, // grpc_tls_credentials_options instance. static int server_cred_reload_sync(void* config_user_data, grpc_tls_credential_reload_arg* arg) { + if (!arg->key_materials_config->pem_key_cert_pair_list().empty()) { + arg->status = GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED; + return 0; + } grpc_ssl_pem_key_cert_pair** key_cert_pair = static_cast( gpr_zalloc(sizeof(grpc_ssl_pem_key_cert_pair*))); diff --git a/test/core/security/BUILD b/test/core/security/BUILD index d430ccfe215..b6d43c62722 100644 --- a/test/core/security/BUILD +++ b/test/core/security/BUILD @@ -252,3 +252,19 @@ grpc_cc_test( "//test/core/util:grpc_test_util", ], ) + +grpc_cc_test( + name = "spiffe_security_connector_test", + srcs = ["spiffe_security_connector_test.cc"], + language = "C++", + external_deps = [ + "gtest", + ], + deps = [ + "//:gpr", + "//:grpc", + "//:grpc_secure", + "//test/core/util:grpc_test_util", + "//test/core/end2end:ssl_test_data", + ], +) diff --git a/test/core/security/spiffe_security_connector_test.cc b/test/core/security/spiffe_security_connector_test.cc new file mode 100644 index 00000000000..785ae1b8128 --- /dev/null +++ b/test/core/security/spiffe_security_connector_test.cc @@ -0,0 +1,282 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include + +#include +#include +#include +#include +#include + +#include "src/core/lib/security/security_connector/tls/spiffe_security_connector.h" +#include "test/core/end2end/data/ssl_test_data.h" +#include "test/core/util/test_config.h" + +namespace { + +enum CredReloadResult { FAIL, SUCCESS, UNCHANGED, ASYNC }; + +void SetKeyMaterials(grpc_tls_key_materials_config* config) { + grpc_ssl_pem_key_cert_pair** key_cert_pair = + static_cast( + gpr_zalloc(sizeof(grpc_ssl_pem_key_cert_pair*))); + key_cert_pair[0] = static_cast( + gpr_zalloc(sizeof(grpc_ssl_pem_key_cert_pair))); + key_cert_pair[0]->private_key = gpr_strdup(test_server1_key); + key_cert_pair[0]->cert_chain = gpr_strdup(test_server1_cert); + grpc_tls_key_materials_config_set_key_materials( + config, gpr_strdup(test_root_cert), + (const grpc_ssl_pem_key_cert_pair**)key_cert_pair, 1); +} + +int CredReloadSuccess(void* config_user_data, + grpc_tls_credential_reload_arg* arg) { + SetKeyMaterials(arg->key_materials_config); + arg->status = GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW; + return 0; +} + +int CredReloadFail(void* config_user_data, + grpc_tls_credential_reload_arg* arg) { + arg->status = GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL; + return 0; +} + +int CredReloadUnchanged(void* config_user_data, + grpc_tls_credential_reload_arg* arg) { + arg->status = GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED; + return 0; +} + +int CredReloadAsync(void* config_user_data, + grpc_tls_credential_reload_arg* arg) { + return 1; +} + +} // namespace + +namespace grpc { +namespace testing { + +class SpiffeSecurityConnectorTest : public ::testing::Test { + protected: + SpiffeSecurityConnectorTest() {} + void SetUp() override { + options_ = grpc_tls_credentials_options_create()->Ref(); + config_ = grpc_tls_key_materials_config_create()->Ref(); + } + void TearDown() override { config_->Unref(); } + // Set credential reload config in options. + void SetOptions(CredReloadResult type) { + grpc_tls_credential_reload_config* reload_config = nullptr; + switch (type) { + case SUCCESS: + reload_config = grpc_tls_credential_reload_config_create( + nullptr, CredReloadSuccess, nullptr, nullptr); + break; + case FAIL: + reload_config = grpc_tls_credential_reload_config_create( + nullptr, CredReloadFail, nullptr, nullptr); + break; + case UNCHANGED: + reload_config = grpc_tls_credential_reload_config_create( + nullptr, CredReloadUnchanged, nullptr, nullptr); + break; + case ASYNC: + reload_config = grpc_tls_credential_reload_config_create( + nullptr, CredReloadAsync, nullptr, nullptr); + break; + default: + break; + } + grpc_tls_credentials_options_set_credential_reload_config(options_.get(), + reload_config); + } + // Set key materials config. + void SetKeyMaterialsConfig() { SetKeyMaterials(config_.get()); } + grpc_core::RefCountedPtr options_; + grpc_core::RefCountedPtr config_; +}; + +TEST_F(SpiffeSecurityConnectorTest, NoKeysAndConfig) { + grpc_ssl_certificate_config_reload_status reload_status; + grpc_status_code status = + TlsFetchKeyMaterials(config_, *options_, &reload_status); + EXPECT_EQ(status, GRPC_STATUS_FAILED_PRECONDITION); + options_->Unref(); +} + +TEST_F(SpiffeSecurityConnectorTest, NoKeySuccessReload) { + grpc_ssl_certificate_config_reload_status reload_status; + SetOptions(SUCCESS); + grpc_status_code status = + TlsFetchKeyMaterials(config_, *options_, &reload_status); + EXPECT_EQ(status, GRPC_STATUS_OK); + EXPECT_EQ(reload_status, GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW); + options_->Unref(); +} + +TEST_F(SpiffeSecurityConnectorTest, NoKeyFailReload) { + grpc_ssl_certificate_config_reload_status reload_status; + SetOptions(FAIL); + grpc_status_code status = + TlsFetchKeyMaterials(config_, *options_, &reload_status); + EXPECT_EQ(status, GRPC_STATUS_INTERNAL); + EXPECT_EQ(reload_status, GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL); + options_->Unref(); +} + +TEST_F(SpiffeSecurityConnectorTest, NoKeyAsyncReload) { + grpc_ssl_certificate_config_reload_status reload_status = + GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED; + SetOptions(ASYNC); + grpc_status_code status = + TlsFetchKeyMaterials(config_, *options_, &reload_status); + EXPECT_EQ(status, GRPC_STATUS_UNIMPLEMENTED); + EXPECT_EQ(reload_status, GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED); + options_->Unref(); +} + +TEST_F(SpiffeSecurityConnectorTest, NoKeyUnchangedReload) { + grpc_ssl_certificate_config_reload_status reload_status = + GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED; + SetOptions(UNCHANGED); + grpc_status_code status = + TlsFetchKeyMaterials(config_, *options_, &reload_status); + EXPECT_EQ(status, GRPC_STATUS_OK); + EXPECT_EQ(reload_status, GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED); + options_->Unref(); +} + +TEST_F(SpiffeSecurityConnectorTest, WithKeyNoReload) { + grpc_ssl_certificate_config_reload_status reload_status = + GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED; + SetKeyMaterialsConfig(); + grpc_status_code status = + TlsFetchKeyMaterials(config_, *options_, &reload_status); + EXPECT_EQ(status, GRPC_STATUS_OK); + options_->Unref(); +} + +TEST_F(SpiffeSecurityConnectorTest, WithKeySuccessReload) { + grpc_ssl_certificate_config_reload_status reload_status; + SetOptions(SUCCESS); + SetKeyMaterialsConfig(); + grpc_status_code status = + TlsFetchKeyMaterials(config_, *options_, &reload_status); + EXPECT_EQ(status, GRPC_STATUS_OK); + EXPECT_EQ(reload_status, GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW); + options_->Unref(); +} + +TEST_F(SpiffeSecurityConnectorTest, WithKeyFailReload) { + grpc_ssl_certificate_config_reload_status reload_status; + SetOptions(FAIL); + SetKeyMaterialsConfig(); + grpc_status_code status = + TlsFetchKeyMaterials(config_, *options_, &reload_status); + EXPECT_EQ(status, GRPC_STATUS_OK); + EXPECT_EQ(reload_status, GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL); + options_->Unref(); +} + +TEST_F(SpiffeSecurityConnectorTest, WithKeyAsyncReload) { + grpc_ssl_certificate_config_reload_status reload_status = + GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED; + SetOptions(ASYNC); + SetKeyMaterialsConfig(); + grpc_status_code status = + TlsFetchKeyMaterials(config_, *options_, &reload_status); + EXPECT_EQ(status, GRPC_STATUS_OK); + EXPECT_EQ(reload_status, GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED); + options_->Unref(); +} + +TEST_F(SpiffeSecurityConnectorTest, WithKeyUnchangedReload) { + grpc_ssl_certificate_config_reload_status reload_status = + GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED; + SetOptions(UNCHANGED); + SetKeyMaterialsConfig(); + grpc_status_code status = + TlsFetchKeyMaterials(config_, *options_, &reload_status); + EXPECT_EQ(status, GRPC_STATUS_OK); + EXPECT_EQ(reload_status, GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED); + options_->Unref(); +} + +TEST_F(SpiffeSecurityConnectorTest, CreateChannelSecurityConnectorSuccess) { + SetOptions(SUCCESS); + auto cred = grpc_core::UniquePtr( + grpc_tls_spiffe_credentials_create(options_.get())); + const char* target_name = "some_target"; + grpc_channel_args* new_args = nullptr; + auto connector = + cred->create_security_connector(nullptr, target_name, nullptr, &new_args); + EXPECT_NE(connector, nullptr); + grpc_channel_args_destroy(new_args); +} + +TEST_F(SpiffeSecurityConnectorTest, + CreateChannelSecurityConnectorFailNoTargetName) { + SetOptions(SUCCESS); + auto cred = grpc_core::UniquePtr( + grpc_tls_spiffe_credentials_create(options_.get())); + grpc_channel_args* new_args = nullptr; + auto connector = + cred->create_security_connector(nullptr, nullptr, nullptr, &new_args); + EXPECT_EQ(connector, nullptr); +} + +TEST_F(SpiffeSecurityConnectorTest, CreateChannelSecurityConnectorFailInit) { + SetOptions(FAIL); + auto cred = grpc_core::UniquePtr( + grpc_tls_spiffe_credentials_create(options_.get())); + grpc_channel_args* new_args = nullptr; + auto connector = + cred->create_security_connector(nullptr, nullptr, nullptr, &new_args); + EXPECT_EQ(connector, nullptr); +} + +TEST_F(SpiffeSecurityConnectorTest, CreateServerSecurityConnectorSuccess) { + SetOptions(SUCCESS); + auto cred = grpc_core::UniquePtr( + grpc_tls_spiffe_server_credentials_create(options_.get())); + auto connector = cred->create_security_connector(); + EXPECT_NE(connector, nullptr); +} + +TEST_F(SpiffeSecurityConnectorTest, CreateServerSecurityConnectorFailInit) { + SetOptions(FAIL); + auto cred = grpc_core::UniquePtr( + grpc_tls_spiffe_server_credentials_create(options_.get())); + auto connector = cred->create_security_connector(); + EXPECT_EQ(connector, nullptr); +} + +} // namespace testing +} // namespace grpc + +int main(int argc, char** argv) { + grpc_init(); + ::testing::InitGoogleTest(&argc, argv); + int ret = RUN_ALL_TESTS(); + grpc_shutdown(); + return ret; +} diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c index e537e482936..f1f3c7a2745 100644 --- a/test/core/surface/public_headers_must_be_c89.c +++ b/test/core/surface/public_headers_must_be_c89.c @@ -201,6 +201,8 @@ int main(int argc, char **argv) { printf("%lx", (unsigned long) grpc_tls_credentials_options_set_server_authorization_check_config); printf("%lx", (unsigned long) grpc_tls_key_materials_config_create); printf("%lx", (unsigned long) grpc_tls_key_materials_config_set_key_materials); + printf("%lx", (unsigned long) grpc_tls_key_materials_config_set_version); + printf("%lx", (unsigned long) grpc_tls_key_materials_config_get_version); printf("%lx", (unsigned long) grpc_tls_credential_reload_config_create); printf("%lx", (unsigned long) grpc_tls_server_authorization_check_config_create); printf("%lx", (unsigned long) grpc_raw_byte_buffer_create); diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index f39c72c4d5e..b54404bbd0d 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -4020,6 +4020,25 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "gpr", + "grpc", + "grpc++", + "grpc++_test", + "grpc++_test_util", + "grpc_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "grpc_spiffe_security_connector_test", + "src": [ + "test/core/security/spiffe_security_connector_test.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index cb5093d586f..6dd3f1422e5 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4811,6 +4811,30 @@ ], "uses_polling": true }, + { + "args": [], + "benchmark": false, + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": true, + "language": "c++", + "name": "grpc_spiffe_security_connector_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "uses_polling": true + }, { "args": [], "benchmark": false, From 0968147c14b38d52c2503876789d38db998757d5 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 12 Aug 2019 14:50:50 -0700 Subject: [PATCH 301/661] clang-format --- src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m index 691521ae7bb..1f6a25ff78f 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m @@ -114,7 +114,7 @@ static NSMutableDictionary *gHostCache; options.hostNameOverride = _hostNameOverride; if (_transportType == GRPCTransportTypeInsecure) { options.transport = GRPCDefaultTransportImplList.core_insecure; - } else if ([GRPCCall isUsingCronet]){ + } else if ([GRPCCall isUsingCronet]) { options.transport = gGRPCCoreCronetId; } else { options.transport = GRPCDefaultTransportImplList.core_secure; From d091480eefbccaa0317891ea131f830e5b8f8c03 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 12 Aug 2019 15:05:20 -0700 Subject: [PATCH 302/661] Remove unused code as comment --- tools/run_tests/run_tests.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index d3b028d4590..c26f8fba812 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1101,17 +1101,6 @@ class ObjCLanguage(object): 'EXAMPLE_PATH': 'src/objective-c/examples/tvOS-sample', 'FRAMEWORKS': 'NO' })) - # out.append( - # self.config.job_spec( - # ['src/objective-c/tests/build_one_example.sh'], - # timeout_seconds=10 * 60, - # shortname='ios-buildtest-example-tvOS-sample-framework', - # cpu_cost=1e6, - # environ={ - # 'SCHEME': 'tvOS-sample', - # 'EXAMPLE_PATH': 'src/objective-c/examples/tvOS-sample', - # 'FRAMEWORKS': 'YES' - # })) out.append( self.config.job_spec( ['src/objective-c/tests/build_one_example.sh'], @@ -1123,17 +1112,6 @@ class ObjCLanguage(object): 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', 'FRAMEWORKS': 'NO' })) - # out.append( - # self.config.job_spec( - # ['src/objective-c/tests/build_one_example.sh'], - # timeout_seconds=20 * 60, - # shortname='ios-buildtest-example-watchOS-sample-framework', - # cpu_cost=1e6, - # environ={ - # 'SCHEME': 'watchOS-sample-WatchKit-App', - # 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', - # 'FRAMEWORKS': 'YES' - # })) out.append( self.config.job_spec( ['src/objective-c/tests/run_plugin_tests.sh'], From 19d576fbb3031ea8fda4ec1956c5f78251bd2fe3 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 12 Aug 2019 15:58:13 -0700 Subject: [PATCH 303/661] update gitignore for files generated by tvOS and watchOS builds --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4a400b4e3b4..dfb7054bfeb 100644 --- a/.gitignore +++ b/.gitignore @@ -94,6 +94,7 @@ DerivedData # Objective-C generated files *.pbobjc.* *.pbrpc.* +src/objective-c/**/Build # Cocoapods artifacts Pods/ @@ -148,4 +149,4 @@ bm_*.json cmake-build-debug/ # Benchmark outputs -BenchmarkDotNet.Artifacts/ \ No newline at end of file +BenchmarkDotNet.Artifacts/ From 43aacf02a7331278164a5e74a2c0da103dca67e6 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 12 Aug 2019 16:21:00 -0700 Subject: [PATCH 304/661] Fix dependency issue and move InteropTestsMultipleChannels to CronetTests --- gRPC-RxLibrary.podspec | 17 ++++++++++++ gRPC.podspec | 1 + .../tvOS-sample/tvOS-sample/ViewController.m | 2 +- .../WatchKit-Extension/InterfaceController.m | 2 +- src/objective-c/tests/Podfile | 20 +++++++------- .../tests/Tests.xcodeproj/project.pbxproj | 27 +++---------------- .../xcschemes/InteropTests.xcscheme | 8 +++--- templates/gRPC-RxLibrary.podspec.template | 17 ++++++++++++ templates/gRPC.podspec.template | 1 + 9 files changed, 55 insertions(+), 40 deletions(-) diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 9666c3c1b98..2e412cf67d6 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -42,6 +42,23 @@ Pod::Spec.new do |s| s.module_name = name s.header_dir = name + s.default_subspec = 'Interface', 'Implementation' + + src_dir = 'src/objective-c/RxLibrary' + s.subspec 'Interface' do |ss| + ss.header_mappings_dir = "#{src_dir}" + ss.source_files = "#{src_dir}/*.h" + ss.public_header_files = "#{src_dir}/*.h" + end + + s.subspec 'Implementation' do |ss| + ss.header_mappings_dir = "#{src_dir}" + ss.source_files = "#{src_dir}/*.m", "#{src_dir}/**/*.{h,m}" + ss.private_header_files = "#{src_dir}/**/*.h" + + ss.dependency "#{s.name}/Interface" + end + src_dir = 'src/objective-c/RxLibrary' s.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" s.private_header_files = "#{src_dir}/private/*.h" diff --git a/gRPC.podspec b/gRPC.podspec index a44f207ed54..e18adcd276e 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -67,6 +67,7 @@ Pod::Spec.new do |s| "GRPCClient/GRPCCall+Tests.h", "src/objective-c/GRPCClient/GRPCCallLegacy.h", "src/objective-c/GRPCClient/GRPCTypes.h" + ss.dependency "gRPC-RxLibrary/Interface", version end s.subspec 'Interface' do |ss| diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m index 3081b28f0ea..9c466260121 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m @@ -25,8 +25,8 @@ #import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" #endif -#import #import +#import @interface ViewController () diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m index 050234cb947..ce204a9c146 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m @@ -24,8 +24,8 @@ #import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" #endif -#import #import +#import @interface InterfaceController () diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index d9087c3c83a..c83e8861e93 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -30,25 +30,25 @@ target 'MacTests' do grpc_deps end -target 'UnitTests' do - platform :ios, '8.0' - grpc_deps -end - %w( + UnitTests InteropTests - CronetTests ).each do |target_name| target target_name do platform :ios, '8.0' grpc_deps - - pod 'gRPC/GRPCCoreCronet', :path => GRPC_LOCAL_SRC - pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c" - pod 'gRPC-Core/Tests', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true end end +target 'CronetTests' do + platform :ios, '8.0' + grpc_deps + + pod 'gRPC/GRPCCoreCronet', :path => GRPC_LOCAL_SRC + pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c" + pod 'gRPC-Core/Tests', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true +end + # gRPC-Core.podspec needs to be modified to be successfully used for local development. A Podfile's # pre_install hook lets us do that. The block passed to it runs after the podspecs are downloaded # and before they are installed in the user project. diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 4a469dc622f..1220714819e 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -8,15 +8,14 @@ /* Begin PBXBuildFile section */ 5E0282E9215AA697007AC99D /* NSErrorUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0282E8215AA697007AC99D /* NSErrorUnitTests.m */; }; + 5E08D07023021E3B006D76EA /* InteropTestsMultipleChannels.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487722778226006656AD /* InteropTestsMultipleChannels.m */; }; 5E3F14842278B461007C6D90 /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; 5E3F14852278BF5D007C6D90 /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; 5E3F14862278BFFF007C6D90 /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; 5E3F148D22792856007C6D90 /* ConfigureCronet.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F1487227918AA007C6D90 /* ConfigureCronet.m */; }; - 5E3F148E22792AF5007C6D90 /* ConfigureCronet.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F1487227918AA007C6D90 /* ConfigureCronet.m */; }; 5E7F486422775B37006656AD /* InteropTestsRemoteWithCronet.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE84BF31D4717E40050C6CC /* InteropTestsRemoteWithCronet.m */; }; 5E7F486522775B41006656AD /* CronetUnitTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5EAD6D261E27047400002378 /* CronetUnitTests.mm */; }; 5E7F486E22778086006656AD /* CoreCronetEnd2EndTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F486D22778086006656AD /* CoreCronetEnd2EndTests.mm */; }; - 5E7F487922778226006656AD /* InteropTestsMultipleChannels.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487722778226006656AD /* InteropTestsMultipleChannels.m */; }; 5E7F487D22778256006656AD /* ChannelPoolTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487B22778256006656AD /* ChannelPoolTest.m */; }; 5E7F487E22778256006656AD /* ChannelTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487C22778256006656AD /* ChannelTests.m */; }; 5E7F4880227782C1006656AD /* APIv2Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487F227782C1006656AD /* APIv2Tests.m */; }; @@ -514,7 +513,6 @@ 5EA476F12272816A000F72FC /* Frameworks */, 5EA476F22272816A000F72FC /* Resources */, D11CB94CF56A1E53760D29D8 /* [CP] Copy Pods Resources */, - 0FEFD5FC6B323AC95549AE4A /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -676,24 +674,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 0FEFD5FC6B323AC95549AE4A /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh", - "${PODS_ROOT}/CronetFramework/Cronet.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 292EA42A76AC7933A37235FD /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -827,7 +807,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC.default-GRPCCoreCronet/gRPCCertificates.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( @@ -896,6 +876,7 @@ files = ( 5E3F14852278BF5D007C6D90 /* InteropTestsBlockCallbacks.m in Sources */, 5E3F148D22792856007C6D90 /* ConfigureCronet.m in Sources */, + 5E08D07023021E3B006D76EA /* InteropTestsMultipleChannels.m in Sources */, 5E7F486E22778086006656AD /* CoreCronetEnd2EndTests.mm in Sources */, 5E7F488522778A88006656AD /* InteropTests.m in Sources */, 5E7F486422775B37006656AD /* InteropTestsRemoteWithCronet.m in Sources */, @@ -908,9 +889,7 @@ buildActionMask = 2147483647; files = ( 5E3F14842278B461007C6D90 /* InteropTestsBlockCallbacks.m in Sources */, - 5E3F148E22792AF5007C6D90 /* ConfigureCronet.m in Sources */, 5E7F488922778B04006656AD /* InteropTestsRemote.m in Sources */, - 5E7F487922778226006656AD /* InteropTestsMultipleChannels.m in Sources */, 5EA477042273617B000F72FC /* InteropTestsLocalCleartext.m in Sources */, 5EA4770322736178000F72FC /* InteropTestsLocalSSL.m in Sources */, 5E7F488422778A88006656AD /* InteropTests.m in Sources */, diff --git a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTests.xcscheme b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTests.xcscheme index adb3c366af2..cbde360a338 100644 --- a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTests.xcscheme +++ b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTests.xcscheme @@ -23,7 +23,7 @@ @@ -48,7 +48,7 @@ + buildConfiguration = "Test"> Date: Mon, 12 Aug 2019 17:00:12 -0700 Subject: [PATCH 305/661] reorder UnsafeSerialize --- .../Internal/SliceBufferSafeHandleTest.cs | 1 - src/csharp/Grpc.Core/Internal/AsyncCall.cs | 31 +++++++++---------- .../Grpc.Core/Internal/AsyncCallBase.cs | 2 +- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs b/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs index 5feb9a711da..89d5f187a22 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs @@ -152,7 +152,6 @@ namespace Grpc.Core.Internal.Tests // TODO: other TODOs // -- provide a null instance of SliceBufferSafeHandle - //-- order of UnsafeSerialize in AsyncCall methods... private byte[] GetTestBuffer(int length) { diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs index 4111c5347ce..830a1f4edc6 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs @@ -160,16 +160,15 @@ namespace Grpc.Core.Internal halfcloseRequested = true; readingDone = true; - //var payload = UnsafeSerialize(msg); - - unaryResponseTcs = new TaskCompletionSource(); using (var serializationScope = DefaultSerializationContext.GetInitializedThreadLocalScope()) - using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers)) { - var payload = UnsafeSerialize(msg, serializationScope.Context); // do before metadata array? - - call.StartUnary(UnaryResponseClientCallback, payload, GetWriteFlagsForCall(), metadataArray, details.Options.Flags); - callStartedOk = true; + var payload = UnsafeSerialize(msg, serializationScope.Context); + unaryResponseTcs = new TaskCompletionSource(); + using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers)) + { + call.StartUnary(UnaryResponseClientCallback, payload, GetWriteFlagsForCall(), metadataArray, details.Options.Flags); + callStartedOk = true; + } } return unaryResponseTcs.Task; @@ -238,17 +237,15 @@ namespace Grpc.Core.Internal halfcloseRequested = true; - //var payload = UnsafeSerialize(msg); - - streamingResponseCallFinishedTcs = new TaskCompletionSource(); - using (var serializationScope = DefaultSerializationContext.GetInitializedThreadLocalScope()) - using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers)) { - var payload = UnsafeSerialize(msg, serializationScope.Context); // do before metadata array? - - call.StartServerStreaming(ReceivedStatusOnClientCallback, payload, GetWriteFlagsForCall(), metadataArray, details.Options.Flags); - callStartedOk = true; + var payload = UnsafeSerialize(msg, serializationScope.Context); + streamingResponseCallFinishedTcs = new TaskCompletionSource(); + using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers)) + { + call.StartServerStreaming(ReceivedStatusOnClientCallback, payload, GetWriteFlagsForCall(), metadataArray, details.Options.Flags); + callStartedOk = true; + } } call.StartReceiveInitialMetadata(ReceivedResponseHeadersCallback); } diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs index bd4b0d81832..252fe114506 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs @@ -117,7 +117,7 @@ namespace Grpc.Core.Internal { using (var serializationScope = DefaultSerializationContext.GetInitializedThreadLocalScope()) { - var payload = UnsafeSerialize(msg, serializationScope.Context); // do before metadata array? + var payload = UnsafeSerialize(msg, serializationScope.Context); lock (myLock) { GrpcPreconditions.CheckState(started); From 36dcea650dc333ca0ba19942f01742f4bec602f9 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 12 Aug 2019 17:03:33 -0700 Subject: [PATCH 306/661] address a TODO --- src/csharp/ext/grpc_csharp_ext.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 89391e67e15..9ffc5591d8b 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -1238,8 +1238,9 @@ grpcsharp_slice_buffer_adjust_tail_space(grpc_slice_buffer* buffer, size_t avail } grpc_slice new_slice = grpc_slice_malloc(requested_tail_space); - // TODO: this always adds as a new slice entry into the sb, but it doesn't have the problem of - // sometimes splitting the continguous new_slice across two different slices (like grpc_slice_buffer_add would) + // grpc_slice_buffer_add_indexed always adds as a new slice entry into the sb (which is suboptimal in some cases) + // but it doesn't have the problem of sometimes splitting the continguous new_slice across two different slices + // (like grpc_slice_buffer_add would) grpc_slice_buffer_add_indexed(buffer, new_slice); } From dd5515870747ecdc5cfd92398aa02fd47b667132 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 12 Aug 2019 17:20:27 -0700 Subject: [PATCH 307/661] address TODO in SendMessageBenchmark --- .../Grpc.Microbenchmarks/SendMessageBenchmark.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs index 76c59ca579c..f850a0a006f 100644 --- a/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs +++ b/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs @@ -50,18 +50,21 @@ namespace Grpc.Microbenchmarks var call = CreateFakeCall(cq); var sendCompletionCallback = new NopSendCompletionCallback(); - var payload = SliceBufferSafeHandle.Create(); - payload.GetSpan(PayloadSize); - payload.Advance(PayloadSize); + var sliceBuffer = SliceBufferSafeHandle.Create(); var writeFlags = default(WriteFlags); for (int i = 0; i < Iterations; i++) { - // TODO: sending for the first time actually steals the slices... - call.StartSendMessage(sendCompletionCallback, payload, writeFlags, false); + // SendMessage steals the slices from the slice buffer, so we need to repopulate in each iteration. + sliceBuffer.Reset(); + sliceBuffer.GetSpan(PayloadSize); + sliceBuffer.Advance(PayloadSize); + + call.StartSendMessage(sendCompletionCallback, sliceBuffer, writeFlags, false); var callback = completionRegistry.Extract(completionRegistry.LastRegisteredKey); callback.OnComplete(true); } + sliceBuffer.Dispose(); cq.Dispose(); } From 9ae5c5df245a2ed683de6028e3aa55bb88723269 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 12 Aug 2019 17:35:00 -0700 Subject: [PATCH 308/661] address a TODO --- .../Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs | 3 --- src/csharp/Grpc.Core/Internal/AsyncCallServer.cs | 2 +- src/csharp/Grpc.Core/Internal/CallSafeHandle.cs | 7 ------- src/csharp/Grpc.Microbenchmarks/Utf8Encode.cs | 2 +- 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs b/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs index 89d5f187a22..76387478312 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/SliceBufferSafeHandleTest.cs @@ -150,9 +150,6 @@ namespace Grpc.Core.Internal.Tests } } - // TODO: other TODOs - // -- provide a null instance of SliceBufferSafeHandle - private byte[] GetTestBuffer(int length) { var testBuffer = new byte[length]; diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs index e0bb41e15dc..58bc40b0ace 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs @@ -131,7 +131,7 @@ namespace Grpc.Core.Internal { using (var serializationScope = DefaultSerializationContext.GetInitializedThreadLocalScope()) { - var payload = optionalWrite.HasValue ? UnsafeSerialize(optionalWrite.Value.Response, serializationScope.Context) : null; + var payload = optionalWrite.HasValue ? UnsafeSerialize(optionalWrite.Value.Response, serializationScope.Context) : SliceBufferSafeHandle.NullInstance; var writeFlags = optionalWrite.HasValue ? optionalWrite.Value.WriteFlags : default(WriteFlags); lock (myLock) diff --git a/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs b/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs index cfcab5dc692..7fadc1d8b47 100644 --- a/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs @@ -131,13 +131,6 @@ namespace Grpc.Core.Internal public void StartSendStatusFromServer(ISendStatusFromServerCompletionCallback callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata, SliceBufferSafeHandle optionalPayload, WriteFlags writeFlags) { - // TODO: optionalPayload == null -> pass null SliceBufferSafeHandle - // do this properly - if (optionalPayload == null) - { - optionalPayload = SliceBufferSafeHandle.NullInstance; - } - using (completionQueue.NewScope()) { var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_ISendStatusFromServerCompletionCallback, callback); diff --git a/src/csharp/Grpc.Microbenchmarks/Utf8Encode.cs b/src/csharp/Grpc.Microbenchmarks/Utf8Encode.cs index e5bac1967c9..8aa2e96832a 100644 --- a/src/csharp/Grpc.Microbenchmarks/Utf8Encode.cs +++ b/src/csharp/Grpc.Microbenchmarks/Utf8Encode.cs @@ -117,7 +117,7 @@ namespace Grpc.Microbenchmarks { for (int i = 0; i < Iterations; i++) { - call.StartSendStatusFromServer(this, status, metadata, false, null, WriteFlags.NoCompress); + call.StartSendStatusFromServer(this, status, metadata, false, SliceBufferSafeHandle.NullInstance, WriteFlags.NoCompress); } } From 2f5464754516f2922e1a1d2711b0a90f3dc25070 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 12 Aug 2019 20:38:49 -0400 Subject: [PATCH 309/661] clang format --- src/csharp/ext/grpc_csharp_ext.c | 93 ++++++++++++++++---------------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 9ffc5591d8b..2360c9e1d5f 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -41,9 +41,10 @@ #define GPR_CALLTYPE #endif -static grpc_byte_buffer* grpcsharp_create_byte_buffer_from_stolen_slices(grpc_slice_buffer* slice_buffer) { +static grpc_byte_buffer* grpcsharp_create_byte_buffer_from_stolen_slices( + grpc_slice_buffer* slice_buffer) { grpc_byte_buffer* bb = - (grpc_byte_buffer*)gpr_malloc(sizeof(grpc_byte_buffer)); + (grpc_byte_buffer*)gpr_malloc(sizeof(grpc_byte_buffer)); memset(bb, 0, sizeof(grpc_byte_buffer)); bb->type = GRPC_BB_RAW; bb->data.raw.compression = GRPC_COMPRESS_NONE; @@ -587,8 +588,8 @@ static grpc_call_error grpcsharp_call_start_batch(grpc_call* call, } GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary( - grpc_call* call, grpcsharp_batch_context* ctx, grpc_slice_buffer* send_buffer, - uint32_t write_flags, + grpc_call* call, grpcsharp_batch_context* ctx, + grpc_slice_buffer* send_buffer, uint32_t write_flags, grpc_metadata_array* initial_metadata, uint32_t initial_metadata_flags) { /* TODO: don't use magic number */ grpc_op ops[6]; @@ -603,7 +604,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary( ops[0].reserved = NULL; ops[1].op = GRPC_OP_SEND_MESSAGE; - ctx->send_message = grpcsharp_create_byte_buffer_from_stolen_slices(send_buffer); + ctx->send_message = + grpcsharp_create_byte_buffer_from_stolen_slices(send_buffer); ops[1].data.send_message.send_message = ctx->send_message; ops[1].flags = write_flags; ops[1].reserved = NULL; @@ -640,8 +642,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary( /* Only for testing. Shortcircuits the unary call logic and only echoes the message as if it was received from the server */ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_test_call_start_unary_echo( - grpc_call* call, grpcsharp_batch_context* ctx, grpc_slice_buffer* send_buffer, - uint32_t write_flags, + grpc_call* call, grpcsharp_batch_context* ctx, + grpc_slice_buffer* send_buffer, uint32_t write_flags, grpc_metadata_array* initial_metadata, uint32_t initial_metadata_flags) { // prepare as if we were performing a normal RPC. grpc_byte_buffer* send_message = @@ -698,8 +700,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_client_streaming( } GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_server_streaming( - grpc_call* call, grpcsharp_batch_context* ctx, grpc_slice_buffer* send_buffer, - uint32_t write_flags, + grpc_call* call, grpcsharp_batch_context* ctx, + grpc_slice_buffer* send_buffer, uint32_t write_flags, grpc_metadata_array* initial_metadata, uint32_t initial_metadata_flags) { /* TODO: don't use magic number */ grpc_op ops[4]; @@ -714,7 +716,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_server_streaming( ops[0].reserved = NULL; ops[1].op = GRPC_OP_SEND_MESSAGE; - ctx->send_message = grpcsharp_create_byte_buffer_from_stolen_slices(send_buffer); + ctx->send_message = + grpcsharp_create_byte_buffer_from_stolen_slices(send_buffer); ops[1].data.send_message.send_message = ctx->send_message; ops[1].flags = write_flags; ops[1].reserved = NULL; @@ -781,15 +784,16 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_recv_initial_metadata( } GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_message( - grpc_call* call, grpcsharp_batch_context* ctx, grpc_slice_buffer* send_buffer, - uint32_t write_flags, + grpc_call* call, grpcsharp_batch_context* ctx, + grpc_slice_buffer* send_buffer, uint32_t write_flags, int32_t send_empty_initial_metadata) { /* TODO: don't use magic number */ grpc_op ops[2]; memset(ops, 0, sizeof(ops)); size_t nops = send_empty_initial_metadata ? 2 : 1; ops[0].op = GRPC_OP_SEND_MESSAGE; - ctx->send_message = grpcsharp_create_byte_buffer_from_stolen_slices(send_buffer); + ctx->send_message = + grpcsharp_create_byte_buffer_from_stolen_slices(send_buffer); ops[0].data.send_message.send_message = ctx->send_message; ops[0].flags = write_flags; ops[0].reserved = NULL; @@ -816,8 +820,7 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server( grpc_call* call, grpcsharp_batch_context* ctx, grpc_status_code status_code, const char* status_details, size_t status_details_len, grpc_metadata_array* trailing_metadata, int32_t send_empty_initial_metadata, - grpc_slice_buffer* optional_send_buffer, - uint32_t write_flags) { + grpc_slice_buffer* optional_send_buffer, uint32_t write_flags) { /* TODO: don't use magic number */ grpc_op ops[3]; memset(ops, 0, sizeof(ops)); @@ -1188,9 +1191,9 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_redirect_log(grpcsharp_log_func func) { typedef void(GPR_CALLTYPE* test_callback_funcptr)(int32_t success); /* Slice buffer functionality */ -GPR_EXPORT grpc_slice_buffer* GPR_CALLTYPE -grpcsharp_slice_buffer_create() { - grpc_slice_buffer* slice_buffer = (grpc_slice_buffer*)gpr_malloc(sizeof(grpc_slice_buffer)); +GPR_EXPORT grpc_slice_buffer* GPR_CALLTYPE grpcsharp_slice_buffer_create() { + grpc_slice_buffer* slice_buffer = + (grpc_slice_buffer*)gpr_malloc(sizeof(grpc_slice_buffer)); grpc_slice_buffer_init(slice_buffer); return slice_buffer; } @@ -1212,44 +1215,40 @@ grpcsharp_slice_buffer_slice_count(grpc_slice_buffer* buffer) { } GPR_EXPORT void GPR_CALLTYPE -grpcsharp_slice_buffer_slice_peek(grpc_slice_buffer* buffer, size_t index, size_t* slice_len, uint8_t** slice_data_ptr) { +grpcsharp_slice_buffer_slice_peek(grpc_slice_buffer* buffer, size_t index, + size_t* slice_len, uint8_t** slice_data_ptr) { GPR_ASSERT(buffer->count > index); grpc_slice* slice_ptr = &buffer->slices[index]; *slice_len = GRPC_SLICE_LENGTH(*slice_ptr); *slice_data_ptr = GRPC_SLICE_START_PTR(*slice_ptr); } -GPR_EXPORT void* GPR_CALLTYPE -grpcsharp_slice_buffer_adjust_tail_space(grpc_slice_buffer* buffer, size_t available_tail_space, +GPR_EXPORT void* GPR_CALLTYPE grpcsharp_slice_buffer_adjust_tail_space( + grpc_slice_buffer* buffer, size_t available_tail_space, size_t requested_tail_space) { - - if (available_tail_space == requested_tail_space) { - // nothing to do - } - else if (available_tail_space >= requested_tail_space) - { - grpc_slice_buffer_trim_end(buffer, available_tail_space - requested_tail_space, NULL); + if (available_tail_space == requested_tail_space) { + // nothing to do + } else if (available_tail_space >= requested_tail_space) { + grpc_slice_buffer_trim_end( + buffer, available_tail_space - requested_tail_space, NULL); + } else { + if (available_tail_space > 0) { + grpc_slice_buffer_trim_end(buffer, available_tail_space, NULL); } - else - { - if (available_tail_space > 0) - { - grpc_slice_buffer_trim_end(buffer, available_tail_space, NULL); - } - grpc_slice new_slice = grpc_slice_malloc(requested_tail_space); - // grpc_slice_buffer_add_indexed always adds as a new slice entry into the sb (which is suboptimal in some cases) - // but it doesn't have the problem of sometimes splitting the continguous new_slice across two different slices - // (like grpc_slice_buffer_add would) - grpc_slice_buffer_add_indexed(buffer, new_slice); - } - - if (buffer->count == 0) - { - return NULL; - } - grpc_slice* last_slice = &(buffer->slices[buffer->count - 1]); - return GRPC_SLICE_END_PTR(*last_slice) - requested_tail_space; + grpc_slice new_slice = grpc_slice_malloc(requested_tail_space); + // grpc_slice_buffer_add_indexed always adds as a new slice entry into the + // sb (which is suboptimal in some cases) but it doesn't have the problem of + // sometimes splitting the continguous new_slice across two different slices + // (like grpc_slice_buffer_add would) + grpc_slice_buffer_add_indexed(buffer, new_slice); + } + + if (buffer->count == 0) { + return NULL; + } + grpc_slice* last_slice = &(buffer->slices[buffer->count - 1]); + return GRPC_SLICE_END_PTR(*last_slice) - requested_tail_space; } /* Version info */ From eadd5ea11093a3c3811b47dd15005df031719f79 Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Mon, 12 Aug 2019 22:44:56 -0400 Subject: [PATCH 310/661] Directly use the ZeroCopyInputStream for grpc::GenericDeserialize. There is no need to use CodedInputStream, wrapping a ZeroCopyInputStream. Suggested by: Gerben Stavenga --- include/grpcpp/impl/codegen/proto_utils.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/include/grpcpp/impl/codegen/proto_utils.h b/include/grpcpp/impl/codegen/proto_utils.h index f9a7d3c0b34..2cf4cdcc9b5 100644 --- a/include/grpcpp/impl/codegen/proto_utils.h +++ b/include/grpcpp/impl/codegen/proto_utils.h @@ -83,14 +83,9 @@ Status GenericDeserialize(ByteBuffer* buffer, if (!reader.status().ok()) { return reader.status(); } - ::grpc::protobuf::io::CodedInputStream decoder(&reader); - decoder.SetTotalBytesLimit(INT_MAX, INT_MAX); - if (!msg->ParseFromCodedStream(&decoder)) { + if (!msg->ParseFromZeroCopyStream(&reader)) { result = Status(StatusCode::INTERNAL, msg->InitializationErrorString()); } - if (!decoder.ConsumedEntireMessage()) { - result = Status(StatusCode::INTERNAL, "Did not read entire message"); - } } buffer->Clear(); return result; From 3c28c5f06850c140399654f55b76157cdcea360f Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 12 Aug 2019 23:11:32 -0700 Subject: [PATCH 311/661] Remove unnecessary notification --- test/cpp/end2end/xds_end2end_test.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 5d114c0ef2b..ecff1d58585 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -924,7 +924,6 @@ TEST_F(SingleBalancerTest, Vanilla) { EXPECT_EQ(kNumRpcsPerAddress, backends_[i]->backend_service()->request_count()); } - balancers_[0]->eds_service()->NotifyDoneWithEdsCall(); // The EDS service got a single request, and sent a single response. EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); @@ -951,7 +950,6 @@ TEST_F(SingleBalancerTest, SameBackendListedMultipleTimes) { // And they should have come from a single client port, because of // subchannel sharing. EXPECT_EQ(1UL, backends_[0]->backend_service()->clients().size()); - balancers_[0]->eds_service()->NotifyDoneWithEdsCall(); } TEST_F(SingleBalancerTest, SecureNaming) { @@ -1022,7 +1020,6 @@ TEST_F(SingleBalancerTest, InitiallyEmptyServerlist) { // populated serverlist but under the call's deadline (which is enforced by // the call's deadline). EXPECT_GT(ellapsed_ms.count(), kServerlistDelayMs); - balancers_[0]->eds_service()->NotifyDoneWithEdsCall(); // The EDS service got a single request. EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); // and sent two responses. @@ -1041,7 +1038,6 @@ TEST_F(SingleBalancerTest, AllServersUnreachableFailFast) { const Status status = SendRpc(); // The error shouldn't be DEADLINE_EXCEEDED. EXPECT_EQ(StatusCode::UNAVAILABLE, status.error_code()); - balancers_[0]->eds_service()->NotifyDoneWithEdsCall(); // The EDS service got a single request, and sent a single response. EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); From 12ca64d2c323a1a81ec0aa923aeaa6f72250828d Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 13 Aug 2019 08:25:32 -0700 Subject: [PATCH 312/661] Add TestCertificates.bundle to CronetTests too --- src/objective-c/tests/Tests.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 9d84fffa9d4..9c3d8ac4c7a 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -33,6 +33,7 @@ 5EA4770322736178000F72FC /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; }; 5EA477042273617B000F72FC /* InteropTestsLocalCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */; }; 5EA4770522736AC4000F72FC /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; + 5ECFED8623030DCC00626501 /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; 65EB19E418B39A8374D407BB /* libPods-CronetTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B1511C20E16A8422B58D61A /* libPods-CronetTests.a */; }; 903163C7FE885838580AEC7A /* libPods-InteropTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D457AD9797664CFA191C3280 /* libPods-InteropTests.a */; }; 953CD2942A3A6D6CE695BE87 /* libPods-MacTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 276873A05AC5479B60DF6079 /* libPods-MacTests.a */; }; @@ -628,6 +629,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 5ECFED8623030DCC00626501 /* TestCertificates.bundle in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; From 69f3e27b9935c204b64bd5753956d44a4f046471 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 13 Aug 2019 09:02:28 -0700 Subject: [PATCH 313/661] Fix managers' thread safety issue --- src/objective-c/GRPCClient/GRPCInterceptor.m | 10 ++++++---- .../GRPCClient/private/GRPCTransport+Private.m | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.m b/src/objective-c/GRPCClient/GRPCInterceptor.m index 9a41c395148..a7ffe05bddc 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.m +++ b/src/objective-c/GRPCClient/GRPCInterceptor.m @@ -68,10 +68,12 @@ } - (void)shutDown { - _nextInterceptor = nil; - _previousInterceptor = nil; - _thisInterceptor = nil; - _shutDown = YES; + dispatch_async(_dispatchQueue, ^{ + self->_nextInterceptor = nil; + self->_previousInterceptor = nil; + self->_thisInterceptor = nil; + self->_shutDown = YES; + }); } - (void)createNextInterceptor { diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m index 0daf127d150..9072f7afbe2 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m @@ -47,8 +47,10 @@ } - (void)shutDown { - _transport = nil; - _previousInterceptor = nil; + dispatch_async(_dispatchQueue, ^{ + self->_transport = nil; + self->_previousInterceptor = nil; + }); } - (dispatch_queue_t)dispatchQueue { From d1b64c3a3e6fe44c4588fb8f6be553eebf180264 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Wed, 14 Aug 2019 00:25:48 +0800 Subject: [PATCH 314/661] add en example which easy start grpc by 4 kinds method of service with python --- examples/python/easy_start_demo/LICENSE | 373 ++++++++++++++++++ examples/python/easy_start_demo/PyClient.py | 93 +++++ examples/python/easy_start_demo/PyServer.py | 87 ++++ examples/python/easy_start_demo/README.md | 37 ++ .../customGrpcPackages/demo_pb2.py | 174 ++++++++ .../customGrpcPackages/demo_pb2_grpc.py | 99 +++++ examples/python/easy_start_demo/demo.proto | 51 +++ examples/python/easy_start_demo/notes | 3 + 8 files changed, 917 insertions(+) create mode 100644 examples/python/easy_start_demo/LICENSE create mode 100644 examples/python/easy_start_demo/PyClient.py create mode 100644 examples/python/easy_start_demo/PyServer.py create mode 100644 examples/python/easy_start_demo/README.md create mode 100644 examples/python/easy_start_demo/customGrpcPackages/demo_pb2.py create mode 100644 examples/python/easy_start_demo/customGrpcPackages/demo_pb2_grpc.py create mode 100644 examples/python/easy_start_demo/demo.proto create mode 100644 examples/python/easy_start_demo/notes diff --git a/examples/python/easy_start_demo/LICENSE b/examples/python/easy_start_demo/LICENSE new file mode 100644 index 00000000000..a612ad9813b --- /dev/null +++ b/examples/python/easy_start_demo/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/examples/python/easy_start_demo/PyClient.py b/examples/python/easy_start_demo/PyClient.py new file mode 100644 index 00000000000..257c817e06f --- /dev/null +++ b/examples/python/easy_start_demo/PyClient.py @@ -0,0 +1,93 @@ +""" +Author: Zhongying Wang +Email: kerbalwzy@gmail.com +License: MPL2 +DateTime: 2019-08-13T23:30:00Z +PythonVersion: Python3.6.3 +""" +import grpc +import time +from customGrpcPackages import demo_pb2, demo_pb2_grpc + +# Constants +PyGrpcServerAddress = "127.0.0.1:23334" +ClientId = 1 + + +# 简单模式 +# Unary +def simple_method(stub): + print("--------------Call SimpleMethod Begin--------------") + req = demo_pb2.Request(Cid=ClientId, ReqMsg="called by Python client") + resp = stub.SimpleMethod(req) + print(f"resp from server({resp.Sid}), the message={resp.RespMsg}") + print("--------------Call SimpleMethod Over---------------") + + +# 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) +# Client Streaming (In a single call, the client can transfer data to the server several times, +# but the server can only return a response once.) +def c_stream_method(stub): + print("--------------Call CStreamMethod Begin--------------") + + # 创建一个生成器 + # create a generator + def req_msgs(): + for i in range(5): + req = demo_pb2.Request(Cid=ClientId, ReqMsg=f"called by Python client, message: {i}") + yield req + + resp = stub.CStreamMethod(req_msgs()) + print(f"resp from server({resp.Sid}), the message={resp.RespMsg}") + print("--------------Call CStreamMethod Over---------------") + + +# 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) +# Server Streaming (In a single call, the client can only transmit data to the server at one time, +# but the server can return the response many times.) +def s_stream_method(stub): + print("--------------Call SStreamMethod Begin--------------") + req = demo_pb2.Request(Cid=ClientId, ReqMsg="called by Python client") + resp_s = stub.SStreamMethod(req) + for resp in resp_s: + print(f"recv from server({resp.Sid}, message={resp.RespMsg})") + + print("--------------Call SStreamMethod Over---------------") + + +# 双向流模式 (在一次调用中, 客户端和服务器都可以向对方多次收发数据) +# Bidirectional Streaming (In a single call, both client and server can send and receive data +# to each other multiple times.) +def twf_method(stub): + print("--------------Call TWFMethod Begin---------------") + + # 创建一个生成器 + # create a generator + def req_msgs(): + for i in range(5): + req = demo_pb2.Request(Cid=ClientId, ReqMsg=f"called by Python client, message: {i}") + yield req + time.sleep(1) + + resp_s = stub.TWFMethod(req_msgs()) + for resp in resp_s: + print(f"recv from server({resp.Sid}, message={resp.RespMsg})") + + print("--------------Call TWFMethod Over---------------") + + +def main(): + with grpc.insecure_channel(PyGrpcServerAddress) as channel: + stub = demo_pb2_grpc.GRPCDemoStub(channel) + + simple_method(stub) + + c_stream_method(stub) + + s_stream_method(stub) + + twf_method(stub) + + +if __name__ == '__main__': + main() diff --git a/examples/python/easy_start_demo/PyServer.py b/examples/python/easy_start_demo/PyServer.py new file mode 100644 index 00000000000..a814205d0d1 --- /dev/null +++ b/examples/python/easy_start_demo/PyServer.py @@ -0,0 +1,87 @@ +""" +Author: Zhongying Wang +Email: kerbalwzy@gmail.com +License: MPL2 +DateTime: 2019-08-13T23:30:00Z +PythonVersion: Python3.6.3 +""" +import time + +import grpc +from threading import Thread +from concurrent import futures +from customGrpcPackages import demo_pb2, demo_pb2_grpc + +# Constants +ServerAddress = '127.0.0.1:23334' +ServerId = 1 + + +class DemoServer(demo_pb2_grpc.GRPCDemoServicer): + + # 简单模式 + # Unary + def SimpleMethod(self, request, context): + print(f"SimpleMethod called by client({request.Cid}) the message: {request.ReqMsg}") + resp = demo_pb2.Response(Sid=ServerId, RespMsg="Python server SimpleMethod Ok!!!!") + return resp + + # 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) + # Client Streaming (In a single call, the client can transfer data to the server several times, + # but the server can only return a response once.) + def CStreamMethod(self, request_iterator, context): + print("CStreamMethod called by client...") + for req in request_iterator: + print(f"recv from client({req.Cid}), message={req.ReqMsg}") + resp = demo_pb2.Response(Sid=ServerId, RespMsg="Python server CStreamMethod ok") + return resp + + # 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) + # Server Streaming (In a single call, the client can only transmit data to the server at one time, + # but the server can return the response many times.) + def SStreamMethod(self, request, context): + print(f"SStreamMethod called by client({request.Cid}), message={request.ReqMsg}") + + # 创建一个生成器 + def resp_msgs(): + for i in range(5): + resp = demo_pb2.Response(Sid=ServerId, RespMsg=f"send by Python server, message={i}") + yield resp + + return resp_msgs() + + # 双向流模式 (在一次调用中, 客户端和服务器都可以向对方多次收发数据) + # Bidirectional Streaming (In a single call, both client and server can send and receive data + # to each other multiple times.) + def TWFMethod(self, request_iterator, context): + # 开启一个子线程去接收数据 + # Open a sub thread to receive data + def parse_req(): + for req in request_iterator: + print(f"recv from client{req.Cid}, message={req.ReqMsg}") + + t = Thread(target=parse_req) + t.start() + + for i in range(5): + yield demo_pb2.Response(Sid=ServerId, RespMsg=f"send by Python server, message={i}") + + t.join() + + +def main(): + server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) + + demo_pb2_grpc.add_GRPCDemoServicer_to_server(DemoServer(), server) + + server.add_insecure_port(ServerAddress) + print("------------------start Python GRPC server") + server.start() + + # In python3, `server` have no attribute `wait_for_termination` + while 1: + time.sleep(10) + + +if __name__ == '__main__': + main() diff --git a/examples/python/easy_start_demo/README.md b/examples/python/easy_start_demo/README.md new file mode 100644 index 00000000000..2bb9059bc90 --- /dev/null +++ b/examples/python/easy_start_demo/README.md @@ -0,0 +1,37 @@ +## easyDemo for using GRPC in Python +###主要是介绍了在Python中使用GRPC时, 进行数据传输的四种方式。 +###This paper mainly introduces four ways of data transmission when GRPC is used in Python. + +- ####简单模式 (Unary) +```text +没啥好说的,跟调普通方法没差 +There's nothing to say. It's no different from the usual way. +``` +- ####客户端流模式 (Client Streaming) +```text +在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应. +In a single call, the client can transfer data to the server several times, +but the server can only return a response once. +``` +- ####服务端流模式 (Server Streaming) +```text +在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应 +In a single call, the client can only transmit data to the server at one time, +but the server can return the response many times. +``` +- ####双向流模式 (Bidirectional Streaming) +```text +在一次调用中, 客户端和服务器都可以向对方多次收发数据 +In a single call, both client and server can send and receive data +to each other multiple times. +``` +---- +Author: Zhongying Wang + +Email: kerbalwzy@gmail.com + +License: MPL2 + +DateTime: 2019-08-13T23:30:00Z + +PythonVersion: Python3.6.3 \ No newline at end of file diff --git a/examples/python/easy_start_demo/customGrpcPackages/demo_pb2.py b/examples/python/easy_start_demo/customGrpcPackages/demo_pb2.py new file mode 100644 index 00000000000..4df1dad0b43 --- /dev/null +++ b/examples/python/easy_start_demo/customGrpcPackages/demo_pb2.py @@ -0,0 +1,174 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: demo.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='demo.proto', + package='demo', + syntax='proto3', + serialized_options=None, + serialized_pb=_b('\n\ndemo.proto\x12\x04\x64\x65mo\"&\n\x07Request\x12\x0b\n\x03\x43id\x18\x01 \x01(\x03\x12\x0e\n\x06ReqMsg\x18\x02 \x01(\t\"(\n\x08Response\x12\x0b\n\x03Sid\x18\x01 \x01(\x03\x12\x0f\n\x07RespMsg\x18\x02 \x01(\t2\xcd\x01\n\x08GRPCDemo\x12-\n\x0cSimpleMethod\x12\r.demo.Request\x1a\x0e.demo.Response\x12\x30\n\rCStreamMethod\x12\r.demo.Request\x1a\x0e.demo.Response(\x01\x12\x30\n\rSStreamMethod\x12\r.demo.Request\x1a\x0e.demo.Response0\x01\x12.\n\tTWFMethod\x12\r.demo.Request\x1a\x0e.demo.Response(\x01\x30\x01\x62\x06proto3') +) + + + + +_REQUEST = _descriptor.Descriptor( + name='Request', + full_name='demo.Request', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Cid', full_name='demo.Request.Cid', index=0, + number=1, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='ReqMsg', full_name='demo.Request.ReqMsg', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=20, + serialized_end=58, +) + + +_RESPONSE = _descriptor.Descriptor( + name='Response', + full_name='demo.Response', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Sid', full_name='demo.Response.Sid', index=0, + number=1, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='RespMsg', full_name='demo.Response.RespMsg', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=60, + serialized_end=100, +) + +DESCRIPTOR.message_types_by_name['Request'] = _REQUEST +DESCRIPTOR.message_types_by_name['Response'] = _RESPONSE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Request = _reflection.GeneratedProtocolMessageType('Request', (_message.Message,), { + 'DESCRIPTOR' : _REQUEST, + '__module__' : 'demo_pb2' + # @@protoc_insertion_point(class_scope:demo.Request) + }) +_sym_db.RegisterMessage(Request) + +Response = _reflection.GeneratedProtocolMessageType('Response', (_message.Message,), { + 'DESCRIPTOR' : _RESPONSE, + '__module__' : 'demo_pb2' + # @@protoc_insertion_point(class_scope:demo.Response) + }) +_sym_db.RegisterMessage(Response) + + + +_GRPCDEMO = _descriptor.ServiceDescriptor( + name='GRPCDemo', + full_name='demo.GRPCDemo', + file=DESCRIPTOR, + index=0, + serialized_options=None, + serialized_start=103, + serialized_end=308, + methods=[ + _descriptor.MethodDescriptor( + name='SimpleMethod', + full_name='demo.GRPCDemo.SimpleMethod', + index=0, + containing_service=None, + input_type=_REQUEST, + output_type=_RESPONSE, + serialized_options=None, + ), + _descriptor.MethodDescriptor( + name='CStreamMethod', + full_name='demo.GRPCDemo.CStreamMethod', + index=1, + containing_service=None, + input_type=_REQUEST, + output_type=_RESPONSE, + serialized_options=None, + ), + _descriptor.MethodDescriptor( + name='SStreamMethod', + full_name='demo.GRPCDemo.SStreamMethod', + index=2, + containing_service=None, + input_type=_REQUEST, + output_type=_RESPONSE, + serialized_options=None, + ), + _descriptor.MethodDescriptor( + name='TWFMethod', + full_name='demo.GRPCDemo.TWFMethod', + index=3, + containing_service=None, + input_type=_REQUEST, + output_type=_RESPONSE, + serialized_options=None, + ), +]) +_sym_db.RegisterServiceDescriptor(_GRPCDEMO) + +DESCRIPTOR.services_by_name['GRPCDemo'] = _GRPCDEMO + +# @@protoc_insertion_point(module_scope) diff --git a/examples/python/easy_start_demo/customGrpcPackages/demo_pb2_grpc.py b/examples/python/easy_start_demo/customGrpcPackages/demo_pb2_grpc.py new file mode 100644 index 00000000000..4aaccf1144a --- /dev/null +++ b/examples/python/easy_start_demo/customGrpcPackages/demo_pb2_grpc.py @@ -0,0 +1,99 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc + +from . import demo_pb2 as demo__pb2 + + +class GRPCDemoStub(object): + """服务service是用来gRPC的方法的, 格式固定 + 类似于Python中定义一个类, 类似于Golang中定义一个接口 + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SimpleMethod = channel.unary_unary( + '/demo.GRPCDemo/SimpleMethod', + request_serializer=demo__pb2.Request.SerializeToString, + response_deserializer=demo__pb2.Response.FromString, + ) + self.CStreamMethod = channel.stream_unary( + '/demo.GRPCDemo/CStreamMethod', + request_serializer=demo__pb2.Request.SerializeToString, + response_deserializer=demo__pb2.Response.FromString, + ) + self.SStreamMethod = channel.unary_stream( + '/demo.GRPCDemo/SStreamMethod', + request_serializer=demo__pb2.Request.SerializeToString, + response_deserializer=demo__pb2.Response.FromString, + ) + self.TWFMethod = channel.stream_stream( + '/demo.GRPCDemo/TWFMethod', + request_serializer=demo__pb2.Request.SerializeToString, + response_deserializer=demo__pb2.Response.FromString, + ) + + +class GRPCDemoServicer(object): + """服务service是用来gRPC的方法的, 格式固定 + 类似于Python中定义一个类, 类似于Golang中定义一个接口 + """ + + def SimpleMethod(self, request, context): + """简单模式 + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def CStreamMethod(self, request_iterator, context): + """客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SStreamMethod(self, request, context): + """服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def TWFMethod(self, request_iterator, context): + """双向流模式 (在一次调用中, 客户端和服务器都可以向对象多次收发数据) + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_GRPCDemoServicer_to_server(servicer, server): + rpc_method_handlers = { + 'SimpleMethod': grpc.unary_unary_rpc_method_handler( + servicer.SimpleMethod, + request_deserializer=demo__pb2.Request.FromString, + response_serializer=demo__pb2.Response.SerializeToString, + ), + 'CStreamMethod': grpc.stream_unary_rpc_method_handler( + servicer.CStreamMethod, + request_deserializer=demo__pb2.Request.FromString, + response_serializer=demo__pb2.Response.SerializeToString, + ), + 'SStreamMethod': grpc.unary_stream_rpc_method_handler( + servicer.SStreamMethod, + request_deserializer=demo__pb2.Request.FromString, + response_serializer=demo__pb2.Response.SerializeToString, + ), + 'TWFMethod': grpc.stream_stream_rpc_method_handler( + servicer.TWFMethod, + request_deserializer=demo__pb2.Request.FromString, + response_serializer=demo__pb2.Response.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'demo.GRPCDemo', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) diff --git a/examples/python/easy_start_demo/demo.proto b/examples/python/easy_start_demo/demo.proto new file mode 100644 index 00000000000..4fb76bce752 --- /dev/null +++ b/examples/python/easy_start_demo/demo.proto @@ -0,0 +1,51 @@ +// 语法版本声明,必须放在非注释的第一行 +// Syntax version declaration, Must be placed on the first line of non-commentary +syntax = "proto3"; + +// 包名定义, Python中使用时可以省略不写(PS:我还要再Go中使用,所以留在这里了) +// Package name definition, which can be omitted in Python (PS: I'll use it again in Go, so stay here) +package demo; + +/* +`message`是用来定义传输的数据的格式的, 等号后面的是字段编号 +消息定义中的每个字段都有唯一的编号 +总体格式类似于Python中定义一个类或者Golang中定义一个结构体 +*/ +/* +`message` is used to define the structure of the data to be transmitted, After the equal sign is the field number. +Each field in the message definition has a unique number. +The overall format is similar to defining a class in Python or a structure in Golang. +*/ +message Request { + int64 Cid = 1; + string ReqMsg = 2; +} + +message Response { + int64 Sid = 1; + string RespMsg = 2; +} + +// service是用来给GRPC服务定义方法的, 格式固定, 类似于Golang中定义一个接口 +// `service` is used to define methods for GRPC services in a fixed format, similar to defining an interface in Golang +service GRPCDemo { + // 简单模式 + // Unary + rpc SimpleMethod (Request) returns (Response); + + // 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) + // Client Streaming (In a single call, the client can transfer data to the server several times, + // but the server can only return a response once.) + rpc CStreamMethod (stream Request) returns (Response); + + // 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) + // Server Streaming (In a single call, the client can only transmit data to the server at one time, + // but the server can return the response many times.) + rpc SStreamMethod (Request) returns (stream Response); + + // 双向流模式 (在一次调用中, 客户端和服务器都可以向对方多次收发数据) + // Bidirectional Streaming (In a single call, both client and server can send and receive data + // to each other multiple times.) + rpc TWFMethod (stream Request) returns (stream Response); +} + diff --git a/examples/python/easy_start_demo/notes b/examples/python/easy_start_demo/notes new file mode 100644 index 00000000000..f0518fc1746 --- /dev/null +++ b/examples/python/easy_start_demo/notes @@ -0,0 +1,3 @@ +//自动生成代码 +//Automatic code generation +>>> python -m grpc_tools.protoc -I ./ ./demo.proto --python_out=./customGrpcPackages --grpc_python_out=./customGrpcPackages \ No newline at end of file From b132c34c61a82ccbf6833a03631cab228cb64062 Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Thu, 8 Aug 2019 17:18:38 -0600 Subject: [PATCH 315/661] Allow loading grpc/errors before grpc --- .../end2end/errors_load_before_grpc_lib.rb | 31 ++++ .../end2end/logger_load_before_grpc_lib.rb | 33 +++++ .../status_codes_load_before_grpc_lib.rb | 32 +++++ src/ruby/ext/grpc/rb_grpc.c | 40 ------ src/ruby/lib/grpc.rb | 1 + src/ruby/lib/grpc/core/status_codes.rb | 135 ++++++++++++++++++ src/ruby/lib/grpc/errors.rb | 2 +- .../helper_scripts/run_ruby_end2end_tests.sh | 3 + 8 files changed, 236 insertions(+), 41 deletions(-) create mode 100755 src/ruby/end2end/errors_load_before_grpc_lib.rb create mode 100755 src/ruby/end2end/logger_load_before_grpc_lib.rb create mode 100755 src/ruby/end2end/status_codes_load_before_grpc_lib.rb create mode 100644 src/ruby/lib/grpc/core/status_codes.rb diff --git a/src/ruby/end2end/errors_load_before_grpc_lib.rb b/src/ruby/end2end/errors_load_before_grpc_lib.rb new file mode 100755 index 00000000000..7e6ff7696fa --- /dev/null +++ b/src/ruby/end2end/errors_load_before_grpc_lib.rb @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby + +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +this_dir = File.expand_path(File.dirname(__FILE__)) +grpc_lib_dir = File.join(File.dirname(this_dir), 'lib') +$LOAD_PATH.unshift(grpc_lib_dir) unless $LOAD_PATH.include?(grpc_lib_dir) + +def main + fail('GRPC constant loaded before expected') if Object.const_defined?(:GRPC) + require 'grpc/errors' + fail('GRPC constant not loaded when expected') unless Object.const_defined?(:GRPC) + fail('GRPC BadStatus not loaded after required') unless GRPC.const_defined?(:BadStatus) + fail('GRPC library loaded before required') if GRPC::Core.const_defined?(:Channel) + require 'grpc' + fail('GRPC library not loaded after required') unless GRPC::Core.const_defined?(:Channel) +end + +main diff --git a/src/ruby/end2end/logger_load_before_grpc_lib.rb b/src/ruby/end2end/logger_load_before_grpc_lib.rb new file mode 100755 index 00000000000..76c37875040 --- /dev/null +++ b/src/ruby/end2end/logger_load_before_grpc_lib.rb @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby + +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +this_dir = File.expand_path(File.dirname(__FILE__)) +grpc_lib_dir = File.join(File.dirname(this_dir), 'lib') +$LOAD_PATH.unshift(grpc_lib_dir) unless $LOAD_PATH.include?(grpc_lib_dir) + +def main + fail('GRPC constant loaded before expected') if Object.const_defined?(:GRPC) + require 'grpc/logconfig' + fail('GRPC constant not loaded when expected') unless Object.const_defined?(:GRPC) + fail('GRPC DefaultLogger not loaded after required') unless GRPC.const_defined?(:DefaultLogger) + fail('GRPC logger not included after required') unless GRPC.methods.include?(:logger) + fail('GRPC Core loaded before required') if GRPC.const_defined?(:Core) + require 'grpc' + fail('GRPC Core not loaded after required') unless GRPC.const_defined?(:Core) + fail('GRPC library not loaded after required') unless GRPC::Core.const_defined?(:Channel) +end + +main diff --git a/src/ruby/end2end/status_codes_load_before_grpc_lib.rb b/src/ruby/end2end/status_codes_load_before_grpc_lib.rb new file mode 100755 index 00000000000..010c94cb91b --- /dev/null +++ b/src/ruby/end2end/status_codes_load_before_grpc_lib.rb @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby + +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +this_dir = File.expand_path(File.dirname(__FILE__)) +grpc_lib_dir = File.join(File.dirname(this_dir), 'lib') +$LOAD_PATH.unshift(grpc_lib_dir) unless $LOAD_PATH.include?(grpc_lib_dir) + +def main + fail('GRPC constant loaded before expected') if Object.const_defined?(:GRPC) + require 'grpc/core/status_codes' + fail('GRPC constant not loaded when expected') unless Object.const_defined?(:GRPC) + fail('GRPC Core not loaded after required') unless GRPC.const_defined?(:Core) + fail('GRPC StatusCodes not loaded after required') unless GRPC::Core.const_defined?(:StatusCodes) + fail('GRPC library loaded before required') if GRPC::Core.const_defined?(:Channel) + require 'grpc' + fail('GRPC library not loaded after required') unless GRPC::Core.const_defined?(:Channel) +end + +main diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index 4aa41217251..147ab4ad087 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -155,45 +155,6 @@ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval) { return t; } -static void Init_grpc_status_codes() { - /* Constants representing the status codes or grpc_status_code in status.h */ - VALUE grpc_rb_mStatusCodes = - rb_define_module_under(grpc_rb_mGrpcCore, "StatusCodes"); - rb_define_const(grpc_rb_mStatusCodes, "OK", INT2NUM(GRPC_STATUS_OK)); - rb_define_const(grpc_rb_mStatusCodes, "CANCELLED", - INT2NUM(GRPC_STATUS_CANCELLED)); - rb_define_const(grpc_rb_mStatusCodes, "UNKNOWN", - INT2NUM(GRPC_STATUS_UNKNOWN)); - rb_define_const(grpc_rb_mStatusCodes, "INVALID_ARGUMENT", - INT2NUM(GRPC_STATUS_INVALID_ARGUMENT)); - rb_define_const(grpc_rb_mStatusCodes, "DEADLINE_EXCEEDED", - INT2NUM(GRPC_STATUS_DEADLINE_EXCEEDED)); - rb_define_const(grpc_rb_mStatusCodes, "NOT_FOUND", - INT2NUM(GRPC_STATUS_NOT_FOUND)); - rb_define_const(grpc_rb_mStatusCodes, "ALREADY_EXISTS", - INT2NUM(GRPC_STATUS_ALREADY_EXISTS)); - rb_define_const(grpc_rb_mStatusCodes, "PERMISSION_DENIED", - INT2NUM(GRPC_STATUS_PERMISSION_DENIED)); - rb_define_const(grpc_rb_mStatusCodes, "UNAUTHENTICATED", - INT2NUM(GRPC_STATUS_UNAUTHENTICATED)); - rb_define_const(grpc_rb_mStatusCodes, "RESOURCE_EXHAUSTED", - INT2NUM(GRPC_STATUS_RESOURCE_EXHAUSTED)); - rb_define_const(grpc_rb_mStatusCodes, "FAILED_PRECONDITION", - INT2NUM(GRPC_STATUS_FAILED_PRECONDITION)); - rb_define_const(grpc_rb_mStatusCodes, "ABORTED", - INT2NUM(GRPC_STATUS_ABORTED)); - rb_define_const(grpc_rb_mStatusCodes, "OUT_OF_RANGE", - INT2NUM(GRPC_STATUS_OUT_OF_RANGE)); - rb_define_const(grpc_rb_mStatusCodes, "UNIMPLEMENTED", - INT2NUM(GRPC_STATUS_UNIMPLEMENTED)); - rb_define_const(grpc_rb_mStatusCodes, "INTERNAL", - INT2NUM(GRPC_STATUS_INTERNAL)); - rb_define_const(grpc_rb_mStatusCodes, "UNAVAILABLE", - INT2NUM(GRPC_STATUS_UNAVAILABLE)); - rb_define_const(grpc_rb_mStatusCodes, "DATA_LOSS", - INT2NUM(GRPC_STATUS_DATA_LOSS)); -} - /* id_at is the constructor method of the ruby standard Time class. */ static ID id_at; @@ -363,7 +324,6 @@ void Init_grpc_c() { Init_grpc_channel_credentials(); Init_grpc_server(); Init_grpc_server_credentials(); - Init_grpc_status_codes(); Init_grpc_time_consts(); Init_grpc_compression_options(); } diff --git a/src/ruby/lib/grpc.rb b/src/ruby/lib/grpc.rb index 37b03920727..66b1b8db39f 100644 --- a/src/ruby/lib/grpc.rb +++ b/src/ruby/lib/grpc.rb @@ -19,6 +19,7 @@ require_relative 'grpc/grpc' require_relative 'grpc/logconfig' require_relative 'grpc/notifier' require_relative 'grpc/version' +require_relative 'grpc/core/status_codes' require_relative 'grpc/core/time_consts' require_relative 'grpc/generic/active_call' require_relative 'grpc/generic/client_stub' diff --git a/src/ruby/lib/grpc/core/status_codes.rb b/src/ruby/lib/grpc/core/status_codes.rb new file mode 100644 index 00000000000..e7e7a0b1e4a --- /dev/null +++ b/src/ruby/lib/grpc/core/status_codes.rb @@ -0,0 +1,135 @@ +# Copyright 2015 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# GRPC contains the General RPC module. +module GRPC + module Core + # StatusCodes defines the canonical error codes used by gRPC for the RPC + # API. + module StatusCodes + # OK is returned on success. + OK = 0 + + # Canceled indicates the operation was canceled (typically by the caller). + CANCELLED = 1 + + # Unknown error. An example of where this error may be returned is if a + # Status value received from another address space belongs to an + # error-space that is not known in this address space. Also errors raised + # by APIs that do not return enough error information may be converted to + # this error. + UNKNOWN = 2 + + # InvalidArgument indicates client specified an invalid argument. Note + # that this differs from FailedPrecondition. It indicates arguments that + # are problematic regardless of the state of the system (e.g., a malformed + # file name). + INVALID_ARGUMENT = 3 + + # DeadlineExceeded means operation expired before completion. For + # operations that change the state of the system, this error may be + # returned even if the operation has completed successfully. For example, + # a successful response from a server could have been delayed long enough + # for the deadline to expire. + DEADLINE_EXCEEDED = 4 + + # NotFound means some requested entity (e.g., file or directory) was not + # found. + NOT_FOUND = 5 + + # AlreadyExists means an attempt to create an entity failed because one + # already exists. + ALREADY_EXISTS = 6 + + # PermissionDenied indicates the caller does not have permission to + # execute the specified operation. It must not be used for rejections + # caused by exhausting some resource (use ResourceExhausted instead for + # those errors). It must not be used if the caller cannot be identified + # (use Unauthenticated instead for those errors). + PERMISSION_DENIED = 7 + + # ResourceExhausted indicates some resource has been exhausted, perhaps a + # per-user quota, or perhaps the entire file system is out of space. + RESOURCE_EXHAUSTED = 8 + + # FailedPrecondition indicates operation was rejected because the system + # is not in a state required for the operation's execution. For example, + # directory to be deleted may be non-empty, an rmdir operation is applied + # to a non-directory, etc. + # + # A litmus test that may help a service implementor in deciding between + # FailedPrecondition, Aborted, and Unavailable: + # (a) Use Unavailable if the client can retry just the failing call. + # (b) Use Aborted if the client should retry at a higher-level (e.g., + # restarting a read-modify-write sequence). + # (c) Use FailedPrecondition if the client should not retry until the + # system state has been explicitly fixed. E.g., if an "rmdir" fails + # because the directory is non-empty, FailedPrecondition should be + # returned since the client should not retry unless they have first + # fixed up the directory by deleting files from it. + # (d) Use FailedPrecondition if the client performs conditional REST + # Get/Update/Delete on a resource and the resource on the server does + # not match the condition. E.g., conflicting read-modify-write on the + # same resource. + FAILED_PRECONDITION = 9 + + # Aborted indicates the operation was aborted, typically due to a + # concurrency issue like sequencer check failures, transaction aborts, + # etc. + # + # See litmus test above for deciding between FailedPrecondition, Aborted, + # and Unavailable. + ABORTED = 10 + + # OutOfRange means operation was attempted past the valid range. E.g., + # seeking or reading past end of file. + # + # Unlike InvalidArgument, this error indicates a problem that may be fixed + # if the system state changes. For example, a 32-bit file system will + # generate InvalidArgument if asked to read at an offset that is not in + # the range [0,2^32-1], but it will generate OutOfRange if asked to read + # from an offset past the current file size. + # + # There is a fair bit of overlap between FailedPrecondition and + # OutOfRange. We recommend using OutOfRange (the more specific error) when + # it applies so that callers who are iterating through a space can easily + # look for an OutOfRange error to detect when they are done. + OUT_OF_RANGE = 11 + + # Unimplemented indicates operation is not implemented or not + # supported/enabled in this service. + UNIMPLEMENTED = 12 + + # Internal errors. Means some invariants expected by underlying system has + # been broken. If you see one of these errors, something is very broken. + INTERNAL = 13 + + # Unavailable indicates the service is currently unavailable. This is a + # most likely a transient condition and may be corrected by retrying with + # a backoff. Note that it is not always safe to retry non-idempotent + # operations. + # + # See litmus test above for deciding between FailedPrecondition, Aborted, + # and Unavailable. + UNAVAILABLE = 14 + + # DataLoss indicates unrecoverable data loss or corruption. + DATA_LOSS = 15 + + # Unauthenticated indicates the request does not have valid authentication + # credentials for the operation. + UNAUTHENTICATED = 16 + end + end +end diff --git a/src/ruby/lib/grpc/errors.rb b/src/ruby/lib/grpc/errors.rb index 0b27bee1b9c..e44043f3199 100644 --- a/src/ruby/lib/grpc/errors.rb +++ b/src/ruby/lib/grpc/errors.rb @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative './grpc' +require_relative './core/status_codes' # GRPC contains the General RPC module. module GRPC diff --git a/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh b/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh index 1c48ed20ba6..fc0759fc836 100755 --- a/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh +++ b/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh @@ -32,4 +32,7 @@ time ruby src/ruby/end2end/client_memory_usage_driver.rb || EXIT_CODE=1 time ruby src/ruby/end2end/package_with_underscore_checker.rb || EXIT_CODE=1 time ruby src/ruby/end2end/graceful_sig_handling_driver.rb || EXIT_CODE=1 time ruby src/ruby/end2end/graceful_sig_stop_driver.rb || EXIT_CODE=1 +time ruby src/ruby/end2end/errors_load_before_grpc_lib.rb || EXIT_CODE=1 +time ruby src/ruby/end2end/logger_load_before_grpc_lib.rb || EXIT_CODE=1 +time ruby src/ruby/end2end/status_codes_load_before_grpc_lib.rb || EXIT_CODE=1 exit $EXIT_CODE From 1713c3689252dce4515006c4a1c5c9fe707495d4 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 13 Aug 2019 10:06:04 -0700 Subject: [PATCH 316/661] Prevent HTTP2 parser from queueing a lot of induced frames - SETTINGS ACK, PING ACK, RST_STREAM --- .../chttp2/transport/chttp2_transport.cc | 55 +++++++++++++------ .../transport/chttp2/transport/frame_ping.cc | 1 + .../chttp2/transport/frame_rst_stream.cc | 8 +++ .../chttp2/transport/frame_rst_stream.h | 7 +++ .../chttp2/transport/frame_settings.cc | 1 + .../chttp2/transport/hpack_parser.cc | 5 +- .../ext/transport/chttp2/transport/internal.h | 7 +++ .../ext/transport/chttp2/transport/parsing.cc | 14 ++--- .../ext/transport/chttp2/transport/writing.cc | 1 + 9 files changed, 71 insertions(+), 28 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index d4ecc37fcc5..029d96c95fe 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -74,6 +74,8 @@ #define DEFAULT_MAX_PINGS_BETWEEN_DATA 2 #define DEFAULT_MAX_PING_STRIKES 2 +#define DEFAULT_MAX_PENDING_INDUCED_FRAMES 10000 + static int g_default_client_keepalive_time_ms = DEFAULT_CLIENT_KEEPALIVE_TIME_MS; static int g_default_client_keepalive_timeout_ms = @@ -105,6 +107,7 @@ static void write_action(void* t, grpc_error* error); static void write_action_end_locked(void* t, grpc_error* error); static void read_action_locked(void* t, grpc_error* error); +static void continue_read_action_locked(grpc_chttp2_transport* t); static void complete_fetch_locked(void* gs, grpc_error* error); /** Set a transport level setting, and push it to our peer */ @@ -797,10 +800,8 @@ grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t, !grpc_resource_user_safe_alloc(t->resource_user, GRPC_RESOURCE_QUOTA_CALL_SIZE)) { gpr_log(GPR_ERROR, "Memory exhausted, rejecting the stream."); - grpc_slice_buffer_add( - &t->qbuf, - grpc_chttp2_rst_stream_create( - id, static_cast(GRPC_HTTP2_REFUSED_STREAM), nullptr)); + grpc_chttp2_add_rst_stream_to_next_write(t, id, GRPC_HTTP2_REFUSED_STREAM, + nullptr); grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM); return nullptr; } @@ -1045,6 +1046,19 @@ static void write_action_begin_locked(void* gt, grpc_error* error_ignored) { GRPC_CLOSURE_SCHED( GRPC_CLOSURE_INIT(&t->write_action, write_action, t, scheduler), GRPC_ERROR_NONE); + if (t->reading_paused_on_pending_induced_frames) { + GPR_ASSERT(t->num_pending_induced_frames == 0); + /* We had paused reading, because we had many induced frames (SETTINGS + * ACK, RST_STREAMS) pending in t->qbuf. Now that we have been able to + * flush qbuf, we can resume reading. */ + GRPC_CHTTP2_IF_TRACING(gpr_log( + GPR_INFO, + "transport %p : Resuming reading after being paused due to too " + "many unwritten SETTINGS ACK and RST_STREAM frames", + t)); + t->reading_paused_on_pending_induced_frames = false; + continue_read_action_locked(t); + } } else { GRPC_STATS_INC_HTTP2_SPURIOUS_WRITES_BEGUN(); set_write_state(t, GRPC_CHTTP2_WRITE_STATE_IDLE, "begin writing nothing"); @@ -1114,7 +1128,6 @@ static void write_action_end_locked(void* tp, grpc_error* error) { } grpc_chttp2_end_write(t, GRPC_ERROR_REF(error)); - GRPC_CHTTP2_UNREF_TRANSPORT(t, "writing"); } @@ -1160,7 +1173,6 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t, gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string, goaway_error, grpc_error_string(t->goaway_error)); } - /* When a client receives a GOAWAY with error code ENHANCE_YOUR_CALM and debug * data equal to "too_many_pings", it should log the occurrence at a log level * that is enabled by default and double the configured KEEPALIVE_TIME used @@ -2110,10 +2122,8 @@ void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s, grpc_http2_error_code http_error; grpc_error_get_status(due_to_error, s->deadline, nullptr, nullptr, &http_error, nullptr); - grpc_slice_buffer_add( - &t->qbuf, - grpc_chttp2_rst_stream_create( - s->id, static_cast(http_error), &s->stats.outgoing)); + grpc_chttp2_add_rst_stream_to_next_write( + t, s->id, static_cast(http_error), &s->stats.outgoing); grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM); } } @@ -2424,9 +2434,8 @@ static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s, grpc_slice_buffer_add(&t->qbuf, status_hdr); grpc_slice_buffer_add(&t->qbuf, message_pfx); grpc_slice_buffer_add(&t->qbuf, grpc_slice_ref_internal(slice)); - grpc_slice_buffer_add( - &t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_HTTP2_NO_ERROR, - &s->stats.outgoing)); + grpc_chttp2_add_rst_stream_to_next_write(t, s->id, GRPC_HTTP2_NO_ERROR, + &s->stats.outgoing); grpc_chttp2_mark_stream_closed(t, s, 1, 1, error); grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_CLOSE_FROM_API); @@ -2596,10 +2605,16 @@ static void read_action_locked(void* tp, grpc_error* error) { grpc_slice_buffer_reset_and_unref_internal(&t->read_buffer); if (keep_reading) { - const bool urgent = t->goaway_error != GRPC_ERROR_NONE; - grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent); - grpc_chttp2_act_on_flowctl_action(t->flow_control->MakeAction(), t, - nullptr); + if (t->num_pending_induced_frames >= DEFAULT_MAX_PENDING_INDUCED_FRAMES) { + t->reading_paused_on_pending_induced_frames = true; + GRPC_CHTTP2_IF_TRACING( + gpr_log(GPR_INFO, + "transport %p : Pausing reading due to too " + "many unwritten SETTINGS ACK and RST_STREAM frames", + t)); + } else { + continue_read_action_locked(t); + } } else { GRPC_CHTTP2_UNREF_TRANSPORT(t, "reading_action"); } @@ -2607,6 +2622,12 @@ static void read_action_locked(void* tp, grpc_error* error) { GRPC_ERROR_UNREF(error); } +static void continue_read_action_locked(grpc_chttp2_transport* t) { + const bool urgent = t->goaway_error != GRPC_ERROR_NONE; + grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent); + grpc_chttp2_act_on_flowctl_action(t->flow_control->MakeAction(), t, nullptr); +} + // t is reffed prior to calling the first time, and once the callback chain // that kicks off finishes, it's unreffed static void schedule_bdp_ping_locked(grpc_chttp2_transport* t) { diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.cc b/src/core/ext/transport/chttp2/transport/frame_ping.cc index 9a56bf093f4..87c92dffc38 100644 --- a/src/core/ext/transport/chttp2/transport/frame_ping.cc +++ b/src/core/ext/transport/chttp2/transport/frame_ping.cc @@ -118,6 +118,7 @@ grpc_error* grpc_chttp2_ping_parser_parse(void* parser, t->ping_acks = static_cast(gpr_realloc( t->ping_acks, t->ping_ack_capacity * sizeof(*t->ping_acks))); } + t->num_pending_induced_frames++; t->ping_acks[t->ping_ack_count++] = p->opaque_8bytes; grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_PING_RESPONSE); } diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc b/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc index cda09c3dea1..1350a967b9f 100644 --- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc @@ -58,6 +58,14 @@ grpc_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code, return slice; } +void grpc_chttp2_add_rst_stream_to_next_write( + grpc_chttp2_transport* t, uint32_t id, uint32_t code, + grpc_transport_one_way_stats* stats) { + t->num_pending_induced_frames++; + grpc_slice_buffer_add(&t->qbuf, + grpc_chttp2_rst_stream_create(id, code, stats)); +} + grpc_error* grpc_chttp2_rst_stream_parser_begin_frame( grpc_chttp2_rst_stream_parser* parser, uint32_t length, uint8_t flags) { if (length != 4) { diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h index 64707666181..d61e62394a4 100644 --- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h @@ -33,6 +33,13 @@ typedef struct { grpc_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code, grpc_transport_one_way_stats* stats); +// Adds RST_STREAM frame to t->qbuf (buffer for the next write). Should be +// called when we want to add RST_STREAM and we are not in +// write_action_begin_locked. +void grpc_chttp2_add_rst_stream_to_next_write( + grpc_chttp2_transport* t, uint32_t id, uint32_t code, + grpc_transport_one_way_stats* stats); + grpc_error* grpc_chttp2_rst_stream_parser_begin_frame( grpc_chttp2_rst_stream_parser* parser, uint32_t length, uint8_t flags); grpc_error* grpc_chttp2_rst_stream_parser_parse(void* parser, diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.cc b/src/core/ext/transport/chttp2/transport/frame_settings.cc index 3f84679ec31..ba57afa74b9 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.cc +++ b/src/core/ext/transport/chttp2/transport/frame_settings.cc @@ -132,6 +132,7 @@ grpc_error* grpc_chttp2_settings_parser_parse(void* p, grpc_chttp2_transport* t, if (is_last) { memcpy(parser->target_settings, parser->incoming_settings, GRPC_CHTTP2_NUM_SETTINGS * sizeof(uint32_t)); + t->num_pending_induced_frames++; grpc_slice_buffer_add(&t->qbuf, grpc_chttp2_settings_ack_create()); if (t->notify_on_receive_settings != nullptr) { GRPC_CLOSURE_SCHED(t->notify_on_receive_settings, diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc index be52d62be3a..7414fd7fff8 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc @@ -1671,9 +1671,8 @@ static void force_client_rst_stream(void* sp, grpc_error* error) { grpc_chttp2_stream* s = static_cast(sp); grpc_chttp2_transport* t = s->t; if (!s->write_closed) { - grpc_slice_buffer_add( - &t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_HTTP2_NO_ERROR, - &s->stats.outgoing)); + grpc_chttp2_add_rst_stream_to_next_write(t, s->id, GRPC_HTTP2_NO_ERROR, + &s->stats.outgoing); grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_FORCE_RST_STREAM); grpc_chttp2_mark_stream_closed(t, s, true, true, GRPC_ERROR_NONE); } diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 2204691726a..b00576cadd5 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -493,6 +493,13 @@ struct grpc_chttp2_transport { grpc_core::ContextList* cl = nullptr; grpc_core::RefCountedPtr channelz_socket; uint32_t num_messages_in_next_write = 0; + /** The number of pending induced frames (SETTINGS_ACK and RST_STREAM) in the + * outgoing buffer (t->qbuf). If this number goes beyond + * DEFAULT_MAX_PENDING_INDUCED_FRAMES, we pause reading new frames. We would + * only continue reading when we are able to write to the socket again, + * thereby reducing the number of induced frames. */ + uint32_t num_pending_induced_frames = 0; + bool reading_paused_on_pending_induced_frames = false; }; typedef enum { diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc index c1b226c5fb3..2a2a8206cb6 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.cc +++ b/src/core/ext/transport/chttp2/transport/parsing.cc @@ -382,10 +382,9 @@ error_handler: if (s != nullptr) { grpc_chttp2_mark_stream_closed(t, s, true, false, err); } - grpc_slice_buffer_add( - &t->qbuf, grpc_chttp2_rst_stream_create(t->incoming_stream_id, - GRPC_HTTP2_PROTOCOL_ERROR, - &s->stats.outgoing)); + grpc_chttp2_add_rst_stream_to_next_write(t, t->incoming_stream_id, + GRPC_HTTP2_PROTOCOL_ERROR, + &s->stats.outgoing); return init_skip_frame_parser(t, 0); } else { return err; @@ -763,10 +762,9 @@ static grpc_error* parse_frame_slice(grpc_chttp2_transport* t, grpc_chttp2_parsing_become_skip_parser(t); if (s) { s->forced_close_error = err; - grpc_slice_buffer_add( - &t->qbuf, grpc_chttp2_rst_stream_create(t->incoming_stream_id, - GRPC_HTTP2_PROTOCOL_ERROR, - &s->stats.outgoing)); + grpc_chttp2_add_rst_stream_to_next_write(t, t->incoming_stream_id, + GRPC_HTTP2_PROTOCOL_ERROR, + &s->stats.outgoing); } else { GRPC_ERROR_UNREF(err); } diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc index f3cb390dc7a..d6d9e4521f6 100644 --- a/src/core/ext/transport/chttp2/transport/writing.cc +++ b/src/core/ext/transport/chttp2/transport/writing.cc @@ -219,6 +219,7 @@ class WriteContext { void FlushQueuedBuffers() { /* simple writes are queued to qbuf, and flushed here */ grpc_slice_buffer_move_into(&t_->qbuf, &t_->outbuf); + t_->num_pending_induced_frames = 0; GPR_ASSERT(t_->qbuf.count == 0); } From eceb4db63ed13d0f3df8019048b95a25fbb9de97 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 13 Aug 2019 10:37:43 -0700 Subject: [PATCH 317/661] Reviewer comments --- src/core/ext/transport/chttp2/transport/chttp2_transport.cc | 6 +++--- src/core/ext/transport/chttp2/transport/internal.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 029d96c95fe..f4b0f694142 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -1049,12 +1049,12 @@ static void write_action_begin_locked(void* gt, grpc_error* error_ignored) { if (t->reading_paused_on_pending_induced_frames) { GPR_ASSERT(t->num_pending_induced_frames == 0); /* We had paused reading, because we had many induced frames (SETTINGS - * ACK, RST_STREAMS) pending in t->qbuf. Now that we have been able to - * flush qbuf, we can resume reading. */ + * ACK, PINGS ACK and RST_STREAMS) pending in t->qbuf. Now that we have + * been able to flush qbuf, we can resume reading. */ GRPC_CHTTP2_IF_TRACING(gpr_log( GPR_INFO, "transport %p : Resuming reading after being paused due to too " - "many unwritten SETTINGS ACK and RST_STREAM frames", + "many unwritten SETTINGS ACK, PINGS ACK and RST_STREAM frames", t)); t->reading_paused_on_pending_induced_frames = false; continue_read_action_locked(t); diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index b00576cadd5..6e1db8a5707 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -493,8 +493,8 @@ struct grpc_chttp2_transport { grpc_core::ContextList* cl = nullptr; grpc_core::RefCountedPtr channelz_socket; uint32_t num_messages_in_next_write = 0; - /** The number of pending induced frames (SETTINGS_ACK and RST_STREAM) in the - * outgoing buffer (t->qbuf). If this number goes beyond + /** The number of pending induced frames (SETTINGS_ACK, PINGS_ACK and + * RST_STREAM) in the outgoing buffer (t->qbuf). If this number goes beyond * DEFAULT_MAX_PENDING_INDUCED_FRAMES, we pause reading new frames. We would * only continue reading when we are able to write to the socket again, * thereby reducing the number of induced frames. */ From 1d981068475d6b938b6df0132e14e3a0f0e93229 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 13 Aug 2019 10:45:52 -0700 Subject: [PATCH 318/661] Renaming the correct files --- test/cpp/ios/build_and_run_tests.sh | 31 +++++++++---------- test/cpp/ios/{run_tests.sh => build_tests.sh} | 31 ++++++++++--------- 2 files changed, 31 insertions(+), 31 deletions(-) rename test/cpp/ios/{run_tests.sh => build_tests.sh} (61%) diff --git a/test/cpp/ios/build_and_run_tests.sh b/test/cpp/ios/build_and_run_tests.sh index ead0159dcc9..83db83fd199 100755 --- a/test/cpp/ios/build_and_run_tests.sh +++ b/test/cpp/ios/build_and_run_tests.sh @@ -14,27 +14,26 @@ # limitations under the License. # Don't run this script standalone. Instead, run from the repository root: -# ./tools/run_tests/run_tests.py -l objc +# ./tools/run_tests/run_tests.py -l c++ -set -e - -# CocoaPods requires the terminal to be using UTF-8 encoding. -export LANG=en_US.UTF-8 +set -ev cd "$(dirname "$0")" -hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; } -hash xcodebuild 2>/dev/null || { - echo >&2 "XCode command-line tools need to be installed." - exit 1 -} +echo "TIME: $(date)" -# clean the directory -rm -rf Pods -rm -rf Tests.xcworkspace -rm -f Podfile.lock -rm -rf RemoteTestClientCpp/src +./build_tests.sh echo "TIME: $(date)" -pod install +set -o pipefail + +XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' + +xcodebuild \ + -workspace Tests.xcworkspace \ + -scheme CronetTests \ + -destination name="iPhone 8" \ + test \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v '^$' - diff --git a/test/cpp/ios/run_tests.sh b/test/cpp/ios/build_tests.sh similarity index 61% rename from test/cpp/ios/run_tests.sh rename to test/cpp/ios/build_tests.sh index 83db83fd199..ead0159dcc9 100755 --- a/test/cpp/ios/run_tests.sh +++ b/test/cpp/ios/build_tests.sh @@ -14,26 +14,27 @@ # limitations under the License. # Don't run this script standalone. Instead, run from the repository root: -# ./tools/run_tests/run_tests.py -l c++ +# ./tools/run_tests/run_tests.py -l objc -set -ev +set -e + +# CocoaPods requires the terminal to be using UTF-8 encoding. +export LANG=en_US.UTF-8 cd "$(dirname "$0")" -echo "TIME: $(date)" +hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; } +hash xcodebuild 2>/dev/null || { + echo >&2 "XCode command-line tools need to be installed." + exit 1 +} -./build_tests.sh +# clean the directory +rm -rf Pods +rm -rf Tests.xcworkspace +rm -f Podfile.lock +rm -rf RemoteTestClientCpp/src echo "TIME: $(date)" +pod install -set -o pipefail - -XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' - -xcodebuild \ - -workspace Tests.xcworkspace \ - -scheme CronetTests \ - -destination name="iPhone 8" \ - test \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v '^$' - From 4c893d8cdc279c8d460a53ed4dd809761588361d Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 13 Aug 2019 11:04:18 -0700 Subject: [PATCH 319/661] Changed dev languages and bundle ids --- src/objective-c/examples/BUILD | 12 +++---- .../Sample/Sample.xcodeproj/project.pbxproj | 4 +-- .../examples/Sample/Sample/Info.plist | 2 +- .../tvOS-sample.xcodeproj/project.pbxproj | 6 ++-- .../tvOS-sample/tvOS-sample/Info.plist | 2 +- .../watchOS-sample/WatchKit-App/Info.plist | 4 +-- .../WatchKit-Extension/Info.plist | 4 +-- .../watchOS-sample.xcodeproj/project.pbxproj | 36 ++++--------------- .../watchOS-sample/watchOS-sample/Info.plist | 2 +- 9 files changed, 24 insertions(+), 48 deletions(-) diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index 5e3e4f9badd..4f333cd7502 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -63,7 +63,7 @@ objc_library( ios_application( name = "Sample", - bundle_id = "grpc.objc.examples.Sample", + bundle_id = "io.grpc.Sample", minimum_os_version = "8.0", infoplists = ["Sample/Sample/Info.plist"], families = [ @@ -87,7 +87,7 @@ objc_library( ios_application( name = "InterceptorSample", - bundle_id = "grpc.objc.examples.InterceptorSample", + bundle_id = "io.grpc.InterceptorSample", minimum_os_version = "9.0", # Safe Area Layout Guide used infoplists = ["InterceptorSample/InterceptorSample/Info.plist"], families = [ @@ -111,7 +111,7 @@ objc_library( # c-ares does not support tvOS CPU architecture with Bazel yet tvos_application( name = "tvOS-sample", - bundle_id = "grpc.objc.examples.tvOS-sample", + bundle_id = "io.grpc.tvOS-sample", minimum_os_version = "10.0", infoplists = ["tvOS-sample/tvOS-sample/Info.plist"], deps = [":tvOS-sample-lib"], @@ -141,7 +141,7 @@ objc_library( ios_application( name = "watchOS-sample", - bundle_id = "com.google.watchOS-sample", + bundle_id = "io.grpc.watchOS-sample", minimum_os_version = "9.0", # Safe Area Layout Guide used families = ["iphone"], infoplists = ["watchOS-sample/watchOS-sample/Info.plist"], @@ -152,7 +152,7 @@ ios_application( # c-ares does not support watchOS CPU architecture with Bazel yet watchos_application( name = "watchOS-sample-watchApp", - bundle_id = "com.google.watchOS-sample.watchkitapp", + bundle_id = "io.grpc.watchOS-sample.watchkitapp", minimum_os_version = "4.0", storyboards = ["watchOS-sample/WatchKit-App/Base.lproj/Interface.storyboard"], infoplists = ["watchOS-sample/WatchKit-App/Info.plist"], @@ -161,7 +161,7 @@ watchos_application( watchos_extension( name = "watchOS-sample-extension", - bundle_id = "com.google.watchOS-sample.watchkitapp.watchkitextension", + bundle_id = "io.grpc.watchOS-sample.watchkitapp.watchkitextension", minimum_os_version = "4.0", infoplists = ["watchOS-sample/WatchKit-Extension/Info.plist"], deps = [":watchOS-sample-extension-lib"], diff --git a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj index cdd1c6c8f7e..2c8156de1e3 100644 --- a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -327,7 +327,7 @@ INFOPLIST_FILE = Sample/Info.plist; LD_GENERATE_MAP_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.grpc.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.Sample; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -340,7 +340,7 @@ INFOPLIST_FILE = Sample/Info.plist; LD_GENERATE_MAP_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.grpc.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.Sample; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; diff --git a/src/objective-c/examples/Sample/Sample/Info.plist b/src/objective-c/examples/Sample/Sample/Info.plist index 2cdf09dc2fc..943e942ae83 100644 --- a/src/objective-c/examples/Sample/Sample/Info.plist +++ b/src/objective-c/examples/Sample/Sample/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + en_US CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj index 84eafed2608..be6863f9f3f 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj @@ -214,7 +214,7 @@ ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources.sh", - "$PODS_CONFIGURATION_BUILD_DIR/gRPC/gRPCCertificates.bundle", + $PODS_CONFIGURATION_BUILD_DIR/gRPC/gRPCCertificates.bundle, ); name = "[CP] Copy Pods Resources"; outputPaths = ( @@ -365,7 +365,7 @@ DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "tvOS-sample/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-sample"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.tvOS-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; TARGETED_DEVICE_FAMILY = 3; @@ -384,7 +384,7 @@ DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "tvOS-sample/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-sample"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.tvOS-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; TARGETED_DEVICE_FAMILY = 3; diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist b/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist index 63dcd6c1d26..33fbde9c63c 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + en_US CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist index 6dbcfe04d53..72c83c2794f 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist +++ b/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + en_US CFBundleDisplayName WatchKit-App CFBundleExecutable @@ -26,7 +26,7 @@ UIInterfaceOrientationPortraitUpsideDown WKCompanionAppBundleIdentifier - com.google.watchOS-sample + io.grpc.watchOS-sample WKWatchKitApp diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist index 4a0a252b854..8d8373ba3e5 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + en_US CFBundleDisplayName watchOS-sample WatchKit Extension CFBundleExecutable @@ -25,7 +25,7 @@ NSExtensionAttributes WKAppBundleIdentifier - com.google.watchOS-sample.watchkitapp + io.grpc.watchOS-sample.watchkitapp NSExtensionPointIdentifier com.apple.watchkit diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj index ddd91170243..8042b5c4a0d 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj @@ -342,15 +342,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh", "$PODS_CONFIGURATION_BUILD_DIR/gRPC-iOS/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - ); outputPaths = ( "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}", ); @@ -364,8 +360,6 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-frameworks.sh", "${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC-iOS/openssl_grpc.framework", @@ -378,8 +372,6 @@ "${BUILT_PRODUCTS_DIR}/nanopb-iOS/nanopb.framework", ); name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - ); outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework", @@ -400,15 +392,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-watchOS-sample-checkManifestLockResult.txt", ); @@ -422,15 +410,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-watchOS-sample WatchKit Extension-checkManifestLockResult.txt", ); @@ -444,15 +428,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources.sh", "$PODS_CONFIGURATION_BUILD_DIR/gRPC-watchOS/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - ); outputPaths = ( "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}", ); @@ -466,8 +446,6 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-frameworks.sh", "${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC-watchOS/openssl_grpc.framework", @@ -480,8 +458,6 @@ "${BUILT_PRODUCTS_DIR}/nanopb-watchOS/nanopb.framework", ); name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - ); outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework", @@ -675,7 +651,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "$(SRCROOT)/WatchKit-Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample.watchkitapp.watchkitextension"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.watchOS-sample.watchkitapp.watchkitextension"; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -693,7 +669,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "$(SRCROOT)/WatchKit-Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample.watchkitapp.watchkitextension"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.watchOS-sample.watchkitapp.watchkitextension"; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -710,7 +686,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; IBSC_MODULE = watchOS_sample_WatchKit_Extension; INFOPLIST_FILE = "$(SRCROOT)/WatchKit-App/Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample.watchkitapp"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.watchOS-sample.watchkitapp"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -727,7 +703,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; IBSC_MODULE = watchOS_sample_WatchKit_Extension; INFOPLIST_FILE = "$(SRCROOT)/WatchKit-App/Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample.watchkitapp"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.watchOS-sample.watchkitapp"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -745,7 +721,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "watchOS-sample/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.watchOS-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -760,7 +736,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "watchOS-sample/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.watchOS-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist b/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist index d0524738680..e5d82108923 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + en_US CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier From 2a070b853d4cb178c9aa3e8b86ee86003dbf6ea9 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 13 Aug 2019 11:06:59 -0700 Subject: [PATCH 320/661] Reverting changes --- .../tests/InteropTests/InteropTestsMultipleChannels.m | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m index c363e523250..98893a466bd 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m +++ b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m @@ -86,9 +86,7 @@ dispatch_once_t initCronet; self.continueAfterFailure = NO; _remoteService = [RMTTestService serviceWithHost:kRemoteSSLHost callOptions:nil]; -#ifdef GRPC_COMPILE_WITH_CRONET configureCronet(); -#endif // Default stack with remote host GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; From 0ad64536edefdb80eff20180717806f4a2694373 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 13 Aug 2019 11:15:38 -0700 Subject: [PATCH 321/661] Added some comments and TODOs --- .../tests/build_one_example_bazel.sh | 4 +- src/objective-c/tests/run_one_test_bazel.sh | 3 + src/objective-c/tests/run_tests.sh | 111 ------------------ tools/run_tests/run_tests.py | 2 + 4 files changed, 7 insertions(+), 113 deletions(-) delete mode 100755 src/objective-c/tests/run_tests.sh diff --git a/src/objective-c/tests/build_one_example_bazel.sh b/src/objective-c/tests/build_one_example_bazel.sh index c3fb3f232b5..b547ac157f0 100755 --- a/src/objective-c/tests/build_one_example_bazel.sh +++ b/src/objective-c/tests/build_one_example_bazel.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2016 gRPC authors. +# Copyright 2019 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,4 +32,4 @@ cd $EXAMPLE_PATH/.. if [ "$SCHEME" == "watchOS-sample-WatchKit-App" ]; then SCHEME="watchOS-sample watchOS-sample-watchApp" fi -../../../tools/bazel build $SCHEME \ No newline at end of file +../../../tools/bazel build $SCHEME diff --git a/src/objective-c/tests/run_one_test_bazel.sh b/src/objective-c/tests/run_one_test_bazel.sh index 97065e8545a..8f920d955fd 100755 --- a/src/objective-c/tests/run_one_test_bazel.sh +++ b/src/objective-c/tests/run_one_test_bazel.sh @@ -16,6 +16,9 @@ # Don't run this script standalone. Instead, run from the repository root: # ./tools/run_tests/run_tests.py -l objc +# TODO(tonyzhehaolu): +# For future use when Xcode is upgraded and tvos_unit_test is fully functional + set -ev cd $(dirname $0) diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh deleted file mode 100755 index 4ffb0e072d9..00000000000 --- a/src/objective-c/tests/run_tests.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/bash -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Don't run this script standalone. Instead, run from the repository root: -# ./tools/run_tests/run_tests.py -l objc - -set -ev - -cd $(dirname $0) - -# Run the tests server. - -BAZEL=../../../tools/bazel - -INTEROP=../../../bazel-out/darwin-fastbuild/bin/test/cpp/interop/interop_server - -[ -d Tests.xcworkspace ] || { - ./build_tests.sh -} - -[ -f $INTEROP ] || { - BAZEL build //test/cpp/interop:interop_server -} - -[ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { - echo >&2 "Can't find the port server. Start port server with tools/run_tests/start_port_server.py." - exit 1 -} - -PLAIN_PORT=$(curl localhost:32766/get) -TLS_PORT=$(curl localhost:32766/get) - -$INTEROP --port=$PLAIN_PORT --max_send_message_size=8388608 & -$INTEROP --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & - -# Kill them when this script exits. -trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT - -set -o pipefail - -# xcodebuild is very verbose. We filter its output and tell Bash to fail if any -# element of the pipe fails. -# TODO(jcanizales): Use xctool instead? Issue #2540. -XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' - -echo "TIME: $(date)" - -xcodebuild \ - -workspace Tests.xcworkspace \ - -scheme InteropTests \ - -destination name="iPhone 8" \ - HOST_PORT_LOCALSSL=localhost:5051 \ - HOST_PORT_LOCAL=localhost:5050 \ - HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ - test \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v '^$' \ - | egrep -v "(GPBDictionary|GPBArray)" - - -echo "TIME: $(date)" -xcodebuild \ - -workspace Tests.xcworkspace \ - -scheme UnitTests \ - -destination name="iPhone 8" \ - HOST_PORT_LOCALSSL=localhost:5051 \ - HOST_PORT_LOCAL=localhost:5050 \ - HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ - test \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v '^$' \ - | egrep -v "(GPBDictionary|GPBArray)" - - -echo "TIME: $(date)" -xcodebuild \ - -workspace Tests.xcworkspace \ - -scheme CronetTests \ - -destination name="iPhone 8" \ - HOST_PORT_LOCALSSL=localhost:5051 \ - HOST_PORT_LOCAL=localhost:5050 \ - HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ - test \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v '^$' \ - | egrep -v "(GPBDictionary|GPBArray)" - - -echo "TIME: $(date)" -xcodebuild \ - -workspace Tests.xcworkspace \ - -scheme MacTests \ - -destination platform=macOS \ - HOST_PORT_LOCALSSL=localhost:5051 \ - HOST_PORT_LOCAL=localhost:5050 \ - HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ - test \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v '^$' \ - | egrep -v "(GPBDictionary|GPBArray)" - - -exit 0 diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index c0b87d38087..95c3d8ed1dd 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1069,6 +1069,7 @@ class ObjCLanguage(object): 'EXAMPLE_PATH': 'src/objective-c/examples/Sample', 'FRAMEWORKS': 'NO' })) + # Currently not supporting compiling as frameworks in Bazel out.append( self.config.job_spec( ['src/objective-c/tests/build_one_example.sh'], @@ -1126,6 +1127,7 @@ class ObjCLanguage(object): shortname='ios-test-cfstream-tests', cpu_cost=1e6, environ=_FORCE_ENVIRON_FOR_WRAPPERS)) + # TODO: replace with run_one_test_bazel.sh when Bazel is stable out.append( self.config.job_spec( ['src/objective-c/tests/run_one_test.sh'], From ae99e81e40c2676b96dc7fc64069f2b2f0229ed6 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 13 Aug 2019 13:32:00 -0700 Subject: [PATCH 322/661] Move kGRPCErrorDomain to interface rather than Core implementation --- src/objective-c/GRPCClient/GRPCCall.m | 2 ++ src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 26f42032537..73ee530ef2c 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -27,6 +27,8 @@ NSString *const kGRPCHeadersKey = @"io.grpc.HeadersKey"; NSString *const kGRPCTrailersKey = @"io.grpc.TrailersKey"; +NSString *const kGRPCErrorDomain = @"io.grpc"; + /** * The response dispatcher creates its own serial dispatch queue and target the queue to the * dispatch queue of a user provided response handler. It removes the requirement of having to use diff --git a/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m b/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m index 3eefed88d63..a1441221b15 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m @@ -19,8 +19,7 @@ #import "NSError+GRPC.h" #include - -NSString *const kGRPCErrorDomain = @"io.grpc"; +#import @implementation NSError (GRPC) + (instancetype)grpc_errorFromStatusCode:(grpc_status_code)statusCode From e82886db208ac20c6ab464d26b3ebe4ff852214c Mon Sep 17 00:00:00 2001 From: ZHANG Dapeng Date: Tue, 13 Aug 2019 14:22:22 -0700 Subject: [PATCH 323/661] Update client_matrix.py for java releases --- tools/interop_matrix/client_matrix.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py index 585734283a7..a0401898699 100644 --- a/tools/interop_matrix/client_matrix.py +++ b/tools/interop_matrix/client_matrix.py @@ -161,7 +161,7 @@ LANG_RELEASE_MATRIX = { ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.6.1', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), - ('v1.7.0', + ('v1.7.1', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.8.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), @@ -171,24 +171,26 @@ LANG_RELEASE_MATRIX = { ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.11.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), - ('v1.12.0', + ('v1.12.1', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), - ('v1.13.1', + ('v1.13.2', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.14.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), - ('v1.15.0', + ('v1.15.1', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.16.1', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), - ('v1.17.1', + ('v1.17.2', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.18.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.19.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.20.0', ReleaseInfo(runtimes=['java_oracle8'])), - ('v1.21.0', ReleaseInfo(runtimes=['java_oracle8'])), + ('v1.21.1', ReleaseInfo(runtimes=['java_oracle8'])), + ('v1.22.2', ReleaseInfo(runtimes=['java_oracle8'])), + ('v1.23.0', ReleaseInfo(runtimes=['java_oracle8'])), ]), 'python': OrderedDict([ From 313b7c593ae050e9d900640525edc1a5a0d78977 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 13 Aug 2019 14:42:48 -0700 Subject: [PATCH 324/661] Backport #19924 to v1.23.x --- .../chttp2/transport/chttp2_transport.cc | 54 +++++++++++++------ .../transport/chttp2/transport/frame_ping.cc | 1 + .../chttp2/transport/frame_rst_stream.cc | 8 +++ .../chttp2/transport/frame_rst_stream.h | 7 +++ .../chttp2/transport/frame_settings.cc | 1 + .../chttp2/transport/hpack_parser.cc | 5 +- .../ext/transport/chttp2/transport/internal.h | 7 +++ .../ext/transport/chttp2/transport/parsing.cc | 14 +++-- .../ext/transport/chttp2/transport/writing.cc | 1 + 9 files changed, 71 insertions(+), 27 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 16146569886..8e81e0a5c2b 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -74,6 +74,8 @@ #define DEFAULT_MAX_PINGS_BETWEEN_DATA 2 #define DEFAULT_MAX_PING_STRIKES 2 +#define DEFAULT_MAX_PENDING_INDUCED_FRAMES 10000 + static int g_default_client_keepalive_time_ms = DEFAULT_CLIENT_KEEPALIVE_TIME_MS; static int g_default_client_keepalive_timeout_ms = @@ -105,6 +107,7 @@ static void write_action(void* t, grpc_error* error); static void write_action_end_locked(void* t, grpc_error* error); static void read_action_locked(void* t, grpc_error* error); +static void continue_read_action_locked(grpc_chttp2_transport* t); static void complete_fetch_locked(void* gs, grpc_error* error); /** Set a transport level setting, and push it to our peer */ @@ -797,10 +800,8 @@ grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t, !grpc_resource_user_safe_alloc(t->resource_user, GRPC_RESOURCE_QUOTA_CALL_SIZE)) { gpr_log(GPR_ERROR, "Memory exhausted, rejecting the stream."); - grpc_slice_buffer_add( - &t->qbuf, - grpc_chttp2_rst_stream_create( - id, static_cast(GRPC_HTTP2_REFUSED_STREAM), nullptr)); + grpc_chttp2_add_rst_stream_to_next_write(t, id, GRPC_HTTP2_REFUSED_STREAM, + nullptr); grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM); return nullptr; } @@ -1045,6 +1046,19 @@ static void write_action_begin_locked(void* gt, grpc_error* error_ignored) { GRPC_CLOSURE_SCHED( GRPC_CLOSURE_INIT(&t->write_action, write_action, t, scheduler), GRPC_ERROR_NONE); + if (t->reading_paused_on_pending_induced_frames) { + GPR_ASSERT(t->num_pending_induced_frames == 0); + /* We had paused reading, because we had many induced frames (SETTINGS + * ACK, PINGS ACK and RST_STREAMS) pending in t->qbuf. Now that we have + * been able to flush qbuf, we can resume reading. */ + GRPC_CHTTP2_IF_TRACING(gpr_log( + GPR_INFO, + "transport %p : Resuming reading after being paused due to too " + "many unwritten SETTINGS ACK, PINGS ACK and RST_STREAM frames", + t)); + t->reading_paused_on_pending_induced_frames = false; + continue_read_action_locked(t); + } } else { GRPC_STATS_INC_HTTP2_SPURIOUS_WRITES_BEGUN(); set_write_state(t, GRPC_CHTTP2_WRITE_STATE_IDLE, "begin writing nothing"); @@ -1114,7 +1128,6 @@ static void write_action_end_locked(void* tp, grpc_error* error) { } grpc_chttp2_end_write(t, GRPC_ERROR_REF(error)); - GRPC_CHTTP2_UNREF_TRANSPORT(t, "writing"); } @@ -2113,10 +2126,8 @@ void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s, grpc_http2_error_code http_error; grpc_error_get_status(due_to_error, s->deadline, nullptr, nullptr, &http_error, nullptr); - grpc_slice_buffer_add( - &t->qbuf, - grpc_chttp2_rst_stream_create( - s->id, static_cast(http_error), &s->stats.outgoing)); + grpc_chttp2_add_rst_stream_to_next_write( + t, s->id, static_cast(http_error), &s->stats.outgoing); grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM); } } @@ -2427,9 +2438,8 @@ static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s, grpc_slice_buffer_add(&t->qbuf, status_hdr); grpc_slice_buffer_add(&t->qbuf, message_pfx); grpc_slice_buffer_add(&t->qbuf, grpc_slice_ref_internal(slice)); - grpc_slice_buffer_add( - &t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_HTTP2_NO_ERROR, - &s->stats.outgoing)); + grpc_chttp2_add_rst_stream_to_next_write(t, s->id, GRPC_HTTP2_NO_ERROR, + &s->stats.outgoing); grpc_chttp2_mark_stream_closed(t, s, 1, 1, error); grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_CLOSE_FROM_API); @@ -2600,10 +2610,16 @@ static void read_action_locked(void* tp, grpc_error* error) { grpc_slice_buffer_reset_and_unref_internal(&t->read_buffer); if (keep_reading) { - const bool urgent = t->goaway_error != GRPC_ERROR_NONE; - grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent); - grpc_chttp2_act_on_flowctl_action(t->flow_control->MakeAction(), t, - nullptr); + if (t->num_pending_induced_frames >= DEFAULT_MAX_PENDING_INDUCED_FRAMES) { + t->reading_paused_on_pending_induced_frames = true; + GRPC_CHTTP2_IF_TRACING( + gpr_log(GPR_INFO, + "transport %p : Pausing reading due to too " + "many unwritten SETTINGS ACK and RST_STREAM frames", + t)); + } else { + continue_read_action_locked(t); + } GRPC_CHTTP2_UNREF_TRANSPORT(t, "keep_reading"); } else { GRPC_CHTTP2_UNREF_TRANSPORT(t, "reading_action"); @@ -2612,6 +2628,12 @@ static void read_action_locked(void* tp, grpc_error* error) { GRPC_ERROR_UNREF(error); } +static void continue_read_action_locked(grpc_chttp2_transport* t) { + const bool urgent = t->goaway_error != GRPC_ERROR_NONE; + grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent); + grpc_chttp2_act_on_flowctl_action(t->flow_control->MakeAction(), t, nullptr); +} + // t is reffed prior to calling the first time, and once the callback chain // that kicks off finishes, it's unreffed static void schedule_bdp_ping_locked(grpc_chttp2_transport* t) { diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.cc b/src/core/ext/transport/chttp2/transport/frame_ping.cc index 9a56bf093f4..87c92dffc38 100644 --- a/src/core/ext/transport/chttp2/transport/frame_ping.cc +++ b/src/core/ext/transport/chttp2/transport/frame_ping.cc @@ -118,6 +118,7 @@ grpc_error* grpc_chttp2_ping_parser_parse(void* parser, t->ping_acks = static_cast(gpr_realloc( t->ping_acks, t->ping_ack_capacity * sizeof(*t->ping_acks))); } + t->num_pending_induced_frames++; t->ping_acks[t->ping_ack_count++] = p->opaque_8bytes; grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_PING_RESPONSE); } diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc b/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc index cda09c3dea1..1350a967b9f 100644 --- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc @@ -58,6 +58,14 @@ grpc_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code, return slice; } +void grpc_chttp2_add_rst_stream_to_next_write( + grpc_chttp2_transport* t, uint32_t id, uint32_t code, + grpc_transport_one_way_stats* stats) { + t->num_pending_induced_frames++; + grpc_slice_buffer_add(&t->qbuf, + grpc_chttp2_rst_stream_create(id, code, stats)); +} + grpc_error* grpc_chttp2_rst_stream_parser_begin_frame( grpc_chttp2_rst_stream_parser* parser, uint32_t length, uint8_t flags) { if (length != 4) { diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h index 64707666181..d61e62394a4 100644 --- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h @@ -33,6 +33,13 @@ typedef struct { grpc_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code, grpc_transport_one_way_stats* stats); +// Adds RST_STREAM frame to t->qbuf (buffer for the next write). Should be +// called when we want to add RST_STREAM and we are not in +// write_action_begin_locked. +void grpc_chttp2_add_rst_stream_to_next_write( + grpc_chttp2_transport* t, uint32_t id, uint32_t code, + grpc_transport_one_way_stats* stats); + grpc_error* grpc_chttp2_rst_stream_parser_begin_frame( grpc_chttp2_rst_stream_parser* parser, uint32_t length, uint8_t flags); grpc_error* grpc_chttp2_rst_stream_parser_parse(void* parser, diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.cc b/src/core/ext/transport/chttp2/transport/frame_settings.cc index 3f84679ec31..ba57afa74b9 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.cc +++ b/src/core/ext/transport/chttp2/transport/frame_settings.cc @@ -132,6 +132,7 @@ grpc_error* grpc_chttp2_settings_parser_parse(void* p, grpc_chttp2_transport* t, if (is_last) { memcpy(parser->target_settings, parser->incoming_settings, GRPC_CHTTP2_NUM_SETTINGS * sizeof(uint32_t)); + t->num_pending_induced_frames++; grpc_slice_buffer_add(&t->qbuf, grpc_chttp2_settings_ack_create()); if (t->notify_on_receive_settings != nullptr) { GRPC_CLOSURE_SCHED(t->notify_on_receive_settings, diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc index 724c6c1bffc..22c0962cd49 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc @@ -1668,9 +1668,8 @@ static void force_client_rst_stream(void* sp, grpc_error* error) { grpc_chttp2_stream* s = static_cast(sp); grpc_chttp2_transport* t = s->t; if (!s->write_closed) { - grpc_slice_buffer_add( - &t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_HTTP2_NO_ERROR, - &s->stats.outgoing)); + grpc_chttp2_add_rst_stream_to_next_write(t, s->id, GRPC_HTTP2_NO_ERROR, + &s->stats.outgoing); grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_FORCE_RST_STREAM); grpc_chttp2_mark_stream_closed(t, s, true, true, GRPC_ERROR_NONE); } diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 643cd25b8bd..e6fc3b599e0 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -493,6 +493,13 @@ struct grpc_chttp2_transport { grpc_core::ContextList* cl = nullptr; grpc_core::RefCountedPtr channelz_socket; uint32_t num_messages_in_next_write = 0; + /** The number of pending induced frames (SETTINGS_ACK, PINGS_ACK and + * RST_STREAM) in the outgoing buffer (t->qbuf). If this number goes beyond + * DEFAULT_MAX_PENDING_INDUCED_FRAMES, we pause reading new frames. We would + * only continue reading when we are able to write to the socket again, + * thereby reducing the number of induced frames. */ + uint32_t num_pending_induced_frames = 0; + bool reading_paused_on_pending_induced_frames = false; }; typedef enum { diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc index 4e6ff60caf8..119a5941d38 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.cc +++ b/src/core/ext/transport/chttp2/transport/parsing.cc @@ -382,10 +382,9 @@ error_handler: if (s != nullptr) { grpc_chttp2_mark_stream_closed(t, s, true, false, err); } - grpc_slice_buffer_add( - &t->qbuf, grpc_chttp2_rst_stream_create(t->incoming_stream_id, - GRPC_HTTP2_PROTOCOL_ERROR, - &s->stats.outgoing)); + grpc_chttp2_add_rst_stream_to_next_write(t, t->incoming_stream_id, + GRPC_HTTP2_PROTOCOL_ERROR, + &s->stats.outgoing); return init_skip_frame_parser(t, 0); } else { return err; @@ -765,10 +764,9 @@ static grpc_error* parse_frame_slice(grpc_chttp2_transport* t, grpc_chttp2_parsing_become_skip_parser(t); if (s) { s->forced_close_error = err; - grpc_slice_buffer_add( - &t->qbuf, grpc_chttp2_rst_stream_create(t->incoming_stream_id, - GRPC_HTTP2_PROTOCOL_ERROR, - &s->stats.outgoing)); + grpc_chttp2_add_rst_stream_to_next_write(t, t->incoming_stream_id, + GRPC_HTTP2_PROTOCOL_ERROR, + &s->stats.outgoing); } else { GRPC_ERROR_UNREF(err); } diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc index f3cb390dc7a..d6d9e4521f6 100644 --- a/src/core/ext/transport/chttp2/transport/writing.cc +++ b/src/core/ext/transport/chttp2/transport/writing.cc @@ -219,6 +219,7 @@ class WriteContext { void FlushQueuedBuffers() { /* simple writes are queued to qbuf, and flushed here */ grpc_slice_buffer_move_into(&t_->qbuf, &t_->outbuf); + t_->num_pending_induced_frames = 0; GPR_ASSERT(t_->qbuf.count == 0); } From de6d4978e0aeffcc89127d587ed9f38da052ad11 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 13 Aug 2019 15:47:19 -0700 Subject: [PATCH 325/661] Merge test_objc_grpc_library into local_... with a testing BOOL flag --- .../grpc_objc_internal_library.bzl | 66 +++---------------- src/objective-c/tests/BUILD | 7 +- 2 files changed, 12 insertions(+), 61 deletions(-) diff --git a/src/objective-c/grpc_objc_internal_library.bzl b/src/objective-c/grpc_objc_internal_library.bzl index b043a0f6880..51206c1e903 100644 --- a/src/objective-c/grpc_objc_internal_library.bzl +++ b/src/objective-c/grpc_objc_internal_library.bzl @@ -73,7 +73,7 @@ def grpc_objc_testing_library( deps = deps + additional_deps, ) -def local_objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kwargs): +def local_objc_grpc_library(name, deps, testing = True, srcs = [], use_well_known_protos = False, **kwargs): """!!For local targets within the gRPC repository only!! Will not work outside of the repo """ objc_grpc_library_name = "_" + name + "_objc_grpc_library" @@ -104,55 +104,11 @@ def local_objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False ) arc_srcs = [":" + objc_grpc_library_name + "_srcs"] - native.objc_library( - name = name, - hdrs = [":" + objc_grpc_library_name + "_hdrs"], - non_arc_srcs = [":" + objc_grpc_library_name + "_non_arc_srcs"], - srcs = arc_srcs, - defines = [ - "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0", - "GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO=0", - ], - includes = [ - "_generated_protos", - "src/objective-c", - ], - deps = [ - "//src/objective-c:proto_objc_rpc", - "@com_google_protobuf//:protobuf_objc", - ], - ) - -def testing_objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kwargs): - """!!For testing within the gRPC repository only!! Will not work outside of the repo - """ - objc_grpc_library_name = "_" + name + "_objc_grpc_library" - - generate_objc( - name = objc_grpc_library_name, - srcs = srcs, - deps = deps, - use_well_known_protos = use_well_known_protos, - **kwargs - ) - - generate_objc_hdrs( - name = objc_grpc_library_name + "_hdrs", - src = ":" + objc_grpc_library_name, - ) - - generate_objc_non_arc_srcs( - name = objc_grpc_library_name + "_non_arc_srcs", - src = ":" + objc_grpc_library_name, - ) - - arc_srcs = None - if len(srcs) > 0: - generate_objc_srcs( - name = objc_grpc_library_name + "_srcs", - src = ":" + objc_grpc_library_name, - ) - arc_srcs = [":" + objc_grpc_library_name + "_srcs"] + library_deps = ["@com_google_protobuf//:protobuf_objc"] + if testing: + library_deps += ["//src/objective-c:grpc_objc_client_internal_testing"] + else: + library_deps += ["//src/objective-c:proto_objc_rpc"] native.objc_library( name = name, @@ -163,12 +119,6 @@ def testing_objc_grpc_library(name, deps, srcs = [], use_well_known_protos = Fal "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0", "GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO=0", ], - includes = [ - "_generated_protos", - "src/objective-c", - ], - deps = [ - "//src/objective-c:grpc_objc_client_internal_testing", - "@com_google_protobuf//:protobuf_objc", - ], + includes = ["_generated_protos"], + deps = library_deps, ) diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index 5d8042ca20a..80c12fba548 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -21,7 +21,7 @@ package(default_visibility = ["//visibility:private"]) load( "//src/objective-c:grpc_objc_internal_library.bzl", "grpc_objc_testing_library", - "testing_objc_grpc_library" + "local_objc_grpc_library" ) load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test") @@ -41,10 +41,11 @@ proto_library( deps = [":messages_proto"], ) -testing_objc_grpc_library( +local_objc_grpc_library( name = "RemoteTest", srcs = ["RemoteTestClient/test.proto"], use_well_known_protos = True, + testing = True, deps = [":test_proto"], ) @@ -232,4 +233,4 @@ tvos_unit_test( ":InteropTestsLocalCleartext-lib", ], test_host = ":tvos-host", -) \ No newline at end of file +) From 08422e7e9a118916bce0601986777ff1cffcba84 Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Tue, 13 Aug 2019 16:06:21 -0700 Subject: [PATCH 326/661] upload images --- tools/interop_matrix/client_matrix.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py index a0401898699..6bcac56f149 100644 --- a/tools/interop_matrix/client_matrix.py +++ b/tools/interop_matrix/client_matrix.py @@ -162,7 +162,7 @@ LANG_RELEASE_MATRIX = { ('v1.6.1', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.7.1', - ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), + ReleaseInfo(testcases_file='java__v1.0.3')), ('v1.8.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.9.1', @@ -172,25 +172,25 @@ LANG_RELEASE_MATRIX = { ('v1.11.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.12.1', - ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), + ReleaseInfo(testcases_file='java__v1.0.3')), ('v1.13.2', - ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), + ReleaseInfo(testcases_file='java__v1.0.3')), ('v1.14.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.15.1', - ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), + ReleaseInfo(testcases_file='java__v1.0.3')), ('v1.16.1', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.17.2', - ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), + ReleaseInfo(testcases_file='java__v1.0.3')), ('v1.18.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.19.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.20.0', ReleaseInfo(runtimes=['java_oracle8'])), - ('v1.21.1', ReleaseInfo(runtimes=['java_oracle8'])), - ('v1.22.2', ReleaseInfo(runtimes=['java_oracle8'])), - ('v1.23.0', ReleaseInfo(runtimes=['java_oracle8'])), + ('v1.21.1', ReleaseInfo()), + ('v1.22.2', ReleaseInfo()), + ('v1.23.0', ReleaseInfo()), ]), 'python': OrderedDict([ From 40584c792255e88a99607808cbd2e159eb11368f Mon Sep 17 00:00:00 2001 From: "Penn (Dapeng) Zhang" Date: Tue, 13 Aug 2019 16:53:29 -0700 Subject: [PATCH 327/661] fix format --- tools/interop_matrix/client_matrix.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py index 6bcac56f149..4c21b7aafce 100644 --- a/tools/interop_matrix/client_matrix.py +++ b/tools/interop_matrix/client_matrix.py @@ -161,8 +161,7 @@ LANG_RELEASE_MATRIX = { ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.6.1', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), - ('v1.7.1', - ReleaseInfo(testcases_file='java__v1.0.3')), + ('v1.7.1', ReleaseInfo(testcases_file='java__v1.0.3')), ('v1.8.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.9.1', @@ -171,18 +170,14 @@ LANG_RELEASE_MATRIX = { ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.11.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), - ('v1.12.1', - ReleaseInfo(testcases_file='java__v1.0.3')), - ('v1.13.2', - ReleaseInfo(testcases_file='java__v1.0.3')), + ('v1.12.1', ReleaseInfo(testcases_file='java__v1.0.3')), + ('v1.13.2', ReleaseInfo(testcases_file='java__v1.0.3')), ('v1.14.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), - ('v1.15.1', - ReleaseInfo(testcases_file='java__v1.0.3')), + ('v1.15.1', ReleaseInfo(testcases_file='java__v1.0.3')), ('v1.16.1', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), - ('v1.17.2', - ReleaseInfo(testcases_file='java__v1.0.3')), + ('v1.17.2', ReleaseInfo(testcases_file='java__v1.0.3')), ('v1.18.0', ReleaseInfo(runtimes=['java_oracle8'], testcases_file='java__v1.0.3')), ('v1.19.0', From d33d30a595ddbe84f41fa8e3ef9755678f4cf8d5 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Wed, 14 Aug 2019 09:20:57 +0800 Subject: [PATCH 328/661] update notes --- examples/python/easy_start_demo/PyClient.py | 6 +++--- examples/python/easy_start_demo/PyServer.py | 6 +++--- examples/python/easy_start_demo/README.md | 6 +++--- examples/python/easy_start_demo/demo.proto | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/python/easy_start_demo/PyClient.py b/examples/python/easy_start_demo/PyClient.py index 257c817e06f..383cdb5afed 100644 --- a/examples/python/easy_start_demo/PyClient.py +++ b/examples/python/easy_start_demo/PyClient.py @@ -15,7 +15,7 @@ ClientId = 1 # 简单模式 -# Unary +# Simple def simple_method(stub): print("--------------Call SimpleMethod Begin--------------") req = demo_pb2.Request(Cid=ClientId, ReqMsg="called by Python client") @@ -25,7 +25,7 @@ def simple_method(stub): # 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) -# Client Streaming (In a single call, the client can transfer data to the server several times, +# Request-streaming (In a single call, the client can transfer data to the server several times, # but the server can only return a response once.) def c_stream_method(stub): print("--------------Call CStreamMethod Begin--------------") @@ -43,7 +43,7 @@ def c_stream_method(stub): # 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) -# Server Streaming (In a single call, the client can only transmit data to the server at one time, +# Response-streaming (In a single call, the client can only transmit data to the server at one time, # but the server can return the response many times.) def s_stream_method(stub): print("--------------Call SStreamMethod Begin--------------") diff --git a/examples/python/easy_start_demo/PyServer.py b/examples/python/easy_start_demo/PyServer.py index a814205d0d1..cfef6bf516a 100644 --- a/examples/python/easy_start_demo/PyServer.py +++ b/examples/python/easy_start_demo/PyServer.py @@ -20,14 +20,14 @@ ServerId = 1 class DemoServer(demo_pb2_grpc.GRPCDemoServicer): # 简单模式 - # Unary + # Simple def SimpleMethod(self, request, context): print(f"SimpleMethod called by client({request.Cid}) the message: {request.ReqMsg}") resp = demo_pb2.Response(Sid=ServerId, RespMsg="Python server SimpleMethod Ok!!!!") return resp # 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) - # Client Streaming (In a single call, the client can transfer data to the server several times, + # Request-streaming (In a single call, the client can transfer data to the server several times, # but the server can only return a response once.) def CStreamMethod(self, request_iterator, context): print("CStreamMethod called by client...") @@ -37,7 +37,7 @@ class DemoServer(demo_pb2_grpc.GRPCDemoServicer): return resp # 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) - # Server Streaming (In a single call, the client can only transmit data to the server at one time, + # Response-streaming (In a single call, the client can only transmit data to the server at one time, # but the server can return the response many times.) def SStreamMethod(self, request, context): print(f"SStreamMethod called by client({request.Cid}), message={request.ReqMsg}") diff --git a/examples/python/easy_start_demo/README.md b/examples/python/easy_start_demo/README.md index 2bb9059bc90..5b8ee8c5b3e 100644 --- a/examples/python/easy_start_demo/README.md +++ b/examples/python/easy_start_demo/README.md @@ -2,18 +2,18 @@ ###主要是介绍了在Python中使用GRPC时, 进行数据传输的四种方式。 ###This paper mainly introduces four ways of data transmission when GRPC is used in Python. -- ####简单模式 (Unary) +- ####简单模式 (Simple) ```text 没啥好说的,跟调普通方法没差 There's nothing to say. It's no different from the usual way. ``` -- ####客户端流模式 (Client Streaming) +- ####客户端流模式 (Request-streaming) ```text 在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应. In a single call, the client can transfer data to the server several times, but the server can only return a response once. ``` -- ####服务端流模式 (Server Streaming) +- ####服务端流模式 (Response-streaming) ```text 在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应 In a single call, the client can only transmit data to the server at one time, diff --git a/examples/python/easy_start_demo/demo.proto b/examples/python/easy_start_demo/demo.proto index 4fb76bce752..a9506cf92a1 100644 --- a/examples/python/easy_start_demo/demo.proto +++ b/examples/python/easy_start_demo/demo.proto @@ -30,21 +30,21 @@ message Response { // `service` is used to define methods for GRPC services in a fixed format, similar to defining an interface in Golang service GRPCDemo { // 简单模式 - // Unary + // Simple rpc SimpleMethod (Request) returns (Response); // 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) - // Client Streaming (In a single call, the client can transfer data to the server several times, + // Request-streaming (In a single call, the client can transfer data to the server several times, // but the server can only return a response once.) rpc CStreamMethod (stream Request) returns (Response); // 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) - // Server Streaming (In a single call, the client can only transmit data to the server at one time, + // Response-streaming (In a single call, the client can only transmit data to the server at one time, // but the server can return the response many times.) rpc SStreamMethod (Request) returns (stream Response); // 双向流模式 (在一次调用中, 客户端和服务器都可以向对方多次收发数据) - // Bidirectional Streaming (In a single call, both client and server can send and receive data + // Bidirectional streaming (In a single call, both client and server can send and receive data // to each other multiple times.) rpc TWFMethod (stream Request) returns (stream Response); } From 6eb8adf91d05ee19592fc12b8a9e2da8f4c90628 Mon Sep 17 00:00:00 2001 From: Doug Fawley Date: Wed, 14 Aug 2019 09:16:35 -0700 Subject: [PATCH 329/661] Add v1.21.3 and v1.22.2 releases of grpc-go to interop matrix --- tools/interop_matrix/client_matrix.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py index 51a47d92f97..1d15de1fdf1 100644 --- a/tools/interop_matrix/client_matrix.py +++ b/tools/interop_matrix/client_matrix.py @@ -142,8 +142,8 @@ LANG_RELEASE_MATRIX = { ('v1.19.0', ReleaseInfo(runtimes=['go1.11'], testcases_file='go__v1.0.5')), ('v1.20.0', ReleaseInfo(runtimes=['go1.11'])), - ('v1.21.2', ReleaseInfo(runtimes=['go1.11'])), - ('v1.22.1', ReleaseInfo(runtimes=['go1.11'])), + ('v1.21.3', ReleaseInfo(runtimes=['go1.11'])), + ('v1.22.2', ReleaseInfo(runtimes=['go1.11'])), ]), 'java': OrderedDict([ From 15f8ae71ddbc60330069d642beda63150c051cae Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 14 Aug 2019 09:30:26 -0700 Subject: [PATCH 330/661] Change cc to c++ --- CMakeLists.txt | 178 ++++++------- Makefile | 235 ++++++++++-------- build.yaml | 44 ++-- .../generated/sources_and_headers.json | 78 +++--- 4 files changed, 287 insertions(+), 248 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 678ad9bdbb9..8e1cdd3fc5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -238,13 +238,13 @@ add_custom_target(tools_c grpc_create_jwt grpc_print_google_default_creds_token grpc_verify_jwt - gen_hpack_tables - gen_legal_metadata_characters - gen_percent_encoding_tables ) add_custom_target(tools_cxx DEPENDS + gen_hpack_tables + gen_legal_metadata_characters + gen_percent_encoding_tables ) add_custom_target(tools @@ -14046,6 +14046,95 @@ target_link_libraries(filter_end2end_test endif (gRPC_BUILD_TESTS) + +add_executable(gen_hpack_tables + tools/codegen/core/gen_hpack_tables.cc +) + + +target_include_directories(gen_hpack_tables + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} + PRIVATE ${_gRPC_CARES_INCLUDE_DIR} + PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} + PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(gen_hpack_tables + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + gpr + grpc +) + + + +add_executable(gen_legal_metadata_characters + tools/codegen/core/gen_legal_metadata_characters.cc +) + + +target_include_directories(gen_legal_metadata_characters + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} + PRIVATE ${_gRPC_CARES_INCLUDE_DIR} + PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} + PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(gen_legal_metadata_characters + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} +) + + + +add_executable(gen_percent_encoding_tables + tools/codegen/core/gen_percent_encoding_tables.cc +) + + +target_include_directories(gen_percent_encoding_tables + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} + PRIVATE ${_gRPC_CARES_INCLUDE_DIR} + PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} + PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(gen_percent_encoding_tables + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} +) + + if (gRPC_BUILD_TESTS) add_executable(generic_end2end_test @@ -17803,89 +17892,6 @@ target_link_libraries(public_headers_must_be_c89 endif (gRPC_BUILD_TESTS) - -add_executable(gen_hpack_tables - tools/codegen/core/gen_hpack_tables.cc -) - - -target_include_directories(gen_hpack_tables - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} - PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} - PRIVATE ${_gRPC_CARES_INCLUDE_DIR} - PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_UPB_GENERATED_DIR} - PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} - PRIVATE ${_gRPC_UPB_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} -) - -target_link_libraries(gen_hpack_tables - ${_gRPC_ALLTARGETS_LIBRARIES} - gpr - grpc -) - - - -add_executable(gen_legal_metadata_characters - tools/codegen/core/gen_legal_metadata_characters.cc -) - - -target_include_directories(gen_legal_metadata_characters - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} - PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} - PRIVATE ${_gRPC_CARES_INCLUDE_DIR} - PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_UPB_GENERATED_DIR} - PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} - PRIVATE ${_gRPC_UPB_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} -) - -target_link_libraries(gen_legal_metadata_characters - ${_gRPC_ALLTARGETS_LIBRARIES} -) - - - -add_executable(gen_percent_encoding_tables - tools/codegen/core/gen_percent_encoding_tables.cc -) - - -target_include_directories(gen_percent_encoding_tables - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} - PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} - PRIVATE ${_gRPC_CARES_INCLUDE_DIR} - PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_UPB_GENERATED_DIR} - PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} - PRIVATE ${_gRPC_UPB_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} -) - -target_link_libraries(gen_percent_encoding_tables - ${_gRPC_ALLTARGETS_LIBRARIES} -) - - if (gRPC_BUILD_TESTS) add_executable(bad_streaming_id_bad_client_test diff --git a/Makefile b/Makefile index 66c4f4489ed..8080efcc41a 100644 --- a/Makefile +++ b/Makefile @@ -1206,6 +1206,9 @@ end2end_test: $(BINDIR)/$(CONFIG)/end2end_test error_details_test: $(BINDIR)/$(CONFIG)/error_details_test exception_test: $(BINDIR)/$(CONFIG)/exception_test filter_end2end_test: $(BINDIR)/$(CONFIG)/filter_end2end_test +gen_hpack_tables: $(BINDIR)/$(CONFIG)/gen_hpack_tables +gen_legal_metadata_characters: $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters +gen_percent_encoding_tables: $(BINDIR)/$(CONFIG)/gen_percent_encoding_tables generic_end2end_test: $(BINDIR)/$(CONFIG)/generic_end2end_test global_config_env_test: $(BINDIR)/$(CONFIG)/global_config_env_test global_config_test: $(BINDIR)/$(CONFIG)/global_config_test @@ -1289,9 +1292,6 @@ transport_security_common_api_test: $(BINDIR)/$(CONFIG)/transport_security_commo writes_per_rpc_test: $(BINDIR)/$(CONFIG)/writes_per_rpc_test xds_end2end_test: $(BINDIR)/$(CONFIG)/xds_end2end_test public_headers_must_be_c89: $(BINDIR)/$(CONFIG)/public_headers_must_be_c89 -gen_hpack_tables: $(BINDIR)/$(CONFIG)/gen_hpack_tables -gen_legal_metadata_characters: $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters -gen_percent_encoding_tables: $(BINDIR)/$(CONFIG)/gen_percent_encoding_tables boringssl_ssl_test: $(BINDIR)/$(CONFIG)/boringssl_ssl_test boringssl_crypto_test: $(BINDIR)/$(CONFIG)/boringssl_crypto_test bad_streaming_id_bad_client_test: $(BINDIR)/$(CONFIG)/bad_streaming_id_bad_client_test @@ -2530,9 +2530,9 @@ test_python: static_c tools: tools_c tools_cxx -tools_c: privatelibs_c $(BINDIR)/$(CONFIG)/check_epollexclusive $(BINDIR)/$(CONFIG)/grpc_create_jwt $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token $(BINDIR)/$(CONFIG)/grpc_verify_jwt $(BINDIR)/$(CONFIG)/gen_hpack_tables $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters $(BINDIR)/$(CONFIG)/gen_percent_encoding_tables +tools_c: privatelibs_c $(BINDIR)/$(CONFIG)/check_epollexclusive $(BINDIR)/$(CONFIG)/grpc_create_jwt $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token $(BINDIR)/$(CONFIG)/grpc_verify_jwt -tools_cxx: privatelibs_cxx +tools_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/gen_hpack_tables $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters $(BINDIR)/$(CONFIG)/gen_percent_encoding_tables buildbenchmarks: privatelibs $(BINDIR)/$(CONFIG)/low_level_ping_pong_benchmark @@ -16341,6 +16341,135 @@ endif endif +GEN_HPACK_TABLES_SRC = \ + tools/codegen/core/gen_hpack_tables.cc \ + +GEN_HPACK_TABLES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GEN_HPACK_TABLES_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/gen_hpack_tables: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+. + +$(BINDIR)/$(CONFIG)/gen_hpack_tables: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/gen_hpack_tables: $(PROTOBUF_DEP) $(GEN_HPACK_TABLES_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(GEN_HPACK_TABLES_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_hpack_tables + +endif + +endif + +$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_hpack_tables.o: $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a + +deps_gen_hpack_tables: $(GEN_HPACK_TABLES_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(GEN_HPACK_TABLES_OBJS:.o=.dep) +endif +endif + + +GEN_LEGAL_METADATA_CHARACTERS_SRC = \ + tools/codegen/core/gen_legal_metadata_characters.cc \ + +GEN_LEGAL_METADATA_CHARACTERS_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GEN_LEGAL_METADATA_CHARACTERS_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+. + +$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: $(PROTOBUF_DEP) $(GEN_LEGAL_METADATA_CHARACTERS_OBJS) + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(GEN_LEGAL_METADATA_CHARACTERS_OBJS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters + +endif + +endif + +$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_legal_metadata_characters.o: + +deps_gen_legal_metadata_characters: $(GEN_LEGAL_METADATA_CHARACTERS_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(GEN_LEGAL_METADATA_CHARACTERS_OBJS:.o=.dep) +endif +endif + + +GEN_PERCENT_ENCODING_TABLES_SRC = \ + tools/codegen/core/gen_percent_encoding_tables.cc \ + +GEN_PERCENT_ENCODING_TABLES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GEN_PERCENT_ENCODING_TABLES_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/gen_percent_encoding_tables: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+. + +$(BINDIR)/$(CONFIG)/gen_percent_encoding_tables: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/gen_percent_encoding_tables: $(PROTOBUF_DEP) $(GEN_PERCENT_ENCODING_TABLES_OBJS) + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(GEN_PERCENT_ENCODING_TABLES_OBJS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_percent_encoding_tables + +endif + +endif + +$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_percent_encoding_tables.o: + +deps_gen_percent_encoding_tables: $(GEN_PERCENT_ENCODING_TABLES_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(GEN_PERCENT_ENCODING_TABLES_OBJS:.o=.dep) +endif +endif + + GENERIC_END2END_TEST_SRC = \ test/cpp/end2end/generic_end2end_test.cc \ @@ -19893,102 +20022,6 @@ endif endif -GEN_HPACK_TABLES_SRC = \ - tools/codegen/core/gen_hpack_tables.cc \ - -GEN_HPACK_TABLES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GEN_HPACK_TABLES_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/gen_hpack_tables: openssl_dep_error - -else - - - -$(BINDIR)/$(CONFIG)/gen_hpack_tables: $(GEN_HPACK_TABLES_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GEN_HPACK_TABLES_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_hpack_tables - -endif - -$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_hpack_tables.o: $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a - -deps_gen_hpack_tables: $(GEN_HPACK_TABLES_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(GEN_HPACK_TABLES_OBJS:.o=.dep) -endif -endif - - -GEN_LEGAL_METADATA_CHARACTERS_SRC = \ - tools/codegen/core/gen_legal_metadata_characters.cc \ - -GEN_LEGAL_METADATA_CHARACTERS_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GEN_LEGAL_METADATA_CHARACTERS_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: openssl_dep_error - -else - - - -$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: $(GEN_LEGAL_METADATA_CHARACTERS_OBJS) - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GEN_LEGAL_METADATA_CHARACTERS_OBJS) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters - -endif - -$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_legal_metadata_characters.o: - -deps_gen_legal_metadata_characters: $(GEN_LEGAL_METADATA_CHARACTERS_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(GEN_LEGAL_METADATA_CHARACTERS_OBJS:.o=.dep) -endif -endif - - -GEN_PERCENT_ENCODING_TABLES_SRC = \ - tools/codegen/core/gen_percent_encoding_tables.cc \ - -GEN_PERCENT_ENCODING_TABLES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GEN_PERCENT_ENCODING_TABLES_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/gen_percent_encoding_tables: openssl_dep_error - -else - - - -$(BINDIR)/$(CONFIG)/gen_percent_encoding_tables: $(GEN_PERCENT_ENCODING_TABLES_OBJS) - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GEN_PERCENT_ENCODING_TABLES_OBJS) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_percent_encoding_tables - -endif - -$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_percent_encoding_tables.o: - -deps_gen_percent_encoding_tables: $(GEN_PERCENT_ENCODING_TABLES_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(GEN_PERCENT_ENCODING_TABLES_OBJS:.o=.dep) -endif -endif - - BORINGSSL_SSL_TEST_SRC = \ third_party/boringssl/crypto/test/gtest_main.cc \ third_party/boringssl/ssl/span_test.cc \ diff --git a/build.yaml b/build.yaml index c7f638495f8..e63f375bd8a 100644 --- a/build.yaml +++ b/build.yaml @@ -4953,6 +4953,28 @@ targets: - grpc++ - grpc - gpr +- name: gen_hpack_tables + build: tool + language: c++ + src: + - tools/codegen/core/gen_hpack_tables.cc + deps: + - gpr + - grpc + uses_polling: false +- name: gen_legal_metadata_characters + build: tool + language: c++ + src: + - tools/codegen/core/gen_legal_metadata_characters.cc + deps: [] +- name: gen_percent_encoding_tables + build: tool + language: c++ + src: + - tools/codegen/core/gen_percent_encoding_tables.cc + deps: [] + uses_polling: false - name: generic_end2end_test gtest: true build: test @@ -6056,28 +6078,6 @@ targets: deps: - grpc - gpr -- name: gen_hpack_tables - build: tool - language: cc - src: - - tools/codegen/core/gen_hpack_tables.cc - deps: - - gpr - - grpc - uses_polling: false -- name: gen_legal_metadata_characters - build: tool - language: cc - src: - - tools/codegen/core/gen_legal_metadata_characters.cc - deps: [] -- name: gen_percent_encoding_tables - build: tool - language: cc - src: - - tools/codegen/core/gen_percent_encoding_tables.cc - deps: [] - uses_polling: false vspackages: - linkage: static name: grpc.dependencies.zlib diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index b54404bbd0d..eeb66a585ee 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -3765,6 +3765,45 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "gpr", + "grpc" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "gen_hpack_tables", + "src": [ + "tools/codegen/core/gen_hpack_tables.cc" + ], + "third_party": false, + "type": "target" + }, + { + "deps": [], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "gen_legal_metadata_characters", + "src": [ + "tools/codegen/core/gen_legal_metadata_characters.cc" + ], + "third_party": false, + "type": "target" + }, + { + "deps": [], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "gen_percent_encoding_tables", + "src": [ + "tools/codegen/core/gen_percent_encoding_tables.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", @@ -5357,45 +5396,6 @@ "third_party": false, "type": "target" }, - { - "deps": [ - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "cc", - "name": "gen_hpack_tables", - "src": [ - "tools/codegen/core/gen_hpack_tables.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [], - "headers": [], - "is_filegroup": false, - "language": "cc", - "name": "gen_legal_metadata_characters", - "src": [ - "tools/codegen/core/gen_legal_metadata_characters.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [], - "headers": [], - "is_filegroup": false, - "language": "cc", - "name": "gen_percent_encoding_tables", - "src": [ - "tools/codegen/core/gen_percent_encoding_tables.cc" - ], - "third_party": false, - "type": "target" - }, { "deps": [ "boringssl", From c8dc36bb477573bb4f3dd5140153502a067463e1 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Tue, 13 Aug 2019 16:10:37 -0700 Subject: [PATCH 331/661] Change xds args to const --- .../client_channel/lb_policy/xds/xds.cc | 19 +++++++++---------- src/core/lib/channel/channel_args.cc | 19 +++++++++++++++++++ src/core/lib/channel/channel_args.h | 18 ++++++++++++++++-- 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 468c9d84591..85d1b012696 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -575,7 +575,7 @@ class XdsLb : public LoadBalancingPolicy { OrphanablePtr pending_lb_chand_; // Timeout in milliseconds for the LB call. 0 means no deadline. - int lb_call_timeout_ms_ = 0; + const grpc_millis lb_call_timeout_ms_; // Whether the checks for fallback at startup are ALL pending. There are // several cases where this can be reset: @@ -587,7 +587,7 @@ class XdsLb : public LoadBalancingPolicy { bool fallback_at_startup_checks_pending_ = false; // Timeout in milliseconds for before using fallback backend addresses. // 0 means not using fallback. - int lb_fallback_timeout_ms_ = 0; + const grpc_millis lb_fallback_timeout_ms_; // The backend addresses from the resolver. ServerAddressList fallback_backend_addresses_; // Fallback timer. @@ -1705,7 +1705,13 @@ grpc_channel_args* BuildBalancerChannelArgs(const grpc_channel_args* args) { // XdsLb::XdsLb(Args args) - : LoadBalancingPolicy(std::move(args)), locality_map_(this) { + : LoadBalancingPolicy(std::move(args)), + lb_call_timeout_ms_(grpc_channel_args_find_integer( + args.args, GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS, {0, 0, INT_MAX})), + lb_fallback_timeout_ms_(grpc_channel_args_find_integer( + args.args, GRPC_ARG_XDS_FALLBACK_TIMEOUT_MS, + {GRPC_XDS_DEFAULT_FALLBACK_TIMEOUT_MS, 0, INT_MAX})), + locality_map_(this) { // Record server name. const grpc_arg* arg = grpc_channel_args_find(args.args, GRPC_ARG_SERVER_URI); const char* server_uri = grpc_channel_arg_get_string(arg); @@ -1719,13 +1725,6 @@ XdsLb::XdsLb(Args args) server_name_); } grpc_uri_destroy(uri); - // Record LB call timeout. - arg = grpc_channel_args_find(args.args, GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS); - lb_call_timeout_ms_ = grpc_channel_arg_get_integer(arg, {0, 0, INT_MAX}); - // Record fallback timeout. - arg = grpc_channel_args_find(args.args, GRPC_ARG_XDS_FALLBACK_TIMEOUT_MS); - lb_fallback_timeout_ms_ = grpc_channel_arg_get_integer( - arg, {GRPC_XDS_DEFAULT_FALLBACK_TIMEOUT_MS, 0, INT_MAX}); } XdsLb::~XdsLb() { diff --git a/src/core/lib/channel/channel_args.cc b/src/core/lib/channel/channel_args.cc index b629ac0e107..60248f9d8fc 100644 --- a/src/core/lib/channel/channel_args.cc +++ b/src/core/lib/channel/channel_args.cc @@ -257,6 +257,13 @@ int grpc_channel_arg_get_integer(const grpc_arg* arg, return arg->value.integer; } +int grpc_channel_args_find_integer(const grpc_channel_args* args, + const char* name, + const grpc_integer_options options) { + const grpc_arg* arg = grpc_channel_args_find(args, name); + return grpc_channel_arg_get_integer(arg, options); +} + char* grpc_channel_arg_get_string(const grpc_arg* arg) { if (arg == nullptr) return nullptr; if (arg->type != GRPC_ARG_STRING) { @@ -266,6 +273,12 @@ char* grpc_channel_arg_get_string(const grpc_arg* arg) { return arg->value.string; } +char* grpc_channel_args_find_string(const grpc_channel_args* args, + const char* name) { + const grpc_arg* arg = grpc_channel_args_find(args, name); + return grpc_channel_arg_get_string(arg); +} + bool grpc_channel_arg_get_bool(const grpc_arg* arg, bool default_value) { if (arg == nullptr) return default_value; if (arg->type != GRPC_ARG_INTEGER) { @@ -284,6 +297,12 @@ bool grpc_channel_arg_get_bool(const grpc_arg* arg, bool default_value) { } } +bool grpc_channel_args_find_bool(const grpc_channel_args* args, + const char* name, bool default_value) { + const grpc_arg* arg = grpc_channel_args_find(args, name); + return grpc_channel_arg_get_bool(arg, default_value); +} + bool grpc_channel_args_want_minimal_stack(const grpc_channel_args* args) { return grpc_channel_arg_get_bool( grpc_channel_args_find(args, GRPC_ARG_MINIMAL_STACK), false); diff --git a/src/core/lib/channel/channel_args.h b/src/core/lib/channel/channel_args.h index 2b698a66cfb..5928802f288 100644 --- a/src/core/lib/channel/channel_args.h +++ b/src/core/lib/channel/channel_args.h @@ -73,16 +73,30 @@ typedef struct grpc_integer_options { int max_value; } grpc_integer_options; -/** Returns the value of \a arg, subject to the contraints in \a options. */ +/** Returns the value of \a arg, subject to the constraints in \a options. */ int grpc_channel_arg_get_integer(const grpc_arg* arg, const grpc_integer_options options); +/** Similar to the above, but needs to find the arg from \a args by the name + * first. */ +int grpc_channel_args_find_integer(const grpc_channel_args* args, + const char* name, + const grpc_integer_options options); /** Returns the value of \a arg if \a arg is of type GRPC_ARG_STRING. Otherwise, emits a warning log, and returns nullptr. If arg is nullptr, returns nullptr, and does not emit a warning. */ char* grpc_channel_arg_get_string(const grpc_arg* arg); - +/** Similar to the above, but needs to find the arg from \a args by the name + * first. */ +char* grpc_channel_args_find_string(const grpc_channel_args* args, + const char* name); +/** If \a arg is of type GRPC_ARG_INTEGER, returns true if it's non-zero. + * Returns \a default_value if \a arg is of other types. */ bool grpc_channel_arg_get_bool(const grpc_arg* arg, bool default_value); +/** Similar to the above, but needs to find the arg from \a args by the name + * first. */ +bool grpc_channel_args_find_bool(const grpc_channel_args* args, + const char* name, bool default_value); // Helpers for creating channel args. grpc_arg grpc_channel_arg_string_create(char* name, char* value); From 03ec155a22fe0177f58d59efd50e8440824b2559 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Wed, 14 Aug 2019 10:26:22 -0700 Subject: [PATCH 332/661] Bump version to v1.23.0 --- BUILD | 2 +- build.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILD b/BUILD index c708318ecbf..6607963fd3e 100644 --- a/BUILD +++ b/BUILD @@ -78,7 +78,7 @@ g_stands_for = "gangnam" core_version = "7.0.0" -version = "1.23.0-pre1" +version = "1.23.0" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/build.yaml b/build.yaml index 1ba055c65dd..bf64faad540 100644 --- a/build.yaml +++ b/build.yaml @@ -15,7 +15,7 @@ settings: core_version: 7.0.0 csharp_major_version: 2 g_stands_for: gangnam - version: 1.23.0-pre1 + version: 1.23.0 filegroups: - name: alts_proto headers: From 136d3daf53adb7e4b41e0d1e2174665694948c13 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Wed, 14 Aug 2019 10:27:19 -0700 Subject: [PATCH 333/661] Regenerate projects --- CMakeLists.txt | 2 +- Makefile | 4 ++-- gRPC-C++.podspec | 6 +++--- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.xml | 8 ++++---- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core.Api/VersionInfo.cs | 2 +- src/csharp/build/dependencies.props | 2 +- src/csharp/build_unitypackage.bat | 2 +- src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/objective-c/tests/version.h | 2 +- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_channelz/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_status/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 30 files changed, 36 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a5b4b5cd8a..5ee805b4852 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 3.5.1) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.23.0-pre1") +set(PACKAGE_VERSION "1.23.0") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index d4d82581cef..2d8b2d64e52 100644 --- a/Makefile +++ b/Makefile @@ -461,8 +461,8 @@ Q = @ endif CORE_VERSION = 7.0.0 -CPP_VERSION = 1.23.0-pre1 -CSHARP_VERSION = 2.23.0-pre1 +CPP_VERSION = 1.23.0 +CSHARP_VERSION = 2.23.0 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 304ae372101..340783d2674 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -23,15 +23,15 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - # version = '1.23.0-pre1' - version = '0.0.9-pre1' + # version = '1.23.0' + version = '0.0.9' s.version = version s.summary = 'gRPC C++ library' s.homepage = 'https://grpc.io' s.license = 'Apache License, Version 2.0' s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - grpc_version = '1.23.0-pre1' + grpc_version = '1.23.0' s.source = { :git => 'https://github.com/grpc/grpc.git', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index d3a82b572dc..ab6738339b2 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.23.0-pre1' + version = '1.23.0' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index c90445baae2..363d600f73c 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.23.0-pre1' + version = '1.23.0' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 87bd9e7c481..f348874284a 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.23.0-pre1' + version = '1.23.0' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index dc05dc86ba2..aa81a45d5f3 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.23.0-pre1' + version = '1.23.0' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.xml b/package.xml index 7d2cb708925..22869666b78 100644 --- a/package.xml +++ b/package.xml @@ -13,12 +13,12 @@ 2018-01-19 - 1.23.0RC1 - 1.23.0RC1 + 1.23.0 + 1.23.0 - beta - beta + stable + stable Apache 2.0 diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 751cbfa1c22..8427f517b99 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.23.0-pre1"; } +grpc::string Version() { return "1.23.0"; } } // namespace grpc diff --git a/src/csharp/Grpc.Core.Api/VersionInfo.cs b/src/csharp/Grpc.Core.Api/VersionInfo.cs index ca9e88f268d..835bc3c9860 100644 --- a/src/csharp/Grpc.Core.Api/VersionInfo.cs +++ b/src/csharp/Grpc.Core.Api/VersionInfo.cs @@ -38,6 +38,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "2.23.0-pre1"; + public const string CurrentVersion = "2.23.0"; } } diff --git a/src/csharp/build/dependencies.props b/src/csharp/build/dependencies.props index 00ff3ccb780..28a0ef6e8a1 100644 --- a/src/csharp/build/dependencies.props +++ b/src/csharp/build/dependencies.props @@ -1,7 +1,7 @@ - 2.23.0-pre1 + 2.23.0 3.8.0 diff --git a/src/csharp/build_unitypackage.bat b/src/csharp/build_unitypackage.bat index 1906f266e20..dc9bcf4c8bb 100644 --- a/src/csharp/build_unitypackage.bat +++ b/src/csharp/build_unitypackage.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=2.23.0-pre1 +set VERSION=2.23.0 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec index 6dc9d4a3f13..730abd861cb 100644 --- a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCCppPlugin' - v = '1.23.0-pre1' + v = '1.23.0' s.version = v s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 98b4ef0dc12..86d2d2d4018 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.23.0-pre1' + v = '1.23.0' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index bf467558d31..29c669e2648 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.23.0-pre1" +#define GRPC_OBJC_VERSION_STRING @"1.23.0" diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index f5d7ec747af..43998fc84ea 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -22,5 +22,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.23.0-pre1" +#define GRPC_OBJC_VERSION_STRING @"1.23.0" #define GRPC_C_VERSION_STRING @"7.0.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 038ca5c1b25..119d554177c 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.23.0RC1" +#define PHP_GRPC_VERSION "1.23.0" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index d8f04ec88f3..dd1e72ed2cc 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.23.0rc1""" +__version__ = """1.23.0""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 2215172be39..9139a633d1e 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.23.0rc1' +VERSION = '1.23.0' diff --git a/src/python/grpcio_channelz/grpc_version.py b/src/python/grpcio_channelz/grpc_version.py index d7b9e92800b..1fbb2c7a889 100644 --- a/src/python/grpcio_channelz/grpc_version.py +++ b/src/python/grpcio_channelz/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/grpc_version.py.template`!!! -VERSION = '1.23.0rc1' +VERSION = '1.23.0' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 04a5cd79401..91530bc84b0 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.23.0rc1' +VERSION = '1.23.0' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 8f47ca23c9b..9c2e33224cc 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.23.0rc1' +VERSION = '1.23.0' diff --git a/src/python/grpcio_status/grpc_version.py b/src/python/grpcio_status/grpc_version.py index 42aad42fa57..c5ce683cf32 100644 --- a/src/python/grpcio_status/grpc_version.py +++ b/src/python/grpcio_status/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_status/grpc_version.py.template`!!! -VERSION = '1.23.0rc1' +VERSION = '1.23.0' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index 71930c6730f..9bb8917c6dd 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.23.0rc1' +VERSION = '1.23.0' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index aab9f1b57ab..b3d03a317a6 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.23.0rc1' +VERSION = '1.23.0' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index fa31c144282..5ca1f443cf0 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.23.0.pre1' + VERSION = '1.23.0' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index e5e7a16717c..a70b4789a46 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.23.0.pre1' + VERSION = '1.23.0' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index 2b4e8218b50..46bdd9b7df1 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION = '1.23.0rc1' +VERSION = '1.23.0' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index d508459f0fd..013ab911a13 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.23.0-pre1 +PROJECT_NUMBER = 1.23.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index ec0c30b0e79..c72f0485275 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.23.0-pre1 +PROJECT_NUMBER = 1.23.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From 6cf05561cedffd7111a94b86c80060deb86c7efa Mon Sep 17 00:00:00 2001 From: Arjun Roy Date: Mon, 22 Jul 2019 12:24:16 -0700 Subject: [PATCH 334/661] Added overloads for metadata add/remove operations when static index is known. In several cases, we wish to add or remove metadata when we already know what kind of metadata it is (e.g. we know we're dealing with the path, or the authority, or the user agent, etc.). In these cases, we do not need to re-compute the metadata batch callout index since we know it a-priori. This saves us some branches and ALU ops spent pointlessly re-computing these indices in several hot-path filters. We do need the original methods where we do compute the indices in cases where we're operating over a collection of metadata, but this is relatively uncommon. --- .../filters/client_channel/client_channel.cc | 5 +- .../health/health_check_client.cc | 3 +- .../filters/http/client/http_client_filter.cc | 18 ++-- .../filters/http/client_authority_filter.cc | 2 +- .../message_compress_filter.cc | 17 ++-- .../filters/http/server/http_server_filter.cc | 78 ++++++++++------ src/core/lib/surface/call.cc | 12 +-- src/core/lib/surface/server.cc | 11 ++- src/core/lib/transport/metadata_batch.cc | 88 +++++++++++++++---- src/core/lib/transport/metadata_batch.h | 38 ++++++++ src/cpp/ext/filters/census/client_filter.cc | 6 +- src/cpp/ext/filters/census/server_filter.cc | 7 +- 12 files changed, 206 insertions(+), 79 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 767a22e9e59..63bd737e931 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -3186,8 +3186,7 @@ void CallData::AddRetriableSendInitialMetadataOp( if (GPR_UNLIKELY(retry_state->send_initial_metadata.idx.named .grpc_previous_rpc_attempts != nullptr)) { grpc_metadata_batch_remove(&retry_state->send_initial_metadata, - retry_state->send_initial_metadata.idx.named - .grpc_previous_rpc_attempts); + GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS); } if (GPR_UNLIKELY(num_attempts_completed_ > 0)) { grpc_mdelem retry_md = grpc_mdelem_create( @@ -3197,7 +3196,7 @@ void CallData::AddRetriableSendInitialMetadataOp( &retry_state->send_initial_metadata, &retry_state ->send_initial_metadata_storage[send_initial_metadata_.list.count], - retry_md); + retry_md, GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS); if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) { gpr_log(GPR_ERROR, "error adding retry metadata: %s", grpc_error_string(error)); diff --git a/src/core/ext/filters/client_channel/health/health_check_client.cc b/src/core/ext/filters/client_channel/health/health_check_client.cc index 63a0a455fc1..026831645c0 100644 --- a/src/core/ext/filters/client_channel/health/health_check_client.cc +++ b/src/core/ext/filters/client_channel/health/health_check_client.cc @@ -346,7 +346,8 @@ void HealthCheckClient::CallState::StartCall() { &send_initial_metadata_, &path_metadata_storage_, grpc_mdelem_from_slices( GRPC_MDSTR_PATH, - GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH)); + GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH), + GRPC_BATCH_PATH); GPR_ASSERT(error == GRPC_ERROR_NONE); payload_.send_initial_metadata.send_initial_metadata = &send_initial_metadata_; diff --git a/src/core/ext/filters/http/client/http_client_filter.cc b/src/core/ext/filters/http/client/http_client_filter.cc index 9ec7aaf4ec8..b16d26b1f24 100644 --- a/src/core/ext/filters/http/client/http_client_filter.cc +++ b/src/core/ext/filters/http/client/http_client_filter.cc @@ -109,7 +109,7 @@ static grpc_error* client_filter_incoming_metadata(grpc_call_element* elem, if (b->idx.named.grpc_status != nullptr || grpc_mdelem_static_value_eq(b->idx.named.status->md, GRPC_MDELEM_STATUS_200)) { - grpc_metadata_batch_remove(b, b->idx.named.status); + grpc_metadata_batch_remove(b, GRPC_BATCH_STATUS); } else { char* val = grpc_dump_slice(GRPC_MDVALUE(b->idx.named.status->md), GPR_DUMP_ASCII); @@ -167,7 +167,7 @@ static grpc_error* client_filter_incoming_metadata(grpc_call_element* elem, gpr_free(val); } } - grpc_metadata_batch_remove(b, b->idx.named.content_type); + grpc_metadata_batch_remove(b, GRPC_BATCH_CONTENT_TYPE); } return GRPC_ERROR_NONE; @@ -336,7 +336,7 @@ static grpc_error* update_path_for_get(grpc_call_element* elem, static void remove_if_present(grpc_metadata_batch* batch, grpc_metadata_batch_callouts_index idx) { if (batch->idx.array[idx] != nullptr) { - grpc_metadata_batch_remove(batch, batch->idx.array[idx]); + grpc_metadata_batch_remove(batch, idx); } } @@ -433,23 +433,25 @@ static void hc_start_transport_stream_op_batch( layer headers. */ error = grpc_metadata_batch_add_head( batch->payload->send_initial_metadata.send_initial_metadata, - &calld->method, method); + &calld->method, method, GRPC_BATCH_METHOD); if (error != GRPC_ERROR_NONE) goto done; error = grpc_metadata_batch_add_head( batch->payload->send_initial_metadata.send_initial_metadata, - &calld->scheme, channeld->static_scheme); + &calld->scheme, channeld->static_scheme, GRPC_BATCH_SCHEME); if (error != GRPC_ERROR_NONE) goto done; error = grpc_metadata_batch_add_tail( batch->payload->send_initial_metadata.send_initial_metadata, - &calld->te_trailers, GRPC_MDELEM_TE_TRAILERS); + &calld->te_trailers, GRPC_MDELEM_TE_TRAILERS, GRPC_BATCH_TE); if (error != GRPC_ERROR_NONE) goto done; error = grpc_metadata_batch_add_tail( batch->payload->send_initial_metadata.send_initial_metadata, - &calld->content_type, GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC); + &calld->content_type, GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC, + GRPC_BATCH_CONTENT_TYPE); if (error != GRPC_ERROR_NONE) goto done; error = grpc_metadata_batch_add_tail( batch->payload->send_initial_metadata.send_initial_metadata, - &calld->user_agent, GRPC_MDELEM_REF(channeld->user_agent)); + &calld->user_agent, GRPC_MDELEM_REF(channeld->user_agent), + GRPC_BATCH_USER_AGENT); if (error != GRPC_ERROR_NONE) goto done; } diff --git a/src/core/ext/filters/http/client_authority_filter.cc b/src/core/ext/filters/http/client_authority_filter.cc index 13c6ce58fec..dc8beb986fc 100644 --- a/src/core/ext/filters/http/client_authority_filter.cc +++ b/src/core/ext/filters/http/client_authority_filter.cc @@ -60,7 +60,7 @@ void authority_start_transport_stream_op_batch( initial_metadata->idx.named.authority == nullptr) { grpc_error* error = grpc_metadata_batch_add_head( initial_metadata, &calld->authority_storage, - GRPC_MDELEM_REF(chand->default_authority_mdelem)); + GRPC_MDELEM_REF(chand->default_authority_mdelem), GRPC_BATCH_AUTHORITY); if (error != GRPC_ERROR_NONE) { grpc_transport_stream_op_batch_finish_with_failure(batch, error, calld->call_combiner); diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.cc b/src/core/ext/filters/http/message_compress/message_compress_filter.cc index 0e0be6e9cff..9ef8e6a1990 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.cc +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.cc @@ -137,9 +137,8 @@ static grpc_compression_algorithm find_compression_algorithm( &compression_algorithm)); // Remove this metadata since it's an internal one (i.e., it won't be // transmitted out). - grpc_metadata_batch_remove( - initial_metadata, - initial_metadata->idx.named.grpc_internal_encoding_request); + grpc_metadata_batch_remove(initial_metadata, + GRPC_BATCH_GRPC_INTERNAL_ENCODING_REQUEST); // Check if that algorithm is enabled. Note that GRPC_COMPRESS_NONE is always // enabled. // TODO(juanlishen): Maybe use channel default or abort() if the algorithm @@ -195,19 +194,22 @@ static grpc_error* process_send_initial_metadata( error = grpc_metadata_batch_add_tail( initial_metadata, &calld->message_compression_algorithm_storage, grpc_message_compression_encoding_mdelem( - calld->message_compression_algorithm)); + calld->message_compression_algorithm), + GRPC_BATCH_GRPC_ENCODING); } else if (stream_compression_algorithm != GRPC_STREAM_COMPRESS_NONE) { initialize_state(elem, calld); error = grpc_metadata_batch_add_tail( initial_metadata, &calld->stream_compression_algorithm_storage, - grpc_stream_compression_encoding_mdelem(stream_compression_algorithm)); + grpc_stream_compression_encoding_mdelem(stream_compression_algorithm), + GRPC_BATCH_CONTENT_ENCODING); } if (error != GRPC_ERROR_NONE) return error; // Convey supported compression algorithms. error = grpc_metadata_batch_add_tail( initial_metadata, &calld->accept_encoding_storage, GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS( - channeld->enabled_message_compression_algorithms_bitset)); + channeld->enabled_message_compression_algorithms_bitset), + GRPC_BATCH_GRPC_ACCEPT_ENCODING); if (error != GRPC_ERROR_NONE) return error; // Do not overwrite accept-encoding header if it already presents (e.g., added // by some proxy). @@ -215,7 +217,8 @@ static grpc_error* process_send_initial_metadata( error = grpc_metadata_batch_add_tail( initial_metadata, &calld->accept_stream_encoding_storage, GRPC_MDELEM_ACCEPT_STREAM_ENCODING_FOR_ALGORITHMS( - channeld->enabled_stream_compression_algorithms_bitset)); + channeld->enabled_stream_compression_algorithms_bitset), + GRPC_BATCH_ACCEPT_ENCODING); } return error; } diff --git a/src/core/ext/filters/http/server/http_server_filter.cc b/src/core/ext/filters/http/server/http_server_filter.cc index 028d268c7b3..99f6b65e424 100644 --- a/src/core/ext/filters/http/server/http_server_filter.cc +++ b/src/core/ext/filters/http/server/http_server_filter.cc @@ -124,6 +124,32 @@ static void hs_add_error(const char* error_name, grpc_error** cumulative, *cumulative = grpc_error_add_child(*cumulative, new_err); } +// Metadata equality within this filter leverages the fact that the sender was +// likely using the gRPC chttp2 transport, in which case the encoder would emit +// indexed values, in which case the local hpack parser would intern the +// relevant metadata, allowing a simple pointer comparison. +// +// That said, if the header was transmitted sans indexing/encoding, we still +// need to do the right thing. +// +// Assumptions: +// 1) The keys for a and b_static must match +// 2) b_static must be a statically allocated metadata object. +// 3) It is assumed that the remote end is indexing, but not necessary. +// TODO(arjunroy): Revisit this method when grpc_mdelem is strongly typed. +static bool md_strict_equal(grpc_mdelem a, grpc_mdelem b_static) { + // Hpack encoder on the remote side should emit indexed values, in which case + // hpack parser on this end should pick up interned values, in which case the + // pointer comparison alone is enough. + // + if (GPR_LIKELY(GRPC_MDELEM_IS_INTERNED(a))) { + return a.payload == b_static.payload; + } else { + return grpc_slice_eq_static_interned(GRPC_MDVALUE(a), + GRPC_MDVALUE(b_static)); + } +} + static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem, grpc_metadata_batch* b) { call_data* calld = static_cast(elem->call_data); @@ -131,19 +157,18 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem, static const char* error_name = "Failed processing incoming headers"; if (b->idx.named.method != nullptr) { - if (grpc_mdelem_static_value_eq(b->idx.named.method->md, - GRPC_MDELEM_METHOD_POST)) { + if (md_strict_equal(b->idx.named.method->md, GRPC_MDELEM_METHOD_POST)) { *calld->recv_initial_metadata_flags &= ~(GRPC_INITIAL_METADATA_CACHEABLE_REQUEST | GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST); - } else if (grpc_mdelem_static_value_eq(b->idx.named.method->md, - GRPC_MDELEM_METHOD_PUT)) { + } else if (md_strict_equal(b->idx.named.method->md, + GRPC_MDELEM_METHOD_PUT)) { *calld->recv_initial_metadata_flags &= ~GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; *calld->recv_initial_metadata_flags |= GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; - } else if (grpc_mdelem_static_value_eq(b->idx.named.method->md, - GRPC_MDELEM_METHOD_GET)) { + } else if (md_strict_equal(b->idx.named.method->md, + GRPC_MDELEM_METHOD_GET)) { *calld->recv_initial_metadata_flags |= GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; *calld->recv_initial_metadata_flags &= @@ -154,7 +179,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad header"), b->idx.named.method->md)); } - grpc_metadata_batch_remove(b, b->idx.named.method); + grpc_metadata_batch_remove(b, GRPC_BATCH_METHOD); } else { hs_add_error( error_name, &error, @@ -171,7 +196,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad header"), b->idx.named.te->md)); } - grpc_metadata_batch_remove(b, b->idx.named.te); + grpc_metadata_batch_remove(b, GRPC_BATCH_TE); } else { hs_add_error(error_name, &error, grpc_error_set_str( @@ -180,10 +205,8 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem, } if (b->idx.named.scheme != nullptr) { - if (!grpc_mdelem_static_value_eq(b->idx.named.scheme->md, - GRPC_MDELEM_SCHEME_HTTP) && - !grpc_mdelem_static_value_eq(b->idx.named.scheme->md, - GRPC_MDELEM_SCHEME_HTTPS) && + if (!md_strict_equal(b->idx.named.scheme->md, GRPC_MDELEM_SCHEME_HTTP) && + !md_strict_equal(b->idx.named.scheme->md, GRPC_MDELEM_SCHEME_HTTPS) && !grpc_mdelem_static_value_eq(b->idx.named.scheme->md, GRPC_MDELEM_SCHEME_GRPC)) { hs_add_error(error_name, &error, @@ -191,7 +214,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad header"), b->idx.named.scheme->md)); } - grpc_metadata_batch_remove(b, b->idx.named.scheme); + grpc_metadata_batch_remove(b, GRPC_BATCH_SCHEME); } else { hs_add_error( error_name, &error, @@ -227,7 +250,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem, gpr_free(val); } } - grpc_metadata_batch_remove(b, b->idx.named.content_type); + grpc_metadata_batch_remove(b, GRPC_BATCH_CONTENT_TYPE); } if (b->idx.named.path == nullptr) { @@ -282,12 +305,13 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem, grpc_linked_mdelem* el = b->idx.named.host; grpc_mdelem md = GRPC_MDELEM_REF(el->md); grpc_metadata_batch_remove(b, el); - hs_add_error(error_name, &error, - grpc_metadata_batch_add_head( - b, el, - grpc_mdelem_from_slices( - GRPC_MDSTR_AUTHORITY, - grpc_slice_ref_internal(GRPC_MDVALUE(md))))); + hs_add_error( + error_name, &error, + grpc_metadata_batch_add_head( + b, el, + grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY, + grpc_slice_ref_internal(GRPC_MDVALUE(md))), + GRPC_BATCH_AUTHORITY)); GRPC_MDELEM_UNREF(md); } @@ -301,7 +325,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem, channel_data* chand = static_cast(elem->channel_data); if (!chand->surface_user_agent && b->idx.named.user_agent != nullptr) { - grpc_metadata_batch_remove(b, b->idx.named.user_agent); + grpc_metadata_batch_remove(b, GRPC_BATCH_USER_AGENT); } return error; @@ -392,15 +416,17 @@ static grpc_error* hs_mutate_op(grpc_call_element* elem, if (op->send_initial_metadata) { grpc_error* error = GRPC_ERROR_NONE; static const char* error_name = "Failed sending initial metadata"; - hs_add_error(error_name, &error, - grpc_metadata_batch_add_head( - op->payload->send_initial_metadata.send_initial_metadata, - &calld->status, GRPC_MDELEM_STATUS_200)); + hs_add_error( + error_name, &error, + grpc_metadata_batch_add_head( + op->payload->send_initial_metadata.send_initial_metadata, + &calld->status, GRPC_MDELEM_STATUS_200, GRPC_BATCH_STATUS)); hs_add_error(error_name, &error, grpc_metadata_batch_add_tail( op->payload->send_initial_metadata.send_initial_metadata, &calld->content_type, - GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC)); + GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC, + GRPC_BATCH_CONTENT_TYPE)); hs_add_error( error_name, &error, hs_filter_outgoing_metadata( diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 378d148c674..1331e57ab0c 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -1007,13 +1007,13 @@ static void recv_initial_filter(grpc_call* call, grpc_metadata_batch* b) { GPR_TIMER_SCOPE("incoming_stream_compression_algorithm", 0); set_incoming_stream_compression_algorithm( call, decode_stream_compression(b->idx.named.content_encoding->md)); - grpc_metadata_batch_remove(b, b->idx.named.content_encoding); + grpc_metadata_batch_remove(b, GRPC_BATCH_CONTENT_ENCODING); } if (b->idx.named.grpc_encoding != nullptr) { GPR_TIMER_SCOPE("incoming_message_compression_algorithm", 0); set_incoming_message_compression_algorithm( call, decode_message_compression(b->idx.named.grpc_encoding->md)); - grpc_metadata_batch_remove(b, b->idx.named.grpc_encoding); + grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_ENCODING); } uint32_t message_encodings_accepted_by_peer = 1u; uint32_t stream_encodings_accepted_by_peer = 1u; @@ -1021,13 +1021,13 @@ static void recv_initial_filter(grpc_call* call, grpc_metadata_batch* b) { GPR_TIMER_SCOPE("encodings_accepted_by_peer", 0); set_encodings_accepted_by_peer(call, b->idx.named.grpc_accept_encoding->md, &message_encodings_accepted_by_peer, false); - grpc_metadata_batch_remove(b, b->idx.named.grpc_accept_encoding); + grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_ACCEPT_ENCODING); } if (b->idx.named.accept_encoding != nullptr) { GPR_TIMER_SCOPE("stream_encodings_accepted_by_peer", 0); set_encodings_accepted_by_peer(call, b->idx.named.accept_encoding->md, &stream_encodings_accepted_by_peer, true); - grpc_metadata_batch_remove(b, b->idx.named.accept_encoding); + grpc_metadata_batch_remove(b, GRPC_BATCH_ACCEPT_ENCODING); } call->encodings_accepted_by_peer = grpc_compression_bitset_from_message_stream_compression_bitset( @@ -1059,13 +1059,13 @@ static void recv_trailing_filter(void* args, grpc_metadata_batch* b, error = grpc_error_set_str( error, GRPC_ERROR_STR_GRPC_MESSAGE, grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.grpc_message->md))); - grpc_metadata_batch_remove(b, b->idx.named.grpc_message); + grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_MESSAGE); } else if (error != GRPC_ERROR_NONE) { error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE, grpc_empty_slice()); } set_final_status(call, GRPC_ERROR_REF(error)); - grpc_metadata_batch_remove(b, b->idx.named.grpc_status); + grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_STATUS); GRPC_ERROR_UNREF(error); } else if (!call->is_client) { set_final_status(call, GRPC_ERROR_NONE); diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index f344b32d7a6..2cc7e88cab4 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -744,19 +744,18 @@ static void server_on_recv_initial_metadata(void* ptr, grpc_error* error) { grpc_millis op_deadline; if (error == GRPC_ERROR_NONE) { - GPR_ASSERT(calld->recv_initial_metadata->idx.named.path != nullptr); - GPR_ASSERT(calld->recv_initial_metadata->idx.named.authority != nullptr); + GPR_DEBUG_ASSERT(calld->recv_initial_metadata->idx.named.path != nullptr); + GPR_DEBUG_ASSERT(calld->recv_initial_metadata->idx.named.authority != + nullptr); calld->path = grpc_slice_ref_internal( GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.path->md)); calld->host = grpc_slice_ref_internal( GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.authority->md)); calld->path_set = true; calld->host_set = true; + grpc_metadata_batch_remove(calld->recv_initial_metadata, GRPC_BATCH_PATH); grpc_metadata_batch_remove(calld->recv_initial_metadata, - calld->recv_initial_metadata->idx.named.path); - grpc_metadata_batch_remove( - calld->recv_initial_metadata, - calld->recv_initial_metadata->idx.named.authority); + GRPC_BATCH_AUTHORITY); } else { GRPC_ERROR_REF(error); } diff --git a/src/core/lib/transport/metadata_batch.cc b/src/core/lib/transport/metadata_batch.cc index 74356b2caf2..560342cecc6 100644 --- a/src/core/lib/transport/metadata_batch.cc +++ b/src/core/lib/transport/metadata_batch.cc @@ -93,6 +93,23 @@ grpc_error* grpc_attach_md_to_error(grpc_error* src, grpc_mdelem md) { return out; } +static grpc_error* GPR_ATTRIBUTE_NOINLINE error_with_md(grpc_mdelem md) { + return grpc_attach_md_to_error( + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Unallowed duplicate metadata"), md); +} + +static grpc_error* link_callout(grpc_metadata_batch* batch, + grpc_linked_mdelem* storage, + grpc_metadata_batch_callouts_index idx) { + GPR_DEBUG_ASSERT(idx >= 0 && idx < GRPC_BATCH_CALLOUTS_COUNT); + if (GPR_LIKELY(batch->idx.array[idx] == nullptr)) { + ++batch->list.default_count; + batch->idx.array[idx] = storage; + return GRPC_ERROR_NONE; + } + return error_with_md(storage->md); +} + static grpc_error* maybe_link_callout(grpc_metadata_batch* batch, grpc_linked_mdelem* storage) GRPC_MUST_USE_RESULT; @@ -104,14 +121,7 @@ static grpc_error* maybe_link_callout(grpc_metadata_batch* batch, if (idx == GRPC_BATCH_CALLOUTS_COUNT) { return GRPC_ERROR_NONE; } - if (GPR_LIKELY(batch->idx.array[idx] == nullptr)) { - ++batch->list.default_count; - batch->idx.array[idx] = storage; - return GRPC_ERROR_NONE; - } - return grpc_attach_md_to_error( - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Unallowed duplicate metadata"), - storage->md); + return link_callout(batch, storage, idx); } static void maybe_unlink_callout(grpc_metadata_batch* batch, @@ -122,21 +132,21 @@ static void maybe_unlink_callout(grpc_metadata_batch* batch, return; } --batch->list.default_count; - GPR_ASSERT(batch->idx.array[idx] != nullptr); + GPR_DEBUG_ASSERT(batch->idx.array[idx] != nullptr); batch->idx.array[idx] = nullptr; } grpc_error* grpc_metadata_batch_add_head(grpc_metadata_batch* batch, grpc_linked_mdelem* storage, grpc_mdelem elem_to_add) { - GPR_ASSERT(!GRPC_MDISNULL(elem_to_add)); + GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add)); storage->md = elem_to_add; return grpc_metadata_batch_link_head(batch, storage); } static void link_head(grpc_mdelem_list* list, grpc_linked_mdelem* storage) { assert_valid_list(list); - GPR_ASSERT(!GRPC_MDISNULL(storage->md)); + GPR_DEBUG_ASSERT(!GRPC_MDISNULL(storage->md)); storage->prev = nullptr; storage->next = list->head; storage->reserved = nullptr; @@ -163,17 +173,35 @@ grpc_error* grpc_metadata_batch_link_head(grpc_metadata_batch* batch, return GRPC_ERROR_NONE; } +// TODO(arjunroy): Need to revisit this and see what guarantees exist between +// C-core and the internal-metadata subsystem. E.g. can we ensure a particular +// metadata is never added twice, even in the presence of user supplied data? +grpc_error* grpc_metadata_batch_link_head( + grpc_metadata_batch* batch, grpc_linked_mdelem* storage, + grpc_metadata_batch_callouts_index idx) { + GPR_DEBUG_ASSERT(GRPC_BATCH_INDEX_OF(GRPC_MDKEY(storage->md)) == idx); + assert_valid_callouts(batch); + grpc_error* err = link_callout(batch, storage, idx); + if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) { + assert_valid_callouts(batch); + return err; + } + link_head(&batch->list, storage); + assert_valid_callouts(batch); + return GRPC_ERROR_NONE; +} + grpc_error* grpc_metadata_batch_add_tail(grpc_metadata_batch* batch, grpc_linked_mdelem* storage, grpc_mdelem elem_to_add) { - GPR_ASSERT(!GRPC_MDISNULL(elem_to_add)); + GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add)); storage->md = elem_to_add; return grpc_metadata_batch_link_tail(batch, storage); } static void link_tail(grpc_mdelem_list* list, grpc_linked_mdelem* storage) { assert_valid_list(list); - GPR_ASSERT(!GRPC_MDISNULL(storage->md)); + GPR_DEBUG_ASSERT(!GRPC_MDISNULL(storage->md)); storage->prev = list->tail; storage->next = nullptr; storage->reserved = nullptr; @@ -200,6 +228,21 @@ grpc_error* grpc_metadata_batch_link_tail(grpc_metadata_batch* batch, return GRPC_ERROR_NONE; } +grpc_error* grpc_metadata_batch_link_tail( + grpc_metadata_batch* batch, grpc_linked_mdelem* storage, + grpc_metadata_batch_callouts_index idx) { + GPR_DEBUG_ASSERT(GRPC_BATCH_INDEX_OF(GRPC_MDKEY(storage->md)) == idx); + assert_valid_callouts(batch); + grpc_error* err = link_callout(batch, storage, idx); + if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) { + assert_valid_callouts(batch); + return err; + } + link_tail(&batch->list, storage); + assert_valid_callouts(batch); + return GRPC_ERROR_NONE; +} + static void unlink_storage(grpc_mdelem_list* list, grpc_linked_mdelem* storage) { assert_valid_list(list); @@ -226,6 +269,18 @@ void grpc_metadata_batch_remove(grpc_metadata_batch* batch, assert_valid_callouts(batch); } +void grpc_metadata_batch_remove(grpc_metadata_batch* batch, + grpc_metadata_batch_callouts_index idx) { + assert_valid_callouts(batch); + grpc_linked_mdelem* storage = batch->idx.array[idx]; + GPR_DEBUG_ASSERT(storage != nullptr); + --batch->list.default_count; + batch->idx.array[idx] = nullptr; + unlink_storage(&batch->list, storage); + GRPC_MDELEM_UNREF(storage->md); + assert_valid_callouts(batch); +} + void grpc_metadata_batch_set_value(grpc_linked_mdelem* storage, const grpc_slice& value) { grpc_mdelem old_mdelem = storage->md; @@ -313,13 +368,14 @@ void grpc_metadata_batch_copy(grpc_metadata_batch* src, size_t i = 0; for (grpc_linked_mdelem* elem = src->list.head; elem != nullptr; elem = elem->next) { - grpc_error* error = grpc_metadata_batch_add_tail(dst, &storage[i++], - GRPC_MDELEM_REF(elem->md)); + // Error unused in non-debug builds. + grpc_error* GRPC_UNUSED error = grpc_metadata_batch_add_tail( + dst, &storage[i++], GRPC_MDELEM_REF(elem->md)); // The only way that grpc_metadata_batch_add_tail() can fail is if // there's a duplicate entry for a callout. However, that can't be // the case here, because we would not have been allowed to create // a source batch that had that kind of conflict. - GPR_ASSERT(error == GRPC_ERROR_NONE); + GPR_DEBUG_ASSERT(error == GRPC_ERROR_NONE); } } diff --git a/src/core/lib/transport/metadata_batch.h b/src/core/lib/transport/metadata_batch.h index d87a8b0886d..46a437e4f1b 100644 --- a/src/core/lib/transport/metadata_batch.h +++ b/src/core/lib/transport/metadata_batch.h @@ -67,6 +67,8 @@ size_t grpc_metadata_batch_size(grpc_metadata_batch* batch); /** Remove \a storage from the batch, unreffing the mdelem contained */ void grpc_metadata_batch_remove(grpc_metadata_batch* batch, grpc_linked_mdelem* storage); +void grpc_metadata_batch_remove(grpc_metadata_batch* batch, + grpc_metadata_batch_callouts_index idx); /** Substitute a new mdelem for an old value */ grpc_error* grpc_metadata_batch_substitute(grpc_metadata_batch* batch, @@ -84,6 +86,9 @@ void grpc_metadata_batch_set_value(grpc_linked_mdelem* storage, grpc_error* grpc_metadata_batch_link_head(grpc_metadata_batch* batch, grpc_linked_mdelem* storage) GRPC_MUST_USE_RESULT; +grpc_error* grpc_metadata_batch_link_head( + grpc_metadata_batch* batch, grpc_linked_mdelem* storage, + grpc_metadata_batch_callouts_index idx) GRPC_MUST_USE_RESULT; /** Add \a storage to the end of \a batch. storage->md is assumed to be valid. @@ -93,6 +98,9 @@ grpc_error* grpc_metadata_batch_link_head(grpc_metadata_batch* batch, grpc_error* grpc_metadata_batch_link_tail(grpc_metadata_batch* batch, grpc_linked_mdelem* storage) GRPC_MUST_USE_RESULT; +grpc_error* grpc_metadata_batch_link_tail( + grpc_metadata_batch* batch, grpc_linked_mdelem* storage, + grpc_metadata_batch_callouts_index idx) GRPC_MUST_USE_RESULT; /** Add \a elem_to_add as the first element in \a batch, using \a storage as backing storage for the linked list element. @@ -104,6 +112,22 @@ grpc_error* grpc_metadata_batch_add_head( grpc_metadata_batch* batch, grpc_linked_mdelem* storage, grpc_mdelem elem_to_add) GRPC_MUST_USE_RESULT; +// TODO(arjunroy, roth): Remove redundant methods. +// add/link_head/tail are almost identical. +inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_head( + grpc_metadata_batch* batch, grpc_linked_mdelem* storage, + grpc_metadata_batch_callouts_index idx) { + return grpc_metadata_batch_link_head(batch, storage, idx); +} + +inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_head( + grpc_metadata_batch* batch, grpc_linked_mdelem* storage, + grpc_mdelem elem_to_add, grpc_metadata_batch_callouts_index idx) { + GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add)); + storage->md = elem_to_add; + return grpc_metadata_batch_add_head(batch, storage, idx); +} + /** Add \a elem_to_add as the last element in \a batch, using \a storage as backing storage for the linked list element. \a storage is owned by the caller and must survive for the @@ -114,6 +138,20 @@ grpc_error* grpc_metadata_batch_add_tail( grpc_metadata_batch* batch, grpc_linked_mdelem* storage, grpc_mdelem elem_to_add) GRPC_MUST_USE_RESULT; +inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail( + grpc_metadata_batch* batch, grpc_linked_mdelem* storage, + grpc_metadata_batch_callouts_index idx) { + return grpc_metadata_batch_link_tail(batch, storage, idx); +} + +inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail( + grpc_metadata_batch* batch, grpc_linked_mdelem* storage, + grpc_mdelem elem_to_add, grpc_metadata_batch_callouts_index idx) { + GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add)); + storage->md = elem_to_add; + return grpc_metadata_batch_add_tail(batch, storage, idx); +} + grpc_error* grpc_attach_md_to_error(grpc_error* src, grpc_mdelem md); typedef struct { diff --git a/src/cpp/ext/filters/census/client_filter.cc b/src/cpp/ext/filters/census/client_filter.cc index 0f69e793551..45a883c45b8 100644 --- a/src/cpp/ext/filters/census/client_filter.cc +++ b/src/cpp/ext/filters/census/client_filter.cc @@ -94,7 +94,8 @@ void CensusClientCallData::StartTransportStreamOpBatch( op->send_initial_metadata()->batch(), &tracing_bin_, grpc_mdelem_from_slices( GRPC_MDSTR_GRPC_TRACE_BIN, - grpc_core::UnmanagedMemorySlice(tracing_buf_, tracing_len)))); + grpc_core::UnmanagedMemorySlice(tracing_buf_, tracing_len)), + GRPC_BATCH_GRPC_TRACE_BIN)); } grpc_slice tags = grpc_empty_slice(); // TODO: Add in tagging serialization. @@ -104,7 +105,8 @@ void CensusClientCallData::StartTransportStreamOpBatch( "census grpc_filter", grpc_metadata_batch_add_tail( op->send_initial_metadata()->batch(), &stats_bin_, - grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_TAGS_BIN, tags))); + grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_TAGS_BIN, tags), + GRPC_BATCH_GRPC_TAGS_BIN)); } } diff --git a/src/cpp/ext/filters/census/server_filter.cc b/src/cpp/ext/filters/census/server_filter.cc index 603d1f90bbb..09ceb9f1da8 100644 --- a/src/cpp/ext/filters/census/server_filter.cc +++ b/src/cpp/ext/filters/census/server_filter.cc @@ -50,12 +50,12 @@ void FilterInitialMetadata(grpc_metadata_batch* b, if (b->idx.named.grpc_trace_bin != nullptr) { sml->tracing_slice = grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.grpc_trace_bin->md)); - grpc_metadata_batch_remove(b, b->idx.named.grpc_trace_bin); + grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_TRACE_BIN); } if (b->idx.named.grpc_tags_bin != nullptr) { sml->census_proto = grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.grpc_tags_bin->md)); - grpc_metadata_batch_remove(b, b->idx.named.grpc_tags_bin); + grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_TAGS_BIN); } } @@ -155,7 +155,8 @@ void CensusServerCallData::StartTransportStreamOpBatch( op->send_trailing_metadata()->batch(), &census_bin_, grpc_mdelem_from_slices( GRPC_MDSTR_GRPC_SERVER_STATS_BIN, - grpc_core::UnmanagedMemorySlice(stats_buf_, len)))); + grpc_core::UnmanagedMemorySlice(stats_buf_, len)), + GRPC_BATCH_GRPC_SERVER_STATS_BIN)); } } // Call next op. From 43bf44469dd022503a9c79525d6cbb4ea572e486 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 13 Aug 2019 13:11:02 -0700 Subject: [PATCH 335/661] Make map's compare to use const --- .../lb_policy/xds/xds_client_stats.h | 2 +- src/core/lib/gprpp/map.h | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h b/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h index 8f04272da75..6e8dd961ea9 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h @@ -37,7 +37,7 @@ class XdsLocalityName : public RefCounted { public: struct Less { bool operator()(const RefCountedPtr& lhs, - const RefCountedPtr& rhs) { + const RefCountedPtr& rhs) const { int cmp_result = strcmp(lhs->region_.get(), rhs->region_.get()); if (cmp_result != 0) return cmp_result < 0; cmp_result = strcmp(lhs->zone_.get(), rhs->zone_.get()); diff --git a/src/core/lib/gprpp/map.h b/src/core/lib/gprpp/map.h index d133a89fb43..8f0a26146b1 100644 --- a/src/core/lib/gprpp/map.h +++ b/src/core/lib/gprpp/map.h @@ -37,14 +37,15 @@ struct StringLess { bool operator()(const char* a, const char* b) const { return strcmp(a, b) < 0; } - bool operator()(const UniquePtr& k1, const UniquePtr& k2) { + bool operator()(const UniquePtr& k1, const UniquePtr& k2) const { return strcmp(k1.get(), k2.get()) < 0; } }; template struct RefCountedPtrLess { - bool operator()(const RefCountedPtr& p1, const RefCountedPtr& p2) { + bool operator()(const RefCountedPtr& p1, + const RefCountedPtr& p2) const { return p1.get() < p2.get(); } }; @@ -117,7 +118,11 @@ class Map { iterator end() { return iterator(this, nullptr); } iterator lower_bound(const Key& k) { - key_compare compare; + // This is a workaround for "const key_compare compare;" + // because some versions of compilers cannot build this by requiring + // a user-provided constructor. (ref: https://stackoverflow.com/q/7411515) + key_compare compare_tmp; + const key_compare& compare = compare_tmp; return std::find_if(begin(), end(), [&k, &compare](const value_type& v) { return !compare(v.first, k); }); @@ -448,7 +453,11 @@ Map::RemoveRecursive(Entry* root, const key_type& k) { template int Map::CompareKeys(const key_type& lhs, const key_type& rhs) { - key_compare compare; + // This is a workaround for "const key_compare compare;" + // because some versions of compilers cannot build this by requiring + // a user-provided constructor. (ref: https://stackoverflow.com/q/7411515) + key_compare compare_tmp; + const key_compare& compare = compare_tmp; bool left_comparison = compare(lhs, rhs); bool right_comparison = compare(rhs, lhs); // Both values are equal From fd106bf1ac940625795b221fa0a039a6bd1d31d5 Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 14 Aug 2019 12:38:59 -0700 Subject: [PATCH 336/661] Add accessor declaration for ClientContext --- include/grpcpp/impl/codegen/client_context_impl.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/grpcpp/impl/codegen/client_context_impl.h b/include/grpcpp/impl/codegen/client_context_impl.h index 638ea641bed..7a543055b4b 100644 --- a/include/grpcpp/impl/codegen/client_context_impl.h +++ b/include/grpcpp/impl/codegen/client_context_impl.h @@ -85,6 +85,7 @@ class ClientCallbackReaderImpl; template class ClientCallbackWriterImpl; class ClientCallbackUnaryImpl; +class ClientContextAccessor; } // namespace internal class CallCredentials; @@ -424,6 +425,7 @@ class ClientContext { template friend class ::grpc_impl::internal::ClientCallbackWriterImpl; friend class ::grpc_impl::internal::ClientCallbackUnaryImpl; + friend class ::grpc_impl::internal::ClientContextAccessor; // Used by friend class CallOpClientRecvStatus void set_debug_error_string(const grpc::string& debug_error_string) { From cb6a8ae0d2d03bd2fe3e288b54d6ca4731237b13 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 14 Aug 2019 13:31:36 -0700 Subject: [PATCH 337/661] Added experimental wrappers for importing to Google3 --- src/objective-c/examples/BUILD | 11 ++++++++--- .../grpc_objc_internal_library.bzl | 19 ++++++++++++++++--- src/objective-c/tests/BUILD | 8 +++++--- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index 4f333cd7502..6689a5a28b8 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -15,20 +15,25 @@ # limitations under the License. -load("//src/objective-c:grpc_objc_internal_library.bzl", "local_objc_grpc_library") +load( + "//src/objective-c:grpc_objc_internal_library.bzl", + "local_objc_grpc_library", + "proto_library_objc_wrapper", +) load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application") load("@build_bazel_rules_apple//apple:watchos.bzl", "watchos_application", "watchos_extension") -proto_library( +proto_library_objc_wrapper( name = "messages_proto", srcs = ["RemoteTestClient/messages.proto"], ) -proto_library( +proto_library_objc_wrapper( name = "test_proto", srcs = ["RemoteTestClient/test.proto"], deps = [":messages_proto"], + use_well_known_protos = True, ) # use objc_grpc_library in bazel:objc_grpc_library.bzl when developing outside the repo diff --git a/src/objective-c/grpc_objc_internal_library.bzl b/src/objective-c/grpc_objc_internal_library.bzl index 51206c1e903..7035e963b94 100644 --- a/src/objective-c/grpc_objc_internal_library.bzl +++ b/src/objective-c/grpc_objc_internal_library.bzl @@ -30,7 +30,20 @@ load( "generate_objc_srcs", "generate_objc_non_arc_srcs" ) -load("//bazel:protobuf.bzl", "well_known_proto_libs") + +def proto_library_objc_wrapper( + name, + srcs, + deps = [], + use_well_known_protos = False): + """proto_library for adding dependencies to google/protobuf protos + use_well_known_protos - ignored in open source version + """ + native.proto_library( + name = name, + srcs = srcs, + deps = deps, + ) def grpc_objc_testing_library( name, @@ -53,7 +66,7 @@ def grpc_objc_testing_library( includes: added to search path, always [the path to objc directory] deps: dependencies """ - + additional_deps = [ ":RemoteTest", "//src/objective-c:grpc_objc_client_internal_testing", @@ -61,7 +74,7 @@ def grpc_objc_testing_library( if not name == "TestConfigs": additional_deps += [":TestConfigs"] - + native.objc_library( name = name, hdrs = hdrs, diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index 80c12fba548..2d0a57ac21d 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -21,7 +21,8 @@ package(default_visibility = ["//visibility:private"]) load( "//src/objective-c:grpc_objc_internal_library.bzl", "grpc_objc_testing_library", - "local_objc_grpc_library" + "local_objc_grpc_library", + "proto_library_objc_wrapper", ) load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test") @@ -30,15 +31,16 @@ load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application", "tvos_unit_ exports_files(["LICENSE"]) -proto_library( +proto_library_objc_wrapper( name = "messages_proto", srcs = ["RemoteTestClient/messages.proto"], ) -proto_library( +proto_library_objc_wrapper( name = "test_proto", srcs = ["RemoteTestClient/test.proto"], deps = [":messages_proto"], + use_well_known_protos = True, ) local_objc_grpc_library( From 5de502528f08a7e3d16b9fb3af04eb579d3e86eb Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 14 Aug 2019 15:39:40 -0700 Subject: [PATCH 338/661] Add license --- src/objective-c/examples/BUILD | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index 6689a5a28b8..3e25c5c7dfa 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -14,6 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +licenses(["notice"]) # 3-clause BSD + +package(default_visibility = ["//visibility:public"]) load( "//src/objective-c:grpc_objc_internal_library.bzl", From a01edec47a8bbb6f34e65af3090a636864a16c8a Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 14 Aug 2019 17:24:51 -0700 Subject: [PATCH 339/661] Added helloworld sample with Bazel build --- examples/objective-c/BUILD | 57 ++++++++++++++++++++++++++ examples/objective-c/helloworld/main.m | 4 ++ 2 files changed, 61 insertions(+) create mode 100644 examples/objective-c/BUILD diff --git a/examples/objective-c/BUILD b/examples/objective-c/BUILD new file mode 100644 index 00000000000..5dc61ea970f --- /dev/null +++ b/examples/objective-c/BUILD @@ -0,0 +1,57 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +licenses(["notice"]) # 3-clause BSD + +package(default_visibility = ["//visibility:public"]) + +load("@com_github_grpc_grpc//bazel:objc_grpc_library.bzl", "objc_grpc_library") +load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") + +objc_grpc_library( + name = "HelloWorld_grpc_proto", + srcs = ["//examples:protos/helloworld.proto"], + deps = ["//examples:helloworld_proto"], +) + +# This one works with import "external/com_github_grpc_grpc/examples/protos/Helloworld.pbrpc.h" +objc_grpc_library( + name = "HelloWorld_grpc_proto_external", + srcs = ["//external/com_github_grpc_grpc/examples:protos/helloworld.proto"], + deps = ["@com_github_grpc_grpc//examples:helloworld_proto"], +) + +objc_library( + name = "HelloWorld-lib", + srcs = glob(["helloworld/**/*.m",]), + hdrs = glob(["helloworld/**/*.h"]), + data = glob([ + "helloworld/HelloWorld/Base.lproj/**", + "helloworld/HelloWorld/Images.xcassets/**", + ]), + includes = ["helloworld/HelloWorld"], + deps = [":HelloWorld_grpc_proto"], +) + +ios_application( + name = "HelloWorld", + bundle_id = "Google.HelloWorld", + families = [ + "iphone", + "ipad", + ], + minimum_os_version = "8.0", + infoplists = ["helloworld/HelloWorld/Info.plist"], + deps = [":HelloWorld-lib"], +) diff --git a/examples/objective-c/helloworld/main.m b/examples/objective-c/helloworld/main.m index 649e65bb5b2..d193af862ba 100644 --- a/examples/objective-c/helloworld/main.m +++ b/examples/objective-c/helloworld/main.m @@ -21,7 +21,11 @@ #import #import +#if COCOAPODS #import +#else +#import "examples/protos/Helloworld.pbrpc.h" +#endif static NSString * const kHostAddress = @"localhost:50051"; From f4037db1fb825c01896471aef32991d683a3ed29 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 14 Aug 2019 17:47:57 -0700 Subject: [PATCH 340/661] Added manual tag and buildtest example --- examples/objective-c/BUILD | 4 ++++ test/build_test/BUILD | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 test/build_test/BUILD diff --git a/examples/objective-c/BUILD b/examples/objective-c/BUILD index 5dc61ea970f..9ceaaa9a8b4 100644 --- a/examples/objective-c/BUILD +++ b/examples/objective-c/BUILD @@ -23,6 +23,7 @@ objc_grpc_library( name = "HelloWorld_grpc_proto", srcs = ["//examples:protos/helloworld.proto"], deps = ["//examples:helloworld_proto"], + tags = ["manual"], ) # This one works with import "external/com_github_grpc_grpc/examples/protos/Helloworld.pbrpc.h" @@ -30,6 +31,7 @@ objc_grpc_library( name = "HelloWorld_grpc_proto_external", srcs = ["//external/com_github_grpc_grpc/examples:protos/helloworld.proto"], deps = ["@com_github_grpc_grpc//examples:helloworld_proto"], + tags = ["manual"], ) objc_library( @@ -42,6 +44,7 @@ objc_library( ]), includes = ["helloworld/HelloWorld"], deps = [":HelloWorld_grpc_proto"], + tags = ["manual"], ) ios_application( @@ -54,4 +57,5 @@ ios_application( minimum_os_version = "8.0", infoplists = ["helloworld/HelloWorld/Info.plist"], deps = [":HelloWorld-lib"], + tags = ["manual"], ) diff --git a/test/build_test/BUILD b/test/build_test/BUILD new file mode 100644 index 00000000000..90777266a14 --- /dev/null +++ b/test/build_test/BUILD @@ -0,0 +1,28 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +licenses(["notice"]) + +package(default_visibility = ["//visibility:public"]) + +load("@bazel_skylib//rules:build_test.bzl", "build_test") + +# build test //test/build_test:objective_c_examples_test +build_test( + name = "objective_c_examples_test", + targets = [ + "//examples/objective-c:HelloWorld", + ], + tags = ["manual"], +) \ No newline at end of file From 20b085e3142768e23d60c909a4ddd0971ecd3b94 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 14 Aug 2019 18:42:16 -0700 Subject: [PATCH 341/661] Passing kwargs --- bazel/objc_grpc_library.bzl | 1 + 1 file changed, 1 insertion(+) diff --git a/bazel/objc_grpc_library.bzl b/bazel/objc_grpc_library.bzl index 7647ab08053..71538843589 100644 --- a/bazel/objc_grpc_library.bzl +++ b/bazel/objc_grpc_library.bzl @@ -64,5 +64,6 @@ def objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kw "@com_github_grpc_grpc//src/objective-c:proto_objc_rpc", "@com_google_protobuf//:protobuf_objc", ], + **kwargs ) From 141c2d24d1e0031842333d63d66c4c4eeff498a9 Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Wed, 7 Aug 2019 14:28:46 -0700 Subject: [PATCH 342/661] Add support for running C++ tests on iOS --- bazel/grpc_build_system.bzl | 34 +++ src/proto/grpc/testing/BUILD | 2 - test/cpp/end2end/BUILD | 16 +- test/cpp/end2end/filter_end2end_test.cc | 11 +- test/cpp/util/BUILD | 4 +- .../objective_c/google_toolbox_for_mac/BUILD | 31 +++ .../UnitTesting/GTMGoogleTestRunner.mm | 233 ++++++++++++++++++ .../macos/grpc_bazel_cpp_ios_tests.cfg | 19 ++ .../macos/grpc_run_bazel_cpp_ios_tests.sh | 39 +++ 9 files changed, 380 insertions(+), 9 deletions(-) create mode 100644 third_party/objective_c/google_toolbox_for_mac/BUILD create mode 100644 third_party/objective_c/google_toolbox_for_mac/UnitTesting/GTMGoogleTestRunner.mm create mode 100644 tools/internal_ci/macos/grpc_bazel_cpp_ios_tests.cfg create mode 100644 tools/internal_ci/macos/grpc_run_bazel_cpp_ios_tests.sh diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 7111b5b8c34..390624f3785 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -26,6 +26,8 @@ load("//bazel:cc_grpc_library.bzl", "cc_grpc_library") load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library") +load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test") + # The set of pollers to test against if a test exercises polling POLLERS = ["epollex", "epoll1", "poll"] @@ -137,6 +139,32 @@ def grpc_proto_library( use_external = use_external, generate_mocks = generate_mocks, ) +def ios_cc_test( + name, + tags = [], + **kwargs): + ios_test_adapter = "//third_party/objective_c/google_toolbox_for_mac:GTM_GoogleTestRunner_GTM_USING_XCTEST"; + + test_lib_ios = name + "_test_lib_ios" + ios_tags = tags + ["manual", "ios_cc_test"] + if not any([t for t in tags if t.startswith("no_test_ios")]): + native.objc_library( + name = test_lib_ios, + srcs = kwargs.get("srcs"), + deps = kwargs.get("deps"), + copts = kwargs.get("copts"), + tags = ios_tags, + alwayslink = 1, + testonly = 1, + ) + ios_test_deps = [ios_test_adapter, ":" + test_lib_ios] + ios_unit_test( + name = name + "_on_ios", + size = kwargs.get("size"), + tags = ios_tags, + minimum_os_version = "9.0", + deps = ios_test_deps, + ) def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++", size = "medium", timeout = None, tags = [], exec_compatible_with = []): copts = if_mac(["-DGRPC_CFSTREAM"]) @@ -183,6 +211,12 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data ) else: native.cc_test(tags = tags, **args) + ios_cc_test( + name = name, + tags = tags, + **args + ) + def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++", testonly = False, linkshared = False, linkopts = [], tags = []): copts = [] diff --git a/src/proto/grpc/testing/BUILD b/src/proto/grpc/testing/BUILD index 15be8227de1..8bea8ed7ca0 100644 --- a/src/proto/grpc/testing/BUILD +++ b/src/proto/grpc/testing/BUILD @@ -50,7 +50,6 @@ grpc_proto_library( grpc_proto_library( name = "echo_messages_proto", srcs = ["echo_messages.proto"], - has_services = False, ) grpc_proto_library( @@ -145,7 +144,6 @@ grpc_proto_library( grpc_proto_library( name = "simple_messages_proto", srcs = ["simple_messages.proto"], - has_services = False, ) grpc_proto_library( diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index f3cc14cb848..5567170d371 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -78,6 +78,7 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + tags = ["no_test_ios"], ) grpc_cc_test( @@ -89,7 +90,7 @@ grpc_cc_test( external_deps = [ "gtest", ], - tags = ["no_windows"], + tags = ["no_windows", "no_test_ios"], deps = [ ":test_service_impl", "//:gpr", @@ -121,6 +122,7 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + tags = ["no_test_ios"], ) grpc_cc_binary( @@ -163,6 +165,7 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + tags = ["no_test_ios"], ) grpc_cc_test( @@ -437,6 +440,7 @@ grpc_cc_test( "//test/core/util:test_lb_policies", "//test/cpp/util:test_util", ], + tags = ["no_test_ios"], ) grpc_cc_test( @@ -477,6 +481,7 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + tags = ["no_test_ios"], ) grpc_cc_test( @@ -499,6 +504,7 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + tags = ["no_test_ios"], ) grpc_cc_test( @@ -561,6 +567,7 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + tags = ["no_test_ios"], ) grpc_cc_binary( @@ -614,6 +621,7 @@ grpc_cc_test( "//src/proto/grpc/testing:echo_proto", "//test/cpp/util:test_util", ], + tags = ["no_test_ios"], ) grpc_cc_test( @@ -622,7 +630,7 @@ grpc_cc_test( external_deps = [ "gtest", ], - tags = ["manual"], + tags = ["manual", "no_test_ios"], deps = [ ":test_service_impl", "//:gpr", @@ -689,6 +697,7 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + tags = ["no_test_ios"], ) grpc_cc_test( @@ -697,7 +706,7 @@ grpc_cc_test( external_deps = [ "gtest", ], - tags = ["manual"], # test requires root, won't work with bazel RBE + tags = ["manual", "no_test_ios"], # test requires root, won't work with bazel RBE deps = [ ":test_service_impl", "//:gpr", @@ -746,4 +755,5 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + tags = ["no_test_ios"], ) diff --git a/test/cpp/end2end/filter_end2end_test.cc b/test/cpp/end2end/filter_end2end_test.cc index e96825c33eb..a224d6596a3 100644 --- a/test/cpp/end2end/filter_end2end_test.cc +++ b/test/cpp/end2end/filter_end2end_test.cc @@ -122,9 +122,14 @@ class FilterEnd2endTest : public ::testing::Test { FilterEnd2endTest() : server_host_("localhost") {} static void SetUpTestCase() { - gpr_log(GPR_ERROR, "In SetUpTestCase"); - grpc::RegisterChannelFilter( - "test-filter", GRPC_SERVER_CHANNEL, INT_MAX, nullptr); + // Workaround for + // https://github.com/google/google-toolbox-for-mac/issues/242 + static bool setup_done = false; + if (!setup_done) { + setup_done = true; + grpc::RegisterChannelFilter( + "test-filter", GRPC_SERVER_CHANNEL, INT_MAX, nullptr); + } } void SetUp() override { diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index d112611ef35..858b88eb01b 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -187,7 +187,9 @@ grpc_cc_test( external_deps = [ "gtest", ], - tags = ["nomsan"], # death tests seem to be incompatible with msan + tags = ["nomsan", # death tests seem to be incompatible with msan + "no_test_ios" + ], deps = [ ":grpc_cli_libs", ":test_util", diff --git a/third_party/objective_c/google_toolbox_for_mac/BUILD b/third_party/objective_c/google_toolbox_for_mac/BUILD new file mode 100644 index 00000000000..dc505f30fc3 --- /dev/null +++ b/third_party/objective_c/google_toolbox_for_mac/BUILD @@ -0,0 +1,31 @@ +# gRPC Bazel BUILD file. +# +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +licenses(["notice"]) +native.objc_library( + name = "GTM_GoogleTestRunner_GTM_USING_XCTEST", + testonly = 1, + srcs = [ + "UnitTesting/GTMGoogleTestRunner.mm", + ], + copts = [ + "-DGTM_USING_XCTEST", + ], + deps = [ + "//external:gtest", + ], + visibility = ["//visibility:public"] +) diff --git a/third_party/objective_c/google_toolbox_for_mac/UnitTesting/GTMGoogleTestRunner.mm b/third_party/objective_c/google_toolbox_for_mac/UnitTesting/GTMGoogleTestRunner.mm new file mode 100644 index 00000000000..3e8e9245fd4 --- /dev/null +++ b/third_party/objective_c/google_toolbox_for_mac/UnitTesting/GTMGoogleTestRunner.mm @@ -0,0 +1,233 @@ +// +// GTMGoogleTestRunner.mm +// +// Copyright 2013 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may not +// use this file except in compliance with the License. You may obtain a copy +// of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations under +// the License. +// + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +// This is a SenTest/XCTest based unit test that will run all of the GoogleTest +// https://code.google.com/p/googletest/ +// based tests in the project, and will report results correctly via SenTest so +// that Xcode can pick them up in it's UI. + +// SenTest dynamically creates one SenTest per GoogleTest. +// GoogleTest is set up using a custom event listener (GoogleTestPrinter) +// which knows how to log GoogleTest test results in a manner that SenTest (and +// the Xcode IDE) understand. + +// Note that this does not able you to control individual tests from the Xcode +// UI. You can only turn on/off all of the C++ tests. It does however give +// you output that you can click on in the Xcode UI and immediately jump to a +// test failure. + +// This class is not compiled as part of the standard Google Toolbox For Mac +// project because of it's dependency on https://code.google.com/p/googletest/ + +// To use this: +// - If you are using XCTest (vs SenTest) make sure to define GTM_USING_XCTEST +// in the settings for your testing bundle. +// - Add GTMGoogleTestRunner to your test bundle sources. +// - Add gtest-all.cc from gtest to your test bundle sources. +// - Write some C++ tests and add them to your test bundle sources. +// - Build and run tests. Your C++ tests should just execute. + +// If you are using this with XCTest (as opposed to SenTestingKit) +// make sure to define GTM_USING_XCTEST. +#ifndef GTM_USING_XCTEST +#define GTM_USING_XCTEST 0 +#endif + +#if GTM_USING_XCTEST +#import +#define SenTestCase XCTestCase +#define SenTestSuite XCTestSuite +#else // GTM_USING_XCTEST +#import +#endif // GTM_USING_XCTEST + +#import + +#include + +using ::testing::EmptyTestEventListener; +using ::testing::TestCase; +using ::testing::TestEventListeners; +using ::testing::TestInfo; +using ::testing::TestPartResult; +using ::testing::TestResult; +using ::testing::UnitTest; + +namespace { + +// A gtest printer that takes care of reporting gtest results via the +// SenTest interface. Note that a test suite in SenTest == a test case in gtest +// and a test case in SenTest == a test in gtest. +// This will handle fatal and non-fatal gtests properly. +class GoogleTestPrinter : public EmptyTestEventListener { + public: + GoogleTestPrinter(SenTestCase *test_case) : test_case_(test_case) {} + + virtual ~GoogleTestPrinter() {} + + virtual void OnTestPartResult(const TestPartResult &test_part_result) { + if (!test_part_result.passed()) { + NSString *file = @(test_part_result.file_name()); + int line = test_part_result.line_number(); + NSString *summary = @(test_part_result.summary()); + + // gtest likes to give multi-line summaries. These don't look good in + // the Xcode UI, so we clean them up. + NSString *oneLineSummary = + [summary stringByReplacingOccurrencesOfString:@"\n" withString:@" "]; +#if GTM_USING_XCTEST + BOOL expected = test_part_result.nonfatally_failed(); + [test_case_ recordFailureWithDescription:oneLineSummary + inFile:file + atLine:line + expected:expected]; +#else // GTM_USING_XCTEST + NSException *exception = + [NSException failureInFile:file + atLine:line + withDescription:@"%@", oneLineSummary]; + + // failWithException: will log appropriately. + [test_case_ failWithException:exception]; +#endif // GTM_USING_XCTEST + } + } + + private: + SenTestCase *test_case_; +}; + +NSString *SelectorNameFromGTestName(NSString *testName) { + NSRange dot = [testName rangeOfString:@"."]; + return [NSString stringWithFormat:@"%@::%@", + [testName substringToIndex:dot.location], + [testName substringFromIndex:dot.location + 1]]; +} + +} // namespace + +// GTMGoogleTestRunner is a GTMTestCase that makes a sub test suite populated +// with all of the GoogleTest unit tests. +@interface GTMGoogleTestRunner : SenTestCase { + NSString *testName_; +} + +// The name for a test is the GoogleTest name which is "TestCase.Test" +- (id)initWithName:(NSString *)testName; +@end + +@implementation GTMGoogleTestRunner + ++ (void)initGoogleTest { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + NSArray *arguments = [NSProcessInfo processInfo].arguments; + int argc = (int)arguments.count; + char **argv = static_cast(alloca((sizeof(char *) * (argc + 1)))); + for (int index = 0; index < argc; index++) { + argv[index] = const_cast ([arguments[index] UTF8String]); + } + argv[argc] = NULL; + + testing::InitGoogleTest(&argc, argv); + }); +} + ++ (id)defaultTestSuite { + [GTMGoogleTestRunner initGoogleTest]; + SenTestSuite *result = + [[SenTestSuite alloc] initWithName:NSStringFromClass(self)]; + UnitTest *test = UnitTest::GetInstance(); + + // Walk the GoogleTest tests, adding sub tests and sub suites as appropriate. + int total_test_case_count = test->total_test_case_count(); + for (int i = 0; i < total_test_case_count; ++i) { + const TestCase *test_case = test->GetTestCase(i); + int total_test_count = test_case->total_test_count(); + SenTestSuite *subSuite = + [[SenTestSuite alloc] initWithName:@(test_case->name())]; + [result addTest:subSuite]; + for (int j = 0; j < total_test_count; ++j) { + const TestInfo *test_info = test_case->GetTestInfo(j); + NSString *testName = [NSString stringWithFormat:@"%s.%s", + test_case->name(), test_info->name()]; + SenTestCase *senTest = [[self alloc] initWithName:testName]; + [subSuite addTest:senTest]; + } + } + return result; +} + +- (id)initWithName:(NSString *)testName { + // Xcode 6.1 started taking the testName from the selector instead of calling + // -name. + // So we will add selectors to GTMGoogleTestRunner. + // They should all be unique because the selectors are named cppclass.method + // Filed as radar 18798444. + Class cls = [self class]; + NSString *selectorTestName = SelectorNameFromGTestName(testName); + SEL selector = sel_registerName([selectorTestName UTF8String]); + Method method = class_getInstanceMethod(cls, @selector(runGoogleTest)); + IMP implementation = method_getImplementation(method); + const char *encoding = method_getTypeEncoding(method); + if (!class_addMethod(cls, selector, implementation, encoding)) { + // If we can't add a method, we should blow up here. + [NSException raise:NSInternalInconsistencyException + format:@"Unable to add %@ to %@.", testName, cls]; + } + if ((self = [super initWithSelector:selector])) { + testName_ = testName; + } + return self; +} + +- (NSString *)name { + // A SenTest name must be "-[foo bar]" or it won't be parsed properly. + NSRange dot = [testName_ rangeOfString:@"."]; + return [NSString stringWithFormat:@"-[%@ %@]", + [testName_ substringToIndex:dot.location], + [testName_ substringFromIndex:dot.location + 1]]; +} + +- (void)runGoogleTest { + [GTMGoogleTestRunner initGoogleTest]; + + // Gets hold of the event listener list. + TestEventListeners& listeners = UnitTest::GetInstance()->listeners(); + + // Adds a listener to the end. Google Test takes the ownership. + listeners.Append(new GoogleTestPrinter(self)); + + // Remove the default printer. + delete listeners.Release(listeners.default_result_printer()); + + // Since there is no way of running a single GoogleTest directly, we use the + // filter mechanism in GoogleTest to simulate it for us. + ::testing::GTEST_FLAG(filter) = [testName_ UTF8String]; + + // Intentionally ignore return value of RUN_ALL_TESTS. We will be printing + // the output appropriately, and there is no reason to mark this test as + // "failed" if RUN_ALL_TESTS returns non-zero. + (void)RUN_ALL_TESTS(); +} + +@end diff --git a/tools/internal_ci/macos/grpc_bazel_cpp_ios_tests.cfg b/tools/internal_ci/macos/grpc_bazel_cpp_ios_tests.cfg new file mode 100644 index 00000000000..ccc27e8fbe5 --- /dev/null +++ b/tools/internal_ci/macos/grpc_bazel_cpp_ios_tests.cfg @@ -0,0 +1,19 @@ +# Copyright 2019 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/macos/grpc_run_bazel_cpp_ios_tests.sh" + diff --git a/tools/internal_ci/macos/grpc_run_bazel_cpp_ios_tests.sh b/tools/internal_ci/macos/grpc_run_bazel_cpp_ios_tests.sh new file mode 100644 index 00000000000..bc2a8295521 --- /dev/null +++ b/tools/internal_ci/macos/grpc_run_bazel_cpp_ios_tests.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Copyright 2019 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -ex + +# change to grpc repo root +cd $(dirname $0)/../../.. + +# Download bazel +temp_dir="$(mktemp -d)" +wget -q https://github.com/bazelbuild/bazel/releases/download/0.26.0/bazel-0.26.0-darwin-x86_64 -O "${temp_dir}/bazel" +chmod 755 "${temp_dir}/bazel" +export PATH="${temp_dir}:${PATH}" +# This should show ${temp_dir}/bazel +which bazel + +./tools/run_tests/start_port_server.py + +dirs=(end2end server client common codegen util grpclb test) +for dir in ${dirs[*]}; do + echo $dir + out=`bazel query "kind(ios_unit_test, tests(//test/cpp/$dir/...))"` + for test in $out; do + echo "Running: $test" + bazel test --test_summary=detailed --test_output=all $test + done +done From 7422a14a5d95ee637283febdd85fd4ef271b9417 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 14 Aug 2019 16:44:56 -0700 Subject: [PATCH 343/661] Added wrapper for objc_library in examples --- src/objective-c/examples/BUILD | 18 ++++------ .../grpc_objc_internal_library.bzl | 35 +++++++++++++++++++ 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index 3e25c5c7dfa..4d838b17ba0 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -20,6 +20,7 @@ package(default_visibility = ["//visibility:public"]) load( "//src/objective-c:grpc_objc_internal_library.bzl", + "grpc_objc_examples_library", "local_objc_grpc_library", "proto_library_objc_wrapper", ) @@ -41,7 +42,7 @@ proto_library_objc_wrapper( # use objc_grpc_library in bazel:objc_grpc_library.bzl when developing outside the repo local_objc_grpc_library( - name = "test_grpc_objc", + name = "RemoteTest", srcs = ["RemoteTestClient/test.proto"], use_well_known_protos = True, deps = [ @@ -58,7 +59,7 @@ local_objc_grpc_library( ], ) -objc_library( +grpc_objc_examples_library( name = "Sample-lib", srcs = glob(["Sample/Sample/**/*.m"]), hdrs = glob(["Sample/Sample/**/*.h"]), @@ -66,7 +67,6 @@ objc_library( "Sample/Sample/Base.lproj/**", "Sample/Sample/Images.xcassets/**", ]), - deps = [":test_grpc_objc"], ) ios_application( @@ -82,7 +82,7 @@ ios_application( visibility = ["//visibility:public"], ) -objc_library( +grpc_objc_examples_library( name = "InterceptorSample-lib", srcs = glob(["InterceptorSample/InterceptorSample/**/*.m"]), hdrs = glob(["InterceptorSample/InterceptorSample/**/*.h"]), @@ -90,7 +90,6 @@ objc_library( "InterceptorSample/InterceptorSample/Base.lproj/**", "InterceptorSample/InterceptorSample/Images.xcassets/**", ]), - deps = [":test_grpc_objc"], ) ios_application( @@ -105,7 +104,7 @@ ios_application( deps = ["InterceptorSample-lib"], ) -objc_library( +grpc_objc_examples_library( name = "tvOS-sample-lib", srcs = glob(["tvOS-sample/tvOS-sample/**/*.m"]), hdrs = glob(["tvOS-sample/tvOS-sample/**/*.h"]), @@ -113,7 +112,6 @@ objc_library( "tvOS-sample/tvOS-sample/Base.lproj/**", "tvOS-sample/tvOS-sample/Images.xcassets/**", ]), - deps = [":test_grpc_objc"], ) # c-ares does not support tvOS CPU architecture with Bazel yet @@ -125,7 +123,7 @@ tvos_application( deps = [":tvOS-sample-lib"], ) -objc_library( +grpc_objc_examples_library( name = "watchOS-sample-iOS-lib", srcs = glob(["watchOS-sample/watchOS-sample/**/*.m"]), hdrs = glob(["watchOS-sample/watchOS-sample/**/*.h"]), @@ -133,14 +131,12 @@ objc_library( "watchOS-sample/watchOS-sample/Base.lproj/**", "watchOS-sample/watchOS-sample/Images.xcassets/**", ]), - deps = [":test_grpc_objc"], ) -objc_library( +grpc_objc_examples_library( name = "watchOS-sample-extension-lib", srcs = glob(["watchOS-sample/WatchKit-Extention/**/*.m"]), hdrs = glob(["watchOS-sample/WatchKit-Extension/**/*.h"]), - deps = [":test_grpc_objc"], sdk_frameworks = [ "WatchConnectivity", "WatchKit", diff --git a/src/objective-c/grpc_objc_internal_library.bzl b/src/objective-c/grpc_objc_internal_library.bzl index 7035e963b94..c90293d827d 100644 --- a/src/objective-c/grpc_objc_internal_library.bzl +++ b/src/objective-c/grpc_objc_internal_library.bzl @@ -45,6 +45,41 @@ def proto_library_objc_wrapper( deps = deps, ) +def grpc_objc_examples_library( + name, + srcs = [], + hdrs = [], + textual_hdrs = [], + data = [], + deps = [], + defines = [], + sdk_frameworks = [], + includes = []): + """objc_library for testing, only works in //src/objective-c/exmaples + + Args: + name: name of target + hdrs: public headers + srcs: all source files (.m) + textual_hdrs: private headers + data: any other bundle resources + defines: preprocessors + sdk_frameworks: sdks + includes: added to search path, always [the path to objc directory] + deps: dependencies + """ + native.objc_library( + name = name, + srcs = srcs, + hdrs = hdrs, + textual_hdrs = textual_hdrs, + data = data, + defines = defines, + includes = includes, + sdk_frameworks = sdk_frameworks, + deps = deps + [":RemoteTest"], + ) + def grpc_objc_testing_library( name, srcs = [], From b4eefcfc0e4b18c79674c073efa326649f6ec8b3 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 14 Aug 2019 16:47:29 -0700 Subject: [PATCH 344/661] Added source of new CPUs --- third_party/cares/cares.BUILD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/third_party/cares/cares.BUILD b/third_party/cares/cares.BUILD index 596dd06f88e..203712b182f 100644 --- a/third_party/cares/cares.BUILD +++ b/third_party/cares/cares.BUILD @@ -44,6 +44,8 @@ config_setting( values = {"cpu": "ios_arm64"}, ) +# The following architectures are found in +# https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/rules/apple/ApplePlatform.java config_setting( name = "tvos_x86_64", values = {"cpu": "tvos_x86_64"}, From eb2ed99a841fd5ec98ed6ad4f9f665cb964e93db Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 14 Aug 2019 17:07:59 -0700 Subject: [PATCH 345/661] Changed visibility to public --- src/objective-c/tests/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index 2d0a57ac21d..d34807f017f 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -16,7 +16,7 @@ licenses(["notice"]) # Apache v2 -package(default_visibility = ["//visibility:private"]) +package(default_visibility = ["//visibility:public"]) load( "//src/objective-c:grpc_objc_internal_library.bzl", From e3f5320ae28c3b73f27a5fd6988ad9d747dcd5b1 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Thu, 15 Aug 2019 16:29:39 +0800 Subject: [PATCH 346/661] remove LICENSE and notes file, Modify the identifier name, --- examples/python/easy_start_demo/LICENSE | 373 ------------------ examples/python/easy_start_demo/PyClient.py | 93 ----- examples/python/easy_start_demo/README.md | 2 - examples/python/easy_start_demo/client.py | 98 +++++ examples/python/easy_start_demo/demo.proto | 6 +- .../demo_pb2.py | 16 +- .../demo_pb2_grpc.py | 49 ++- examples/python/easy_start_demo/notes | 3 - .../{PyServer.py => server.py} | 42 +- 9 files changed, 162 insertions(+), 520 deletions(-) delete mode 100644 examples/python/easy_start_demo/LICENSE delete mode 100644 examples/python/easy_start_demo/PyClient.py create mode 100644 examples/python/easy_start_demo/client.py rename examples/python/easy_start_demo/{customGrpcPackages => demo_grpc_pbs}/demo_pb2.py (88%) rename examples/python/easy_start_demo/{customGrpcPackages => demo_grpc_pbs}/demo_pb2_grpc.py (61%) delete mode 100644 examples/python/easy_start_demo/notes rename examples/python/easy_start_demo/{PyServer.py => server.py} (63%) diff --git a/examples/python/easy_start_demo/LICENSE b/examples/python/easy_start_demo/LICENSE deleted file mode 100644 index a612ad9813b..00000000000 --- a/examples/python/easy_start_demo/LICENSE +++ /dev/null @@ -1,373 +0,0 @@ -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. diff --git a/examples/python/easy_start_demo/PyClient.py b/examples/python/easy_start_demo/PyClient.py deleted file mode 100644 index 383cdb5afed..00000000000 --- a/examples/python/easy_start_demo/PyClient.py +++ /dev/null @@ -1,93 +0,0 @@ -""" -Author: Zhongying Wang -Email: kerbalwzy@gmail.com -License: MPL2 -DateTime: 2019-08-13T23:30:00Z -PythonVersion: Python3.6.3 -""" -import grpc -import time -from customGrpcPackages import demo_pb2, demo_pb2_grpc - -# Constants -PyGrpcServerAddress = "127.0.0.1:23334" -ClientId = 1 - - -# 简单模式 -# Simple -def simple_method(stub): - print("--------------Call SimpleMethod Begin--------------") - req = demo_pb2.Request(Cid=ClientId, ReqMsg="called by Python client") - resp = stub.SimpleMethod(req) - print(f"resp from server({resp.Sid}), the message={resp.RespMsg}") - print("--------------Call SimpleMethod Over---------------") - - -# 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) -# Request-streaming (In a single call, the client can transfer data to the server several times, -# but the server can only return a response once.) -def c_stream_method(stub): - print("--------------Call CStreamMethod Begin--------------") - - # 创建一个生成器 - # create a generator - def req_msgs(): - for i in range(5): - req = demo_pb2.Request(Cid=ClientId, ReqMsg=f"called by Python client, message: {i}") - yield req - - resp = stub.CStreamMethod(req_msgs()) - print(f"resp from server({resp.Sid}), the message={resp.RespMsg}") - print("--------------Call CStreamMethod Over---------------") - - -# 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) -# Response-streaming (In a single call, the client can only transmit data to the server at one time, -# but the server can return the response many times.) -def s_stream_method(stub): - print("--------------Call SStreamMethod Begin--------------") - req = demo_pb2.Request(Cid=ClientId, ReqMsg="called by Python client") - resp_s = stub.SStreamMethod(req) - for resp in resp_s: - print(f"recv from server({resp.Sid}, message={resp.RespMsg})") - - print("--------------Call SStreamMethod Over---------------") - - -# 双向流模式 (在一次调用中, 客户端和服务器都可以向对方多次收发数据) -# Bidirectional Streaming (In a single call, both client and server can send and receive data -# to each other multiple times.) -def twf_method(stub): - print("--------------Call TWFMethod Begin---------------") - - # 创建一个生成器 - # create a generator - def req_msgs(): - for i in range(5): - req = demo_pb2.Request(Cid=ClientId, ReqMsg=f"called by Python client, message: {i}") - yield req - time.sleep(1) - - resp_s = stub.TWFMethod(req_msgs()) - for resp in resp_s: - print(f"recv from server({resp.Sid}, message={resp.RespMsg})") - - print("--------------Call TWFMethod Over---------------") - - -def main(): - with grpc.insecure_channel(PyGrpcServerAddress) as channel: - stub = demo_pb2_grpc.GRPCDemoStub(channel) - - simple_method(stub) - - c_stream_method(stub) - - s_stream_method(stub) - - twf_method(stub) - - -if __name__ == '__main__': - main() diff --git a/examples/python/easy_start_demo/README.md b/examples/python/easy_start_demo/README.md index 5b8ee8c5b3e..50529c57df5 100644 --- a/examples/python/easy_start_demo/README.md +++ b/examples/python/easy_start_demo/README.md @@ -30,8 +30,6 @@ Author: Zhongying Wang Email: kerbalwzy@gmail.com -License: MPL2 - DateTime: 2019-08-13T23:30:00Z PythonVersion: Python3.6.3 \ No newline at end of file diff --git a/examples/python/easy_start_demo/client.py b/examples/python/easy_start_demo/client.py new file mode 100644 index 00000000000..46d11d05cbf --- /dev/null +++ b/examples/python/easy_start_demo/client.py @@ -0,0 +1,98 @@ +""" +Author: Zhongying Wang +Email: kerbalwzy@gmail.com +DateTime: 2019-08-13T23:30:00Z +PythonVersion: Python3.6.3 +""" +import os +import sys +import time +import grpc + +# add the `demo_grpc_dps` dir into python package search paths +BaseDir = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.join(BaseDir, "demo_grpc_pbs")) + +from demo_grpc_pbs import demo_pb2, demo_pb2_grpc + +ServerAddress = "127.0.0.1:23334" +ClientId = 1 + + +# 简单模式 +# Simple Method +def simple_method(stub): + print("--------------Call SimpleMethod Begin--------------") + req = demo_pb2.Request(Cid=ClientId, ReqMsg="called by Python client") + resp = stub.SimpleMethod(req) + print("resp from server(%d), the message=%s" % (resp.Sid, resp.RespMsg)) + print("--------------Call SimpleMethod Over---------------") + + +# 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) +# Request-streaming (In a single call, the client can transfer data to the server several times, +# but the server can only return a response once.) +def client_streaming_method(stub): + print("--------------Call ClientStreamingMethod Begin--------------") + + # 创建一个生成器 + # create a generator + def request_messages(): + for i in range(5): + req = demo_pb2.Request(Cid=ClientId, ReqMsg=("called by Python client, message:%d" % i)) + yield req + + resp = stub.ClientStreamingMethod(request_messages()) + print("resp from server(%d), the message=%s" % (resp.Sid, resp.RespMsg)) + print("--------------Call ClientStreamingMethod Over---------------") + + +# 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) +# Response-streaming (In a single call, the client can only transmit data to the server at one time, +# but the server can return the response many times.) +def server_streaming_method(stub): + print("--------------Call ServerStreamingMethod Begin--------------") + req = demo_pb2.Request(Cid=ClientId, ReqMsg="called by Python client") + resp_s = stub.ServerStreamingMethod(req) + for resp in resp_s: + print("recv from server(%d), message=%s" % (resp.Sid, resp.RespMsg)) + + print("--------------Call ServerStreamingMethod Over---------------") + + +# 双向流模式 (在一次调用中, 客户端和服务器都可以向对方多次收发数据) +# Bidirectional Streaming (In a single call, both client and server can send and receive data +# to each other multiple times.) +def bidirectional_streaming_method(stub): + print("--------------Call BidirectionalStreamingMethod Begin---------------") + + # 创建一个生成器 + # create a generator + def req_messages(): + for i in range(5): + req = demo_pb2.Request(Cid=ClientId, ReqMsg=("called by Python client, message: %d" % i)) + yield req + time.sleep(1) + + resp_s = stub.BidirectionalStreamingMethod(req_messages()) + for resp in resp_s: + print("recv from server(%d), message=%s" % (resp.Sid, resp.RespMsg)) + + print("--------------Call BidirectionalStreamingMethod Over---------------") + + +def main(): + with grpc.insecure_channel(ServerAddress) as channel: + stub = demo_pb2_grpc.GRPCDemoStub(channel) + + simple_method(stub) + + client_streaming_method(stub) + + server_streaming_method(stub) + + bidirectional_streaming_method(stub) + + +if __name__ == '__main__': + main() diff --git a/examples/python/easy_start_demo/demo.proto b/examples/python/easy_start_demo/demo.proto index a9506cf92a1..2844ba7b225 100644 --- a/examples/python/easy_start_demo/demo.proto +++ b/examples/python/easy_start_demo/demo.proto @@ -36,16 +36,16 @@ service GRPCDemo { // 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) // Request-streaming (In a single call, the client can transfer data to the server several times, // but the server can only return a response once.) - rpc CStreamMethod (stream Request) returns (Response); + rpc ClientStreamingMethod (stream Request) returns (Response); // 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) // Response-streaming (In a single call, the client can only transmit data to the server at one time, // but the server can return the response many times.) - rpc SStreamMethod (Request) returns (stream Response); + rpc ServerStreamingMethod (Request) returns (stream Response); // 双向流模式 (在一次调用中, 客户端和服务器都可以向对方多次收发数据) // Bidirectional streaming (In a single call, both client and server can send and receive data // to each other multiple times.) - rpc TWFMethod (stream Request) returns (stream Response); + rpc BidirectionalStreamingMethod (stream Request) returns (stream Response); } diff --git a/examples/python/easy_start_demo/customGrpcPackages/demo_pb2.py b/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2.py similarity index 88% rename from examples/python/easy_start_demo/customGrpcPackages/demo_pb2.py rename to examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2.py index 4df1dad0b43..de960c8a6c1 100644 --- a/examples/python/easy_start_demo/customGrpcPackages/demo_pb2.py +++ b/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2.py @@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor.FileDescriptor( package='demo', syntax='proto3', serialized_options=None, - serialized_pb=_b('\n\ndemo.proto\x12\x04\x64\x65mo\"&\n\x07Request\x12\x0b\n\x03\x43id\x18\x01 \x01(\x03\x12\x0e\n\x06ReqMsg\x18\x02 \x01(\t\"(\n\x08Response\x12\x0b\n\x03Sid\x18\x01 \x01(\x03\x12\x0f\n\x07RespMsg\x18\x02 \x01(\t2\xcd\x01\n\x08GRPCDemo\x12-\n\x0cSimpleMethod\x12\r.demo.Request\x1a\x0e.demo.Response\x12\x30\n\rCStreamMethod\x12\r.demo.Request\x1a\x0e.demo.Response(\x01\x12\x30\n\rSStreamMethod\x12\r.demo.Request\x1a\x0e.demo.Response0\x01\x12.\n\tTWFMethod\x12\r.demo.Request\x1a\x0e.demo.Response(\x01\x30\x01\x62\x06proto3') + serialized_pb=_b('\n\ndemo.proto\x12\x04\x64\x65mo\"&\n\x07Request\x12\x0b\n\x03\x43id\x18\x01 \x01(\x03\x12\x0e\n\x06ReqMsg\x18\x02 \x01(\t\"(\n\x08Response\x12\x0b\n\x03Sid\x18\x01 \x01(\x03\x12\x0f\n\x07RespMsg\x18\x02 \x01(\t2\xf0\x01\n\x08GRPCDemo\x12-\n\x0cSimpleMethod\x12\r.demo.Request\x1a\x0e.demo.Response\x12\x38\n\x15\x43lientStreamingMethod\x12\r.demo.Request\x1a\x0e.demo.Response(\x01\x12\x38\n\x15ServerStreamingMethod\x12\r.demo.Request\x1a\x0e.demo.Response0\x01\x12\x41\n\x1c\x42idirectionalStreamingMethod\x12\r.demo.Request\x1a\x0e.demo.Response(\x01\x30\x01\x62\x06proto3') ) @@ -128,7 +128,7 @@ _GRPCDEMO = _descriptor.ServiceDescriptor( index=0, serialized_options=None, serialized_start=103, - serialized_end=308, + serialized_end=343, methods=[ _descriptor.MethodDescriptor( name='SimpleMethod', @@ -140,8 +140,8 @@ _GRPCDEMO = _descriptor.ServiceDescriptor( serialized_options=None, ), _descriptor.MethodDescriptor( - name='CStreamMethod', - full_name='demo.GRPCDemo.CStreamMethod', + name='ClientStreamingMethod', + full_name='demo.GRPCDemo.ClientStreamingMethod', index=1, containing_service=None, input_type=_REQUEST, @@ -149,8 +149,8 @@ _GRPCDEMO = _descriptor.ServiceDescriptor( serialized_options=None, ), _descriptor.MethodDescriptor( - name='SStreamMethod', - full_name='demo.GRPCDemo.SStreamMethod', + name='ServerStreamingMethod', + full_name='demo.GRPCDemo.ServerStreamingMethod', index=2, containing_service=None, input_type=_REQUEST, @@ -158,8 +158,8 @@ _GRPCDEMO = _descriptor.ServiceDescriptor( serialized_options=None, ), _descriptor.MethodDescriptor( - name='TWFMethod', - full_name='demo.GRPCDemo.TWFMethod', + name='BidirectionalStreamingMethod', + full_name='demo.GRPCDemo.BidirectionalStreamingMethod', index=3, containing_service=None, input_type=_REQUEST, diff --git a/examples/python/easy_start_demo/customGrpcPackages/demo_pb2_grpc.py b/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2_grpc.py similarity index 61% rename from examples/python/easy_start_demo/customGrpcPackages/demo_pb2_grpc.py rename to examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2_grpc.py index 4aaccf1144a..0f7d5dabbd6 100644 --- a/examples/python/easy_start_demo/customGrpcPackages/demo_pb2_grpc.py +++ b/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2_grpc.py @@ -1,12 +1,12 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc -from . import demo_pb2 as demo__pb2 +import demo_pb2 as demo__pb2 class GRPCDemoStub(object): - """服务service是用来gRPC的方法的, 格式固定 - 类似于Python中定义一个类, 类似于Golang中定义一个接口 + """service是用来给GRPC服务定义方法的, 格式固定, 类似于Golang中定义一个接口 + `service` is used to define methods for GRPC services in a fixed format, similar to defining an interface in Golang """ def __init__(self, channel): @@ -20,51 +20,58 @@ class GRPCDemoStub(object): request_serializer=demo__pb2.Request.SerializeToString, response_deserializer=demo__pb2.Response.FromString, ) - self.CStreamMethod = channel.stream_unary( - '/demo.GRPCDemo/CStreamMethod', + self.ClientStreamingMethod = channel.stream_unary( + '/demo.GRPCDemo/ClientStreamingMethod', request_serializer=demo__pb2.Request.SerializeToString, response_deserializer=demo__pb2.Response.FromString, ) - self.SStreamMethod = channel.unary_stream( - '/demo.GRPCDemo/SStreamMethod', + self.ServerStreamingMethod = channel.unary_stream( + '/demo.GRPCDemo/ServerStreamingMethod', request_serializer=demo__pb2.Request.SerializeToString, response_deserializer=demo__pb2.Response.FromString, ) - self.TWFMethod = channel.stream_stream( - '/demo.GRPCDemo/TWFMethod', + self.BidirectionalStreamingMethod = channel.stream_stream( + '/demo.GRPCDemo/BidirectionalStreamingMethod', request_serializer=demo__pb2.Request.SerializeToString, response_deserializer=demo__pb2.Response.FromString, ) class GRPCDemoServicer(object): - """服务service是用来gRPC的方法的, 格式固定 - 类似于Python中定义一个类, 类似于Golang中定义一个接口 + """service是用来给GRPC服务定义方法的, 格式固定, 类似于Golang中定义一个接口 + `service` is used to define methods for GRPC services in a fixed format, similar to defining an interface in Golang """ def SimpleMethod(self, request, context): """简单模式 + Simple """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') - def CStreamMethod(self, request_iterator, context): + def ClientStreamingMethod(self, request_iterator, context): """客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) + Request-streaming (In a single call, the client can transfer data to the server several times, + but the server can only return a response once.) """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') - def SStreamMethod(self, request, context): + def ServerStreamingMethod(self, request, context): """服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) + Response-streaming (In a single call, the client can only transmit data to the server at one time, + but the server can return the response many times.) """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') - def TWFMethod(self, request_iterator, context): - """双向流模式 (在一次调用中, 客户端和服务器都可以向对象多次收发数据) + def BidirectionalStreamingMethod(self, request_iterator, context): + """双向流模式 (在一次调用中, 客户端和服务器都可以向对方多次收发数据) + Bidirectional streaming (In a single call, both client and server can send and receive data + to each other multiple times.) """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') @@ -78,18 +85,18 @@ def add_GRPCDemoServicer_to_server(servicer, server): request_deserializer=demo__pb2.Request.FromString, response_serializer=demo__pb2.Response.SerializeToString, ), - 'CStreamMethod': grpc.stream_unary_rpc_method_handler( - servicer.CStreamMethod, + 'ClientStreamingMethod': grpc.stream_unary_rpc_method_handler( + servicer.ClientStreamingMethod, request_deserializer=demo__pb2.Request.FromString, response_serializer=demo__pb2.Response.SerializeToString, ), - 'SStreamMethod': grpc.unary_stream_rpc_method_handler( - servicer.SStreamMethod, + 'ServerStreamingMethod': grpc.unary_stream_rpc_method_handler( + servicer.ServerStreamingMethod, request_deserializer=demo__pb2.Request.FromString, response_serializer=demo__pb2.Response.SerializeToString, ), - 'TWFMethod': grpc.stream_stream_rpc_method_handler( - servicer.TWFMethod, + 'BidirectionalStreamingMethod': grpc.stream_stream_rpc_method_handler( + servicer.BidirectionalStreamingMethod, request_deserializer=demo__pb2.Request.FromString, response_serializer=demo__pb2.Response.SerializeToString, ), diff --git a/examples/python/easy_start_demo/notes b/examples/python/easy_start_demo/notes deleted file mode 100644 index f0518fc1746..00000000000 --- a/examples/python/easy_start_demo/notes +++ /dev/null @@ -1,3 +0,0 @@ -//自动生成代码 -//Automatic code generation ->>> python -m grpc_tools.protoc -I ./ ./demo.proto --python_out=./customGrpcPackages --grpc_python_out=./customGrpcPackages \ No newline at end of file diff --git a/examples/python/easy_start_demo/PyServer.py b/examples/python/easy_start_demo/server.py similarity index 63% rename from examples/python/easy_start_demo/PyServer.py rename to examples/python/easy_start_demo/server.py index cfef6bf516a..a4130719ada 100644 --- a/examples/python/easy_start_demo/PyServer.py +++ b/examples/python/easy_start_demo/server.py @@ -1,18 +1,23 @@ """ Author: Zhongying Wang Email: kerbalwzy@gmail.com -License: MPL2 DateTime: 2019-08-13T23:30:00Z PythonVersion: Python3.6.3 """ +import os +import sys import time - import grpc + from threading import Thread from concurrent import futures -from customGrpcPackages import demo_pb2, demo_pb2_grpc -# Constants +# add the `demo_grpc_dps` dir into python package search paths +BaseDir = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.join(BaseDir, "demo_grpc_pbs")) + +from demo_grpc_pbs import demo_pb2, demo_pb2_grpc + ServerAddress = '127.0.0.1:23334' ServerId = 1 @@ -22,49 +27,52 @@ class DemoServer(demo_pb2_grpc.GRPCDemoServicer): # 简单模式 # Simple def SimpleMethod(self, request, context): - print(f"SimpleMethod called by client({request.Cid}) the message: {request.ReqMsg}") + print("SimpleMethod called by client(%d) the message: %s" % (request.Cid, request.ReqMsg)) resp = demo_pb2.Response(Sid=ServerId, RespMsg="Python server SimpleMethod Ok!!!!") return resp # 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) # Request-streaming (In a single call, the client can transfer data to the server several times, # but the server can only return a response once.) - def CStreamMethod(self, request_iterator, context): - print("CStreamMethod called by client...") + def ClientStreamingMethod(self, request_iterator, context): + print("ClientStreamingMethod called by client...") for req in request_iterator: - print(f"recv from client({req.Cid}), message={req.ReqMsg}") - resp = demo_pb2.Response(Sid=ServerId, RespMsg="Python server CStreamMethod ok") + print("recv from client(%d), message= %s" % (req.Cid, req.ReqMsg)) + resp = demo_pb2.Response(Sid=ServerId, RespMsg="Python server ClientStreamingMethod ok") return resp # 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) # Response-streaming (In a single call, the client can only transmit data to the server at one time, # but the server can return the response many times.) - def SStreamMethod(self, request, context): - print(f"SStreamMethod called by client({request.Cid}), message={request.ReqMsg}") + def ServerStreamingMethod(self, request, context): + print("ServerStreamingMethod called by client(%d), message= %s" % (request.Cid, request.ReqMsg)) # 创建一个生成器 - def resp_msgs(): + # create a generator + def response_messages(): for i in range(5): - resp = demo_pb2.Response(Sid=ServerId, RespMsg=f"send by Python server, message={i}") + resp = demo_pb2.Response(Sid=ServerId, RespMsg=("send by Python server, message=%d" % i)) yield resp - return resp_msgs() + return response_messages() # 双向流模式 (在一次调用中, 客户端和服务器都可以向对方多次收发数据) # Bidirectional Streaming (In a single call, both client and server can send and receive data # to each other multiple times.) - def TWFMethod(self, request_iterator, context): + def BidirectionalStreamingMethod(self, request_iterator, context): + print("BidirectionalStreamingMethod called by client...") + # 开启一个子线程去接收数据 # Open a sub thread to receive data def parse_req(): for req in request_iterator: - print(f"recv from client{req.Cid}, message={req.ReqMsg}") + print("recv from client(%d), message= %s" % (req.Cid, req.ReqMsg)) t = Thread(target=parse_req) t.start() for i in range(5): - yield demo_pb2.Response(Sid=ServerId, RespMsg=f"send by Python server, message={i}") + yield demo_pb2.Response(Sid=ServerId, RespMsg=("send by Python server, message= %d" % i)) t.join() From f46396508422f3a126d41d66cc98deda7331f404 Mon Sep 17 00:00:00 2001 From: Joe Bolinger Date: Tue, 13 Aug 2019 21:36:25 -0700 Subject: [PATCH 347/661] Allow :: in ruby_package --- src/compiler/ruby_generator.cc | 14 +--- src/compiler/ruby_generator_string-inl.h | 23 +++++- .../grpc/testing/package_options_import.proto | 22 +++++ .../testing/package_options_ruby_style.proto | 34 ++++++++ .../spec/pb/codegen/package_option_spec.rb | 82 ++++++++++++------- 5 files changed, 133 insertions(+), 42 deletions(-) create mode 100644 src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto create mode 100644 src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto diff --git a/src/compiler/ruby_generator.cc b/src/compiler/ruby_generator.cc index e39d8be5d41..2a71aae32bb 100644 --- a/src/compiler/ruby_generator.cc +++ b/src/compiler/ruby_generator.cc @@ -40,13 +40,11 @@ namespace { // Prints out the method using the ruby gRPC DSL. void PrintMethod(const MethodDescriptor* method, const grpc::string& package, Printer* out) { - grpc::string input_type = - RubyTypeOf(method->input_type()->full_name(), package); + grpc::string input_type = RubyTypeOf(method->input_type(), package); if (method->client_streaming()) { input_type = "stream(" + input_type + ")"; } - grpc::string output_type = - RubyTypeOf(method->output_type()->full_name(), package); + grpc::string output_type = RubyTypeOf(method->output_type(), package); if (method->server_streaming()) { output_type = "stream(" + output_type + ")"; } @@ -160,13 +158,7 @@ grpc::string GetServices(const FileDescriptor* file) { return output; } - std::string package_name; - - if (file->options().has_ruby_package()) { - package_name = file->options().ruby_package(); - } else { - package_name = file->package(); - } + std::string package_name = RubyPackage(file); // Write out a file header. std::map header_comment_vars = ListToDict({ diff --git a/src/compiler/ruby_generator_string-inl.h b/src/compiler/ruby_generator_string-inl.h index ecfe796e7a2..7d6b50a516d 100644 --- a/src/compiler/ruby_generator_string-inl.h +++ b/src/compiler/ruby_generator_string-inl.h @@ -100,10 +100,29 @@ inline grpc::string Modularize(grpc::string s) { return new_string; } +// RubyPackage gets the ruby package in either proto or ruby_package format +inline grpc::string RubyPackage(const grpc::protobuf::FileDescriptor* file) { + grpc::string package_name = file->package(); + if (file->options().has_ruby_package()) { + package_name = file->options().ruby_package(); + + // If :: is in the package convert the Ruby formated name + // -> A::B::C + // to use the dot seperator notation + // -> A.B.C + package_name = ReplaceAll(package_name, "::", "."); + } + return package_name; +} + // RubyTypeOf updates a proto type to the required ruby equivalent. -inline grpc::string RubyTypeOf(const grpc::string& a_type, +inline grpc::string RubyTypeOf(const grpc::protobuf::Descriptor* descriptor, const grpc::string& package) { - grpc::string res(a_type); + std::string proto_type = descriptor->full_name(); + if (descriptor->file()->options().has_ruby_package()) { + proto_type = RubyPackage(descriptor->file()) + "." + descriptor->name(); + } + grpc::string res(proto_type); ReplacePrefix(&res, package, ""); // remove the leading package if present ReplacePrefix(&res, ".", ""); // remove the leading . (no package) if (res.find('.') == grpc::string::npos) { diff --git a/src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto b/src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto new file mode 100644 index 00000000000..2205d21b83e --- /dev/null +++ b/src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto @@ -0,0 +1,22 @@ +// Copyright 2019 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package grpc.testing; + +// For sanity checking package definitions +option ruby_package = "A::Other"; + +message Thing { } diff --git a/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto b/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto new file mode 100644 index 00000000000..4bfe61e2f63 --- /dev/null +++ b/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto @@ -0,0 +1,34 @@ +// Copyright 2019 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package grpc.testing; + +import "grpc/testing/package_options_import.proto"; + +// For sanity checking package definitions +option ruby_package = "RPC::Test::New::Package::Options"; + +message AnotherTestRequest { } + +message AnotherTestResponse { } + +message Foo { } + +service AnotherTestService { + rpc GetTest(AnotherTestRequest) returns (AnotherTestResponse) { } + rpc OtherTest(Thing) returns (Thing) { } + rpc FooTest(Foo) returns (Foo) { } +} diff --git a/src/ruby/spec/pb/codegen/package_option_spec.rb b/src/ruby/spec/pb/codegen/package_option_spec.rb index 0ebd503d79d..870f53ef297 100644 --- a/src/ruby/spec/pb/codegen/package_option_spec.rb +++ b/src/ruby/spec/pb/codegen/package_option_spec.rb @@ -18,35 +18,59 @@ require 'tmpdir' describe 'Code Generation Options' do it 'should generate and respect package options' do - fail 'CONFIG env variable unexpectedly unset' unless ENV['CONFIG'] - bins_sub_dir = ENV['CONFIG'] - - pb_dir = File.dirname(__FILE__) - bins_dir = File.join('..', '..', '..', '..', '..', 'bins', bins_sub_dir) - - plugin = File.join(bins_dir, 'grpc_ruby_plugin') - protoc = File.join(bins_dir, 'protobuf', 'protoc') - - # Generate the service from the proto - Dir.mktmpdir(nil, File.dirname(__FILE__)) do |tmp_dir| - gen_file = system(protoc, - '-I.', - 'grpc/testing/package_options.proto', - "--grpc_out=#{tmp_dir}", # generate the service - "--ruby_out=#{tmp_dir}", # generate the definitions - "--plugin=protoc-gen-grpc=#{plugin}", - chdir: pb_dir, - out: File::NULL) - - expect(gen_file).to be_truthy - begin - $LOAD_PATH.push(tmp_dir) - expect { Grpc::Testing::Package::Options::TestService::Service }.to raise_error(NameError) - expect(require('grpc/testing/package_options_services_pb')).to be_truthy - expect { Grpc::Testing::Package::Options::TestService::Service }.to_not raise_error - ensure - $LOAD_PATH.delete(tmp_dir) - end + with_protos(%w[grpc/testing/package_options.proto]) do + expect { Grpc::Testing::Package::Options::TestService::Service }.to raise_error(NameError) + expect(require('grpc/testing/package_options_services_pb')).to be_truthy + expect { Grpc::Testing::Package::Options::TestService::Service }.to_not raise_error + expect { Grpc::Testing::TestService::Service }.to raise_error(NameError) + end + end + + it 'should generate and respect Ruby style package options' do + with_protos(%w[grpc/testing/package_options_ruby_style.proto grpc/testing/package_options_import.proto]) do + expect { RPC::Test::New::Package::Options::AnotherTestService::Service }.to raise_error(NameError) + expect(require('grpc/testing/package_options_ruby_style_services_pb')).to be_truthy + expect { RPC::Test::New::Package::Options::AnotherTestService::Service }.to_not raise_error + expect { Grpc::Testing::AnotherTestService::Service }.to raise_error(NameError) + + services = RPC::Test::New::Package::Options::AnotherTestService::Service.rpc_descs + expect(services[:GetTest].input).to eq(RPC::Test::New::Package::Options::AnotherTestRequest) + expect(services[:GetTest].output).to eq(RPC::Test::New::Package::Options::AnotherTestResponse) + expect(services[:OtherTest].input).to eq(A::Other::Thing) + expect(services[:OtherTest].output).to eq(A::Other::Thing) + expect(services[:FooTest].input).to eq(RPC::Test::New::Package::Options::Foo) + expect(services[:FooTest].output).to eq(RPC::Test::New::Package::Options::Foo) + end + end +end + +def with_protos(file_paths) + fail 'CONFIG env variable unexpectedly unset' unless ENV['CONFIG'] + bins_sub_dir = ENV['CONFIG'] + + pb_dir = File.dirname(__FILE__) + bins_dir = File.join('..', '..', '..', '..', '..', 'bins', bins_sub_dir) + + plugin = File.join(bins_dir, 'grpc_ruby_plugin') + protoc = File.join(bins_dir, 'protobuf', 'protoc') + + # Generate the service from the proto + Dir.mktmpdir(nil, File.dirname(__FILE__)) do |tmp_dir| + gen_file = system(protoc, + '-I.', + *file_paths, + "--grpc_out=#{tmp_dir}", # generate the service + "--ruby_out=#{tmp_dir}", # generate the definitions + "--plugin=protoc-gen-grpc=#{plugin}", + chdir: pb_dir, + out: File::NULL) + + expect(gen_file).to be_truthy + begin + $LOAD_PATH.push(tmp_dir) + yield + ensure + $LOAD_PATH.delete(tmp_dir) end end end From 21c6531bc0df1501cc9188f35b5d4ddedfa6d5fa Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 15 Aug 2019 11:21:10 -0700 Subject: [PATCH 348/661] Added targets for other examples in objective-c examples --- examples/BUILD | 5 ++ examples/objective-c/BUILD | 58 +++++++++++++++++++ .../helloworld_macos/HelloWorld/Info.plist | 2 +- examples/objective-c/helloworld_macos/main.m | 4 ++ .../objective-c/route_guide/ViewControllers.m | 4 ++ test/build_test/BUILD | 2 +- 6 files changed, 73 insertions(+), 2 deletions(-) diff --git a/examples/BUILD b/examples/BUILD index aa9ed945849..6f801963c6e 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -238,3 +238,8 @@ cc_binary( "//:grpc++", ], ) + +proto_library( + name = "route_guide_proto", + srcs = ["protos/route_guide.proto"], +) diff --git a/examples/objective-c/BUILD b/examples/objective-c/BUILD index 9ceaaa9a8b4..4a5eafdf3fb 100644 --- a/examples/objective-c/BUILD +++ b/examples/objective-c/BUILD @@ -18,6 +18,7 @@ package(default_visibility = ["//visibility:public"]) load("@com_github_grpc_grpc//bazel:objc_grpc_library.bzl", "objc_grpc_library") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") +load("@build_bazel_rules_apple//apple:macos.bzl", "macos_application") objc_grpc_library( name = "HelloWorld_grpc_proto", @@ -59,3 +60,60 @@ ios_application( deps = [":HelloWorld-lib"], tags = ["manual"], ) + +objc_library( + name = "HelloWorldMacos-lib", + srcs = glob(["helloworld_macos/**/*.m",]), + hdrs = glob(["helloworld_macos/**/*.h"]), + data = glob([ + "helloworld_macos/HelloWorld/Base.lproj/**", + "helloworld_macos/HelloWorld/Images.xcassets/**", + ]), + includes = ["helloworld_macos/HelloWorld"], + deps = [":HelloWorld_grpc_proto"], + tags = ["manual"], +) + +macos_application( + name = "HelloWorldMacos", + bundle_id = "io.grpc.HelloWorld", + minimum_os_version = "10.13", + entitlements = "helloworld_macos/HelloWorld/Helloworld.entitlements", + infoplists = ["helloworld_macos/HelloWorld/Info.plist"], + deps = [":HelloWorldMacos-lib"], + tags = ["manual"], +) + +objc_grpc_library( + name = "RouteGuide", + srcs = ["//examples:protos/route_guide.proto"], + deps = ["//examples:route_guide_proto"], + tags = ["manual"], +) + +objc_library( + name = "RouteGuideClient-lib", + srcs = glob(["route_guide/**/*.m"]), + hdrs = glob(["route_guide/**/*.h"]), + data = glob([ + "route_guide/Misc/Base.lproj/**", + "route_guide/Misc/Images.xcassets/**", + "route_guide/route_guide_db.json", + ]), + includes = ["route_guide/Misc"], + deps = [":RouteGuide"], + tags = ["manual"], +) + +ios_application( + name = "RouteGuideClient", + bundle_id = "gRPC.RouteGuideClient", + families = [ + "iphone", + "ipad", + ], + minimum_os_version = "8.0", + infoplists = ["route_guide/Misc/Info.plist"], + deps = [":RouteGuideClient-lib"], + tags = ["manual"], +) diff --git a/examples/objective-c/helloworld_macos/HelloWorld/Info.plist b/examples/objective-c/helloworld_macos/HelloWorld/Info.plist index f7bfdac9d6f..c76261baef0 100644 --- a/examples/objective-c/helloworld_macos/HelloWorld/Info.plist +++ b/examples/objective-c/helloworld_macos/HelloWorld/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIconFile diff --git a/examples/objective-c/helloworld_macos/main.m b/examples/objective-c/helloworld_macos/main.m index ce24a9b1466..c0e7ef3c9ab 100644 --- a/examples/objective-c/helloworld_macos/main.m +++ b/examples/objective-c/helloworld_macos/main.m @@ -20,7 +20,11 @@ #import #import +#if COCOAPODS #import +#else +#import "examples/protos/Helloworld.pbrpc.h" +#endif static NSString * const kHostAddress = @"localhost:50051"; diff --git a/examples/objective-c/route_guide/ViewControllers.m b/examples/objective-c/route_guide/ViewControllers.m index 43d2082f585..f36bfe607b5 100644 --- a/examples/objective-c/route_guide/ViewControllers.m +++ b/examples/objective-c/route_guide/ViewControllers.m @@ -17,7 +17,11 @@ */ #import +#if COCOAPODS #import +#else +#import "examples/protos/RouteGuide.pbrpc.h" +#endif static NSString * const kHostAddress = @"localhost:50051"; diff --git a/test/build_test/BUILD b/test/build_test/BUILD index 90777266a14..dd2030ccda6 100644 --- a/test/build_test/BUILD +++ b/test/build_test/BUILD @@ -25,4 +25,4 @@ build_test( "//examples/objective-c:HelloWorld", ], tags = ["manual"], -) \ No newline at end of file +) From f037eac0a96096e41818024303863eaa7719f693 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 15 Aug 2019 13:37:14 -0700 Subject: [PATCH 349/661] Small fixes --- .../RemoteTestClientCpp/RemoteTestCpp.podspec | 16 +--------------- tools/run_tests/run_tests.py | 2 +- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec b/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec index a0f0e2e436a..debe2943208 100644 --- a/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec +++ b/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec @@ -33,21 +33,7 @@ Pod::Spec.new do |s| --grpc_out=. \ -I #{repo_root} \ -I #{well_known_types_dir} \ - #{proto_dir}/echo.proto - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{well_known_types_dir} \ - #{proto_dir}/echo_messages.proto - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{well_known_types_dir} \ - #{proto_dir}/simple_messages.proto + #{proto_dir}/echo.proto #{proto_dir}/echo_messages.proto #{proto_dir}/simple_messages.proto CMD s.pod_target_xcconfig = { diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 95c3d8ed1dd..1ff37ca85af 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1127,7 +1127,7 @@ class ObjCLanguage(object): shortname='ios-test-cfstream-tests', cpu_cost=1e6, environ=_FORCE_ENVIRON_FOR_WRAPPERS)) - # TODO: replace with run_one_test_bazel.sh when Bazel is stable + # TODO: replace with run_one_test_bazel.sh when Bazel-Xcode is stable out.append( self.config.job_spec( ['src/objective-c/tests/run_one_test.sh'], From 699f810cf234f97fad1d08e8cb57a7b9df10aa37 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 20 Jun 2019 19:51:12 -0700 Subject: [PATCH 350/661] Do not create streams after a GOAWAY has been received --- .../chttp2/transport/chttp2_transport.cc | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index f4b0f694142..7d6d6a80745 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -1198,10 +1198,30 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t, static void maybe_start_some_streams(grpc_chttp2_transport* t) { grpc_chttp2_stream* s; + /* cancel out streams that will never be started */ + if (t->goaway_error != GRPC_ERROR_NONE) { + while (grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) { + grpc_chttp2_cancel_stream( + t, s, + grpc_error_set_int( + GRPC_ERROR_CREATE_FROM_STATIC_STRING("GOAWAY received"), + GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE)); + } + return; + } + if (t->next_stream_id >= MAX_CLIENT_STREAM_ID) { + while (grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) { + grpc_chttp2_cancel_stream( + t, s, + grpc_error_set_int( + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"), + GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE)); + } + return; + } /* start streams where we have free grpc_chttp2_stream ids and free * concurrency */ - while (t->next_stream_id <= MAX_CLIENT_STREAM_ID && - grpc_chttp2_stream_map_size(&t->stream_map) < + while (grpc_chttp2_stream_map_size(&t->stream_map) < t->settings[GRPC_PEER_SETTINGS] [GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS] && grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) { @@ -1225,15 +1245,6 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) { grpc_chttp2_mark_stream_writable(t, s); grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM); } - /* cancel out streams that will never be started */ - while (t->next_stream_id >= MAX_CLIENT_STREAM_ID && - grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) { - grpc_chttp2_cancel_stream( - t, s, - grpc_error_set_int( - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"), - GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE)); - } } /* Flag that this closure barrier may be covering a write in a pollset, and so From 0f8dced6c44642ac53462eacffde1e682a0c8023 Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Tue, 13 Aug 2019 18:21:44 -0600 Subject: [PATCH 351/661] Define Struct::Status in Ruby Update error end2end test for loading when calling to_status. Update error end2end test for loading when calling to_rpc_status. --- .../end2end/errors_load_before_grpc_lib.rb | 20 +++++++++++++++++++ src/ruby/ext/grpc/rb_grpc.c | 3 +-- src/ruby/lib/grpc.rb | 1 + src/ruby/lib/grpc/errors.rb | 9 +++------ src/ruby/lib/grpc/google_rpc_status_utils.rb | 13 ++++++++---- src/ruby/lib/grpc/structs.rb | 15 ++++++++++++++ src/ruby/spec/errors_spec.rb | 1 + 7 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 src/ruby/lib/grpc/structs.rb diff --git a/src/ruby/end2end/errors_load_before_grpc_lib.rb b/src/ruby/end2end/errors_load_before_grpc_lib.rb index 7e6ff7696fa..56f7714fc7c 100755 --- a/src/ruby/end2end/errors_load_before_grpc_lib.rb +++ b/src/ruby/end2end/errors_load_before_grpc_lib.rb @@ -18,12 +18,32 @@ this_dir = File.expand_path(File.dirname(__FILE__)) grpc_lib_dir = File.join(File.dirname(this_dir), 'lib') $LOAD_PATH.unshift(grpc_lib_dir) unless $LOAD_PATH.include?(grpc_lib_dir) +def check_to_status(error) + my_status = error.to_status + fail('GRPC BadStatus#to_status not expected to return nil') if my_status.nil? + fail('GRPC BadStatus#to_status code expected to be 2') unless my_status.code == 2 + fail('GRPC BadStatus#to_status details expected to be unknown') unless my_status.details == 'unknown' + fail('GRPC BadStatus#to_status metadata expected to be empty hash') unless my_status.metadata == {} + fail('GRPC library loaded after BadStatus#to_status') if GRPC::Core.const_defined?(:Channel) +end + +def check_to_rpc_status(error) + my_rpc_status = error.to_rpc_status + fail('GRPC BadStatus#to_rpc_status expected to return nil') unless my_rpc_status.nil? + fail('GRPC library loaded after BadStatus#to_rpc_status') if GRPC::Core.const_defined?(:Channel) +end + def main fail('GRPC constant loaded before expected') if Object.const_defined?(:GRPC) require 'grpc/errors' fail('GRPC constant not loaded when expected') unless Object.const_defined?(:GRPC) fail('GRPC BadStatus not loaded after required') unless GRPC.const_defined?(:BadStatus) + fail('GRPC Core not loaded after required') unless GRPC.const_defined?(:Core) + fail('GRPC StatusCodes not loaded after required') unless GRPC::Core.const_defined?(:StatusCodes) fail('GRPC library loaded before required') if GRPC::Core.const_defined?(:Channel) + error = GRPC::BadStatus.new 2, 'unknown' + check_to_status(error) + check_to_rpc_status(error) require 'grpc' fail('GRPC library not loaded after required') unless GRPC::Core.const_defined?(:Channel) end diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index 147ab4ad087..77cabfca814 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -312,8 +312,7 @@ void Init_grpc_c() { grpc_rb_mGrpcCore = rb_define_module_under(grpc_rb_mGRPC, "Core"); grpc_rb_sNewServerRpc = rb_struct_define( "NewServerRpc", "method", "host", "deadline", "metadata", "call", NULL); - grpc_rb_sStatus = - rb_struct_define("Status", "code", "details", "metadata", NULL); + grpc_rb_sStatus = rb_const_get(rb_cStruct, rb_intern("Status")); sym_code = ID2SYM(rb_intern("code")); sym_details = ID2SYM(rb_intern("details")); sym_metadata = ID2SYM(rb_intern("metadata")); diff --git a/src/ruby/lib/grpc.rb b/src/ruby/lib/grpc.rb index 66b1b8db39f..e0e1c9cd9b6 100644 --- a/src/ruby/lib/grpc.rb +++ b/src/ruby/lib/grpc.rb @@ -15,6 +15,7 @@ ssl_roots_path = File.expand_path('../../../../etc/roots.pem', __FILE__) require_relative 'grpc/errors' +require_relative 'grpc/structs' require_relative 'grpc/grpc' require_relative 'grpc/logconfig' require_relative 'grpc/notifier' diff --git a/src/ruby/lib/grpc/errors.rb b/src/ruby/lib/grpc/errors.rb index e44043f3199..7a300eb2daa 100644 --- a/src/ruby/lib/grpc/errors.rb +++ b/src/ruby/lib/grpc/errors.rb @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +require_relative './structs' require_relative './core/status_codes' +require_relative './google_rpc_status_utils' # GRPC contains the General RPC module. module GRPC @@ -57,12 +59,7 @@ module GRPC # # @return [Google::Rpc::Status, nil] def to_rpc_status - # Lazily require google_rpc_status_utils to scope - # loading protobuf_c.so to the users of this method. - require_relative './google_rpc_status_utils' - status = to_status - return if status.nil? - GoogleRpcStatusUtils.extract_google_rpc_status(status) + GoogleRpcStatusUtils.extract_google_rpc_status(to_status) rescue Google::Protobuf::ParseError => parse_error GRPC.logger.warn('parse error: to_rpc_status failed') GRPC.logger.warn(parse_error) diff --git a/src/ruby/lib/grpc/google_rpc_status_utils.rb b/src/ruby/lib/grpc/google_rpc_status_utils.rb index f253b082b63..adf6cf615c7 100644 --- a/src/ruby/lib/grpc/google_rpc_status_utils.rb +++ b/src/ruby/lib/grpc/google_rpc_status_utils.rb @@ -12,8 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative './grpc' -require 'google/rpc/status_pb' +require_relative './structs' # GRPC contains the General RPC module. module GRPC @@ -28,8 +27,14 @@ module GRPC def self.extract_google_rpc_status(status) fail ArgumentError, 'bad type' unless status.is_a? Struct::Status grpc_status_details_bin_trailer = 'grpc-status-details-bin' - return nil if status.metadata[grpc_status_details_bin_trailer].nil? - Google::Rpc::Status.decode(status.metadata[grpc_status_details_bin_trailer]) + binstatus = status.metadata[grpc_status_details_bin_trailer] + return nil if binstatus.nil? + + # Lazily load grpc_c and protobuf_c.so for users of this method. + require_relative './grpc' + require 'google/rpc/status_pb' + + Google::Rpc::Status.decode(binstatus) end end end diff --git a/src/ruby/lib/grpc/structs.rb b/src/ruby/lib/grpc/structs.rb new file mode 100644 index 00000000000..e57f1b69619 --- /dev/null +++ b/src/ruby/lib/grpc/structs.rb @@ -0,0 +1,15 @@ +# Copyright 2015 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Struct.new('Status', :code, :details, :metadata) diff --git a/src/ruby/spec/errors_spec.rb b/src/ruby/spec/errors_spec.rb index bf27a537405..6fb22b15356 100644 --- a/src/ruby/spec/errors_spec.rb +++ b/src/ruby/spec/errors_spec.rb @@ -14,6 +14,7 @@ require 'spec_helper' require 'google/protobuf/well_known_types' +require 'google/rpc/status_pb' require_relative '../pb/src/proto/grpc/testing/messages_pb' describe GRPC::BadStatus do From 4076695969c645e7b487656c9aa61e2359b7e3f7 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 15 Aug 2019 16:48:37 -0700 Subject: [PATCH 352/661] Reviewer comments --- .../chttp2/transport/chttp2_transport.cc | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 7d6d6a80745..73235756dfb 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -1198,7 +1198,7 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t, static void maybe_start_some_streams(grpc_chttp2_transport* t) { grpc_chttp2_stream* s; - /* cancel out streams that will never be started */ + /* cancel out streams that haven't yet started if we have received a GOAWAY */ if (t->goaway_error != GRPC_ERROR_NONE) { while (grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) { grpc_chttp2_cancel_stream( @@ -1209,19 +1209,10 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) { } return; } - if (t->next_stream_id >= MAX_CLIENT_STREAM_ID) { - while (grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) { - grpc_chttp2_cancel_stream( - t, s, - grpc_error_set_int( - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"), - GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE)); - } - return; - } /* start streams where we have free grpc_chttp2_stream ids and free * concurrency */ - while (grpc_chttp2_stream_map_size(&t->stream_map) < + while (t->next_stream_id <= MAX_CLIENT_STREAM_ID && + grpc_chttp2_stream_map_size(&t->stream_map) < t->settings[GRPC_PEER_SETTINGS] [GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS] && grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) { @@ -1245,6 +1236,16 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) { grpc_chttp2_mark_stream_writable(t, s); grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM); } + /* cancel out streams that will never be started */ + if (t->next_stream_id >= MAX_CLIENT_STREAM_ID) { + while (grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) { + grpc_chttp2_cancel_stream( + t, s, + grpc_error_set_int( + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"), + GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE)); + } + } } /* Flag that this closure barrier may be covering a write in a pollset, and so From 5db1ae34b4a0fd8e0b81ecfc4e1eac5da2c6bba4 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 15 Aug 2019 20:13:39 -0700 Subject: [PATCH 353/661] Expose local credentials on Python layer --- .../grpc/_cython/_cygrpc/credentials.pxd.pxi | 5 ++ .../grpc/_cython/_cygrpc/credentials.pyx.pxi | 22 +++++++ .../grpcio/grpc/_cython/_cygrpc/grpc.pxi | 12 ++++ src/python/grpcio/grpc/_local_credentials.py | 57 +++++++++++++++++ src/python/grpcio_tests/tests/tests.json | 1 + .../grpcio_tests/tests/unit/BUILD.bazel | 1 + .../tests/unit/_local_credentials_test.py | 64 +++++++++++++++++++ 7 files changed, 162 insertions(+) create mode 100644 src/python/grpcio/grpc/_local_credentials.py create mode 100644 src/python/grpcio_tests/tests/unit/_local_credentials_test.py diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi index 05892b37324..ec647378a99 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi @@ -97,3 +97,8 @@ cdef class ServerCredentials: cdef object cert_config_fetcher # whether C-core has asked for the initial_cert_config cdef bint initial_cert_config_fetched + + +cdef class LocalChannelCredentials(ChannelCredentials): + + cdef readonly object _local_connect_type diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi index 2ec1c0bc427..ac88bbe7afc 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi @@ -328,3 +328,25 @@ cdef grpc_ssl_certificate_config_reload_status _server_cert_config_fetcher_wrapp cert_config.c_ssl_pem_key_cert_pairs_count) return GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW + +class LocalConnectType: + uds = UDS + local_tcp = LOCAL_TCP + +cdef class LocalChannelCredentials(ChannelCredentials): + + def __cinit__(self, grpc_local_connect_type local_connect_type): + self._local_connect_type = local_connect_type + + cdef grpc_channel_credentials *c(self) except *: + cdef grpc_local_connect_type local_connect_type + local_connect_type = self._local_connect_type + return grpc_local_credentials_create(local_connect_type) + +def channel_credentials_local(grpc_local_connect_type local_connect_type): + return LocalChannelCredentials(local_connect_type) + +def server_credentials_local(grpc_local_connect_type local_connect_type): + cdef ServerCredentials credentials = ServerCredentials() + credentials.c_credentials = grpc_local_server_credentials_create(local_connect_type) + return credentials diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index a674c34bb23..4bfb42026aa 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -584,6 +584,12 @@ cdef extern from "grpc/grpc_security.h": void grpc_auth_context_release(grpc_auth_context *context) + grpc_channel_credentials *grpc_local_credentials_create( + grpc_local_connect_type type) + grpc_server_credentials *grpc_local_server_credentials_create( + grpc_local_connect_type type) + + cdef extern from "grpc/compression.h": ctypedef enum grpc_compression_algorithm: @@ -624,3 +630,9 @@ cdef extern from "grpc/impl/codegen/compression_types.h": const char *_GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \ "GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY" + + +cdef extern from "grpc/grpc_security_constants.h": + ctypedef enum grpc_local_connect_type: + UDS + LOCAL_TCP diff --git a/src/python/grpcio/grpc/_local_credentials.py b/src/python/grpcio/grpc/_local_credentials.py new file mode 100644 index 00000000000..326820dee39 --- /dev/null +++ b/src/python/grpcio/grpc/_local_credentials.py @@ -0,0 +1,57 @@ + +# Copyright 2019 The gRPC authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""gRPC's local credential API.""" + +import enum +import grpc +from grpc._cython import cygrpc + + +@enum.unique +class LocalConnectType(enum.Enum): + """Type of local connections for which local channel/server credentials will be applied. + + Attributes: + UDS: Unix domain socket connections + LOCAL_TCP: Local TCP connections. + """ + UDS = cygrpc.LocalConnectType.uds + LOCAL_TCP = cygrpc.LocalConnectType.local_tcp + + +def local_channel_credentials(local_connect_type=LocalConnectType.LOCAL_TCP): + """Creates a local ChannelCredentials used for local connections. + + Args: + local_connect_type: Local connection type (either UDS or LOCAL_TCP) + + Returns: + A ChannelCredentials for use with a local Channel + """ + return grpc.ChannelCredentials( + cygrpc.channel_credentials_local(local_connect_type.value)) + + +def local_server_credentials(local_connect_type=LocalConnectType.LOCAL_TCP): + """Creates a local ServerCredentials used for local connections. + + Args: + local_connect_type: Local connection type (either UDS or LOCAL_TCP) + + Returns: + A ServerCredentials for use with a local Server + """ + return grpc.ServerCredentials( + cygrpc.server_credentials_local(local_connect_type.value)) diff --git a/src/python/grpcio_tests/tests/tests.json b/src/python/grpcio_tests/tests/tests.json index ab70943e5ed..c636ee5d4e3 100644 --- a/src/python/grpcio_tests/tests/tests.json +++ b/src/python/grpcio_tests/tests/tests.json @@ -53,6 +53,7 @@ "unit._interceptor_test.InterceptorTest", "unit._invalid_metadata_test.InvalidMetadataTest", "unit._invocation_defects_test.InvocationDefectsTest", + "unit._local_credentials_test.LocalCredentialsTest", "unit._logging_test.LoggingTest", "unit._metadata_code_details_test.MetadataCodeDetailsTest", "unit._metadata_flags_test.MetadataFlagsTest", diff --git a/src/python/grpcio_tests/tests/unit/BUILD.bazel b/src/python/grpcio_tests/tests/unit/BUILD.bazel index aede11e325f..baa8a4a3e6b 100644 --- a/src/python/grpcio_tests/tests/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/BUILD.bazel @@ -19,6 +19,7 @@ GRPCIO_TESTS_UNIT = [ "_interceptor_test.py", "_invalid_metadata_test.py", "_invocation_defects_test.py", + "_local_crednetials_test.py", "_logging_test.py", "_metadata_code_details_test.py", "_metadata_test.py", diff --git a/src/python/grpcio_tests/tests/unit/_local_credentials_test.py b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py new file mode 100644 index 00000000000..838d8129e8c --- /dev/null +++ b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py @@ -0,0 +1,64 @@ +# Copyright 2019 The gRPC authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Test of RPCs made using local credentials.""" + +import unittest +from concurrent.futures import ThreadPoolExecutor +import grpc +from grpc import local_credentials + + +class _GenericHandler(grpc.GenericRpcHandler): + + def service(self, handler_call_details): + return grpc.unary_unary_rpc_method_handler( + lambda request, unused_context: request) + + +class LocalCredentialsTest(unittest.TestCase): + + def _create_server(self): + server = grpc.server(ThreadPoolExecutor()) + server.add_generic_rpc_handlers((_GenericHandler(),)) + return server + + def test_local_tcp(self): + server_addr = '[::1]:{}' + channel_creds = local_credentials.local_channel_credentials( + local_credentials.LocalConnectType.LOCAL_TCP) + server_creds = local_credentials.local_server_credentials( + local_credentials.LocalConnectType.LOCAL_TCP) + server = self._create_server() + port = server.add_secure_port(server_addr.format(0), server_creds) + server.start() + channel = grpc.secure_channel(server_addr.format(port), channel_creds) + self.assertEqual(b'abc', channel.unary_unary('/test/method')(b'abc')) + server.stop(None) + + def test_uds(self): + server_addr = 'unix:/tmp/grpc_fullstack_test' + channel_creds = local_credentials.local_channel_credentials( + local_credentials.LocalConnectType.UDS) + server_creds = local_credentials.local_server_credentials( + local_credentials.LocalConnectType.UDS) + server = self._create_server() + server.add_secure_port(server_addr, server_creds) + server.start() + channel = grpc.secure_channel(server_addr, channel_creds) + self.assertEqual(b'abc', channel.unary_unary('/test/method')(b'abc')) + server.stop(None) + + +if __name__ == '__main__': + unittest.main() From f681fe89af7ba140d0e3e02eeaa9efa03e2332d2 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 15 Aug 2019 20:16:01 -0700 Subject: [PATCH 354/661] Make yapf happy --- src/python/grpcio/grpc/_local_credentials.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/python/grpcio/grpc/_local_credentials.py b/src/python/grpcio/grpc/_local_credentials.py index 326820dee39..8d46fa3d3ae 100644 --- a/src/python/grpcio/grpc/_local_credentials.py +++ b/src/python/grpcio/grpc/_local_credentials.py @@ -1,4 +1,3 @@ - # Copyright 2019 The gRPC authors # # Licensed under the Apache License, Version 2.0 (the "License"); From d2a224252d0021699dcc64d44aa301a0d8797314 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Fri, 16 Aug 2019 11:54:31 +0800 Subject: [PATCH 355/661] fix:Update notes, with more standard words --- examples/python/easy_start_demo/README.md | 21 +++++++------------ examples/python/easy_start_demo/demo.proto | 20 +++++++++--------- .../easy_start_demo/demo_grpc_pbs/demo_pb2.py | 20 +++++++++--------- .../demo_grpc_pbs/demo_pb2_grpc.py | 8 +++---- 4 files changed, 31 insertions(+), 38 deletions(-) diff --git a/examples/python/easy_start_demo/README.md b/examples/python/easy_start_demo/README.md index 50529c57df5..32ad177af17 100644 --- a/examples/python/easy_start_demo/README.md +++ b/examples/python/easy_start_demo/README.md @@ -1,35 +1,28 @@ -## easyDemo for using GRPC in Python -###主要是介绍了在Python中使用GRPC时, 进行数据传输的四种方式。 -###This paper mainly introduces four ways of data transmission when GRPC is used in Python. +## Demo for using gRPC in Python -- ####简单模式 (Simple) +在Python中使用gRPC时, 进行数据传输的四种方式。(Four ways of data transmission when gRPC is used in Python.) + +- ####简单模式 (unary-unary) ```text 没啥好说的,跟调普通方法没差 There's nothing to say. It's no different from the usual way. ``` -- ####客户端流模式 (Request-streaming) +- ####客户端流模式 (stream-unary) ```text 在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应. In a single call, the client can transfer data to the server several times, but the server can only return a response once. ``` -- ####服务端流模式 (Response-streaming) +- ####服务端流模式 (unary-stream) ```text 在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应 In a single call, the client can only transmit data to the server at one time, but the server can return the response many times. ``` -- ####双向流模式 (Bidirectional Streaming) +- ####双向流模式 (stream-stream) ```text 在一次调用中, 客户端和服务器都可以向对方多次收发数据 In a single call, both client and server can send and receive data to each other multiple times. ``` ----- -Author: Zhongying Wang - -Email: kerbalwzy@gmail.com - -DateTime: 2019-08-13T23:30:00Z -PythonVersion: Python3.6.3 \ No newline at end of file diff --git a/examples/python/easy_start_demo/demo.proto b/examples/python/easy_start_demo/demo.proto index 2844ba7b225..dd29a178d77 100644 --- a/examples/python/easy_start_demo/demo.proto +++ b/examples/python/easy_start_demo/demo.proto @@ -1,9 +1,9 @@ // 语法版本声明,必须放在非注释的第一行 -// Syntax version declaration, Must be placed on the first line of non-commentary +// Syntax version declaration. Must be placed on the first line of non-commentary. syntax = "proto3"; // 包名定义, Python中使用时可以省略不写(PS:我还要再Go中使用,所以留在这里了) -// Package name definition, which can be omitted in Python (PS: I'll use it again in Go, so stay here) +// Package name definition, which can be omitted in Python. (PS: I'll use it again in Go, so stay here) package demo; /* @@ -17,34 +17,34 @@ Each field in the message definition has a unique number. The overall format is similar to defining a class in Python or a structure in Golang. */ message Request { - int64 Cid = 1; - string ReqMsg = 2; + int64 client_id = 1; + string request_data = 2; } message Response { - int64 Sid = 1; - string RespMsg = 2; + int64 server_id = 1; + string response_data = 2; } // service是用来给GRPC服务定义方法的, 格式固定, 类似于Golang中定义一个接口 // `service` is used to define methods for GRPC services in a fixed format, similar to defining an interface in Golang service GRPCDemo { // 简单模式 - // Simple + // unary-unary rpc SimpleMethod (Request) returns (Response); // 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) - // Request-streaming (In a single call, the client can transfer data to the server several times, + // stream-unary (In a single call, the client can transfer data to the server several times, // but the server can only return a response once.) rpc ClientStreamingMethod (stream Request) returns (Response); // 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) - // Response-streaming (In a single call, the client can only transmit data to the server at one time, + // unary-stream (In a single call, the client can only transmit data to the server at one time, // but the server can return the response many times.) rpc ServerStreamingMethod (Request) returns (stream Response); // 双向流模式 (在一次调用中, 客户端和服务器都可以向对方多次收发数据) - // Bidirectional streaming (In a single call, both client and server can send and receive data + // stream-stream (In a single call, both client and server can send and receive data // to each other multiple times.) rpc BidirectionalStreamingMethod (stream Request) returns (stream Response); } diff --git a/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2.py b/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2.py index de960c8a6c1..5dfaf837dfd 100644 --- a/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2.py +++ b/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2.py @@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor.FileDescriptor( package='demo', syntax='proto3', serialized_options=None, - serialized_pb=_b('\n\ndemo.proto\x12\x04\x64\x65mo\"&\n\x07Request\x12\x0b\n\x03\x43id\x18\x01 \x01(\x03\x12\x0e\n\x06ReqMsg\x18\x02 \x01(\t\"(\n\x08Response\x12\x0b\n\x03Sid\x18\x01 \x01(\x03\x12\x0f\n\x07RespMsg\x18\x02 \x01(\t2\xf0\x01\n\x08GRPCDemo\x12-\n\x0cSimpleMethod\x12\r.demo.Request\x1a\x0e.demo.Response\x12\x38\n\x15\x43lientStreamingMethod\x12\r.demo.Request\x1a\x0e.demo.Response(\x01\x12\x38\n\x15ServerStreamingMethod\x12\r.demo.Request\x1a\x0e.demo.Response0\x01\x12\x41\n\x1c\x42idirectionalStreamingMethod\x12\r.demo.Request\x1a\x0e.demo.Response(\x01\x30\x01\x62\x06proto3') + serialized_pb=_b('\n\ndemo.proto\x12\x04\x64\x65mo\"2\n\x07Request\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x14\n\x0crequest_data\x18\x02 \x01(\t\"4\n\x08Response\x12\x11\n\tserver_id\x18\x01 \x01(\x03\x12\x15\n\rresponse_data\x18\x02 \x01(\t2\xf0\x01\n\x08GRPCDemo\x12-\n\x0cSimpleMethod\x12\r.demo.Request\x1a\x0e.demo.Response\x12\x38\n\x15\x43lientStreamingMethod\x12\r.demo.Request\x1a\x0e.demo.Response(\x01\x12\x38\n\x15ServerStreamingMethod\x12\r.demo.Request\x1a\x0e.demo.Response0\x01\x12\x41\n\x1c\x42idirectionalStreamingMethod\x12\r.demo.Request\x1a\x0e.demo.Response(\x01\x30\x01\x62\x06proto3') ) @@ -34,14 +34,14 @@ _REQUEST = _descriptor.Descriptor( containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='Cid', full_name='demo.Request.Cid', index=0, + name='client_id', full_name='demo.Request.client_id', index=0, number=1, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( - name='ReqMsg', full_name='demo.Request.ReqMsg', index=1, + name='request_data', full_name='demo.Request.request_data', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, @@ -60,7 +60,7 @@ _REQUEST = _descriptor.Descriptor( oneofs=[ ], serialized_start=20, - serialized_end=58, + serialized_end=70, ) @@ -72,14 +72,14 @@ _RESPONSE = _descriptor.Descriptor( containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='Sid', full_name='demo.Response.Sid', index=0, + name='server_id', full_name='demo.Response.server_id', index=0, number=1, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( - name='RespMsg', full_name='demo.Response.RespMsg', index=1, + name='response_data', full_name='demo.Response.response_data', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, @@ -97,8 +97,8 @@ _RESPONSE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=60, - serialized_end=100, + serialized_start=72, + serialized_end=124, ) DESCRIPTOR.message_types_by_name['Request'] = _REQUEST @@ -127,8 +127,8 @@ _GRPCDEMO = _descriptor.ServiceDescriptor( file=DESCRIPTOR, index=0, serialized_options=None, - serialized_start=103, - serialized_end=343, + serialized_start=127, + serialized_end=367, methods=[ _descriptor.MethodDescriptor( name='SimpleMethod', diff --git a/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2_grpc.py b/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2_grpc.py index 0f7d5dabbd6..b6d6fc72a13 100644 --- a/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2_grpc.py +++ b/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2_grpc.py @@ -44,7 +44,7 @@ class GRPCDemoServicer(object): def SimpleMethod(self, request, context): """简单模式 - Simple + unary-unary """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') @@ -52,7 +52,7 @@ class GRPCDemoServicer(object): def ClientStreamingMethod(self, request_iterator, context): """客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) - Request-streaming (In a single call, the client can transfer data to the server several times, + stream-unary (In a single call, the client can transfer data to the server several times, but the server can only return a response once.) """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) @@ -61,7 +61,7 @@ class GRPCDemoServicer(object): def ServerStreamingMethod(self, request, context): """服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) - Response-streaming (In a single call, the client can only transmit data to the server at one time, + unary-stream (In a single call, the client can only transmit data to the server at one time, but the server can return the response many times.) """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) @@ -70,7 +70,7 @@ class GRPCDemoServicer(object): def BidirectionalStreamingMethod(self, request_iterator, context): """双向流模式 (在一次调用中, 客户端和服务器都可以向对方多次收发数据) - Bidirectional streaming (In a single call, both client and server can send and receive data + stream-stream (In a single call, both client and server can send and receive data to each other multiple times.) """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) From 5ca7452c51d4ac87185db1d3025b84c517605397 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Fri, 16 Aug 2019 11:57:35 +0800 Subject: [PATCH 356/661] fix:Update the constant name. Replace abbreviations with complete forms of words --- examples/python/easy_start_demo/client.py | 48 +++++++++++------------ examples/python/easy_start_demo/server.py | 44 ++++++++++----------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/examples/python/easy_start_demo/client.py b/examples/python/easy_start_demo/client.py index 46d11d05cbf..b5b994820a3 100644 --- a/examples/python/easy_start_demo/client.py +++ b/examples/python/easy_start_demo/client.py @@ -15,22 +15,22 @@ sys.path.insert(0, os.path.join(BaseDir, "demo_grpc_pbs")) from demo_grpc_pbs import demo_pb2, demo_pb2_grpc -ServerAddress = "127.0.0.1:23334" -ClientId = 1 +SERVER_ADDRESS = "localhost:23334" +CLIENT_ID = 1 # 简单模式 -# Simple Method +# unary-unary def simple_method(stub): print("--------------Call SimpleMethod Begin--------------") - req = demo_pb2.Request(Cid=ClientId, ReqMsg="called by Python client") - resp = stub.SimpleMethod(req) - print("resp from server(%d), the message=%s" % (resp.Sid, resp.RespMsg)) + request = demo_pb2.Request(client_id=CLIENT_ID, request_data="called by Python client") + response = stub.SimpleMethod(request) + print("resp from server(%d), the message=%s" % (response.server_id, response.response_data)) print("--------------Call SimpleMethod Over---------------") # 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) -# Request-streaming (In a single call, the client can transfer data to the server several times, +# stream-unary (In a single call, the client can transfer data to the server several times, # but the server can only return a response once.) def client_streaming_method(stub): print("--------------Call ClientStreamingMethod Begin--------------") @@ -39,50 +39,50 @@ def client_streaming_method(stub): # create a generator def request_messages(): for i in range(5): - req = demo_pb2.Request(Cid=ClientId, ReqMsg=("called by Python client, message:%d" % i)) - yield req + request = demo_pb2.Request(client_id=CLIENT_ID, request_data=("called by Python client, message:%d" % i)) + yield request - resp = stub.ClientStreamingMethod(request_messages()) - print("resp from server(%d), the message=%s" % (resp.Sid, resp.RespMsg)) + response = stub.ClientStreamingMethod(request_messages()) + print("resp from server(%d), the message=%s" % (response.server_id, response.response_data)) print("--------------Call ClientStreamingMethod Over---------------") # 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) -# Response-streaming (In a single call, the client can only transmit data to the server at one time, +# unary-stream (In a single call, the client can only transmit data to the server at one time, # but the server can return the response many times.) def server_streaming_method(stub): print("--------------Call ServerStreamingMethod Begin--------------") - req = demo_pb2.Request(Cid=ClientId, ReqMsg="called by Python client") - resp_s = stub.ServerStreamingMethod(req) - for resp in resp_s: - print("recv from server(%d), message=%s" % (resp.Sid, resp.RespMsg)) + request = demo_pb2.Request(client_id=CLIENT_ID, request_data="called by Python client") + response_iterator = stub.ServerStreamingMethod(request) + for response in response_iterator: + print("recv from server(%d), message=%s" % (response.server_id, response.response_data)) print("--------------Call ServerStreamingMethod Over---------------") # 双向流模式 (在一次调用中, 客户端和服务器都可以向对方多次收发数据) -# Bidirectional Streaming (In a single call, both client and server can send and receive data +# stream-stream (In a single call, both client and server can send and receive data # to each other multiple times.) def bidirectional_streaming_method(stub): print("--------------Call BidirectionalStreamingMethod Begin---------------") # 创建一个生成器 # create a generator - def req_messages(): + def request_messages(): for i in range(5): - req = demo_pb2.Request(Cid=ClientId, ReqMsg=("called by Python client, message: %d" % i)) - yield req + request = demo_pb2.Request(client_id=CLIENT_ID, request_data=("called by Python client, message: %d" % i)) + yield request time.sleep(1) - resp_s = stub.BidirectionalStreamingMethod(req_messages()) - for resp in resp_s: - print("recv from server(%d), message=%s" % (resp.Sid, resp.RespMsg)) + response_iterator = stub.BidirectionalStreamingMethod(request_messages()) + for response in response_iterator: + print("recv from server(%d), message=%s" % (response.server_id, response.response_data)) print("--------------Call BidirectionalStreamingMethod Over---------------") def main(): - with grpc.insecure_channel(ServerAddress) as channel: + with grpc.insecure_channel(SERVER_ADDRESS) as channel: stub = demo_pb2_grpc.GRPCDemoStub(channel) simple_method(stub) diff --git a/examples/python/easy_start_demo/server.py b/examples/python/easy_start_demo/server.py index a4130719ada..60fb84768b7 100644 --- a/examples/python/easy_start_demo/server.py +++ b/examples/python/easy_start_demo/server.py @@ -18,61 +18,61 @@ sys.path.insert(0, os.path.join(BaseDir, "demo_grpc_pbs")) from demo_grpc_pbs import demo_pb2, demo_pb2_grpc -ServerAddress = '127.0.0.1:23334' -ServerId = 1 +SERVER_ADDRESS = 'localhost:23334' +SERVER_ID = 1 class DemoServer(demo_pb2_grpc.GRPCDemoServicer): # 简单模式 - # Simple + # unary-unary def SimpleMethod(self, request, context): - print("SimpleMethod called by client(%d) the message: %s" % (request.Cid, request.ReqMsg)) - resp = demo_pb2.Response(Sid=ServerId, RespMsg="Python server SimpleMethod Ok!!!!") - return resp + print("SimpleMethod called by client(%d) the message: %s" % (request.client_id, request.request_data)) + response = demo_pb2.Response(server_id=SERVER_ID, response_data="Python server SimpleMethod Ok!!!!") + return response # 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) - # Request-streaming (In a single call, the client can transfer data to the server several times, + # stream-unary (In a single call, the client can transfer data to the server several times, # but the server can only return a response once.) def ClientStreamingMethod(self, request_iterator, context): print("ClientStreamingMethod called by client...") - for req in request_iterator: - print("recv from client(%d), message= %s" % (req.Cid, req.ReqMsg)) - resp = demo_pb2.Response(Sid=ServerId, RespMsg="Python server ClientStreamingMethod ok") - return resp + for request in request_iterator: + print("recv from client(%d), message= %s" % (request.client_id, request.request_data)) + response = demo_pb2.Response(server_id=SERVER_ID, response_data="Python server ClientStreamingMethod ok") + return response # 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) - # Response-streaming (In a single call, the client can only transmit data to the server at one time, + # unary-stream (In a single call, the client can only transmit data to the server at one time, # but the server can return the response many times.) def ServerStreamingMethod(self, request, context): - print("ServerStreamingMethod called by client(%d), message= %s" % (request.Cid, request.ReqMsg)) + print("ServerStreamingMethod called by client(%d), message= %s" % (request.client_id, request.request_data)) # 创建一个生成器 # create a generator def response_messages(): for i in range(5): - resp = demo_pb2.Response(Sid=ServerId, RespMsg=("send by Python server, message=%d" % i)) - yield resp + response = demo_pb2.Response(server_id=SERVER_ID, response_data=("send by Python server, message=%d" % i)) + yield response return response_messages() # 双向流模式 (在一次调用中, 客户端和服务器都可以向对方多次收发数据) - # Bidirectional Streaming (In a single call, both client and server can send and receive data + # stream-stream (In a single call, both client and server can send and receive data # to each other multiple times.) def BidirectionalStreamingMethod(self, request_iterator, context): print("BidirectionalStreamingMethod called by client...") # 开启一个子线程去接收数据 # Open a sub thread to receive data - def parse_req(): - for req in request_iterator: - print("recv from client(%d), message= %s" % (req.Cid, req.ReqMsg)) + def parse_request(): + for request in request_iterator: + print("recv from client(%d), message= %s" % (request.client_id, request.request_data)) - t = Thread(target=parse_req) + t = Thread(target=parse_request) t.start() for i in range(5): - yield demo_pb2.Response(Sid=ServerId, RespMsg=("send by Python server, message= %d" % i)) + yield demo_pb2.Response(server_id=SERVER_ID, response_data=("send by Python server, message= %d" % i)) t.join() @@ -82,7 +82,7 @@ def main(): demo_pb2_grpc.add_GRPCDemoServicer_to_server(DemoServer(), server) - server.add_insecure_port(ServerAddress) + server.add_insecure_port(SERVER_ADDRESS) print("------------------start Python GRPC server") server.start() From 7beba8547eaa94a7eb465e983b8e3f74993feae1 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Fri, 16 Aug 2019 12:08:27 +0800 Subject: [PATCH 357/661] fix:Make the title appear properly --- examples/python/easy_start_demo/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/python/easy_start_demo/README.md b/examples/python/easy_start_demo/README.md index 32ad177af17..919b9c5cc61 100644 --- a/examples/python/easy_start_demo/README.md +++ b/examples/python/easy_start_demo/README.md @@ -2,24 +2,24 @@ 在Python中使用gRPC时, 进行数据传输的四种方式。(Four ways of data transmission when gRPC is used in Python.) -- ####简单模式 (unary-unary) +- #### 简单模式 (unary-unary) ```text 没啥好说的,跟调普通方法没差 There's nothing to say. It's no different from the usual way. ``` -- ####客户端流模式 (stream-unary) +- #### 客户端流模式 (stream-unary) ```text 在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应. In a single call, the client can transfer data to the server several times, but the server can only return a response once. ``` -- ####服务端流模式 (unary-stream) +- #### 服务端流模式 (unary-stream) ```text 在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应 In a single call, the client can only transmit data to the server at one time, but the server can return the response many times. ``` -- ####双向流模式 (stream-stream) +- #### 双向流模式 (stream-stream) ```text 在一次调用中, 客户端和服务器都可以向对方多次收发数据 In a single call, both client and server can send and receive data From 6bca0f04a3cf8530c457fae2fb8da5330421f08b Mon Sep 17 00:00:00 2001 From: easy Date: Thu, 15 Aug 2019 11:34:55 +1000 Subject: [PATCH 358/661] Use opencensus::tags::TagKey. opencensus::stats::TagKey is deprecated. --- .../registered_opencensus_objects.h | 31 ++++++++++--------- src/cpp/ext/filters/census/grpc_plugin.cc | 17 +++++----- src/cpp/ext/filters/census/grpc_plugin.h | 9 +++--- src/cpp/server/load_reporter/load_reporter.cc | 11 ++++--- src/cpp/server/load_reporter/load_reporter.h | 11 ++++--- 5 files changed, 42 insertions(+), 37 deletions(-) diff --git a/src/core/ext/filters/load_reporting/registered_opencensus_objects.h b/src/core/ext/filters/load_reporting/registered_opencensus_objects.h index 4eacda7c02a..ed11ff42239 100644 --- a/src/core/ext/filters/load_reporting/registered_opencensus_objects.h +++ b/src/core/ext/filters/load_reporting/registered_opencensus_objects.h @@ -22,6 +22,7 @@ #include #include "opencensus/stats/stats.h" +#include "opencensus/tags/tag_key.h" #include "src/cpp/server/load_reporter/constants.h" @@ -80,33 +81,33 @@ inline ::opencensus::stats::MeasureDouble MeasureOtherCallMetric() { // Tags. -inline ::opencensus::stats::TagKey TagKeyToken() { - static const ::opencensus::stats::TagKey token = - opencensus::stats::TagKey::Register(kTagKeyToken); +inline ::opencensus::tags::TagKey TagKeyToken() { + static const ::opencensus::tags::TagKey token = + opencensus::tags::TagKey::Register(kTagKeyToken); return token; } -inline ::opencensus::stats::TagKey TagKeyHost() { - static const ::opencensus::stats::TagKey token = - opencensus::stats::TagKey::Register(kTagKeyHost); +inline ::opencensus::tags::TagKey TagKeyHost() { + static const ::opencensus::tags::TagKey token = + opencensus::tags::TagKey::Register(kTagKeyHost); return token; } -inline ::opencensus::stats::TagKey TagKeyUserId() { - static const ::opencensus::stats::TagKey token = - opencensus::stats::TagKey::Register(kTagKeyUserId); +inline ::opencensus::tags::TagKey TagKeyUserId() { + static const ::opencensus::tags::TagKey token = + opencensus::tags::TagKey::Register(kTagKeyUserId); return token; } -inline ::opencensus::stats::TagKey TagKeyStatus() { - static const ::opencensus::stats::TagKey token = - opencensus::stats::TagKey::Register(kTagKeyStatus); +inline ::opencensus::tags::TagKey TagKeyStatus() { + static const ::opencensus::tags::TagKey token = + opencensus::tags::TagKey::Register(kTagKeyStatus); return token; } -inline ::opencensus::stats::TagKey TagKeyMetricName() { - static const ::opencensus::stats::TagKey token = - opencensus::stats::TagKey::Register(kTagKeyMetricName); +inline ::opencensus::tags::TagKey TagKeyMetricName() { + static const ::opencensus::tags::TagKey token = + opencensus::tags::TagKey::Register(kTagKeyMetricName); return token; } diff --git a/src/cpp/ext/filters/census/grpc_plugin.cc b/src/cpp/ext/filters/census/grpc_plugin.cc index c5018f0673a..63d6f1bde48 100644 --- a/src/cpp/ext/filters/census/grpc_plugin.cc +++ b/src/cpp/ext/filters/census/grpc_plugin.cc @@ -22,6 +22,7 @@ #include +#include "opencensus/tags/tag_key.h" #include "opencensus/trace/span.h" #include "src/cpp/ext/filters/census/channel_filter.h" #include "src/cpp/ext/filters/census/client_filter.h" @@ -33,27 +34,27 @@ namespace grpc { // These measure definitions should be kept in sync across opencensus // implementations--see // https://github.com/census-instrumentation/opencensus-java/blob/master/contrib/grpc_metrics/src/main/java/io/opencensus/contrib/grpc/metrics/RpcMeasureConstants.java. -::opencensus::stats::TagKey ClientMethodTagKey() { +::opencensus::tags::TagKey ClientMethodTagKey() { static const auto method_tag_key = - ::opencensus::stats::TagKey::Register("grpc_client_method"); + ::opencensus::tags::TagKey::Register("grpc_client_method"); return method_tag_key; } -::opencensus::stats::TagKey ClientStatusTagKey() { +::opencensus::tags::TagKey ClientStatusTagKey() { static const auto status_tag_key = - ::opencensus::stats::TagKey::Register("grpc_client_status"); + ::opencensus::tags::TagKey::Register("grpc_client_status"); return status_tag_key; } -::opencensus::stats::TagKey ServerMethodTagKey() { +::opencensus::tags::TagKey ServerMethodTagKey() { static const auto method_tag_key = - ::opencensus::stats::TagKey::Register("grpc_server_method"); + ::opencensus::tags::TagKey::Register("grpc_server_method"); return method_tag_key; } -::opencensus::stats::TagKey ServerStatusTagKey() { +::opencensus::tags::TagKey ServerStatusTagKey() { static const auto status_tag_key = - ::opencensus::stats::TagKey::Register("grpc_server_status"); + ::opencensus::tags::TagKey::Register("grpc_server_status"); return status_tag_key; } diff --git a/src/cpp/ext/filters/census/grpc_plugin.h b/src/cpp/ext/filters/census/grpc_plugin.h index 13176759e37..14f2481681d 100644 --- a/src/cpp/ext/filters/census/grpc_plugin.h +++ b/src/cpp/ext/filters/census/grpc_plugin.h @@ -24,6 +24,7 @@ #include "absl/strings/string_view.h" #include "include/grpcpp/opencensus.h" #include "opencensus/stats/stats.h" +#include "opencensus/tags/tag_key.h" namespace grpc_impl { class ServerContext; @@ -32,10 +33,10 @@ class ServerContext; namespace grpc { // The tag keys set when recording RPC stats. -::opencensus::stats::TagKey ClientMethodTagKey(); -::opencensus::stats::TagKey ClientStatusTagKey(); -::opencensus::stats::TagKey ServerMethodTagKey(); -::opencensus::stats::TagKey ServerStatusTagKey(); +::opencensus::tags::TagKey ClientMethodTagKey(); +::opencensus::tags::TagKey ClientStatusTagKey(); +::opencensus::tags::TagKey ServerMethodTagKey(); +::opencensus::tags::TagKey ServerStatusTagKey(); // Names of measures used by the plugin--users can create views on these // measures but should not record data for them. diff --git a/src/cpp/server/load_reporter/load_reporter.cc b/src/cpp/server/load_reporter/load_reporter.cc index 422ea62efd5..b4c5e57c354 100644 --- a/src/cpp/server/load_reporter/load_reporter.cc +++ b/src/cpp/server/load_reporter/load_reporter.cc @@ -29,6 +29,7 @@ #include "src/cpp/server/load_reporter/load_reporter.h" #include "opencensus/stats/internal/set_aggregation_window.h" +#include "opencensus/tags/tag_key.h" namespace grpc { namespace load_reporter { @@ -38,12 +39,12 @@ CpuStatsProvider::CpuStatsSample CpuStatsProviderDefaultImpl::GetCpuStats() { } CensusViewProvider::CensusViewProvider() - : tag_key_token_(::opencensus::stats::TagKey::Register(kTagKeyToken)), - tag_key_host_(::opencensus::stats::TagKey::Register(kTagKeyHost)), - tag_key_user_id_(::opencensus::stats::TagKey::Register(kTagKeyUserId)), - tag_key_status_(::opencensus::stats::TagKey::Register(kTagKeyStatus)), + : tag_key_token_(::opencensus::tags::TagKey::Register(kTagKeyToken)), + tag_key_host_(::opencensus::tags::TagKey::Register(kTagKeyHost)), + tag_key_user_id_(::opencensus::tags::TagKey::Register(kTagKeyUserId)), + tag_key_status_(::opencensus::tags::TagKey::Register(kTagKeyStatus)), tag_key_metric_name_( - ::opencensus::stats::TagKey::Register(kTagKeyMetricName)) { + ::opencensus::tags::TagKey::Register(kTagKeyMetricName)) { // One view related to starting a call. auto vd_start_count = ::opencensus::stats::ViewDescriptor() diff --git a/src/cpp/server/load_reporter/load_reporter.h b/src/cpp/server/load_reporter/load_reporter.h index 766e02a407a..44767ee841e 100644 --- a/src/cpp/server/load_reporter/load_reporter.h +++ b/src/cpp/server/load_reporter/load_reporter.h @@ -34,6 +34,7 @@ #include "src/proto/grpc/lb/v1/load_reporter.grpc.pb.h" #include "opencensus/stats/stats.h" +#include "opencensus/tags/tag_key.h" namespace grpc { namespace load_reporter { @@ -75,11 +76,11 @@ class CensusViewProvider { private: ViewDescriptorMap view_descriptor_map_; // Tag keys. - ::opencensus::stats::TagKey tag_key_token_; - ::opencensus::stats::TagKey tag_key_host_; - ::opencensus::stats::TagKey tag_key_user_id_; - ::opencensus::stats::TagKey tag_key_status_; - ::opencensus::stats::TagKey tag_key_metric_name_; + ::opencensus::tags::TagKey tag_key_token_; + ::opencensus::tags::TagKey tag_key_host_; + ::opencensus::tags::TagKey tag_key_user_id_; + ::opencensus::tags::TagKey tag_key_status_; + ::opencensus::tags::TagKey tag_key_metric_name_; }; // The default implementation fetches the real stats from Census. From c1713800e047c4ca2da558b259d5e8abc19f5f30 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Fri, 16 Aug 2019 09:06:06 -0700 Subject: [PATCH 359/661] Handle EDS response update in locality map --- include/grpc/impl/codegen/grpc_types.h | 5 + .../client_channel/lb_policy/xds/xds.cc | 144 +++++++++++------- .../lb_policy/xds/xds_load_balancer_api.cc | 21 ++- test/cpp/end2end/xds_end2end_test.cc | 116 ++++++++++++-- 4 files changed, 210 insertions(+), 76 deletions(-) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index ab29e917ed8..68ae3606e80 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -330,6 +330,11 @@ typedef struct { balancer before using fallback backend addresses from the resolver. If 0, enter fallback mode immediately. Default value is 10000. */ #define GRPC_ARG_XDS_FALLBACK_TIMEOUT_MS "grpc.xds_fallback_timeout_ms" +/* Time in milliseconds to wait before a locality is deleted after it's removed + from the received EDS update. If 0, delete the locality immediately. Default + value is 15 minutes. */ +#define GRPC_ARG_LOCALITY_RETENTION_INTERVAL_MS \ + "grpc.xds_locality_retention_interval_ms" /** If non-zero, grpc server's cronet compression workaround will be enabled */ #define GRPC_ARG_WORKAROUND_CRONET_COMPRESSION \ "grpc.workaround.cronet_compression" diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 85d1b012696..11bbb72a367 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -109,6 +109,7 @@ #define GRPC_XDS_RECONNECT_JITTER 0.2 #define GRPC_XDS_DEFAULT_FALLBACK_TIMEOUT_MS 10000 #define GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS 1000 +#define GRPC_XDS_DEFAULT_LOCALITY_RETENTION_INTERVAL_MS (15 * 60 * 1000) namespace grpc_core { @@ -452,15 +453,15 @@ class XdsLb : public LoadBalancingPolicy { class LocalityEntry : public InternallyRefCounted { public: LocalityEntry(RefCountedPtr parent, - RefCountedPtr name, - uint32_t locality_weight); + RefCountedPtr name); ~LocalityEntry(); - void UpdateLocked(ServerAddressList serverlist, + void UpdateLocked(uint32_t locality_weight, ServerAddressList serverlist, LoadBalancingPolicy::Config* child_policy_config, const grpc_channel_args* args); void ShutdownLocked(); void ResetBackoffLocked(); + void DeactivateLocked(); void Orphan() override; grpc_connectivity_state connectivity_state() const { @@ -504,6 +505,8 @@ class XdsLb : public LoadBalancingPolicy { grpc_channel_args* CreateChildPolicyArgsLocked( const grpc_channel_args* args); + static void OnDelayedRemovalTimerLocked(void* arg, grpc_error* error); + RefCountedPtr parent_; RefCountedPtr name_; OrphanablePtr child_policy_; @@ -511,20 +514,22 @@ class XdsLb : public LoadBalancingPolicy { RefCountedPtr picker_wrapper_; grpc_connectivity_state connectivity_state_ = GRPC_CHANNEL_IDLE; uint32_t locality_weight_; + grpc_closure on_delayed_removal_timer_; + grpc_timer delayed_removal_timer_; + bool delayed_removal_timer_callback_pending_ = false; }; explicit LocalityMap(XdsLb* xds_policy) : xds_policy_(xds_policy) {} void UpdateLocked(const XdsLocalityList& locality_list, LoadBalancingPolicy::Config* child_policy_config, - const grpc_channel_args* args, XdsLb* parent); + const grpc_channel_args* args, XdsLb* parent, + bool is_initial_update = false); void UpdateXdsPickerLocked(); void ShutdownLocked(); void ResetBackoffLocked(); private: - void PruneLocalities(const XdsLocalityList& locality_list); - XdsLb* xds_policy_; Map, OrphanablePtr, XdsLocalityName::Less> @@ -602,6 +607,7 @@ class XdsLb : public LoadBalancingPolicy { // The policy to use for the backends. RefCountedPtr child_policy_config_; + const grpc_millis locality_retention_interval_ms_; // Map of policies to use in the backend LocalityMap locality_map_; // TODO(mhaidry) : Add support for multiple maps of localities @@ -1711,6 +1717,9 @@ XdsLb::XdsLb(Args args) lb_fallback_timeout_ms_(grpc_channel_args_find_integer( args.args, GRPC_ARG_XDS_FALLBACK_TIMEOUT_MS, {GRPC_XDS_DEFAULT_FALLBACK_TIMEOUT_MS, 0, INT_MAX})), + locality_retention_interval_ms_(grpc_channel_args_find_integer( + args.args, GRPC_ARG_LOCALITY_RETENTION_INTERVAL_MS, + {GRPC_XDS_DEFAULT_LOCALITY_RETENTION_INTERVAL_MS, 0, INT_MAX})), locality_map_(this) { // Record server name. const grpc_arg* arg = grpc_channel_args_find(args.args, GRPC_ARG_SERVER_URI); @@ -1837,7 +1846,7 @@ void XdsLb::UpdateLocked(UpdateArgs args) { } ProcessAddressesAndChannelArgsLocked(std::move(args.addresses), *args.args); locality_map_.UpdateLocked(locality_list_, child_policy_config_.get(), args_, - this); + this, is_initial_update); // Update the existing fallback policy. The fallback policy config and/or the // fallback addresses may be new. if (fallback_policy_ != nullptr) UpdateFallbackPolicyLocked(); @@ -2035,27 +2044,12 @@ void XdsLb::MaybeExitFallbackMode() { // XdsLb::LocalityMap // -void XdsLb::LocalityMap::PruneLocalities(const XdsLocalityList& locality_list) { - for (auto iter = map_.begin(); iter != map_.end();) { - bool found = false; - for (size_t i = 0; i < locality_list.size(); i++) { - if (*locality_list[i].locality_name == *iter->first) { - found = true; - break; - } - } - if (!found) { // Remove entries not present in the locality list. - iter = map_.erase(iter); - } else - iter++; - } -} - void XdsLb::LocalityMap::UpdateLocked( const XdsLocalityList& locality_list, LoadBalancingPolicy::Config* child_policy_config, - const grpc_channel_args* args, XdsLb* parent) { + const grpc_channel_args* args, XdsLb* parent, bool is_initial_update) { if (parent->shutting_down_) return; + // Add or update the localities in locality_list. for (size_t i = 0; i < locality_list.size(); i++) { auto& locality_name = locality_list[i].locality_name; auto iter = map_.find(locality_name); @@ -2063,19 +2057,35 @@ void XdsLb::LocalityMap::UpdateLocked( // locality list. if (iter == map_.end()) { OrphanablePtr new_entry = MakeOrphanable( - parent->Ref(DEBUG_LOCATION, "LocalityEntry"), locality_name, - locality_list[i].lb_weight); + parent->Ref(DEBUG_LOCATION, "LocalityEntry"), locality_name); iter = map_.emplace(locality_name, std::move(new_entry)).first; } // Keep a copy of serverlist in locality_list_ so that we can compare it // with the future ones. - iter->second->UpdateLocked(locality_list[i].serverlist, child_policy_config, + iter->second->UpdateLocked(locality_list[i].lb_weight, + locality_list[i].serverlist, child_policy_config, args); } - PruneLocalities(locality_list); + // Remove (later) the localities not in locality_list. + for (auto& p : map_) { + const XdsLocalityName* locality_name = p.first.get(); + LocalityEntry* locality_entry = p.second.get(); + bool in_locality_list = false; + for (size_t i = 0; i < locality_list.size(); ++i) { + if (*locality_list[i].locality_name == *locality_name) { + in_locality_list = true; + break; + } + } + if (!in_locality_list) locality_entry->DeactivateLocked(); + } + // Generate a new xds picker immediately. + if (!is_initial_update) UpdateXdsPickerLocked(); } void XdsLb::LocalityMap::UpdateXdsPickerLocked() { + // If we are in fallback mode, don't generate an xds picker from localities. + if (xds_policy_->fallback_policy_ != nullptr) return; // Construct a new xds picker which maintains a map of all locality pickers // that are ready. Each locality is represented by a portion of the range // proportional to its weight, such that the total range is the sum of the @@ -2086,23 +2096,8 @@ void XdsLb::LocalityMap::UpdateXdsPickerLocked() { size_t num_transient_failures = 0; Picker::PickerList pickers; for (auto& p : map_) { - // TODO(juanlishen): We should prune a locality (and kill its stats) after - // we know we won't pick from it. We need to improve our update logic to - // make that easier. Consider the following situation: the current map has - // two READY localities A and B, and the update only contains B with the - // same addresses as before. Without the following hack, we will generate - // the same picker containing A and B because we haven't pruned A when the - // update happens. Remove the for loop below once we implement the locality - // map update. - bool in_locality_list = false; - for (size_t i = 0; i < xds_policy_->locality_list_.size(); ++i) { - if (*xds_policy_->locality_list_[i].locality_name == *p.first) { - in_locality_list = true; - break; - } - } - if (!in_locality_list) continue; const LocalityEntry* entry = p.second.get(); + if (entry->locality_weight() == 0) continue; switch (entry->connectivity_state()) { case GRPC_CHANNEL_READY: { end += entry->locality_weight(); @@ -2121,10 +2116,8 @@ void XdsLb::LocalityMap::UpdateXdsPickerLocked() { num_transient_failures++; break; } - default: { - gpr_log(GPR_ERROR, "Invalid locality connectivity state - %d", - entry->connectivity_state()); - } + default: + GPR_UNREACHABLE_CODE(return ); } } // Pass on the constructed xds picker if it has any ready pickers in their map @@ -2148,11 +2141,9 @@ void XdsLb::LocalityMap::UpdateXdsPickerLocked() { UniquePtr( New(xds_policy_->Ref(DEBUG_LOCATION, "QueuePicker")))); } else { - GPR_ASSERT(num_transient_failures == - xds_policy_->locality_map_.map_.size()); grpc_error* error = grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING( - "connections to all localities failing"), + "connections to all active localities failing"), GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE); xds_policy_->channel_control_helper()->UpdateState( GRPC_CHANNEL_TRANSIENT_FAILURE, @@ -2173,15 +2164,14 @@ void XdsLb::LocalityMap::ResetBackoffLocked() { // XdsLb::LocalityMap::LocalityEntry::LocalityEntry( - RefCountedPtr parent, RefCountedPtr name, - uint32_t locality_weight) - : parent_(std::move(parent)), - name_(std::move(name)), - locality_weight_(locality_weight) { + RefCountedPtr parent, RefCountedPtr name) + : parent_(std::move(parent)), name_(std::move(name)) { if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { gpr_log(GPR_INFO, "[xdslb %p] created LocalityEntry %p for %s", parent_.get(), this, name_->AsHumanReadableString()); } + GRPC_CLOSURE_INIT(&on_delayed_removal_timer_, OnDelayedRemovalTimerLocked, + this, grpc_combiner_scheduler(parent_->combiner())); } XdsLb::LocalityMap::LocalityEntry::~LocalityEntry() { @@ -2245,10 +2235,15 @@ XdsLb::LocalityMap::LocalityEntry::CreateChildPolicyLocked( } void XdsLb::LocalityMap::LocalityEntry::UpdateLocked( - ServerAddressList serverlist, + uint32_t locality_weight, ServerAddressList serverlist, LoadBalancingPolicy::Config* child_policy_config, const grpc_channel_args* args_in) { if (parent_->shutting_down_) return; + // Update locality weight. + locality_weight_ = locality_weight; + if (delayed_removal_timer_callback_pending_) { + grpc_timer_cancel(&delayed_removal_timer_); + } // Construct update args. UpdateArgs update_args; update_args.addresses = std::move(serverlist); @@ -2373,6 +2368,9 @@ void XdsLb::LocalityMap::LocalityEntry::ShutdownLocked() { // Drop our ref to the child's picker, in case it's holding a ref to // the child. picker_wrapper_.reset(); + if (delayed_removal_timer_callback_pending_) { + grpc_timer_cancel(&delayed_removal_timer_); + } } void XdsLb::LocalityMap::LocalityEntry::ResetBackoffLocked() { @@ -2387,6 +2385,36 @@ void XdsLb::LocalityMap::LocalityEntry::Orphan() { Unref(); } +void XdsLb::LocalityMap::LocalityEntry::DeactivateLocked() { + // If locality retaining is disabled, delete the locality immediately. + if (parent_->locality_retention_interval_ms_ == 0) { + parent_->locality_map_.map_.erase(name_); + return; + } + // If already deactivated, don't do that again. + if (locality_weight_ == 0) return; + // Set the locality weight to 0 so that future xds picker won't contain this + // locality. + locality_weight_ = 0; + // Start a timer to delete the locality. + Ref(DEBUG_LOCATION, "LocalityEntry+timer").release(); + grpc_timer_init( + &delayed_removal_timer_, + ExecCtx::Get()->Now() + parent_->locality_retention_interval_ms_, + &on_delayed_removal_timer_); + delayed_removal_timer_callback_pending_ = true; +} + +void XdsLb::LocalityMap::LocalityEntry::OnDelayedRemovalTimerLocked( + void* arg, grpc_error* error) { + LocalityEntry* self = static_cast(arg); + self->delayed_removal_timer_callback_pending_ = false; + if (error == GRPC_ERROR_NONE && self->locality_weight_ == 0) { + self->parent_->locality_map_.map_.erase(self->name_); + } + self->Unref(DEBUG_LOCATION, "LocalityEntry+timer"); +} + // // XdsLb::LocalityEntry::Helper // @@ -2446,8 +2474,6 @@ void XdsLb::LocalityMap::LocalityEntry::Helper::UpdateState( entry_->parent_->MaybeCancelFallbackAtStartupChecks(); entry_->parent_->MaybeExitFallbackMode(); } - // If we are in fallback mode, ignore update request from the child policy. - if (entry_->parent_->fallback_policy_ != nullptr) return; GPR_ASSERT(entry_->parent_->lb_chand_ != nullptr); // Cache the picker and its state in the entry. entry_->picker_wrapper_ = MakeRefCounted( diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc index bd8a7142e38..ac87053d47f 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc @@ -137,6 +137,16 @@ UniquePtr StringCopy(const upb_strview& strview) { grpc_error* LocalityParse( const envoy_api_v2_endpoint_LocalityLbEndpoints* locality_lb_endpoints, XdsLocalityInfo* locality_info) { + // Parse LB weight. + const google_protobuf_UInt32Value* lb_weight = + envoy_api_v2_endpoint_LocalityLbEndpoints_load_balancing_weight( + locality_lb_endpoints); + // If LB weight is not specified, it means this locality is assigned no load. + // TODO(juanlishen): When we support CDS to configure the inter-locality + // policy, we should change the LB weight handling. + locality_info->lb_weight = + lb_weight != nullptr ? google_protobuf_UInt32Value_value(lb_weight) : 0; + if (locality_info->lb_weight == 0) return GRPC_ERROR_NONE; // Parse locality name. const envoy_api_v2_core_Locality* locality = envoy_api_v2_endpoint_LocalityLbEndpoints_locality(locality_lb_endpoints); @@ -154,14 +164,7 @@ grpc_error* LocalityParse( &locality_info->serverlist); if (error != GRPC_ERROR_NONE) return error; } - // Parse the lb_weight and priority. - const google_protobuf_UInt32Value* lb_weight = - envoy_api_v2_endpoint_LocalityLbEndpoints_load_balancing_weight( - locality_lb_endpoints); - // If LB weight is not specified, the default weight 0 is used, which means - // this locality is assigned no load. - locality_info->lb_weight = - lb_weight != nullptr ? google_protobuf_UInt32Value_value(lb_weight) : 0; + // Parse the priority. locality_info->priority = envoy_api_v2_endpoint_LocalityLbEndpoints_priority(locality_lb_endpoints); return GRPC_ERROR_NONE; @@ -253,6 +256,8 @@ grpc_error* XdsEdsResponseDecodeAndParse(const grpc_slice& encoded_response, XdsLocalityInfo locality_info; grpc_error* error = LocalityParse(endpoints[i], &locality_info); if (error != GRPC_ERROR_NONE) return error; + // Filter out locality with weight 0. + if (locality_info.lb_weight == 0) continue; update->locality_list.push_back(std::move(locality_info)); } // The locality list is sorted here into deterministic order so that it's diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 9afa141ae21..0a5c3740096 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -316,9 +317,11 @@ class EdsServiceImpl : public EdsService { gpr_log(GPR_INFO, "LB[%p]: shut down", this); } + // TODO(juanlishen): Put the args into a struct. static DiscoveryResponse BuildResponse( const std::vector>& backend_ports, const std::vector& lb_weights = {}, + size_t first_locality_name_index = 0, const std::map& drop_categories = {}, const FractionalPercent::DenominatorType denominator = FractionalPercent::MILLION) { @@ -333,7 +336,8 @@ class EdsServiceImpl : public EdsService { endpoints->mutable_locality()->set_region(kDefaultLocalityRegion); endpoints->mutable_locality()->set_zone(kDefaultLocalityZone); std::ostringstream sub_zone; - sub_zone << kDefaultLocalitySubzone << '_' << i; + sub_zone << kDefaultLocalitySubzone << '_' + << first_locality_name_index + i; endpoints->mutable_locality()->set_sub_zone(sub_zone.str()); for (const int& backend_port : backend_ports[i]) { auto* lb_endpoints = endpoints->add_lb_endpoints(); @@ -1114,8 +1118,102 @@ TEST_F(SingleBalancerTest, LocalityMapStressTest) { // Wait until backend 1 is ready, before which kNumLocalities localities are // removed by the xds policy. WaitForBackend(1); + // The EDS service got a single request. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + // and sent two responses. + EXPECT_EQ(2U, balancers_[0]->eds_service()->response_count()); +} + +TEST_F(SingleBalancerTest, LocalityMapUpdate) { + SetNextResolution({}, kDefaultServiceConfig_.c_str()); + SetNextResolutionForLbChannelAllBalancers(); + const size_t kNumRpcs = 1000; + // The locality weight for the first 3 localities. + const std::vector kLocalityWeights0 = {2, 3, 4}; + const double kTotalLocalityWeight0 = + std::accumulate(kLocalityWeights0.begin(), kLocalityWeights0.end(), 0); + std::vector locality_weight_rate_0; + for (int weight : kLocalityWeights0) { + locality_weight_rate_0.push_back(weight / kTotalLocalityWeight0); + } + // Delete the first locality, keep the second locality, change the third + // locality's weight from 4 to 2, and add a new locality with weight 6. + const std::vector kLocalityWeights1 = {3, 2, 6}; + const double kTotalLocalityWeight1 = + std::accumulate(kLocalityWeights1.begin(), kLocalityWeights1.end(), 0); + std::vector locality_weight_rate_1 = { + 0 /* placeholder for locality 0 */}; + for (int weight : kLocalityWeights1) { + locality_weight_rate_1.push_back(weight / kTotalLocalityWeight1); + } + ScheduleResponseForBalancer( + 0, + EdsServiceImpl::BuildResponse( + GetBackendPortsInGroups(0 /*start_index*/, 3 /*stop_index*/, + 3 /*num_group*/), + kLocalityWeights0), + 0); + ScheduleResponseForBalancer( + 0, + EdsServiceImpl::BuildResponse( + GetBackendPortsInGroups(1 /*start_index*/, 4 /*stop_index*/, + 3 /*num_group*/), + kLocalityWeights1, 1 /*first_locality_name_index*/), + 5000); + // Wait for the first 3 backends to be ready. + WaitForAllBackends(1, 0, 3); + gpr_log(GPR_INFO, "========= BEFORE FIRST BATCH =========="); + // Send kNumRpcs RPCs. + CheckRpcSendOk(kNumRpcs); + gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH =========="); + // The picking rates of the first 3 backends should be roughly equal to the + // expectation. + std::vector locality_picked_rates; + for (size_t i = 0; i < 3; ++i) { + locality_picked_rates.push_back( + static_cast(backends_[i]->backend_service()->request_count()) / + kNumRpcs); + } + const double kErrorTolerance = 0.2; + for (size_t i = 0; i < 3; ++i) { + EXPECT_THAT( + locality_picked_rates[i], + ::testing::AllOf( + ::testing::Ge(locality_weight_rate_0[i] * (1 - kErrorTolerance)), + ::testing::Le(locality_weight_rate_0[i] * (1 + kErrorTolerance)))); + } + // Backend 3 hasn't received any request. + EXPECT_EQ(0U, backends_[3]->backend_service()->request_count()); // The EDS service got a single request, and sent a single response. EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); + // Wait until the locality update has been processed, as signaled by backend 3 + // receiving a request. + WaitForBackend(3); + gpr_log(GPR_INFO, "========= BEFORE SECOND BATCH =========="); + // Send kNumRpcs RPCs. + CheckRpcSendOk(kNumRpcs); + gpr_log(GPR_INFO, "========= DONE WITH SECOND BATCH =========="); + // Backend 0 no longer receives any request. + EXPECT_EQ(0U, backends_[0]->backend_service()->request_count()); + // The picking rates of the last 3 backends should be roughly equal to the + // expectation. + locality_picked_rates = {0 /* placeholder for backend 0 */}; + for (size_t i = 1; i < 4; ++i) { + locality_picked_rates.push_back( + static_cast(backends_[i]->backend_service()->request_count()) / + kNumRpcs); + } + for (size_t i = 1; i < 4; ++i) { + EXPECT_THAT( + locality_picked_rates[i], + ::testing::AllOf( + ::testing::Ge(locality_weight_rate_1[i] * (1 - kErrorTolerance)), + ::testing::Le(locality_weight_rate_1[i] * (1 + kErrorTolerance)))); + } + // The EDS service got a single request. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + // and sent two responses. EXPECT_EQ(2U, balancers_[0]->eds_service()->response_count()); } @@ -1133,7 +1231,7 @@ TEST_F(SingleBalancerTest, Drop) { ScheduleResponseForBalancer( 0, EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(), {}, + GetBackendPortsInGroups(), {}, 0, {{kLbDropType, kDropPerMillionForLb}, {kThrottleDropType, kDropPerMillionForThrottle}}), 0); @@ -1174,7 +1272,7 @@ TEST_F(SingleBalancerTest, DropPerHundred) { // The EDS response contains one drop category. ScheduleResponseForBalancer( 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, 0, {{kLbDropType, kDropPerHundredForLb}}, FractionalPercent::HUNDRED), 0); @@ -1214,7 +1312,7 @@ TEST_F(SingleBalancerTest, DropPerTenThousand) { // The EDS response contains one drop category. ScheduleResponseForBalancer( 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, 0, {{kLbDropType, kDropPerTenThousandForLb}}, FractionalPercent::TEN_THOUSAND), 0); @@ -1258,7 +1356,7 @@ TEST_F(SingleBalancerTest, DropUpdate) { // The first EDS response contains one drop category. ScheduleResponseForBalancer( 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, 0, {{kLbDropType, kDropPerMillionForLb}}), 0); // The second EDS response contains two drop categories. @@ -1268,7 +1366,7 @@ TEST_F(SingleBalancerTest, DropUpdate) { ScheduleResponseForBalancer( 0, EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(), {}, + GetBackendPortsInGroups(), {}, 0, {{kLbDropType, kDropPerMillionForLb}, {kThrottleDropType, kDropPerMillionForThrottle}}), 10000); @@ -1354,7 +1452,7 @@ TEST_F(SingleBalancerTest, DropAll) { ScheduleResponseForBalancer( 0, EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(), {}, + GetBackendPortsInGroups(), {}, 0, {{kLbDropType, kDropPerMillionForLb}, {kThrottleDropType, kDropPerMillionForThrottle}}), 0); @@ -1547,7 +1645,7 @@ TEST_F(SingleBalancerTest, FallbackModeIsExitedWhenBalancerSaysToDropAllCalls) { // Return a new balancer that sends a response to drop all calls. ScheduleResponseForBalancer( 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, + EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, 0, {{kLbDropType, 1000000}}), 0); SetNextResolutionForLbChannelAllBalancers(); @@ -2005,7 +2103,7 @@ TEST_F(SingleBalancerWithClientLoadReportingAndDropTest, Vanilla) { ScheduleResponseForBalancer( 0, EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(), {}, + GetBackendPortsInGroups(), {}, 0, {{kLbDropType, kDropPerMillionForLb}, {kThrottleDropType, kDropPerMillionForThrottle}}), 0); From fff51d3842f4c9d5b3386e5a08dacd715e358fd8 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 14 Aug 2019 11:13:54 -0700 Subject: [PATCH 360/661] Remove sources_and_headers.json --- .../sources_and_headers.json.template | 72 - .../generated/sources_and_headers.json | 11052 ---------------- 2 files changed, 11124 deletions(-) delete mode 100644 templates/tools/run_tests/generated/sources_and_headers.json.template delete mode 100644 tools/run_tests/generated/sources_and_headers.json diff --git a/templates/tools/run_tests/generated/sources_and_headers.json.template b/templates/tools/run_tests/generated/sources_and_headers.json.template deleted file mode 100644 index c7dc3c837d1..00000000000 --- a/templates/tools/run_tests/generated/sources_and_headers.json.template +++ /dev/null @@ -1,72 +0,0 @@ -%YAML 1.2 ---- | - <%! - import json - import os - - def proto_headers(src): - out = [] - for f in src: - name, ext = os.path.splitext(f) - if ext == '.proto': - out.extend(fmt % name for fmt in ['%s.grpc.pb.h', '%s.pb.h', '%s_mock.grpc.pb.h']) - return out - - def all_targets(targets, libs, filegroups): - for tgt in targets: - yield ('target', tgt) - for tgt in libs: - yield ('lib', tgt) - for tgt in filegroups: - yield ('filegroup', tgt) - - def no_protos_filter(src): - return os.path.splitext(src)[1] != '.proto' - - def no_third_party_filter(src): - return not src.startswith('third_party/') - - def filter_srcs(srcs, filters): - out = [] - for s in srcs: - filter_passes = (f(s) for f in filters) - if all(filter_passes): - out.append(s) - return out - %> - - ${json.dumps([{"name": tgt.name, - "type": typ, - "is_filegroup": False, - "language": tgt.language, - "third_party": tgt.boringssl or tgt.zlib, - "src": sorted( - filter_srcs(tgt.own_src, (no_protos_filter, no_third_party_filter)) + - filter_srcs(tgt.own_public_headers, (no_protos_filter, no_third_party_filter)) + - filter_srcs(tgt.own_headers, (no_third_party_filter,))), - "headers": sorted( - tgt.own_public_headers + - tgt.own_headers + - proto_headers(tgt.own_src)), - "deps": sorted(tgt.get('deps', []) + - tgt.get('uses', []) + - tgt.get('filegroups', []))} - for typ, tgt in all_targets(targets, libs, [])] + - [{"name": tgt.name, - "type": typ, - "is_filegroup": True, - "language": tgt.language, - "third_party": tgt.boringssl or tgt.zlib, - "src": sorted( - filter_srcs(tgt.own_src, (no_protos_filter, no_third_party_filter)) + - filter_srcs(tgt.own_public_headers, (no_protos_filter, no_third_party_filter)) + - filter_srcs(tgt.own_headers, (no_third_party_filter,))), - "headers": sorted( - tgt.own_public_headers + - tgt.own_headers + - proto_headers(tgt.own_src)), - "deps": sorted(tgt.get('deps', []) + - tgt.get('uses', []) + - tgt.get('filegroups', []))} - for typ, tgt in all_targets([], [], filegroups)], - sort_keys=True, indent=2)} diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json deleted file mode 100644 index eeb66a585ee..00000000000 --- a/tools/run_tests/generated/sources_and_headers.json +++ /dev/null @@ -1,11052 +0,0 @@ - - -[ - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "algorithm_test", - "src": [ - "test/core/compression/algorithm_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "alloc_test", - "src": [ - "test/core/gpr/alloc_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "alpn_test", - "src": [ - "test/core/transport/chttp2/alpn_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "alts_credentials_fuzzer", - "src": [ - "test/core/security/alts_credentials_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "api_fuzzer", - "src": [ - "test/core/end2end/fuzzers/api_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "arena_test", - "src": [ - "test/core/gpr/arena_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "avl_test", - "src": [ - "test/core/avl/avl_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util", - "test_tcp_server" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "bad_server_response_test", - "src": [ - "test/core/end2end/bad_server_response_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "bin_decoder_test", - "src": [ - "test/core/transport/chttp2/bin_decoder_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "bin_encoder_test", - "src": [ - "test/core/transport/chttp2/bin_encoder_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "buffer_list_test", - "src": [ - "test/core/iomgr/buffer_list_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "channel_create_test", - "src": [ - "test/core/surface/channel_create_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "check_epollexclusive", - "src": [ - "test/build/check_epollexclusive.c" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "chttp2_hpack_encoder_test", - "src": [ - "test/core/transport/chttp2/hpack_encoder_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "chttp2_stream_map_test", - "src": [ - "test/core/transport/chttp2/stream_map_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "chttp2_varint_test", - "src": [ - "test/core/transport/chttp2/varint_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "client_fuzzer", - "src": [ - "test/core/end2end/fuzzers/client_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "close_fd_test", - "src": [ - "test/core/bad_connection/close_fd_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "cmdline_test", - "src": [ - "test/core/util/cmdline_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "combiner_test", - "src": [ - "test/core/iomgr/combiner_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "compression_test", - "src": [ - "test/core/compression/compression_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "concurrent_connectivity_test", - "src": [ - "test/core/surface/concurrent_connectivity_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "connection_refused_test", - "src": [ - "test/core/end2end/connection_refused_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "dns_resolver_connectivity_test", - "src": [ - "test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "dns_resolver_cooldown_using_ares_resolver_test", - "src": [ - "test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "dns_resolver_cooldown_using_native_resolver_test", - "src": [ - "test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "dns_resolver_test", - "src": [ - "test/core/client_channel/resolvers/dns_resolver_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "dualstack_socket_test", - "src": [ - "test/core/end2end/dualstack_socket_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "endpoint_pair_test", - "src": [ - "test/core/iomgr/endpoint_pair_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "error_test", - "src": [ - "test/core/iomgr/error_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "ev_epollex_linux_test", - "src": [ - "test/core/iomgr/ev_epollex_linux_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "fake_resolver_test", - "src": [ - "test/core/client_channel/resolvers/fake_resolver_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util", - "transport_security_test_lib" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "fake_transport_security_test", - "src": [ - "test/core/tsi/fake_transport_security_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "fd_conservation_posix_test", - "src": [ - "test/core/iomgr/fd_conservation_posix_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "fd_posix_test", - "src": [ - "test/core/iomgr/fd_posix_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "fling_client", - "src": [ - "test/core/fling/client.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "fling_server", - "src": [ - "test/core/fling/server.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "fling_stream_test", - "src": [ - "test/core/fling/fling_stream_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "fling_test", - "src": [ - "test/core/fling/fling_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "fork_test", - "src": [ - "test/core/gprpp/fork_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "goaway_server_test", - "src": [ - "test/core/end2end/goaway_server_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_cpu_test", - "src": [ - "test/core/gpr/cpu_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_env_test", - "src": [ - "test/core/gpr/env_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_host_port_test", - "src": [ - "test/core/gprpp/host_port_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_log_test", - "src": [ - "test/core/gpr/log_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_manual_constructor_test", - "src": [ - "test/core/gprpp/manual_constructor_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_mpscq_test", - "src": [ - "test/core/gpr/mpscq_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_spinlock_test", - "src": [ - "test/core/gpr/spinlock_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_string_test", - "src": [ - "test/core/gpr/string_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_sync_test", - "src": [ - "test/core/gpr/sync_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_thd_test", - "src": [ - "test/core/gprpp/thd_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_time_test", - "src": [ - "test/core/gpr/time_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_tls_test", - "src": [ - "test/core/gpr/tls_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_useful_test", - "src": [ - "test/core/gpr/useful_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_auth_context_test", - "src": [ - "test/core/security/auth_context_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_b64_test", - "src": [ - "test/core/slice/b64_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_byte_buffer_reader_test", - "src": [ - "test/core/surface/byte_buffer_reader_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_channel_args_test", - "src": [ - "test/core/channel/channel_args_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_channel_stack_builder_test", - "src": [ - "test/core/channel/channel_stack_builder_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_channel_stack_test", - "src": [ - "test/core/channel/channel_stack_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_completion_queue_test", - "src": [ - "test/core/surface/completion_queue_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_completion_queue_threading_test", - "src": [ - "test/core/surface/completion_queue_threading_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_control_plane_credentials_test", - "src": [ - "test/core/security/control_plane_credentials_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "cmdline", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_create_jwt", - "src": [ - "test/core/security/create_jwt.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_credentials_test", - "src": [ - "test/core/security/credentials_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_ipv6_loopback_available_test", - "src": [ - "test/core/iomgr/grpc_ipv6_loopback_available_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_json_token_test", - "src": [ - "test/core/security/json_token_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_jwt_verifier_test", - "src": [ - "test/core/security/jwt_verifier_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "cmdline", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_print_google_default_creds_token", - "src": [ - "test/core/security/print_google_default_creds_token.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_security_connector_test", - "src": [ - "test/core/security/security_connector_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_ssl_credentials_test", - "src": [ - "test/core/security/ssl_credentials_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "cmdline", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_verify_jwt", - "src": [ - "test/core/security/verify_jwt.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "handshake_client_ssl", - "src": [ - "test/core/handshake/client_ssl.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [ - "test/core/handshake/server_ssl_common.h" - ], - "is_filegroup": false, - "language": "c", - "name": "handshake_server_ssl", - "src": [ - "test/core/handshake/server_ssl.cc", - "test/core/handshake/server_ssl_common.cc", - "test/core/handshake/server_ssl_common.h" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [ - "test/core/handshake/server_ssl_common.h" - ], - "is_filegroup": false, - "language": "c", - "name": "handshake_server_with_readahead_handshaker", - "src": [ - "test/core/handshake/readahead_handshaker_server_ssl.cc", - "test/core/handshake/server_ssl_common.cc", - "test/core/handshake/server_ssl_common.h" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "handshake_verify_peer_options", - "src": [ - "test/core/handshake/verify_peer_options.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "histogram_test", - "src": [ - "test/core/util/histogram_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "hpack_parser_fuzzer_test", - "src": [ - "test/core/transport/chttp2/hpack_parser_fuzzer_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "hpack_parser_test", - "src": [ - "test/core/transport/chttp2/hpack_parser_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "hpack_table_test", - "src": [ - "test/core/transport/chttp2/hpack_table_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "http_parser_test", - "src": [ - "test/core/http/parser_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "http_request_fuzzer_test", - "src": [ - "test/core/http/request_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "http_response_fuzzer_test", - "src": [ - "test/core/http/response_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "httpcli_format_request_test", - "src": [ - "test/core/http/format_request_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "httpcli_test", - "src": [ - "test/core/http/httpcli_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "httpscli_test", - "src": [ - "test/core/http/httpscli_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "init_test", - "src": [ - "test/core/surface/init_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [ - "test/core/end2end/end2end_tests.h" - ], - "is_filegroup": false, - "language": "c", - "name": "inproc_callback_test", - "src": [ - "test/core/end2end/end2end_tests.h", - "test/core/end2end/inproc_callback_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "invalid_call_argument_test", - "src": [ - "test/core/end2end/invalid_call_argument_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "json_fuzzer_test", - "src": [ - "test/core/json/fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "json_rewrite", - "src": [ - "test/core/json/json_rewrite.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "json_rewrite_test", - "src": [ - "test/core/json/json_rewrite_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "json_stream_error_test", - "src": [ - "test/core/json/json_stream_error_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "json_test", - "src": [ - "test/core/json/json_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "lame_client_test", - "src": [ - "test/core/surface/lame_client_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "load_file_test", - "src": [ - "test/core/iomgr/load_file_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "low_level_ping_pong_benchmark", - "src": [ - "test/core/network_benchmarks/low_level_ping_pong.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "memory_usage_client", - "src": [ - "test/core/memory_usage/client.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "memory_usage_server", - "src": [ - "test/core/memory_usage/server.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "memory_usage_test", - "src": [ - "test/core/memory_usage/memory_usage_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "message_compress_test", - "src": [ - "test/core/compression/message_compress_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "minimal_stack_is_minimal_test", - "src": [ - "test/core/channel/minimal_stack_is_minimal_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "mpmcqueue_test", - "src": [ - "test/core/iomgr/mpmcqueue_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "multiple_server_queues_test", - "src": [ - "test/core/end2end/multiple_server_queues_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "murmur_hash_test", - "src": [ - "test/core/gpr/murmur_hash_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "nanopb_fuzzer_response_test", - "src": [ - "test/core/nanopb/fuzzer_response.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "nanopb_fuzzer_serverlist_test", - "src": [ - "test/core/nanopb/fuzzer_serverlist.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "no_server_test", - "src": [ - "test/core/end2end/no_server_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "num_external_connectivity_watchers_test", - "src": [ - "test/core/surface/num_external_connectivity_watchers_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "parse_address_test", - "src": [ - "test/core/client_channel/parse_address_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "parse_address_with_named_scope_id_test", - "src": [ - "test/core/client_channel/parse_address_with_named_scope_id_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "percent_decode_fuzzer", - "src": [ - "test/core/slice/percent_decode_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "percent_encode_fuzzer", - "src": [ - "test/core/slice/percent_encode_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "percent_encoding_test", - "src": [ - "test/core/slice/percent_encoding_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "resolve_address_using_ares_resolver_posix_test", - "src": [ - "test/core/iomgr/resolve_address_posix_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "resolve_address_using_ares_resolver_test", - "src": [ - "test/core/iomgr/resolve_address_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "resolve_address_using_native_resolver_posix_test", - "src": [ - "test/core/iomgr/resolve_address_posix_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "resolve_address_using_native_resolver_test", - "src": [ - "test/core/iomgr/resolve_address_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "resource_quota_test", - "src": [ - "test/core/iomgr/resource_quota_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "secure_channel_create_test", - "src": [ - "test/core/surface/secure_channel_create_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "secure_endpoint_test", - "src": [ - "test/core/security/secure_endpoint_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "sequential_connectivity_test", - "src": [ - "test/core/surface/sequential_connectivity_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "server_chttp2_test", - "src": [ - "test/core/surface/server_chttp2_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "server_fuzzer", - "src": [ - "test/core/end2end/fuzzers/server_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "server_test", - "src": [ - "test/core/surface/server_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "slice_buffer_test", - "src": [ - "test/core/slice/slice_buffer_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "slice_string_helpers_test", - "src": [ - "test/core/slice/slice_string_helpers_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "slice_test", - "src": [ - "test/core/slice/slice_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "sockaddr_resolver_test", - "src": [ - "test/core/client_channel/resolvers/sockaddr_resolver_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "sockaddr_utils_test", - "src": [ - "test/core/iomgr/sockaddr_utils_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "socket_utils_test", - "src": [ - "test/core/iomgr/socket_utils_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "ssl_server_fuzzer", - "src": [ - "test/core/security/ssl_server_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util", - "transport_security_test_lib" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "ssl_transport_security_test", - "src": [ - "test/core/tsi/ssl_transport_security_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "status_conversion_test", - "src": [ - "test/core/transport/status_conversion_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "stream_compression_test", - "src": [ - "test/core/compression/stream_compression_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "stream_owned_slice_test", - "src": [ - "test/core/transport/stream_owned_slice_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "tcp_client_posix_test", - "src": [ - "test/core/iomgr/tcp_client_posix_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "tcp_client_uv_test", - "src": [ - "test/core/iomgr/tcp_client_uv_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "tcp_posix_test", - "src": [ - "test/core/iomgr/tcp_posix_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "tcp_server_posix_test", - "src": [ - "test/core/iomgr/tcp_server_posix_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "tcp_server_uv_test", - "src": [ - "test/core/iomgr/tcp_server_uv_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "threadpool_test", - "src": [ - "test/core/iomgr/threadpool_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "time_averaged_stats_test", - "src": [ - "test/core/iomgr/time_averaged_stats_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "timeout_encoding_test", - "src": [ - "test/core/transport/timeout_encoding_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "timer_heap_test", - "src": [ - "test/core/iomgr/timer_heap_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "timer_list_test", - "src": [ - "test/core/iomgr/timer_list_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "transport_connectivity_state_test", - "src": [ - "test/core/transport/connectivity_state_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "transport_metadata_test", - "src": [ - "test/core/transport/metadata_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "transport_security_test", - "src": [ - "test/core/tsi/transport_security_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "udp_server_test", - "src": [ - "test/core/iomgr/udp_server_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "uri_fuzzer_test", - "src": [ - "test/core/client_channel/uri_fuzzer_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "uri_parser_test", - "src": [ - "test/core/client_channel/uri_parser_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alarm_test", - "src": [ - "test/cpp/common/alarm_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "alts_test_util", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alts_counter_test", - "src": [ - "test/core/tsi/alts/frame_protector/alts_counter_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "alts_test_util", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alts_crypt_test", - "src": [ - "test/core/tsi/alts/crypt/aes_gcm_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "alts_test_util", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alts_crypter_test", - "src": [ - "test/core/tsi/alts/frame_protector/alts_crypter_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "alts_test_util", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alts_frame_handler_test", - "src": [ - "test/core/tsi/alts/frame_protector/frame_handler_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "alts_test_util", - "gpr", - "grpc", - "transport_security_test_lib" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alts_frame_protector_test", - "src": [ - "test/core/tsi/alts/frame_protector/alts_frame_protector_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "alts_test_util", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alts_grpc_record_protocol_test", - "src": [ - "test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "alts_test_util", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alts_handshaker_client_test", - "src": [ - "test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "alts_test_util", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alts_iovec_record_protocol_test", - "src": [ - "test/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alts_security_connector_test", - "src": [ - "test/core/security/alts_security_connector_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "alts_test_util", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alts_tsi_handshaker_test", - "src": [ - "test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "alts_test_util", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alts_tsi_utils_test", - "src": [ - "test/core/tsi/alts/handshaker/alts_tsi_utils_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "alts_test_util", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "alts_zero_copy_grpc_protector_test", - "src": [ - "test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "async_end2end_test", - "src": [ - "test/cpp/end2end/async_end2end_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "auth_property_iterator_test", - "src": [ - "test/cpp/common/auth_property_iterator_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "backoff_test", - "src": [ - "test/core/backoff/backoff_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bdp_estimator_test", - "src": [ - "test/core/transport/bdp_estimator_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_alarm", - "src": [ - "test/cpp/microbenchmarks/bm_alarm.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_arena", - "src": [ - "test/cpp/microbenchmarks/bm_arena.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_byte_buffer", - "src": [ - "test/cpp/microbenchmarks/bm_byte_buffer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_call_create", - "src": [ - "test/cpp/microbenchmarks/bm_call_create.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "bm_callback_test_service_impl", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [ - "test/cpp/microbenchmarks/callback_streaming_ping_pong.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "bm_callback_streaming_ping_pong", - "src": [ - "test/cpp/microbenchmarks/bm_callback_streaming_ping_pong.cc", - "test/cpp/microbenchmarks/callback_streaming_ping_pong.h" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "bm_callback_test_service_impl", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [ - "test/cpp/microbenchmarks/callback_unary_ping_pong.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "bm_callback_unary_ping_pong", - "src": [ - "test/cpp/microbenchmarks/bm_callback_unary_ping_pong.cc", - "test/cpp/microbenchmarks/callback_unary_ping_pong.h" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_channel", - "src": [ - "test/cpp/microbenchmarks/bm_channel.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_chttp2_hpack", - "src": [ - "test/cpp/microbenchmarks/bm_chttp2_hpack.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_chttp2_transport", - "src": [ - "test/cpp/microbenchmarks/bm_chttp2_transport.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_closure", - "src": [ - "test/cpp/microbenchmarks/bm_closure.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_cq", - "src": [ - "test/cpp/microbenchmarks/bm_cq.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_cq_multiple_threads", - "src": [ - "test/cpp/microbenchmarks/bm_cq_multiple_threads.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_error", - "src": [ - "test/cpp/microbenchmarks/bm_error.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [ - "test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "bm_fullstack_streaming_ping_pong", - "src": [ - "test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc", - "test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [ - "test/cpp/microbenchmarks/fullstack_streaming_pump.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "bm_fullstack_streaming_pump", - "src": [ - "test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc", - "test/cpp/microbenchmarks/fullstack_streaming_pump.h" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_fullstack_trickle", - "src": [ - "test/cpp/microbenchmarks/bm_fullstack_trickle.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [ - "test/cpp/microbenchmarks/fullstack_unary_ping_pong.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "bm_fullstack_unary_ping_pong", - "src": [ - "test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc", - "test/cpp/microbenchmarks/fullstack_unary_ping_pong.h" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_metadata", - "src": [ - "test/cpp/microbenchmarks/bm_metadata.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_pollset", - "src": [ - "test/cpp/microbenchmarks/bm_pollset.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_threadpool", - "src": [ - "test/cpp/microbenchmarks/bm_threadpool.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bm_timer", - "src": [ - "test/cpp/microbenchmarks/bm_timer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "byte_stream_test", - "src": [ - "test/core/transport/byte_stream_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "channel_arguments_test", - "src": [ - "test/cpp/common/channel_arguments_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "channel_filter_test", - "src": [ - "test/cpp/common/channel_filter_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc++_test_util", - "grpc_test_util", - "grpcpp_channelz_proto" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "channel_trace_test", - "src": [ - "test/core/channel/channel_trace_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "channelz_registry_test", - "src": [ - "test/core/channel/channelz_registry_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util", - "grpcpp_channelz", - "grpcpp_channelz_proto" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "channelz_service_test", - "src": [ - "test/cpp/end2end/channelz_service_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc++_test_util", - "grpc_test_util", - "grpcpp_channelz_proto" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "channelz_test", - "src": [ - "test/core/channel/channelz_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "check_gcp_environment_linux_test", - "src": [ - "test/core/security/check_gcp_environment_linux_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "check_gcp_environment_windows_test", - "src": [ - "test/core/security/check_gcp_environment_windows_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "chttp2_settings_timeout_test", - "src": [ - "test/core/transport/chttp2/settings_timeout_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_cli_libs", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "cli_call_test", - "src": [ - "test/cpp/util/cli_call_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "client_callback_end2end_test", - "src": [ - "test/cpp/end2end/client_callback_end2end_test.cc", - "test/cpp/end2end/interceptors_util.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "src/proto/grpc/lb/v1/load_balancer.grpc.pb.h", - "src/proto/grpc/lb/v1/load_balancer.pb.h", - "src/proto/grpc/lb/v1/load_balancer_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "client_channel_stress_test", - "src": [ - "test/cpp/client/client_channel_stress_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "client_crash_test", - "src": [ - "test/cpp/end2end/client_crash_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "client_crash_test_server", - "src": [ - "test/cpp/end2end/client_crash_test_server.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "test/cpp/end2end/interceptors_util.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "client_interceptors_end2end_test", - "src": [ - "test/cpp/end2end/client_interceptors_end2end_test.cc", - "test/cpp/end2end/interceptors_util.cc", - "test/cpp/end2end/interceptors_util.h" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "client_lb_end2end_test", - "src": [ - "test/cpp/end2end/client_lb_end2end_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_codegen_base", - "grpc++_core_stats" - ], - "headers": [ - "src/proto/grpc/testing/benchmark_service.grpc.pb.h", - "src/proto/grpc/testing/benchmark_service.pb.h", - "src/proto/grpc/testing/benchmark_service_mock.grpc.pb.h", - "src/proto/grpc/testing/control.grpc.pb.h", - "src/proto/grpc/testing/control.pb.h", - "src/proto/grpc/testing/control_mock.grpc.pb.h", - "src/proto/grpc/testing/messages.grpc.pb.h", - "src/proto/grpc/testing/messages.pb.h", - "src/proto/grpc/testing/messages_mock.grpc.pb.h", - "src/proto/grpc/testing/payloads.grpc.pb.h", - "src/proto/grpc/testing/payloads.pb.h", - "src/proto/grpc/testing/payloads_mock.grpc.pb.h", - "src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.h", - "src/proto/grpc/testing/report_qps_scenario_service.pb.h", - "src/proto/grpc/testing/report_qps_scenario_service_mock.grpc.pb.h", - "src/proto/grpc/testing/stats.grpc.pb.h", - "src/proto/grpc/testing/stats.pb.h", - "src/proto/grpc/testing/stats_mock.grpc.pb.h", - "src/proto/grpc/testing/worker_service.grpc.pb.h", - "src/proto/grpc/testing/worker_service.pb.h", - "src/proto/grpc/testing/worker_service_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "codegen_test_full", - "src": [ - "test/cpp/codegen/codegen_test_full.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++_codegen_base", - "grpc++_codegen_base_src", - "grpc++_core_stats" - ], - "headers": [ - "src/proto/grpc/testing/benchmark_service.grpc.pb.h", - "src/proto/grpc/testing/benchmark_service.pb.h", - "src/proto/grpc/testing/benchmark_service_mock.grpc.pb.h", - "src/proto/grpc/testing/control.grpc.pb.h", - "src/proto/grpc/testing/control.pb.h", - "src/proto/grpc/testing/control_mock.grpc.pb.h", - "src/proto/grpc/testing/messages.grpc.pb.h", - "src/proto/grpc/testing/messages.pb.h", - "src/proto/grpc/testing/messages_mock.grpc.pb.h", - "src/proto/grpc/testing/payloads.grpc.pb.h", - "src/proto/grpc/testing/payloads.pb.h", - "src/proto/grpc/testing/payloads_mock.grpc.pb.h", - "src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.h", - "src/proto/grpc/testing/report_qps_scenario_service.pb.h", - "src/proto/grpc/testing/report_qps_scenario_service_mock.grpc.pb.h", - "src/proto/grpc/testing/stats.grpc.pb.h", - "src/proto/grpc/testing/stats.pb.h", - "src/proto/grpc/testing/stats_mock.grpc.pb.h", - "src/proto/grpc/testing/worker_service.grpc.pb.h", - "src/proto/grpc/testing/worker_service.pb.h", - "src/proto/grpc/testing/worker_service_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "codegen_test_minimal", - "src": [ - "test/cpp/codegen/codegen_test_minimal.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "context_list_test", - "src": [ - "test/core/transport/chttp2/context_list_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "credentials_test", - "src": [ - "test/cpp/client/credentials_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "cxx_byte_buffer_test", - "src": [ - "test/cpp/util/byte_buffer_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "cxx_slice_test", - "src": [ - "test/cpp/util/slice_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc", - "grpc++" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "cxx_string_ref_test", - "src": [ - "test/cpp/util/string_ref_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "cxx_time_test", - "src": [ - "test/cpp/util/time_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "delegating_channel_test", - "src": [ - "test/cpp/end2end/delegating_channel_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "test/cpp/end2end/interceptors_util.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "end2end_test", - "src": [ - "test/cpp/end2end/end2end_test.cc", - "test/cpp/end2end/interceptors_util.cc", - "test/cpp/end2end/interceptors_util.h" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc++", - "grpc++_error_details" - ], - "headers": [ - "src/proto/grpc/testing/echo_messages.grpc.pb.h", - "src/proto/grpc/testing/echo_messages.pb.h", - "src/proto/grpc/testing/echo_messages_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "error_details_test", - "src": [ - "test/cpp/util/error_details_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "exception_test", - "src": [ - "test/cpp/end2end/exception_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "filter_end2end_test", - "src": [ - "test/cpp/end2end/filter_end2end_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "gen_hpack_tables", - "src": [ - "tools/codegen/core/gen_hpack_tables.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "gen_legal_metadata_characters", - "src": [ - "tools/codegen/core/gen_legal_metadata_characters.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "gen_percent_encoding_tables", - "src": [ - "tools/codegen/core/gen_percent_encoding_tables.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "generic_end2end_test", - "src": [ - "test/cpp/end2end/generic_end2end_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "global_config_env_test", - "src": [ - "test/core/gprpp/global_config_env_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "global_config_test", - "src": [ - "test/core/gprpp/global_config_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config" - ], - "headers": [ - "src/proto/grpc/testing/compiler_test.grpc.pb.h", - "src/proto/grpc/testing/compiler_test.pb.h", - "src/proto/grpc/testing/compiler_test_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "golden_file_test", - "src": [ - "test/cpp/codegen/golden_file_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc_alts_credentials_options_test", - "src": [ - "test/core/security/grpc_alts_credentials_options_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_proto_reflection_desc_db", - "grpc++_test_config", - "grpc_cli_libs" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc_cli", - "src": [ - "test/cpp/util/grpc_cli.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc_test_util" - ], - "headers": [ - "test/core/gprpp/map_tester.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc_core_map_test", - "src": [ - "test/core/gprpp/map_test.cc", - "test/core/gprpp/map_tester.h" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc_plugin_support" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc_cpp_plugin", - "src": [ - "src/compiler/cpp_plugin.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc_plugin_support" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc_csharp_plugin", - "src": [ - "src/compiler/csharp_plugin.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc_fetch_oauth2", - "src": [ - "test/core/security/fetch_oauth2.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc_linux_system_roots_test", - "src": [ - "test/core/security/linux_system_roots_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc_plugin_support" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc_node_plugin", - "src": [ - "src/compiler/node_plugin.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc_plugin_support" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc_objective_c_plugin", - "src": [ - "src/compiler/objective_c_plugin.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc_plugin_support" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc_php_plugin", - "src": [ - "src/compiler/php_plugin.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc_plugin_support" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc_python_plugin", - "src": [ - "src/compiler/python_plugin.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc_plugin_support" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc_ruby_plugin", - "src": [ - "src/compiler/ruby_plugin.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc_spiffe_security_connector_test", - "src": [ - "test/core/security/spiffe_security_connector_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_codegen_proto", - "grpc++_proto_reflection_desc_db", - "grpc++_reflection", - "grpc++_test_util", - "grpc_cli_libs", - "grpc_test_util" - ], - "headers": [ - "src/proto/grpc/testing/echo.grpc.pb.h", - "src/proto/grpc/testing/echo.pb.h", - "src/proto/grpc/testing/echo_messages.grpc.pb.h", - "src/proto/grpc/testing/echo_messages.pb.h", - "src/proto/grpc/testing/echo_messages_mock.grpc.pb.h", - "src/proto/grpc/testing/echo_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc_tool_test", - "src": [ - "test/cpp/util/grpc_tool_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "src/proto/grpc/lb/v1/load_balancer.grpc.pb.h", - "src/proto/grpc/lb/v1/load_balancer.pb.h", - "src/proto/grpc/lb/v1/load_balancer_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpclb_api_test", - "src": [ - "test/cpp/grpclb/grpclb_api_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "src/proto/grpc/lb/v1/load_balancer.grpc.pb.h", - "src/proto/grpc/lb/v1/load_balancer.pb.h", - "src/proto/grpc/lb/v1/load_balancer_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpclb_end2end_test", - "src": [ - "test/cpp/end2end/grpclb_end2end_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "src/proto/grpc/testing/empty.grpc.pb.h", - "src/proto/grpc/testing/empty.pb.h", - "src/proto/grpc/testing/empty_mock.grpc.pb.h", - "src/proto/grpc/testing/messages.grpc.pb.h", - "src/proto/grpc/testing/messages.pb.h", - "src/proto/grpc/testing/messages_mock.grpc.pb.h", - "src/proto/grpc/testing/test.grpc.pb.h", - "src/proto/grpc/testing/test.pb.h", - "src/proto/grpc/testing/test_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpclb_fallback_test", - "src": [ - "test/cpp/interop/grpclb_fallback_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc_test_util" - ], - "headers": [ - "test/core/end2end/end2end_tests.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "h2_ssl_cert_test", - "src": [ - "test/core/end2end/end2end_tests.h", - "test/core/end2end/h2_ssl_cert_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc_test_util" - ], - "headers": [ - "test/core/end2end/end2end_tests.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "h2_ssl_session_reuse_test", - "src": [ - "test/core/end2end/end2end_tests.h", - "test/core/end2end/h2_ssl_session_reuse_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "health_service_end2end_test", - "src": [ - "test/cpp/end2end/health_service_end2end_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util", - "http2_client_main" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "http2_client", - "src": [], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "hybrid_end2end_test", - "src": [ - "test/cpp/end2end/hybrid_end2end_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "inlined_vector_test", - "src": [ - "test/core/gprpp/inlined_vector_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_core_stats", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util", - "qps" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "inproc_sync_unary_ping_pong_test", - "src": [ - "test/cpp/qps/inproc_sync_unary_ping_pong_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util", - "interop_client_helper", - "interop_client_main" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "interop_client", - "src": [], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util", - "interop_server_helper", - "interop_server_lib", - "interop_server_main" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "interop_server", - "src": [], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++_test_config", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "interop_test", - "src": [ - "test/cpp/interop/interop_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "json_run_localhost", - "src": [ - "test/cpp/qps/json_run_localhost.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "memory_test", - "src": [ - "test/core/gprpp/memory_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "message_allocator_end2end_test", - "src": [ - "test/cpp/end2end/message_allocator_end2end_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config" - ], - "headers": [ - "src/proto/grpc/testing/metrics.grpc.pb.h", - "src/proto/grpc/testing/metrics.pb.h", - "src/proto/grpc/testing/metrics_mock.grpc.pb.h", - "test/cpp/util/metrics_server.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "metrics_client", - "src": [ - "test/cpp/interop/metrics_client.cc", - "test/cpp/util/metrics_server.h" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "include/grpc++/test/mock_stream.h", - "include/grpcpp/test/mock_stream.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "mock_test", - "src": [ - "include/grpc++/test/mock_stream.h", - "include/grpcpp/test/mock_stream.h", - "test/cpp/end2end/mock_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "nonblocking_test", - "src": [ - "test/cpp/end2end/nonblocking_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "benchmark" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "noop-benchmark", - "src": [ - "test/cpp/microbenchmarks/noop-benchmark.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "optional_test", - "src": [ - "test/core/gprpp/optional_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "orphanable_test", - "src": [ - "test/core/gprpp/orphanable_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util", - "test_tcp_server" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "port_sharing_end2end_test", - "src": [ - "test/cpp/end2end/port_sharing_end2end_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_proto_reflection_desc_db", - "grpc++_reflection", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "proto_server_reflection_test", - "src": [ - "test/cpp/end2end/proto_server_reflection_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc", - "grpc++", - "grpc++_codegen_base", - "grpc++_codegen_proto" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "proto_utils_test", - "src": [ - "test/cpp/codegen/proto_utils_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util", - "qps" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "qps_interarrival_test", - "src": [ - "test/cpp/qps/qps_interarrival_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_core_stats", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util", - "qps" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "qps_json_driver", - "src": [ - "test/cpp/qps/qps_json_driver.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_core_stats", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util", - "qps" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "qps_openloop_test", - "src": [ - "test/cpp/qps/qps_openloop_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_core_stats", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util", - "qps" - ], - "headers": [ - "test/cpp/qps/client.h", - "test/cpp/qps/server.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "qps_worker", - "src": [ - "test/cpp/qps/client.h", - "test/cpp/qps/server.h", - "test/cpp/qps/worker.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "raw_end2end_test", - "src": [ - "test/cpp/end2end/raw_end2end_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "src/proto/grpc/testing/empty.grpc.pb.h", - "src/proto/grpc/testing/empty.pb.h", - "src/proto/grpc/testing/empty_mock.grpc.pb.h", - "src/proto/grpc/testing/messages.grpc.pb.h", - "src/proto/grpc/testing/messages.pb.h", - "src/proto/grpc/testing/messages_mock.grpc.pb.h", - "src/proto/grpc/testing/test.grpc.pb.h", - "src/proto/grpc/testing/test.pb.h", - "src/proto/grpc/testing/test_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "reconnect_interop_client", - "src": [ - "test/cpp/interop/reconnect_interop_client.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util", - "reconnect_server", - "test_tcp_server" - ], - "headers": [ - "src/proto/grpc/testing/empty.grpc.pb.h", - "src/proto/grpc/testing/empty.pb.h", - "src/proto/grpc/testing/empty_mock.grpc.pb.h", - "src/proto/grpc/testing/messages.grpc.pb.h", - "src/proto/grpc/testing/messages.pb.h", - "src/proto/grpc/testing/messages_mock.grpc.pb.h", - "src/proto/grpc/testing/test.grpc.pb.h", - "src/proto/grpc/testing/test.pb.h", - "src/proto/grpc/testing/test_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "reconnect_interop_server", - "src": [ - "test/cpp/interop/reconnect_interop_server.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "ref_counted_ptr_test", - "src": [ - "test/core/gprpp/ref_counted_ptr_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "ref_counted_test", - "src": [ - "test/core/gprpp/ref_counted_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "retry_throttle_test", - "src": [ - "test/core/client_channel/retry_throttle_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "secure_auth_context_test", - "src": [ - "test/cpp/common/secure_auth_context_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_core_stats", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util", - "qps" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "secure_sync_unary_ping_pong_test", - "src": [ - "test/cpp/qps/secure_sync_unary_ping_pong_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "server_builder_plugin_test", - "src": [ - "test/cpp/end2end/server_builder_plugin_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [ - "src/proto/grpc/testing/echo.grpc.pb.h", - "src/proto/grpc/testing/echo.pb.h", - "src/proto/grpc/testing/echo_messages.grpc.pb.h", - "src/proto/grpc/testing/echo_messages.pb.h", - "src/proto/grpc/testing/echo_messages_mock.grpc.pb.h", - "src/proto/grpc/testing/echo_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "server_builder_test", - "src": [ - "test/cpp/server/server_builder_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [ - "src/proto/grpc/testing/echo.grpc.pb.h", - "src/proto/grpc/testing/echo.pb.h", - "src/proto/grpc/testing/echo_messages.grpc.pb.h", - "src/proto/grpc/testing/echo_messages.pb.h", - "src/proto/grpc/testing/echo_messages_mock.grpc.pb.h", - "src/proto/grpc/testing/echo_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "server_builder_with_socket_mutator_test", - "src": [ - "test/cpp/server/server_builder_with_socket_mutator_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "server_context_test_spouse_test", - "src": [ - "test/cpp/test/server_context_test_spouse_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "server_crash_test", - "src": [ - "test/cpp/end2end/server_crash_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "server_crash_test_client", - "src": [ - "test/cpp/end2end/server_crash_test_client.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "server_early_return_test", - "src": [ - "test/cpp/end2end/server_early_return_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "test/cpp/end2end/interceptors_util.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "server_interceptors_end2end_test", - "src": [ - "test/cpp/end2end/interceptors_util.cc", - "test/cpp/end2end/interceptors_util.h", - "test/cpp/end2end/server_interceptors_end2end_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [ - "src/proto/grpc/testing/echo.grpc.pb.h", - "src/proto/grpc/testing/echo.pb.h", - "src/proto/grpc/testing/echo_messages.grpc.pb.h", - "src/proto/grpc/testing/echo_messages.pb.h", - "src/proto/grpc/testing/echo_messages_mock.grpc.pb.h", - "src/proto/grpc/testing/echo_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "server_request_call_test", - "src": [ - "test/cpp/server/server_request_call_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "service_config_end2end_test", - "src": [ - "test/cpp/end2end/service_config_end2end_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "service_config_test", - "src": [ - "test/core/client_channel/service_config_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "shutdown_test", - "src": [ - "test/cpp/end2end/shutdown_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "slice_hash_table_test", - "src": [ - "test/core/slice/slice_hash_table_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "slice_weak_hash_table_test", - "src": [ - "test/core/slice/slice_weak_hash_table_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "stats_test", - "src": [ - "test/core/debug/stats_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "status_metadata_test", - "src": [ - "test/core/transport/status_metadata_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "status_util_test", - "src": [ - "test/core/channel/status_util_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "streaming_throughput_test", - "src": [ - "test/cpp/end2end/streaming_throughput_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "src/proto/grpc/testing/empty.grpc.pb.h", - "src/proto/grpc/testing/empty.pb.h", - "src/proto/grpc/testing/empty_mock.grpc.pb.h", - "src/proto/grpc/testing/messages.grpc.pb.h", - "src/proto/grpc/testing/messages.pb.h", - "src/proto/grpc/testing/messages_mock.grpc.pb.h", - "src/proto/grpc/testing/metrics.grpc.pb.h", - "src/proto/grpc/testing/metrics.pb.h", - "src/proto/grpc/testing/metrics_mock.grpc.pb.h", - "src/proto/grpc/testing/test.grpc.pb.h", - "src/proto/grpc/testing/test.pb.h", - "src/proto/grpc/testing/test_mock.grpc.pb.h", - "test/cpp/interop/client_helper.h", - "test/cpp/interop/interop_client.h", - "test/cpp/interop/stress_interop_client.h", - "test/cpp/util/create_test_channel.h", - "test/cpp/util/metrics_server.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "stress_test", - "src": [ - "test/cpp/interop/client_helper.h", - "test/cpp/interop/interop_client.cc", - "test/cpp/interop/interop_client.h", - "test/cpp/interop/stress_interop_client.cc", - "test/cpp/interop/stress_interop_client.h", - "test/cpp/interop/stress_test.cc", - "test/cpp/util/create_test_channel.h", - "test/cpp/util/metrics_server.cc", - "test/cpp/util/metrics_server.h" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "string_view_test", - "src": [ - "test/core/gprpp/string_view_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc++_test_config", - "grpc++_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "thread_manager_test", - "src": [ - "test/cpp/thread_manager/thread_manager_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "thread_stress_test", - "src": [ - "test/cpp/end2end/thread_stress_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "time_change_test", - "src": [ - "test/cpp/end2end/time_change_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "transport_pid_controller_test", - "src": [ - "test/core/transport/pid_controller_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "alts_test_util", - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "transport_security_common_api_test", - "src": [ - "test/core/tsi/alts/handshaker/transport_security_common_api_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "writes_per_rpc_test", - "src": [ - "test/cpp/performance/writes_per_rpc_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "src/proto/grpc/lb/v2/eds_for_test.grpc.pb.h", - "src/proto/grpc/lb/v2/eds_for_test.pb.h", - "src/proto/grpc/lb/v2/eds_for_test_mock.grpc.pb.h", - "src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.h", - "src/proto/grpc/lb/v2/lrs_for_test.pb.h", - "src/proto/grpc/lb/v2/lrs_for_test_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "xds_end2end_test", - "src": [ - "test/cpp/end2end/xds_end2end_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "c89", - "name": "public_headers_must_be_c89", - "src": [ - "test/core/surface/public_headers_must_be_c89.c" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_ssl_test", - "src": [], - "third_party": true, - "type": "target" - }, - { - "deps": [ - "boringssl", - "boringssl_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_crypto_test", - "src": [ - "src/boringssl/crypto_test_data.cc" - ], - "third_party": true, - "type": "target" - }, - { - "deps": [ - "bad_client_test", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "bad_streaming_id_bad_client_test", - "src": [ - "test/core/bad_client/tests/bad_streaming_id.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "bad_client_test", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "badreq_bad_client_test", - "src": [ - "test/core/bad_client/tests/badreq.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "bad_client_test", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "connection_prefix_bad_client_test", - "src": [ - "test/core/bad_client/tests/connection_prefix.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "bad_client_test", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "duplicate_header_bad_client_test", - "src": [ - "test/core/bad_client/tests/duplicate_header.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "bad_client_test", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "head_of_line_blocking_bad_client_test", - "src": [ - "test/core/bad_client/tests/head_of_line_blocking.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "bad_client_test", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "headers_bad_client_test", - "src": [ - "test/core/bad_client/tests/headers.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "bad_client_test", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "initial_settings_frame_bad_client_test", - "src": [ - "test/core/bad_client/tests/initial_settings_frame.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "bad_client_test", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "large_metadata_bad_client_test", - "src": [ - "test/core/bad_client/tests/large_metadata.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "bad_client_test", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "out_of_bounds_bad_client_test", - "src": [ - "test/core/bad_client/tests/out_of_bounds.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "bad_client_test", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "server_registered_method_bad_client_test", - "src": [ - "test/core/bad_client/tests/server_registered_method.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "bad_client_test", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "simple_request_bad_client_test", - "src": [ - "test/core/bad_client/tests/simple_request.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "bad_client_test", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "unknown_frame_bad_client_test", - "src": [ - "test/core/bad_client/tests/unknown_frame.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "bad_client_test", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "window_overflow_bad_client_test", - "src": [ - "test/core/bad_client/tests/window_overflow.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "bad_ssl_test_server", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "bad_ssl_cert_server", - "src": [ - "test/core/bad_ssl/servers/cert.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "bad_ssl_cert_test", - "src": [ - "test/core/bad_ssl/bad_ssl_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_census_test", - "src": [ - "test/core/end2end/fixtures/h2_census.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_compress_test", - "src": [ - "test/core/end2end/fixtures/h2_compress.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_fakesec_test", - "src": [ - "test/core/end2end/fixtures/h2_fakesec.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_fd_test", - "src": [ - "test/core/end2end/fixtures/h2_fd.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_full_test", - "src": [ - "test/core/end2end/fixtures/h2_full.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_full+pipe_test", - "src": [ - "test/core/end2end/fixtures/h2_full+pipe.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_full+trace_test", - "src": [ - "test/core/end2end/fixtures/h2_full+trace.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_full+workarounds_test", - "src": [ - "test/core/end2end/fixtures/h2_full+workarounds.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_http_proxy_test", - "src": [ - "test/core/end2end/fixtures/h2_http_proxy.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_local_ipv4_test", - "src": [ - "test/core/end2end/fixtures/h2_local_ipv4.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_local_ipv6_test", - "src": [ - "test/core/end2end/fixtures/h2_local_ipv6.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_local_uds_test", - "src": [ - "test/core/end2end/fixtures/h2_local_uds.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_oauth2_test", - "src": [ - "test/core/end2end/fixtures/h2_oauth2.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_proxy_test", - "src": [ - "test/core/end2end/fixtures/h2_proxy.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_sockpair_test", - "src": [ - "test/core/end2end/fixtures/h2_sockpair.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_sockpair+trace_test", - "src": [ - "test/core/end2end/fixtures/h2_sockpair+trace.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_sockpair_1byte_test", - "src": [ - "test/core/end2end/fixtures/h2_sockpair_1byte.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_spiffe_test", - "src": [ - "test/core/end2end/fixtures/h2_spiffe.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_ssl_test", - "src": [ - "test/core/end2end/fixtures/h2_ssl.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_ssl_cred_reload_test", - "src": [ - "test/core/end2end/fixtures/h2_ssl_cred_reload.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_ssl_proxy_test", - "src": [ - "test/core/end2end/fixtures/h2_ssl_proxy.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_uds_test", - "src": [ - "test/core/end2end/fixtures/h2_uds.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_tests", - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "inproc_test", - "src": [ - "test/core/end2end/fixtures/inproc.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_nosec_tests", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_census_nosec_test", - "src": [ - "test/core/end2end/fixtures/h2_census.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_nosec_tests", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_compress_nosec_test", - "src": [ - "test/core/end2end/fixtures/h2_compress.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_nosec_tests", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_fd_nosec_test", - "src": [ - "test/core/end2end/fixtures/h2_fd.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_nosec_tests", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_full_nosec_test", - "src": [ - "test/core/end2end/fixtures/h2_full.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_nosec_tests", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_full+pipe_nosec_test", - "src": [ - "test/core/end2end/fixtures/h2_full+pipe.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_nosec_tests", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_full+trace_nosec_test", - "src": [ - "test/core/end2end/fixtures/h2_full+trace.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_nosec_tests", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_full+workarounds_nosec_test", - "src": [ - "test/core/end2end/fixtures/h2_full+workarounds.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_nosec_tests", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_http_proxy_nosec_test", - "src": [ - "test/core/end2end/fixtures/h2_http_proxy.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_nosec_tests", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_proxy_nosec_test", - "src": [ - "test/core/end2end/fixtures/h2_proxy.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_nosec_tests", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_sockpair_nosec_test", - "src": [ - "test/core/end2end/fixtures/h2_sockpair.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_nosec_tests", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_sockpair+trace_nosec_test", - "src": [ - "test/core/end2end/fixtures/h2_sockpair+trace.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_nosec_tests", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_sockpair_1byte_nosec_test", - "src": [ - "test/core/end2end/fixtures/h2_sockpair_1byte.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "end2end_nosec_tests", - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "h2_uds_nosec_test", - "src": [ - "test/core/end2end/fixtures/h2_uds.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "dns_test_util", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "resolver_component_test_unsecure", - "src": [ - "test/cpp/naming/resolver_component_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "dns_test_util", - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "resolver_component_test", - "src": [ - "test/cpp/naming/resolver_component_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "resolver_component_tests_runner_invoker_unsecure", - "src": [ - "test/cpp/naming/resolver_component_tests_runner_invoker.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "resolver_component_tests_runner_invoker", - "src": [ - "test/cpp/naming/resolver_component_tests_runner_invoker.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "address_sorting_test_unsecure", - "src": [ - "test/cpp/naming/address_sorting_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "address_sorting_test", - "src": [ - "test/cpp/naming/address_sorting_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "dns_test_util", - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "cancel_ares_query_test", - "src": [ - "test/cpp/naming/cancel_ares_query_test.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "alts_credentials_fuzzer_one_entry", - "src": [ - "test/core/security/alts_credentials_fuzzer.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "api_fuzzer_one_entry", - "src": [ - "test/core/end2end/fuzzers/api_fuzzer.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "client_fuzzer_one_entry", - "src": [ - "test/core/end2end/fuzzers/client_fuzzer.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "hpack_parser_fuzzer_test_one_entry", - "src": [ - "test/core/transport/chttp2/hpack_parser_fuzzer_test.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "http_request_fuzzer_test_one_entry", - "src": [ - "test/core/http/request_fuzzer.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "http_response_fuzzer_test_one_entry", - "src": [ - "test/core/http/response_fuzzer.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "json_fuzzer_test_one_entry", - "src": [ - "test/core/json/fuzzer.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "nanopb_fuzzer_response_test_one_entry", - "src": [ - "test/core/nanopb/fuzzer_response.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "nanopb_fuzzer_serverlist_test_one_entry", - "src": [ - "test/core/nanopb/fuzzer_serverlist.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "percent_decode_fuzzer_one_entry", - "src": [ - "test/core/slice/percent_decode_fuzzer.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "percent_encode_fuzzer_one_entry", - "src": [ - "test/core/slice/percent_encode_fuzzer.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "server_fuzzer_one_entry", - "src": [ - "test/core/end2end/fuzzers/server_fuzzer.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "ssl_server_fuzzer_one_entry", - "src": [ - "test/core/security/ssl_server_fuzzer.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "uri_fuzzer_test_one_entry", - "src": [ - "test/core/client_channel/uri_fuzzer_test.cc", - "test/core/util/one_corpus_entry_fuzzer.cc" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [], - "headers": [ - "third_party/address_sorting/address_sorting_internal.h", - "third_party/address_sorting/include/address_sorting/address_sorting.h" - ], - "is_filegroup": false, - "language": "c", - "name": "address_sorting", - "src": [], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "grpc" - ], - "headers": [ - "test/core/tsi/alts/crypt/gsec_test_util.h", - "test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.h" - ], - "is_filegroup": false, - "language": "c", - "name": "alts_test_util", - "src": [ - "test/core/tsi/alts/crypt/gsec_test_util.cc", - "test/core/tsi/alts/crypt/gsec_test_util.h", - "test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.cc", - "test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "cxxabi", - "src": [], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr_base" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr", - "src": [], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "census", - "gpr", - "grpc_base", - "grpc_client_authority_filter", - "grpc_client_idle_filter", - "grpc_deadline_filter", - "grpc_lb_policy_grpclb_secure", - "grpc_lb_policy_pick_first", - "grpc_lb_policy_round_robin", - "grpc_lb_policy_xds_secure", - "grpc_max_age_filter", - "grpc_message_size_filter", - "grpc_resolver_dns_ares", - "grpc_resolver_dns_native", - "grpc_resolver_fake", - "grpc_resolver_sockaddr", - "grpc_secure", - "grpc_server_backward_compatibility", - "grpc_transport_chttp2_client_insecure", - "grpc_transport_chttp2_client_secure", - "grpc_transport_chttp2_server_insecure", - "grpc_transport_chttp2_server_secure", - "grpc_transport_inproc", - "grpc_workaround_cronet_compression_filter" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc", - "src": [ - "src/core/lib/surface/init.cc" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_transport_chttp2_client_secure", - "grpc_transport_cronet_client_secure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_cronet", - "src": [ - "src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc", - "src/core/lib/surface/init.cc" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util_base" - ], - "headers": [ - "test/core/end2end/data/ssl_test_data.h", - "test/core/security/oauth2_utils.h" - ], - "is_filegroup": false, - "language": "c", - "name": "grpc_test_util", - "src": [ - "test/core/end2end/data/client_certs.cc", - "test/core/end2end/data/server1_cert.cc", - "test/core/end2end/data/server1_key.cc", - "test/core/end2end/data/ssl_test_data.h", - "test/core/end2end/data/test_root_cert.cc", - "test/core/security/oauth2_utils.cc", - "test/core/security/oauth2_utils.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc_test_util_base", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_test_util_unsecure", - "src": [], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "census", - "gpr", - "grpc_base", - "grpc_client_authority_filter", - "grpc_client_idle_filter", - "grpc_deadline_filter", - "grpc_lb_policy_grpclb", - "grpc_lb_policy_pick_first", - "grpc_lb_policy_round_robin", - "grpc_lb_policy_xds", - "grpc_max_age_filter", - "grpc_message_size_filter", - "grpc_resolver_dns_ares", - "grpc_resolver_dns_native", - "grpc_resolver_fake", - "grpc_resolver_sockaddr", - "grpc_server_backward_compatibility", - "grpc_transport_chttp2_client_insecure", - "grpc_transport_chttp2_server_insecure", - "grpc_transport_inproc", - "grpc_workaround_cronet_compression_filter" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_unsecure", - "src": [ - "src/core/lib/surface/init.cc", - "src/core/lib/surface/init_unsecure.cc" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util", - "test_tcp_server" - ], - "headers": [ - "test/core/util/reconnect_server.h" - ], - "is_filegroup": false, - "language": "c", - "name": "reconnect_server", - "src": [ - "test/core/util/reconnect_server.cc", - "test/core/util/reconnect_server.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [ - "test/core/util/test_tcp_server.h" - ], - "is_filegroup": false, - "language": "c", - "name": "test_tcp_server", - "src": [ - "test/core/util/test_tcp_server.cc", - "test/core/util/test_tcp_server.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "benchmark", - "gpr", - "grpc++_test_config", - "grpc++_test_util_unsecure", - "grpc++_unsecure", - "grpc_benchmark", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [ - "src/proto/grpc/testing/echo.grpc.pb.h", - "src/proto/grpc/testing/echo.pb.h", - "src/proto/grpc/testing/echo_mock.grpc.pb.h", - "test/cpp/microbenchmarks/callback_test_service.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "bm_callback_test_service_impl", - "src": [ - "test/cpp/microbenchmarks/callback_test_service.cc", - "test/cpp/microbenchmarks/callback_test_service.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [], - "headers": [ - "test/cpp/naming/dns_test_util.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "dns_test_util", - "src": [ - "test/cpp/naming/dns_test_util.cc", - "test/cpp/naming/dns_test_util.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++_base", - "grpc++_codegen_base", - "grpc++_codegen_base_src", - "grpc++_codegen_proto" - ], - "headers": [ - "include/grpc++/impl/codegen/core_codegen.h", - "include/grpcpp/impl/codegen/core_codegen.h", - "src/cpp/client/secure_credentials.h", - "src/cpp/common/secure_auth_context.h", - "src/cpp/server/secure_server_credentials.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc++", - "src": [ - "include/grpc++/impl/codegen/core_codegen.h", - "include/grpcpp/impl/codegen/core_codegen.h", - "src/cpp/client/insecure_credentials.cc", - "src/cpp/client/secure_credentials.cc", - "src/cpp/client/secure_credentials.h", - "src/cpp/common/auth_property_iterator.cc", - "src/cpp/common/secure_auth_context.cc", - "src/cpp/common/secure_auth_context.h", - "src/cpp/common/secure_channel_arguments.cc", - "src/cpp/common/secure_create_auth_context.cc", - "src/cpp/server/insecure_server_credentials.cc", - "src/cpp/server/secure_server_credentials.cc", - "src/cpp/server/secure_server_credentials.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "grpc++" - ], - "headers": [ - "src/cpp/util/core_stats.h", - "src/proto/grpc/core/stats.grpc.pb.h", - "src/proto/grpc/core/stats.pb.h", - "src/proto/grpc/core/stats_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc++_core_stats", - "src": [ - "src/cpp/util/core_stats.cc", - "src/cpp/util/core_stats.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "grpc++" - ], - "headers": [ - "include/grpc++/support/error_details.h", - "include/grpcpp/support/error_details.h", - "include/grpcpp/support/error_details_impl.h", - "src/proto/grpc/status/status.grpc.pb.h", - "src/proto/grpc/status/status.pb.h", - "src/proto/grpc/status/status_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc++_error_details", - "src": [ - "include/grpc++/support/error_details.h", - "include/grpcpp/support/error_details.h", - "include/grpcpp/support/error_details_impl.h", - "src/cpp/util/error_details.cc" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "grpc", - "grpc++", - "grpc++_config_proto", - "grpc++_reflection_proto" - ], - "headers": [ - "test/cpp/util/proto_reflection_descriptor_database.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc++_proto_reflection_desc_db", - "src": [ - "test/cpp/util/proto_reflection_descriptor_database.cc", - "test/cpp/util/proto_reflection_descriptor_database.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "grpc", - "grpc++", - "grpc++_reflection_proto" - ], - "headers": [ - "include/grpc++/ext/proto_server_reflection_plugin.h", - "include/grpcpp/ext/proto_server_reflection_plugin.h", - "include/grpcpp/ext/proto_server_reflection_plugin_impl.h", - "src/cpp/ext/proto_server_reflection.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc++_reflection", - "src": [ - "include/grpc++/ext/proto_server_reflection_plugin.h", - "include/grpcpp/ext/proto_server_reflection_plugin.h", - "include/grpcpp/ext/proto_server_reflection_plugin_impl.h", - "src/cpp/ext/proto_server_reflection.cc", - "src/cpp/ext/proto_server_reflection.h", - "src/cpp/ext/proto_server_reflection_plugin.cc" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [], - "headers": [ - "test/cpp/util/test_config.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc++_test_config", - "src": [ - "test/cpp/util/test_config.h", - "test/cpp/util/test_config_cc.cc" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "grpc", - "grpc++", - "grpc++_codegen_base", - "grpc++_codegen_base_src", - "grpc++_codegen_proto", - "grpc++_config_proto", - "grpc_test_util" - ], - "headers": [ - "src/proto/grpc/channelz/channelz.grpc.pb.h", - "src/proto/grpc/channelz/channelz.pb.h", - "src/proto/grpc/channelz/channelz_mock.grpc.pb.h", - "src/proto/grpc/health/v1/health.grpc.pb.h", - "src/proto/grpc/health/v1/health.pb.h", - "src/proto/grpc/health/v1/health_mock.grpc.pb.h", - "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h", - "src/proto/grpc/testing/duplicate/echo_duplicate.pb.h", - "src/proto/grpc/testing/duplicate/echo_duplicate_mock.grpc.pb.h", - "src/proto/grpc/testing/echo.grpc.pb.h", - "src/proto/grpc/testing/echo.pb.h", - "src/proto/grpc/testing/echo_messages.grpc.pb.h", - "src/proto/grpc/testing/echo_messages.pb.h", - "src/proto/grpc/testing/echo_messages_mock.grpc.pb.h", - "src/proto/grpc/testing/echo_mock.grpc.pb.h", - "src/proto/grpc/testing/simple_messages.grpc.pb.h", - "src/proto/grpc/testing/simple_messages.pb.h", - "src/proto/grpc/testing/simple_messages_mock.grpc.pb.h", - "test/cpp/end2end/test_health_check_service_impl.h", - "test/cpp/end2end/test_service_impl.h", - "test/cpp/util/byte_buffer_proto_helper.h", - "test/cpp/util/channel_trace_proto_helper.h", - "test/cpp/util/create_test_channel.h", - "test/cpp/util/string_ref_helper.h", - "test/cpp/util/subprocess.h", - "test/cpp/util/test_credentials_provider.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc++_test_util", - "src": [ - "test/cpp/end2end/test_health_check_service_impl.cc", - "test/cpp/end2end/test_health_check_service_impl.h", - "test/cpp/end2end/test_service_impl.cc", - "test/cpp/end2end/test_service_impl.h", - "test/cpp/util/byte_buffer_proto_helper.cc", - "test/cpp/util/byte_buffer_proto_helper.h", - "test/cpp/util/channel_trace_proto_helper.cc", - "test/cpp/util/channel_trace_proto_helper.h", - "test/cpp/util/create_test_channel.cc", - "test/cpp/util/create_test_channel.h", - "test/cpp/util/string_ref_helper.cc", - "test/cpp/util/string_ref_helper.h", - "test/cpp/util/subprocess.cc", - "test/cpp/util/subprocess.h", - "test/cpp/util/test_credentials_provider.cc", - "test/cpp/util/test_credentials_provider.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "grpc++_codegen_base", - "grpc++_codegen_base_src", - "grpc++_codegen_proto", - "grpc++_config_proto", - "grpc++_unsecure", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [ - "src/proto/grpc/health/v1/health.grpc.pb.h", - "src/proto/grpc/health/v1/health.pb.h", - "src/proto/grpc/health/v1/health_mock.grpc.pb.h", - "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h", - "src/proto/grpc/testing/duplicate/echo_duplicate.pb.h", - "src/proto/grpc/testing/duplicate/echo_duplicate_mock.grpc.pb.h", - "src/proto/grpc/testing/echo.grpc.pb.h", - "src/proto/grpc/testing/echo.pb.h", - "src/proto/grpc/testing/echo_messages.grpc.pb.h", - "src/proto/grpc/testing/echo_messages.pb.h", - "src/proto/grpc/testing/echo_messages_mock.grpc.pb.h", - "src/proto/grpc/testing/echo_mock.grpc.pb.h", - "src/proto/grpc/testing/simple_messages.grpc.pb.h", - "src/proto/grpc/testing/simple_messages.pb.h", - "src/proto/grpc/testing/simple_messages_mock.grpc.pb.h", - "test/cpp/end2end/test_health_check_service_impl.h", - "test/cpp/end2end/test_service_impl.h", - "test/cpp/util/byte_buffer_proto_helper.h", - "test/cpp/util/string_ref_helper.h", - "test/cpp/util/subprocess.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc++_test_util_unsecure", - "src": [ - "test/cpp/end2end/test_health_check_service_impl.cc", - "test/cpp/end2end/test_health_check_service_impl.h", - "test/cpp/end2end/test_service_impl.cc", - "test/cpp/end2end/test_service_impl.h", - "test/cpp/util/byte_buffer_proto_helper.cc", - "test/cpp/util/byte_buffer_proto_helper.h", - "test/cpp/util/string_ref_helper.cc", - "test/cpp/util/string_ref_helper.h", - "test/cpp/util/subprocess.cc", - "test/cpp/util/subprocess.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc++_base_unsecure", - "grpc++_codegen_base", - "grpc++_codegen_base_src", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc++_unsecure", - "src": [ - "src/cpp/client/insecure_credentials.cc", - "src/cpp/common/insecure_create_auth_context.cc", - "src/cpp/server/insecure_server_credentials.cc" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "benchmark", - "grpc++_unsecure", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [ - "test/cpp/microbenchmarks/fullstack_context_mutators.h", - "test/cpp/microbenchmarks/fullstack_fixtures.h", - "test/cpp/microbenchmarks/helpers.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc_benchmark", - "src": [ - "test/cpp/microbenchmarks/fullstack_context_mutators.h", - "test/cpp/microbenchmarks/fullstack_fixtures.h", - "test/cpp/microbenchmarks/helpers.cc", - "test/cpp/microbenchmarks/helpers.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "grpc", - "grpc++", - "grpc++_config_proto", - "grpc++_proto_reflection_desc_db", - "grpc++_reflection_proto" - ], - "headers": [ - "test/cpp/util/cli_call.h", - "test/cpp/util/cli_credentials.h", - "test/cpp/util/config_grpc_cli.h", - "test/cpp/util/grpc_tool.h", - "test/cpp/util/proto_file_parser.h", - "test/cpp/util/service_describer.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc_cli_libs", - "src": [ - "test/cpp/util/cli_call.cc", - "test/cpp/util/cli_call.h", - "test/cpp/util/cli_credentials.cc", - "test/cpp/util/cli_credentials.h", - "test/cpp/util/config_grpc_cli.h", - "test/cpp/util/grpc_tool.cc", - "test/cpp/util/grpc_tool.h", - "test/cpp/util/proto_file_parser.cc", - "test/cpp/util/proto_file_parser.h", - "test/cpp/util/service_describer.cc", - "test/cpp/util/service_describer.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "grpc++_config_proto" - ], - "headers": [ - "src/compiler/config.h", - "src/compiler/config_protobuf.h", - "src/compiler/cpp_generator.h", - "src/compiler/cpp_generator_helpers.h", - "src/compiler/csharp_generator.h", - "src/compiler/csharp_generator_helpers.h", - "src/compiler/generator_helpers.h", - "src/compiler/node_generator.h", - "src/compiler/node_generator_helpers.h", - "src/compiler/objective_c_generator.h", - "src/compiler/objective_c_generator_helpers.h", - "src/compiler/php_generator.h", - "src/compiler/php_generator_helpers.h", - "src/compiler/protobuf_plugin.h", - "src/compiler/python_generator.h", - "src/compiler/python_generator_helpers.h", - "src/compiler/python_private_generator.h", - "src/compiler/ruby_generator.h", - "src/compiler/ruby_generator_helpers-inl.h", - "src/compiler/ruby_generator_map-inl.h", - "src/compiler/ruby_generator_string-inl.h", - "src/compiler/schema_interface.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc_plugin_support", - "src": [ - "src/compiler/config.h", - "src/compiler/config_protobuf.h", - "src/compiler/cpp_generator.cc", - "src/compiler/cpp_generator.h", - "src/compiler/cpp_generator_helpers.h", - "src/compiler/csharp_generator.cc", - "src/compiler/csharp_generator.h", - "src/compiler/csharp_generator_helpers.h", - "src/compiler/generator_helpers.h", - "src/compiler/node_generator.cc", - "src/compiler/node_generator.h", - "src/compiler/node_generator_helpers.h", - "src/compiler/objective_c_generator.cc", - "src/compiler/objective_c_generator.h", - "src/compiler/objective_c_generator_helpers.h", - "src/compiler/php_generator.cc", - "src/compiler/php_generator.h", - "src/compiler/php_generator_helpers.h", - "src/compiler/protobuf_plugin.h", - "src/compiler/python_generator.cc", - "src/compiler/python_generator.h", - "src/compiler/python_generator_helpers.h", - "src/compiler/python_private_generator.h", - "src/compiler/ruby_generator.cc", - "src/compiler/ruby_generator.h", - "src/compiler/ruby_generator_helpers-inl.h", - "src/compiler/ruby_generator_map-inl.h", - "src/compiler/ruby_generator_string-inl.h", - "src/compiler/schema_interface.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "grpc", - "grpc++", - "grpcpp_channelz_proto" - ], - "headers": [ - "include/grpcpp/ext/channelz_service_plugin.h", - "include/grpcpp/ext/channelz_service_plugin_impl.h", - "src/cpp/server/channelz/channelz_service.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpcpp_channelz", - "src": [ - "include/grpcpp/ext/channelz_service_plugin.h", - "include/grpcpp/ext/channelz_service_plugin_impl.h", - "src/cpp/server/channelz/channelz_service.cc", - "src/cpp/server/channelz/channelz_service.h", - "src/cpp/server/channelz/channelz_service_plugin.cc" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "src/proto/grpc/testing/empty.grpc.pb.h", - "src/proto/grpc/testing/empty.pb.h", - "src/proto/grpc/testing/empty_mock.grpc.pb.h", - "src/proto/grpc/testing/messages.grpc.pb.h", - "src/proto/grpc/testing/messages.pb.h", - "src/proto/grpc/testing/messages_mock.grpc.pb.h", - "src/proto/grpc/testing/test.grpc.pb.h", - "src/proto/grpc/testing/test.pb.h", - "src/proto/grpc/testing/test_mock.grpc.pb.h", - "test/cpp/interop/http2_client.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "http2_client_main", - "src": [ - "test/cpp/interop/http2_client.cc", - "test/cpp/interop/http2_client.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "src/proto/grpc/testing/messages.grpc.pb.h", - "src/proto/grpc/testing/messages.pb.h", - "src/proto/grpc/testing/messages_mock.grpc.pb.h", - "test/cpp/interop/client_helper.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "interop_client_helper", - "src": [ - "test/cpp/interop/client_helper.cc", - "test/cpp/interop/client_helper.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util", - "interop_client_helper" - ], - "headers": [ - "src/proto/grpc/testing/empty.grpc.pb.h", - "src/proto/grpc/testing/empty.pb.h", - "src/proto/grpc/testing/empty_mock.grpc.pb.h", - "src/proto/grpc/testing/messages.grpc.pb.h", - "src/proto/grpc/testing/messages.pb.h", - "src/proto/grpc/testing/messages_mock.grpc.pb.h", - "src/proto/grpc/testing/test.grpc.pb.h", - "src/proto/grpc/testing/test.pb.h", - "src/proto/grpc/testing/test_mock.grpc.pb.h", - "test/cpp/interop/interop_client.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "interop_client_main", - "src": [ - "test/cpp/interop/client.cc", - "test/cpp/interop/interop_client.cc", - "test/cpp/interop/interop_client.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "test/cpp/interop/server_helper.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "interop_server_helper", - "src": [ - "test/cpp/interop/server_helper.cc", - "test/cpp/interop/server_helper.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc++_test_util", - "grpc_test_util", - "interop_server_helper" - ], - "headers": [ - "src/proto/grpc/testing/empty.grpc.pb.h", - "src/proto/grpc/testing/empty.pb.h", - "src/proto/grpc/testing/empty_mock.grpc.pb.h", - "src/proto/grpc/testing/messages.grpc.pb.h", - "src/proto/grpc/testing/messages.pb.h", - "src/proto/grpc/testing/messages_mock.grpc.pb.h", - "src/proto/grpc/testing/test.grpc.pb.h", - "src/proto/grpc/testing/test.pb.h", - "src/proto/grpc/testing/test_mock.grpc.pb.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "interop_server_lib", - "src": [ - "test/cpp/interop/interop_server.cc" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "interop_server_lib" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "interop_server_main", - "src": [ - "test/cpp/interop/interop_server_bootstrap.cc" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "grpc", - "grpc++", - "grpc++_core_stats", - "grpc++_test_util", - "grpc_test_util" - ], - "headers": [ - "src/proto/grpc/testing/benchmark_service.grpc.pb.h", - "src/proto/grpc/testing/benchmark_service.pb.h", - "src/proto/grpc/testing/benchmark_service_mock.grpc.pb.h", - "src/proto/grpc/testing/control.grpc.pb.h", - "src/proto/grpc/testing/control.pb.h", - "src/proto/grpc/testing/control_mock.grpc.pb.h", - "src/proto/grpc/testing/messages.grpc.pb.h", - "src/proto/grpc/testing/messages.pb.h", - "src/proto/grpc/testing/messages_mock.grpc.pb.h", - "src/proto/grpc/testing/payloads.grpc.pb.h", - "src/proto/grpc/testing/payloads.pb.h", - "src/proto/grpc/testing/payloads_mock.grpc.pb.h", - "src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.h", - "src/proto/grpc/testing/report_qps_scenario_service.pb.h", - "src/proto/grpc/testing/report_qps_scenario_service_mock.grpc.pb.h", - "src/proto/grpc/testing/stats.grpc.pb.h", - "src/proto/grpc/testing/stats.pb.h", - "src/proto/grpc/testing/stats_mock.grpc.pb.h", - "src/proto/grpc/testing/worker_service.grpc.pb.h", - "src/proto/grpc/testing/worker_service.pb.h", - "src/proto/grpc/testing/worker_service_mock.grpc.pb.h", - "test/cpp/qps/benchmark_config.h", - "test/cpp/qps/client.h", - "test/cpp/qps/driver.h", - "test/cpp/qps/histogram.h", - "test/cpp/qps/interarrival.h", - "test/cpp/qps/parse_json.h", - "test/cpp/qps/qps_server_builder.h", - "test/cpp/qps/qps_worker.h", - "test/cpp/qps/report.h", - "test/cpp/qps/server.h", - "test/cpp/qps/stats.h", - "test/cpp/qps/usage_timer.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "qps", - "src": [ - "test/cpp/qps/benchmark_config.cc", - "test/cpp/qps/benchmark_config.h", - "test/cpp/qps/client.h", - "test/cpp/qps/client_async.cc", - "test/cpp/qps/client_callback.cc", - "test/cpp/qps/client_sync.cc", - "test/cpp/qps/driver.cc", - "test/cpp/qps/driver.h", - "test/cpp/qps/histogram.h", - "test/cpp/qps/interarrival.h", - "test/cpp/qps/parse_json.cc", - "test/cpp/qps/parse_json.h", - "test/cpp/qps/qps_server_builder.cc", - "test/cpp/qps/qps_server_builder.h", - "test/cpp/qps/qps_worker.cc", - "test/cpp/qps/qps_worker.h", - "test/cpp/qps/report.cc", - "test/cpp/qps/report.h", - "test/cpp/qps/server.h", - "test/cpp/qps/server_async.cc", - "test/cpp/qps/server_callback.cc", - "test/cpp/qps/server_sync.cc", - "test/cpp/qps/stats.h", - "test/cpp/qps/usage_timer.cc", - "test/cpp/qps/usage_timer.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc" - ], - "headers": [], - "is_filegroup": false, - "language": "csharp", - "name": "grpc_csharp_ext", - "src": [ - "src/csharp/ext/grpc_csharp_ext.c" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [], - "headers": [ - "third_party/boringssl/crypto/asn1/asn1_locl.h", - "third_party/boringssl/crypto/bio/internal.h", - "third_party/boringssl/crypto/bytestring/internal.h", - "third_party/boringssl/crypto/cipher_extra/internal.h", - "third_party/boringssl/crypto/conf/conf_def.h", - "third_party/boringssl/crypto/conf/internal.h", - "third_party/boringssl/crypto/err/internal.h", - "third_party/boringssl/crypto/evp/internal.h", - "third_party/boringssl/crypto/fipsmodule/aes/aes.c", - "third_party/boringssl/crypto/fipsmodule/aes/internal.h", - "third_party/boringssl/crypto/fipsmodule/aes/key_wrap.c", - "third_party/boringssl/crypto/fipsmodule/aes/mode_wrappers.c", - "third_party/boringssl/crypto/fipsmodule/bn/add.c", - "third_party/boringssl/crypto/fipsmodule/bn/asm/x86_64-gcc.c", - "third_party/boringssl/crypto/fipsmodule/bn/bn.c", - "third_party/boringssl/crypto/fipsmodule/bn/bytes.c", - "third_party/boringssl/crypto/fipsmodule/bn/cmp.c", - "third_party/boringssl/crypto/fipsmodule/bn/ctx.c", - "third_party/boringssl/crypto/fipsmodule/bn/div.c", - "third_party/boringssl/crypto/fipsmodule/bn/exponentiation.c", - "third_party/boringssl/crypto/fipsmodule/bn/gcd.c", - "third_party/boringssl/crypto/fipsmodule/bn/generic.c", - "third_party/boringssl/crypto/fipsmodule/bn/internal.h", - "third_party/boringssl/crypto/fipsmodule/bn/jacobi.c", - "third_party/boringssl/crypto/fipsmodule/bn/montgomery.c", - "third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.c", - "third_party/boringssl/crypto/fipsmodule/bn/mul.c", - "third_party/boringssl/crypto/fipsmodule/bn/prime.c", - "third_party/boringssl/crypto/fipsmodule/bn/random.c", - "third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.c", - "third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h", - "third_party/boringssl/crypto/fipsmodule/bn/shift.c", - "third_party/boringssl/crypto/fipsmodule/bn/sqrt.c", - "third_party/boringssl/crypto/fipsmodule/cipher/aead.c", - "third_party/boringssl/crypto/fipsmodule/cipher/cipher.c", - "third_party/boringssl/crypto/fipsmodule/cipher/e_aes.c", - "third_party/boringssl/crypto/fipsmodule/cipher/e_des.c", - "third_party/boringssl/crypto/fipsmodule/cipher/internal.h", - "third_party/boringssl/crypto/fipsmodule/delocate.h", - "third_party/boringssl/crypto/fipsmodule/des/des.c", - "third_party/boringssl/crypto/fipsmodule/des/internal.h", - "third_party/boringssl/crypto/fipsmodule/digest/digest.c", - "third_party/boringssl/crypto/fipsmodule/digest/digests.c", - "third_party/boringssl/crypto/fipsmodule/digest/internal.h", - "third_party/boringssl/crypto/fipsmodule/digest/md32_common.h", - "third_party/boringssl/crypto/fipsmodule/ec/ec.c", - "third_party/boringssl/crypto/fipsmodule/ec/ec_key.c", - "third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.c", - "third_party/boringssl/crypto/fipsmodule/ec/internal.h", - "third_party/boringssl/crypto/fipsmodule/ec/oct.c", - "third_party/boringssl/crypto/fipsmodule/ec/p224-64.c", - "third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h", - "third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.c", - "third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.h", - "third_party/boringssl/crypto/fipsmodule/ec/simple.c", - "third_party/boringssl/crypto/fipsmodule/ec/util.c", - "third_party/boringssl/crypto/fipsmodule/ec/wnaf.c", - "third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c", - "third_party/boringssl/crypto/fipsmodule/hmac/hmac.c", - "third_party/boringssl/crypto/fipsmodule/md4/md4.c", - "third_party/boringssl/crypto/fipsmodule/md5/md5.c", - "third_party/boringssl/crypto/fipsmodule/modes/cbc.c", - "third_party/boringssl/crypto/fipsmodule/modes/ccm.c", - "third_party/boringssl/crypto/fipsmodule/modes/cfb.c", - "third_party/boringssl/crypto/fipsmodule/modes/ctr.c", - "third_party/boringssl/crypto/fipsmodule/modes/gcm.c", - "third_party/boringssl/crypto/fipsmodule/modes/internal.h", - "third_party/boringssl/crypto/fipsmodule/modes/ofb.c", - "third_party/boringssl/crypto/fipsmodule/modes/polyval.c", - "third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.c", - "third_party/boringssl/crypto/fipsmodule/rand/internal.h", - "third_party/boringssl/crypto/fipsmodule/rand/rand.c", - "third_party/boringssl/crypto/fipsmodule/rand/urandom.c", - "third_party/boringssl/crypto/fipsmodule/rsa/blinding.c", - "third_party/boringssl/crypto/fipsmodule/rsa/internal.h", - "third_party/boringssl/crypto/fipsmodule/rsa/padding.c", - "third_party/boringssl/crypto/fipsmodule/rsa/rsa.c", - "third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c", - "third_party/boringssl/crypto/fipsmodule/self_check/self_check.c", - "third_party/boringssl/crypto/fipsmodule/sha/sha1-altivec.c", - "third_party/boringssl/crypto/fipsmodule/sha/sha1.c", - "third_party/boringssl/crypto/fipsmodule/sha/sha256.c", - "third_party/boringssl/crypto/fipsmodule/sha/sha512.c", - "third_party/boringssl/crypto/fipsmodule/tls/internal.h", - "third_party/boringssl/crypto/fipsmodule/tls/kdf.c", - "third_party/boringssl/crypto/internal.h", - "third_party/boringssl/crypto/obj/obj_dat.h", - "third_party/boringssl/crypto/pkcs7/internal.h", - "third_party/boringssl/crypto/pkcs8/internal.h", - "third_party/boringssl/crypto/poly1305/internal.h", - "third_party/boringssl/crypto/pool/internal.h", - "third_party/boringssl/crypto/x509/charmap.h", - "third_party/boringssl/crypto/x509/internal.h", - "third_party/boringssl/crypto/x509/vpm_int.h", - "third_party/boringssl/crypto/x509v3/ext_dat.h", - "third_party/boringssl/crypto/x509v3/pcy_int.h", - "third_party/boringssl/include/openssl/aead.h", - "third_party/boringssl/include/openssl/aes.h", - "third_party/boringssl/include/openssl/arm_arch.h", - "third_party/boringssl/include/openssl/asn1.h", - "third_party/boringssl/include/openssl/asn1_mac.h", - "third_party/boringssl/include/openssl/asn1t.h", - "third_party/boringssl/include/openssl/base.h", - "third_party/boringssl/include/openssl/base64.h", - "third_party/boringssl/include/openssl/bio.h", - "third_party/boringssl/include/openssl/blowfish.h", - "third_party/boringssl/include/openssl/bn.h", - "third_party/boringssl/include/openssl/buf.h", - "third_party/boringssl/include/openssl/buffer.h", - "third_party/boringssl/include/openssl/bytestring.h", - "third_party/boringssl/include/openssl/cast.h", - "third_party/boringssl/include/openssl/chacha.h", - "third_party/boringssl/include/openssl/cipher.h", - "third_party/boringssl/include/openssl/cmac.h", - "third_party/boringssl/include/openssl/conf.h", - "third_party/boringssl/include/openssl/cpu.h", - "third_party/boringssl/include/openssl/crypto.h", - "third_party/boringssl/include/openssl/curve25519.h", - "third_party/boringssl/include/openssl/des.h", - "third_party/boringssl/include/openssl/dh.h", - "third_party/boringssl/include/openssl/digest.h", - "third_party/boringssl/include/openssl/dsa.h", - "third_party/boringssl/include/openssl/dtls1.h", - "third_party/boringssl/include/openssl/ec.h", - "third_party/boringssl/include/openssl/ec_key.h", - "third_party/boringssl/include/openssl/ecdh.h", - "third_party/boringssl/include/openssl/ecdsa.h", - "third_party/boringssl/include/openssl/engine.h", - "third_party/boringssl/include/openssl/err.h", - "third_party/boringssl/include/openssl/evp.h", - "third_party/boringssl/include/openssl/ex_data.h", - "third_party/boringssl/include/openssl/hkdf.h", - "third_party/boringssl/include/openssl/hmac.h", - "third_party/boringssl/include/openssl/is_boringssl.h", - "third_party/boringssl/include/openssl/lhash.h", - "third_party/boringssl/include/openssl/lhash_macros.h", - "third_party/boringssl/include/openssl/md4.h", - "third_party/boringssl/include/openssl/md5.h", - "third_party/boringssl/include/openssl/mem.h", - "third_party/boringssl/include/openssl/nid.h", - "third_party/boringssl/include/openssl/obj.h", - "third_party/boringssl/include/openssl/obj_mac.h", - "third_party/boringssl/include/openssl/objects.h", - "third_party/boringssl/include/openssl/opensslconf.h", - "third_party/boringssl/include/openssl/opensslv.h", - "third_party/boringssl/include/openssl/ossl_typ.h", - "third_party/boringssl/include/openssl/pem.h", - "third_party/boringssl/include/openssl/pkcs12.h", - "third_party/boringssl/include/openssl/pkcs7.h", - "third_party/boringssl/include/openssl/pkcs8.h", - "third_party/boringssl/include/openssl/poly1305.h", - "third_party/boringssl/include/openssl/pool.h", - "third_party/boringssl/include/openssl/rand.h", - "third_party/boringssl/include/openssl/rc4.h", - "third_party/boringssl/include/openssl/ripemd.h", - "third_party/boringssl/include/openssl/rsa.h", - "third_party/boringssl/include/openssl/safestack.h", - "third_party/boringssl/include/openssl/sha.h", - "third_party/boringssl/include/openssl/span.h", - "third_party/boringssl/include/openssl/srtp.h", - "third_party/boringssl/include/openssl/ssl.h", - "third_party/boringssl/include/openssl/ssl3.h", - "third_party/boringssl/include/openssl/stack.h", - "third_party/boringssl/include/openssl/thread.h", - "third_party/boringssl/include/openssl/tls1.h", - "third_party/boringssl/include/openssl/type_check.h", - "third_party/boringssl/include/openssl/x509.h", - "third_party/boringssl/include/openssl/x509_vfy.h", - "third_party/boringssl/include/openssl/x509v3.h", - "third_party/boringssl/ssl/internal.h", - "third_party/boringssl/third_party/fiat/curve25519_tables.h", - "third_party/boringssl/third_party/fiat/internal.h", - "third_party/boringssl/third_party/fiat/p256.c" - ], - "is_filegroup": false, - "language": "c", - "name": "boringssl", - "src": [ - "src/boringssl/err_data.c" - ], - "third_party": true, - "type": "lib" - }, - { - "deps": [], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "boringssl_test_util", - "src": [], - "third_party": true, - "type": "lib" - }, - { - "deps": [], - "headers": [ - "third_party/benchmark/include/benchmark/benchmark.h", - "third_party/benchmark/src/arraysize.h", - "third_party/benchmark/src/benchmark_api_internal.h", - "third_party/benchmark/src/benchmark_register.h", - "third_party/benchmark/src/check.h", - "third_party/benchmark/src/colorprint.h", - "third_party/benchmark/src/commandlineflags.h", - "third_party/benchmark/src/complexity.h", - "third_party/benchmark/src/counter.h", - "third_party/benchmark/src/cycleclock.h", - "third_party/benchmark/src/internal_macros.h", - "third_party/benchmark/src/log.h", - "third_party/benchmark/src/mutex.h", - "third_party/benchmark/src/re.h", - "third_party/benchmark/src/sleep.h", - "third_party/benchmark/src/statistics.h", - "third_party/benchmark/src/string_util.h", - "third_party/benchmark/src/thread_manager.h", - "third_party/benchmark/src/thread_timer.h", - "third_party/benchmark/src/timers.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "benchmark", - "src": [], - "third_party": false, - "type": "lib" - }, - { - "deps": [], - "headers": [ - "third_party/zlib/crc32.h", - "third_party/zlib/deflate.h", - "third_party/zlib/gzguts.h", - "third_party/zlib/inffast.h", - "third_party/zlib/inffixed.h", - "third_party/zlib/inflate.h", - "third_party/zlib/inftrees.h", - "third_party/zlib/trees.h", - "third_party/zlib/zconf.h", - "third_party/zlib/zlib.h", - "third_party/zlib/zutil.h" - ], - "is_filegroup": false, - "language": "c", - "name": "z", - "src": [], - "third_party": true, - "type": "lib" - }, - { - "deps": [], - "headers": [ - "third_party/cares/ares_build.h", - "third_party/cares/cares/ares.h", - "third_party/cares/cares/ares_data.h", - "third_party/cares/cares/ares_dns.h", - "third_party/cares/cares/ares_getenv.h", - "third_party/cares/cares/ares_getopt.h", - "third_party/cares/cares/ares_inet_net_pton.h", - "third_party/cares/cares/ares_iphlpapi.h", - "third_party/cares/cares/ares_ipv6.h", - "third_party/cares/cares/ares_library_init.h", - "third_party/cares/cares/ares_llist.h", - "third_party/cares/cares/ares_nowarn.h", - "third_party/cares/cares/ares_platform.h", - "third_party/cares/cares/ares_private.h", - "third_party/cares/cares/ares_rules.h", - "third_party/cares/cares/ares_setup.h", - "third_party/cares/cares/ares_strcasecmp.h", - "third_party/cares/cares/ares_strdup.h", - "third_party/cares/cares/ares_strsplit.h", - "third_party/cares/cares/ares_version.h", - "third_party/cares/cares/bitncmp.h", - "third_party/cares/cares/config-win32.h", - "third_party/cares/cares/setup_once.h", - "third_party/cares/config_darwin/ares_config.h", - "third_party/cares/config_freebsd/ares_config.h", - "third_party/cares/config_linux/ares_config.h", - "third_party/cares/config_openbsd/ares_config.h" - ], - "is_filegroup": false, - "language": "c", - "name": "ares", - "src": [], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [ - "test/core/bad_client/bad_client.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "bad_client_test", - "src": [ - "test/core/bad_client/bad_client.cc", - "test/core/bad_client/bad_client.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [ - "test/core/bad_ssl/server_common.h" - ], - "is_filegroup": false, - "language": "c", - "name": "bad_ssl_test_server", - "src": [ - "test/core/bad_ssl/server_common.cc", - "test/core/bad_ssl/server_common.h" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc_test_util" - ], - "headers": [ - "test/core/end2end/end2end_tests.h", - "test/core/end2end/tests/cancel_test_helpers.h" - ], - "is_filegroup": false, - "language": "c", - "name": "end2end_tests", - "src": [ - "test/core/end2end/end2end_test_utils.cc", - "test/core/end2end/end2end_tests.cc", - "test/core/end2end/end2end_tests.h", - "test/core/end2end/tests/authority_not_supported.cc", - "test/core/end2end/tests/bad_hostname.cc", - "test/core/end2end/tests/bad_ping.cc", - "test/core/end2end/tests/binary_metadata.cc", - "test/core/end2end/tests/call_creds.cc", - "test/core/end2end/tests/call_host_override.cc", - "test/core/end2end/tests/cancel_after_accept.cc", - "test/core/end2end/tests/cancel_after_client_done.cc", - "test/core/end2end/tests/cancel_after_invoke.cc", - "test/core/end2end/tests/cancel_after_round_trip.cc", - "test/core/end2end/tests/cancel_before_invoke.cc", - "test/core/end2end/tests/cancel_in_a_vacuum.cc", - "test/core/end2end/tests/cancel_test_helpers.h", - "test/core/end2end/tests/cancel_with_status.cc", - "test/core/end2end/tests/channelz.cc", - "test/core/end2end/tests/compressed_payload.cc", - "test/core/end2end/tests/connectivity.cc", - "test/core/end2end/tests/default_host.cc", - "test/core/end2end/tests/disappearing_server.cc", - "test/core/end2end/tests/empty_batch.cc", - "test/core/end2end/tests/filter_call_init_fails.cc", - "test/core/end2end/tests/filter_causes_close.cc", - "test/core/end2end/tests/filter_context.cc", - "test/core/end2end/tests/filter_latency.cc", - "test/core/end2end/tests/filter_status_code.cc", - "test/core/end2end/tests/graceful_server_shutdown.cc", - "test/core/end2end/tests/high_initial_seqno.cc", - "test/core/end2end/tests/hpack_size.cc", - "test/core/end2end/tests/idempotent_request.cc", - "test/core/end2end/tests/invoke_large_request.cc", - "test/core/end2end/tests/keepalive_timeout.cc", - "test/core/end2end/tests/large_metadata.cc", - "test/core/end2end/tests/max_concurrent_streams.cc", - "test/core/end2end/tests/max_connection_age.cc", - "test/core/end2end/tests/max_connection_idle.cc", - "test/core/end2end/tests/max_message_length.cc", - "test/core/end2end/tests/negative_deadline.cc", - "test/core/end2end/tests/no_error_on_hotpath.cc", - "test/core/end2end/tests/no_logging.cc", - "test/core/end2end/tests/no_op.cc", - "test/core/end2end/tests/payload.cc", - "test/core/end2end/tests/ping.cc", - "test/core/end2end/tests/ping_pong_streaming.cc", - "test/core/end2end/tests/proxy_auth.cc", - "test/core/end2end/tests/registered_call.cc", - "test/core/end2end/tests/request_with_flags.cc", - "test/core/end2end/tests/request_with_payload.cc", - "test/core/end2end/tests/resource_quota_server.cc", - "test/core/end2end/tests/retry.cc", - "test/core/end2end/tests/retry_cancellation.cc", - "test/core/end2end/tests/retry_disabled.cc", - "test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc", - "test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc", - "test/core/end2end/tests/retry_non_retriable_status.cc", - "test/core/end2end/tests/retry_non_retriable_status_before_recv_trailing_metadata_started.cc", - "test/core/end2end/tests/retry_recv_initial_metadata.cc", - "test/core/end2end/tests/retry_recv_message.cc", - "test/core/end2end/tests/retry_server_pushback_delay.cc", - "test/core/end2end/tests/retry_server_pushback_disabled.cc", - "test/core/end2end/tests/retry_streaming.cc", - "test/core/end2end/tests/retry_streaming_after_commit.cc", - "test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc", - "test/core/end2end/tests/retry_throttled.cc", - "test/core/end2end/tests/retry_too_many_attempts.cc", - "test/core/end2end/tests/server_finishes_request.cc", - "test/core/end2end/tests/shutdown_finishes_calls.cc", - "test/core/end2end/tests/shutdown_finishes_tags.cc", - "test/core/end2end/tests/simple_cacheable_request.cc", - "test/core/end2end/tests/simple_delayed_request.cc", - "test/core/end2end/tests/simple_metadata.cc", - "test/core/end2end/tests/simple_request.cc", - "test/core/end2end/tests/stream_compression_compressed_payload.cc", - "test/core/end2end/tests/stream_compression_payload.cc", - "test/core/end2end/tests/stream_compression_ping_pong_streaming.cc", - "test/core/end2end/tests/streaming_error_response.cc", - "test/core/end2end/tests/trailing_metadata.cc", - "test/core/end2end/tests/workaround_cronet_compression.cc", - "test/core/end2end/tests/write_buffering.cc", - "test/core/end2end/tests/write_buffering_at_end.cc" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "gpr", - "grpc_test_util_unsecure", - "grpc_unsecure" - ], - "headers": [ - "test/core/end2end/end2end_tests.h", - "test/core/end2end/tests/cancel_test_helpers.h" - ], - "is_filegroup": false, - "language": "c", - "name": "end2end_nosec_tests", - "src": [ - "test/core/end2end/end2end_nosec_tests.cc", - "test/core/end2end/end2end_test_utils.cc", - "test/core/end2end/end2end_tests.h", - "test/core/end2end/tests/authority_not_supported.cc", - "test/core/end2end/tests/bad_hostname.cc", - "test/core/end2end/tests/bad_ping.cc", - "test/core/end2end/tests/binary_metadata.cc", - "test/core/end2end/tests/call_host_override.cc", - "test/core/end2end/tests/cancel_after_accept.cc", - "test/core/end2end/tests/cancel_after_client_done.cc", - "test/core/end2end/tests/cancel_after_invoke.cc", - "test/core/end2end/tests/cancel_after_round_trip.cc", - "test/core/end2end/tests/cancel_before_invoke.cc", - "test/core/end2end/tests/cancel_in_a_vacuum.cc", - "test/core/end2end/tests/cancel_test_helpers.h", - "test/core/end2end/tests/cancel_with_status.cc", - "test/core/end2end/tests/channelz.cc", - "test/core/end2end/tests/compressed_payload.cc", - "test/core/end2end/tests/connectivity.cc", - "test/core/end2end/tests/default_host.cc", - "test/core/end2end/tests/disappearing_server.cc", - "test/core/end2end/tests/empty_batch.cc", - "test/core/end2end/tests/filter_call_init_fails.cc", - "test/core/end2end/tests/filter_causes_close.cc", - "test/core/end2end/tests/filter_context.cc", - "test/core/end2end/tests/filter_latency.cc", - "test/core/end2end/tests/filter_status_code.cc", - "test/core/end2end/tests/graceful_server_shutdown.cc", - "test/core/end2end/tests/high_initial_seqno.cc", - "test/core/end2end/tests/hpack_size.cc", - "test/core/end2end/tests/idempotent_request.cc", - "test/core/end2end/tests/invoke_large_request.cc", - "test/core/end2end/tests/keepalive_timeout.cc", - "test/core/end2end/tests/large_metadata.cc", - "test/core/end2end/tests/max_concurrent_streams.cc", - "test/core/end2end/tests/max_connection_age.cc", - "test/core/end2end/tests/max_connection_idle.cc", - "test/core/end2end/tests/max_message_length.cc", - "test/core/end2end/tests/negative_deadline.cc", - "test/core/end2end/tests/no_error_on_hotpath.cc", - "test/core/end2end/tests/no_logging.cc", - "test/core/end2end/tests/no_op.cc", - "test/core/end2end/tests/payload.cc", - "test/core/end2end/tests/ping.cc", - "test/core/end2end/tests/ping_pong_streaming.cc", - "test/core/end2end/tests/proxy_auth.cc", - "test/core/end2end/tests/registered_call.cc", - "test/core/end2end/tests/request_with_flags.cc", - "test/core/end2end/tests/request_with_payload.cc", - "test/core/end2end/tests/resource_quota_server.cc", - "test/core/end2end/tests/retry.cc", - "test/core/end2end/tests/retry_cancellation.cc", - "test/core/end2end/tests/retry_disabled.cc", - "test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc", - "test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc", - "test/core/end2end/tests/retry_non_retriable_status.cc", - "test/core/end2end/tests/retry_non_retriable_status_before_recv_trailing_metadata_started.cc", - "test/core/end2end/tests/retry_recv_initial_metadata.cc", - "test/core/end2end/tests/retry_recv_message.cc", - "test/core/end2end/tests/retry_server_pushback_delay.cc", - "test/core/end2end/tests/retry_server_pushback_disabled.cc", - "test/core/end2end/tests/retry_streaming.cc", - "test/core/end2end/tests/retry_streaming_after_commit.cc", - "test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc", - "test/core/end2end/tests/retry_throttled.cc", - "test/core/end2end/tests/retry_too_many_attempts.cc", - "test/core/end2end/tests/server_finishes_request.cc", - "test/core/end2end/tests/shutdown_finishes_calls.cc", - "test/core/end2end/tests/shutdown_finishes_tags.cc", - "test/core/end2end/tests/simple_cacheable_request.cc", - "test/core/end2end/tests/simple_delayed_request.cc", - "test/core/end2end/tests/simple_metadata.cc", - "test/core/end2end/tests/simple_request.cc", - "test/core/end2end/tests/stream_compression_compressed_payload.cc", - "test/core/end2end/tests/stream_compression_payload.cc", - "test/core/end2end/tests/stream_compression_ping_pong_streaming.cc", - "test/core/end2end/tests/streaming_error_response.cc", - "test/core/end2end/tests/trailing_metadata.cc", - "test/core/end2end/tests/workaround_cronet_compression.cc", - "test/core/end2end/tests/write_buffering.cc", - "test/core/end2end/tests/write_buffering_at_end.cc" - ], - "third_party": false, - "type": "lib" - }, - { - "deps": [ - "alts_util", - "gpr", - "grpc_base", - "grpc_shadow_boringssl", - "grpc_transport_chttp2_client_insecure", - "tsi", - "tsi_interface" - ], - "headers": [ - "src/core/tsi/alts/crypt/gsec.h", - "src/core/tsi/alts/frame_protector/alts_counter.h", - "src/core/tsi/alts/frame_protector/alts_crypter.h", - "src/core/tsi/alts/frame_protector/alts_frame_protector.h", - "src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h", - "src/core/tsi/alts/frame_protector/frame_handler.h", - "src/core/tsi/alts/handshaker/alts_handshaker_client.h", - "src/core/tsi/alts/handshaker/alts_shared_resource.h", - "src/core/tsi/alts/handshaker/alts_tsi_handshaker.h", - "src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h", - "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h", - "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h", - "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h", - "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h", - "src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h", - "src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h" - ], - "is_filegroup": true, - "language": "c", - "name": "alts_tsi", - "src": [ - "src/core/tsi/alts/crypt/aes_gcm.cc", - "src/core/tsi/alts/crypt/gsec.cc", - "src/core/tsi/alts/crypt/gsec.h", - "src/core/tsi/alts/frame_protector/alts_counter.cc", - "src/core/tsi/alts/frame_protector/alts_counter.h", - "src/core/tsi/alts/frame_protector/alts_crypter.cc", - "src/core/tsi/alts/frame_protector/alts_crypter.h", - "src/core/tsi/alts/frame_protector/alts_frame_protector.cc", - "src/core/tsi/alts/frame_protector/alts_frame_protector.h", - "src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.cc", - "src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h", - "src/core/tsi/alts/frame_protector/alts_seal_privacy_integrity_crypter.cc", - "src/core/tsi/alts/frame_protector/alts_unseal_privacy_integrity_crypter.cc", - "src/core/tsi/alts/frame_protector/frame_handler.cc", - "src/core/tsi/alts/frame_protector/frame_handler.h", - "src/core/tsi/alts/handshaker/alts_handshaker_client.cc", - "src/core/tsi/alts/handshaker/alts_handshaker_client.h", - "src/core/tsi/alts/handshaker/alts_shared_resource.cc", - "src/core/tsi/alts/handshaker/alts_shared_resource.h", - "src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc", - "src/core/tsi/alts/handshaker/alts_tsi_handshaker.h", - "src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h", - "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc", - "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h", - "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc", - "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h", - "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h", - "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc", - "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h", - "src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc", - "src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h", - "src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc", - "src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "upb" - ], - "headers": [ - "src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h", - "src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h", - "src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h" - ], - "is_filegroup": true, - "language": "c", - "name": "alts_upb", - "src": [ - "src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c", - "src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h", - "src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c", - "src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h", - "src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c", - "src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "alts_upb", - "gpr", - "grpc_base", - "tsi_interface", - "upb" - ], - "headers": [ - "include/grpc/grpc_security.h", - "src/core/lib/security/credentials/alts/check_gcp_environment.h", - "src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h", - "src/core/tsi/alts/handshaker/alts_tsi_utils.h", - "src/core/tsi/alts/handshaker/transport_security_common_api.h" - ], - "is_filegroup": true, - "language": "c", - "name": "alts_util", - "src": [ - "include/grpc/grpc_security.h", - "src/core/lib/security/credentials/alts/check_gcp_environment.cc", - "src/core/lib/security/credentials/alts/check_gcp_environment.h", - "src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc", - "src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc", - "src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc", - "src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc", - "src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc", - "src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h", - "src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc", - "src/core/tsi/alts/handshaker/alts_tsi_utils.cc", - "src/core/tsi/alts/handshaker/alts_tsi_utils.h", - "src/core/tsi/alts/handshaker/transport_security_common_api.cc", - "src/core/tsi/alts/handshaker/transport_security_common_api.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base" - ], - "headers": [ - "include/grpc/census.h" - ], - "is_filegroup": true, - "language": "c", - "name": "census", - "src": [ - "include/grpc/census.h", - "src/core/ext/filters/census/grpc_context.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr_base_headers" - ], - "headers": [ - "test/core/util/cmdline.h" - ], - "is_filegroup": true, - "language": "c", - "name": "cmdline", - "src": [ - "test/core/util/cmdline.cc", - "test/core/util/cmdline.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "envoy_core_upb", - "envoy_type_upb", - "google_api_upb", - "proto_gen_validate_upb" - ], - "headers": [ - "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/cds.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/eds.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h", - "src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h", - "src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h" - ], - "is_filegroup": true, - "language": "c", - "name": "envoy_ads_upb", - "src": [ - "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/cds.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/cds.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/eds.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/eds.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h", - "src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c", - "src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h", - "src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c", - "src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "envoy_type_upb", - "google_api_upb", - "proto_gen_validate_upb" - ], - "headers": [ - "src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h" - ], - "is_filegroup": true, - "language": "c", - "name": "envoy_core_upb", - "src": [ - "src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "google_api_upb", - "proto_gen_validate_upb" - ], - "headers": [ - "src/core/ext/upb-generated/envoy/type/percent.upb.h", - "src/core/ext/upb-generated/envoy/type/range.upb.h" - ], - "is_filegroup": true, - "language": "c", - "name": "envoy_type_upb", - "src": [ - "src/core/ext/upb-generated/envoy/type/percent.upb.c", - "src/core/ext/upb-generated/envoy/type/percent.upb.h", - "src/core/ext/upb-generated/envoy/type/range.upb.c", - "src/core/ext/upb-generated/envoy/type/range.upb.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "upb" - ], - "headers": [ - "src/core/ext/upb-generated/google/api/annotations.upb.h", - "src/core/ext/upb-generated/google/api/http.upb.h", - "src/core/ext/upb-generated/google/protobuf/any.upb.h", - "src/core/ext/upb-generated/google/protobuf/descriptor.upb.h", - "src/core/ext/upb-generated/google/protobuf/duration.upb.h", - "src/core/ext/upb-generated/google/protobuf/empty.upb.h", - "src/core/ext/upb-generated/google/protobuf/struct.upb.h", - "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", - "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h", - "src/core/ext/upb-generated/google/rpc/status.upb.h" - ], - "is_filegroup": true, - "language": "c", - "name": "google_api_upb", - "src": [ - "src/core/ext/upb-generated/google/api/annotations.upb.c", - "src/core/ext/upb-generated/google/api/annotations.upb.h", - "src/core/ext/upb-generated/google/api/http.upb.c", - "src/core/ext/upb-generated/google/api/http.upb.h", - "src/core/ext/upb-generated/google/protobuf/any.upb.c", - "src/core/ext/upb-generated/google/protobuf/any.upb.h", - "src/core/ext/upb-generated/google/protobuf/descriptor.upb.c", - "src/core/ext/upb-generated/google/protobuf/descriptor.upb.h", - "src/core/ext/upb-generated/google/protobuf/duration.upb.c", - "src/core/ext/upb-generated/google/protobuf/duration.upb.h", - "src/core/ext/upb-generated/google/protobuf/empty.upb.c", - "src/core/ext/upb-generated/google/protobuf/empty.upb.h", - "src/core/ext/upb-generated/google/protobuf/struct.upb.c", - "src/core/ext/upb-generated/google/protobuf/struct.upb.h", - "src/core/ext/upb-generated/google/protobuf/timestamp.upb.c", - "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", - "src/core/ext/upb-generated/google/protobuf/wrappers.upb.c", - "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h", - "src/core/ext/upb-generated/google/rpc/status.upb.c", - "src/core/ext/upb-generated/google/rpc/status.upb.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr_base_headers" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "gpr_base", - "src": [ - "src/core/lib/gpr/alloc.cc", - "src/core/lib/gpr/atm.cc", - "src/core/lib/gpr/cpu_iphone.cc", - "src/core/lib/gpr/cpu_linux.cc", - "src/core/lib/gpr/cpu_posix.cc", - "src/core/lib/gpr/cpu_windows.cc", - "src/core/lib/gpr/env_linux.cc", - "src/core/lib/gpr/env_posix.cc", - "src/core/lib/gpr/env_windows.cc", - "src/core/lib/gpr/log.cc", - "src/core/lib/gpr/log_android.cc", - "src/core/lib/gpr/log_linux.cc", - "src/core/lib/gpr/log_posix.cc", - "src/core/lib/gpr/log_windows.cc", - "src/core/lib/gpr/mpscq.cc", - "src/core/lib/gpr/murmur_hash.cc", - "src/core/lib/gpr/string.cc", - "src/core/lib/gpr/string_posix.cc", - "src/core/lib/gpr/string_util_windows.cc", - "src/core/lib/gpr/string_windows.cc", - "src/core/lib/gpr/sync.cc", - "src/core/lib/gpr/sync_posix.cc", - "src/core/lib/gpr/sync_windows.cc", - "src/core/lib/gpr/time.cc", - "src/core/lib/gpr/time_posix.cc", - "src/core/lib/gpr/time_precise.cc", - "src/core/lib/gpr/time_windows.cc", - "src/core/lib/gpr/tls_pthread.cc", - "src/core/lib/gpr/tmpfile_msys.cc", - "src/core/lib/gpr/tmpfile_posix.cc", - "src/core/lib/gpr/tmpfile_windows.cc", - "src/core/lib/gpr/wrap_memcpy.cc", - "src/core/lib/gprpp/arena.cc", - "src/core/lib/gprpp/fork.cc", - "src/core/lib/gprpp/global_config_env.cc", - "src/core/lib/gprpp/host_port.cc", - "src/core/lib/gprpp/thd_posix.cc", - "src/core/lib/gprpp/thd_windows.cc", - "src/core/lib/profiling/basic_timers.cc", - "src/core/lib/profiling/stap_timers.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr_codegen" - ], - "headers": [ - "include/grpc/support/alloc.h", - "include/grpc/support/atm.h", - "include/grpc/support/atm_gcc_atomic.h", - "include/grpc/support/atm_gcc_sync.h", - "include/grpc/support/atm_windows.h", - "include/grpc/support/cpu.h", - "include/grpc/support/log.h", - "include/grpc/support/log_windows.h", - "include/grpc/support/port_platform.h", - "include/grpc/support/string_util.h", - "include/grpc/support/sync.h", - "include/grpc/support/sync_custom.h", - "include/grpc/support/sync_generic.h", - "include/grpc/support/sync_posix.h", - "include/grpc/support/sync_windows.h", - "include/grpc/support/thd_id.h", - "include/grpc/support/time.h", - "src/core/lib/gpr/alloc.h", - "src/core/lib/gpr/arena.h", - "src/core/lib/gpr/env.h", - "src/core/lib/gpr/mpscq.h", - "src/core/lib/gpr/murmur_hash.h", - "src/core/lib/gpr/spinlock.h", - "src/core/lib/gpr/string.h", - "src/core/lib/gpr/string_windows.h", - "src/core/lib/gpr/time_precise.h", - "src/core/lib/gpr/tls.h", - "src/core/lib/gpr/tls_gcc.h", - "src/core/lib/gpr/tls_msvc.h", - "src/core/lib/gpr/tls_pthread.h", - "src/core/lib/gpr/tmpfile.h", - "src/core/lib/gpr/useful.h", - "src/core/lib/gprpp/abstract.h", - "src/core/lib/gprpp/arena.h", - "src/core/lib/gprpp/atomic.h", - "src/core/lib/gprpp/fork.h", - "src/core/lib/gprpp/global_config.h", - "src/core/lib/gprpp/global_config_custom.h", - "src/core/lib/gprpp/global_config_env.h", - "src/core/lib/gprpp/global_config_generic.h", - "src/core/lib/gprpp/host_port.h", - "src/core/lib/gprpp/manual_constructor.h", - "src/core/lib/gprpp/map.h", - "src/core/lib/gprpp/memory.h", - "src/core/lib/gprpp/pair.h", - "src/core/lib/gprpp/sync.h", - "src/core/lib/gprpp/thd.h", - "src/core/lib/profiling/timers.h" - ], - "is_filegroup": true, - "language": "c", - "name": "gpr_base_headers", - "src": [ - "include/grpc/support/alloc.h", - "include/grpc/support/atm.h", - "include/grpc/support/atm_gcc_atomic.h", - "include/grpc/support/atm_gcc_sync.h", - "include/grpc/support/atm_windows.h", - "include/grpc/support/cpu.h", - "include/grpc/support/log.h", - "include/grpc/support/log_windows.h", - "include/grpc/support/port_platform.h", - "include/grpc/support/string_util.h", - "include/grpc/support/sync.h", - "include/grpc/support/sync_custom.h", - "include/grpc/support/sync_generic.h", - "include/grpc/support/sync_posix.h", - "include/grpc/support/sync_windows.h", - "include/grpc/support/thd_id.h", - "include/grpc/support/time.h", - "src/core/lib/gpr/alloc.h", - "src/core/lib/gpr/arena.h", - "src/core/lib/gpr/env.h", - "src/core/lib/gpr/mpscq.h", - "src/core/lib/gpr/murmur_hash.h", - "src/core/lib/gpr/spinlock.h", - "src/core/lib/gpr/string.h", - "src/core/lib/gpr/string_windows.h", - "src/core/lib/gpr/time_precise.h", - "src/core/lib/gpr/tls.h", - "src/core/lib/gpr/tls_gcc.h", - "src/core/lib/gpr/tls_msvc.h", - "src/core/lib/gpr/tls_pthread.h", - "src/core/lib/gpr/tmpfile.h", - "src/core/lib/gpr/useful.h", - "src/core/lib/gprpp/abstract.h", - "src/core/lib/gprpp/arena.h", - "src/core/lib/gprpp/atomic.h", - "src/core/lib/gprpp/fork.h", - "src/core/lib/gprpp/global_config.h", - "src/core/lib/gprpp/global_config_custom.h", - "src/core/lib/gprpp/global_config_env.h", - "src/core/lib/gprpp/global_config_generic.h", - "src/core/lib/gprpp/host_port.h", - "src/core/lib/gprpp/manual_constructor.h", - "src/core/lib/gprpp/map.h", - "src/core/lib/gprpp/memory.h", - "src/core/lib/gprpp/pair.h", - "src/core/lib/gprpp/sync.h", - "src/core/lib/gprpp/thd.h", - "src/core/lib/profiling/timers.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [], - "headers": [ - "include/grpc/impl/codegen/atm.h", - "include/grpc/impl/codegen/atm_gcc_atomic.h", - "include/grpc/impl/codegen/atm_gcc_sync.h", - "include/grpc/impl/codegen/atm_windows.h", - "include/grpc/impl/codegen/fork.h", - "include/grpc/impl/codegen/gpr_slice.h", - "include/grpc/impl/codegen/gpr_types.h", - "include/grpc/impl/codegen/log.h", - "include/grpc/impl/codegen/port_platform.h", - "include/grpc/impl/codegen/sync.h", - "include/grpc/impl/codegen/sync_custom.h", - "include/grpc/impl/codegen/sync_generic.h", - "include/grpc/impl/codegen/sync_posix.h", - "include/grpc/impl/codegen/sync_windows.h" - ], - "is_filegroup": true, - "language": "c", - "name": "gpr_codegen", - "src": [ - "include/grpc/impl/codegen/atm.h", - "include/grpc/impl/codegen/atm_gcc_atomic.h", - "include/grpc/impl/codegen/atm_gcc_sync.h", - "include/grpc/impl/codegen/atm_windows.h", - "include/grpc/impl/codegen/fork.h", - "include/grpc/impl/codegen/gpr_slice.h", - "include/grpc/impl/codegen/gpr_types.h", - "include/grpc/impl/codegen/log.h", - "include/grpc/impl/codegen/port_platform.h", - "include/grpc/impl/codegen/sync.h", - "include/grpc/impl/codegen/sync_custom.h", - "include/grpc/impl/codegen/sync_generic.h", - "include/grpc/impl/codegen/sync_posix.h", - "include/grpc/impl/codegen/sync_windows.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc", - "grpc++_codegen_base", - "grpc++_common" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc++_base", - "src": [], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc++_codegen_base", - "grpc++_common", - "grpc_unsecure" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc++_base_unsecure", - "src": [], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base_headers", - "grpc_codegen", - "grpc_trace" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc_base", - "src": [ - "src/core/lib/avl/avl.cc", - "src/core/lib/backoff/backoff.cc", - "src/core/lib/channel/channel_args.cc", - "src/core/lib/channel/channel_stack.cc", - "src/core/lib/channel/channel_stack_builder.cc", - "src/core/lib/channel/channel_trace.cc", - "src/core/lib/channel/channelz.cc", - "src/core/lib/channel/channelz_registry.cc", - "src/core/lib/channel/connected_channel.cc", - "src/core/lib/channel/handshaker.cc", - "src/core/lib/channel/handshaker_registry.cc", - "src/core/lib/channel/status_util.cc", - "src/core/lib/compression/compression.cc", - "src/core/lib/compression/compression_args.cc", - "src/core/lib/compression/compression_internal.cc", - "src/core/lib/compression/message_compress.cc", - "src/core/lib/compression/stream_compression.cc", - "src/core/lib/compression/stream_compression_gzip.cc", - "src/core/lib/compression/stream_compression_identity.cc", - "src/core/lib/debug/stats.cc", - "src/core/lib/debug/stats_data.cc", - "src/core/lib/http/format_request.cc", - "src/core/lib/http/httpcli.cc", - "src/core/lib/http/parser.cc", - "src/core/lib/iomgr/buffer_list.cc", - "src/core/lib/iomgr/call_combiner.cc", - "src/core/lib/iomgr/cfstream_handle.cc", - "src/core/lib/iomgr/combiner.cc", - "src/core/lib/iomgr/endpoint.cc", - "src/core/lib/iomgr/endpoint_cfstream.cc", - "src/core/lib/iomgr/endpoint_pair_posix.cc", - "src/core/lib/iomgr/endpoint_pair_uv.cc", - "src/core/lib/iomgr/endpoint_pair_windows.cc", - "src/core/lib/iomgr/error.cc", - "src/core/lib/iomgr/error_cfstream.cc", - "src/core/lib/iomgr/ev_epoll1_linux.cc", - "src/core/lib/iomgr/ev_epollex_linux.cc", - "src/core/lib/iomgr/ev_poll_posix.cc", - "src/core/lib/iomgr/ev_posix.cc", - "src/core/lib/iomgr/ev_windows.cc", - "src/core/lib/iomgr/exec_ctx.cc", - "src/core/lib/iomgr/executor.cc", - "src/core/lib/iomgr/executor/mpmcqueue.cc", - "src/core/lib/iomgr/executor/threadpool.cc", - "src/core/lib/iomgr/fork_posix.cc", - "src/core/lib/iomgr/fork_windows.cc", - "src/core/lib/iomgr/gethostname_fallback.cc", - "src/core/lib/iomgr/gethostname_host_name_max.cc", - "src/core/lib/iomgr/gethostname_sysconf.cc", - "src/core/lib/iomgr/grpc_if_nametoindex_posix.cc", - "src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc", - "src/core/lib/iomgr/internal_errqueue.cc", - "src/core/lib/iomgr/iocp_windows.cc", - "src/core/lib/iomgr/iomgr.cc", - "src/core/lib/iomgr/iomgr_custom.cc", - "src/core/lib/iomgr/iomgr_internal.cc", - "src/core/lib/iomgr/iomgr_posix.cc", - "src/core/lib/iomgr/iomgr_posix_cfstream.cc", - "src/core/lib/iomgr/iomgr_uv.cc", - "src/core/lib/iomgr/iomgr_windows.cc", - "src/core/lib/iomgr/is_epollexclusive_available.cc", - "src/core/lib/iomgr/load_file.cc", - "src/core/lib/iomgr/lockfree_event.cc", - "src/core/lib/iomgr/polling_entity.cc", - "src/core/lib/iomgr/pollset.cc", - "src/core/lib/iomgr/pollset_custom.cc", - "src/core/lib/iomgr/pollset_set.cc", - "src/core/lib/iomgr/pollset_set_custom.cc", - "src/core/lib/iomgr/pollset_set_windows.cc", - "src/core/lib/iomgr/pollset_uv.cc", - "src/core/lib/iomgr/pollset_windows.cc", - "src/core/lib/iomgr/resolve_address.cc", - "src/core/lib/iomgr/resolve_address_custom.cc", - "src/core/lib/iomgr/resolve_address_posix.cc", - "src/core/lib/iomgr/resolve_address_windows.cc", - "src/core/lib/iomgr/resource_quota.cc", - "src/core/lib/iomgr/sockaddr_utils.cc", - "src/core/lib/iomgr/socket_factory_posix.cc", - "src/core/lib/iomgr/socket_mutator.cc", - "src/core/lib/iomgr/socket_utils_common_posix.cc", - "src/core/lib/iomgr/socket_utils_linux.cc", - "src/core/lib/iomgr/socket_utils_posix.cc", - "src/core/lib/iomgr/socket_utils_uv.cc", - "src/core/lib/iomgr/socket_utils_windows.cc", - "src/core/lib/iomgr/socket_windows.cc", - "src/core/lib/iomgr/tcp_client.cc", - "src/core/lib/iomgr/tcp_client_cfstream.cc", - "src/core/lib/iomgr/tcp_client_custom.cc", - "src/core/lib/iomgr/tcp_client_posix.cc", - "src/core/lib/iomgr/tcp_client_windows.cc", - "src/core/lib/iomgr/tcp_custom.cc", - "src/core/lib/iomgr/tcp_posix.cc", - "src/core/lib/iomgr/tcp_server.cc", - "src/core/lib/iomgr/tcp_server_custom.cc", - "src/core/lib/iomgr/tcp_server_posix.cc", - "src/core/lib/iomgr/tcp_server_utils_posix_common.cc", - "src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc", - "src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc", - "src/core/lib/iomgr/tcp_server_windows.cc", - "src/core/lib/iomgr/tcp_uv.cc", - "src/core/lib/iomgr/tcp_windows.cc", - "src/core/lib/iomgr/time_averaged_stats.cc", - "src/core/lib/iomgr/timer.cc", - "src/core/lib/iomgr/timer_custom.cc", - "src/core/lib/iomgr/timer_generic.cc", - "src/core/lib/iomgr/timer_heap.cc", - "src/core/lib/iomgr/timer_manager.cc", - "src/core/lib/iomgr/timer_uv.cc", - "src/core/lib/iomgr/udp_server.cc", - "src/core/lib/iomgr/unix_sockets_posix.cc", - "src/core/lib/iomgr/unix_sockets_posix_noop.cc", - "src/core/lib/iomgr/wakeup_fd_eventfd.cc", - "src/core/lib/iomgr/wakeup_fd_nospecial.cc", - "src/core/lib/iomgr/wakeup_fd_pipe.cc", - "src/core/lib/iomgr/wakeup_fd_posix.cc", - "src/core/lib/json/json.cc", - "src/core/lib/json/json_reader.cc", - "src/core/lib/json/json_string.cc", - "src/core/lib/json/json_writer.cc", - "src/core/lib/slice/b64.cc", - "src/core/lib/slice/percent_encoding.cc", - "src/core/lib/slice/slice.cc", - "src/core/lib/slice/slice_buffer.cc", - "src/core/lib/slice/slice_intern.cc", - "src/core/lib/slice/slice_string_helpers.cc", - "src/core/lib/surface/api_trace.cc", - "src/core/lib/surface/byte_buffer.cc", - "src/core/lib/surface/byte_buffer_reader.cc", - "src/core/lib/surface/call.cc", - "src/core/lib/surface/call_details.cc", - "src/core/lib/surface/call_log_batch.cc", - "src/core/lib/surface/channel.cc", - "src/core/lib/surface/channel_init.cc", - "src/core/lib/surface/channel_ping.cc", - "src/core/lib/surface/channel_stack_type.cc", - "src/core/lib/surface/completion_queue.cc", - "src/core/lib/surface/completion_queue_factory.cc", - "src/core/lib/surface/event_string.cc", - "src/core/lib/surface/lame_client.cc", - "src/core/lib/surface/metadata_array.cc", - "src/core/lib/surface/server.cc", - "src/core/lib/surface/validate_metadata.cc", - "src/core/lib/surface/version.cc", - "src/core/lib/transport/bdp_estimator.cc", - "src/core/lib/transport/byte_stream.cc", - "src/core/lib/transport/connectivity_state.cc", - "src/core/lib/transport/error_utils.cc", - "src/core/lib/transport/metadata.cc", - "src/core/lib/transport/metadata_batch.cc", - "src/core/lib/transport/pid_controller.cc", - "src/core/lib/transport/static_metadata.cc", - "src/core/lib/transport/status_conversion.cc", - "src/core/lib/transport/status_metadata.cc", - "src/core/lib/transport/timeout_encoding.cc", - "src/core/lib/transport/transport.cc", - "src/core/lib/transport/transport_op_string.cc", - "src/core/lib/uri/uri_parser.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_codegen", - "grpc_trace_headers" - ], - "headers": [ - "include/grpc/byte_buffer.h", - "include/grpc/byte_buffer_reader.h", - "include/grpc/compression.h", - "include/grpc/fork.h", - "include/grpc/grpc.h", - "include/grpc/grpc_posix.h", - "include/grpc/grpc_security_constants.h", - "include/grpc/load_reporting.h", - "include/grpc/slice.h", - "include/grpc/slice_buffer.h", - "include/grpc/status.h", - "include/grpc/support/workaround_list.h", - "src/core/lib/avl/avl.h", - "src/core/lib/backoff/backoff.h", - "src/core/lib/channel/channel_args.h", - "src/core/lib/channel/channel_stack.h", - "src/core/lib/channel/channel_stack_builder.h", - "src/core/lib/channel/channel_trace.h", - "src/core/lib/channel/channelz.h", - "src/core/lib/channel/channelz_registry.h", - "src/core/lib/channel/connected_channel.h", - "src/core/lib/channel/context.h", - "src/core/lib/channel/handshaker.h", - "src/core/lib/channel/handshaker_factory.h", - "src/core/lib/channel/handshaker_registry.h", - "src/core/lib/channel/status_util.h", - "src/core/lib/compression/algorithm_metadata.h", - "src/core/lib/compression/compression_args.h", - "src/core/lib/compression/compression_internal.h", - "src/core/lib/compression/message_compress.h", - "src/core/lib/compression/stream_compression.h", - "src/core/lib/compression/stream_compression_gzip.h", - "src/core/lib/compression/stream_compression_identity.h", - "src/core/lib/debug/stats.h", - "src/core/lib/debug/stats_data.h", - "src/core/lib/gprpp/debug_location.h", - "src/core/lib/gprpp/inlined_vector.h", - "src/core/lib/gprpp/optional.h", - "src/core/lib/gprpp/orphanable.h", - "src/core/lib/gprpp/ref_counted.h", - "src/core/lib/gprpp/ref_counted_ptr.h", - "src/core/lib/gprpp/string_view.h", - "src/core/lib/http/format_request.h", - "src/core/lib/http/httpcli.h", - "src/core/lib/http/parser.h", - "src/core/lib/iomgr/block_annotate.h", - "src/core/lib/iomgr/buffer_list.h", - "src/core/lib/iomgr/call_combiner.h", - "src/core/lib/iomgr/cfstream_handle.h", - "src/core/lib/iomgr/closure.h", - "src/core/lib/iomgr/combiner.h", - "src/core/lib/iomgr/dynamic_annotations.h", - "src/core/lib/iomgr/endpoint.h", - "src/core/lib/iomgr/endpoint_cfstream.h", - "src/core/lib/iomgr/endpoint_pair.h", - "src/core/lib/iomgr/error.h", - "src/core/lib/iomgr/error_cfstream.h", - "src/core/lib/iomgr/error_internal.h", - "src/core/lib/iomgr/ev_epoll1_linux.h", - "src/core/lib/iomgr/ev_epollex_linux.h", - "src/core/lib/iomgr/ev_poll_posix.h", - "src/core/lib/iomgr/ev_posix.h", - "src/core/lib/iomgr/exec_ctx.h", - "src/core/lib/iomgr/executor.h", - "src/core/lib/iomgr/executor/mpmcqueue.h", - "src/core/lib/iomgr/executor/threadpool.h", - "src/core/lib/iomgr/gethostname.h", - "src/core/lib/iomgr/grpc_if_nametoindex.h", - "src/core/lib/iomgr/internal_errqueue.h", - "src/core/lib/iomgr/iocp_windows.h", - "src/core/lib/iomgr/iomgr.h", - "src/core/lib/iomgr/iomgr_custom.h", - "src/core/lib/iomgr/iomgr_internal.h", - "src/core/lib/iomgr/iomgr_posix.h", - "src/core/lib/iomgr/is_epollexclusive_available.h", - "src/core/lib/iomgr/load_file.h", - "src/core/lib/iomgr/lockfree_event.h", - "src/core/lib/iomgr/nameser.h", - "src/core/lib/iomgr/polling_entity.h", - "src/core/lib/iomgr/pollset.h", - "src/core/lib/iomgr/pollset_custom.h", - "src/core/lib/iomgr/pollset_set.h", - "src/core/lib/iomgr/pollset_set_custom.h", - "src/core/lib/iomgr/pollset_set_windows.h", - "src/core/lib/iomgr/pollset_windows.h", - "src/core/lib/iomgr/port.h", - "src/core/lib/iomgr/resolve_address.h", - "src/core/lib/iomgr/resolve_address_custom.h", - "src/core/lib/iomgr/resource_quota.h", - "src/core/lib/iomgr/sockaddr.h", - "src/core/lib/iomgr/sockaddr_custom.h", - "src/core/lib/iomgr/sockaddr_posix.h", - "src/core/lib/iomgr/sockaddr_utils.h", - "src/core/lib/iomgr/sockaddr_windows.h", - "src/core/lib/iomgr/socket_factory_posix.h", - "src/core/lib/iomgr/socket_mutator.h", - "src/core/lib/iomgr/socket_utils.h", - "src/core/lib/iomgr/socket_utils_posix.h", - "src/core/lib/iomgr/socket_windows.h", - "src/core/lib/iomgr/sys_epoll_wrapper.h", - "src/core/lib/iomgr/tcp_client.h", - "src/core/lib/iomgr/tcp_client_posix.h", - "src/core/lib/iomgr/tcp_custom.h", - "src/core/lib/iomgr/tcp_posix.h", - "src/core/lib/iomgr/tcp_server.h", - "src/core/lib/iomgr/tcp_server_utils_posix.h", - "src/core/lib/iomgr/tcp_windows.h", - "src/core/lib/iomgr/time_averaged_stats.h", - "src/core/lib/iomgr/timer.h", - "src/core/lib/iomgr/timer_custom.h", - "src/core/lib/iomgr/timer_heap.h", - "src/core/lib/iomgr/timer_manager.h", - "src/core/lib/iomgr/udp_server.h", - "src/core/lib/iomgr/unix_sockets_posix.h", - "src/core/lib/iomgr/wakeup_fd_pipe.h", - "src/core/lib/iomgr/wakeup_fd_posix.h", - "src/core/lib/json/json.h", - "src/core/lib/json/json_common.h", - "src/core/lib/json/json_reader.h", - "src/core/lib/json/json_writer.h", - "src/core/lib/slice/b64.h", - "src/core/lib/slice/percent_encoding.h", - "src/core/lib/slice/slice_hash_table.h", - "src/core/lib/slice/slice_internal.h", - "src/core/lib/slice/slice_string_helpers.h", - "src/core/lib/slice/slice_utils.h", - "src/core/lib/slice/slice_weak_hash_table.h", - "src/core/lib/surface/api_trace.h", - "src/core/lib/surface/call.h", - "src/core/lib/surface/call_test_only.h", - "src/core/lib/surface/channel.h", - "src/core/lib/surface/channel_init.h", - "src/core/lib/surface/channel_stack_type.h", - "src/core/lib/surface/completion_queue.h", - "src/core/lib/surface/completion_queue_factory.h", - "src/core/lib/surface/event_string.h", - "src/core/lib/surface/init.h", - "src/core/lib/surface/lame_client.h", - "src/core/lib/surface/server.h", - "src/core/lib/surface/validate_metadata.h", - "src/core/lib/transport/bdp_estimator.h", - "src/core/lib/transport/byte_stream.h", - "src/core/lib/transport/connectivity_state.h", - "src/core/lib/transport/error_utils.h", - "src/core/lib/transport/http2_errors.h", - "src/core/lib/transport/metadata.h", - "src/core/lib/transport/metadata_batch.h", - "src/core/lib/transport/pid_controller.h", - "src/core/lib/transport/static_metadata.h", - "src/core/lib/transport/status_conversion.h", - "src/core/lib/transport/status_metadata.h", - "src/core/lib/transport/timeout_encoding.h", - "src/core/lib/transport/transport.h", - "src/core/lib/transport/transport_impl.h", - "src/core/lib/uri/uri_parser.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_base_headers", - "src": [ - "include/grpc/byte_buffer.h", - "include/grpc/byte_buffer_reader.h", - "include/grpc/compression.h", - "include/grpc/fork.h", - "include/grpc/grpc.h", - "include/grpc/grpc_posix.h", - "include/grpc/grpc_security_constants.h", - "include/grpc/load_reporting.h", - "include/grpc/slice.h", - "include/grpc/slice_buffer.h", - "include/grpc/status.h", - "include/grpc/support/workaround_list.h", - "src/core/lib/avl/avl.h", - "src/core/lib/backoff/backoff.h", - "src/core/lib/channel/channel_args.h", - "src/core/lib/channel/channel_stack.h", - "src/core/lib/channel/channel_stack_builder.h", - "src/core/lib/channel/channel_trace.h", - "src/core/lib/channel/channelz.h", - "src/core/lib/channel/channelz_registry.h", - "src/core/lib/channel/connected_channel.h", - "src/core/lib/channel/context.h", - "src/core/lib/channel/handshaker.h", - "src/core/lib/channel/handshaker_factory.h", - "src/core/lib/channel/handshaker_registry.h", - "src/core/lib/channel/status_util.h", - "src/core/lib/compression/algorithm_metadata.h", - "src/core/lib/compression/compression_args.h", - "src/core/lib/compression/compression_internal.h", - "src/core/lib/compression/message_compress.h", - "src/core/lib/compression/stream_compression.h", - "src/core/lib/compression/stream_compression_gzip.h", - "src/core/lib/compression/stream_compression_identity.h", - "src/core/lib/debug/stats.h", - "src/core/lib/debug/stats_data.h", - "src/core/lib/gprpp/debug_location.h", - "src/core/lib/gprpp/inlined_vector.h", - "src/core/lib/gprpp/optional.h", - "src/core/lib/gprpp/orphanable.h", - "src/core/lib/gprpp/ref_counted.h", - "src/core/lib/gprpp/ref_counted_ptr.h", - "src/core/lib/gprpp/string_view.h", - "src/core/lib/http/format_request.h", - "src/core/lib/http/httpcli.h", - "src/core/lib/http/parser.h", - "src/core/lib/iomgr/block_annotate.h", - "src/core/lib/iomgr/buffer_list.h", - "src/core/lib/iomgr/call_combiner.h", - "src/core/lib/iomgr/cfstream_handle.h", - "src/core/lib/iomgr/closure.h", - "src/core/lib/iomgr/combiner.h", - "src/core/lib/iomgr/dynamic_annotations.h", - "src/core/lib/iomgr/endpoint.h", - "src/core/lib/iomgr/endpoint_cfstream.h", - "src/core/lib/iomgr/endpoint_pair.h", - "src/core/lib/iomgr/error.h", - "src/core/lib/iomgr/error_cfstream.h", - "src/core/lib/iomgr/error_internal.h", - "src/core/lib/iomgr/ev_epoll1_linux.h", - "src/core/lib/iomgr/ev_epollex_linux.h", - "src/core/lib/iomgr/ev_poll_posix.h", - "src/core/lib/iomgr/ev_posix.h", - "src/core/lib/iomgr/exec_ctx.h", - "src/core/lib/iomgr/executor.h", - "src/core/lib/iomgr/executor/mpmcqueue.h", - "src/core/lib/iomgr/executor/threadpool.h", - "src/core/lib/iomgr/gethostname.h", - "src/core/lib/iomgr/grpc_if_nametoindex.h", - "src/core/lib/iomgr/internal_errqueue.h", - "src/core/lib/iomgr/iocp_windows.h", - "src/core/lib/iomgr/iomgr.h", - "src/core/lib/iomgr/iomgr_custom.h", - "src/core/lib/iomgr/iomgr_internal.h", - "src/core/lib/iomgr/iomgr_posix.h", - "src/core/lib/iomgr/is_epollexclusive_available.h", - "src/core/lib/iomgr/load_file.h", - "src/core/lib/iomgr/lockfree_event.h", - "src/core/lib/iomgr/nameser.h", - "src/core/lib/iomgr/polling_entity.h", - "src/core/lib/iomgr/pollset.h", - "src/core/lib/iomgr/pollset_custom.h", - "src/core/lib/iomgr/pollset_set.h", - "src/core/lib/iomgr/pollset_set_custom.h", - "src/core/lib/iomgr/pollset_set_windows.h", - "src/core/lib/iomgr/pollset_windows.h", - "src/core/lib/iomgr/port.h", - "src/core/lib/iomgr/resolve_address.h", - "src/core/lib/iomgr/resolve_address_custom.h", - "src/core/lib/iomgr/resource_quota.h", - "src/core/lib/iomgr/sockaddr.h", - "src/core/lib/iomgr/sockaddr_custom.h", - "src/core/lib/iomgr/sockaddr_posix.h", - "src/core/lib/iomgr/sockaddr_utils.h", - "src/core/lib/iomgr/sockaddr_windows.h", - "src/core/lib/iomgr/socket_factory_posix.h", - "src/core/lib/iomgr/socket_mutator.h", - "src/core/lib/iomgr/socket_utils.h", - "src/core/lib/iomgr/socket_utils_posix.h", - "src/core/lib/iomgr/socket_windows.h", - "src/core/lib/iomgr/sys_epoll_wrapper.h", - "src/core/lib/iomgr/tcp_client.h", - "src/core/lib/iomgr/tcp_client_posix.h", - "src/core/lib/iomgr/tcp_custom.h", - "src/core/lib/iomgr/tcp_posix.h", - "src/core/lib/iomgr/tcp_server.h", - "src/core/lib/iomgr/tcp_server_utils_posix.h", - "src/core/lib/iomgr/tcp_windows.h", - "src/core/lib/iomgr/time_averaged_stats.h", - "src/core/lib/iomgr/timer.h", - "src/core/lib/iomgr/timer_custom.h", - "src/core/lib/iomgr/timer_heap.h", - "src/core/lib/iomgr/timer_manager.h", - "src/core/lib/iomgr/udp_server.h", - "src/core/lib/iomgr/unix_sockets_posix.h", - "src/core/lib/iomgr/wakeup_fd_pipe.h", - "src/core/lib/iomgr/wakeup_fd_posix.h", - "src/core/lib/json/json.h", - "src/core/lib/json/json_common.h", - "src/core/lib/json/json_reader.h", - "src/core/lib/json/json_writer.h", - "src/core/lib/slice/b64.h", - "src/core/lib/slice/percent_encoding.h", - "src/core/lib/slice/slice_hash_table.h", - "src/core/lib/slice/slice_internal.h", - "src/core/lib/slice/slice_string_helpers.h", - "src/core/lib/slice/slice_utils.h", - "src/core/lib/slice/slice_weak_hash_table.h", - "src/core/lib/surface/api_trace.h", - "src/core/lib/surface/call.h", - "src/core/lib/surface/call_test_only.h", - "src/core/lib/surface/channel.h", - "src/core/lib/surface/channel_init.h", - "src/core/lib/surface/channel_stack_type.h", - "src/core/lib/surface/completion_queue.h", - "src/core/lib/surface/completion_queue_factory.h", - "src/core/lib/surface/event_string.h", - "src/core/lib/surface/init.h", - "src/core/lib/surface/lame_client.h", - "src/core/lib/surface/server.h", - "src/core/lib/surface/validate_metadata.h", - "src/core/lib/transport/bdp_estimator.h", - "src/core/lib/transport/byte_stream.h", - "src/core/lib/transport/connectivity_state.h", - "src/core/lib/transport/error_utils.h", - "src/core/lib/transport/http2_errors.h", - "src/core/lib/transport/metadata.h", - "src/core/lib/transport/metadata_batch.h", - "src/core/lib/transport/pid_controller.h", - "src/core/lib/transport/static_metadata.h", - "src/core/lib/transport/status_conversion.h", - "src/core/lib/transport/status_metadata.h", - "src/core/lib/transport/timeout_encoding.h", - "src/core/lib/transport/transport.h", - "src/core/lib/transport/transport_impl.h", - "src/core/lib/uri/uri_parser.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base" - ], - "headers": [ - "src/core/ext/filters/http/client_authority_filter.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_client_authority_filter", - "src": [ - "src/core/ext/filters/http/client_authority_filter.cc", - "src/core/ext/filters/http/client_authority_filter.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_deadline_filter", - "grpc_health_upb" - ], - "headers": [ - "src/core/ext/filters/client_channel/backup_poller.h", - "src/core/ext/filters/client_channel/client_channel.h", - "src/core/ext/filters/client_channel/client_channel_channelz.h", - "src/core/ext/filters/client_channel/client_channel_factory.h", - "src/core/ext/filters/client_channel/connector.h", - "src/core/ext/filters/client_channel/global_subchannel_pool.h", - "src/core/ext/filters/client_channel/health/health_check_client.h", - "src/core/ext/filters/client_channel/http_connect_handshaker.h", - "src/core/ext/filters/client_channel/http_proxy.h", - "src/core/ext/filters/client_channel/lb_policy.h", - "src/core/ext/filters/client_channel/lb_policy_factory.h", - "src/core/ext/filters/client_channel/lb_policy_registry.h", - "src/core/ext/filters/client_channel/local_subchannel_pool.h", - "src/core/ext/filters/client_channel/parse_address.h", - "src/core/ext/filters/client_channel/proxy_mapper.h", - "src/core/ext/filters/client_channel/proxy_mapper_registry.h", - "src/core/ext/filters/client_channel/resolver.h", - "src/core/ext/filters/client_channel/resolver_factory.h", - "src/core/ext/filters/client_channel/resolver_registry.h", - "src/core/ext/filters/client_channel/resolver_result_parsing.h", - "src/core/ext/filters/client_channel/resolving_lb_policy.h", - "src/core/ext/filters/client_channel/retry_throttle.h", - "src/core/ext/filters/client_channel/server_address.h", - "src/core/ext/filters/client_channel/service_config.h", - "src/core/ext/filters/client_channel/subchannel.h", - "src/core/ext/filters/client_channel/subchannel_interface.h", - "src/core/ext/filters/client_channel/subchannel_pool_interface.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_client_channel", - "src": [ - "src/core/ext/filters/client_channel/backup_poller.cc", - "src/core/ext/filters/client_channel/backup_poller.h", - "src/core/ext/filters/client_channel/channel_connectivity.cc", - "src/core/ext/filters/client_channel/client_channel.cc", - "src/core/ext/filters/client_channel/client_channel.h", - "src/core/ext/filters/client_channel/client_channel_channelz.cc", - "src/core/ext/filters/client_channel/client_channel_channelz.h", - "src/core/ext/filters/client_channel/client_channel_factory.cc", - "src/core/ext/filters/client_channel/client_channel_factory.h", - "src/core/ext/filters/client_channel/client_channel_plugin.cc", - "src/core/ext/filters/client_channel/connector.cc", - "src/core/ext/filters/client_channel/connector.h", - "src/core/ext/filters/client_channel/global_subchannel_pool.cc", - "src/core/ext/filters/client_channel/global_subchannel_pool.h", - "src/core/ext/filters/client_channel/health/health_check_client.cc", - "src/core/ext/filters/client_channel/health/health_check_client.h", - "src/core/ext/filters/client_channel/http_connect_handshaker.cc", - "src/core/ext/filters/client_channel/http_connect_handshaker.h", - "src/core/ext/filters/client_channel/http_proxy.cc", - "src/core/ext/filters/client_channel/http_proxy.h", - "src/core/ext/filters/client_channel/lb_policy.cc", - "src/core/ext/filters/client_channel/lb_policy.h", - "src/core/ext/filters/client_channel/lb_policy_factory.h", - "src/core/ext/filters/client_channel/lb_policy_registry.cc", - "src/core/ext/filters/client_channel/lb_policy_registry.h", - "src/core/ext/filters/client_channel/local_subchannel_pool.cc", - "src/core/ext/filters/client_channel/local_subchannel_pool.h", - "src/core/ext/filters/client_channel/parse_address.cc", - "src/core/ext/filters/client_channel/parse_address.h", - "src/core/ext/filters/client_channel/proxy_mapper.cc", - "src/core/ext/filters/client_channel/proxy_mapper.h", - "src/core/ext/filters/client_channel/proxy_mapper_registry.cc", - "src/core/ext/filters/client_channel/proxy_mapper_registry.h", - "src/core/ext/filters/client_channel/resolver.cc", - "src/core/ext/filters/client_channel/resolver.h", - "src/core/ext/filters/client_channel/resolver_factory.h", - "src/core/ext/filters/client_channel/resolver_registry.cc", - "src/core/ext/filters/client_channel/resolver_registry.h", - "src/core/ext/filters/client_channel/resolver_result_parsing.cc", - "src/core/ext/filters/client_channel/resolver_result_parsing.h", - "src/core/ext/filters/client_channel/resolving_lb_policy.cc", - "src/core/ext/filters/client_channel/resolving_lb_policy.h", - "src/core/ext/filters/client_channel/retry_throttle.cc", - "src/core/ext/filters/client_channel/retry_throttle.h", - "src/core/ext/filters/client_channel/server_address.cc", - "src/core/ext/filters/client_channel/server_address.h", - "src/core/ext/filters/client_channel/service_config.cc", - "src/core/ext/filters/client_channel/service_config.h", - "src/core/ext/filters/client_channel/subchannel.cc", - "src/core/ext/filters/client_channel/subchannel.h", - "src/core/ext/filters/client_channel/subchannel_interface.h", - "src/core/ext/filters/client_channel/subchannel_pool_interface.cc", - "src/core/ext/filters/client_channel/subchannel_pool_interface.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc_client_idle_filter", - "src": [ - "src/core/ext/filters/client_idle/client_idle_filter.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr_codegen" - ], - "headers": [ - "include/grpc/impl/codegen/byte_buffer.h", - "include/grpc/impl/codegen/byte_buffer_reader.h", - "include/grpc/impl/codegen/compression_types.h", - "include/grpc/impl/codegen/connectivity_state.h", - "include/grpc/impl/codegen/grpc_types.h", - "include/grpc/impl/codegen/propagation_bits.h", - "include/grpc/impl/codegen/slice.h", - "include/grpc/impl/codegen/status.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_codegen", - "src": [ - "include/grpc/impl/codegen/byte_buffer.h", - "include/grpc/impl/codegen/byte_buffer_reader.h", - "include/grpc/impl/codegen/compression_types.h", - "include/grpc/impl/codegen/connectivity_state.h", - "include/grpc/impl/codegen/grpc_types.h", - "include/grpc/impl/codegen/propagation_bits.h", - "include/grpc/impl/codegen/slice.h", - "include/grpc/impl/codegen/status.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base" - ], - "headers": [ - "src/core/ext/filters/deadline/deadline_filter.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_deadline_filter", - "src": [ - "src/core/ext/filters/deadline/deadline_filter.cc", - "src/core/ext/filters/deadline/deadline_filter.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "upb" - ], - "headers": [ - "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_health_upb", - "src": [ - "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c", - "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base" - ], - "headers": [ - "src/core/ext/filters/http/client/http_client_filter.h", - "src/core/ext/filters/http/message_compress/message_compress_filter.h", - "src/core/ext/filters/http/server/http_server_filter.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_http_filters", - "src": [ - "src/core/ext/filters/http/client/http_client_filter.cc", - "src/core/ext/filters/http/client/http_client_filter.h", - "src/core/ext/filters/http/http_filters_plugin.cc", - "src/core/ext/filters/http/message_compress/message_compress_filter.cc", - "src/core/ext/filters/http/message_compress/message_compress_filter.h", - "src/core/ext/filters/http/server/http_server_filter.cc", - "src/core/ext/filters/http/server/http_server_filter.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_client_channel", - "grpc_lb_upb", - "grpc_resolver_fake", - "upb" - ], - "headers": [ - "src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_lb_policy_grpclb", - "src": [ - "src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc", - "src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc", - "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_client_channel", - "grpc_lb_upb", - "grpc_resolver_fake", - "grpc_secure", - "upb" - ], - "headers": [ - "src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_lb_policy_grpclb_secure", - "src": [ - "src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc", - "src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc", - "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_client_channel", - "grpc_lb_subchannel_list" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc_lb_policy_pick_first", - "src": [ - "src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_client_channel", - "grpc_lb_subchannel_list" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc_lb_policy_round_robin", - "src": [ - "src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "envoy_ads_upb", - "gpr", - "grpc_base", - "grpc_client_channel", - "grpc_resolver_fake" - ], - "headers": [ - "src/core/ext/filters/client_channel/lb_policy/xds/xds.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_lb_policy_xds", - "src": [ - "src/core/ext/filters/client_channel/lb_policy/xds/xds.cc", - "src/core/ext/filters/client_channel/lb_policy/xds/xds.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "envoy_ads_upb", - "gpr", - "grpc_base", - "grpc_client_channel", - "grpc_resolver_fake", - "grpc_secure" - ], - "headers": [ - "src/core/ext/filters/client_channel/lb_policy/xds/xds.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_lb_policy_xds_secure", - "src": [ - "src/core/ext/filters/client_channel/lb_policy/xds/xds.cc", - "src/core/ext/filters/client_channel/lb_policy/xds/xds.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc", - "src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_client_channel" - ], - "headers": [ - "src/core/ext/filters/client_channel/lb_policy/subchannel_list.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_lb_subchannel_list", - "src": [ - "src/core/ext/filters/client_channel/lb_policy/subchannel_list.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "google_api_upb", - "upb" - ], - "headers": [ - "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_lb_upb", - "src": [ - "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c", - "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base" - ], - "headers": [ - "src/core/ext/filters/max_age/max_age_filter.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_max_age_filter", - "src": [ - "src/core/ext/filters/max_age/max_age_filter.cc", - "src/core/ext/filters/max_age/max_age_filter.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base" - ], - "headers": [ - "src/core/ext/filters/message_size/message_size_filter.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_message_size_filter", - "src": [ - "src/core/ext/filters/message_size/message_size_filter.cc", - "src/core/ext/filters/message_size/message_size_filter.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_client_channel", - "grpc_resolver_dns_selection" - ], - "headers": [ - "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h", - "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_resolver_dns_ares", - "src": [ - "src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc", - "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc", - "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h", - "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc", - "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc", - "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc", - "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc", - "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h", - "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc", - "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc", - "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc", - "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_client_channel", - "grpc_resolver_dns_selection" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc_resolver_dns_native", - "src": [ - "src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base" - ], - "headers": [ - "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_resolver_dns_selection", - "src": [ - "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc", - "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_client_channel" - ], - "headers": [ - "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_resolver_fake", - "src": [ - "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc", - "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_client_channel" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc_resolver_sockaddr", - "src": [ - "src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "alts_tsi", - "gpr", - "grpc_base", - "grpc_shadow_boringssl", - "grpc_transport_chttp2_alpn", - "tsi" - ], - "headers": [ - "include/grpc/grpc_security.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds.h", - "src/core/lib/security/context/security_context.h", - "src/core/lib/security/credentials/alts/alts_credentials.h", - "src/core/lib/security/credentials/composite/composite_credentials.h", - "src/core/lib/security/credentials/credentials.h", - "src/core/lib/security/credentials/fake/fake_credentials.h", - "src/core/lib/security/credentials/google_default/google_default_credentials.h", - "src/core/lib/security/credentials/iam/iam_credentials.h", - "src/core/lib/security/credentials/jwt/json_token.h", - "src/core/lib/security/credentials/jwt/jwt_credentials.h", - "src/core/lib/security/credentials/jwt/jwt_verifier.h", - "src/core/lib/security/credentials/local/local_credentials.h", - "src/core/lib/security/credentials/oauth2/oauth2_credentials.h", - "src/core/lib/security/credentials/plugin/plugin_credentials.h", - "src/core/lib/security/credentials/ssl/ssl_credentials.h", - "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h", - "src/core/lib/security/credentials/tls/spiffe_credentials.h", - "src/core/lib/security/security_connector/alts/alts_security_connector.h", - "src/core/lib/security/security_connector/fake/fake_security_connector.h", - "src/core/lib/security/security_connector/load_system_roots.h", - "src/core/lib/security/security_connector/load_system_roots_linux.h", - "src/core/lib/security/security_connector/local/local_security_connector.h", - "src/core/lib/security/security_connector/security_connector.h", - "src/core/lib/security/security_connector/ssl/ssl_security_connector.h", - "src/core/lib/security/security_connector/ssl_utils.h", - "src/core/lib/security/security_connector/tls/spiffe_security_connector.h", - "src/core/lib/security/transport/auth_filters.h", - "src/core/lib/security/transport/secure_endpoint.h", - "src/core/lib/security/transport/security_handshaker.h", - "src/core/lib/security/transport/target_authority_table.h", - "src/core/lib/security/transport/tsi_error.h", - "src/core/lib/security/util/json_util.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_secure", - "src": [ - "include/grpc/grpc_security.h", - "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h", - "src/core/ext/filters/client_channel/lb_policy/xds/xds.h", - "src/core/lib/http/httpcli_security_connector.cc", - "src/core/lib/security/context/security_context.cc", - "src/core/lib/security/context/security_context.h", - "src/core/lib/security/credentials/alts/alts_credentials.cc", - "src/core/lib/security/credentials/alts/alts_credentials.h", - "src/core/lib/security/credentials/composite/composite_credentials.cc", - "src/core/lib/security/credentials/composite/composite_credentials.h", - "src/core/lib/security/credentials/credentials.cc", - "src/core/lib/security/credentials/credentials.h", - "src/core/lib/security/credentials/credentials_metadata.cc", - "src/core/lib/security/credentials/fake/fake_credentials.cc", - "src/core/lib/security/credentials/fake/fake_credentials.h", - "src/core/lib/security/credentials/google_default/credentials_generic.cc", - "src/core/lib/security/credentials/google_default/google_default_credentials.cc", - "src/core/lib/security/credentials/google_default/google_default_credentials.h", - "src/core/lib/security/credentials/iam/iam_credentials.cc", - "src/core/lib/security/credentials/iam/iam_credentials.h", - "src/core/lib/security/credentials/jwt/json_token.cc", - "src/core/lib/security/credentials/jwt/json_token.h", - "src/core/lib/security/credentials/jwt/jwt_credentials.cc", - "src/core/lib/security/credentials/jwt/jwt_credentials.h", - "src/core/lib/security/credentials/jwt/jwt_verifier.cc", - "src/core/lib/security/credentials/jwt/jwt_verifier.h", - "src/core/lib/security/credentials/local/local_credentials.cc", - "src/core/lib/security/credentials/local/local_credentials.h", - "src/core/lib/security/credentials/oauth2/oauth2_credentials.cc", - "src/core/lib/security/credentials/oauth2/oauth2_credentials.h", - "src/core/lib/security/credentials/plugin/plugin_credentials.cc", - "src/core/lib/security/credentials/plugin/plugin_credentials.h", - "src/core/lib/security/credentials/ssl/ssl_credentials.cc", - "src/core/lib/security/credentials/ssl/ssl_credentials.h", - "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc", - "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h", - "src/core/lib/security/credentials/tls/spiffe_credentials.cc", - "src/core/lib/security/credentials/tls/spiffe_credentials.h", - "src/core/lib/security/security_connector/alts/alts_security_connector.cc", - "src/core/lib/security/security_connector/alts/alts_security_connector.h", - "src/core/lib/security/security_connector/fake/fake_security_connector.cc", - "src/core/lib/security/security_connector/fake/fake_security_connector.h", - "src/core/lib/security/security_connector/load_system_roots.h", - "src/core/lib/security/security_connector/load_system_roots_fallback.cc", - "src/core/lib/security/security_connector/load_system_roots_linux.cc", - "src/core/lib/security/security_connector/load_system_roots_linux.h", - "src/core/lib/security/security_connector/local/local_security_connector.cc", - "src/core/lib/security/security_connector/local/local_security_connector.h", - "src/core/lib/security/security_connector/security_connector.cc", - "src/core/lib/security/security_connector/security_connector.h", - "src/core/lib/security/security_connector/ssl/ssl_security_connector.cc", - "src/core/lib/security/security_connector/ssl/ssl_security_connector.h", - "src/core/lib/security/security_connector/ssl_utils.cc", - "src/core/lib/security/security_connector/ssl_utils.h", - "src/core/lib/security/security_connector/tls/spiffe_security_connector.cc", - "src/core/lib/security/security_connector/tls/spiffe_security_connector.h", - "src/core/lib/security/transport/auth_filters.h", - "src/core/lib/security/transport/client_auth_filter.cc", - "src/core/lib/security/transport/secure_endpoint.cc", - "src/core/lib/security/transport/secure_endpoint.h", - "src/core/lib/security/transport/security_handshaker.cc", - "src/core/lib/security/transport/security_handshaker.h", - "src/core/lib/security/transport/server_auth_filter.cc", - "src/core/lib/security/transport/target_authority_table.cc", - "src/core/lib/security/transport/target_authority_table.h", - "src/core/lib/security/transport/tsi_error.cc", - "src/core/lib/security/transport/tsi_error.h", - "src/core/lib/security/util/json_util.cc", - "src/core/lib/security/util/json_util.h", - "src/core/lib/surface/init_secure.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base" - ], - "headers": [ - "src/core/ext/filters/workarounds/workaround_utils.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_server_backward_compatibility", - "src": [ - "src/core/ext/filters/workarounds/workaround_utils.cc", - "src/core/ext/filters/workarounds/workaround_utils.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [], - "headers": [ - "src/core/tsi/grpc_shadow_boringssl.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_shadow_boringssl", - "src": [ - "src/core/tsi/grpc_shadow_boringssl.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "cmdline", - "gpr", - "grpc_base", - "grpc_client_channel", - "grpc_transport_chttp2" - ], - "headers": [ - "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h", - "test/core/end2end/cq_verifier.h", - "test/core/end2end/fixtures/http_proxy_fixture.h", - "test/core/end2end/fixtures/local_util.h", - "test/core/end2end/fixtures/proxy.h", - "test/core/iomgr/endpoint_tests.h", - "test/core/util/debugger_macros.h", - "test/core/util/fuzzer_util.h", - "test/core/util/grpc_profiler.h", - "test/core/util/histogram.h", - "test/core/util/memory_counters.h", - "test/core/util/mock_endpoint.h", - "test/core/util/parse_hexstring.h", - "test/core/util/passthru_endpoint.h", - "test/core/util/port.h", - "test/core/util/port_server_client.h", - "test/core/util/slice_splitter.h", - "test/core/util/subprocess.h", - "test/core/util/test_config.h", - "test/core/util/test_lb_policies.h", - "test/core/util/tracer_util.h", - "test/core/util/trickle_endpoint.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_test_util_base", - "src": [ - "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc", - "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h", - "test/core/end2end/cq_verifier.cc", - "test/core/end2end/cq_verifier.h", - "test/core/end2end/fixtures/http_proxy_fixture.cc", - "test/core/end2end/fixtures/http_proxy_fixture.h", - "test/core/end2end/fixtures/local_util.cc", - "test/core/end2end/fixtures/local_util.h", - "test/core/end2end/fixtures/proxy.cc", - "test/core/end2end/fixtures/proxy.h", - "test/core/iomgr/endpoint_tests.cc", - "test/core/iomgr/endpoint_tests.h", - "test/core/util/debugger_macros.cc", - "test/core/util/debugger_macros.h", - "test/core/util/fuzzer_util.cc", - "test/core/util/fuzzer_util.h", - "test/core/util/grpc_profiler.cc", - "test/core/util/grpc_profiler.h", - "test/core/util/histogram.cc", - "test/core/util/histogram.h", - "test/core/util/memory_counters.cc", - "test/core/util/memory_counters.h", - "test/core/util/mock_endpoint.cc", - "test/core/util/mock_endpoint.h", - "test/core/util/parse_hexstring.cc", - "test/core/util/parse_hexstring.h", - "test/core/util/passthru_endpoint.cc", - "test/core/util/passthru_endpoint.h", - "test/core/util/port.cc", - "test/core/util/port.h", - "test/core/util/port_isolated_runtime_environment.cc", - "test/core/util/port_server_client.cc", - "test/core/util/port_server_client.h", - "test/core/util/slice_splitter.cc", - "test/core/util/slice_splitter.h", - "test/core/util/subprocess.h", - "test/core/util/subprocess_posix.cc", - "test/core/util/subprocess_windows.cc", - "test/core/util/test_config.cc", - "test/core/util/test_config.h", - "test/core/util/test_lb_policies.cc", - "test/core/util/test_lb_policies.h", - "test/core/util/tracer_util.cc", - "test/core/util/tracer_util.h", - "test/core/util/trickle_endpoint.cc", - "test/core/util/trickle_endpoint.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base_headers", - "grpc_trace_headers" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc_trace", - "src": [ - "src/core/lib/debug/trace.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr" - ], - "headers": [ - "src/core/lib/debug/trace.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_trace_headers", - "src": [ - "src/core/lib/debug/trace.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_http_filters", - "grpc_transport_chttp2_alpn" - ], - "headers": [ - "src/core/ext/transport/chttp2/transport/bin_decoder.h", - "src/core/ext/transport/chttp2/transport/bin_encoder.h", - "src/core/ext/transport/chttp2/transport/chttp2_transport.h", - "src/core/ext/transport/chttp2/transport/context_list.h", - "src/core/ext/transport/chttp2/transport/flow_control.h", - "src/core/ext/transport/chttp2/transport/frame.h", - "src/core/ext/transport/chttp2/transport/frame_data.h", - "src/core/ext/transport/chttp2/transport/frame_goaway.h", - "src/core/ext/transport/chttp2/transport/frame_ping.h", - "src/core/ext/transport/chttp2/transport/frame_rst_stream.h", - "src/core/ext/transport/chttp2/transport/frame_settings.h", - "src/core/ext/transport/chttp2/transport/frame_window_update.h", - "src/core/ext/transport/chttp2/transport/hpack_encoder.h", - "src/core/ext/transport/chttp2/transport/hpack_parser.h", - "src/core/ext/transport/chttp2/transport/hpack_table.h", - "src/core/ext/transport/chttp2/transport/http2_settings.h", - "src/core/ext/transport/chttp2/transport/huffsyms.h", - "src/core/ext/transport/chttp2/transport/incoming_metadata.h", - "src/core/ext/transport/chttp2/transport/internal.h", - "src/core/ext/transport/chttp2/transport/stream_map.h", - "src/core/ext/transport/chttp2/transport/varint.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_transport_chttp2", - "src": [ - "src/core/ext/transport/chttp2/transport/bin_decoder.cc", - "src/core/ext/transport/chttp2/transport/bin_decoder.h", - "src/core/ext/transport/chttp2/transport/bin_encoder.cc", - "src/core/ext/transport/chttp2/transport/bin_encoder.h", - "src/core/ext/transport/chttp2/transport/chttp2_plugin.cc", - "src/core/ext/transport/chttp2/transport/chttp2_transport.cc", - "src/core/ext/transport/chttp2/transport/chttp2_transport.h", - "src/core/ext/transport/chttp2/transport/context_list.cc", - "src/core/ext/transport/chttp2/transport/context_list.h", - "src/core/ext/transport/chttp2/transport/flow_control.cc", - "src/core/ext/transport/chttp2/transport/flow_control.h", - "src/core/ext/transport/chttp2/transport/frame.h", - "src/core/ext/transport/chttp2/transport/frame_data.cc", - "src/core/ext/transport/chttp2/transport/frame_data.h", - "src/core/ext/transport/chttp2/transport/frame_goaway.cc", - "src/core/ext/transport/chttp2/transport/frame_goaway.h", - "src/core/ext/transport/chttp2/transport/frame_ping.cc", - "src/core/ext/transport/chttp2/transport/frame_ping.h", - "src/core/ext/transport/chttp2/transport/frame_rst_stream.cc", - "src/core/ext/transport/chttp2/transport/frame_rst_stream.h", - "src/core/ext/transport/chttp2/transport/frame_settings.cc", - "src/core/ext/transport/chttp2/transport/frame_settings.h", - "src/core/ext/transport/chttp2/transport/frame_window_update.cc", - "src/core/ext/transport/chttp2/transport/frame_window_update.h", - "src/core/ext/transport/chttp2/transport/hpack_encoder.cc", - "src/core/ext/transport/chttp2/transport/hpack_encoder.h", - "src/core/ext/transport/chttp2/transport/hpack_parser.cc", - "src/core/ext/transport/chttp2/transport/hpack_parser.h", - "src/core/ext/transport/chttp2/transport/hpack_table.cc", - "src/core/ext/transport/chttp2/transport/hpack_table.h", - "src/core/ext/transport/chttp2/transport/http2_settings.cc", - "src/core/ext/transport/chttp2/transport/http2_settings.h", - "src/core/ext/transport/chttp2/transport/huffsyms.cc", - "src/core/ext/transport/chttp2/transport/huffsyms.h", - "src/core/ext/transport/chttp2/transport/incoming_metadata.cc", - "src/core/ext/transport/chttp2/transport/incoming_metadata.h", - "src/core/ext/transport/chttp2/transport/internal.h", - "src/core/ext/transport/chttp2/transport/parsing.cc", - "src/core/ext/transport/chttp2/transport/stream_lists.cc", - "src/core/ext/transport/chttp2/transport/stream_map.cc", - "src/core/ext/transport/chttp2/transport/stream_map.h", - "src/core/ext/transport/chttp2/transport/varint.cc", - "src/core/ext/transport/chttp2/transport/varint.h", - "src/core/ext/transport/chttp2/transport/writing.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr" - ], - "headers": [ - "src/core/ext/transport/chttp2/alpn/alpn.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_transport_chttp2_alpn", - "src": [ - "src/core/ext/transport/chttp2/alpn/alpn.cc", - "src/core/ext/transport/chttp2/alpn/alpn.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_client_channel", - "grpc_transport_chttp2" - ], - "headers": [ - "src/core/ext/transport/chttp2/client/authority.h", - "src/core/ext/transport/chttp2/client/chttp2_connector.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_transport_chttp2_client_connector", - "src": [ - "src/core/ext/transport/chttp2/client/authority.cc", - "src/core/ext/transport/chttp2/client/authority.h", - "src/core/ext/transport/chttp2/client/chttp2_connector.cc", - "src/core/ext/transport/chttp2/client/chttp2_connector.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_client_channel", - "grpc_transport_chttp2", - "grpc_transport_chttp2_client_connector" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc_transport_chttp2_client_insecure", - "src": [ - "src/core/ext/transport/chttp2/client/insecure/channel_create.cc", - "src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_client_channel", - "grpc_secure", - "grpc_transport_chttp2", - "grpc_transport_chttp2_client_connector" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc_transport_chttp2_client_secure", - "src": [ - "src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_transport_chttp2" - ], - "headers": [ - "src/core/ext/transport/chttp2/server/chttp2_server.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_transport_chttp2_server", - "src": [ - "src/core/ext/transport/chttp2/server/chttp2_server.cc", - "src/core/ext/transport/chttp2/server/chttp2_server.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_transport_chttp2", - "grpc_transport_chttp2_server" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc_transport_chttp2_server_insecure", - "src": [ - "src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc", - "src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_secure", - "grpc_transport_chttp2", - "grpc_transport_chttp2_server" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc_transport_chttp2_server_secure", - "src": [ - "src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "grpc_base", - "grpc_http_filters", - "grpc_transport_chttp2" - ], - "headers": [ - "include/grpc/grpc_cronet.h", - "include/grpc/grpc_security.h", - "include/grpc/grpc_security_constants.h", - "src/core/ext/transport/cronet/client/secure/cronet_channel_create.h", - "src/core/ext/transport/cronet/transport/cronet_transport.h", - "third_party/objective_c/Cronet/bidirectional_stream_c.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_transport_cronet_client_secure", - "src": [ - "include/grpc/grpc_cronet.h", - "include/grpc/grpc_security.h", - "include/grpc/grpc_security_constants.h", - "src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc", - "src/core/ext/transport/cronet/client/secure/cronet_channel_create.h", - "src/core/ext/transport/cronet/transport/cronet_api_dummy.cc", - "src/core/ext/transport/cronet/transport/cronet_transport.cc", - "src/core/ext/transport/cronet/transport/cronet_transport.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_transport_inproc_headers" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "grpc_transport_inproc", - "src": [ - "src/core/ext/transport/inproc/inproc_plugin.cc", - "src/core/ext/transport/inproc/inproc_transport.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base_headers" - ], - "headers": [ - "src/core/ext/transport/inproc/inproc_transport.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_transport_inproc_headers", - "src": [ - "src/core/ext/transport/inproc/inproc_transport.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_server_backward_compatibility" - ], - "headers": [ - "src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h" - ], - "is_filegroup": true, - "language": "c", - "name": "grpc_workaround_cronet_compression_filter", - "src": [ - "src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc", - "src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "nanopb_headers" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "nanopb", - "src": [], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [], - "headers": [ - "third_party/nanopb/pb.h", - "third_party/nanopb/pb_common.h", - "third_party/nanopb/pb_decode.h", - "third_party/nanopb/pb_encode.h" - ], - "is_filegroup": true, - "language": "c", - "name": "nanopb_headers", - "src": [], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "google_api_upb" - ], - "headers": [ - "src/core/ext/upb-generated/gogoproto/gogo.upb.h", - "src/core/ext/upb-generated/validate/validate.upb.h" - ], - "is_filegroup": true, - "language": "c", - "name": "proto_gen_validate_upb", - "src": [ - "src/core/ext/upb-generated/gogoproto/gogo.upb.c", - "src/core/ext/upb-generated/gogoproto/gogo.upb.h", - "src/core/ext/upb-generated/validate/validate.upb.c", - "src/core/ext/upb-generated/validate/validate.upb.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "grpc" - ], - "headers": [ - "test/core/tsi/transport_security_test_lib.h" - ], - "is_filegroup": true, - "language": "c", - "name": "transport_security_test_lib", - "src": [ - "test/core/tsi/transport_security_test_lib.cc", - "test/core/tsi/transport_security_test_lib.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_base", - "grpc_shadow_boringssl", - "grpc_trace", - "tsi_interface" - ], - "headers": [ - "src/core/tsi/fake_transport_security.h", - "src/core/tsi/local_transport_security.h", - "src/core/tsi/ssl/session_cache/ssl_session.h", - "src/core/tsi/ssl/session_cache/ssl_session_cache.h", - "src/core/tsi/ssl_transport_security.h", - "src/core/tsi/ssl_types.h", - "src/core/tsi/transport_security_grpc.h" - ], - "is_filegroup": true, - "language": "c", - "name": "tsi", - "src": [ - "src/core/tsi/fake_transport_security.cc", - "src/core/tsi/fake_transport_security.h", - "src/core/tsi/local_transport_security.cc", - "src/core/tsi/local_transport_security.h", - "src/core/tsi/ssl/session_cache/ssl_session.h", - "src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc", - "src/core/tsi/ssl/session_cache/ssl_session_cache.cc", - "src/core/tsi/ssl/session_cache/ssl_session_cache.h", - "src/core/tsi/ssl/session_cache/ssl_session_openssl.cc", - "src/core/tsi/ssl_transport_security.cc", - "src/core/tsi/ssl_transport_security.h", - "src/core/tsi/ssl_types.h", - "src/core/tsi/transport_security_grpc.cc", - "src/core/tsi/transport_security_grpc.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "grpc_trace" - ], - "headers": [ - "src/core/tsi/transport_security.h", - "src/core/tsi/transport_security_interface.h" - ], - "is_filegroup": true, - "language": "c", - "name": "tsi_interface", - "src": [ - "src/core/tsi/transport_security.cc", - "src/core/tsi/transport_security.h", - "src/core/tsi/transport_security_interface.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "grpc++_internal_hdrs_only", - "grpc_codegen" - ], - "headers": [ - "include/grpc++/impl/codegen/async_stream.h", - "include/grpc++/impl/codegen/async_unary_call.h", - "include/grpc++/impl/codegen/byte_buffer.h", - "include/grpc++/impl/codegen/call.h", - "include/grpc++/impl/codegen/call_hook.h", - "include/grpc++/impl/codegen/channel_interface.h", - "include/grpc++/impl/codegen/client_context.h", - "include/grpc++/impl/codegen/client_unary_call.h", - "include/grpc++/impl/codegen/completion_queue.h", - "include/grpc++/impl/codegen/completion_queue_tag.h", - "include/grpc++/impl/codegen/config.h", - "include/grpc++/impl/codegen/core_codegen_interface.h", - "include/grpc++/impl/codegen/create_auth_context.h", - "include/grpc++/impl/codegen/grpc_library.h", - "include/grpc++/impl/codegen/metadata_map.h", - "include/grpc++/impl/codegen/method_handler_impl.h", - "include/grpc++/impl/codegen/rpc_method.h", - "include/grpc++/impl/codegen/rpc_service_method.h", - "include/grpc++/impl/codegen/security/auth_context.h", - "include/grpc++/impl/codegen/serialization_traits.h", - "include/grpc++/impl/codegen/server_context.h", - "include/grpc++/impl/codegen/server_interface.h", - "include/grpc++/impl/codegen/service_type.h", - "include/grpc++/impl/codegen/slice.h", - "include/grpc++/impl/codegen/status.h", - "include/grpc++/impl/codegen/status_code_enum.h", - "include/grpc++/impl/codegen/string_ref.h", - "include/grpc++/impl/codegen/stub_options.h", - "include/grpc++/impl/codegen/sync_stream.h", - "include/grpc++/impl/codegen/time.h", - "include/grpcpp/impl/codegen/async_generic_service.h", - "include/grpcpp/impl/codegen/async_stream.h", - "include/grpcpp/impl/codegen/async_stream_impl.h", - "include/grpcpp/impl/codegen/async_unary_call.h", - "include/grpcpp/impl/codegen/async_unary_call_impl.h", - "include/grpcpp/impl/codegen/byte_buffer.h", - "include/grpcpp/impl/codegen/call.h", - "include/grpcpp/impl/codegen/call_hook.h", - "include/grpcpp/impl/codegen/call_op_set.h", - "include/grpcpp/impl/codegen/call_op_set_interface.h", - "include/grpcpp/impl/codegen/callback_common.h", - "include/grpcpp/impl/codegen/channel_interface.h", - "include/grpcpp/impl/codegen/client_callback.h", - "include/grpcpp/impl/codegen/client_callback_impl.h", - "include/grpcpp/impl/codegen/client_context.h", - "include/grpcpp/impl/codegen/client_context_impl.h", - "include/grpcpp/impl/codegen/client_interceptor.h", - "include/grpcpp/impl/codegen/client_unary_call.h", - "include/grpcpp/impl/codegen/completion_queue.h", - "include/grpcpp/impl/codegen/completion_queue_impl.h", - "include/grpcpp/impl/codegen/completion_queue_tag.h", - "include/grpcpp/impl/codegen/config.h", - "include/grpcpp/impl/codegen/core_codegen_interface.h", - "include/grpcpp/impl/codegen/create_auth_context.h", - "include/grpcpp/impl/codegen/delegating_channel.h", - "include/grpcpp/impl/codegen/grpc_library.h", - "include/grpcpp/impl/codegen/intercepted_channel.h", - "include/grpcpp/impl/codegen/interceptor.h", - "include/grpcpp/impl/codegen/interceptor_common.h", - "include/grpcpp/impl/codegen/message_allocator.h", - "include/grpcpp/impl/codegen/metadata_map.h", - "include/grpcpp/impl/codegen/method_handler_impl.h", - "include/grpcpp/impl/codegen/rpc_method.h", - "include/grpcpp/impl/codegen/rpc_service_method.h", - "include/grpcpp/impl/codegen/security/auth_context.h", - "include/grpcpp/impl/codegen/serialization_traits.h", - "include/grpcpp/impl/codegen/server_callback.h", - "include/grpcpp/impl/codegen/server_callback_impl.h", - "include/grpcpp/impl/codegen/server_context.h", - "include/grpcpp/impl/codegen/server_context_impl.h", - "include/grpcpp/impl/codegen/server_interceptor.h", - "include/grpcpp/impl/codegen/server_interface.h", - "include/grpcpp/impl/codegen/service_type.h", - "include/grpcpp/impl/codegen/slice.h", - "include/grpcpp/impl/codegen/status.h", - "include/grpcpp/impl/codegen/status_code_enum.h", - "include/grpcpp/impl/codegen/string_ref.h", - "include/grpcpp/impl/codegen/stub_options.h", - "include/grpcpp/impl/codegen/sync_stream.h", - "include/grpcpp/impl/codegen/sync_stream_impl.h", - "include/grpcpp/impl/codegen/time.h" - ], - "is_filegroup": true, - "language": "c++", - "name": "grpc++_codegen_base", - "src": [ - "include/grpc++/impl/codegen/async_stream.h", - "include/grpc++/impl/codegen/async_unary_call.h", - "include/grpc++/impl/codegen/byte_buffer.h", - "include/grpc++/impl/codegen/call.h", - "include/grpc++/impl/codegen/call_hook.h", - "include/grpc++/impl/codegen/channel_interface.h", - "include/grpc++/impl/codegen/client_context.h", - "include/grpc++/impl/codegen/client_unary_call.h", - "include/grpc++/impl/codegen/completion_queue.h", - "include/grpc++/impl/codegen/completion_queue_tag.h", - "include/grpc++/impl/codegen/config.h", - "include/grpc++/impl/codegen/core_codegen_interface.h", - "include/grpc++/impl/codegen/create_auth_context.h", - "include/grpc++/impl/codegen/grpc_library.h", - "include/grpc++/impl/codegen/metadata_map.h", - "include/grpc++/impl/codegen/method_handler_impl.h", - "include/grpc++/impl/codegen/rpc_method.h", - "include/grpc++/impl/codegen/rpc_service_method.h", - "include/grpc++/impl/codegen/security/auth_context.h", - "include/grpc++/impl/codegen/serialization_traits.h", - "include/grpc++/impl/codegen/server_context.h", - "include/grpc++/impl/codegen/server_interface.h", - "include/grpc++/impl/codegen/service_type.h", - "include/grpc++/impl/codegen/slice.h", - "include/grpc++/impl/codegen/status.h", - "include/grpc++/impl/codegen/status_code_enum.h", - "include/grpc++/impl/codegen/string_ref.h", - "include/grpc++/impl/codegen/stub_options.h", - "include/grpc++/impl/codegen/sync_stream.h", - "include/grpc++/impl/codegen/time.h", - "include/grpcpp/impl/codegen/async_generic_service.h", - "include/grpcpp/impl/codegen/async_stream.h", - "include/grpcpp/impl/codegen/async_stream_impl.h", - "include/grpcpp/impl/codegen/async_unary_call.h", - "include/grpcpp/impl/codegen/async_unary_call_impl.h", - "include/grpcpp/impl/codegen/byte_buffer.h", - "include/grpcpp/impl/codegen/call.h", - "include/grpcpp/impl/codegen/call_hook.h", - "include/grpcpp/impl/codegen/call_op_set.h", - "include/grpcpp/impl/codegen/call_op_set_interface.h", - "include/grpcpp/impl/codegen/callback_common.h", - "include/grpcpp/impl/codegen/channel_interface.h", - "include/grpcpp/impl/codegen/client_callback.h", - "include/grpcpp/impl/codegen/client_callback_impl.h", - "include/grpcpp/impl/codegen/client_context.h", - "include/grpcpp/impl/codegen/client_context_impl.h", - "include/grpcpp/impl/codegen/client_interceptor.h", - "include/grpcpp/impl/codegen/client_unary_call.h", - "include/grpcpp/impl/codegen/completion_queue.h", - "include/grpcpp/impl/codegen/completion_queue_impl.h", - "include/grpcpp/impl/codegen/completion_queue_tag.h", - "include/grpcpp/impl/codegen/config.h", - "include/grpcpp/impl/codegen/core_codegen_interface.h", - "include/grpcpp/impl/codegen/create_auth_context.h", - "include/grpcpp/impl/codegen/delegating_channel.h", - "include/grpcpp/impl/codegen/grpc_library.h", - "include/grpcpp/impl/codegen/intercepted_channel.h", - "include/grpcpp/impl/codegen/interceptor.h", - "include/grpcpp/impl/codegen/interceptor_common.h", - "include/grpcpp/impl/codegen/message_allocator.h", - "include/grpcpp/impl/codegen/metadata_map.h", - "include/grpcpp/impl/codegen/method_handler_impl.h", - "include/grpcpp/impl/codegen/rpc_method.h", - "include/grpcpp/impl/codegen/rpc_service_method.h", - "include/grpcpp/impl/codegen/security/auth_context.h", - "include/grpcpp/impl/codegen/serialization_traits.h", - "include/grpcpp/impl/codegen/server_callback.h", - "include/grpcpp/impl/codegen/server_callback_impl.h", - "include/grpcpp/impl/codegen/server_context.h", - "include/grpcpp/impl/codegen/server_context_impl.h", - "include/grpcpp/impl/codegen/server_interceptor.h", - "include/grpcpp/impl/codegen/server_interface.h", - "include/grpcpp/impl/codegen/service_type.h", - "include/grpcpp/impl/codegen/slice.h", - "include/grpcpp/impl/codegen/status.h", - "include/grpcpp/impl/codegen/status_code_enum.h", - "include/grpcpp/impl/codegen/string_ref.h", - "include/grpcpp/impl/codegen/stub_options.h", - "include/grpcpp/impl/codegen/sync_stream.h", - "include/grpcpp/impl/codegen/sync_stream_impl.h", - "include/grpcpp/impl/codegen/time.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "grpc++_codegen_base" - ], - "headers": [], - "is_filegroup": true, - "language": "c++", - "name": "grpc++_codegen_base_src", - "src": [ - "src/cpp/codegen/codegen_init.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "grpc++_codegen_base", - "grpc++_config_proto" - ], - "headers": [ - "include/grpc++/impl/codegen/proto_utils.h", - "include/grpcpp/impl/codegen/proto_buffer_reader.h", - "include/grpcpp/impl/codegen/proto_buffer_writer.h", - "include/grpcpp/impl/codegen/proto_utils.h" - ], - "is_filegroup": true, - "language": "c++", - "name": "grpc++_codegen_proto", - "src": [ - "include/grpc++/impl/codegen/proto_utils.h", - "include/grpcpp/impl/codegen/proto_buffer_reader.h", - "include/grpcpp/impl/codegen/proto_buffer_writer.h", - "include/grpcpp/impl/codegen/proto_utils.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "gpr", - "gpr_base_headers", - "grpc++_codegen_base", - "grpc++_internal_hdrs_only", - "grpc_base_headers", - "grpc_health_upb", - "grpc_transport_inproc_headers", - "nanopb_headers" - ], - "headers": [ - "include/grpc++/alarm.h", - "include/grpc++/channel.h", - "include/grpc++/client_context.h", - "include/grpc++/completion_queue.h", - "include/grpc++/create_channel.h", - "include/grpc++/create_channel_posix.h", - "include/grpc++/ext/health_check_service_server_builder_option.h", - "include/grpc++/generic/async_generic_service.h", - "include/grpc++/generic/generic_stub.h", - "include/grpc++/grpc++.h", - "include/grpc++/health_check_service_interface.h", - "include/grpc++/impl/call.h", - "include/grpc++/impl/channel_argument_option.h", - "include/grpc++/impl/client_unary_call.h", - "include/grpc++/impl/codegen/core_codegen.h", - "include/grpc++/impl/grpc_library.h", - "include/grpc++/impl/method_handler_impl.h", - "include/grpc++/impl/rpc_method.h", - "include/grpc++/impl/rpc_service_method.h", - "include/grpc++/impl/serialization_traits.h", - "include/grpc++/impl/server_builder_option.h", - "include/grpc++/impl/server_builder_plugin.h", - "include/grpc++/impl/server_initializer.h", - "include/grpc++/impl/service_type.h", - "include/grpc++/resource_quota.h", - "include/grpc++/security/auth_context.h", - "include/grpc++/security/auth_metadata_processor.h", - "include/grpc++/security/credentials.h", - "include/grpc++/security/server_credentials.h", - "include/grpc++/server.h", - "include/grpc++/server_builder.h", - "include/grpc++/server_context.h", - "include/grpc++/server_posix.h", - "include/grpc++/support/async_stream.h", - "include/grpc++/support/async_unary_call.h", - "include/grpc++/support/byte_buffer.h", - "include/grpc++/support/channel_arguments.h", - "include/grpc++/support/config.h", - "include/grpc++/support/slice.h", - "include/grpc++/support/status.h", - "include/grpc++/support/status_code_enum.h", - "include/grpc++/support/string_ref.h", - "include/grpc++/support/stub_options.h", - "include/grpc++/support/sync_stream.h", - "include/grpc++/support/time.h", - "include/grpcpp/alarm.h", - "include/grpcpp/alarm_impl.h", - "include/grpcpp/channel.h", - "include/grpcpp/channel_impl.h", - "include/grpcpp/client_context.h", - "include/grpcpp/completion_queue.h", - "include/grpcpp/completion_queue_impl.h", - "include/grpcpp/create_channel.h", - "include/grpcpp/create_channel_impl.h", - "include/grpcpp/create_channel_posix.h", - "include/grpcpp/create_channel_posix_impl.h", - "include/grpcpp/ext/health_check_service_server_builder_option.h", - "include/grpcpp/generic/async_generic_service.h", - "include/grpcpp/generic/generic_stub.h", - "include/grpcpp/generic/generic_stub_impl.h", - "include/grpcpp/grpcpp.h", - "include/grpcpp/health_check_service_interface.h", - "include/grpcpp/health_check_service_interface_impl.h", - "include/grpcpp/impl/call.h", - "include/grpcpp/impl/channel_argument_option.h", - "include/grpcpp/impl/client_unary_call.h", - "include/grpcpp/impl/codegen/core_codegen.h", - "include/grpcpp/impl/grpc_library.h", - "include/grpcpp/impl/method_handler_impl.h", - "include/grpcpp/impl/rpc_method.h", - "include/grpcpp/impl/rpc_service_method.h", - "include/grpcpp/impl/serialization_traits.h", - "include/grpcpp/impl/server_builder_option.h", - "include/grpcpp/impl/server_builder_option_impl.h", - "include/grpcpp/impl/server_builder_plugin.h", - "include/grpcpp/impl/server_initializer.h", - "include/grpcpp/impl/server_initializer_impl.h", - "include/grpcpp/impl/service_type.h", - "include/grpcpp/resource_quota.h", - "include/grpcpp/resource_quota_impl.h", - "include/grpcpp/security/auth_context.h", - "include/grpcpp/security/auth_metadata_processor.h", - "include/grpcpp/security/auth_metadata_processor_impl.h", - "include/grpcpp/security/credentials.h", - "include/grpcpp/security/credentials_impl.h", - "include/grpcpp/security/server_credentials.h", - "include/grpcpp/security/server_credentials_impl.h", - "include/grpcpp/server.h", - "include/grpcpp/server_builder.h", - "include/grpcpp/server_builder_impl.h", - "include/grpcpp/server_context.h", - "include/grpcpp/server_impl.h", - "include/grpcpp/server_posix.h", - "include/grpcpp/server_posix_impl.h", - "include/grpcpp/support/async_stream.h", - "include/grpcpp/support/async_stream_impl.h", - "include/grpcpp/support/async_unary_call.h", - "include/grpcpp/support/async_unary_call_impl.h", - "include/grpcpp/support/byte_buffer.h", - "include/grpcpp/support/channel_arguments.h", - "include/grpcpp/support/channel_arguments_impl.h", - "include/grpcpp/support/client_callback.h", - "include/grpcpp/support/client_callback_impl.h", - "include/grpcpp/support/client_interceptor.h", - "include/grpcpp/support/config.h", - "include/grpcpp/support/interceptor.h", - "include/grpcpp/support/message_allocator.h", - "include/grpcpp/support/proto_buffer_reader.h", - "include/grpcpp/support/proto_buffer_writer.h", - "include/grpcpp/support/server_callback.h", - "include/grpcpp/support/server_callback_impl.h", - "include/grpcpp/support/server_interceptor.h", - "include/grpcpp/support/slice.h", - "include/grpcpp/support/status.h", - "include/grpcpp/support/status_code_enum.h", - "include/grpcpp/support/string_ref.h", - "include/grpcpp/support/stub_options.h", - "include/grpcpp/support/sync_stream.h", - "include/grpcpp/support/sync_stream_impl.h", - "include/grpcpp/support/time.h", - "include/grpcpp/support/validate_service_config.h", - "src/cpp/client/create_channel_internal.h", - "src/cpp/common/channel_filter.h", - "src/cpp/server/dynamic_thread_pool.h", - "src/cpp/server/external_connection_acceptor_impl.h", - "src/cpp/server/health/default_health_check_service.h", - "src/cpp/server/thread_pool_interface.h", - "src/cpp/thread_manager/thread_manager.h" - ], - "is_filegroup": true, - "language": "c++", - "name": "grpc++_common", - "src": [ - "include/grpc++/alarm.h", - "include/grpc++/channel.h", - "include/grpc++/client_context.h", - "include/grpc++/completion_queue.h", - "include/grpc++/create_channel.h", - "include/grpc++/create_channel_posix.h", - "include/grpc++/ext/health_check_service_server_builder_option.h", - "include/grpc++/generic/async_generic_service.h", - "include/grpc++/generic/generic_stub.h", - "include/grpc++/grpc++.h", - "include/grpc++/health_check_service_interface.h", - "include/grpc++/impl/call.h", - "include/grpc++/impl/channel_argument_option.h", - "include/grpc++/impl/client_unary_call.h", - "include/grpc++/impl/codegen/core_codegen.h", - "include/grpc++/impl/grpc_library.h", - "include/grpc++/impl/method_handler_impl.h", - "include/grpc++/impl/rpc_method.h", - "include/grpc++/impl/rpc_service_method.h", - "include/grpc++/impl/serialization_traits.h", - "include/grpc++/impl/server_builder_option.h", - "include/grpc++/impl/server_builder_plugin.h", - "include/grpc++/impl/server_initializer.h", - "include/grpc++/impl/service_type.h", - "include/grpc++/resource_quota.h", - "include/grpc++/security/auth_context.h", - "include/grpc++/security/auth_metadata_processor.h", - "include/grpc++/security/credentials.h", - "include/grpc++/security/server_credentials.h", - "include/grpc++/server.h", - "include/grpc++/server_builder.h", - "include/grpc++/server_context.h", - "include/grpc++/server_posix.h", - "include/grpc++/support/async_stream.h", - "include/grpc++/support/async_unary_call.h", - "include/grpc++/support/byte_buffer.h", - "include/grpc++/support/channel_arguments.h", - "include/grpc++/support/config.h", - "include/grpc++/support/slice.h", - "include/grpc++/support/status.h", - "include/grpc++/support/status_code_enum.h", - "include/grpc++/support/string_ref.h", - "include/grpc++/support/stub_options.h", - "include/grpc++/support/sync_stream.h", - "include/grpc++/support/time.h", - "include/grpcpp/alarm.h", - "include/grpcpp/alarm_impl.h", - "include/grpcpp/channel.h", - "include/grpcpp/channel_impl.h", - "include/grpcpp/client_context.h", - "include/grpcpp/completion_queue.h", - "include/grpcpp/completion_queue_impl.h", - "include/grpcpp/create_channel.h", - "include/grpcpp/create_channel_impl.h", - "include/grpcpp/create_channel_posix.h", - "include/grpcpp/create_channel_posix_impl.h", - "include/grpcpp/ext/health_check_service_server_builder_option.h", - "include/grpcpp/generic/async_generic_service.h", - "include/grpcpp/generic/generic_stub.h", - "include/grpcpp/generic/generic_stub_impl.h", - "include/grpcpp/grpcpp.h", - "include/grpcpp/health_check_service_interface.h", - "include/grpcpp/health_check_service_interface_impl.h", - "include/grpcpp/impl/call.h", - "include/grpcpp/impl/channel_argument_option.h", - "include/grpcpp/impl/client_unary_call.h", - "include/grpcpp/impl/codegen/core_codegen.h", - "include/grpcpp/impl/grpc_library.h", - "include/grpcpp/impl/method_handler_impl.h", - "include/grpcpp/impl/rpc_method.h", - "include/grpcpp/impl/rpc_service_method.h", - "include/grpcpp/impl/serialization_traits.h", - "include/grpcpp/impl/server_builder_option.h", - "include/grpcpp/impl/server_builder_option_impl.h", - "include/grpcpp/impl/server_builder_plugin.h", - "include/grpcpp/impl/server_initializer.h", - "include/grpcpp/impl/server_initializer_impl.h", - "include/grpcpp/impl/service_type.h", - "include/grpcpp/resource_quota.h", - "include/grpcpp/resource_quota_impl.h", - "include/grpcpp/security/auth_context.h", - "include/grpcpp/security/auth_metadata_processor.h", - "include/grpcpp/security/auth_metadata_processor_impl.h", - "include/grpcpp/security/credentials.h", - "include/grpcpp/security/credentials_impl.h", - "include/grpcpp/security/server_credentials.h", - "include/grpcpp/security/server_credentials_impl.h", - "include/grpcpp/server.h", - "include/grpcpp/server_builder.h", - "include/grpcpp/server_builder_impl.h", - "include/grpcpp/server_context.h", - "include/grpcpp/server_impl.h", - "include/grpcpp/server_posix.h", - "include/grpcpp/server_posix_impl.h", - "include/grpcpp/support/async_stream.h", - "include/grpcpp/support/async_stream_impl.h", - "include/grpcpp/support/async_unary_call.h", - "include/grpcpp/support/async_unary_call_impl.h", - "include/grpcpp/support/byte_buffer.h", - "include/grpcpp/support/channel_arguments.h", - "include/grpcpp/support/channel_arguments_impl.h", - "include/grpcpp/support/client_callback.h", - "include/grpcpp/support/client_callback_impl.h", - "include/grpcpp/support/client_interceptor.h", - "include/grpcpp/support/config.h", - "include/grpcpp/support/interceptor.h", - "include/grpcpp/support/message_allocator.h", - "include/grpcpp/support/proto_buffer_reader.h", - "include/grpcpp/support/proto_buffer_writer.h", - "include/grpcpp/support/server_callback.h", - "include/grpcpp/support/server_callback_impl.h", - "include/grpcpp/support/server_interceptor.h", - "include/grpcpp/support/slice.h", - "include/grpcpp/support/status.h", - "include/grpcpp/support/status_code_enum.h", - "include/grpcpp/support/string_ref.h", - "include/grpcpp/support/stub_options.h", - "include/grpcpp/support/sync_stream.h", - "include/grpcpp/support/sync_stream_impl.h", - "include/grpcpp/support/time.h", - "include/grpcpp/support/validate_service_config.h", - "src/cpp/client/channel_cc.cc", - "src/cpp/client/client_context.cc", - "src/cpp/client/client_interceptor.cc", - "src/cpp/client/create_channel.cc", - "src/cpp/client/create_channel_internal.cc", - "src/cpp/client/create_channel_internal.h", - "src/cpp/client/create_channel_posix.cc", - "src/cpp/client/credentials_cc.cc", - "src/cpp/client/generic_stub.cc", - "src/cpp/common/alarm.cc", - "src/cpp/common/channel_arguments.cc", - "src/cpp/common/channel_filter.cc", - "src/cpp/common/channel_filter.h", - "src/cpp/common/completion_queue_cc.cc", - "src/cpp/common/core_codegen.cc", - "src/cpp/common/resource_quota_cc.cc", - "src/cpp/common/rpc_method.cc", - "src/cpp/common/validate_service_config.cc", - "src/cpp/common/version_cc.cc", - "src/cpp/server/async_generic_service.cc", - "src/cpp/server/channel_argument_option.cc", - "src/cpp/server/create_default_thread_pool.cc", - "src/cpp/server/dynamic_thread_pool.cc", - "src/cpp/server/dynamic_thread_pool.h", - "src/cpp/server/external_connection_acceptor_impl.cc", - "src/cpp/server/external_connection_acceptor_impl.h", - "src/cpp/server/health/default_health_check_service.cc", - "src/cpp/server/health/default_health_check_service.h", - "src/cpp/server/health/health_check_service.cc", - "src/cpp/server/health/health_check_service_server_builder_option.cc", - "src/cpp/server/server_builder.cc", - "src/cpp/server/server_cc.cc", - "src/cpp/server/server_context.cc", - "src/cpp/server/server_credentials.cc", - "src/cpp/server/server_posix.cc", - "src/cpp/server/thread_pool_interface.h", - "src/cpp/thread_manager/thread_manager.cc", - "src/cpp/thread_manager/thread_manager.h", - "src/cpp/util/byte_buffer_cc.cc", - "src/cpp/util/status.cc", - "src/cpp/util/string_ref.cc", - "src/cpp/util/time_cc.cc" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [], - "headers": [ - "include/grpc++/impl/codegen/config_protobuf.h", - "include/grpcpp/impl/codegen/config_protobuf.h" - ], - "is_filegroup": true, - "language": "c++", - "name": "grpc++_config_proto", - "src": [ - "include/grpc++/impl/codegen/config_protobuf.h", - "include/grpcpp/impl/codegen/config_protobuf.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [], - "headers": [ - "include/grpcpp/impl/codegen/sync.h" - ], - "is_filegroup": true, - "language": "c++", - "name": "grpc++_internal_hdrs_only", - "src": [ - "include/grpcpp/impl/codegen/sync.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [], - "headers": [ - "src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h", - "src/proto/grpc/reflection/v1alpha/reflection.pb.h", - "src/proto/grpc/reflection/v1alpha/reflection_mock.grpc.pb.h" - ], - "is_filegroup": true, - "language": "c++", - "name": "grpc++_reflection_proto", - "src": [], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "grpc", - "grpc++" - ], - "headers": [ - "include/grpc++/test/mock_stream.h", - "include/grpc++/test/server_context_test_spouse.h", - "include/grpcpp/test/mock_stream.h", - "include/grpcpp/test/server_context_test_spouse.h" - ], - "is_filegroup": true, - "language": "c++", - "name": "grpc++_test", - "src": [ - "include/grpc++/test/mock_stream.h", - "include/grpc++/test/server_context_test_spouse.h", - "include/grpcpp/test/mock_stream.h", - "include/grpcpp/test/server_context_test_spouse.h" - ], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [], - "headers": [ - "src/proto/grpc/channelz/channelz.grpc.pb.h", - "src/proto/grpc/channelz/channelz.pb.h", - "src/proto/grpc/channelz/channelz_mock.grpc.pb.h" - ], - "is_filegroup": true, - "language": "c++", - "name": "grpcpp_channelz_proto", - "src": [], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [ - "upb_headers" - ], - "headers": [], - "is_filegroup": true, - "language": "c", - "name": "upb", - "src": [], - "third_party": false, - "type": "filegroup" - }, - { - "deps": [], - "headers": [ - "third_party/upb/upb/decode.h", - "third_party/upb/upb/encode.h", - "third_party/upb/upb/generated_util.h", - "third_party/upb/upb/msg.h", - "third_party/upb/upb/port_def.inc", - "third_party/upb/upb/port_undef.inc", - "third_party/upb/upb/table.int.h", - "third_party/upb/upb/upb.h" - ], - "is_filegroup": true, - "language": "c", - "name": "upb_headers", - "src": [], - "third_party": false, - "type": "filegroup" - } -] From 0d203d39b821ad80d3ddf828e8395b0f9a40350e Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 16 Aug 2019 11:17:35 -0700 Subject: [PATCH 361/661] Adopt reviewers' advice --- src/python/grpcio/grpc/__init__.py | 42 ++++++++++++++ .../grpc/_cython/_cygrpc/credentials.pxd.pxi | 2 +- src/python/grpcio/grpc/_local_credentials.py | 56 ------------------- .../grpcio_tests/tests/unit/BUILD.bazel | 2 +- .../tests/unit/_local_credentials_test.py | 19 +++---- 5 files changed, 53 insertions(+), 68 deletions(-) delete mode 100644 src/python/grpcio/grpc/_local_credentials.py diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index 7dae90c89e8..f96ca270dc0 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -22,6 +22,7 @@ import six from grpc._cython import cygrpc as _cygrpc from grpc import _compression +from grpc import local_credentials logging.getLogger(__name__).addHandler(logging.NullHandler()) @@ -1744,6 +1745,44 @@ def dynamic_ssl_server_credentials(initial_certificate_configuration, certificate_configuration_fetcher, require_client_authentication)) +@enum.unique +class LocalConnectionType(enum.Enum): + """Type of local connections for which local channel/server credentials will be applied. + + Attributes: + UDS: Unix domain socket connections + LOCAL_TCP: Local TCP connections. + """ + UDS = _cygrpc.LocalConnectType.uds + LOCAL_TCP = _cygrpc.LocalConnectType.local_tcp + + +def local_channel_credentials(local_connect_type=LocalConnectionType.LOCAL_TCP): + """Creates a local ChannelCredentials used for local connections. + + Args: + local_connect_type: Local connection type (either UDS or LOCAL_TCP) + + Returns: + A ChannelCredentials for use with a local Channel + """ + return ChannelCredentials( + _cygrpc.channel_credentials_local(local_connect_type.value)) + + +def local_server_credentials(local_connect_type=LocalConnectionType.LOCAL_TCP): + """Creates a local ServerCredentials used for local connections. + + Args: + local_connect_type: Local connection type (either UDS or LOCAL_TCP) + + Returns: + A ServerCredentials for use with a local Server + """ + return ServerCredentials( + _cygrpc.server_credentials_local(local_connect_type.value)) + + def channel_ready_future(channel): """Creates a Future that tracks when a Channel is ready. @@ -1913,6 +1952,7 @@ __all__ = ( 'ClientCallDetails', 'ServerCertificateConfiguration', 'ServerCredentials', + 'LocalConnectionType', 'UnaryUnaryMultiCallable', 'UnaryStreamMultiCallable', 'StreamUnaryMultiCallable', @@ -1939,6 +1979,8 @@ __all__ = ( 'access_token_call_credentials', 'composite_call_credentials', 'composite_channel_credentials', + 'local_channel_credentials', + 'local_server_credentials', 'ssl_server_credentials', 'ssl_server_certificate_configuration', 'dynamic_ssl_server_credentials', diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi index ec647378a99..0631e1cf63c 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi @@ -101,4 +101,4 @@ cdef class ServerCredentials: cdef class LocalChannelCredentials(ChannelCredentials): - cdef readonly object _local_connect_type + cdef grpc_local_connect_type _local_connect_type diff --git a/src/python/grpcio/grpc/_local_credentials.py b/src/python/grpcio/grpc/_local_credentials.py deleted file mode 100644 index 8d46fa3d3ae..00000000000 --- a/src/python/grpcio/grpc/_local_credentials.py +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2019 The gRPC authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""gRPC's local credential API.""" - -import enum -import grpc -from grpc._cython import cygrpc - - -@enum.unique -class LocalConnectType(enum.Enum): - """Type of local connections for which local channel/server credentials will be applied. - - Attributes: - UDS: Unix domain socket connections - LOCAL_TCP: Local TCP connections. - """ - UDS = cygrpc.LocalConnectType.uds - LOCAL_TCP = cygrpc.LocalConnectType.local_tcp - - -def local_channel_credentials(local_connect_type=LocalConnectType.LOCAL_TCP): - """Creates a local ChannelCredentials used for local connections. - - Args: - local_connect_type: Local connection type (either UDS or LOCAL_TCP) - - Returns: - A ChannelCredentials for use with a local Channel - """ - return grpc.ChannelCredentials( - cygrpc.channel_credentials_local(local_connect_type.value)) - - -def local_server_credentials(local_connect_type=LocalConnectType.LOCAL_TCP): - """Creates a local ServerCredentials used for local connections. - - Args: - local_connect_type: Local connection type (either UDS or LOCAL_TCP) - - Returns: - A ServerCredentials for use with a local Server - """ - return grpc.ServerCredentials( - cygrpc.server_credentials_local(local_connect_type.value)) diff --git a/src/python/grpcio_tests/tests/unit/BUILD.bazel b/src/python/grpcio_tests/tests/unit/BUILD.bazel index baa8a4a3e6b..49203b7fa16 100644 --- a/src/python/grpcio_tests/tests/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/BUILD.bazel @@ -19,7 +19,7 @@ GRPCIO_TESTS_UNIT = [ "_interceptor_test.py", "_invalid_metadata_test.py", "_invocation_defects_test.py", - "_local_crednetials_test.py", + "_local_credentials_test.py", "_logging_test.py", "_metadata_code_details_test.py", "_metadata_test.py", diff --git a/src/python/grpcio_tests/tests/unit/_local_credentials_test.py b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py index 838d8129e8c..fe7b052482b 100644 --- a/src/python/grpcio_tests/tests/unit/_local_credentials_test.py +++ b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py @@ -1,4 +1,4 @@ -# Copyright 2019 The gRPC authors +# Copyright 2019 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ import unittest from concurrent.futures import ThreadPoolExecutor import grpc -from grpc import local_credentials class _GenericHandler(grpc.GenericRpcHandler): @@ -35,10 +34,10 @@ class LocalCredentialsTest(unittest.TestCase): def test_local_tcp(self): server_addr = '[::1]:{}' - channel_creds = local_credentials.local_channel_credentials( - local_credentials.LocalConnectType.LOCAL_TCP) - server_creds = local_credentials.local_server_credentials( - local_credentials.LocalConnectType.LOCAL_TCP) + channel_creds = grpc.local_channel_credentials( + grpc.LocalConnectionType.LOCAL_TCP) + server_creds = grpc.local_server_credentials( + grpc.LocalConnectionType.LOCAL_TCP) server = self._create_server() port = server.add_secure_port(server_addr.format(0), server_creds) server.start() @@ -48,10 +47,10 @@ class LocalCredentialsTest(unittest.TestCase): def test_uds(self): server_addr = 'unix:/tmp/grpc_fullstack_test' - channel_creds = local_credentials.local_channel_credentials( - local_credentials.LocalConnectType.UDS) - server_creds = local_credentials.local_server_credentials( - local_credentials.LocalConnectType.UDS) + channel_creds = grpc.local_channel_credentials( + grpc.LocalConnectionType.UDS) + server_creds = grpc.local_server_credentials( + grpc.LocalConnectionType.UDS) server = self._create_server() server.add_secure_port(server_addr, server_creds) server.start() From feb263ba6d3c8b17e72b9221e42ab926654ad901 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Thu, 15 Aug 2019 12:56:41 -0700 Subject: [PATCH 362/661] Add check_attrs & clean-up build.yaml --- CMakeLists.txt | 13 - build.yaml | 2435 +++++++++---------- src/benchmark/gen_build_yaml.py | 2 +- src/boringssl/gen_build_yaml.py | 6 +- src/c-ares/gen_build_yaml.py | 2 +- src/objective-c/tests/run_one_test_bazel.sh | 2 +- src/zlib/gen_build_yaml.py | 2 +- test/core/bad_client/gen_build_yaml.py | 2 +- tools/buildgen/plugins/check_attrs.py | 126 + 9 files changed, 1324 insertions(+), 1266 deletions(-) create mode 100644 tools/buildgen/plugins/check_attrs.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e1cdd3fc5f..0b6dba6dedb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17923,7 +17923,6 @@ target_include_directories(bad_streaming_id_bad_client_test ) target_link_libraries(bad_streaming_id_bad_client_test - ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} bad_client_test @@ -17966,7 +17965,6 @@ target_include_directories(badreq_bad_client_test ) target_link_libraries(badreq_bad_client_test - ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} bad_client_test @@ -18009,7 +18007,6 @@ target_include_directories(connection_prefix_bad_client_test ) target_link_libraries(connection_prefix_bad_client_test - ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} bad_client_test @@ -18052,7 +18049,6 @@ target_include_directories(duplicate_header_bad_client_test ) target_link_libraries(duplicate_header_bad_client_test - ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} bad_client_test @@ -18095,7 +18091,6 @@ target_include_directories(head_of_line_blocking_bad_client_test ) target_link_libraries(head_of_line_blocking_bad_client_test - ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} bad_client_test @@ -18138,7 +18133,6 @@ target_include_directories(headers_bad_client_test ) target_link_libraries(headers_bad_client_test - ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} bad_client_test @@ -18181,7 +18175,6 @@ target_include_directories(initial_settings_frame_bad_client_test ) target_link_libraries(initial_settings_frame_bad_client_test - ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} bad_client_test @@ -18224,7 +18217,6 @@ target_include_directories(large_metadata_bad_client_test ) target_link_libraries(large_metadata_bad_client_test - ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} bad_client_test @@ -18267,7 +18259,6 @@ target_include_directories(out_of_bounds_bad_client_test ) target_link_libraries(out_of_bounds_bad_client_test - ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} bad_client_test @@ -18310,7 +18301,6 @@ target_include_directories(server_registered_method_bad_client_test ) target_link_libraries(server_registered_method_bad_client_test - ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} bad_client_test @@ -18353,7 +18343,6 @@ target_include_directories(simple_request_bad_client_test ) target_link_libraries(simple_request_bad_client_test - ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} bad_client_test @@ -18396,7 +18385,6 @@ target_include_directories(unknown_frame_bad_client_test ) target_link_libraries(unknown_frame_bad_client_test - ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} bad_client_test @@ -18439,7 +18427,6 @@ target_include_directories(window_overflow_bad_client_test ) target_link_libraries(window_overflow_bad_client_test - ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} bad_client_test diff --git a/build.yaml b/build.yaml index e63f375bd8a..87ca412d12f 100644 --- a/build.yaml +++ b/build.yaml @@ -315,1307 +315,1284 @@ filegroups: uses: - grpc++_common - grpc++_codegen_base -- name: grpc_base - src: - - src/core/lib/avl/avl.cc - - src/core/lib/backoff/backoff.cc - - src/core/lib/channel/channel_args.cc - - src/core/lib/channel/channel_stack.cc - - src/core/lib/channel/channel_stack_builder.cc - - src/core/lib/channel/channel_trace.cc - - src/core/lib/channel/channelz.cc - - src/core/lib/channel/channelz_registry.cc - - src/core/lib/channel/connected_channel.cc - - src/core/lib/channel/handshaker.cc - - src/core/lib/channel/handshaker_registry.cc - - src/core/lib/channel/status_util.cc - - src/core/lib/compression/compression.cc - - src/core/lib/compression/compression_args.cc - - src/core/lib/compression/compression_internal.cc - - src/core/lib/compression/message_compress.cc - - src/core/lib/compression/stream_compression.cc - - src/core/lib/compression/stream_compression_gzip.cc - - src/core/lib/compression/stream_compression_identity.cc - - src/core/lib/debug/stats.cc - - src/core/lib/debug/stats_data.cc - - src/core/lib/http/format_request.cc - - src/core/lib/http/httpcli.cc - - src/core/lib/http/parser.cc - - src/core/lib/iomgr/buffer_list.cc - - src/core/lib/iomgr/call_combiner.cc - - src/core/lib/iomgr/cfstream_handle.cc - - src/core/lib/iomgr/combiner.cc - - src/core/lib/iomgr/endpoint.cc - - src/core/lib/iomgr/endpoint_cfstream.cc - - src/core/lib/iomgr/endpoint_pair_posix.cc - - src/core/lib/iomgr/endpoint_pair_uv.cc - - src/core/lib/iomgr/endpoint_pair_windows.cc - - src/core/lib/iomgr/error.cc - - src/core/lib/iomgr/error_cfstream.cc - - src/core/lib/iomgr/ev_epoll1_linux.cc - - src/core/lib/iomgr/ev_epollex_linux.cc - - src/core/lib/iomgr/ev_poll_posix.cc - - src/core/lib/iomgr/ev_posix.cc - - src/core/lib/iomgr/ev_windows.cc - - src/core/lib/iomgr/exec_ctx.cc - - src/core/lib/iomgr/executor.cc - - src/core/lib/iomgr/executor/mpmcqueue.cc - - src/core/lib/iomgr/executor/threadpool.cc - - src/core/lib/iomgr/fork_posix.cc - - src/core/lib/iomgr/fork_windows.cc - - src/core/lib/iomgr/gethostname_fallback.cc - - src/core/lib/iomgr/gethostname_host_name_max.cc - - src/core/lib/iomgr/gethostname_sysconf.cc - - src/core/lib/iomgr/grpc_if_nametoindex_posix.cc - - src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc - - src/core/lib/iomgr/internal_errqueue.cc - - src/core/lib/iomgr/iocp_windows.cc - - src/core/lib/iomgr/iomgr.cc - - src/core/lib/iomgr/iomgr_custom.cc - - src/core/lib/iomgr/iomgr_internal.cc - - src/core/lib/iomgr/iomgr_posix.cc - - src/core/lib/iomgr/iomgr_posix_cfstream.cc - - src/core/lib/iomgr/iomgr_uv.cc - - src/core/lib/iomgr/iomgr_windows.cc - - src/core/lib/iomgr/is_epollexclusive_available.cc - - src/core/lib/iomgr/load_file.cc - - src/core/lib/iomgr/lockfree_event.cc - - src/core/lib/iomgr/polling_entity.cc - - src/core/lib/iomgr/pollset.cc - - src/core/lib/iomgr/pollset_custom.cc - - src/core/lib/iomgr/pollset_set.cc - - src/core/lib/iomgr/pollset_set_custom.cc - - src/core/lib/iomgr/pollset_set_windows.cc - - src/core/lib/iomgr/pollset_uv.cc - - src/core/lib/iomgr/pollset_windows.cc - - src/core/lib/iomgr/resolve_address.cc - - src/core/lib/iomgr/resolve_address_custom.cc - - src/core/lib/iomgr/resolve_address_posix.cc - - src/core/lib/iomgr/resolve_address_windows.cc - - src/core/lib/iomgr/resource_quota.cc - - src/core/lib/iomgr/sockaddr_utils.cc - - src/core/lib/iomgr/socket_factory_posix.cc - - src/core/lib/iomgr/socket_mutator.cc - - src/core/lib/iomgr/socket_utils_common_posix.cc - - src/core/lib/iomgr/socket_utils_linux.cc - - src/core/lib/iomgr/socket_utils_posix.cc - - src/core/lib/iomgr/socket_utils_uv.cc - - src/core/lib/iomgr/socket_utils_windows.cc - - src/core/lib/iomgr/socket_windows.cc - - src/core/lib/iomgr/tcp_client.cc - - src/core/lib/iomgr/tcp_client_cfstream.cc - - src/core/lib/iomgr/tcp_client_custom.cc - - src/core/lib/iomgr/tcp_client_posix.cc - - src/core/lib/iomgr/tcp_client_windows.cc - - src/core/lib/iomgr/tcp_custom.cc - - src/core/lib/iomgr/tcp_posix.cc - - src/core/lib/iomgr/tcp_server.cc - - src/core/lib/iomgr/tcp_server_custom.cc - - src/core/lib/iomgr/tcp_server_posix.cc - - src/core/lib/iomgr/tcp_server_utils_posix_common.cc - - src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc - - src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc - - src/core/lib/iomgr/tcp_server_windows.cc - - src/core/lib/iomgr/tcp_uv.cc - - src/core/lib/iomgr/tcp_windows.cc - - src/core/lib/iomgr/time_averaged_stats.cc - - src/core/lib/iomgr/timer.cc - - src/core/lib/iomgr/timer_custom.cc - - src/core/lib/iomgr/timer_generic.cc - - src/core/lib/iomgr/timer_heap.cc - - src/core/lib/iomgr/timer_manager.cc - - src/core/lib/iomgr/timer_uv.cc - - src/core/lib/iomgr/udp_server.cc - - src/core/lib/iomgr/unix_sockets_posix.cc - - src/core/lib/iomgr/unix_sockets_posix_noop.cc - - src/core/lib/iomgr/wakeup_fd_eventfd.cc - - src/core/lib/iomgr/wakeup_fd_nospecial.cc - - src/core/lib/iomgr/wakeup_fd_pipe.cc - - src/core/lib/iomgr/wakeup_fd_posix.cc - - src/core/lib/json/json.cc - - src/core/lib/json/json_reader.cc - - src/core/lib/json/json_string.cc - - src/core/lib/json/json_writer.cc - - src/core/lib/slice/b64.cc - - src/core/lib/slice/percent_encoding.cc - - src/core/lib/slice/slice.cc - - src/core/lib/slice/slice_buffer.cc - - src/core/lib/slice/slice_intern.cc - - src/core/lib/slice/slice_string_helpers.cc - - src/core/lib/surface/api_trace.cc - - src/core/lib/surface/byte_buffer.cc - - src/core/lib/surface/byte_buffer_reader.cc - - src/core/lib/surface/call.cc - - src/core/lib/surface/call_details.cc - - src/core/lib/surface/call_log_batch.cc - - src/core/lib/surface/channel.cc - - src/core/lib/surface/channel_init.cc - - src/core/lib/surface/channel_ping.cc - - src/core/lib/surface/channel_stack_type.cc - - src/core/lib/surface/completion_queue.cc - - src/core/lib/surface/completion_queue_factory.cc - - src/core/lib/surface/event_string.cc - - src/core/lib/surface/lame_client.cc - - src/core/lib/surface/metadata_array.cc - - src/core/lib/surface/server.cc - - src/core/lib/surface/validate_metadata.cc - - src/core/lib/surface/version.cc - - src/core/lib/transport/bdp_estimator.cc - - src/core/lib/transport/byte_stream.cc - - src/core/lib/transport/connectivity_state.cc - - src/core/lib/transport/error_utils.cc - - src/core/lib/transport/metadata.cc - - src/core/lib/transport/metadata_batch.cc - - src/core/lib/transport/pid_controller.cc - - src/core/lib/transport/static_metadata.cc - - src/core/lib/transport/status_conversion.cc - - src/core/lib/transport/status_metadata.cc - - src/core/lib/transport/timeout_encoding.cc - - src/core/lib/transport/transport.cc - - src/core/lib/transport/transport_op_string.cc - - src/core/lib/uri/uri_parser.cc - deps: - - gpr - filegroups: - - grpc_base_headers - uses: - - grpc_codegen - - grpc_trace -- name: grpc_base_headers - public_headers: - - include/grpc/byte_buffer.h - - include/grpc/byte_buffer_reader.h - - include/grpc/compression.h - - include/grpc/fork.h - - include/grpc/grpc.h - - include/grpc/grpc_posix.h - - include/grpc/grpc_security_constants.h - - include/grpc/load_reporting.h - - include/grpc/slice.h - - include/grpc/slice_buffer.h - - include/grpc/status.h - - include/grpc/support/workaround_list.h - headers: - - src/core/lib/avl/avl.h - - src/core/lib/backoff/backoff.h - - src/core/lib/channel/channel_args.h - - src/core/lib/channel/channel_stack.h - - src/core/lib/channel/channel_stack_builder.h - - src/core/lib/channel/channel_trace.h - - src/core/lib/channel/channelz.h - - src/core/lib/channel/channelz_registry.h - - src/core/lib/channel/connected_channel.h - - src/core/lib/channel/context.h - - src/core/lib/channel/handshaker.h - - src/core/lib/channel/handshaker_factory.h - - src/core/lib/channel/handshaker_registry.h - - src/core/lib/channel/status_util.h - - src/core/lib/compression/algorithm_metadata.h - - src/core/lib/compression/compression_args.h - - src/core/lib/compression/compression_internal.h - - src/core/lib/compression/message_compress.h - - src/core/lib/compression/stream_compression.h - - src/core/lib/compression/stream_compression_gzip.h - - src/core/lib/compression/stream_compression_identity.h - - src/core/lib/debug/stats.h - - src/core/lib/debug/stats_data.h - - src/core/lib/gprpp/debug_location.h - - src/core/lib/gprpp/inlined_vector.h - - src/core/lib/gprpp/optional.h - - src/core/lib/gprpp/orphanable.h - - src/core/lib/gprpp/ref_counted.h - - src/core/lib/gprpp/ref_counted_ptr.h - - src/core/lib/gprpp/string_view.h - - src/core/lib/http/format_request.h - - src/core/lib/http/httpcli.h - - src/core/lib/http/parser.h - - src/core/lib/iomgr/block_annotate.h - - src/core/lib/iomgr/buffer_list.h - - src/core/lib/iomgr/call_combiner.h - - src/core/lib/iomgr/cfstream_handle.h - - src/core/lib/iomgr/closure.h - - src/core/lib/iomgr/combiner.h - - src/core/lib/iomgr/dynamic_annotations.h - - src/core/lib/iomgr/endpoint.h - - src/core/lib/iomgr/endpoint_cfstream.h - - src/core/lib/iomgr/endpoint_pair.h - - src/core/lib/iomgr/error.h - - src/core/lib/iomgr/error_cfstream.h - - src/core/lib/iomgr/error_internal.h - - src/core/lib/iomgr/ev_epoll1_linux.h - - src/core/lib/iomgr/ev_epollex_linux.h - - src/core/lib/iomgr/ev_poll_posix.h - - src/core/lib/iomgr/ev_posix.h - - src/core/lib/iomgr/exec_ctx.h - - src/core/lib/iomgr/executor.h - - src/core/lib/iomgr/executor/mpmcqueue.h - - src/core/lib/iomgr/executor/threadpool.h - - src/core/lib/iomgr/gethostname.h - - src/core/lib/iomgr/grpc_if_nametoindex.h - - src/core/lib/iomgr/internal_errqueue.h - - src/core/lib/iomgr/iocp_windows.h - - src/core/lib/iomgr/iomgr.h - - src/core/lib/iomgr/iomgr_custom.h - - src/core/lib/iomgr/iomgr_internal.h - - src/core/lib/iomgr/iomgr_posix.h - - src/core/lib/iomgr/is_epollexclusive_available.h - - src/core/lib/iomgr/load_file.h - - src/core/lib/iomgr/lockfree_event.h - - src/core/lib/iomgr/nameser.h - - src/core/lib/iomgr/polling_entity.h - - src/core/lib/iomgr/pollset.h - - src/core/lib/iomgr/pollset_custom.h - - src/core/lib/iomgr/pollset_set.h - - src/core/lib/iomgr/pollset_set_custom.h - - src/core/lib/iomgr/pollset_set_windows.h - - src/core/lib/iomgr/pollset_windows.h - - src/core/lib/iomgr/port.h - - src/core/lib/iomgr/resolve_address.h - - src/core/lib/iomgr/resolve_address_custom.h - - src/core/lib/iomgr/resource_quota.h - - src/core/lib/iomgr/sockaddr.h - - src/core/lib/iomgr/sockaddr_custom.h - - src/core/lib/iomgr/sockaddr_posix.h - - src/core/lib/iomgr/sockaddr_utils.h - - src/core/lib/iomgr/sockaddr_windows.h - - src/core/lib/iomgr/socket_factory_posix.h - - src/core/lib/iomgr/socket_mutator.h - - src/core/lib/iomgr/socket_utils.h - - src/core/lib/iomgr/socket_utils_posix.h - - src/core/lib/iomgr/socket_windows.h - - src/core/lib/iomgr/sys_epoll_wrapper.h - - src/core/lib/iomgr/tcp_client.h - - src/core/lib/iomgr/tcp_client_posix.h - - src/core/lib/iomgr/tcp_custom.h - - src/core/lib/iomgr/tcp_posix.h - - src/core/lib/iomgr/tcp_server.h - - src/core/lib/iomgr/tcp_server_utils_posix.h - - src/core/lib/iomgr/tcp_windows.h - - src/core/lib/iomgr/time_averaged_stats.h - - src/core/lib/iomgr/timer.h - - src/core/lib/iomgr/timer_custom.h - - src/core/lib/iomgr/timer_heap.h - - src/core/lib/iomgr/timer_manager.h - - src/core/lib/iomgr/udp_server.h - - src/core/lib/iomgr/unix_sockets_posix.h - - src/core/lib/iomgr/wakeup_fd_pipe.h - - src/core/lib/iomgr/wakeup_fd_posix.h - - src/core/lib/json/json.h - - src/core/lib/json/json_common.h - - src/core/lib/json/json_reader.h - - src/core/lib/json/json_writer.h - - src/core/lib/slice/b64.h - - src/core/lib/slice/percent_encoding.h - - src/core/lib/slice/slice_hash_table.h - - src/core/lib/slice/slice_internal.h - - src/core/lib/slice/slice_string_helpers.h - - src/core/lib/slice/slice_utils.h - - src/core/lib/slice/slice_weak_hash_table.h - - src/core/lib/surface/api_trace.h - - src/core/lib/surface/call.h - - src/core/lib/surface/call_test_only.h - - src/core/lib/surface/channel.h - - src/core/lib/surface/channel_init.h - - src/core/lib/surface/channel_stack_type.h - - src/core/lib/surface/completion_queue.h - - src/core/lib/surface/completion_queue_factory.h - - src/core/lib/surface/event_string.h - - src/core/lib/surface/init.h - - src/core/lib/surface/lame_client.h - - src/core/lib/surface/server.h - - src/core/lib/surface/validate_metadata.h - - src/core/lib/transport/bdp_estimator.h - - src/core/lib/transport/byte_stream.h - - src/core/lib/transport/connectivity_state.h - - src/core/lib/transport/error_utils.h - - src/core/lib/transport/http2_errors.h - - src/core/lib/transport/metadata.h - - src/core/lib/transport/metadata_batch.h - - src/core/lib/transport/pid_controller.h - - src/core/lib/transport/static_metadata.h - - src/core/lib/transport/status_conversion.h - - src/core/lib/transport/status_metadata.h - - src/core/lib/transport/timeout_encoding.h - - src/core/lib/transport/transport.h - - src/core/lib/transport/transport_impl.h - - src/core/lib/uri/uri_parser.h - deps: - - gpr - uses: - - grpc_codegen - - grpc_trace_headers -- name: grpc_client_authority_filter - headers: - - src/core/ext/filters/http/client_authority_filter.h - src: - - src/core/ext/filters/http/client_authority_filter.cc - plugin: grpc_client_authority_filter - uses: - - grpc_base -- name: grpc_client_channel - headers: - - src/core/ext/filters/client_channel/backup_poller.h - - src/core/ext/filters/client_channel/client_channel.h - - src/core/ext/filters/client_channel/client_channel_channelz.h - - src/core/ext/filters/client_channel/client_channel_factory.h - - src/core/ext/filters/client_channel/connector.h - - src/core/ext/filters/client_channel/global_subchannel_pool.h - - src/core/ext/filters/client_channel/health/health_check_client.h - - src/core/ext/filters/client_channel/http_connect_handshaker.h - - src/core/ext/filters/client_channel/http_proxy.h - - src/core/ext/filters/client_channel/lb_policy.h - - src/core/ext/filters/client_channel/lb_policy_factory.h - - src/core/ext/filters/client_channel/lb_policy_registry.h - - src/core/ext/filters/client_channel/local_subchannel_pool.h - - src/core/ext/filters/client_channel/parse_address.h - - src/core/ext/filters/client_channel/proxy_mapper.h - - src/core/ext/filters/client_channel/proxy_mapper_registry.h - - src/core/ext/filters/client_channel/resolver.h - - src/core/ext/filters/client_channel/resolver_factory.h - - src/core/ext/filters/client_channel/resolver_registry.h - - src/core/ext/filters/client_channel/resolver_result_parsing.h - - src/core/ext/filters/client_channel/resolving_lb_policy.h - - src/core/ext/filters/client_channel/retry_throttle.h - - src/core/ext/filters/client_channel/server_address.h - - src/core/ext/filters/client_channel/service_config.h - - src/core/ext/filters/client_channel/subchannel.h - - src/core/ext/filters/client_channel/subchannel_interface.h - - src/core/ext/filters/client_channel/subchannel_pool_interface.h - src: - - src/core/ext/filters/client_channel/backup_poller.cc - - src/core/ext/filters/client_channel/channel_connectivity.cc - - src/core/ext/filters/client_channel/client_channel.cc - - src/core/ext/filters/client_channel/client_channel_channelz.cc - - src/core/ext/filters/client_channel/client_channel_factory.cc - - src/core/ext/filters/client_channel/client_channel_plugin.cc - - src/core/ext/filters/client_channel/connector.cc - - src/core/ext/filters/client_channel/global_subchannel_pool.cc - - src/core/ext/filters/client_channel/health/health_check_client.cc - - src/core/ext/filters/client_channel/http_connect_handshaker.cc - - src/core/ext/filters/client_channel/http_proxy.cc - - src/core/ext/filters/client_channel/lb_policy.cc - - src/core/ext/filters/client_channel/lb_policy_registry.cc - - src/core/ext/filters/client_channel/local_subchannel_pool.cc - - src/core/ext/filters/client_channel/parse_address.cc - - src/core/ext/filters/client_channel/proxy_mapper.cc - - src/core/ext/filters/client_channel/proxy_mapper_registry.cc - - src/core/ext/filters/client_channel/resolver.cc - - src/core/ext/filters/client_channel/resolver_registry.cc - - src/core/ext/filters/client_channel/resolver_result_parsing.cc - - src/core/ext/filters/client_channel/resolving_lb_policy.cc - - src/core/ext/filters/client_channel/retry_throttle.cc - - src/core/ext/filters/client_channel/server_address.cc - - src/core/ext/filters/client_channel/service_config.cc - - src/core/ext/filters/client_channel/subchannel.cc - - src/core/ext/filters/client_channel/subchannel_pool_interface.cc - plugin: grpc_client_channel - uses: - - grpc_base - - grpc_deadline_filter - - grpc_health_upb -- name: grpc_client_idle_filter - src: - - src/core/ext/filters/client_idle/client_idle_filter.cc - plugin: grpc_client_idle_filter - uses: - - grpc_base -- name: grpc_codegen +- name: grpc++_codegen_base public_headers: - - include/grpc/impl/codegen/byte_buffer.h - - include/grpc/impl/codegen/byte_buffer_reader.h - - include/grpc/impl/codegen/compression_types.h - - include/grpc/impl/codegen/connectivity_state.h - - include/grpc/impl/codegen/grpc_types.h - - include/grpc/impl/codegen/propagation_bits.h - - include/grpc/impl/codegen/slice.h - - include/grpc/impl/codegen/status.h - uses: - - gpr_codegen -- name: grpc_deadline_filter - headers: - - src/core/ext/filters/deadline/deadline_filter.h - src: - - src/core/ext/filters/deadline/deadline_filter.cc - plugin: grpc_deadline_filter - uses: - - grpc_base -- name: grpc_health_upb - headers: - - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h - src: - - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c - uses: - - upb -- name: grpc_http_filters - headers: - - src/core/ext/filters/http/client/http_client_filter.h - - src/core/ext/filters/http/message_compress/message_compress_filter.h - - src/core/ext/filters/http/server/http_server_filter.h - src: - - src/core/ext/filters/http/client/http_client_filter.cc - - src/core/ext/filters/http/http_filters_plugin.cc - - src/core/ext/filters/http/message_compress/message_compress_filter.cc - - src/core/ext/filters/http/server/http_server_filter.cc - plugin: grpc_http_filters - uses: - - grpc_base -- name: grpc_lb_policy_grpclb - headers: - - src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h - - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h - - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h - - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h - - src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h - src: - - src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc - - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc - - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc - - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc - - src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc - plugin: grpc_lb_policy_grpclb - uses: - - grpc_base - - grpc_client_channel - - grpc_lb_upb - - grpc_resolver_fake - - upb -- name: grpc_lb_policy_grpclb_secure - headers: - - src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h - - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h - - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h - - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h - - src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h - src: - - src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc - - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc - - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc - - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc - - src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc - plugin: grpc_lb_policy_grpclb - uses: - - grpc_base - - grpc_client_channel - - grpc_lb_upb - - grpc_resolver_fake - - grpc_secure - - upb -- name: grpc_lb_policy_pick_first - src: - - src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc - plugin: grpc_lb_policy_pick_first - uses: - - grpc_base - - grpc_client_channel - - grpc_lb_subchannel_list -- name: grpc_lb_policy_round_robin - src: - - src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc - plugin: grpc_lb_policy_round_robin - uses: - - grpc_base - - grpc_client_channel - - grpc_lb_subchannel_list -- name: grpc_lb_policy_xds - headers: - - src/core/ext/filters/client_channel/lb_policy/xds/xds.h - - src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h - - src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h - - src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h - src: - - src/core/ext/filters/client_channel/lb_policy/xds/xds.cc - - src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc - - src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc - - src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc - plugin: grpc_lb_policy_xds - uses: - - envoy_ads_upb - - grpc_base - - grpc_client_channel - - grpc_resolver_fake -- name: grpc_lb_policy_xds_secure - headers: - - src/core/ext/filters/client_channel/lb_policy/xds/xds.h - - src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h - - src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h - - src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h - src: - - src/core/ext/filters/client_channel/lb_policy/xds/xds.cc - - src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc - - src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc - - src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc - plugin: grpc_lb_policy_xds - uses: - - envoy_ads_upb - - grpc_base - - grpc_client_channel - - grpc_resolver_fake - - grpc_secure -- name: grpc_lb_subchannel_list - headers: - - src/core/ext/filters/client_channel/lb_policy/subchannel_list.h - uses: - - grpc_base - - grpc_client_channel -- name: grpc_lb_upb - headers: - - src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h - src: - - src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c - uses: - - google_api_upb - - upb -- name: grpc_max_age_filter - headers: - - src/core/ext/filters/max_age/max_age_filter.h - src: - - src/core/ext/filters/max_age/max_age_filter.cc - plugin: grpc_max_age_filter - uses: - - grpc_base -- name: grpc_message_size_filter - headers: - - src/core/ext/filters/message_size/message_size_filter.h - src: - - src/core/ext/filters/message_size/message_size_filter.cc - plugin: grpc_message_size_filter + - include/grpc++/impl/codegen/async_stream.h + - include/grpc++/impl/codegen/async_unary_call.h + - include/grpc++/impl/codegen/byte_buffer.h + - include/grpc++/impl/codegen/call.h + - include/grpc++/impl/codegen/call_hook.h + - include/grpc++/impl/codegen/channel_interface.h + - include/grpc++/impl/codegen/client_context.h + - include/grpc++/impl/codegen/client_unary_call.h + - include/grpc++/impl/codegen/completion_queue.h + - include/grpc++/impl/codegen/completion_queue_tag.h + - include/grpc++/impl/codegen/config.h + - include/grpc++/impl/codegen/core_codegen_interface.h + - include/grpc++/impl/codegen/create_auth_context.h + - include/grpc++/impl/codegen/grpc_library.h + - include/grpc++/impl/codegen/metadata_map.h + - include/grpc++/impl/codegen/method_handler_impl.h + - include/grpc++/impl/codegen/rpc_method.h + - include/grpc++/impl/codegen/rpc_service_method.h + - include/grpc++/impl/codegen/security/auth_context.h + - include/grpc++/impl/codegen/serialization_traits.h + - include/grpc++/impl/codegen/server_context.h + - include/grpc++/impl/codegen/server_interface.h + - include/grpc++/impl/codegen/service_type.h + - include/grpc++/impl/codegen/slice.h + - include/grpc++/impl/codegen/status.h + - include/grpc++/impl/codegen/status_code_enum.h + - include/grpc++/impl/codegen/string_ref.h + - include/grpc++/impl/codegen/stub_options.h + - include/grpc++/impl/codegen/sync_stream.h + - include/grpc++/impl/codegen/time.h + - include/grpcpp/impl/codegen/async_generic_service.h + - include/grpcpp/impl/codegen/async_stream.h + - include/grpcpp/impl/codegen/async_stream_impl.h + - include/grpcpp/impl/codegen/async_unary_call.h + - include/grpcpp/impl/codegen/async_unary_call_impl.h + - include/grpcpp/impl/codegen/byte_buffer.h + - include/grpcpp/impl/codegen/call.h + - include/grpcpp/impl/codegen/call_hook.h + - include/grpcpp/impl/codegen/call_op_set.h + - include/grpcpp/impl/codegen/call_op_set_interface.h + - include/grpcpp/impl/codegen/callback_common.h + - include/grpcpp/impl/codegen/channel_interface.h + - include/grpcpp/impl/codegen/client_callback.h + - include/grpcpp/impl/codegen/client_callback_impl.h + - include/grpcpp/impl/codegen/client_context.h + - include/grpcpp/impl/codegen/client_context_impl.h + - include/grpcpp/impl/codegen/client_interceptor.h + - include/grpcpp/impl/codegen/client_unary_call.h + - include/grpcpp/impl/codegen/completion_queue.h + - include/grpcpp/impl/codegen/completion_queue_impl.h + - include/grpcpp/impl/codegen/completion_queue_tag.h + - include/grpcpp/impl/codegen/config.h + - include/grpcpp/impl/codegen/core_codegen_interface.h + - include/grpcpp/impl/codegen/create_auth_context.h + - include/grpcpp/impl/codegen/delegating_channel.h + - include/grpcpp/impl/codegen/grpc_library.h + - include/grpcpp/impl/codegen/intercepted_channel.h + - include/grpcpp/impl/codegen/interceptor.h + - include/grpcpp/impl/codegen/interceptor_common.h + - include/grpcpp/impl/codegen/message_allocator.h + - include/grpcpp/impl/codegen/metadata_map.h + - include/grpcpp/impl/codegen/method_handler_impl.h + - include/grpcpp/impl/codegen/rpc_method.h + - include/grpcpp/impl/codegen/rpc_service_method.h + - include/grpcpp/impl/codegen/security/auth_context.h + - include/grpcpp/impl/codegen/serialization_traits.h + - include/grpcpp/impl/codegen/server_callback.h + - include/grpcpp/impl/codegen/server_callback_impl.h + - include/grpcpp/impl/codegen/server_context.h + - include/grpcpp/impl/codegen/server_context_impl.h + - include/grpcpp/impl/codegen/server_interceptor.h + - include/grpcpp/impl/codegen/server_interface.h + - include/grpcpp/impl/codegen/service_type.h + - include/grpcpp/impl/codegen/slice.h + - include/grpcpp/impl/codegen/status.h + - include/grpcpp/impl/codegen/status_code_enum.h + - include/grpcpp/impl/codegen/string_ref.h + - include/grpcpp/impl/codegen/stub_options.h + - include/grpcpp/impl/codegen/sync_stream.h + - include/grpcpp/impl/codegen/sync_stream_impl.h + - include/grpcpp/impl/codegen/time.h uses: - - grpc_base -- name: grpc_resolver_dns_ares - headers: - - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h - - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h + - grpc_codegen + - grpc++_internal_hdrs_only +- name: grpc++_codegen_base_src src: - - src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc - - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc - - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc - - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc - - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc - - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc - - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc - - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc - - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc - - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc - plugin: grpc_resolver_dns_ares + - src/cpp/codegen/codegen_init.cc uses: - - grpc_base - - grpc_client_channel - - grpc_resolver_dns_selection -- name: grpc_resolver_dns_native - src: - - src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc - plugin: grpc_resolver_dns_native + - grpc++_codegen_base +- name: grpc++_codegen_proto + public_headers: + - include/grpc++/impl/codegen/proto_utils.h + - include/grpcpp/impl/codegen/proto_buffer_reader.h + - include/grpcpp/impl/codegen/proto_buffer_writer.h + - include/grpcpp/impl/codegen/proto_utils.h uses: - - grpc_base - - grpc_client_channel - - grpc_resolver_dns_selection -- name: grpc_resolver_dns_selection + - grpc++_codegen_base + - grpc++_config_proto +- name: grpc++_common + public_headers: + - include/grpc++/alarm.h + - include/grpc++/channel.h + - include/grpc++/client_context.h + - include/grpc++/completion_queue.h + - include/grpc++/create_channel.h + - include/grpc++/create_channel_posix.h + - include/grpc++/ext/health_check_service_server_builder_option.h + - include/grpc++/generic/async_generic_service.h + - include/grpc++/generic/generic_stub.h + - include/grpc++/grpc++.h + - include/grpc++/health_check_service_interface.h + - include/grpc++/impl/call.h + - include/grpc++/impl/channel_argument_option.h + - include/grpc++/impl/client_unary_call.h + - include/grpc++/impl/codegen/core_codegen.h + - include/grpc++/impl/grpc_library.h + - include/grpc++/impl/method_handler_impl.h + - include/grpc++/impl/rpc_method.h + - include/grpc++/impl/rpc_service_method.h + - include/grpc++/impl/serialization_traits.h + - include/grpc++/impl/server_builder_option.h + - include/grpc++/impl/server_builder_plugin.h + - include/grpc++/impl/server_initializer.h + - include/grpc++/impl/service_type.h + - include/grpc++/resource_quota.h + - include/grpc++/security/auth_context.h + - include/grpc++/security/auth_metadata_processor.h + - include/grpc++/security/credentials.h + - include/grpc++/security/server_credentials.h + - include/grpc++/server.h + - include/grpc++/server_builder.h + - include/grpc++/server_context.h + - include/grpc++/server_posix.h + - include/grpc++/support/async_stream.h + - include/grpc++/support/async_unary_call.h + - include/grpc++/support/byte_buffer.h + - include/grpc++/support/channel_arguments.h + - include/grpc++/support/config.h + - include/grpc++/support/slice.h + - include/grpc++/support/status.h + - include/grpc++/support/status_code_enum.h + - include/grpc++/support/string_ref.h + - include/grpc++/support/stub_options.h + - include/grpc++/support/sync_stream.h + - include/grpc++/support/time.h + - include/grpcpp/alarm.h + - include/grpcpp/alarm_impl.h + - include/grpcpp/channel.h + - include/grpcpp/channel_impl.h + - include/grpcpp/client_context.h + - include/grpcpp/completion_queue.h + - include/grpcpp/completion_queue_impl.h + - include/grpcpp/create_channel.h + - include/grpcpp/create_channel_impl.h + - include/grpcpp/create_channel_posix.h + - include/grpcpp/create_channel_posix_impl.h + - include/grpcpp/ext/health_check_service_server_builder_option.h + - include/grpcpp/generic/async_generic_service.h + - include/grpcpp/generic/generic_stub.h + - include/grpcpp/generic/generic_stub_impl.h + - include/grpcpp/grpcpp.h + - include/grpcpp/health_check_service_interface.h + - include/grpcpp/health_check_service_interface_impl.h + - include/grpcpp/impl/call.h + - include/grpcpp/impl/channel_argument_option.h + - include/grpcpp/impl/client_unary_call.h + - include/grpcpp/impl/codegen/core_codegen.h + - include/grpcpp/impl/grpc_library.h + - include/grpcpp/impl/method_handler_impl.h + - include/grpcpp/impl/rpc_method.h + - include/grpcpp/impl/rpc_service_method.h + - include/grpcpp/impl/serialization_traits.h + - include/grpcpp/impl/server_builder_option.h + - include/grpcpp/impl/server_builder_option_impl.h + - include/grpcpp/impl/server_builder_plugin.h + - include/grpcpp/impl/server_initializer.h + - include/grpcpp/impl/server_initializer_impl.h + - include/grpcpp/impl/service_type.h + - include/grpcpp/resource_quota.h + - include/grpcpp/resource_quota_impl.h + - include/grpcpp/security/auth_context.h + - include/grpcpp/security/auth_metadata_processor.h + - include/grpcpp/security/auth_metadata_processor_impl.h + - include/grpcpp/security/credentials.h + - include/grpcpp/security/credentials_impl.h + - include/grpcpp/security/server_credentials.h + - include/grpcpp/security/server_credentials_impl.h + - include/grpcpp/server.h + - include/grpcpp/server_builder.h + - include/grpcpp/server_builder_impl.h + - include/grpcpp/server_context.h + - include/grpcpp/server_impl.h + - include/grpcpp/server_posix.h + - include/grpcpp/server_posix_impl.h + - include/grpcpp/support/async_stream.h + - include/grpcpp/support/async_stream_impl.h + - include/grpcpp/support/async_unary_call.h + - include/grpcpp/support/async_unary_call_impl.h + - include/grpcpp/support/byte_buffer.h + - include/grpcpp/support/channel_arguments.h + - include/grpcpp/support/channel_arguments_impl.h + - include/grpcpp/support/client_callback.h + - include/grpcpp/support/client_callback_impl.h + - include/grpcpp/support/client_interceptor.h + - include/grpcpp/support/config.h + - include/grpcpp/support/interceptor.h + - include/grpcpp/support/message_allocator.h + - include/grpcpp/support/proto_buffer_reader.h + - include/grpcpp/support/proto_buffer_writer.h + - include/grpcpp/support/server_callback.h + - include/grpcpp/support/server_callback_impl.h + - include/grpcpp/support/server_interceptor.h + - include/grpcpp/support/slice.h + - include/grpcpp/support/status.h + - include/grpcpp/support/status_code_enum.h + - include/grpcpp/support/string_ref.h + - include/grpcpp/support/stub_options.h + - include/grpcpp/support/sync_stream.h + - include/grpcpp/support/sync_stream_impl.h + - include/grpcpp/support/time.h + - include/grpcpp/support/validate_service_config.h headers: - - src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h + - src/cpp/client/create_channel_internal.h + - src/cpp/common/channel_filter.h + - src/cpp/server/dynamic_thread_pool.h + - src/cpp/server/external_connection_acceptor_impl.h + - src/cpp/server/health/default_health_check_service.h + - src/cpp/server/thread_pool_interface.h + - src/cpp/thread_manager/thread_manager.h src: - - src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc + - src/cpp/client/channel_cc.cc + - src/cpp/client/client_context.cc + - src/cpp/client/client_interceptor.cc + - src/cpp/client/create_channel.cc + - src/cpp/client/create_channel_internal.cc + - src/cpp/client/create_channel_posix.cc + - src/cpp/client/credentials_cc.cc + - src/cpp/client/generic_stub.cc + - src/cpp/common/alarm.cc + - src/cpp/common/channel_arguments.cc + - src/cpp/common/channel_filter.cc + - src/cpp/common/completion_queue_cc.cc + - src/cpp/common/core_codegen.cc + - src/cpp/common/resource_quota_cc.cc + - src/cpp/common/rpc_method.cc + - src/cpp/common/validate_service_config.cc + - src/cpp/common/version_cc.cc + - src/cpp/server/async_generic_service.cc + - src/cpp/server/channel_argument_option.cc + - src/cpp/server/create_default_thread_pool.cc + - src/cpp/server/dynamic_thread_pool.cc + - src/cpp/server/external_connection_acceptor_impl.cc + - src/cpp/server/health/default_health_check_service.cc + - src/cpp/server/health/health_check_service.cc + - src/cpp/server/health/health_check_service_server_builder_option.cc + - src/cpp/server/server_builder.cc + - src/cpp/server/server_cc.cc + - src/cpp/server/server_context.cc + - src/cpp/server/server_credentials.cc + - src/cpp/server/server_posix.cc + - src/cpp/thread_manager/thread_manager.cc + - src/cpp/util/byte_buffer_cc.cc + - src/cpp/util/status.cc + - src/cpp/util/string_ref.cc + - src/cpp/util/time_cc.cc uses: - - grpc_base -- name: grpc_resolver_fake - headers: - - src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h + - gpr_base_headers + - grpc_base_headers + - grpc_health_upb + - grpc_transport_inproc_headers + - grpc++_codegen_base + - grpc++_internal_hdrs_only + - nanopb_headers +- name: grpc++_config_proto + public_headers: + - include/grpc++/impl/codegen/config_protobuf.h + - include/grpcpp/impl/codegen/config_protobuf.h +- name: grpc++_internal_hdrs_only + public_headers: + - include/grpcpp/impl/codegen/sync.h +- name: grpc++_reflection_proto src: - - src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc - plugin: grpc_resolver_fake - uses: - - grpc_base - - grpc_client_channel -- name: grpc_resolver_sockaddr + - src/proto/grpc/reflection/v1alpha/reflection.proto +- name: grpc++_test + public_headers: + - include/grpc++/test/mock_stream.h + - include/grpc++/test/server_context_test_spouse.h + - include/grpcpp/test/mock_stream.h + - include/grpcpp/test/server_context_test_spouse.h + deps: + - grpc++ + - grpc +- name: grpc_base src: - - src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc - plugin: grpc_resolver_sockaddr + - src/core/lib/avl/avl.cc + - src/core/lib/backoff/backoff.cc + - src/core/lib/channel/channel_args.cc + - src/core/lib/channel/channel_stack.cc + - src/core/lib/channel/channel_stack_builder.cc + - src/core/lib/channel/channel_trace.cc + - src/core/lib/channel/channelz.cc + - src/core/lib/channel/channelz_registry.cc + - src/core/lib/channel/connected_channel.cc + - src/core/lib/channel/handshaker.cc + - src/core/lib/channel/handshaker_registry.cc + - src/core/lib/channel/status_util.cc + - src/core/lib/compression/compression.cc + - src/core/lib/compression/compression_args.cc + - src/core/lib/compression/compression_internal.cc + - src/core/lib/compression/message_compress.cc + - src/core/lib/compression/stream_compression.cc + - src/core/lib/compression/stream_compression_gzip.cc + - src/core/lib/compression/stream_compression_identity.cc + - src/core/lib/debug/stats.cc + - src/core/lib/debug/stats_data.cc + - src/core/lib/http/format_request.cc + - src/core/lib/http/httpcli.cc + - src/core/lib/http/parser.cc + - src/core/lib/iomgr/buffer_list.cc + - src/core/lib/iomgr/call_combiner.cc + - src/core/lib/iomgr/cfstream_handle.cc + - src/core/lib/iomgr/combiner.cc + - src/core/lib/iomgr/endpoint.cc + - src/core/lib/iomgr/endpoint_cfstream.cc + - src/core/lib/iomgr/endpoint_pair_posix.cc + - src/core/lib/iomgr/endpoint_pair_uv.cc + - src/core/lib/iomgr/endpoint_pair_windows.cc + - src/core/lib/iomgr/error.cc + - src/core/lib/iomgr/error_cfstream.cc + - src/core/lib/iomgr/ev_epoll1_linux.cc + - src/core/lib/iomgr/ev_epollex_linux.cc + - src/core/lib/iomgr/ev_poll_posix.cc + - src/core/lib/iomgr/ev_posix.cc + - src/core/lib/iomgr/ev_windows.cc + - src/core/lib/iomgr/exec_ctx.cc + - src/core/lib/iomgr/executor.cc + - src/core/lib/iomgr/executor/mpmcqueue.cc + - src/core/lib/iomgr/executor/threadpool.cc + - src/core/lib/iomgr/fork_posix.cc + - src/core/lib/iomgr/fork_windows.cc + - src/core/lib/iomgr/gethostname_fallback.cc + - src/core/lib/iomgr/gethostname_host_name_max.cc + - src/core/lib/iomgr/gethostname_sysconf.cc + - src/core/lib/iomgr/grpc_if_nametoindex_posix.cc + - src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc + - src/core/lib/iomgr/internal_errqueue.cc + - src/core/lib/iomgr/iocp_windows.cc + - src/core/lib/iomgr/iomgr.cc + - src/core/lib/iomgr/iomgr_custom.cc + - src/core/lib/iomgr/iomgr_internal.cc + - src/core/lib/iomgr/iomgr_posix.cc + - src/core/lib/iomgr/iomgr_posix_cfstream.cc + - src/core/lib/iomgr/iomgr_uv.cc + - src/core/lib/iomgr/iomgr_windows.cc + - src/core/lib/iomgr/is_epollexclusive_available.cc + - src/core/lib/iomgr/load_file.cc + - src/core/lib/iomgr/lockfree_event.cc + - src/core/lib/iomgr/polling_entity.cc + - src/core/lib/iomgr/pollset.cc + - src/core/lib/iomgr/pollset_custom.cc + - src/core/lib/iomgr/pollset_set.cc + - src/core/lib/iomgr/pollset_set_custom.cc + - src/core/lib/iomgr/pollset_set_windows.cc + - src/core/lib/iomgr/pollset_uv.cc + - src/core/lib/iomgr/pollset_windows.cc + - src/core/lib/iomgr/resolve_address.cc + - src/core/lib/iomgr/resolve_address_custom.cc + - src/core/lib/iomgr/resolve_address_posix.cc + - src/core/lib/iomgr/resolve_address_windows.cc + - src/core/lib/iomgr/resource_quota.cc + - src/core/lib/iomgr/sockaddr_utils.cc + - src/core/lib/iomgr/socket_factory_posix.cc + - src/core/lib/iomgr/socket_mutator.cc + - src/core/lib/iomgr/socket_utils_common_posix.cc + - src/core/lib/iomgr/socket_utils_linux.cc + - src/core/lib/iomgr/socket_utils_posix.cc + - src/core/lib/iomgr/socket_utils_uv.cc + - src/core/lib/iomgr/socket_utils_windows.cc + - src/core/lib/iomgr/socket_windows.cc + - src/core/lib/iomgr/tcp_client.cc + - src/core/lib/iomgr/tcp_client_cfstream.cc + - src/core/lib/iomgr/tcp_client_custom.cc + - src/core/lib/iomgr/tcp_client_posix.cc + - src/core/lib/iomgr/tcp_client_windows.cc + - src/core/lib/iomgr/tcp_custom.cc + - src/core/lib/iomgr/tcp_posix.cc + - src/core/lib/iomgr/tcp_server.cc + - src/core/lib/iomgr/tcp_server_custom.cc + - src/core/lib/iomgr/tcp_server_posix.cc + - src/core/lib/iomgr/tcp_server_utils_posix_common.cc + - src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc + - src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc + - src/core/lib/iomgr/tcp_server_windows.cc + - src/core/lib/iomgr/tcp_uv.cc + - src/core/lib/iomgr/tcp_windows.cc + - src/core/lib/iomgr/time_averaged_stats.cc + - src/core/lib/iomgr/timer.cc + - src/core/lib/iomgr/timer_custom.cc + - src/core/lib/iomgr/timer_generic.cc + - src/core/lib/iomgr/timer_heap.cc + - src/core/lib/iomgr/timer_manager.cc + - src/core/lib/iomgr/timer_uv.cc + - src/core/lib/iomgr/udp_server.cc + - src/core/lib/iomgr/unix_sockets_posix.cc + - src/core/lib/iomgr/unix_sockets_posix_noop.cc + - src/core/lib/iomgr/wakeup_fd_eventfd.cc + - src/core/lib/iomgr/wakeup_fd_nospecial.cc + - src/core/lib/iomgr/wakeup_fd_pipe.cc + - src/core/lib/iomgr/wakeup_fd_posix.cc + - src/core/lib/json/json.cc + - src/core/lib/json/json_reader.cc + - src/core/lib/json/json_string.cc + - src/core/lib/json/json_writer.cc + - src/core/lib/slice/b64.cc + - src/core/lib/slice/percent_encoding.cc + - src/core/lib/slice/slice.cc + - src/core/lib/slice/slice_buffer.cc + - src/core/lib/slice/slice_intern.cc + - src/core/lib/slice/slice_string_helpers.cc + - src/core/lib/surface/api_trace.cc + - src/core/lib/surface/byte_buffer.cc + - src/core/lib/surface/byte_buffer_reader.cc + - src/core/lib/surface/call.cc + - src/core/lib/surface/call_details.cc + - src/core/lib/surface/call_log_batch.cc + - src/core/lib/surface/channel.cc + - src/core/lib/surface/channel_init.cc + - src/core/lib/surface/channel_ping.cc + - src/core/lib/surface/channel_stack_type.cc + - src/core/lib/surface/completion_queue.cc + - src/core/lib/surface/completion_queue_factory.cc + - src/core/lib/surface/event_string.cc + - src/core/lib/surface/lame_client.cc + - src/core/lib/surface/metadata_array.cc + - src/core/lib/surface/server.cc + - src/core/lib/surface/validate_metadata.cc + - src/core/lib/surface/version.cc + - src/core/lib/transport/bdp_estimator.cc + - src/core/lib/transport/byte_stream.cc + - src/core/lib/transport/connectivity_state.cc + - src/core/lib/transport/error_utils.cc + - src/core/lib/transport/metadata.cc + - src/core/lib/transport/metadata_batch.cc + - src/core/lib/transport/pid_controller.cc + - src/core/lib/transport/static_metadata.cc + - src/core/lib/transport/status_conversion.cc + - src/core/lib/transport/status_metadata.cc + - src/core/lib/transport/timeout_encoding.cc + - src/core/lib/transport/transport.cc + - src/core/lib/transport/transport_op_string.cc + - src/core/lib/uri/uri_parser.cc + deps: + - gpr uses: - - grpc_base - - grpc_client_channel -- name: grpc_secure + - grpc_codegen + - grpc_trace +- name: grpc_base_headers public_headers: - - include/grpc/grpc_security.h + - include/grpc/byte_buffer.h + - include/grpc/byte_buffer_reader.h + - include/grpc/compression.h + - include/grpc/fork.h + - include/grpc/grpc.h + - include/grpc/grpc_posix.h + - include/grpc/grpc_security_constants.h + - include/grpc/load_reporting.h + - include/grpc/slice.h + - include/grpc/slice_buffer.h + - include/grpc/status.h + - include/grpc/support/workaround_list.h headers: - - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h - - src/core/ext/filters/client_channel/lb_policy/xds/xds.h - - src/core/lib/security/context/security_context.h - - src/core/lib/security/credentials/alts/alts_credentials.h - - src/core/lib/security/credentials/composite/composite_credentials.h - - src/core/lib/security/credentials/credentials.h - - src/core/lib/security/credentials/fake/fake_credentials.h - - src/core/lib/security/credentials/google_default/google_default_credentials.h - - src/core/lib/security/credentials/iam/iam_credentials.h - - src/core/lib/security/credentials/jwt/json_token.h - - src/core/lib/security/credentials/jwt/jwt_credentials.h - - src/core/lib/security/credentials/jwt/jwt_verifier.h - - src/core/lib/security/credentials/local/local_credentials.h - - src/core/lib/security/credentials/oauth2/oauth2_credentials.h - - src/core/lib/security/credentials/plugin/plugin_credentials.h - - src/core/lib/security/credentials/ssl/ssl_credentials.h - - src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h - - src/core/lib/security/credentials/tls/spiffe_credentials.h - - src/core/lib/security/security_connector/alts/alts_security_connector.h - - src/core/lib/security/security_connector/fake/fake_security_connector.h - - src/core/lib/security/security_connector/load_system_roots.h - - src/core/lib/security/security_connector/load_system_roots_linux.h - - src/core/lib/security/security_connector/local/local_security_connector.h - - src/core/lib/security/security_connector/security_connector.h - - src/core/lib/security/security_connector/ssl/ssl_security_connector.h - - src/core/lib/security/security_connector/ssl_utils.h - - src/core/lib/security/security_connector/tls/spiffe_security_connector.h - - src/core/lib/security/transport/auth_filters.h - - src/core/lib/security/transport/secure_endpoint.h - - src/core/lib/security/transport/security_handshaker.h - - src/core/lib/security/transport/target_authority_table.h - - src/core/lib/security/transport/tsi_error.h - - src/core/lib/security/util/json_util.h - src: - - src/core/lib/http/httpcli_security_connector.cc - - src/core/lib/security/context/security_context.cc - - src/core/lib/security/credentials/alts/alts_credentials.cc - - src/core/lib/security/credentials/composite/composite_credentials.cc - - src/core/lib/security/credentials/credentials.cc - - src/core/lib/security/credentials/credentials_metadata.cc - - src/core/lib/security/credentials/fake/fake_credentials.cc - - src/core/lib/security/credentials/google_default/credentials_generic.cc - - src/core/lib/security/credentials/google_default/google_default_credentials.cc - - src/core/lib/security/credentials/iam/iam_credentials.cc - - src/core/lib/security/credentials/jwt/json_token.cc - - src/core/lib/security/credentials/jwt/jwt_credentials.cc - - src/core/lib/security/credentials/jwt/jwt_verifier.cc - - src/core/lib/security/credentials/local/local_credentials.cc - - src/core/lib/security/credentials/oauth2/oauth2_credentials.cc - - src/core/lib/security/credentials/plugin/plugin_credentials.cc - - src/core/lib/security/credentials/ssl/ssl_credentials.cc - - src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc - - src/core/lib/security/credentials/tls/spiffe_credentials.cc - - src/core/lib/security/security_connector/alts/alts_security_connector.cc - - src/core/lib/security/security_connector/fake/fake_security_connector.cc - - src/core/lib/security/security_connector/load_system_roots_fallback.cc - - src/core/lib/security/security_connector/load_system_roots_linux.cc - - src/core/lib/security/security_connector/local/local_security_connector.cc - - src/core/lib/security/security_connector/security_connector.cc - - src/core/lib/security/security_connector/ssl/ssl_security_connector.cc - - src/core/lib/security/security_connector/ssl_utils.cc - - src/core/lib/security/security_connector/tls/spiffe_security_connector.cc - - src/core/lib/security/transport/client_auth_filter.cc - - src/core/lib/security/transport/secure_endpoint.cc - - src/core/lib/security/transport/security_handshaker.cc - - src/core/lib/security/transport/server_auth_filter.cc - - src/core/lib/security/transport/target_authority_table.cc - - src/core/lib/security/transport/tsi_error.cc - - src/core/lib/security/util/json_util.cc - - src/core/lib/surface/init_secure.cc - secure: true + - src/core/lib/avl/avl.h + - src/core/lib/backoff/backoff.h + - src/core/lib/channel/channel_args.h + - src/core/lib/channel/channel_stack.h + - src/core/lib/channel/channel_stack_builder.h + - src/core/lib/channel/channel_trace.h + - src/core/lib/channel/channelz.h + - src/core/lib/channel/channelz_registry.h + - src/core/lib/channel/connected_channel.h + - src/core/lib/channel/context.h + - src/core/lib/channel/handshaker.h + - src/core/lib/channel/handshaker_factory.h + - src/core/lib/channel/handshaker_registry.h + - src/core/lib/channel/status_util.h + - src/core/lib/compression/algorithm_metadata.h + - src/core/lib/compression/compression_args.h + - src/core/lib/compression/compression_internal.h + - src/core/lib/compression/message_compress.h + - src/core/lib/compression/stream_compression.h + - src/core/lib/compression/stream_compression_gzip.h + - src/core/lib/compression/stream_compression_identity.h + - src/core/lib/debug/stats.h + - src/core/lib/debug/stats_data.h + - src/core/lib/gprpp/debug_location.h + - src/core/lib/gprpp/inlined_vector.h + - src/core/lib/gprpp/optional.h + - src/core/lib/gprpp/orphanable.h + - src/core/lib/gprpp/ref_counted.h + - src/core/lib/gprpp/ref_counted_ptr.h + - src/core/lib/gprpp/string_view.h + - src/core/lib/http/format_request.h + - src/core/lib/http/httpcli.h + - src/core/lib/http/parser.h + - src/core/lib/iomgr/block_annotate.h + - src/core/lib/iomgr/buffer_list.h + - src/core/lib/iomgr/call_combiner.h + - src/core/lib/iomgr/cfstream_handle.h + - src/core/lib/iomgr/closure.h + - src/core/lib/iomgr/combiner.h + - src/core/lib/iomgr/dynamic_annotations.h + - src/core/lib/iomgr/endpoint.h + - src/core/lib/iomgr/endpoint_cfstream.h + - src/core/lib/iomgr/endpoint_pair.h + - src/core/lib/iomgr/error.h + - src/core/lib/iomgr/error_cfstream.h + - src/core/lib/iomgr/error_internal.h + - src/core/lib/iomgr/ev_epoll1_linux.h + - src/core/lib/iomgr/ev_epollex_linux.h + - src/core/lib/iomgr/ev_poll_posix.h + - src/core/lib/iomgr/ev_posix.h + - src/core/lib/iomgr/exec_ctx.h + - src/core/lib/iomgr/executor.h + - src/core/lib/iomgr/executor/mpmcqueue.h + - src/core/lib/iomgr/executor/threadpool.h + - src/core/lib/iomgr/gethostname.h + - src/core/lib/iomgr/grpc_if_nametoindex.h + - src/core/lib/iomgr/internal_errqueue.h + - src/core/lib/iomgr/iocp_windows.h + - src/core/lib/iomgr/iomgr.h + - src/core/lib/iomgr/iomgr_custom.h + - src/core/lib/iomgr/iomgr_internal.h + - src/core/lib/iomgr/iomgr_posix.h + - src/core/lib/iomgr/is_epollexclusive_available.h + - src/core/lib/iomgr/load_file.h + - src/core/lib/iomgr/lockfree_event.h + - src/core/lib/iomgr/nameser.h + - src/core/lib/iomgr/polling_entity.h + - src/core/lib/iomgr/pollset.h + - src/core/lib/iomgr/pollset_custom.h + - src/core/lib/iomgr/pollset_set.h + - src/core/lib/iomgr/pollset_set_custom.h + - src/core/lib/iomgr/pollset_set_windows.h + - src/core/lib/iomgr/pollset_windows.h + - src/core/lib/iomgr/port.h + - src/core/lib/iomgr/resolve_address.h + - src/core/lib/iomgr/resolve_address_custom.h + - src/core/lib/iomgr/resource_quota.h + - src/core/lib/iomgr/sockaddr.h + - src/core/lib/iomgr/sockaddr_custom.h + - src/core/lib/iomgr/sockaddr_posix.h + - src/core/lib/iomgr/sockaddr_utils.h + - src/core/lib/iomgr/sockaddr_windows.h + - src/core/lib/iomgr/socket_factory_posix.h + - src/core/lib/iomgr/socket_mutator.h + - src/core/lib/iomgr/socket_utils.h + - src/core/lib/iomgr/socket_utils_posix.h + - src/core/lib/iomgr/socket_windows.h + - src/core/lib/iomgr/sys_epoll_wrapper.h + - src/core/lib/iomgr/tcp_client.h + - src/core/lib/iomgr/tcp_client_posix.h + - src/core/lib/iomgr/tcp_custom.h + - src/core/lib/iomgr/tcp_posix.h + - src/core/lib/iomgr/tcp_server.h + - src/core/lib/iomgr/tcp_server_utils_posix.h + - src/core/lib/iomgr/tcp_windows.h + - src/core/lib/iomgr/time_averaged_stats.h + - src/core/lib/iomgr/timer.h + - src/core/lib/iomgr/timer_custom.h + - src/core/lib/iomgr/timer_heap.h + - src/core/lib/iomgr/timer_manager.h + - src/core/lib/iomgr/udp_server.h + - src/core/lib/iomgr/unix_sockets_posix.h + - src/core/lib/iomgr/wakeup_fd_pipe.h + - src/core/lib/iomgr/wakeup_fd_posix.h + - src/core/lib/json/json.h + - src/core/lib/json/json_common.h + - src/core/lib/json/json_reader.h + - src/core/lib/json/json_writer.h + - src/core/lib/slice/b64.h + - src/core/lib/slice/percent_encoding.h + - src/core/lib/slice/slice_hash_table.h + - src/core/lib/slice/slice_internal.h + - src/core/lib/slice/slice_string_helpers.h + - src/core/lib/slice/slice_utils.h + - src/core/lib/slice/slice_weak_hash_table.h + - src/core/lib/surface/api_trace.h + - src/core/lib/surface/call.h + - src/core/lib/surface/call_test_only.h + - src/core/lib/surface/channel.h + - src/core/lib/surface/channel_init.h + - src/core/lib/surface/channel_stack_type.h + - src/core/lib/surface/completion_queue.h + - src/core/lib/surface/completion_queue_factory.h + - src/core/lib/surface/event_string.h + - src/core/lib/surface/init.h + - src/core/lib/surface/lame_client.h + - src/core/lib/surface/server.h + - src/core/lib/surface/validate_metadata.h + - src/core/lib/transport/bdp_estimator.h + - src/core/lib/transport/byte_stream.h + - src/core/lib/transport/connectivity_state.h + - src/core/lib/transport/error_utils.h + - src/core/lib/transport/http2_errors.h + - src/core/lib/transport/metadata.h + - src/core/lib/transport/metadata_batch.h + - src/core/lib/transport/pid_controller.h + - src/core/lib/transport/static_metadata.h + - src/core/lib/transport/status_conversion.h + - src/core/lib/transport/status_metadata.h + - src/core/lib/transport/timeout_encoding.h + - src/core/lib/transport/transport.h + - src/core/lib/transport/transport_impl.h + - src/core/lib/uri/uri_parser.h + deps: + - gpr uses: - - alts_tsi - - grpc_base - - grpc_transport_chttp2_alpn - - tsi - - grpc_shadow_boringssl -- name: grpc_server_backward_compatibility + - grpc_codegen + - grpc_trace_headers +- name: grpc_client_authority_filter headers: - - src/core/ext/filters/workarounds/workaround_utils.h + - src/core/ext/filters/http/client_authority_filter.h src: - - src/core/ext/filters/workarounds/workaround_utils.cc + - src/core/ext/filters/http/client_authority_filter.cc + plugin: grpc_client_authority_filter uses: - grpc_base -- name: grpc_shadow_boringssl - headers: - - src/core/tsi/grpc_shadow_boringssl.h -- name: grpc_test_util_base - build: test +- name: grpc_client_channel headers: - - src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h - - test/core/end2end/cq_verifier.h - - test/core/end2end/fixtures/http_proxy_fixture.h - - test/core/end2end/fixtures/local_util.h - - test/core/end2end/fixtures/proxy.h - - test/core/iomgr/endpoint_tests.h - - test/core/util/debugger_macros.h - - test/core/util/fuzzer_util.h - - test/core/util/grpc_profiler.h - - test/core/util/histogram.h - - test/core/util/memory_counters.h - - test/core/util/mock_endpoint.h - - test/core/util/parse_hexstring.h - - test/core/util/passthru_endpoint.h - - test/core/util/port.h - - test/core/util/port_server_client.h - - test/core/util/slice_splitter.h - - test/core/util/subprocess.h - - test/core/util/test_config.h - - test/core/util/test_lb_policies.h - - test/core/util/tracer_util.h - - test/core/util/trickle_endpoint.h + - src/core/ext/filters/client_channel/backup_poller.h + - src/core/ext/filters/client_channel/client_channel.h + - src/core/ext/filters/client_channel/client_channel_channelz.h + - src/core/ext/filters/client_channel/client_channel_factory.h + - src/core/ext/filters/client_channel/connector.h + - src/core/ext/filters/client_channel/global_subchannel_pool.h + - src/core/ext/filters/client_channel/health/health_check_client.h + - src/core/ext/filters/client_channel/http_connect_handshaker.h + - src/core/ext/filters/client_channel/http_proxy.h + - src/core/ext/filters/client_channel/lb_policy.h + - src/core/ext/filters/client_channel/lb_policy_factory.h + - src/core/ext/filters/client_channel/lb_policy_registry.h + - src/core/ext/filters/client_channel/local_subchannel_pool.h + - src/core/ext/filters/client_channel/parse_address.h + - src/core/ext/filters/client_channel/proxy_mapper.h + - src/core/ext/filters/client_channel/proxy_mapper_registry.h + - src/core/ext/filters/client_channel/resolver.h + - src/core/ext/filters/client_channel/resolver_factory.h + - src/core/ext/filters/client_channel/resolver_registry.h + - src/core/ext/filters/client_channel/resolver_result_parsing.h + - src/core/ext/filters/client_channel/resolving_lb_policy.h + - src/core/ext/filters/client_channel/retry_throttle.h + - src/core/ext/filters/client_channel/server_address.h + - src/core/ext/filters/client_channel/service_config.h + - src/core/ext/filters/client_channel/subchannel.h + - src/core/ext/filters/client_channel/subchannel_interface.h + - src/core/ext/filters/client_channel/subchannel_pool_interface.h src: - - src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc - - test/core/end2end/cq_verifier.cc - - test/core/end2end/fixtures/http_proxy_fixture.cc - - test/core/end2end/fixtures/local_util.cc - - test/core/end2end/fixtures/proxy.cc - - test/core/iomgr/endpoint_tests.cc - - test/core/util/debugger_macros.cc - - test/core/util/fuzzer_util.cc - - test/core/util/grpc_profiler.cc - - test/core/util/histogram.cc - - test/core/util/memory_counters.cc - - test/core/util/mock_endpoint.cc - - test/core/util/parse_hexstring.cc - - test/core/util/passthru_endpoint.cc - - test/core/util/port.cc - - test/core/util/port_isolated_runtime_environment.cc - - test/core/util/port_server_client.cc - - test/core/util/slice_splitter.cc - - test/core/util/subprocess_posix.cc - - test/core/util/subprocess_windows.cc - - test/core/util/test_config.cc - - test/core/util/test_lb_policies.cc - - test/core/util/tracer_util.cc - - test/core/util/trickle_endpoint.cc - deps: - - gpr + - src/core/ext/filters/client_channel/backup_poller.cc + - src/core/ext/filters/client_channel/channel_connectivity.cc + - src/core/ext/filters/client_channel/client_channel.cc + - src/core/ext/filters/client_channel/client_channel_channelz.cc + - src/core/ext/filters/client_channel/client_channel_factory.cc + - src/core/ext/filters/client_channel/client_channel_plugin.cc + - src/core/ext/filters/client_channel/connector.cc + - src/core/ext/filters/client_channel/global_subchannel_pool.cc + - src/core/ext/filters/client_channel/health/health_check_client.cc + - src/core/ext/filters/client_channel/http_connect_handshaker.cc + - src/core/ext/filters/client_channel/http_proxy.cc + - src/core/ext/filters/client_channel/lb_policy.cc + - src/core/ext/filters/client_channel/lb_policy_registry.cc + - src/core/ext/filters/client_channel/local_subchannel_pool.cc + - src/core/ext/filters/client_channel/parse_address.cc + - src/core/ext/filters/client_channel/proxy_mapper.cc + - src/core/ext/filters/client_channel/proxy_mapper_registry.cc + - src/core/ext/filters/client_channel/resolver.cc + - src/core/ext/filters/client_channel/resolver_registry.cc + - src/core/ext/filters/client_channel/resolver_result_parsing.cc + - src/core/ext/filters/client_channel/resolving_lb_policy.cc + - src/core/ext/filters/client_channel/retry_throttle.cc + - src/core/ext/filters/client_channel/server_address.cc + - src/core/ext/filters/client_channel/service_config.cc + - src/core/ext/filters/client_channel/subchannel.cc + - src/core/ext/filters/client_channel/subchannel_pool_interface.cc + plugin: grpc_client_channel uses: - - cmdline - grpc_base - - grpc_client_channel - - grpc_transport_chttp2 -- name: grpc_trace + - grpc_deadline_filter + - grpc_health_upb +- name: grpc_client_idle_filter src: - - src/core/lib/debug/trace.cc - deps: - - gpr - filegroups: - - grpc_trace_headers - - grpc_base_headers -- name: grpc_trace_headers - headers: - - src/core/lib/debug/trace.h - deps: - - gpr -- name: grpc_transport_chttp2 + - src/core/ext/filters/client_idle/client_idle_filter.cc + plugin: grpc_client_idle_filter + uses: + - grpc_base +- name: grpc_codegen + public_headers: + - include/grpc/impl/codegen/byte_buffer.h + - include/grpc/impl/codegen/byte_buffer_reader.h + - include/grpc/impl/codegen/compression_types.h + - include/grpc/impl/codegen/connectivity_state.h + - include/grpc/impl/codegen/grpc_types.h + - include/grpc/impl/codegen/propagation_bits.h + - include/grpc/impl/codegen/slice.h + - include/grpc/impl/codegen/status.h + uses: + - gpr_codegen +- name: grpc_deadline_filter headers: - - src/core/ext/transport/chttp2/transport/bin_decoder.h - - src/core/ext/transport/chttp2/transport/bin_encoder.h - - src/core/ext/transport/chttp2/transport/chttp2_transport.h - - src/core/ext/transport/chttp2/transport/context_list.h - - src/core/ext/transport/chttp2/transport/flow_control.h - - src/core/ext/transport/chttp2/transport/frame.h - - src/core/ext/transport/chttp2/transport/frame_data.h - - src/core/ext/transport/chttp2/transport/frame_goaway.h - - src/core/ext/transport/chttp2/transport/frame_ping.h - - src/core/ext/transport/chttp2/transport/frame_rst_stream.h - - src/core/ext/transport/chttp2/transport/frame_settings.h - - src/core/ext/transport/chttp2/transport/frame_window_update.h - - src/core/ext/transport/chttp2/transport/hpack_encoder.h - - src/core/ext/transport/chttp2/transport/hpack_parser.h - - src/core/ext/transport/chttp2/transport/hpack_table.h - - src/core/ext/transport/chttp2/transport/http2_settings.h - - src/core/ext/transport/chttp2/transport/huffsyms.h - - src/core/ext/transport/chttp2/transport/incoming_metadata.h - - src/core/ext/transport/chttp2/transport/internal.h - - src/core/ext/transport/chttp2/transport/stream_map.h - - src/core/ext/transport/chttp2/transport/varint.h + - src/core/ext/filters/deadline/deadline_filter.h src: - - src/core/ext/transport/chttp2/transport/bin_decoder.cc - - src/core/ext/transport/chttp2/transport/bin_encoder.cc - - src/core/ext/transport/chttp2/transport/chttp2_plugin.cc - - src/core/ext/transport/chttp2/transport/chttp2_transport.cc - - src/core/ext/transport/chttp2/transport/context_list.cc - - src/core/ext/transport/chttp2/transport/flow_control.cc - - src/core/ext/transport/chttp2/transport/frame_data.cc - - src/core/ext/transport/chttp2/transport/frame_goaway.cc - - src/core/ext/transport/chttp2/transport/frame_ping.cc - - src/core/ext/transport/chttp2/transport/frame_rst_stream.cc - - src/core/ext/transport/chttp2/transport/frame_settings.cc - - src/core/ext/transport/chttp2/transport/frame_window_update.cc - - src/core/ext/transport/chttp2/transport/hpack_encoder.cc - - src/core/ext/transport/chttp2/transport/hpack_parser.cc - - src/core/ext/transport/chttp2/transport/hpack_table.cc - - src/core/ext/transport/chttp2/transport/http2_settings.cc - - src/core/ext/transport/chttp2/transport/huffsyms.cc - - src/core/ext/transport/chttp2/transport/incoming_metadata.cc - - src/core/ext/transport/chttp2/transport/parsing.cc - - src/core/ext/transport/chttp2/transport/stream_lists.cc - - src/core/ext/transport/chttp2/transport/stream_map.cc - - src/core/ext/transport/chttp2/transport/varint.cc - - src/core/ext/transport/chttp2/transport/writing.cc - plugin: grpc_chttp2_plugin + - src/core/ext/filters/deadline/deadline_filter.cc + plugin: grpc_deadline_filter uses: - grpc_base - - grpc_transport_chttp2_alpn - - grpc_http_filters -- name: grpc_transport_chttp2_alpn +- name: grpc_health_upb headers: - - src/core/ext/transport/chttp2/alpn/alpn.h + - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h src: - - src/core/ext/transport/chttp2/alpn/alpn.cc - deps: - - gpr -- name: grpc_transport_chttp2_client_connector + - src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + uses: + - upb +- name: grpc_http_filters headers: - - src/core/ext/transport/chttp2/client/authority.h - - src/core/ext/transport/chttp2/client/chttp2_connector.h + - src/core/ext/filters/http/client/http_client_filter.h + - src/core/ext/filters/http/message_compress/message_compress_filter.h + - src/core/ext/filters/http/server/http_server_filter.h src: - - src/core/ext/transport/chttp2/client/authority.cc - - src/core/ext/transport/chttp2/client/chttp2_connector.cc + - src/core/ext/filters/http/client/http_client_filter.cc + - src/core/ext/filters/http/http_filters_plugin.cc + - src/core/ext/filters/http/message_compress/message_compress_filter.cc + - src/core/ext/filters/http/server/http_server_filter.cc + plugin: grpc_http_filters uses: - - grpc_transport_chttp2 - grpc_base - - grpc_client_channel -- name: grpc_transport_chttp2_client_insecure +- name: grpc_lb_policy_grpclb + headers: + - src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h + - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h + - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h + - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h + - src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h src: - - src/core/ext/transport/chttp2/client/insecure/channel_create.cc - - src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc + - src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc + - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc + - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc + - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc + - src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc + plugin: grpc_lb_policy_grpclb uses: - - grpc_transport_chttp2_client_connector - - grpc_transport_chttp2 - grpc_base - grpc_client_channel -- name: grpc_transport_chttp2_client_secure + - grpc_lb_upb + - grpc_resolver_fake + - upb +- name: grpc_lb_policy_grpclb_secure + headers: + - src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h + - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h + - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h + - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h + - src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h src: - - src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc + - src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc + - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc + - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc + - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc + - src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc + plugin: grpc_lb_policy_grpclb uses: - - grpc_transport_chttp2 - grpc_base - grpc_client_channel + - grpc_lb_upb + - grpc_resolver_fake - grpc_secure - - grpc_transport_chttp2_client_connector -- name: grpc_transport_chttp2_server - headers: - - src/core/ext/transport/chttp2/server/chttp2_server.h + - upb +- name: grpc_lb_policy_pick_first src: - - src/core/ext/transport/chttp2/server/chttp2_server.cc + - src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc + plugin: grpc_lb_policy_pick_first uses: - - grpc_transport_chttp2 - grpc_base -- name: grpc_transport_chttp2_server_insecure + - grpc_client_channel + - grpc_lb_subchannel_list +- name: grpc_lb_policy_round_robin src: - - src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc - - src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc + - src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc + plugin: grpc_lb_policy_round_robin uses: - - grpc_transport_chttp2 - grpc_base - - grpc_transport_chttp2_server -- name: grpc_transport_chttp2_server_secure + - grpc_client_channel + - grpc_lb_subchannel_list +- name: grpc_lb_policy_xds + headers: + - src/core/ext/filters/client_channel/lb_policy/xds/xds.h + - src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h + - src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h + - src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h src: - - src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc + - src/core/ext/filters/client_channel/lb_policy/xds/xds.cc + - src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc + - src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc + - src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc + plugin: grpc_lb_policy_xds uses: - - grpc_transport_chttp2 + - envoy_ads_upb - grpc_base - - grpc_secure - - grpc_transport_chttp2_server -- name: grpc_transport_cronet_client_secure - public_headers: - - include/grpc/grpc_cronet.h - - include/grpc/grpc_security.h - - include/grpc/grpc_security_constants.h + - grpc_client_channel + - grpc_resolver_fake +- name: grpc_lb_policy_xds_secure headers: - - src/core/ext/transport/cronet/client/secure/cronet_channel_create.h - - src/core/ext/transport/cronet/transport/cronet_transport.h - - third_party/objective_c/Cronet/bidirectional_stream_c.h + - src/core/ext/filters/client_channel/lb_policy/xds/xds.h + - src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h + - src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h + - src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h src: - - src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc - - src/core/ext/transport/cronet/transport/cronet_api_dummy.cc - - src/core/ext/transport/cronet/transport/cronet_transport.cc - filegroups: + - src/core/ext/filters/client_channel/lb_policy/xds/xds.cc + - src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc + - src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc + - src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc + plugin: grpc_lb_policy_xds + uses: + - envoy_ads_upb - grpc_base - - grpc_transport_chttp2 - - grpc_http_filters -- name: grpc_transport_inproc + - grpc_client_channel + - grpc_resolver_fake + - grpc_secure +- name: grpc_lb_subchannel_list + headers: + - src/core/ext/filters/client_channel/lb_policy/subchannel_list.h + uses: + - grpc_base + - grpc_client_channel +- name: grpc_lb_upb + headers: + - src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h src: - - src/core/ext/transport/inproc/inproc_plugin.cc - - src/core/ext/transport/inproc/inproc_transport.cc - plugin: grpc_inproc_plugin + - src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c + uses: + - google_api_upb + - upb +- name: grpc_max_age_filter + headers: + - src/core/ext/filters/max_age/max_age_filter.h + src: + - src/core/ext/filters/max_age/max_age_filter.cc + plugin: grpc_max_age_filter uses: - - grpc_transport_inproc_headers - grpc_base -- name: grpc_transport_inproc_headers +- name: grpc_message_size_filter headers: - - src/core/ext/transport/inproc/inproc_transport.h + - src/core/ext/filters/message_size/message_size_filter.h + src: + - src/core/ext/filters/message_size/message_size_filter.cc + plugin: grpc_message_size_filter uses: - - grpc_base_headers -- name: grpc_workaround_cronet_compression_filter + - grpc_base +- name: grpc_resolver_dns_ares headers: - - src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h + - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h + - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h src: - - src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc - plugin: grpc_workaround_cronet_compression_filter + - src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc + - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc + - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc + - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc + - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc + - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc + - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc + - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc + - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc + - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc + plugin: grpc_resolver_dns_ares uses: - grpc_base - - grpc_server_backward_compatibility -- name: nanopb + - grpc_client_channel + - grpc_resolver_dns_selection +- name: grpc_resolver_dns_native src: - - third_party/nanopb/pb_common.c - - third_party/nanopb/pb_decode.c - - third_party/nanopb/pb_encode.c + - src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc + plugin: grpc_resolver_dns_native uses: - - nanopb_headers -- name: nanopb_headers - headers: - - third_party/nanopb/pb.h - - third_party/nanopb/pb_common.h - - third_party/nanopb/pb_decode.h - - third_party/nanopb/pb_encode.h -- name: proto_gen_validate_upb + - grpc_base + - grpc_client_channel + - grpc_resolver_dns_selection +- name: grpc_resolver_dns_selection headers: - - src/core/ext/upb-generated/gogoproto/gogo.upb.h - - src/core/ext/upb-generated/validate/validate.upb.h + - src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h src: - - src/core/ext/upb-generated/gogoproto/gogo.upb.c - - src/core/ext/upb-generated/validate/validate.upb.c + - src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc uses: - - google_api_upb -- name: transport_security_test_lib - build: test - headers: - - test/core/tsi/transport_security_test_lib.h - src: - - test/core/tsi/transport_security_test_lib.cc - deps: - - grpc -- name: tsi + - grpc_base +- name: grpc_resolver_fake headers: - - src/core/tsi/fake_transport_security.h - - src/core/tsi/local_transport_security.h - - src/core/tsi/ssl/session_cache/ssl_session.h - - src/core/tsi/ssl/session_cache/ssl_session_cache.h - - src/core/tsi/ssl_transport_security.h - - src/core/tsi/ssl_types.h - - src/core/tsi/transport_security_grpc.h + - src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h src: - - src/core/tsi/fake_transport_security.cc - - src/core/tsi/local_transport_security.cc - - src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc - - src/core/tsi/ssl/session_cache/ssl_session_cache.cc - - src/core/tsi/ssl/session_cache/ssl_session_openssl.cc - - src/core/tsi/ssl_transport_security.cc - - src/core/tsi/transport_security_grpc.cc - deps: - - gpr - secure: true + - src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc + plugin: grpc_resolver_fake uses: - - tsi_interface - grpc_base - - grpc_trace - - grpc_shadow_boringssl -- name: tsi_interface - headers: - - src/core/tsi/transport_security.h - - src/core/tsi/transport_security_interface.h + - grpc_client_channel +- name: grpc_resolver_sockaddr src: - - src/core/tsi/transport_security.cc - deps: - - gpr - secure: true + - src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc + plugin: grpc_resolver_sockaddr uses: - - grpc_trace -- name: grpc++_codegen_base - language: c++ + - grpc_base + - grpc_client_channel +- name: grpc_secure public_headers: - - include/grpc++/impl/codegen/async_stream.h - - include/grpc++/impl/codegen/async_unary_call.h - - include/grpc++/impl/codegen/byte_buffer.h - - include/grpc++/impl/codegen/call.h - - include/grpc++/impl/codegen/call_hook.h - - include/grpc++/impl/codegen/channel_interface.h - - include/grpc++/impl/codegen/client_context.h - - include/grpc++/impl/codegen/client_unary_call.h - - include/grpc++/impl/codegen/completion_queue.h - - include/grpc++/impl/codegen/completion_queue_tag.h - - include/grpc++/impl/codegen/config.h - - include/grpc++/impl/codegen/core_codegen_interface.h - - include/grpc++/impl/codegen/create_auth_context.h - - include/grpc++/impl/codegen/grpc_library.h - - include/grpc++/impl/codegen/metadata_map.h - - include/grpc++/impl/codegen/method_handler_impl.h - - include/grpc++/impl/codegen/rpc_method.h - - include/grpc++/impl/codegen/rpc_service_method.h - - include/grpc++/impl/codegen/security/auth_context.h - - include/grpc++/impl/codegen/serialization_traits.h - - include/grpc++/impl/codegen/server_context.h - - include/grpc++/impl/codegen/server_interface.h - - include/grpc++/impl/codegen/service_type.h - - include/grpc++/impl/codegen/slice.h - - include/grpc++/impl/codegen/status.h - - include/grpc++/impl/codegen/status_code_enum.h - - include/grpc++/impl/codegen/string_ref.h - - include/grpc++/impl/codegen/stub_options.h - - include/grpc++/impl/codegen/sync_stream.h - - include/grpc++/impl/codegen/time.h - - include/grpcpp/impl/codegen/async_generic_service.h - - include/grpcpp/impl/codegen/async_stream.h - - include/grpcpp/impl/codegen/async_stream_impl.h - - include/grpcpp/impl/codegen/async_unary_call.h - - include/grpcpp/impl/codegen/async_unary_call_impl.h - - include/grpcpp/impl/codegen/byte_buffer.h - - include/grpcpp/impl/codegen/call.h - - include/grpcpp/impl/codegen/call_hook.h - - include/grpcpp/impl/codegen/call_op_set.h - - include/grpcpp/impl/codegen/call_op_set_interface.h - - include/grpcpp/impl/codegen/callback_common.h - - include/grpcpp/impl/codegen/channel_interface.h - - include/grpcpp/impl/codegen/client_callback.h - - include/grpcpp/impl/codegen/client_callback_impl.h - - include/grpcpp/impl/codegen/client_context.h - - include/grpcpp/impl/codegen/client_context_impl.h - - include/grpcpp/impl/codegen/client_interceptor.h - - include/grpcpp/impl/codegen/client_unary_call.h - - include/grpcpp/impl/codegen/completion_queue.h - - include/grpcpp/impl/codegen/completion_queue_impl.h - - include/grpcpp/impl/codegen/completion_queue_tag.h - - include/grpcpp/impl/codegen/config.h - - include/grpcpp/impl/codegen/core_codegen_interface.h - - include/grpcpp/impl/codegen/create_auth_context.h - - include/grpcpp/impl/codegen/delegating_channel.h - - include/grpcpp/impl/codegen/grpc_library.h - - include/grpcpp/impl/codegen/intercepted_channel.h - - include/grpcpp/impl/codegen/interceptor.h - - include/grpcpp/impl/codegen/interceptor_common.h - - include/grpcpp/impl/codegen/message_allocator.h - - include/grpcpp/impl/codegen/metadata_map.h - - include/grpcpp/impl/codegen/method_handler_impl.h - - include/grpcpp/impl/codegen/rpc_method.h - - include/grpcpp/impl/codegen/rpc_service_method.h - - include/grpcpp/impl/codegen/security/auth_context.h - - include/grpcpp/impl/codegen/serialization_traits.h - - include/grpcpp/impl/codegen/server_callback.h - - include/grpcpp/impl/codegen/server_callback_impl.h - - include/grpcpp/impl/codegen/server_context.h - - include/grpcpp/impl/codegen/server_context_impl.h - - include/grpcpp/impl/codegen/server_interceptor.h - - include/grpcpp/impl/codegen/server_interface.h - - include/grpcpp/impl/codegen/service_type.h - - include/grpcpp/impl/codegen/slice.h - - include/grpcpp/impl/codegen/status.h - - include/grpcpp/impl/codegen/status_code_enum.h - - include/grpcpp/impl/codegen/string_ref.h - - include/grpcpp/impl/codegen/stub_options.h - - include/grpcpp/impl/codegen/sync_stream.h - - include/grpcpp/impl/codegen/sync_stream_impl.h - - include/grpcpp/impl/codegen/time.h + - include/grpc/grpc_security.h + headers: + - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h + - src/core/ext/filters/client_channel/lb_policy/xds/xds.h + - src/core/lib/security/context/security_context.h + - src/core/lib/security/credentials/alts/alts_credentials.h + - src/core/lib/security/credentials/composite/composite_credentials.h + - src/core/lib/security/credentials/credentials.h + - src/core/lib/security/credentials/fake/fake_credentials.h + - src/core/lib/security/credentials/google_default/google_default_credentials.h + - src/core/lib/security/credentials/iam/iam_credentials.h + - src/core/lib/security/credentials/jwt/json_token.h + - src/core/lib/security/credentials/jwt/jwt_credentials.h + - src/core/lib/security/credentials/jwt/jwt_verifier.h + - src/core/lib/security/credentials/local/local_credentials.h + - src/core/lib/security/credentials/oauth2/oauth2_credentials.h + - src/core/lib/security/credentials/plugin/plugin_credentials.h + - src/core/lib/security/credentials/ssl/ssl_credentials.h + - src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h + - src/core/lib/security/credentials/tls/spiffe_credentials.h + - src/core/lib/security/security_connector/alts/alts_security_connector.h + - src/core/lib/security/security_connector/fake/fake_security_connector.h + - src/core/lib/security/security_connector/load_system_roots.h + - src/core/lib/security/security_connector/load_system_roots_linux.h + - src/core/lib/security/security_connector/local/local_security_connector.h + - src/core/lib/security/security_connector/security_connector.h + - src/core/lib/security/security_connector/ssl/ssl_security_connector.h + - src/core/lib/security/security_connector/ssl_utils.h + - src/core/lib/security/security_connector/tls/spiffe_security_connector.h + - src/core/lib/security/transport/auth_filters.h + - src/core/lib/security/transport/secure_endpoint.h + - src/core/lib/security/transport/security_handshaker.h + - src/core/lib/security/transport/target_authority_table.h + - src/core/lib/security/transport/tsi_error.h + - src/core/lib/security/util/json_util.h + src: + - src/core/lib/http/httpcli_security_connector.cc + - src/core/lib/security/context/security_context.cc + - src/core/lib/security/credentials/alts/alts_credentials.cc + - src/core/lib/security/credentials/composite/composite_credentials.cc + - src/core/lib/security/credentials/credentials.cc + - src/core/lib/security/credentials/credentials_metadata.cc + - src/core/lib/security/credentials/fake/fake_credentials.cc + - src/core/lib/security/credentials/google_default/credentials_generic.cc + - src/core/lib/security/credentials/google_default/google_default_credentials.cc + - src/core/lib/security/credentials/iam/iam_credentials.cc + - src/core/lib/security/credentials/jwt/json_token.cc + - src/core/lib/security/credentials/jwt/jwt_credentials.cc + - src/core/lib/security/credentials/jwt/jwt_verifier.cc + - src/core/lib/security/credentials/local/local_credentials.cc + - src/core/lib/security/credentials/oauth2/oauth2_credentials.cc + - src/core/lib/security/credentials/plugin/plugin_credentials.cc + - src/core/lib/security/credentials/ssl/ssl_credentials.cc + - src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc + - src/core/lib/security/credentials/tls/spiffe_credentials.cc + - src/core/lib/security/security_connector/alts/alts_security_connector.cc + - src/core/lib/security/security_connector/fake/fake_security_connector.cc + - src/core/lib/security/security_connector/load_system_roots_fallback.cc + - src/core/lib/security/security_connector/load_system_roots_linux.cc + - src/core/lib/security/security_connector/local/local_security_connector.cc + - src/core/lib/security/security_connector/security_connector.cc + - src/core/lib/security/security_connector/ssl/ssl_security_connector.cc + - src/core/lib/security/security_connector/ssl_utils.cc + - src/core/lib/security/security_connector/tls/spiffe_security_connector.cc + - src/core/lib/security/transport/client_auth_filter.cc + - src/core/lib/security/transport/secure_endpoint.cc + - src/core/lib/security/transport/security_handshaker.cc + - src/core/lib/security/transport/server_auth_filter.cc + - src/core/lib/security/transport/target_authority_table.cc + - src/core/lib/security/transport/tsi_error.cc + - src/core/lib/security/util/json_util.cc + - src/core/lib/surface/init_secure.cc uses: - - grpc_codegen - - grpc++_internal_hdrs_only -- name: grpc++_codegen_base_src - language: c++ + - alts_tsi + - grpc_base + - grpc_transport_chttp2_alpn + - tsi + - grpc_shadow_boringssl +- name: grpc_server_backward_compatibility + headers: + - src/core/ext/filters/workarounds/workaround_utils.h src: - - src/cpp/codegen/codegen_init.cc + - src/core/ext/filters/workarounds/workaround_utils.cc uses: - - grpc++_codegen_base -- name: grpc++_codegen_proto - language: c++ - public_headers: - - include/grpc++/impl/codegen/proto_utils.h - - include/grpcpp/impl/codegen/proto_buffer_reader.h - - include/grpcpp/impl/codegen/proto_buffer_writer.h - - include/grpcpp/impl/codegen/proto_utils.h + - grpc_base +- name: grpc_shadow_boringssl + headers: + - src/core/tsi/grpc_shadow_boringssl.h +- name: grpc_test_util_base + headers: + - src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h + - test/core/end2end/cq_verifier.h + - test/core/end2end/fixtures/http_proxy_fixture.h + - test/core/end2end/fixtures/local_util.h + - test/core/end2end/fixtures/proxy.h + - test/core/iomgr/endpoint_tests.h + - test/core/util/debugger_macros.h + - test/core/util/fuzzer_util.h + - test/core/util/grpc_profiler.h + - test/core/util/histogram.h + - test/core/util/memory_counters.h + - test/core/util/mock_endpoint.h + - test/core/util/parse_hexstring.h + - test/core/util/passthru_endpoint.h + - test/core/util/port.h + - test/core/util/port_server_client.h + - test/core/util/slice_splitter.h + - test/core/util/subprocess.h + - test/core/util/test_config.h + - test/core/util/test_lb_policies.h + - test/core/util/tracer_util.h + - test/core/util/trickle_endpoint.h + src: + - src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc + - test/core/end2end/cq_verifier.cc + - test/core/end2end/fixtures/http_proxy_fixture.cc + - test/core/end2end/fixtures/local_util.cc + - test/core/end2end/fixtures/proxy.cc + - test/core/iomgr/endpoint_tests.cc + - test/core/util/debugger_macros.cc + - test/core/util/fuzzer_util.cc + - test/core/util/grpc_profiler.cc + - test/core/util/histogram.cc + - test/core/util/memory_counters.cc + - test/core/util/mock_endpoint.cc + - test/core/util/parse_hexstring.cc + - test/core/util/passthru_endpoint.cc + - test/core/util/port.cc + - test/core/util/port_isolated_runtime_environment.cc + - test/core/util/port_server_client.cc + - test/core/util/slice_splitter.cc + - test/core/util/subprocess_posix.cc + - test/core/util/subprocess_windows.cc + - test/core/util/test_config.cc + - test/core/util/test_lb_policies.cc + - test/core/util/tracer_util.cc + - test/core/util/trickle_endpoint.cc + deps: + - gpr uses: - - grpc++_codegen_base - - grpc++_config_proto -- name: grpc++_common - language: c++ - public_headers: - - include/grpc++/alarm.h - - include/grpc++/channel.h - - include/grpc++/client_context.h - - include/grpc++/completion_queue.h - - include/grpc++/create_channel.h - - include/grpc++/create_channel_posix.h - - include/grpc++/ext/health_check_service_server_builder_option.h - - include/grpc++/generic/async_generic_service.h - - include/grpc++/generic/generic_stub.h - - include/grpc++/grpc++.h - - include/grpc++/health_check_service_interface.h - - include/grpc++/impl/call.h - - include/grpc++/impl/channel_argument_option.h - - include/grpc++/impl/client_unary_call.h - - include/grpc++/impl/codegen/core_codegen.h - - include/grpc++/impl/grpc_library.h - - include/grpc++/impl/method_handler_impl.h - - include/grpc++/impl/rpc_method.h - - include/grpc++/impl/rpc_service_method.h - - include/grpc++/impl/serialization_traits.h - - include/grpc++/impl/server_builder_option.h - - include/grpc++/impl/server_builder_plugin.h - - include/grpc++/impl/server_initializer.h - - include/grpc++/impl/service_type.h - - include/grpc++/resource_quota.h - - include/grpc++/security/auth_context.h - - include/grpc++/security/auth_metadata_processor.h - - include/grpc++/security/credentials.h - - include/grpc++/security/server_credentials.h - - include/grpc++/server.h - - include/grpc++/server_builder.h - - include/grpc++/server_context.h - - include/grpc++/server_posix.h - - include/grpc++/support/async_stream.h - - include/grpc++/support/async_unary_call.h - - include/grpc++/support/byte_buffer.h - - include/grpc++/support/channel_arguments.h - - include/grpc++/support/config.h - - include/grpc++/support/slice.h - - include/grpc++/support/status.h - - include/grpc++/support/status_code_enum.h - - include/grpc++/support/string_ref.h - - include/grpc++/support/stub_options.h - - include/grpc++/support/sync_stream.h - - include/grpc++/support/time.h - - include/grpcpp/alarm.h - - include/grpcpp/alarm_impl.h - - include/grpcpp/channel.h - - include/grpcpp/channel_impl.h - - include/grpcpp/client_context.h - - include/grpcpp/completion_queue.h - - include/grpcpp/completion_queue_impl.h - - include/grpcpp/create_channel.h - - include/grpcpp/create_channel_impl.h - - include/grpcpp/create_channel_posix.h - - include/grpcpp/create_channel_posix_impl.h - - include/grpcpp/ext/health_check_service_server_builder_option.h - - include/grpcpp/generic/async_generic_service.h - - include/grpcpp/generic/generic_stub.h - - include/grpcpp/generic/generic_stub_impl.h - - include/grpcpp/grpcpp.h - - include/grpcpp/health_check_service_interface.h - - include/grpcpp/health_check_service_interface_impl.h - - include/grpcpp/impl/call.h - - include/grpcpp/impl/channel_argument_option.h - - include/grpcpp/impl/client_unary_call.h - - include/grpcpp/impl/codegen/core_codegen.h - - include/grpcpp/impl/grpc_library.h - - include/grpcpp/impl/method_handler_impl.h - - include/grpcpp/impl/rpc_method.h - - include/grpcpp/impl/rpc_service_method.h - - include/grpcpp/impl/serialization_traits.h - - include/grpcpp/impl/server_builder_option.h - - include/grpcpp/impl/server_builder_option_impl.h - - include/grpcpp/impl/server_builder_plugin.h - - include/grpcpp/impl/server_initializer.h - - include/grpcpp/impl/server_initializer_impl.h - - include/grpcpp/impl/service_type.h - - include/grpcpp/resource_quota.h - - include/grpcpp/resource_quota_impl.h - - include/grpcpp/security/auth_context.h - - include/grpcpp/security/auth_metadata_processor.h - - include/grpcpp/security/auth_metadata_processor_impl.h - - include/grpcpp/security/credentials.h - - include/grpcpp/security/credentials_impl.h - - include/grpcpp/security/server_credentials.h - - include/grpcpp/security/server_credentials_impl.h - - include/grpcpp/server.h - - include/grpcpp/server_builder.h - - include/grpcpp/server_builder_impl.h - - include/grpcpp/server_context.h - - include/grpcpp/server_impl.h - - include/grpcpp/server_posix.h - - include/grpcpp/server_posix_impl.h - - include/grpcpp/support/async_stream.h - - include/grpcpp/support/async_stream_impl.h - - include/grpcpp/support/async_unary_call.h - - include/grpcpp/support/async_unary_call_impl.h - - include/grpcpp/support/byte_buffer.h - - include/grpcpp/support/channel_arguments.h - - include/grpcpp/support/channel_arguments_impl.h - - include/grpcpp/support/client_callback.h - - include/grpcpp/support/client_callback_impl.h - - include/grpcpp/support/client_interceptor.h - - include/grpcpp/support/config.h - - include/grpcpp/support/interceptor.h - - include/grpcpp/support/message_allocator.h - - include/grpcpp/support/proto_buffer_reader.h - - include/grpcpp/support/proto_buffer_writer.h - - include/grpcpp/support/server_callback.h - - include/grpcpp/support/server_callback_impl.h - - include/grpcpp/support/server_interceptor.h - - include/grpcpp/support/slice.h - - include/grpcpp/support/status.h - - include/grpcpp/support/status_code_enum.h - - include/grpcpp/support/string_ref.h - - include/grpcpp/support/stub_options.h - - include/grpcpp/support/sync_stream.h - - include/grpcpp/support/sync_stream_impl.h - - include/grpcpp/support/time.h - - include/grpcpp/support/validate_service_config.h + - cmdline + - grpc_base + - grpc_client_channel + - grpc_transport_chttp2 +- name: grpc_trace + src: + - src/core/lib/debug/trace.cc + deps: + - gpr +- name: grpc_trace_headers + headers: + - src/core/lib/debug/trace.h + deps: + - gpr +- name: grpc_transport_chttp2 + headers: + - src/core/ext/transport/chttp2/transport/bin_decoder.h + - src/core/ext/transport/chttp2/transport/bin_encoder.h + - src/core/ext/transport/chttp2/transport/chttp2_transport.h + - src/core/ext/transport/chttp2/transport/context_list.h + - src/core/ext/transport/chttp2/transport/flow_control.h + - src/core/ext/transport/chttp2/transport/frame.h + - src/core/ext/transport/chttp2/transport/frame_data.h + - src/core/ext/transport/chttp2/transport/frame_goaway.h + - src/core/ext/transport/chttp2/transport/frame_ping.h + - src/core/ext/transport/chttp2/transport/frame_rst_stream.h + - src/core/ext/transport/chttp2/transport/frame_settings.h + - src/core/ext/transport/chttp2/transport/frame_window_update.h + - src/core/ext/transport/chttp2/transport/hpack_encoder.h + - src/core/ext/transport/chttp2/transport/hpack_parser.h + - src/core/ext/transport/chttp2/transport/hpack_table.h + - src/core/ext/transport/chttp2/transport/http2_settings.h + - src/core/ext/transport/chttp2/transport/huffsyms.h + - src/core/ext/transport/chttp2/transport/incoming_metadata.h + - src/core/ext/transport/chttp2/transport/internal.h + - src/core/ext/transport/chttp2/transport/stream_map.h + - src/core/ext/transport/chttp2/transport/varint.h + src: + - src/core/ext/transport/chttp2/transport/bin_decoder.cc + - src/core/ext/transport/chttp2/transport/bin_encoder.cc + - src/core/ext/transport/chttp2/transport/chttp2_plugin.cc + - src/core/ext/transport/chttp2/transport/chttp2_transport.cc + - src/core/ext/transport/chttp2/transport/context_list.cc + - src/core/ext/transport/chttp2/transport/flow_control.cc + - src/core/ext/transport/chttp2/transport/frame_data.cc + - src/core/ext/transport/chttp2/transport/frame_goaway.cc + - src/core/ext/transport/chttp2/transport/frame_ping.cc + - src/core/ext/transport/chttp2/transport/frame_rst_stream.cc + - src/core/ext/transport/chttp2/transport/frame_settings.cc + - src/core/ext/transport/chttp2/transport/frame_window_update.cc + - src/core/ext/transport/chttp2/transport/hpack_encoder.cc + - src/core/ext/transport/chttp2/transport/hpack_parser.cc + - src/core/ext/transport/chttp2/transport/hpack_table.cc + - src/core/ext/transport/chttp2/transport/http2_settings.cc + - src/core/ext/transport/chttp2/transport/huffsyms.cc + - src/core/ext/transport/chttp2/transport/incoming_metadata.cc + - src/core/ext/transport/chttp2/transport/parsing.cc + - src/core/ext/transport/chttp2/transport/stream_lists.cc + - src/core/ext/transport/chttp2/transport/stream_map.cc + - src/core/ext/transport/chttp2/transport/varint.cc + - src/core/ext/transport/chttp2/transport/writing.cc + plugin: grpc_chttp2_plugin + uses: + - grpc_base + - grpc_transport_chttp2_alpn + - grpc_http_filters +- name: grpc_transport_chttp2_alpn headers: - - src/cpp/client/create_channel_internal.h - - src/cpp/common/channel_filter.h - - src/cpp/server/dynamic_thread_pool.h - - src/cpp/server/external_connection_acceptor_impl.h - - src/cpp/server/health/default_health_check_service.h - - src/cpp/server/thread_pool_interface.h - - src/cpp/thread_manager/thread_manager.h + - src/core/ext/transport/chttp2/alpn/alpn.h src: - - src/cpp/client/channel_cc.cc - - src/cpp/client/client_context.cc - - src/cpp/client/client_interceptor.cc - - src/cpp/client/create_channel.cc - - src/cpp/client/create_channel_internal.cc - - src/cpp/client/create_channel_posix.cc - - src/cpp/client/credentials_cc.cc - - src/cpp/client/generic_stub.cc - - src/cpp/common/alarm.cc - - src/cpp/common/channel_arguments.cc - - src/cpp/common/channel_filter.cc - - src/cpp/common/completion_queue_cc.cc - - src/cpp/common/core_codegen.cc - - src/cpp/common/resource_quota_cc.cc - - src/cpp/common/rpc_method.cc - - src/cpp/common/validate_service_config.cc - - src/cpp/common/version_cc.cc - - src/cpp/server/async_generic_service.cc - - src/cpp/server/channel_argument_option.cc - - src/cpp/server/create_default_thread_pool.cc - - src/cpp/server/dynamic_thread_pool.cc - - src/cpp/server/external_connection_acceptor_impl.cc - - src/cpp/server/health/default_health_check_service.cc - - src/cpp/server/health/health_check_service.cc - - src/cpp/server/health/health_check_service_server_builder_option.cc - - src/cpp/server/server_builder.cc - - src/cpp/server/server_cc.cc - - src/cpp/server/server_context.cc - - src/cpp/server/server_credentials.cc - - src/cpp/server/server_posix.cc - - src/cpp/thread_manager/thread_manager.cc - - src/cpp/util/byte_buffer_cc.cc - - src/cpp/util/status.cc - - src/cpp/util/string_ref.cc - - src/cpp/util/time_cc.cc + - src/core/ext/transport/chttp2/alpn/alpn.cc + deps: + - gpr +- name: grpc_transport_chttp2_client_connector + headers: + - src/core/ext/transport/chttp2/client/authority.h + - src/core/ext/transport/chttp2/client/chttp2_connector.h + src: + - src/core/ext/transport/chttp2/client/authority.cc + - src/core/ext/transport/chttp2/client/chttp2_connector.cc + uses: + - grpc_transport_chttp2 + - grpc_base + - grpc_client_channel +- name: grpc_transport_chttp2_client_insecure + src: + - src/core/ext/transport/chttp2/client/insecure/channel_create.cc + - src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc + uses: + - grpc_transport_chttp2_client_connector + - grpc_transport_chttp2 + - grpc_base + - grpc_client_channel +- name: grpc_transport_chttp2_client_secure + src: + - src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc + uses: + - grpc_transport_chttp2 + - grpc_base + - grpc_client_channel + - grpc_secure + - grpc_transport_chttp2_client_connector +- name: grpc_transport_chttp2_server + headers: + - src/core/ext/transport/chttp2/server/chttp2_server.h + src: + - src/core/ext/transport/chttp2/server/chttp2_server.cc + uses: + - grpc_transport_chttp2 + - grpc_base +- name: grpc_transport_chttp2_server_insecure + src: + - src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc + - src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc + uses: + - grpc_transport_chttp2 + - grpc_base + - grpc_transport_chttp2_server +- name: grpc_transport_chttp2_server_secure + src: + - src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc + uses: + - grpc_transport_chttp2 + - grpc_base + - grpc_secure + - grpc_transport_chttp2_server +- name: grpc_transport_cronet_client_secure + public_headers: + - include/grpc/grpc_cronet.h + - include/grpc/grpc_security.h + - include/grpc/grpc_security_constants.h + headers: + - src/core/ext/transport/cronet/client/secure/cronet_channel_create.h + - src/core/ext/transport/cronet/transport/cronet_transport.h + - third_party/objective_c/Cronet/bidirectional_stream_c.h + src: + - src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc + - src/core/ext/transport/cronet/transport/cronet_api_dummy.cc + - src/core/ext/transport/cronet/transport/cronet_transport.cc +- name: grpc_transport_inproc + src: + - src/core/ext/transport/inproc/inproc_plugin.cc + - src/core/ext/transport/inproc/inproc_transport.cc + plugin: grpc_inproc_plugin uses: - - gpr_base_headers - - grpc_base_headers - - grpc_health_upb - grpc_transport_inproc_headers - - grpc++_codegen_base - - grpc++_internal_hdrs_only + - grpc_base +- name: grpc_transport_inproc_headers + headers: + - src/core/ext/transport/inproc/inproc_transport.h + uses: + - grpc_base_headers +- name: grpc_workaround_cronet_compression_filter + headers: + - src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h + src: + - src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc + plugin: grpc_workaround_cronet_compression_filter + uses: + - grpc_base + - grpc_server_backward_compatibility +- name: grpcpp_channelz_proto + src: + - src/proto/grpc/channelz/channelz.proto +- name: nanopb + src: + - third_party/nanopb/pb_common.c + - third_party/nanopb/pb_decode.c + - third_party/nanopb/pb_encode.c + uses: - nanopb_headers -- name: grpc++_config_proto - language: c++ - public_headers: - - include/grpc++/impl/codegen/config_protobuf.h - - include/grpcpp/impl/codegen/config_protobuf.h -- name: grpc++_internal_hdrs_only - language: c++ - public_headers: - - include/grpcpp/impl/codegen/sync.h -- name: grpc++_reflection_proto - language: c++ +- name: nanopb_headers + headers: + - third_party/nanopb/pb.h + - third_party/nanopb/pb_common.h + - third_party/nanopb/pb_decode.h + - third_party/nanopb/pb_encode.h +- name: proto_gen_validate_upb + headers: + - src/core/ext/upb-generated/gogoproto/gogo.upb.h + - src/core/ext/upb-generated/validate/validate.upb.h src: - - src/proto/grpc/reflection/v1alpha/reflection.proto -- name: grpc++_test - language: c++ - public_headers: - - include/grpc++/test/mock_stream.h - - include/grpc++/test/server_context_test_spouse.h - - include/grpcpp/test/mock_stream.h - - include/grpcpp/test/server_context_test_spouse.h + - src/core/ext/upb-generated/gogoproto/gogo.upb.c + - src/core/ext/upb-generated/validate/validate.upb.c + uses: + - google_api_upb +- name: transport_security_test_lib + headers: + - test/core/tsi/transport_security_test_lib.h + src: + - test/core/tsi/transport_security_test_lib.cc deps: - - grpc++ - grpc -- name: grpcpp_channelz_proto - language: c++ +- name: tsi + headers: + - src/core/tsi/fake_transport_security.h + - src/core/tsi/local_transport_security.h + - src/core/tsi/ssl/session_cache/ssl_session.h + - src/core/tsi/ssl/session_cache/ssl_session_cache.h + - src/core/tsi/ssl_transport_security.h + - src/core/tsi/ssl_types.h + - src/core/tsi/transport_security_grpc.h src: - - src/proto/grpc/channelz/channelz.proto + - src/core/tsi/fake_transport_security.cc + - src/core/tsi/local_transport_security.cc + - src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc + - src/core/tsi/ssl/session_cache/ssl_session_cache.cc + - src/core/tsi/ssl/session_cache/ssl_session_openssl.cc + - src/core/tsi/ssl_transport_security.cc + - src/core/tsi/transport_security_grpc.cc + deps: + - gpr + uses: + - tsi_interface + - grpc_base + - grpc_trace + - grpc_shadow_boringssl +- name: tsi_interface + headers: + - src/core/tsi/transport_security.h + - src/core/tsi/transport_security_interface.h + src: + - src/core/tsi/transport_security.cc + deps: + - gpr + uses: + - grpc_trace libs: - name: address_sorting build: all @@ -4608,8 +4585,6 @@ targets: - gpr filegroups: - grpcpp_channelz_proto - uses: - - grpc++_test - name: channelz_registry_test gtest: true build: test @@ -4622,8 +4597,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test uses_polling: false - name: channelz_service_test gtest: true @@ -4654,8 +4627,6 @@ targets: - gpr filegroups: - grpcpp_channelz_proto - uses: - - grpc++_test - name: check_gcp_environment_linux_test build: test language: c++ @@ -5054,8 +5025,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test uses_polling: false - name: grpc_cpp_plugin build: protoc @@ -5146,8 +5115,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test - name: grpc_tool_test gtest: true build: test @@ -5222,8 +5189,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test - name: h2_ssl_session_reuse_test gtest: true build: test @@ -5237,8 +5202,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test - name: health_service_end2end_test gtest: true build: test @@ -5290,8 +5253,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test - name: inproc_sync_unary_ping_pong_test build: test language: c++ @@ -5390,8 +5351,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test uses_polling: false - name: message_allocator_end2end_test gtest: true @@ -5466,8 +5425,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test - name: orphanable_test gtest: true build: test @@ -5479,8 +5436,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test - name: port_sharing_end2end_test gtest: true build: test @@ -5649,8 +5604,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test - name: ref_counted_test gtest: true build: test @@ -5662,8 +5615,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test - name: retry_throttle_test gtest: true build: test @@ -5758,8 +5709,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test - name: server_crash_test gtest: true cpu_cost: 0.1 @@ -5855,8 +5804,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test - name: shutdown_test gtest: true build: test @@ -5978,8 +5925,6 @@ targets: - grpc++ - grpc - gpr - uses: - - grpc++_test - name: thread_manager_test build: test language: c++ diff --git a/src/benchmark/gen_build_yaml.py b/src/benchmark/gen_build_yaml.py index 4d9391a91f5..a1f777d6c2b 100755 --- a/src/benchmark/gen_build_yaml.py +++ b/src/benchmark/gen_build_yaml.py @@ -27,7 +27,7 @@ out['libs'] = [{ 'name': 'benchmark', 'build': 'private', 'language': 'c++', - 'secure': 'no', + 'secure': False, 'defaults': 'benchmark', 'src': sorted(glob.glob('third_party/benchmark/src/*.cc')), 'headers': sorted( diff --git a/src/boringssl/gen_build_yaml.py b/src/boringssl/gen_build_yaml.py index c25a4ed3c94..145cc67b0d1 100755 --- a/src/boringssl/gen_build_yaml.py +++ b/src/boringssl/gen_build_yaml.py @@ -61,7 +61,7 @@ class Grpc(object): 'name': 'boringssl', 'build': 'private', 'language': 'c', - 'secure': 'no', + 'secure': False, 'src': sorted( map_dir(f) for f in files['ssl'] + files['crypto'] @@ -79,7 +79,7 @@ class Grpc(object): 'name': 'boringssl_test_util', 'build': 'private', 'language': 'c++', - 'secure': 'no', + 'secure': False, 'boringssl': True, 'defaults': 'boringssl', 'src': [ @@ -93,7 +93,7 @@ class Grpc(object): 'name': 'boringssl_%s' % test, 'build': 'test', 'run': False, - 'secure': 'no', + 'secure': False, 'language': 'c++', 'src': sorted(map_dir(f) for f in files[test]), 'vs_proj_dir': 'test/boringssl', diff --git a/src/c-ares/gen_build_yaml.py b/src/c-ares/gen_build_yaml.py index 6e832edcea3..fe2ecb462c3 100755 --- a/src/c-ares/gen_build_yaml.py +++ b/src/c-ares/gen_build_yaml.py @@ -53,7 +53,7 @@ try: 'defaults': 'ares', 'build': 'private', 'language': 'c', - 'secure': 'no', + 'secure': False, 'src': [ "third_party/cares/cares/ares__close_sockets.c", "third_party/cares/cares/ares__get_hostent.c", diff --git a/src/objective-c/tests/run_one_test_bazel.sh b/src/objective-c/tests/run_one_test_bazel.sh index 8f920d955fd..09da7bfbd59 100755 --- a/src/objective-c/tests/run_one_test_bazel.sh +++ b/src/objective-c/tests/run_one_test_bazel.sh @@ -48,4 +48,4 @@ $INTEROP --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT -../../../tools/bazel run $SCHEME \ No newline at end of file +../../../tools/bazel run $SCHEME diff --git a/src/zlib/gen_build_yaml.py b/src/zlib/gen_build_yaml.py index d0912b9cb62..ee347e0b1f3 100755 --- a/src/zlib/gen_build_yaml.py +++ b/src/zlib/gen_build_yaml.py @@ -42,7 +42,7 @@ try: 'defaults': 'zlib', 'build': 'private', 'language': 'c', - 'secure': 'no', + 'secure': False, 'src': sorted(cmvar('ZLIB_SRCS')), 'headers': sorted(cmvar('ZLIB_PUBLIC_HDRS') + cmvar('ZLIB_PRIVATE_HDRS')), }] diff --git a/test/core/bad_client/gen_build_yaml.py b/test/core/bad_client/gen_build_yaml.py index e390db90e15..3224dfe3877 100755 --- a/test/core/bad_client/gen_build_yaml.py +++ b/test/core/bad_client/gen_build_yaml.py @@ -68,7 +68,7 @@ def main(): 'cpu_cost': BAD_CLIENT_TESTS[t].cpu_cost, 'build': 'test', 'language': 'c++', - 'secure': 'no', + 'secure': False, 'src': ['test/core/bad_client/tests/%s.cc' % t], 'vs_proj_dir': 'test', 'exclude_iomgrs': ['uv'], diff --git a/tools/buildgen/plugins/check_attrs.py b/tools/buildgen/plugins/check_attrs.py new file mode 100644 index 00000000000..0730f8a1bbb --- /dev/null +++ b/tools/buildgen/plugins/check_attrs.py @@ -0,0 +1,126 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Buildgen attribute validation plugin.""" + + +def anything(): + return lambda v: None + + +def one_of(values): + return lambda v: ('{0} is not in [{1}]'.format(v, values) if v not in values else None) + + +def subset_of(values): + return lambda v: ('{0} is not subset of [{1}]'.format(v, values) + if not all(e in values for e in v) else None) + + +VALID_ATTRIBUTE_KEYS_MAP = { + 'filegroup': { + 'deps': anything(), + 'headers': anything(), + 'plugin': anything(), + 'public_headers': anything(), + 'src': anything(), + 'uses': anything(), + }, + 'lib': { + 'baselib': anything(), + 'boringssl': one_of((True,)), + 'build_system': anything(), + 'build': anything(), + 'defaults': anything(), + 'deps_linkage': one_of(('static',)), + 'deps': anything(), + 'dll': one_of((True, 'only')), + 'filegroups': anything(), + 'generate_plugin_registry': anything(), + 'headers': anything(), + 'language': one_of(('c', 'c++', 'csharp')), + 'LDFLAGS': anything(), + 'platforms': subset_of(('linux', 'mac', 'posix', 'windows')), + 'public_headers': anything(), + 'secure': one_of(('check', True, False)), + 'src': anything(), + 'vs_proj_dir': anything(), + 'zlib': one_of((True,)), + }, + 'target': { + 'args': anything(), + 'benchmark': anything(), + 'boringssl': one_of((True,)), + 'build': anything(), + 'ci_platforms': anything(), + 'corpus_dirs': anything(), + 'cpu_cost': anything(), + 'defaults': anything(), + 'deps': anything(), + 'dict': anything(), + 'exclude_configs': anything(), + 'exclude_iomgrs': anything(), + 'excluded_poll_engines': anything(), + 'filegroups': anything(), + 'flaky': one_of((True, False)), + 'gtest': one_of((True, False)), + 'headers': anything(), + 'language': one_of(('c', 'c89', 'c++', 'csharp')), + 'maxlen': anything(), + 'platforms': subset_of(('linux', 'mac', 'posix', 'windows')), + 'run': one_of((True, False)), + 'secure': one_of(('check', True, False)), + 'src': anything(), + 'timeout_seconds': anything(), + 'uses_polling': anything(), + 'vs_proj_dir': anything(), + 'zlib': one_of((True,)), + }, +} + + +def check_attributes(entity, kind, errors): + attributes = VALID_ATTRIBUTE_KEYS_MAP[kind] + name = entity.get('name', anything()) + for key, value in entity.items(): + if key == 'name': + continue + validator = attributes.get(key) + if validator: + error = validator(value) + if error: + errors.append( + "{0}({1}) has an invalid value for '{2}': {3}".format( + name, kind, key, error)) + else: + errors.append("{0}({1}) has an invalid attribute '{2}'".format( + name, kind, key)) + + +def mako_plugin(dictionary): + """The exported plugin code for check_attr. + + This validates that filegroups, libs, and target can have only valid + attributes. This is mainly for preventing build.yaml from having + unnecessary and misleading attributes accidently. + """ + + errors = [] + for filegroup in dictionary.get('filegroups', {}): + check_attributes(filegroup, 'filegroup', errors) + for lib in dictionary.get('libs', {}): + check_attributes(lib, 'lib', errors) + for target in dictionary.get('targets', {}): + check_attributes(target, 'target', errors) + if errors: + raise Exception('\n'.join(errors)) From 1391c93a95cc8efeca80ecefe69697418dcb3354 Mon Sep 17 00:00:00 2001 From: Qiancheng Zhao Date: Fri, 16 Aug 2019 14:15:21 -0700 Subject: [PATCH 363/661] atomic client idle filter --- include/grpc/impl/codegen/grpc_types.h | 6 +- .../filters/client_idle/client_idle_filter.cc | 234 +++++++++++++++--- .../channel/minimal_stack_is_minimal_test.cc | 4 +- test/cpp/end2end/client_lb_end2end_test.cc | 4 +- 4 files changed, 210 insertions(+), 38 deletions(-) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 68ae3606e80..8108b853fca 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -169,11 +169,7 @@ typedef struct { #define GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS "grpc.max_connection_age_grace_ms" /** Timeout after the last RPC finishes on the client channel at which the * channel goes back into IDLE state. Int valued, milliseconds. INT_MAX means - * unlimited. */ -/** TODO(qianchengz): Currently the default value is INT_MAX, which means the - * client idle filter is disabled by default. After the client idle filter - * proves no perfomance issue, we will change the default value to a reasonable - * value. */ + * unlimited. The default value is 30 minutes and the min value is 1 second. */ #define GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS "grpc.client_idle_timeout_ms" /** Enable/disable support for per-message compression. Defaults to 1, unless GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0. */ diff --git a/src/core/ext/filters/client_idle/client_idle_filter.cc b/src/core/ext/filters/client_idle/client_idle_filter.cc index d2b23a9d20f..13c35ae3730 100644 --- a/src/core/ext/filters/client_idle/client_idle_filter.cc +++ b/src/core/ext/filters/client_idle/client_idle_filter.cc @@ -27,12 +27,12 @@ #include "src/core/lib/surface/channel_init.h" #include "src/core/lib/transport/http2_errors.h" -// The idle filter is disabled in client channel by default. -// To enable the idle filte, set GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS to [0, INT_MAX) -// in channel args. -// TODO(qianchengz): Find a reasonable default value. Maybe check what deault -// value Java uses. -#define DEFAULT_IDLE_TIMEOUT_MS INT_MAX +// The idle filter is enabled in client channel by default. +// Set GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS to [1000, INT_MAX) in channel args to +// configure the idle timeout. +#define DEFAULT_IDLE_TIMEOUT_MS (30 /*minutes*/ * 60 * 1000) +// The user input idle timeout smaller than this would be capped to it. +#define MIN_IDLE_TIMEOUT_MS (1 /*second*/ * 1000) namespace grpc_core { @@ -47,10 +47,82 @@ TraceFlag grpc_trace_client_idle_filter(false, "client_idle_filter"); namespace { +/* + client_idle_filter maintains a state tracking if there are active calls in the + channel and its internal idle_timer_. The states are specified as following: + + +--------------------------------------------+-------------+---------+ + | ChannelState | idle_timer_ | channel | + +--------------------------------------------+-------------+---------+ + | IDLE | unset | idle | + | CALLS_ACTIVE | unset | busy | + | TIMER_PENDING | set-valid | idle | + | TIMER_PENDING_CALLS_ACTIVE | set-invalid | busy | + | TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START | set-invalid | idle | + +--------------------------------------------+-------------+---------+ + + IDLE: The initial state of the client_idle_filter, indicating the channel is + in IDLE. + + CALLS_ACTIVE: The channel has 1 or 1+ active calls and the timer is not set. + + TIMER_PENDING: The state after the timer is set and no calls have arrived + after the timer is set. The channel must have 0 active call in this state. If + the timer is fired in this state, the channel will go into IDLE state. + + TIMER_PENDING_CALLS_ACTIVE: The state after the timer is set and at least one + call has arrived after the timer is set. The channel must have 1 or 1+ active + calls in this state. If the timer is fired in this state, we won't reschedule + it. + + TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START: The state after the timer is set + and at least one call has arrived after the timer is set, BUT the channel + currently has 0 active call. If the timer is fired in this state, we will + reschedule it according to the finish time of the latest call. + + PROCESSING: The state set to block other threads when the setting thread is + doing some work to keep state consistency. + + idle_timer_ will not be cancelled (unless the channel is shutting down). + If the timer callback is called when the idle_timer_ is valid (i.e. idle_state + is TIMER_PENDING), the channel will enter IDLE, otherwise the channel won't be + changed. + + State transitions: + IDLE + | ^ + --------------------------------- * + | * + v * + CALLS_ACTIVE =================> TIMER_PENDING + ^ | ^ + * ------------------------------ * + * | * + * v * +TIMER_PENDING_CALLS_ACTIVE ===> TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START + ^ | + | | + --------------------------------- + + ---> Triggered by IncreaseCallCount() + ===> Triggered by DecreaseCallCount() + ***> Triggered by IdleTimerCallback() +*/ +enum ChannelState { + IDLE, + CALLS_ACTIVE, + TIMER_PENDING, + TIMER_PENDING_CALLS_ACTIVE, + TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START, + PROCESSING +}; + grpc_millis GetClientIdleTimeout(const grpc_channel_args* args) { - return grpc_channel_arg_get_integer( - grpc_channel_args_find(args, GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS), - {DEFAULT_IDLE_TIMEOUT_MS, 0, INT_MAX}); + return GPR_MAX( + grpc_channel_arg_get_integer( + grpc_channel_args_find(args, GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS), + {DEFAULT_IDLE_TIMEOUT_MS, 0, INT_MAX}), + MIN_IDLE_TIMEOUT_MS); } class ChannelData { @@ -86,8 +158,9 @@ class ChannelData { const grpc_millis client_idle_timeout_; // Member data used to track the state of channel. - Mutex call_count_mu_; - size_t call_count_; + grpc_millis last_idle_time_; + Atomic call_count_{0}; + Atomic state_{IDLE}; // Idle timer and its callback closure. grpc_timer idle_timer_; @@ -115,37 +188,105 @@ void ChannelData::StartTransportOp(grpc_channel_element* elem, ChannelData* chand = static_cast(elem->channel_data); // Catch the disconnect_with_error transport op. if (op->disconnect_with_error != nullptr) { - // Disconnect. Cancel the timer if we set it before. - // IncreaseCallCount() introduces a dummy call. It will cancel the timer and - // prevent the timer from being reset by other threads. + // IncreaseCallCount() introduces a dummy call and prevent the timer from + // being reset by other threads. chand->IncreaseCallCount(); + // If the timer has been set, cancel the timer. + // No synchronization issues here. grpc_timer_cancel() is valid as long as + // the timer has been init()ed before. + grpc_timer_cancel(&chand->idle_timer_); } // Pass the op to the next filter. grpc_channel_next_op(elem, op); } void ChannelData::IncreaseCallCount() { - MutexLock lock(&call_count_mu_); - if (call_count_++ == 0) { - grpc_timer_cancel(&idle_timer_); + const intptr_t previous_value = call_count_.FetchAdd(1, MemoryOrder::RELAXED); + GRPC_IDLE_FILTER_LOG("call counter has increased to %" PRIuPTR, + previous_value + 1); + if (previous_value == 0) { + // This call is the one that makes the channel busy. + // Loop here to make sure the previous decrease operation has finished. + ChannelState state = state_.Load(MemoryOrder::RELAXED); + while (true) { + switch (state) { + // Timer has not been set. Switch to CALLS_ACTIVE. + case IDLE: + // In this case, no other threads will modify the state, so we can + // just store the value. + state_.Store(CALLS_ACTIVE, MemoryOrder::RELAXED); + return; + // Timer has been set. Switch to TIMER_PENDING_CALLS_ACTIVE. + case TIMER_PENDING: + case TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START: + // At this point, the state may have been switched to IDLE by the + // idle timer callback. Therefore, use CAS operation to change the + // state atomically. + // Use MemoryOrder::ACQUIRE on success to ensure last_idle_time_ has + // been properly set in DecreaseCallCount(). + if (state_.CompareExchangeWeak(&state, TIMER_PENDING_CALLS_ACTIVE, + MemoryOrder::ACQUIRE, + MemoryOrder::RELAXED)) { + return; + } + break; + default: + // The state has not been switched to desired value yet, try again. + state = state_.Load(MemoryOrder::RELAXED); + break; + } + } } - GRPC_IDLE_FILTER_LOG("call counter has increased to %" PRIuPTR, call_count_); } void ChannelData::DecreaseCallCount() { - MutexLock lock(&call_count_mu_); - if (call_count_-- == 1) { - StartIdleTimer(); + const intptr_t previous_value = call_count_.FetchSub(1, MemoryOrder::RELAXED); + GRPC_IDLE_FILTER_LOG("call counter has decreased to %" PRIuPTR, + previous_value - 1); + if (previous_value == 1) { + // This call is the one that makes the channel idle. + // last_idle_time_ does not need to be Atomic<> because busy-loops in + // IncreaseCallCount(), DecreaseCallCount() and IdleTimerCallback() will + // prevent multiple threads from simultaneously accessing this variable. + last_idle_time_ = ExecCtx::Get()->Now(); + ChannelState state = state_.Load(MemoryOrder::RELAXED); + while (true) { + switch (state) { + // Timer has not been set. Set the timer and switch to TIMER_PENDING + case CALLS_ACTIVE: + // Release store here to make other threads see the updated value of + // last_idle_time_. + StartIdleTimer(); + state_.Store(TIMER_PENDING, MemoryOrder::RELEASE); + return; + // Timer has been set. Switch to + // TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START + case TIMER_PENDING_CALLS_ACTIVE: + // At this point, the state may have been switched to CALLS_ACTIVE by + // the idle timer callback. Therefore, use CAS operation to change the + // state atomically. + // Release store here to make the idle timer callback see the updated + // value of last_idle_time_ to properly reset the idle timer. + if (state_.CompareExchangeWeak( + &state, TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START, + MemoryOrder::RELEASE, MemoryOrder::RELAXED)) { + return; + } + break; + default: + // The state has not been switched to desired value yet, try again. + state = state_.Load(MemoryOrder::RELAXED); + break; + } + } } - GRPC_IDLE_FILTER_LOG("call counter has decreased to %" PRIuPTR, call_count_); } ChannelData::ChannelData(grpc_channel_element* elem, grpc_channel_element_args* args, grpc_error** error) : elem_(elem), channel_stack_(args->channel_stack), - client_idle_timeout_(GetClientIdleTimeout(args->channel_args)), - call_count_(0) { + client_idle_timeout_(GetClientIdleTimeout(args->channel_args)) { // If the idle filter is explicitly disabled in channel args, this ctor should // not get called. GPR_ASSERT(client_idle_timeout_ != GRPC_MILLIS_INF_FUTURE); @@ -165,10 +306,45 @@ ChannelData::ChannelData(grpc_channel_element* elem, void ChannelData::IdleTimerCallback(void* arg, grpc_error* error) { GRPC_IDLE_FILTER_LOG("timer alarms"); ChannelData* chand = static_cast(arg); - { - MutexLock lock(&chand->call_count_mu_); - if (error == GRPC_ERROR_NONE && chand->call_count_ == 0) { - chand->EnterIdle(); + if (error != GRPC_ERROR_NONE) { + GRPC_IDLE_FILTER_LOG("timer canceled"); + GRPC_CHANNEL_STACK_UNREF(chand->channel_stack_, "max idle timer callback"); + return; + } + bool finished = false; + ChannelState state = chand->state_.Load(MemoryOrder::RELAXED); + while (!finished) { + switch (state) { + case TIMER_PENDING: + // Change the state to PROCESSING to block IncreaseCallCout() until the + // EnterIdle() operation finishes, preventing mistakenly entering IDLE + // when active RPC exists. + finished = chand->state_.CompareExchangeWeak( + &state, PROCESSING, MemoryOrder::RELAXED, MemoryOrder::RELAXED); + if (finished) { + chand->EnterIdle(); + chand->state_.Store(IDLE, MemoryOrder::RELAXED); + } + break; + case TIMER_PENDING_CALLS_ACTIVE: + finished = chand->state_.CompareExchangeWeak( + &state, CALLS_ACTIVE, MemoryOrder::RELAXED, MemoryOrder::RELAXED); + break; + case TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START: + // Change the state to PROCESSING to block IncreaseCallCount() until the + // StartIdleTimer() operation finishes, preventing mistakenly restarting + // the timer after grpc_timer_cancel() when shutdown. + finished = chand->state_.CompareExchangeWeak( + &state, PROCESSING, MemoryOrder::ACQUIRE, MemoryOrder::RELAXED); + if (finished) { + chand->StartIdleTimer(); + chand->state_.Store(TIMER_PENDING, MemoryOrder::RELAXED); + } + break; + default: + // The state has not been switched to desired value yet, try again. + state = chand->state_.Load(MemoryOrder::RELAXED); + break; } } GRPC_IDLE_FILTER_LOG("timer finishes"); @@ -185,7 +361,7 @@ void ChannelData::StartIdleTimer() { GRPC_IDLE_FILTER_LOG("timer has started"); // Hold a ref to the channel stack for the timer callback. GRPC_CHANNEL_STACK_REF(channel_stack_, "max idle timer callback"); - grpc_timer_init(&idle_timer_, ExecCtx::Get()->Now() + client_idle_timeout_, + grpc_timer_init(&idle_timer_, last_idle_time_ + client_idle_timeout_, &idle_timer_callback_); } diff --git a/test/core/channel/minimal_stack_is_minimal_test.cc b/test/core/channel/minimal_stack_is_minimal_test.cc index bee0bfb41f2..3ca1992195b 100644 --- a/test/core/channel/minimal_stack_is_minimal_test.cc +++ b/test/core/channel/minimal_stack_is_minimal_test.cc @@ -100,8 +100,8 @@ int main(int argc, char** argv) { errors += CHECK_STACK("chttp2", nullptr, GRPC_SERVER_CHANNEL, "server", "message_size", "deadline", "http-server", "message_compress", "connected", NULL); - errors += CHECK_STACK(nullptr, nullptr, GRPC_CLIENT_CHANNEL, "client-channel", - NULL); + errors += CHECK_STACK(nullptr, nullptr, GRPC_CLIENT_CHANNEL, + "client_idle, client-channel", NULL); GPR_ASSERT(errors == 0); grpc_shutdown(); diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index dac7860141c..ceab7506729 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -1471,7 +1471,7 @@ TEST_F(ClientLbEnd2endTest, ChannelIdleness) { StartServers(kNumServers); // Set max idle time and build the channel. ChannelArguments args; - args.SetInt(GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS, 100); + args.SetInt(GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS, 1000); auto response_generator = BuildResolverResponseGenerator(); auto channel = BuildChannel("", response_generator, args); auto stub = BuildStub(channel); @@ -1483,7 +1483,7 @@ TEST_F(ClientLbEnd2endTest, ChannelIdleness) { EXPECT_EQ(channel->GetState(false), GRPC_CHANNEL_READY); // After a period time not using the channel, the channel state should switch // to IDLE. - gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(120)); + gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(1200)); EXPECT_EQ(channel->GetState(false), GRPC_CHANNEL_IDLE); // Sending a new RPC should awake the IDLE channel. response_generator.SetNextResolution(GetServersPorts()); From 40fe76ad307626c441563b4d12640ce683da01c4 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 16 Aug 2019 14:17:05 -0700 Subject: [PATCH 364/661] Fix import --- src/python/grpcio/grpc/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index f96ca270dc0..aa47316b448 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -22,7 +22,6 @@ import six from grpc._cython import cygrpc as _cygrpc from grpc import _compression -from grpc import local_credentials logging.getLogger(__name__).addHandler(logging.NullHandler()) From 96a7b68edc49166b23d6ab743bd69fd8afda1328 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 16 Aug 2019 14:20:20 -0700 Subject: [PATCH 365/661] Ignore Visual Studio Code configurations --- .gitignore | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitignore b/.gitignore index 4a400b4e3b4..63ba8f53705 100644 --- a/.gitignore +++ b/.gitignore @@ -139,10 +139,6 @@ bm_*.json # Visual Studio Code artifacts .vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json # Clion artifacts cmake-build-debug/ From 64dd53273252db24662b93d4e3408c58bfc000f4 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 16 Aug 2019 14:55:48 -0700 Subject: [PATCH 366/661] Make _api_test.py happy --- src/python/grpcio_tests/tests/unit/_api_test.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/python/grpcio_tests/tests/unit/_api_test.py b/src/python/grpcio_tests/tests/unit/_api_test.py index 127dab336bf..cc0daba2098 100644 --- a/src/python/grpcio_tests/tests/unit/_api_test.py +++ b/src/python/grpcio_tests/tests/unit/_api_test.py @@ -60,6 +60,9 @@ class AllTest(unittest.TestCase): 'ServiceRpcHandler', 'Server', 'ServerInterceptor', + 'LocalConnectionType', + 'local_channel_credentials', + 'local_server_credentials', 'unary_unary_rpc_method_handler', 'unary_stream_rpc_method_handler', 'stream_unary_rpc_method_handler', From a802b14be6d8ed0fabfbf7a1df1607116a238f64 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Fri, 16 Aug 2019 15:09:32 -0700 Subject: [PATCH 367/661] Add xds resolver --- BUILD | 13 +++ BUILD.gn | 1 + CMakeLists.txt | 2 + Makefile | 2 + build.yaml | 9 ++ config.m4 | 2 + config.w32 | 2 + gRPC-Core.podspec | 1 + grpc.gemspec | 1 + grpc.gyp | 2 + package.xml | 1 + .../client_channel/lb_policy/xds/xds.cc | 5 +- .../resolver/xds/xds_resolver.cc | 89 +++++++++++++++++++ .../plugin_registry/grpc_plugin_registry.cc | 4 + .../grpc_unsecure_plugin_registry.cc | 4 + src/python/grpcio/grpc_core_dependencies.py | 1 + .../client_channel/service_config_test.cc | 22 ----- test/cpp/end2end/xds_end2end_test.cc | 20 ++++- tools/doxygen/Doxyfile.core.internal | 1 + 19 files changed, 154 insertions(+), 28 deletions(-) create mode 100644 src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc diff --git a/BUILD b/BUILD index d5e863c552d..c510757c35d 100644 --- a/BUILD +++ b/BUILD @@ -991,6 +991,7 @@ grpc_cc_library( "grpc_resolver_fake", "grpc_resolver_dns_native", "grpc_resolver_sockaddr", + "grpc_resolver_xds", "grpc_transport_chttp2_client_insecure", "grpc_transport_chttp2_server_insecure", "grpc_transport_inproc", @@ -1527,6 +1528,18 @@ grpc_cc_library( ], ) +grpc_cc_library( + name = "grpc_resolver_xds", + srcs = [ + "src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc", + ], + language = "c++", + deps = [ + "grpc_base", + "grpc_client_channel", + ], +) + grpc_cc_library( name = "grpc_secure", srcs = [ diff --git a/BUILD.gn b/BUILD.gn index 18204a17c33..1b157427087 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -305,6 +305,7 @@ config("grpc_config") { "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc", "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h", "src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc", + "src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc", "src/core/ext/filters/client_channel/resolver_factory.h", "src/core/ext/filters/client_channel/resolver_registry.cc", "src/core/ext/filters/client_channel/resolver_registry.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b6dba6dedb..86a77c95663 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1368,6 +1368,7 @@ add_library(grpc src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc + src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc src/core/ext/filters/census/grpc_context.cc src/core/ext/filters/client_idle/client_idle_filter.cc src/core/ext/filters/max_age/max_age_filter.cc @@ -2808,6 +2809,7 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc + src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc diff --git a/Makefile b/Makefile index 8080efcc41a..a0692f38d20 100644 --- a/Makefile +++ b/Makefile @@ -3891,6 +3891,7 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc \ src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \ src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \ + src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc \ src/core/ext/filters/census/grpc_context.cc \ src/core/ext/filters/client_idle/client_idle_filter.cc \ src/core/ext/filters/max_age/max_age_filter.cc \ @@ -5255,6 +5256,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \ src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \ src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \ + src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc \ diff --git a/build.yaml b/build.yaml index 87ca412d12f..7431dbb2a53 100644 --- a/build.yaml +++ b/build.yaml @@ -1224,6 +1224,13 @@ filegroups: uses: - grpc_base - grpc_client_channel +- name: grpc_resolver_xds + src: + - src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc + plugin: grpc_resolver_xds + uses: + - grpc_base + - grpc_client_channel - name: grpc_secure public_headers: - include/grpc/grpc_security.h @@ -1672,6 +1679,7 @@ libs: - grpc_resolver_dns_native - grpc_resolver_sockaddr - grpc_resolver_fake + - grpc_resolver_xds - grpc_secure - census - grpc_client_idle_filter @@ -1743,6 +1751,7 @@ libs: - grpc_resolver_dns_native - grpc_resolver_sockaddr - grpc_resolver_fake + - grpc_resolver_xds - grpc_lb_policy_grpclb - grpc_lb_policy_xds - grpc_lb_policy_pick_first diff --git a/config.m4 b/config.m4 index 72fd381fd53..2a074768f57 100644 --- a/config.m4 +++ b/config.m4 @@ -447,6 +447,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc \ src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \ src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \ + src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc \ src/core/ext/filters/census/grpc_context.cc \ src/core/ext/filters/client_idle/client_idle_filter.cc \ src/core/ext/filters/max_age/max_age_filter.cc \ @@ -732,6 +733,7 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/dns/native) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/fake) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/sockaddr) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/xds) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_idle) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/deadline) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http) diff --git a/config.w32 b/config.w32 index a2d0d0f6abf..065da74bfb9 100644 --- a/config.w32 +++ b/config.w32 @@ -420,6 +420,7 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\resolver\\dns\\dns_resolver_selection.cc " + "src\\core\\ext\\filters\\client_channel\\resolver\\dns\\native\\dns_resolver.cc " + "src\\core\\ext\\filters\\client_channel\\resolver\\sockaddr\\sockaddr_resolver.cc " + + "src\\core\\ext\\filters\\client_channel\\resolver\\xds\\xds_resolver.cc " + "src\\core\\ext\\filters\\census\\grpc_context.cc " + "src\\core\\ext\\filters\\client_idle\\client_idle_filter.cc " + "src\\core\\ext\\filters\\max_age\\max_age_filter.cc " + @@ -738,6 +739,7 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\dns\\native"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\fake"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\sockaddr"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\xds"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_idle"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\deadline"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\http"); diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 2a35ca35fb5..3244e9d08f9 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -945,6 +945,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc', 'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc', 'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc', + 'src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc', 'src/core/ext/filters/census/grpc_context.cc', 'src/core/ext/filters/client_idle/client_idle_filter.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', diff --git a/grpc.gemspec b/grpc.gemspec index c817006b125..5a29165c92d 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -874,6 +874,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc ) s.files += %w( src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc ) s.files += %w( src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc ) + s.files += %w( src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc ) s.files += %w( src/core/ext/filters/census/grpc_context.cc ) s.files += %w( src/core/ext/filters/client_idle/client_idle_filter.cc ) s.files += %w( src/core/ext/filters/max_age/max_age_filter.cc ) diff --git a/grpc.gyp b/grpc.gyp index 173aef52a79..ba847d99548 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -657,6 +657,7 @@ 'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc', 'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc', 'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc', + 'src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc', 'src/core/ext/filters/census/grpc_context.cc', 'src/core/ext/filters/client_idle/client_idle_filter.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', @@ -1434,6 +1435,7 @@ 'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc', 'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', + 'src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc', diff --git a/package.xml b/package.xml index 979bc465a75..196c6a6d7db 100644 --- a/package.xml +++ b/package.xml @@ -879,6 +879,7 @@ + diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 11bbb72a367..75fa544c80a 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -1832,6 +1832,7 @@ void XdsLb::ProcessAddressesAndChannelArgsLocked( void XdsLb::ParseLbConfig(const ParsedXdsConfig* xds_config) { if (xds_config == nullptr || xds_config->balancer_name() == nullptr) return; // TODO(yashykt) : does this need to be a gpr_strdup + // TODO(juanlishen): Read balancer name from bootstrap file. balancer_name_ = UniquePtr(gpr_strdup(xds_config->balancer_name())); child_policy_config_ = xds_config->child_policy(); fallback_policy_config_ = xds_config->fallback_policy(); @@ -2588,10 +2589,6 @@ class XdsFactory : public LoadBalancingPolicyFactory { } } } - if (balancer_name == nullptr) { - error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( - "field:balancerName error:not found")); - } if (error_list.empty()) { return RefCountedPtr(New( balancer_name, std::move(child_policy), std::move(fallback_policy))); diff --git a/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc b/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc new file mode 100644 index 00000000000..8be1b89eee0 --- /dev/null +++ b/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc @@ -0,0 +1,89 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#include "src/core/ext/filters/client_channel/resolver_registry.h" + +namespace grpc_core { + +namespace { + +class XdsResolver : public Resolver { + public: + explicit XdsResolver(ResolverArgs args) + : Resolver(args.combiner, std::move(args.result_handler)), + args_(grpc_channel_args_copy(args.args)) {} + ~XdsResolver() override { grpc_channel_args_destroy(args_); } + + void StartLocked() override; + + void ShutdownLocked() override{}; + + private: + const grpc_channel_args* args_; +}; + +void XdsResolver::StartLocked() { + static const char* service_config = + "{\n" + " \"loadBalancingConfig\":[\n" + " { \"xds_experimental\":{} }\n" + " ]\n" + "}"; + Result result; + result.args = args_; + args_ = nullptr; + grpc_error* error = GRPC_ERROR_NONE; + result.service_config = ServiceConfig::Create(service_config, &error); + result_handler()->ReturnResult(std::move(result)); +} + +// +// Factory +// + +class XdsResolverFactory : public ResolverFactory { + public: + bool IsValidUri(const grpc_uri* uri) const override { + if (GPR_UNLIKELY(0 != strcmp(uri->authority, ""))) { + gpr_log(GPR_ERROR, "URI authority not supported"); + return false; + } + return true; + } + + OrphanablePtr CreateResolver(ResolverArgs args) const override { + if (!IsValidUri(args.uri)) return nullptr; + return OrphanablePtr(New(std::move(args))); + } + + const char* scheme() const override { return "xds-experimental"; } +}; + +} // namespace + +} // namespace grpc_core + +void grpc_resolver_xds_init() { + grpc_core::ResolverRegistry::Builder::RegisterResolverFactory( + grpc_core::UniquePtr( + grpc_core::New())); +} + +void grpc_resolver_xds_shutdown() {} diff --git a/src/core/plugin_registry/grpc_plugin_registry.cc b/src/core/plugin_registry/grpc_plugin_registry.cc index 9b011d8df0f..ebe3def245a 100644 --- a/src/core/plugin_registry/grpc_plugin_registry.cc +++ b/src/core/plugin_registry/grpc_plugin_registry.cc @@ -46,6 +46,8 @@ void grpc_resolver_dns_native_init(void); void grpc_resolver_dns_native_shutdown(void); void grpc_resolver_sockaddr_init(void); void grpc_resolver_sockaddr_shutdown(void); +void grpc_resolver_xds_init(void); +void grpc_resolver_xds_shutdown(void); void grpc_client_idle_filter_init(void); void grpc_client_idle_filter_shutdown(void); void grpc_max_age_filter_init(void); @@ -84,6 +86,8 @@ void grpc_register_built_in_plugins(void) { grpc_resolver_dns_native_shutdown); grpc_register_plugin(grpc_resolver_sockaddr_init, grpc_resolver_sockaddr_shutdown); + grpc_register_plugin(grpc_resolver_xds_init, + grpc_resolver_xds_shutdown); grpc_register_plugin(grpc_client_idle_filter_init, grpc_client_idle_filter_shutdown); grpc_register_plugin(grpc_max_age_filter_init, diff --git a/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc b/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc index 055c3ccc134..6668836f02f 100644 --- a/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc +++ b/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc @@ -38,6 +38,8 @@ void grpc_resolver_sockaddr_init(void); void grpc_resolver_sockaddr_shutdown(void); void grpc_resolver_fake_init(void); void grpc_resolver_fake_shutdown(void); +void grpc_resolver_xds_init(void); +void grpc_resolver_xds_shutdown(void); void grpc_lb_policy_grpclb_init(void); void grpc_lb_policy_grpclb_shutdown(void); void grpc_lb_policy_xds_init(void); @@ -76,6 +78,8 @@ void grpc_register_built_in_plugins(void) { grpc_resolver_sockaddr_shutdown); grpc_register_plugin(grpc_resolver_fake_init, grpc_resolver_fake_shutdown); + grpc_register_plugin(grpc_resolver_xds_init, + grpc_resolver_xds_shutdown); grpc_register_plugin(grpc_lb_policy_grpclb_init, grpc_lb_policy_grpclb_shutdown); grpc_register_plugin(grpc_lb_policy_xds_init, diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 58c1fd3daba..607235556e3 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -419,6 +419,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc', 'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc', 'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc', + 'src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc', 'src/core/ext/filters/census/grpc_context.cc', 'src/core/ext/filters/client_idle/client_idle_filter.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', diff --git a/test/core/client_channel/service_config_test.cc b/test/core/client_channel/service_config_test.cc index 919441d706a..79dde6bcabe 100644 --- a/test/core/client_channel/service_config_test.cc +++ b/test/core/client_channel/service_config_test.cc @@ -457,28 +457,6 @@ TEST_F(ClientChannelParserTest, InvalidGrpclbLoadBalancingConfig) { VerifyRegexMatch(error, e); } -TEST_F(ClientChannelParserTest, InalidLoadBalancingConfigXds) { - const char* test_json = - "{\n" - " \"loadBalancingConfig\":[\n" - " { \"does_not_exist\":{} },\n" - " { \"xds_experimental\":{} }\n" - " ]\n" - "}"; - grpc_error* error = GRPC_ERROR_NONE; - auto svc_cfg = ServiceConfig::Create(test_json, &error); - gpr_log(GPR_ERROR, "%s", grpc_error_string(error)); - ASSERT_TRUE(error != GRPC_ERROR_NONE); - std::regex e( - std::string("(Service config parsing " - "error)(.*)(referenced_errors)(.*)(Global " - "Params)(.*)(referenced_errors)(.*)(Client channel global " - "parser)(.*)(referenced_errors)(.*)(Xds " - "Parser)(.*)(referenced_errors)(.*)(field:balancerName " - "error:not found)")); - VerifyRegexMatch(error, e); -} - TEST_F(ClientChannelParserTest, ValidLoadBalancingPolicy) { const char* test_json = "{\"loadBalancingPolicy\":\"pick_first\"}"; grpc_error* error = GRPC_ERROR_NONE; diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 0a5c3740096..9bc7efe957f 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -551,7 +551,8 @@ class XdsEnd2endTest : public ::testing::Test { void ShutdownBackend(size_t index) { backends_[index]->Shutdown(); } void ResetStub(int fallback_timeout = 0, - const grpc::string& expected_targets = "") { + const grpc::string& expected_targets = "", + grpc::string scheme = "") { ChannelArguments args; // TODO(juanlishen): Add setter to ChannelArguments. if (fallback_timeout > 0) { @@ -562,8 +563,9 @@ class XdsEnd2endTest : public ::testing::Test { if (!expected_targets.empty()) { args.SetString(GRPC_ARG_FAKE_SECURITY_EXPECTED_TARGETS, expected_targets); } + if (scheme.empty()) scheme = "fake"; std::ostringstream uri; - uri << "fake:///" << kApplicationTargetName_; + uri << scheme << ":///" << kApplicationTargetName_; // TODO(dgq): templatize tests to run everything using both secure and // insecure channel credentials. grpc_channel_credentials* channel_creds = @@ -913,6 +915,20 @@ class XdsEnd2endTest : public ::testing::Test { "}"; }; +class XdsResolverTest : public XdsEnd2endTest { + public: + XdsResolverTest() : XdsEnd2endTest(0, 0, 0) {} +}; + +TEST_F(XdsResolverTest, XdsResolverIsUsed) { + // Use xds-experimental scheme in URI. + ResetStub(0, "", "xds-experimental"); + // Send an RPC to trigger resolution. + SendRpc(); + // Xds resolver returns xds_experimental as the LB policy. + EXPECT_EQ("xds_experimental", channel_->GetLoadBalancingPolicyName()); +} + class SingleBalancerTest : public XdsEnd2endTest { public: SingleBalancerTest() : XdsEnd2endTest(4, 1, 0) {} diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index e9bd8e463ba..e2900b2e701 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -952,6 +952,7 @@ src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \ src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h \ src/core/ext/filters/client_channel/resolver/sockaddr/README.md \ src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \ +src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc \ src/core/ext/filters/client_channel/resolver_factory.h \ src/core/ext/filters/client_channel/resolver_registry.cc \ src/core/ext/filters/client_channel/resolver_registry.h \ From 5a4d46d19bc190e49feccc9879f2df57ab51dbb0 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 16 Aug 2019 15:16:29 -0700 Subject: [PATCH 368/661] Add wait_for_ready attempt to fix gevent issue --- .../grpcio_tests/tests/unit/_local_credentials_test.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/python/grpcio_tests/tests/unit/_local_credentials_test.py b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py index fe7b052482b..7fb2520d48d 100644 --- a/src/python/grpcio_tests/tests/unit/_local_credentials_test.py +++ b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py @@ -42,7 +42,9 @@ class LocalCredentialsTest(unittest.TestCase): port = server.add_secure_port(server_addr.format(0), server_creds) server.start() channel = grpc.secure_channel(server_addr.format(port), channel_creds) - self.assertEqual(b'abc', channel.unary_unary('/test/method')(b'abc')) + self.assertEqual(b'abc', + channel.unary_unary('/test/method')( + b'abc', wait_for_ready=True)) server.stop(None) def test_uds(self): @@ -55,7 +57,9 @@ class LocalCredentialsTest(unittest.TestCase): server.add_secure_port(server_addr, server_creds) server.start() channel = grpc.secure_channel(server_addr, channel_creds) - self.assertEqual(b'abc', channel.unary_unary('/test/method')(b'abc')) + self.assertEqual(b'abc', + channel.unary_unary('/test/method')( + b'abc', wait_for_ready=True)) server.stop(None) From 227a7cb47b14b135989897aa49d98b6abede9023 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 16 Aug 2019 15:43:06 -0700 Subject: [PATCH 369/661] Adopt reviewer's suggestion --- src/python/grpcio/grpc/__init__.py | 26 +++++++++++++++---- .../grpc/_cython/_cygrpc/credentials.pyx.pxi | 2 +- .../tests/unit/_local_credentials_test.py | 21 ++++++++------- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index aa47316b448..3852b40c971 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -1746,21 +1746,29 @@ def dynamic_ssl_server_credentials(initial_certificate_configuration, @enum.unique class LocalConnectionType(enum.Enum): - """Type of local connections for which local channel/server credentials will be applied. + """Types of local connection for local credential creation. Attributes: UDS: Unix domain socket connections LOCAL_TCP: Local TCP connections. """ - UDS = _cygrpc.LocalConnectType.uds - LOCAL_TCP = _cygrpc.LocalConnectType.local_tcp + UDS = _cygrpc.LocalConnectionType.uds + LOCAL_TCP = _cygrpc.LocalConnectionType.local_tcp def local_channel_credentials(local_connect_type=LocalConnectionType.LOCAL_TCP): """Creates a local ChannelCredentials used for local connections. + Local credentials are used by local TCP endpoints (e.g. localhost:10000) + also UDS connections. It allows them to create secure channel, hence + transmitting call credentials become possible. + + It is useful for 1) eliminating insecure_channel usage; 2) enable unit + testing for call credentials without setting up secrets. + Args: - local_connect_type: Local connection type (either UDS or LOCAL_TCP) + local_connect_type: Local connection type (either + grpc.LocalConnectionType.UDS or grpc.LocalConnectionType.LOCAL_TCP) Returns: A ChannelCredentials for use with a local Channel @@ -1772,8 +1780,16 @@ def local_channel_credentials(local_connect_type=LocalConnectionType.LOCAL_TCP): def local_server_credentials(local_connect_type=LocalConnectionType.LOCAL_TCP): """Creates a local ServerCredentials used for local connections. + Local credentials are used by local TCP endpoints (e.g. localhost:10000) + also UDS connections. It allows them to create secure channel, hence + transmitting call credentials become possible. + + It is useful for 1) eliminating insecure_channel usage; 2) enable unit + testing for call credentials without setting up secrets. + Args: - local_connect_type: Local connection type (either UDS or LOCAL_TCP) + local_connect_type: Local connection type (either + grpc.LocalConnectionType.UDS or grpc.LocalConnectionType.LOCAL_TCP) Returns: A ServerCredentials for use with a local Server diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi index ac88bbe7afc..b2aa7800295 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi @@ -329,7 +329,7 @@ cdef grpc_ssl_certificate_config_reload_status _server_cert_config_fetcher_wrapp return GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW -class LocalConnectType: +class LocalConnectionType: uds = UDS local_tcp = LOCAL_TCP diff --git a/src/python/grpcio_tests/tests/unit/_local_credentials_test.py b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py index 7fb2520d48d..80a21af1cef 100644 --- a/src/python/grpcio_tests/tests/unit/_local_credentials_test.py +++ b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py @@ -33,18 +33,20 @@ class LocalCredentialsTest(unittest.TestCase): return server def test_local_tcp(self): - server_addr = '[::1]:{}' + server_addr = 'localhost:{}' channel_creds = grpc.local_channel_credentials( grpc.LocalConnectionType.LOCAL_TCP) server_creds = grpc.local_server_credentials( grpc.LocalConnectionType.LOCAL_TCP) + server = self._create_server() port = server.add_secure_port(server_addr.format(0), server_creds) server.start() - channel = grpc.secure_channel(server_addr.format(port), channel_creds) - self.assertEqual(b'abc', - channel.unary_unary('/test/method')( - b'abc', wait_for_ready=True)) + with grpc.secure_channel(server_addr.format(port), + channel_creds) as channel: + self.assertEqual(b'abc', + channel.unary_unary('/test/method')( + b'abc', wait_for_ready=True)) server.stop(None) def test_uds(self): @@ -53,13 +55,14 @@ class LocalCredentialsTest(unittest.TestCase): grpc.LocalConnectionType.UDS) server_creds = grpc.local_server_credentials( grpc.LocalConnectionType.UDS) + server = self._create_server() server.add_secure_port(server_addr, server_creds) server.start() - channel = grpc.secure_channel(server_addr, channel_creds) - self.assertEqual(b'abc', - channel.unary_unary('/test/method')( - b'abc', wait_for_ready=True)) + with grpc.secure_channel(server_addr, channel_creds) as channel: + self.assertEqual(b'abc', + channel.unary_unary('/test/method')( + b'abc', wait_for_ready=True)) server.stop(None) From 4bd0ee17bcd7e9b9276680f5a308ba2a3aa24fff Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Fri, 16 Aug 2019 16:42:33 -0700 Subject: [PATCH 370/661] GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS is based on data frames being received --- doc/keepalive.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/keepalive.md b/doc/keepalive.md index 20449fc273b..a54a4fa033c 100644 --- a/doc/keepalive.md +++ b/doc/keepalive.md @@ -18,9 +18,9 @@ The above two channel arguments should be sufficient for most users, but the fol * **GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA** * This channel argument controls the maximum number of pings that can be sent when there is no other data (data frame or header frame) to be sent. GRPC Core will not continue sending pings if we run over the limit. Setting it to 0 allows sending pings without sending data. * **GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS** - * If there is no data being sent on the transport, this channel argument controls the minimum time (in milliseconds) gRPC Core will wait between successive pings. + * If there are no data frames being received on the transport, this channel argument controls the minimum time (in milliseconds) gRPC Core will wait between successive pings. * **GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS** - * If there is no data being sent on the transport, this channel argument on the server side controls the minimum time (in milliseconds) that gRPC Core would expect between receiving successive pings. If the time between successive pings is less that than this time, then the ping will be considered a bad ping from the peer. Such a ping counts as a ‘ping strike’. + * If there are no data frames being sent on the transport, this channel argument on the server side controls the minimum time (in milliseconds) that gRPC Core would expect between receiving successive pings. If the time between successive pings is less that than this time, then the ping will be considered a bad ping from the peer. Such a ping counts as a ‘ping strike’. On the client side, this does not have any effect. * **GRPC_ARG_HTTP2_MAX_PING_STRIKES** * This arg controls the maximum number of bad pings that the server will tolerate before sending an HTTP2 GOAWAY frame and closing the transport. Setting it to 0 allows the server to accept any number of bad pings. From c45fb12ffb21966307888ef9c87dbd7ba70a0683 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 16 Aug 2019 17:33:19 -0700 Subject: [PATCH 371/661] Add experimental API note. --- src/python/grpcio/grpc/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index 3852b40c971..aa1a20c58db 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -1759,6 +1759,8 @@ class LocalConnectionType(enum.Enum): def local_channel_credentials(local_connect_type=LocalConnectionType.LOCAL_TCP): """Creates a local ChannelCredentials used for local connections. + This is an EXPERIMENTAL API. + Local credentials are used by local TCP endpoints (e.g. localhost:10000) also UDS connections. It allows them to create secure channel, hence transmitting call credentials become possible. @@ -1780,6 +1782,8 @@ def local_channel_credentials(local_connect_type=LocalConnectionType.LOCAL_TCP): def local_server_credentials(local_connect_type=LocalConnectionType.LOCAL_TCP): """Creates a local ServerCredentials used for local connections. + This is an EXPERIMENTAL API. + Local credentials are used by local TCP endpoints (e.g. localhost:10000) also UDS connections. It allows them to create secure channel, hence transmitting call credentials become possible. From 43bedf0007eb4945a3c8252494f84f7edd2263b9 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 19 Aug 2019 11:56:44 -0700 Subject: [PATCH 372/661] Fix internal lint warnings. --- src/benchmark/gen_build_yaml.py | 3 ++- src/boringssl/gen_build_yaml.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/benchmark/gen_build_yaml.py b/src/benchmark/gen_build_yaml.py index a1f777d6c2b..35c9244e6fa 100755 --- a/src/benchmark/gen_build_yaml.py +++ b/src/benchmark/gen_build_yaml.py @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import print_function import os import sys import glob @@ -35,4 +36,4 @@ out['libs'] = [{ glob.glob('third_party/benchmark/include/benchmark/*.h')), }] -print yaml.dump(out) +print(yaml.dump(out)) diff --git a/src/boringssl/gen_build_yaml.py b/src/boringssl/gen_build_yaml.py index 145cc67b0d1..3b259c32c5d 100755 --- a/src/boringssl/gen_build_yaml.py +++ b/src/boringssl/gen_build_yaml.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import print_function import shutil import sys import os @@ -28,7 +29,7 @@ sys.path.append(os.path.join(boring_ssl_root, 'util')) try: import generate_build_files except ImportError: - print yaml.dump({}) + print(yaml.dump({})) sys.exit() def map_dir(filename): @@ -135,7 +136,7 @@ try: g = Grpc() generate_build_files.main([g]) - print yaml.dump(g.yaml) + print(yaml.dump(g.yaml)) finally: shutil.rmtree('src') From 2a9998bc13d4aae9e0288efa1f7676f706a91073 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 19 Aug 2019 13:19:04 -0700 Subject: [PATCH 373/661] Properly handle exceptions in signal handlers for in-flight outgoing RPCs --- .../grpc/_cython/_cygrpc/channel.pyx.pxi | 27 +++++++--- .../grpcio_tests/tests/unit/_signal_client.py | 38 ++++++++++++-- .../tests/unit/_signal_handling_test.py | 49 +++++++++++++++++++ 3 files changed, 103 insertions(+), 11 deletions(-) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi index ca637094353..5b47d356d6f 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi @@ -146,12 +146,17 @@ cdef _cancel( cdef _next_call_event( _ChannelState channel_state, grpc_completion_queue *c_completion_queue, - on_success, deadline): - tag, event = _latent_event(c_completion_queue, deadline) - with channel_state.condition: - on_success(tag) - channel_state.condition.notify_all() - return event + on_success, on_failure, deadline): + try: + tag, event = _latent_event(c_completion_queue, deadline) + except: + on_failure() + raise + else: + with channel_state.condition: + on_success(tag) + channel_state.condition.notify_all() + return event # TODO(https://github.com/grpc/grpc/issues/14569): This could be a lot simpler. @@ -307,8 +312,14 @@ cdef class SegregatedCall: def on_success(tag): _process_segregated_call_tag( self._channel_state, self._call_state, self._c_completion_queue, tag) + def on_failure(): + self._call_state.due.clear() + grpc_call_unref(self._call_state.c_call) + self._call_state.c_call = NULL + self._channel_state.segregated_call_states.remove(self._call_state) + _destroy_c_completion_queue(self._c_completion_queue) return _next_call_event( - self._channel_state, self._c_completion_queue, on_success, None) + self._channel_state, self._c_completion_queue, on_success, on_failure, None) cdef SegregatedCall _segregated_call( @@ -462,7 +473,7 @@ cdef class Channel: else: queue_deadline = None return _next_call_event(self._state, self._state.c_call_completion_queue, - on_success, queue_deadline) + on_success, None, queue_deadline) def segregated_call( self, int flags, method, host, object deadline, object metadata, diff --git a/src/python/grpcio_tests/tests/unit/_signal_client.py b/src/python/grpcio_tests/tests/unit/_signal_client.py index 65ddd6d858e..a2234623a76 100644 --- a/src/python/grpcio_tests/tests/unit/_signal_client.py +++ b/src/python/grpcio_tests/tests/unit/_signal_client.py @@ -45,6 +45,7 @@ def handle_sigint(unused_signum, unused_frame): if per_process_rpc_future is not None: per_process_rpc_future.cancel() sys.stderr.flush() + # This sys.exit(0) avoids an exception caused by the cancelled RPC. sys.exit(0) @@ -72,13 +73,44 @@ def main_streaming(server_target): assert False, _ASSERTION_MESSAGE +def main_unary_with_exception(server_target): + """Initiate an RPC with wait_for_ready set and no server backing the RPC.""" + channel = grpc.insecure_channel(server_target) + try: + channel.unary_unary(UNARY_UNARY)(_MESSAGE, wait_for_ready=True) + except KeyboardInterrupt: + sys.stderr.write("Running signal handler.\n"); sys.stderr.flush() + + sys.stderr.write("Calling Channel.close()"); sys.stderr.flush() + # This call should not hang. + channel.close() + +def main_streaming_with_exception(server_target): + """Initiate an RPC with wait_for_ready set and no server backing the RPC.""" + channel = grpc.insecure_channel(server_target) + try: + channel.unary_stream(UNARY_STREAM)(_MESSAGE, wait_for_ready=True) + except KeyboardInterrupt: + sys.stderr.write("Running signal handler.\n"); sys.stderr.flush() + + sys.stderr.write("Calling Channel.close()"); sys.stderr.flush() + # This call should not hang. + channel.close() + if __name__ == '__main__': parser = argparse.ArgumentParser(description='Signal test client.') parser.add_argument('server', help='Server target') parser.add_argument( - 'arity', help='RPC arity', choices=('unary', 'streaming')) + 'arity', help='Arity', choices=('unary', 'streaming')) + parser.add_argument( + '--exception', help='Whether the signal throws an exception', + action='store_true') args = parser.parse_args() - if args.arity == 'unary': + if args.arity == 'unary' and not args.exception: main_unary(args.server) - else: + elif args.arity == 'streaming' and not args.exception: main_streaming(args.server) + elif args.arity == 'unary' and args.exception: + main_unary_with_exception(args.server) + else: + main_streaming_with_exception(args.server) diff --git a/src/python/grpcio_tests/tests/unit/_signal_handling_test.py b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py index 8ef156c596d..fbb1280e9d4 100644 --- a/src/python/grpcio_tests/tests/unit/_signal_handling_test.py +++ b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py @@ -13,6 +13,7 @@ # limitations under the License. """Test of responsiveness to signals.""" +import contextlib import logging import os import signal @@ -20,6 +21,7 @@ import subprocess import tempfile import threading import unittest +import socket import sys import grpc @@ -167,6 +169,53 @@ class SignalHandlingTest(unittest.TestCase): client_stdout.read()) +@contextlib.contextmanager +def _get_free_loopback_tcp_port(): + sock = socket.socket(socket.AF_INET6) + sock.bind(('', 0)) + address_tuple = sock.getsockname() + try: + yield "[::1]:%s" % (address_tuple[1]) + finally: + sock.close() + + +# TODO(gnossen): Consider combining classes. +class SignalHandlingTestWithoutServer(unittest.TestCase): + + @unittest.skipIf(os.name == 'nt', 'SIGINT not supported on windows') + def testUnaryHandlerWithException(self): + with _get_free_loopback_tcp_port() as server_target: + with tempfile.TemporaryFile(mode='r') as client_stdout: + with tempfile.TemporaryFile(mode='r') as client_stderr: + client = _start_client(('--exception', server_target, 'unary'), + client_stdout, client_stderr) + # TODO(rbellevi): Figure out a way to determininstically hook + # in here. + import time; time.sleep(1) + client.send_signal(signal.SIGINT) + client.wait() + print(_read_stream(client_stderr)) + self.assertEqual(0, client.returncode) + + @unittest.skipIf(os.name == 'nt', 'SIGINT not supported on windows') + def testStreamingHandlerWithException(self): + with _get_free_loopback_tcp_port() as server_target: + with tempfile.TemporaryFile(mode='r') as client_stdout: + with tempfile.TemporaryFile(mode='r') as client_stderr: + client = _start_client(('--exception', server_target, 'streaming'), + client_stdout, client_stderr) + # TODO(rbellevi): Figure out a way to deterministically hook + # in here. + import time; time.sleep(1) + client.send_signal(signal.SIGINT) + client.wait() + print(_read_stream(client_stderr)) + self.assertEqual(0, client.returncode) + + + + if __name__ == '__main__': logging.basicConfig() unittest.main(verbosity=2) From b4eaccf754cd9fdd53efe41e2de13ba5fc0678c8 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 19 Aug 2019 13:22:58 -0700 Subject: [PATCH 374/661] Make tests deterministic --- .../tests/unit/_signal_handling_test.py | 67 ++++++------------- 1 file changed, 20 insertions(+), 47 deletions(-) diff --git a/src/python/grpcio_tests/tests/unit/_signal_handling_test.py b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py index fbb1280e9d4..837a385be0d 100644 --- a/src/python/grpcio_tests/tests/unit/_signal_handling_test.py +++ b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py @@ -168,54 +168,27 @@ class SignalHandlingTest(unittest.TestCase): self.assertIn(_signal_client.SIGTERM_MESSAGE, client_stdout.read()) - -@contextlib.contextmanager -def _get_free_loopback_tcp_port(): - sock = socket.socket(socket.AF_INET6) - sock.bind(('', 0)) - address_tuple = sock.getsockname() - try: - yield "[::1]:%s" % (address_tuple[1]) - finally: - sock.close() - - -# TODO(gnossen): Consider combining classes. -class SignalHandlingTestWithoutServer(unittest.TestCase): - @unittest.skipIf(os.name == 'nt', 'SIGINT not supported on windows') - def testUnaryHandlerWithException(self): - with _get_free_loopback_tcp_port() as server_target: - with tempfile.TemporaryFile(mode='r') as client_stdout: - with tempfile.TemporaryFile(mode='r') as client_stderr: - client = _start_client(('--exception', server_target, 'unary'), - client_stdout, client_stderr) - # TODO(rbellevi): Figure out a way to determininstically hook - # in here. - import time; time.sleep(1) - client.send_signal(signal.SIGINT) - client.wait() - print(_read_stream(client_stderr)) - self.assertEqual(0, client.returncode) + def testUnaryWithException(self): + server_target = '{}:{}'.format(_HOST, self._port) + with tempfile.TemporaryFile(mode='r') as client_stdout: + with tempfile.TemporaryFile(mode='r') as client_stderr: + client = _start_client(('--exception', server_target, 'unary'), + client_stdout, client_stderr) + self._handler.await_connected_client() + client.send_signal(signal.SIGINT) + client.wait() + self.assertEqual(0, client.returncode) @unittest.skipIf(os.name == 'nt', 'SIGINT not supported on windows') def testStreamingHandlerWithException(self): - with _get_free_loopback_tcp_port() as server_target: - with tempfile.TemporaryFile(mode='r') as client_stdout: - with tempfile.TemporaryFile(mode='r') as client_stderr: - client = _start_client(('--exception', server_target, 'streaming'), - client_stdout, client_stderr) - # TODO(rbellevi): Figure out a way to deterministically hook - # in here. - import time; time.sleep(1) - client.send_signal(signal.SIGINT) - client.wait() - print(_read_stream(client_stderr)) - self.assertEqual(0, client.returncode) - - - - -if __name__ == '__main__': - logging.basicConfig() - unittest.main(verbosity=2) + server_target = '{}:{}'.format(_HOST, self._port) + with tempfile.TemporaryFile(mode='r') as client_stdout: + with tempfile.TemporaryFile(mode='r') as client_stderr: + client = _start_client(('--exception', server_target, 'streaming'), + client_stdout, client_stderr) + self._handler.await_connected_client() + client.send_signal(signal.SIGINT) + client.wait() + print(_read_stream(client_stderr)) + self.assertEqual(0, client.returncode) From 4f04a80a69f48d8971098fd658ae76c0bb686a0b Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 19 Aug 2019 13:27:56 -0700 Subject: [PATCH 375/661] Add note about something seemingly suspect. --- src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi index 5b47d356d6f..53abdc5ec15 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi @@ -472,6 +472,9 @@ cdef class Channel: queue_deadline = time.time() + 1.0 else: queue_deadline = None + # NOTE(gnossen): It is acceptable for on_failure to be None here because + # failure conditions can only ever happen on the main thread and this + # method is only ever invoked on the channel spin thread. return _next_call_event(self._state, self._state.c_call_completion_queue, on_success, None, queue_deadline) From ca2fcd647ac2f5603d21c19217b8b065d8f968d7 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 19 Aug 2019 13:36:53 -0700 Subject: [PATCH 376/661] Add docstring --- .../grpc/_cython/_cygrpc/channel.pyx.pxi | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi index 53abdc5ec15..c83ff00fedf 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi @@ -147,10 +147,27 @@ cdef _cancel( cdef _next_call_event( _ChannelState channel_state, grpc_completion_queue *c_completion_queue, on_success, on_failure, deadline): + """Block on the next event out of the completion queue. + + On success, `on_success` will be invoked with the tag taken from the CQ. + In the case of a failure due to an exception raised in a signal handler, + `on_failure` will be invoked with no arguments. Note that this situation + can only occur on the main thread. + + Args: + channel_state: The state for the channel on which the RPC is running. + c_completion_queue: The CQ which will be polled. + on_success: A callable object to be invoked upon successful receipt of a + tag from the CQ. + on_failure: A callable object to be invoked in case a Python exception is + raised from a signal handler during polling. + deadline: The point after which the RPC will time out. + """ try: tag, event = _latent_event(c_completion_queue, deadline) except: - on_failure() + if on_failure is not None: + on_failure() raise else: with channel_state.condition: From 84855a18a9bcb0ea6b83ed1dd23999354bf7fe71 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 19 Aug 2019 13:44:32 -0700 Subject: [PATCH 377/661] Yapf --- .../grpcio_tests/tests/unit/_signal_client.py | 16 +++++++++------- .../tests/unit/_signal_handling_test.py | 7 +++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/python/grpcio_tests/tests/unit/_signal_client.py b/src/python/grpcio_tests/tests/unit/_signal_client.py index a2234623a76..9aa37854a23 100644 --- a/src/python/grpcio_tests/tests/unit/_signal_client.py +++ b/src/python/grpcio_tests/tests/unit/_signal_client.py @@ -79,31 +79,33 @@ def main_unary_with_exception(server_target): try: channel.unary_unary(UNARY_UNARY)(_MESSAGE, wait_for_ready=True) except KeyboardInterrupt: - sys.stderr.write("Running signal handler.\n"); sys.stderr.flush() + sys.stderr.write("Running signal handler.\n") + sys.stderr.flush() - sys.stderr.write("Calling Channel.close()"); sys.stderr.flush() # This call should not hang. channel.close() + def main_streaming_with_exception(server_target): """Initiate an RPC with wait_for_ready set and no server backing the RPC.""" channel = grpc.insecure_channel(server_target) try: channel.unary_stream(UNARY_STREAM)(_MESSAGE, wait_for_ready=True) except KeyboardInterrupt: - sys.stderr.write("Running signal handler.\n"); sys.stderr.flush() + sys.stderr.write("Running signal handler.\n") + sys.stderr.flush() - sys.stderr.write("Calling Channel.close()"); sys.stderr.flush() # This call should not hang. channel.close() + if __name__ == '__main__': parser = argparse.ArgumentParser(description='Signal test client.') parser.add_argument('server', help='Server target') + parser.add_argument('arity', help='Arity', choices=('unary', 'streaming')) parser.add_argument( - 'arity', help='Arity', choices=('unary', 'streaming')) - parser.add_argument( - '--exception', help='Whether the signal throws an exception', + '--exception', + help='Whether the signal throws an exception', action='store_true') args = parser.parse_args() if args.arity == 'unary' and not args.exception: diff --git a/src/python/grpcio_tests/tests/unit/_signal_handling_test.py b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py index 837a385be0d..3c46860fcc5 100644 --- a/src/python/grpcio_tests/tests/unit/_signal_handling_test.py +++ b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py @@ -13,7 +13,6 @@ # limitations under the License. """Test of responsiveness to signals.""" -import contextlib import logging import os import signal @@ -21,7 +20,6 @@ import subprocess import tempfile import threading import unittest -import socket import sys import grpc @@ -185,8 +183,9 @@ class SignalHandlingTest(unittest.TestCase): server_target = '{}:{}'.format(_HOST, self._port) with tempfile.TemporaryFile(mode='r') as client_stdout: with tempfile.TemporaryFile(mode='r') as client_stderr: - client = _start_client(('--exception', server_target, 'streaming'), - client_stdout, client_stderr) + client = _start_client( + ('--exception', server_target, 'streaming'), client_stdout, + client_stderr) self._handler.await_connected_client() client.send_signal(signal.SIGINT) client.wait() From 235b27257c90f1773af8628964bb1c453e478b2b Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 19 Aug 2019 14:05:54 -0700 Subject: [PATCH 378/661] Re-add unittest.main. --- src/python/grpcio_tests/tests/unit/_signal_handling_test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/python/grpcio_tests/tests/unit/_signal_handling_test.py b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py index 3c46860fcc5..6f81e0b2d34 100644 --- a/src/python/grpcio_tests/tests/unit/_signal_handling_test.py +++ b/src/python/grpcio_tests/tests/unit/_signal_handling_test.py @@ -191,3 +191,8 @@ class SignalHandlingTest(unittest.TestCase): client.wait() print(_read_stream(client_stderr)) self.assertEqual(0, client.returncode) + + +if __name__ == '__main__': + logging.basicConfig() + unittest.main(verbosity=2) From 967f55efd633055c1e5419ffd00c51282238d265 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 19 Aug 2019 14:20:01 -0700 Subject: [PATCH 379/661] Add explanatory comment. --- src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi index c83ff00fedf..1799780fce4 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi @@ -165,6 +165,8 @@ cdef _next_call_event( """ try: tag, event = _latent_event(c_completion_queue, deadline) + # NOTE(rbellevi): This broad except enables us to clean up resources before + # propagating any exceptions raised by signal handlers to the application. except: if on_failure is not None: on_failure() From 3d56c83a5f86d7930a99392bc1ee7dc5d2c12f1f Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 19 Aug 2019 14:24:45 -0700 Subject: [PATCH 380/661] Correct out-of-date docstrings --- src/python/grpcio_tests/tests/unit/_signal_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/grpcio_tests/tests/unit/_signal_client.py b/src/python/grpcio_tests/tests/unit/_signal_client.py index 9aa37854a23..97e432d5360 100644 --- a/src/python/grpcio_tests/tests/unit/_signal_client.py +++ b/src/python/grpcio_tests/tests/unit/_signal_client.py @@ -74,7 +74,7 @@ def main_streaming(server_target): def main_unary_with_exception(server_target): - """Initiate an RPC with wait_for_ready set and no server backing the RPC.""" + """Initiate a unary RPC with a signal handler that will raise.""" channel = grpc.insecure_channel(server_target) try: channel.unary_unary(UNARY_UNARY)(_MESSAGE, wait_for_ready=True) @@ -87,7 +87,7 @@ def main_unary_with_exception(server_target): def main_streaming_with_exception(server_target): - """Initiate an RPC with wait_for_ready set and no server backing the RPC.""" + """Initiate a streaming RPC with a signal handler that will raise.""" channel = grpc.insecure_channel(server_target) try: channel.unary_stream(UNARY_STREAM)(_MESSAGE, wait_for_ready=True) From 1abba74225fef9e7968526b87ac115880bcd12e4 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 19 Aug 2019 14:40:27 -0700 Subject: [PATCH 381/661] Fix unused result error --- test/cpp/end2end/xds_end2end_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 9bc7efe957f..480680c9a32 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -924,7 +924,7 @@ TEST_F(XdsResolverTest, XdsResolverIsUsed) { // Use xds-experimental scheme in URI. ResetStub(0, "", "xds-experimental"); // Send an RPC to trigger resolution. - SendRpc(); + auto unused_result = SendRpc(); // Xds resolver returns xds_experimental as the LB policy. EXPECT_EQ("xds_experimental", channel_->GetLoadBalancingPolicyName()); } From e45bea777eb662951bafc506ea9383e940247269 Mon Sep 17 00:00:00 2001 From: Qiancheng Zhao Date: Mon, 19 Aug 2019 15:43:12 -0700 Subject: [PATCH 382/661] use acquire instead of relaxed in IdleTimerCallback() --- src/core/ext/filters/client_idle/client_idle_filter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/filters/client_idle/client_idle_filter.cc b/src/core/ext/filters/client_idle/client_idle_filter.cc index 13c35ae3730..9da098d6d6d 100644 --- a/src/core/ext/filters/client_idle/client_idle_filter.cc +++ b/src/core/ext/filters/client_idle/client_idle_filter.cc @@ -320,7 +320,7 @@ void ChannelData::IdleTimerCallback(void* arg, grpc_error* error) { // EnterIdle() operation finishes, preventing mistakenly entering IDLE // when active RPC exists. finished = chand->state_.CompareExchangeWeak( - &state, PROCESSING, MemoryOrder::RELAXED, MemoryOrder::RELAXED); + &state, PROCESSING, MemoryOrder::ACQUIRE, MemoryOrder::RELAXED); if (finished) { chand->EnterIdle(); chand->state_.Store(IDLE, MemoryOrder::RELAXED); From 4e61956ef4320176ae555b567829c6a87a407543 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Mon, 19 Aug 2019 16:08:57 -0700 Subject: [PATCH 383/661] Add run: false to grpclb_fallback_test --- Makefile | 2 -- build.yaml | 1 + tools/run_tests/generated/tests.json | 18 ------------------ 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/Makefile b/Makefile index a0692f38d20..37df0d6c809 100644 --- a/Makefile +++ b/Makefile @@ -2381,8 +2381,6 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/grpclb_api_test || ( echo test grpclb_api_test failed ; exit 1 ) $(E) "[RUN] Testing grpclb_end2end_test" $(Q) $(BINDIR)/$(CONFIG)/grpclb_end2end_test || ( echo test grpclb_end2end_test failed ; exit 1 ) - $(E) "[RUN] Testing grpclb_fallback_test" - $(Q) $(BINDIR)/$(CONFIG)/grpclb_fallback_test || ( echo test grpclb_fallback_test failed ; exit 1 ) $(E) "[RUN] Testing h2_ssl_cert_test" $(Q) $(BINDIR)/$(CONFIG)/h2_ssl_cert_test || ( echo test h2_ssl_cert_test failed ; exit 1 ) $(E) "[RUN] Testing h2_ssl_session_reuse_test" diff --git a/build.yaml b/build.yaml index 7431dbb2a53..e0862c116e5 100644 --- a/build.yaml +++ b/build.yaml @@ -5170,6 +5170,7 @@ targets: - gpr - name: grpclb_fallback_test build: test + run: false language: c++ src: - src/proto/grpc/testing/empty.proto diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 6dd3f1422e5..f28b1335a6c 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4907,24 +4907,6 @@ ], "uses_polling": true }, - { - "args": [], - "benchmark": false, - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "gtest": false, - "language": "c++", - "name": "grpclb_fallback_test", - "platforms": [ - "linux" - ], - "uses_polling": true - }, { "args": [], "benchmark": false, From f03ae6d493493b5e2c61822a8c10ee7bbf627bf7 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 19 Aug 2019 16:58:56 -0700 Subject: [PATCH 384/661] Fix streaming test case --- src/python/grpcio_tests/tests/unit/_signal_client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio_tests/tests/unit/_signal_client.py b/src/python/grpcio_tests/tests/unit/_signal_client.py index 97e432d5360..3e13146d9e2 100644 --- a/src/python/grpcio_tests/tests/unit/_signal_client.py +++ b/src/python/grpcio_tests/tests/unit/_signal_client.py @@ -90,7 +90,8 @@ def main_streaming_with_exception(server_target): """Initiate a streaming RPC with a signal handler that will raise.""" channel = grpc.insecure_channel(server_target) try: - channel.unary_stream(UNARY_STREAM)(_MESSAGE, wait_for_ready=True) + for _ in channel.unary_stream(UNARY_STREAM)(_MESSAGE, wait_for_ready=True): + pass except KeyboardInterrupt: sys.stderr.write("Running signal handler.\n") sys.stderr.flush() From 76aba16cf4f0296f0af617adbe4e7f4f4468221e Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 19 Aug 2019 17:00:40 -0700 Subject: [PATCH 385/661] Add issue/pr templates --- .../bug_report.md} | 33 +++++++++++-------- .github/ISSUE_TEMPLATE/cleanup_request.md | 18 ++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 29 ++++++++++++++++ .github/pull_request_template.md | 5 +++ 4 files changed, 72 insertions(+), 13 deletions(-) rename .github/{ISSUE_TEMPLATE.md => ISSUE_TEMPLATE/bug_report.md} (90%) mode change 100755 => 100644 create mode 100644 .github/ISSUE_TEMPLATE/cleanup_request.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/pull_request_template.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE/bug_report.md old mode 100755 new mode 100644 similarity index 90% rename from .github/ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE/bug_report.md index acfcdc14845..6eafaacd034 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,3 +1,11 @@ +--- +name: Report a bug +about: Create a report to help us improve +labels: kind/bug +assignees: AspirinSJL + +--- + - + ### What version of gRPC and what language are you using? - - + + ### What operating system (Linux, Windows,...) and version? - - + + ### What runtime / compiler are you using (e.g. python version or version of gcc) - - + + ### What did you do? If possible, provide a recipe for reproducing the error. Try being specific and include code snippets if helpful. - + ### What did you expect to see? - - + + ### What did you see instead? - + Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs). See [TROUBLESHOOTING.md](https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md) for how to diagnose problems better. - -### Anything else we should know about your project / environment? +### Anything else we should know about your project / environment? diff --git a/.github/ISSUE_TEMPLATE/cleanup_request.md b/.github/ISSUE_TEMPLATE/cleanup_request.md new file mode 100644 index 00000000000..65e56772541 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/cleanup_request.md @@ -0,0 +1,18 @@ +--- +name: Request a cleanup +about: Suggest a cleanup in our repository +labels: kind/internal cleanup +assignees: AspirinSJL + +--- + + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000000..2be15ac785c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,29 @@ +--- +name: Request a feature +about: Suggest an idea for this project +labels: kind/enhancement +assignees: AspirinSJL + +--- + + + +### Is your feature request related to a problem? Please describe. +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +### Describe the solution you'd like +A clear and concise description of what you want to happen. + +### Describe alternatives you've considered +A clear and concise description of any alternative solutions or features you've considered. + +### Additional context +Add any other context about the feature request here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000000..31f574ef60d --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,5 @@ + + + + +@AspirinSJL \ No newline at end of file From 5d7766153fe9e307cb3694d21f53a5c6d41eed02 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Mon, 19 Aug 2019 17:37:55 -0700 Subject: [PATCH 386/661] Disable local tcp test for gevent --- src/python/grpcio_tests/commands.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/python/grpcio_tests/commands.py b/src/python/grpcio_tests/commands.py index 166cea101a4..a3912cda712 100644 --- a/src/python/grpcio_tests/commands.py +++ b/src/python/grpcio_tests/commands.py @@ -155,6 +155,8 @@ class TestGevent(setuptools.Command): 'channelz._channelz_servicer_test.ChannelzServicerTest.test_streaming_rpc', # TODO(https://github.com/grpc/grpc/issues/15411) enable this test 'unit._cython._channel_test.ChannelTest.test_negative_deadline_connectivity' + # TODO(https://github.com/grpc/grpc/issues/15411) enable this test + 'unit._local_credentials_test.LocalCredentialsTest.test_local_tcp', ) BANNED_WINDOWS_TESTS = ( # TODO(https://github.com/grpc/grpc/pull/15411) enable this test From e0d04c9a9e64797d0016a176be4f28dd8305a44a Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 19 Aug 2019 18:09:19 -0700 Subject: [PATCH 387/661] Yapf. --- src/python/grpcio_tests/tests/unit/_signal_client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio_tests/tests/unit/_signal_client.py b/src/python/grpcio_tests/tests/unit/_signal_client.py index 3e13146d9e2..075fe7f7177 100644 --- a/src/python/grpcio_tests/tests/unit/_signal_client.py +++ b/src/python/grpcio_tests/tests/unit/_signal_client.py @@ -90,7 +90,8 @@ def main_streaming_with_exception(server_target): """Initiate a streaming RPC with a signal handler that will raise.""" channel = grpc.insecure_channel(server_target) try: - for _ in channel.unary_stream(UNARY_STREAM)(_MESSAGE, wait_for_ready=True): + for _ in channel.unary_stream(UNARY_STREAM)( + _MESSAGE, wait_for_ready=True): pass except KeyboardInterrupt: sys.stderr.write("Running signal handler.\n") From df7ad5f91c0a32356e7648f88091e55e04a6f8a1 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 19 Aug 2019 14:58:01 -0700 Subject: [PATCH 388/661] Repo stats tracking --- tools/gcp/github_stats_tracking/app.yaml | 13 +++ .../github_stats_tracking/appengine_config.py | 19 ++++ tools/gcp/github_stats_tracking/cron.yaml | 4 + tools/gcp/github_stats_tracking/fetch_data.py | 94 +++++++++++++++++++ tools/gcp/github_stats_tracking/main.py | 29 ++++++ 5 files changed, 159 insertions(+) create mode 100644 tools/gcp/github_stats_tracking/app.yaml create mode 100644 tools/gcp/github_stats_tracking/appengine_config.py create mode 100644 tools/gcp/github_stats_tracking/cron.yaml create mode 100644 tools/gcp/github_stats_tracking/fetch_data.py create mode 100644 tools/gcp/github_stats_tracking/main.py diff --git a/tools/gcp/github_stats_tracking/app.yaml b/tools/gcp/github_stats_tracking/app.yaml new file mode 100644 index 00000000000..b0fa5573649 --- /dev/null +++ b/tools/gcp/github_stats_tracking/app.yaml @@ -0,0 +1,13 @@ +runtime: python27 +api_version: 1 +threadsafe: true + +service: github-stats-tracking + +handlers: +- url: /.* + script: main.app + +libraries: +- name: ssl + version: latest diff --git a/tools/gcp/github_stats_tracking/appengine_config.py b/tools/gcp/github_stats_tracking/appengine_config.py new file mode 100644 index 00000000000..086be2aefff --- /dev/null +++ b/tools/gcp/github_stats_tracking/appengine_config.py @@ -0,0 +1,19 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# appengine_config.py +from google.appengine.ext import vendor + +# Add any libraries install in the "lib" folder. +vendor.add('lib') diff --git a/tools/gcp/github_stats_tracking/cron.yaml b/tools/gcp/github_stats_tracking/cron.yaml new file mode 100644 index 00000000000..b5b36be92c6 --- /dev/null +++ b/tools/gcp/github_stats_tracking/cron.yaml @@ -0,0 +1,4 @@ +cron: +- description: "daily github stats tracking job" + url: /daily + schedule: every 24 hours diff --git a/tools/gcp/github_stats_tracking/fetch_data.py b/tools/gcp/github_stats_tracking/fetch_data.py new file mode 100644 index 00000000000..ed183a15a25 --- /dev/null +++ b/tools/gcp/github_stats_tracking/fetch_data.py @@ -0,0 +1,94 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from github import Github, Label +from datetime import datetime, timedelta +from time import time +from google.cloud import bigquery + +ACCESS_TOKEN = "" + + +def get_stats_from_github(): + # Please set the access token properly before deploying. + assert ACCESS_TOKEN + g = Github(ACCESS_TOKEN) + print g.rate_limiting + repo = g.get_repo('grpc/grpc') + + LABEL_LANG = set(label for label in repo.get_labels() + if label.name.split('/')[0] == 'lang') + LABEL_KIND_BUG = repo.get_label('kind/bug') + LABEL_PRIORITY_P0 = repo.get_label('priority/P0') + LABEL_PRIORITY_P1 = repo.get_label('priority/P1') + LABEL_PRIORITY_P2 = repo.get_label('priority/P2') + + def is_untriaged(issue): + key_labels = set() + for label in issue.labels: + label_kind = label.name.split('/')[0] + if label_kind in ('lang', 'kind', 'priority'): + key_labels.add(label_kind) + return len(key_labels) < 3 + + untriaged_open_issues = [ + issue for issue in repo.get_issues(state='open') + if issue.pull_request is None and is_untriaged(issue) + ] + total_bugs = [ + issue + for issue in repo.get_issues(state='all', labels=[LABEL_KIND_BUG]) + if issue.pull_request is None + ] + + lang_to_stats = {} + for lang in LABEL_LANG: + lang_bugs = filter(lambda bug: lang in bug.labels, total_bugs) + closed_bugs = filter(lambda bug: bug.state == 'closed', lang_bugs) + open_bugs = filter(lambda bug: bug.state == 'open', lang_bugs) + open_p0_bugs = filter(lambda bug: LABEL_PRIORITY_P0 in bug.labels, + open_bugs) + open_p1_bugs = filter(lambda bug: LABEL_PRIORITY_P1 in bug.labels, + open_bugs) + open_p2_bugs = filter(lambda bug: LABEL_PRIORITY_P2 in bug.labels, + open_bugs) + lang_to_stats[lang] = [ + len(lang_bugs), + len(closed_bugs), + len(open_bugs), + len(open_p0_bugs), + len(open_p1_bugs), + len(open_p2_bugs) + ] + return len(untriaged_open_issues), lang_to_stats + + +def insert_stats_to_db(untriaged_open_issues, lang_to_stats): + timestamp = time() + client = bigquery.Client() + dataset_ref = client.dataset('github_issues') + table_ref = dataset_ref.table('untriaged_issues') + table = client.get_table(table_ref) + errors = client.insert_rows(table, [(timestamp, untriaged_open_issues)]) + table_ref = dataset_ref.table('bug_stats') + table = client.get_table(table_ref) + rows = [] + for lang, stats in lang_to_stats.iteritems(): + rows.append((timestamp, lang.name[5:]) + tuple(stats)) + errors = client.insert_rows(table, rows) + + +def fetch(): + untriaged_open_issues, lang_to_stats = get_stats_from_github() + insert_stats_to_db(untriaged_open_issues, lang_to_stats) diff --git a/tools/gcp/github_stats_tracking/main.py b/tools/gcp/github_stats_tracking/main.py new file mode 100644 index 00000000000..f1e7ca6d981 --- /dev/null +++ b/tools/gcp/github_stats_tracking/main.py @@ -0,0 +1,29 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import webapp2 +from fetch_data import fetch + + +class DailyCron(webapp2.RequestHandler): + + def get(self): + fetch() + self.response.status = 204 + + +app = webapp2.WSGIApplication( + [ + ('/daily', DailyCron), + ], debug=True) From a08f043b59fe2820f25d296629cac3948a1b67c4 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 20 Aug 2019 08:05:27 -0700 Subject: [PATCH 389/661] add missing build deps --- BUILD | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BUILD b/BUILD index c510757c35d..1ce579812d1 100644 --- a/BUILD +++ b/BUILD @@ -1215,6 +1215,7 @@ grpc_cc_library( "grpc_client_channel", "grpc_lb_upb", "grpc_resolver_fake", + "grpc_transport_chttp2_client_insecure", ], ) @@ -1241,6 +1242,7 @@ grpc_cc_library( "grpc_lb_upb", "grpc_resolver_fake", "grpc_secure", + "grpc_transport_chttp2_client_secure", ], ) @@ -1264,6 +1266,7 @@ grpc_cc_library( "grpc_base", "grpc_client_channel", "grpc_resolver_fake", + "grpc_transport_chttp2_client_insecure", ], ) @@ -1288,6 +1291,7 @@ grpc_cc_library( "grpc_client_channel", "grpc_resolver_fake", "grpc_secure", + "grpc_transport_chttp2_client_secure", ], ) From 66675437aaa13ff3b46042835c61d6e056f47886 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Tue, 20 Aug 2019 08:37:26 -0700 Subject: [PATCH 390/661] Bump YAPF to use Python 3 --- tools/distrib/yapf_code.sh | 2 +- tools/run_tests/sanity/check_bazel_workspace.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/distrib/yapf_code.sh b/tools/distrib/yapf_code.sh index 27c5e3129dd..1fddb706498 100755 --- a/tools/distrib/yapf_code.sh +++ b/tools/distrib/yapf_code.sh @@ -30,7 +30,7 @@ EXCLUSIONS=( VIRTUALENV=yapf_virtual_environment -python -m virtualenv $VIRTUALENV +python3 -m virtualenv $VIRTUALENV PYTHON=${VIRTUALENV}/bin/python "$PYTHON" -m pip install --upgrade pip==10.0.1 "$PYTHON" -m pip install --upgrade futures diff --git a/tools/run_tests/sanity/check_bazel_workspace.py b/tools/run_tests/sanity/check_bazel_workspace.py index d7634bd611b..73b13a883d8 100755 --- a/tools/run_tests/sanity/check_bazel_workspace.py +++ b/tools/run_tests/sanity/check_bazel_workspace.py @@ -136,7 +136,7 @@ build_rules = { 'git_repository': lambda **args: eval_state.git_repository(**args), 'grpc_python_deps': lambda: None, } -exec (bazel_file) in build_rules +exec(bazel_file) in build_rules for name in _GRPC_DEP_NAMES: assert name in names_and_urls.keys() assert len(_GRPC_DEP_NAMES) == len(names_and_urls.keys()) @@ -179,7 +179,7 @@ for name in _GRPC_DEP_NAMES: 'git_repository': lambda **args: state.git_repository(**args), 'grpc_python_deps': lambda *args, **kwargs: None, } - exec (bazel_file) in rules + exec(bazel_file) in rules assert name not in names_and_urls_with_overridden_name.keys() sys.exit(0) From 853a6318b439b4bed1ea0707831b5d726ce286f1 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Tue, 20 Aug 2019 08:43:32 -0700 Subject: [PATCH 391/661] Correct the disable pattern --- src/python/grpcio_tests/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/grpcio_tests/commands.py b/src/python/grpcio_tests/commands.py index a3912cda712..aa947329230 100644 --- a/src/python/grpcio_tests/commands.py +++ b/src/python/grpcio_tests/commands.py @@ -156,7 +156,7 @@ class TestGevent(setuptools.Command): # TODO(https://github.com/grpc/grpc/issues/15411) enable this test 'unit._cython._channel_test.ChannelTest.test_negative_deadline_connectivity' # TODO(https://github.com/grpc/grpc/issues/15411) enable this test - 'unit._local_credentials_test.LocalCredentialsTest.test_local_tcp', + 'unit._local_credentials_test.LocalCredentialsTest', ) BANNED_WINDOWS_TESTS = ( # TODO(https://github.com/grpc/grpc/pull/15411) enable this test From 17bc1cecf4f53874d765d482032704e41ecd3e6f Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 20 Aug 2019 09:26:14 -0700 Subject: [PATCH 392/661] Increase timeout for macos/grpc-node test to 120 minutes --- tools/internal_ci/macos/grpc_basictests_node.cfg | 2 +- tools/internal_ci/macos/pull_request/grpc_basictests_node.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/internal_ci/macos/grpc_basictests_node.cfg b/tools/internal_ci/macos/grpc_basictests_node.cfg index 9dfd6a7b9e8..b2ea7bc505c 100644 --- a/tools/internal_ci/macos/grpc_basictests_node.cfg +++ b/tools/internal_ci/macos/grpc_basictests_node.cfg @@ -17,7 +17,7 @@ # Location of the continuous shell script in repository. build_file: "grpc/tools/internal_ci/macos/grpc_run_tests_matrix.sh" gfile_resources: "/bigstore/grpc-testing-secrets/gcp_credentials/GrpcTesting-d0eeee2db331.json" -timeout_mins: 60 +timeout_mins: 120 action { define_artifacts { regex: "**/*sponge_log.*" diff --git a/tools/internal_ci/macos/pull_request/grpc_basictests_node.cfg b/tools/internal_ci/macos/pull_request/grpc_basictests_node.cfg index ed729ef5a91..e0eed76f4bb 100644 --- a/tools/internal_ci/macos/pull_request/grpc_basictests_node.cfg +++ b/tools/internal_ci/macos/pull_request/grpc_basictests_node.cfg @@ -17,7 +17,7 @@ # Location of the continuous shell script in repository. build_file: "grpc/tools/internal_ci/macos/grpc_run_tests_matrix.sh" gfile_resources: "/bigstore/grpc-testing-secrets/gcp_credentials/GrpcTesting-d0eeee2db331.json" -timeout_mins: 60 +timeout_mins: 120 action { define_artifacts { regex: "**/*sponge_log.*" From 5877f2e56b0b7c2c65cc0cda213cc4becb815418 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Tue, 20 Aug 2019 10:54:48 -0700 Subject: [PATCH 393/661] Fixing gcc8's no-unknown-warning-option issue. Before gcc8, it was ignoring any unknown -Wno-* command, leaving clang's -Wno-unknown-warning-option to mix. That's no longer the case. --- Makefile | 8 +++++++- build.yaml | 2 +- grpc.gyp | 6 +++--- templates/Makefile.template | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index a0692f38d20..ec88bd3926c 100644 --- a/Makefile +++ b/Makefile @@ -330,6 +330,12 @@ ifeq ($(HAS_WORKING_NO_MAYBE_UNINITIALIZED),true) W_NO_MAYBE_UNINITIALIZED=-Wno-maybe-uninitialized NO_W_NO_MAYBE_UNINITIALIZED=-Wmaybe-uninitialized endif +CHECK_NO_UNKNOWN_WARNING_OPTION_WORKS_CMD = $(CC) -std=c99 -Werror -Wno-unknown-warning-option -o $(TMPOUT) -c test/build/no-unknown-warning-option.c +HAS_WORKING_NO_UNKNOWN_WARNING_OPTION = $(shell $(CHECK_NO_UNKNOWN_WARNING_OPTION_WORKS_CMD) 2> /dev/null && echo true || echo false) +ifeq ($(HAS_WORKING_NO_UNKNOWN_WARNING_OPTION),true) +W_NO_UNKNOWN_WARNING_OPTION=-Wno-unknown-warning-option +NO_W_NO_UNKNOWN_WARNING_OPTION=-Wunknown-warning-option +endif # The HOST compiler settings are used to compile the protoc plugins. # In most cases, you won't have to change anything, but if you are @@ -348,7 +354,7 @@ CXXFLAGS += -stdlib=libc++ LDFLAGS += -framework CoreFoundation endif CXXFLAGS += -Wnon-virtual-dtor -CPPFLAGS += -g -Wall -Wextra -Werror -Wno-unknown-warning-option -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/nanopb -Ithird_party/upb -Isrc/core/ext/upb-generated +CPPFLAGS += -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/nanopb -Ithird_party/upb -Isrc/core/ext/upb-generated COREFLAGS += -fno-rtti -fno-exceptions LDFLAGS += -g diff --git a/build.yaml b/build.yaml index 7431dbb2a53..f43964408d4 100644 --- a/build.yaml +++ b/build.yaml @@ -6199,7 +6199,7 @@ defaults: CXXFLAGS: $(W_NO_CXX14_COMPAT) global: COREFLAGS: -fno-rtti -fno-exceptions - CPPFLAGS: -g -Wall -Wextra -Werror -Wno-unknown-warning-option -Wno-long-long + CPPFLAGS: -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/nanopb diff --git a/grpc.gyp b/grpc.gyp index ba847d99548..1e0a0f766ee 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -55,7 +55,7 @@ '-Wall', '-Wextra', '-Werror', - '-Wno-unknown-warning-option', + '$(W_NO_UNKNOWN_WARNING_OPTION)', '-Wno-long-long', '-Wno-unused-parameter', '-Wno-deprecated-declarations', @@ -146,7 +146,7 @@ '-Wall', '-Wextra', '-Werror', - '-Wno-unknown-warning-option', + '$(W_NO_UNKNOWN_WARNING_OPTION)', '-Wno-long-long', '-Wno-unused-parameter', '-Wno-deprecated-declarations', @@ -168,7 +168,7 @@ '-Wall', '-Wextra', '-Werror', - '-Wno-unknown-warning-option', + '$(W_NO_UNKNOWN_WARNING_OPTION)', '-Wno-long-long', '-Wno-unused-parameter', '-Wno-deprecated-declarations', diff --git a/templates/Makefile.template b/templates/Makefile.template index c7f8a05739e..89415fa69b5 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -37,7 +37,7 @@ # warnings we'd like, but that dont exist in all compilers PREFERRED_WARNINGS=['extra-semi'] - CHECK_WARNINGS=PREFERRED_WARNINGS + ['no-shift-negative-value', 'no-unused-but-set-variable', 'no-maybe-uninitialized'] + CHECK_WARNINGS=PREFERRED_WARNINGS + ['no-shift-negative-value', 'no-unused-but-set-variable', 'no-maybe-uninitialized', 'no-unknown-warning-option'] def warning_var(fmt, warning): return fmt % warning.replace('-', '_').replace('+', 'X').upper() From 257737f2c63b85ec760e0375f430dccb6e71420d Mon Sep 17 00:00:00 2001 From: Hope Casey-Allen Date: Tue, 20 Aug 2019 11:18:45 -0700 Subject: [PATCH 394/661] Fix warning in client_idle_filter.cc to support gcc8 --- src/core/ext/filters/client_idle/client_idle_filter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/filters/client_idle/client_idle_filter.cc b/src/core/ext/filters/client_idle/client_idle_filter.cc index 13c35ae3730..0e598b0649a 100644 --- a/src/core/ext/filters/client_idle/client_idle_filter.cc +++ b/src/core/ext/filters/client_idle/client_idle_filter.cc @@ -370,7 +370,7 @@ void ChannelData::EnterIdle() { // Hold a ref to the channel stack for the transport op. GRPC_CHANNEL_STACK_REF(channel_stack_, "idle transport op"); // Initialize the transport op. - memset(&idle_transport_op_, 0, sizeof(idle_transport_op_)); + idle_transport_op_ = {}; idle_transport_op_.disconnect_with_error = grpc_error_set_int( GRPC_ERROR_CREATE_FROM_STATIC_STRING("enter idle"), GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE, GRPC_CHANNEL_IDLE); From 5bf71fa4b77083bf4c48155bcddaf73e33b5b650 Mon Sep 17 00:00:00 2001 From: Hope Casey-Allen Date: Tue, 20 Aug 2019 11:50:58 -0700 Subject: [PATCH 395/661] Add a developer trick to the installation doc, reorganize a bit --- BUILDING.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/BUILDING.md b/BUILDING.md index 615b371db6e..e4269a25956 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -14,6 +14,7 @@ If you plan to build from source and run tests, install the following as well: $ [sudo] apt-get install libgflags-dev libgtest-dev $ [sudo] apt-get install clang libc++-dev ``` +Lastly, see the Protoc section below if you do not yet have the protoc compiler installed. ## MacOS @@ -46,6 +47,7 @@ installed by `brew` is being used: ```sh $ LIBTOOL=glibtool LIBTOOLIZE=glibtoolize make ``` +Lastly, see the Protoc section below if you do not yet have the protoc compiler. ## Windows @@ -112,6 +114,12 @@ From the grpc repository root ```sh $ make ``` +NOTE: if you get an error on linux such as 'aclocal-1.15: command not found', which can happen if you ran 'make' before installing the pre-reqs, try the following: +```sh +$ git clean -f -d -x && git submodule foreach --recursive git clean -f -d -x +$ [sudo] apt-get install build-essential autoconf libtool pkg-config +$ make +``` ## bazel From b49ba51f84c24b46b7ab4c42c3fb160c6cd94df5 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Tue, 20 Aug 2019 12:38:18 -0700 Subject: [PATCH 396/661] Forgot one file. --- test/build/no-unknown-warning-option.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/build/no-unknown-warning-option.c diff --git a/test/build/no-unknown-warning-option.c b/test/build/no-unknown-warning-option.c new file mode 100644 index 00000000000..0c1771c7bbd --- /dev/null +++ b/test/build/no-unknown-warning-option.c @@ -0,0 +1,19 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +int main(void) {} From eabc64d1967bba0e70d0def189167d42d68bdf43 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Tue, 20 Aug 2019 13:13:49 -0700 Subject: [PATCH 397/661] Add v1.23.0 to interop matrix --- tools/interop_matrix/client_matrix.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py index 51a47d92f97..a98440b3109 100644 --- a/tools/interop_matrix/client_matrix.py +++ b/tools/interop_matrix/client_matrix.py @@ -99,6 +99,7 @@ LANG_RELEASE_MATRIX = { ('v1.20.0', ReleaseInfo()), ('v1.21.4', ReleaseInfo()), ('v1.22.0', ReleaseInfo()), + ('v1.23.0', ReleaseInfo()), ]), 'go': OrderedDict( @@ -214,6 +215,7 @@ LANG_RELEASE_MATRIX = { ('v1.20.0', ReleaseInfo()), ('v1.21.4', ReleaseInfo()), ('v1.22.0', ReleaseInfo()), + ('v1.23.0', ReleaseInfo()), ]), 'node': OrderedDict([ @@ -264,6 +266,7 @@ LANG_RELEASE_MATRIX = { ('v1.20.0', ReleaseInfo()), ('v1.21.4', ReleaseInfo()), ('v1.22.0', ReleaseInfo()), + ('v1.23.0', ReleaseInfo()), # TODO: https://github.com/grpc/grpc/issues/18262. # If you are not encountering the error in above issue # go ahead and upload the docker image for new releases. @@ -292,6 +295,7 @@ LANG_RELEASE_MATRIX = { # See https://github.com/grpc/grpc/issues/18264 ('v1.21.4', ReleaseInfo()), ('v1.22.0', ReleaseInfo()), + ('v1.23.0', ReleaseInfo()), ]), 'csharp': OrderedDict([ @@ -323,5 +327,6 @@ LANG_RELEASE_MATRIX = { ('v1.20.0', ReleaseInfo()), ('v1.21.4', ReleaseInfo()), ('v1.22.0', ReleaseInfo()), + ('v1.23.0', ReleaseInfo()), ]), } From 09c55da6c2a2de682fa31acd0d2d313109cdb353 Mon Sep 17 00:00:00 2001 From: Christopher Warrington Date: Tue, 7 May 2019 12:14:40 -0700 Subject: [PATCH 398/661] Update Google Benchmark v1.5.0 to get CMake < 3.6 fix Google Benchmark v1.4.1 uses a CMake feature that is only in version >= 3.6. This was an inadvertent change in Google Benchmark (too high of a version) that has been [fixed upstream][1] in v1.5.0. Google Benchmark v1.5.0 now requires CMake >= 3.5.1. [Another PR][2] will bump gRPC's minimum version as well. [1]: https://github.com/google/benchmark/commit/505be96ab23056580a3a2315abba048f4428b04e [2]: https://github.com/grpc/grpc/pull/19467 --- third_party/benchmark | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/benchmark b/third_party/benchmark index e776aa0275e..090faecb454 160000 --- a/third_party/benchmark +++ b/third_party/benchmark @@ -1 +1 @@ -Subproject commit e776aa0275e293707b6a0901e0e8d8a8a3679508 +Subproject commit 090faecb454fbd6e6e17a75ef8146acb037118d4 From 09a270d6ad5632538b4f0e11a9cda9898b3491d1 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 20 Aug 2019 13:38:55 -0700 Subject: [PATCH 399/661] Gracefully handle errors from callbacks. In https://github.com/grpc/grpc/issues/19910, it was pointed out that raising an exception from a Future callback would cause the channel spin thread to terminate. If there are outstanding events on the channel, this will cause calls to Channel.close() to block indefinitely. This commit ensures that the channel spin thread does not die. Instead, exceptions will be logged at ERROR level. --- src/python/grpcio/grpc/__init__.py | 3 + src/python/grpcio/grpc/_channel.py | 11 ++- .../tests/unit/_channel_close_test.py | 67 ++++++++++++++++--- 3 files changed, 71 insertions(+), 10 deletions(-) diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index 7dae90c89e8..e14db7906da 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -192,6 +192,9 @@ class Future(six.with_metaclass(abc.ABCMeta)): If the computation has already completed, the callback will be called immediately. + Exceptions raised in the callback will be logged at ERROR level, but + will not terminate any threads of execution. + Args: fn: A callable taking this Future object as its single parameter. """ diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index 0bf8e03b5ce..b19c64d3a6e 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -159,7 +159,14 @@ def _event_handler(state, response_deserializer): state.condition.notify_all() done = not state.due for callback in callbacks: - callback() + # TODO(gnossen): Are these *only* user callbacks? + try: + callback() + except Exception as e: # pylint: disable=broad-except + # NOTE(rbellevi): We suppress but log errors here so as not to + # kill the channel spin thread. + logging.error('Exception in callback %s: %s', repr( + callback.func), repr(e)) return done and state.fork_epoch >= cygrpc.get_fork_epoch() return handle_event @@ -338,7 +345,7 @@ class _Rendezvous(grpc.RpcError, grpc.Future, grpc.Call): # pylint: disable=too def add_done_callback(self, fn): with self._state.condition: if self._state.code is None: - self._state.callbacks.append(lambda: fn(self)) + self._state.callbacks.append(functools.partial(fn, self)) return fn(self) diff --git a/src/python/grpcio_tests/tests/unit/_channel_close_test.py b/src/python/grpcio_tests/tests/unit/_channel_close_test.py index 82fa1657109..571504c6e3f 100644 --- a/src/python/grpcio_tests/tests/unit/_channel_close_test.py +++ b/src/python/grpcio_tests/tests/unit/_channel_close_test.py @@ -27,8 +27,11 @@ _BEAT = 0.5 _SOME_TIME = 5 _MORE_TIME = 10 +_STREAM_URI = 'Meffod' +_UNARY_URI = 'MeffodMan' -class _MethodHandler(grpc.RpcMethodHandler): + +class _StreamingMethodHandler(grpc.RpcMethodHandler): request_streaming = True response_streaming = True @@ -40,13 +43,28 @@ class _MethodHandler(grpc.RpcMethodHandler): yield request * 2 -_METHOD_HANDLER = _MethodHandler() +class _UnaryMethodHandler(grpc.RpcMethodHandler): + + request_streaming = False + response_streaming = False + request_deserializer = None + response_serializer = None + + def unary_unary(self, request, servicer_context): + return request * 2 + + +_STREAMING_METHOD_HANDLER = _StreamingMethodHandler() +_UNARY_METHOD_HANDLER = _UnaryMethodHandler() class _GenericHandler(grpc.GenericRpcHandler): def service(self, handler_call_details): - return _METHOD_HANDLER + if handler_call_details.method == _STREAM_URI: + return _STREAMING_METHOD_HANDLER + else: + return _UNARY_METHOD_HANDLER _GENERIC_HANDLER = _GenericHandler() @@ -94,6 +112,24 @@ class _Pipe(object): self.close() +class EndlessIterator(object): + + def __init__(self, msg): + self._msg = msg + + def __iter__(self): + return self + + def _next(self): + return self._msg + + def __next__(self): + return self._next() + + def next(self): + return self._next() + + class ChannelCloseTest(unittest.TestCase): def setUp(self): @@ -108,7 +144,7 @@ class ChannelCloseTest(unittest.TestCase): def test_close_immediately_after_call_invocation(self): channel = grpc.insecure_channel('localhost:{}'.format(self._port)) - multi_callable = channel.stream_stream('Meffod') + multi_callable = channel.stream_stream(_STREAM_URI) request_iterator = _Pipe(()) response_iterator = multi_callable(request_iterator) channel.close() @@ -118,7 +154,7 @@ class ChannelCloseTest(unittest.TestCase): def test_close_while_call_active(self): channel = grpc.insecure_channel('localhost:{}'.format(self._port)) - multi_callable = channel.stream_stream('Meffod') + multi_callable = channel.stream_stream(_STREAM_URI) request_iterator = _Pipe((b'abc',)) response_iterator = multi_callable(request_iterator) next(response_iterator) @@ -130,7 +166,7 @@ class ChannelCloseTest(unittest.TestCase): def test_context_manager_close_while_call_active(self): with grpc.insecure_channel('localhost:{}'.format( self._port)) as channel: # pylint: disable=bad-continuation - multi_callable = channel.stream_stream('Meffod') + multi_callable = channel.stream_stream(_STREAM_URI) request_iterator = _Pipe((b'abc',)) response_iterator = multi_callable(request_iterator) next(response_iterator) @@ -141,7 +177,7 @@ class ChannelCloseTest(unittest.TestCase): def test_context_manager_close_while_many_calls_active(self): with grpc.insecure_channel('localhost:{}'.format( self._port)) as channel: # pylint: disable=bad-continuation - multi_callable = channel.stream_stream('Meffod') + multi_callable = channel.stream_stream(_STREAM_URI) request_iterators = tuple( _Pipe((b'abc',)) for _ in range(test_constants.THREAD_CONCURRENCY)) @@ -158,7 +194,7 @@ class ChannelCloseTest(unittest.TestCase): def test_many_concurrent_closes(self): channel = grpc.insecure_channel('localhost:{}'.format(self._port)) - multi_callable = channel.stream_stream('Meffod') + multi_callable = channel.stream_stream(_STREAM_URI) request_iterator = _Pipe((b'abc',)) response_iterator = multi_callable(request_iterator) next(response_iterator) @@ -181,6 +217,21 @@ class ChannelCloseTest(unittest.TestCase): self.assertIs(response_iterator.code(), grpc.StatusCode.CANCELLED) + def test_exception_in_callback(self): + with grpc.insecure_channel('localhost:{}'.format( + self._port)) as channel: + stream_multi_callable = channel.stream_stream(_STREAM_URI) + request_iterator = (str(i).encode('ascii') for i in range(9999)) + endless_iterator = EndlessIterator(b'abc') + stream_response_iterator = stream_multi_callable(endless_iterator) + future = channel.unary_unary(_UNARY_URI).future(b'abc') + + def on_done_callback(future): + raise Exception("This should not cause a deadlock.") + + future.add_done_callback(on_done_callback) + future.result() + if __name__ == '__main__': logging.basicConfig() From ee99f9aa4c45e9d29c7649ac5a4e0690c26534f8 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 20 Aug 2019 14:25:14 -0700 Subject: [PATCH 400/661] Remove TODO --- src/python/grpcio/grpc/_channel.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index b19c64d3a6e..f1584940a86 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -159,7 +159,6 @@ def _event_handler(state, response_deserializer): state.condition.notify_all() done = not state.due for callback in callbacks: - # TODO(gnossen): Are these *only* user callbacks? try: callback() except Exception as e: # pylint: disable=broad-except From d273fdf41d557f126fe227a0c8858397c0effca7 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 20 Aug 2019 14:26:22 -0700 Subject: [PATCH 401/661] Remove line of dead code --- src/python/grpcio_tests/tests/unit/_channel_close_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/python/grpcio_tests/tests/unit/_channel_close_test.py b/src/python/grpcio_tests/tests/unit/_channel_close_test.py index 571504c6e3f..6004c25cc30 100644 --- a/src/python/grpcio_tests/tests/unit/_channel_close_test.py +++ b/src/python/grpcio_tests/tests/unit/_channel_close_test.py @@ -221,7 +221,6 @@ class ChannelCloseTest(unittest.TestCase): with grpc.insecure_channel('localhost:{}'.format( self._port)) as channel: stream_multi_callable = channel.stream_stream(_STREAM_URI) - request_iterator = (str(i).encode('ascii') for i in range(9999)) endless_iterator = EndlessIterator(b'abc') stream_response_iterator = stream_multi_callable(endless_iterator) future = channel.unary_unary(_UNARY_URI).future(b'abc') From 090b4f30ed80cbfac06fcbb7da18c3c1cfacde78 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Tue, 20 Aug 2019 14:35:31 -0700 Subject: [PATCH 402/661] Add version 1.22.1 to interop test matrix --- tools/interop_matrix/client_matrix.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py index a98440b3109..6129b658793 100644 --- a/tools/interop_matrix/client_matrix.py +++ b/tools/interop_matrix/client_matrix.py @@ -99,6 +99,7 @@ LANG_RELEASE_MATRIX = { ('v1.20.0', ReleaseInfo()), ('v1.21.4', ReleaseInfo()), ('v1.22.0', ReleaseInfo()), + ('v1.22.1', ReleaseInfo()), ('v1.23.0', ReleaseInfo()), ]), 'go': @@ -215,6 +216,7 @@ LANG_RELEASE_MATRIX = { ('v1.20.0', ReleaseInfo()), ('v1.21.4', ReleaseInfo()), ('v1.22.0', ReleaseInfo()), + ('v1.22.1', ReleaseInfo()), ('v1.23.0', ReleaseInfo()), ]), 'node': @@ -266,6 +268,7 @@ LANG_RELEASE_MATRIX = { ('v1.20.0', ReleaseInfo()), ('v1.21.4', ReleaseInfo()), ('v1.22.0', ReleaseInfo()), + ('v1.22.1', ReleaseInfo()), ('v1.23.0', ReleaseInfo()), # TODO: https://github.com/grpc/grpc/issues/18262. # If you are not encountering the error in above issue @@ -295,6 +298,7 @@ LANG_RELEASE_MATRIX = { # See https://github.com/grpc/grpc/issues/18264 ('v1.21.4', ReleaseInfo()), ('v1.22.0', ReleaseInfo()), + ('v1.22.1', ReleaseInfo()), ('v1.23.0', ReleaseInfo()), ]), 'csharp': @@ -327,6 +331,7 @@ LANG_RELEASE_MATRIX = { ('v1.20.0', ReleaseInfo()), ('v1.21.4', ReleaseInfo()), ('v1.22.0', ReleaseInfo()), + ('v1.22.1', ReleaseInfo()), ('v1.23.0', ReleaseInfo()), ]), } From 662919cf901287618c5d56f2a216cb386607d831 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 20 Aug 2019 14:49:57 -0700 Subject: [PATCH 403/661] Simplify with itertools --- .../tests/unit/_channel_close_test.py | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/python/grpcio_tests/tests/unit/_channel_close_test.py b/src/python/grpcio_tests/tests/unit/_channel_close_test.py index 6004c25cc30..47f52b4890e 100644 --- a/src/python/grpcio_tests/tests/unit/_channel_close_test.py +++ b/src/python/grpcio_tests/tests/unit/_channel_close_test.py @@ -13,6 +13,7 @@ # limitations under the License. """Tests server and client side compression.""" +import itertools import logging import threading import time @@ -112,24 +113,6 @@ class _Pipe(object): self.close() -class EndlessIterator(object): - - def __init__(self, msg): - self._msg = msg - - def __iter__(self): - return self - - def _next(self): - return self._msg - - def __next__(self): - return self._next() - - def next(self): - return self._next() - - class ChannelCloseTest(unittest.TestCase): def setUp(self): @@ -221,7 +204,7 @@ class ChannelCloseTest(unittest.TestCase): with grpc.insecure_channel('localhost:{}'.format( self._port)) as channel: stream_multi_callable = channel.stream_stream(_STREAM_URI) - endless_iterator = EndlessIterator(b'abc') + endless_iterator = itertools.repeat(b'abc') stream_response_iterator = stream_multi_callable(endless_iterator) future = channel.unary_unary(_UNARY_URI).future(b'abc') From 2c9cff30a1efc6abc689a7205467dbf251903ec2 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Tue, 20 Aug 2019 14:52:20 -0700 Subject: [PATCH 404/661] Fix typo in the ignore list... --- src/python/grpcio_tests/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/grpcio_tests/commands.py b/src/python/grpcio_tests/commands.py index aa947329230..61d8bdc1f7b 100644 --- a/src/python/grpcio_tests/commands.py +++ b/src/python/grpcio_tests/commands.py @@ -154,7 +154,7 @@ class TestGevent(setuptools.Command): 'channelz._channelz_servicer_test.ChannelzServicerTest.test_many_subchannels_and_sockets', 'channelz._channelz_servicer_test.ChannelzServicerTest.test_streaming_rpc', # TODO(https://github.com/grpc/grpc/issues/15411) enable this test - 'unit._cython._channel_test.ChannelTest.test_negative_deadline_connectivity' + 'unit._cython._channel_test.ChannelTest.test_negative_deadline_connectivity', # TODO(https://github.com/grpc/grpc/issues/15411) enable this test 'unit._local_credentials_test.LocalCredentialsTest', ) From f276b89f1163ea10d6de270ea1b69eee18a106d2 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Tue, 20 Aug 2019 15:16:32 -0700 Subject: [PATCH 405/661] Fix issue/PR template --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/pull_request_template.md | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 6eafaacd034..f3ed8399dc2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,7 @@ --- name: Report a bug about: Create a report to help us improve -labels: kind/bug +labels: kind/bug, priority/P2 assignees: AspirinSJL --- diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 31f574ef60d..fba14a5db00 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,5 +1,11 @@ - + + @AspirinSJL \ No newline at end of file From 25f21d4824d57e77d43990b243b1a74ccbc18cfc Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Tue, 20 Aug 2019 09:13:22 -0700 Subject: [PATCH 406/661] Make default vtable for pointer argumnet a constant --- .../grpcio/grpc/_cython/_cygrpc/arguments.pxd.pxi | 2 +- .../grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi | 8 ++++---- src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi | 4 ++-- .../grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi | 1 - .../grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi | 4 +--- src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi | 1 - src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi | 5 ++--- src/python/grpcio/grpc/_cython/_cygrpc/tag.pxd.pxi | 1 - src/python/grpcio/grpc/_cython/_cygrpc/tag.pyx.pxi | 5 ++--- src/python/grpcio/grpc/_cython/_cygrpc/vtable.pxd.pxi | 5 +---- src/python/grpcio/grpc/_cython/_cygrpc/vtable.pyx.pxi | 11 ++++------- 11 files changed, 17 insertions(+), 30 deletions(-) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pxd.pxi index 9415b16344a..251efe15b39 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pxd.pxi @@ -23,7 +23,7 @@ cdef class _ChannelArg: cdef grpc_arg c_argument - cdef void c(self, argument, _VTable vtable, references) except * + cdef void c(self, argument, references) except * cdef class _ChannelArgs: diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi index 9211354b1ca..e121ea60395 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi @@ -33,7 +33,7 @@ cdef grpc_arg _unwrap_grpc_arg(tuple wrapped_arg): cdef class _ChannelArg: - cdef void c(self, argument, _VTable vtable, references) except *: + cdef void c(self, argument, references) except *: key, value = argument cdef bytes encoded_key = _encode(key) if encoded_key is not key: @@ -56,7 +56,7 @@ cdef class _ChannelArg: # lifecycle of the pointer is fixed to the lifecycle of the # python object wrapping it. self.c_argument.type = GRPC_ARG_POINTER - self.c_argument.value.pointer.vtable = &vtable.c_vtable + self.c_argument.value.pointer.vtable = &default_vtable self.c_argument.value.pointer.address = (int(value)) else: raise TypeError( @@ -65,7 +65,7 @@ cdef class _ChannelArg: cdef class _ChannelArgs: - def __cinit__(self, arguments, _VTable vtable not None): + def __cinit__(self, arguments): self._arguments = () if arguments is None else tuple(arguments) self._channel_args = [] self._references = [] @@ -75,7 +75,7 @@ cdef class _ChannelArgs: self._c_arguments.arguments_length * sizeof(grpc_arg)) for index, argument in enumerate(self._arguments): channel_arg = _ChannelArg() - channel_arg.c(argument, vtable, self._references) + channel_arg.c(argument, self._references) self._c_arguments.arguments[index] = channel_arg.c_argument self._channel_args.append(channel_arg) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi index 84934db4d60..6e4574af8d5 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi @@ -17,11 +17,11 @@ cimport cpython cdef class Call: - def __cinit__(self, _VTable vtable not None): + def __cinit__(self): # Create an *empty* call fork_handlers_and_grpc_init() self.c_call = NULL - self.references = [vtable] + self.references = [] def _start_batch(self, operations, tag, retain_self): if not self.is_valid: diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi index 13c0c02ab21..eb27f2df7ad 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi @@ -69,7 +69,6 @@ cdef class SegregatedCall: cdef class Channel: cdef _ChannelState _state - cdef _VTable _vtable # TODO(https://github.com/grpc/grpc/issues/15662): Eliminate this. cdef tuple _arguments diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi index 1799780fce4..70bc8dbed7e 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi @@ -455,9 +455,7 @@ cdef class Channel: self._state.c_connectivity_completion_queue = ( grpc_completion_queue_create_for_next(NULL)) self._arguments = arguments - self._vtable = _VTable() - cdef _ChannelArgs channel_args = _ChannelArgs( - arguments, self._vtable) + cdef _ChannelArgs channel_args = _ChannelArgs(arguments) if channel_credentials is None: self._state.c_channel = grpc_insecure_channel_create( target, channel_args.c_args(), NULL) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi index b3fadcdc62d..b89ed99d97b 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi @@ -16,7 +16,6 @@ cdef class Server: cdef grpc_server *c_server - cdef _VTable _vtable cdef bint is_started # start has been called cdef bint is_shutting_down # shutdown has been called cdef bint is_shutdown # notification of complete shutdown received diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi index 2369371cabe..67b2e9d4e88 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi @@ -31,8 +31,7 @@ cdef class Server: self.is_shutting_down = False self.is_shutdown = False self.c_server = NULL - self._vtable = _VTable() - cdef _ChannelArgs channel_args = _ChannelArgs(arguments, self._vtable) + cdef _ChannelArgs channel_args = _ChannelArgs(arguments) self.c_server = grpc_server_create(channel_args.c_args(), NULL) self.references.append(arguments) @@ -43,7 +42,7 @@ cdef class Server: raise ValueError("server must be started and not shutting down") if server_queue not in self.registered_completion_queues: raise ValueError("server_queue must be a registered completion queue") - cdef _RequestCallTag request_call_tag = _RequestCallTag(tag, self._vtable) + cdef _RequestCallTag request_call_tag = _RequestCallTag(tag) request_call_tag.prepare() cpython.Py_INCREF(request_call_tag) return grpc_server_request_call( diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/tag.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/tag.pxd.pxi index c77beb28194..d8ba1ea9bd5 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/tag.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/tag.pxd.pxi @@ -29,7 +29,6 @@ cdef class _RequestCallTag(_Tag): cdef readonly object _user_tag cdef Call call - cdef _VTable _vtable cdef CallDetails call_details cdef grpc_metadata_array c_invocation_metadata diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/tag.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/tag.pyx.pxi index d1280ef4948..e80dc88767e 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/tag.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/tag.pyx.pxi @@ -30,14 +30,13 @@ cdef class _ConnectivityTag(_Tag): cdef class _RequestCallTag(_Tag): - def __cinit__(self, user_tag, _VTable vtable not None): + def __cinit__(self, user_tag): self._user_tag = user_tag self.call = None self.call_details = None - self._vtable = vtable cdef void prepare(self) except *: - self.call = Call(self._vtable) + self.call = Call() self.call_details = CallDetails() grpc_metadata_array_init(&self.c_invocation_metadata) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/vtable.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/vtable.pxd.pxi index 1799b6e1f14..c96e5cb6696 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/vtable.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/vtable.pxd.pxi @@ -15,12 +15,9 @@ cdef void* _copy_pointer(void* pointer) - cdef void _destroy_pointer(void* pointer) - cdef int _compare_pointer(void* first_pointer, void* second_pointer) -cdef class _VTable: - cdef grpc_arg_pointer_vtable c_vtable +cdef grpc_arg_pointer_vtable default_vtable diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/vtable.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/vtable.pyx.pxi index 98cb60c10e3..da4b81bd97e 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/vtable.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/vtable.pyx.pxi @@ -30,10 +30,7 @@ cdef int _compare_pointer(void* first_pointer, void* second_pointer): else: return 0 - -cdef class _VTable: - def __cinit__(self): - self.c_vtable.copy = &_copy_pointer - self.c_vtable.destroy = &_destroy_pointer - self.c_vtable.cmp = &_compare_pointer - +cdef grpc_arg_pointer_vtable default_vtable +default_vtable.copy = &_copy_pointer +default_vtable.destroy = &_destroy_pointer +default_vtable.cmp = &_compare_pointer From 41986e8ed8c9da70ad6909ac376280512f386e3b Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Wed, 14 Aug 2019 12:08:24 -0700 Subject: [PATCH 407/661] Added test for timer wakeups --- CMakeLists.txt | 43 ++++++++ Makefile | 48 +++++++++ build.yaml | 11 ++ src/core/lib/iomgr/timer_manager.cc | 9 +- src/core/lib/iomgr/timer_manager.h | 2 + test/cpp/common/BUILD | 13 ++- test/cpp/common/timer_test.cc | 150 +++++++++++++++++++++++++++ tools/run_tests/generated/tests.json | 24 +++++ 8 files changed, 298 insertions(+), 2 deletions(-) create mode 100644 test/cpp/common/timer_test.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 86a77c95663..ce632d9e1fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -731,6 +731,7 @@ add_dependencies(buildtests_cxx thread_stress_test) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_cxx time_change_test) endif() +add_dependencies(buildtests_cxx timer_test) add_dependencies(buildtests_cxx transport_pid_controller_test) add_dependencies(buildtests_cxx transport_security_common_api_test) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) @@ -17679,6 +17680,48 @@ endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) +add_executable(timer_test + test/cpp/common/timer_test.cc + third_party/googletest/googletest/src/gtest-all.cc + third_party/googletest/googlemock/src/gmock-all.cc +) + + +target_include_directories(timer_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} + PRIVATE ${_gRPC_CARES_INCLUDE_DIR} + PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} + PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest + PRIVATE third_party/googletest/googlemock/include + PRIVATE third_party/googletest/googlemock + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(timer_test + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc_test_util + grpc++ + grpc + gpr + ${_gRPC_GFLAGS_LIBRARIES} +) + + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + add_executable(transport_pid_controller_test test/core/transport/pid_controller_test.cc third_party/googletest/googletest/src/gtest-all.cc diff --git a/Makefile b/Makefile index a0692f38d20..2f86c96d379 100644 --- a/Makefile +++ b/Makefile @@ -1287,6 +1287,7 @@ string_view_test: $(BINDIR)/$(CONFIG)/string_view_test thread_manager_test: $(BINDIR)/$(CONFIG)/thread_manager_test thread_stress_test: $(BINDIR)/$(CONFIG)/thread_stress_test time_change_test: $(BINDIR)/$(CONFIG)/time_change_test +timer_test: $(BINDIR)/$(CONFIG)/timer_test transport_pid_controller_test: $(BINDIR)/$(CONFIG)/transport_pid_controller_test transport_security_common_api_test: $(BINDIR)/$(CONFIG)/transport_security_common_api_test writes_per_rpc_test: $(BINDIR)/$(CONFIG)/writes_per_rpc_test @@ -1758,6 +1759,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/thread_manager_test \ $(BINDIR)/$(CONFIG)/thread_stress_test \ $(BINDIR)/$(CONFIG)/time_change_test \ + $(BINDIR)/$(CONFIG)/timer_test \ $(BINDIR)/$(CONFIG)/transport_pid_controller_test \ $(BINDIR)/$(CONFIG)/transport_security_common_api_test \ $(BINDIR)/$(CONFIG)/writes_per_rpc_test \ @@ -1926,6 +1928,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/thread_manager_test \ $(BINDIR)/$(CONFIG)/thread_stress_test \ $(BINDIR)/$(CONFIG)/time_change_test \ + $(BINDIR)/$(CONFIG)/timer_test \ $(BINDIR)/$(CONFIG)/transport_pid_controller_test \ $(BINDIR)/$(CONFIG)/transport_security_common_api_test \ $(BINDIR)/$(CONFIG)/writes_per_rpc_test \ @@ -2471,6 +2474,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/thread_stress_test || ( echo test thread_stress_test failed ; exit 1 ) $(E) "[RUN] Testing time_change_test" $(Q) $(BINDIR)/$(CONFIG)/time_change_test || ( echo test time_change_test failed ; exit 1 ) + $(E) "[RUN] Testing timer_test" + $(Q) $(BINDIR)/$(CONFIG)/timer_test || ( echo test timer_test failed ; exit 1 ) $(E) "[RUN] Testing transport_pid_controller_test" $(Q) $(BINDIR)/$(CONFIG)/transport_pid_controller_test || ( echo test transport_pid_controller_test failed ; exit 1 ) $(E) "[RUN] Testing transport_security_common_api_test" @@ -19809,6 +19814,49 @@ endif endif +TIMER_TEST_SRC = \ + test/cpp/common/timer_test.cc \ + +TIMER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(TIMER_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/timer_test: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+. + +$(BINDIR)/$(CONFIG)/timer_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/timer_test: $(PROTOBUF_DEP) $(TIMER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(TIMER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/timer_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/cpp/common/timer_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_timer_test: $(TIMER_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(TIMER_TEST_OBJS:.o=.dep) +endif +endif + + TRANSPORT_PID_CONTROLLER_TEST_SRC = \ test/core/transport/pid_controller_test.cc \ diff --git a/build.yaml b/build.yaml index 7431dbb2a53..7cebdd3c78d 100644 --- a/build.yaml +++ b/build.yaml @@ -5973,6 +5973,17 @@ targets: - mac - linux - posix +- name: timer_test + gtest: true + build: test + language: c++ + src: + - test/cpp/common/timer_test.cc + deps: + - grpc_test_util + - grpc++ + - grpc + - gpr - name: transport_pid_controller_test build: test language: c++ diff --git a/src/core/lib/iomgr/timer_manager.cc b/src/core/lib/iomgr/timer_manager.cc index 17cae5cd4c3..96d502c5108 100644 --- a/src/core/lib/iomgr/timer_manager.cc +++ b/src/core/lib/iomgr/timer_manager.cc @@ -18,6 +18,8 @@ #include +#include "src/core/lib/iomgr/timer_manager.h" + #include #include @@ -26,7 +28,6 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/timer.h" -#include "src/core/lib/iomgr/timer_manager.h" struct completed_thread { grpc_core::Thread thd; @@ -58,6 +59,8 @@ static bool g_has_timed_waiter; static grpc_millis g_timed_waiter_deadline; // generation counter to track which thread is waiting for the next timer static uint64_t g_timed_waiter_generation; +// number of timer wakeups +static uint64_t g_wakeups; static void timer_thread(void* completed_thread_ptr); @@ -206,6 +209,7 @@ static bool wait_until(grpc_millis next) { // that there's now no timed waiter... we'll look for a replacement if // there's work to do after checking timers (code above) if (my_timed_waiter_generation == g_timed_waiter_generation) { + ++g_wakeups; g_has_timed_waiter = false; g_timed_waiter_deadline = GRPC_MILLIS_INF_FUTURE; } @@ -326,6 +330,7 @@ static void stop_threads(void) { gc_completed_threads(); } } + g_wakeups = 0; gpr_mu_unlock(&g_mu); } @@ -354,3 +359,5 @@ void grpc_kick_poller(void) { gpr_cv_signal(&g_cv_wait); gpr_mu_unlock(&g_mu); } + +uint64_t grpc_timer_manager_get_wakeups_testonly(void) { return g_wakeups; } diff --git a/src/core/lib/iomgr/timer_manager.h b/src/core/lib/iomgr/timer_manager.h index 00dcdc461b5..d407cbbc2b7 100644 --- a/src/core/lib/iomgr/timer_manager.h +++ b/src/core/lib/iomgr/timer_manager.h @@ -35,5 +35,7 @@ void grpc_timer_manager_set_threading(bool enabled); /* explicitly perform one tick of the timer system - for when threading is * disabled */ void grpc_timer_manager_tick(void); +/* get global counter that tracks timer wakeups */ +uint64_t grpc_timer_manager_get_wakeups_testonly(void); #endif /* GRPC_CORE_LIB_IOMGR_TIMER_MANAGER_H */ diff --git a/test/cpp/common/BUILD b/test/cpp/common/BUILD index b67c1995ff7..f0d0e9a6223 100644 --- a/test/cpp/common/BUILD +++ b/test/cpp/common/BUILD @@ -28,7 +28,18 @@ grpc_cc_test( "//:grpc++_unsecure", "//test/core/util:grpc_test_util_unsecure", ], - tags = ["no_windows"], +) + +grpc_cc_test( + name = "timer_test", + srcs = ["timer_test.cc"], + external_deps = [ + "gtest", + ], + deps = [ + "//:grpc++", + "//test/core/util:grpc_test_util", + ], ) grpc_cc_test( diff --git a/test/cpp/common/timer_test.cc b/test/cpp/common/timer_test.cc new file mode 100644 index 00000000000..f5083d66e76 --- /dev/null +++ b/test/cpp/common/timer_test.cc @@ -0,0 +1,150 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include + +#include "src/core/lib/iomgr/closure.h" +#include "src/core/lib/iomgr/error.h" +#include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/lib/iomgr/timer.h" +#include "src/core/lib/iomgr/timer_manager.h" +#include "test/core/util/test_config.h" + +// MAYBE_SKIP_TEST is a macro to determine if this particular test configuration +// should be skipped based on a decision made at SetUp time. +#define MAYBE_SKIP_TEST \ + do { \ + if (do_not_test_) { \ + return; \ + } \ + } while (0) + +class TimerTest : public ::testing::Test { + protected: + void SetUp() override { + // Skip test if slowdown factor > 1. + do_not_test_ = (grpc_test_slowdown_factor() != 1); + grpc_init(); + } + + void TearDown() override { grpc_shutdown_blocking(); } + + bool do_not_test_{false}; +}; + +TEST_F(TimerTest, NoTimers) { + MAYBE_SKIP_TEST; + grpc_core::ExecCtx exec_ctx; + gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(1500)); + + // We expect to get 1 wakeup per second. Sometimes we also get a wakeup + // during initialization, so in 1.5 seconds we expect to get 1 or 2 wakeups. + int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); + GPR_ASSERT(wakeups == 1 || wakeups == 2); +} + +TEST_F(TimerTest, OneTimerExpires) { + MAYBE_SKIP_TEST; + grpc_core::ExecCtx exec_ctx; + grpc_timer timer; + int timer_fired = 0; + grpc_timer_init(&timer, 500, + GRPC_CLOSURE_CREATE( + [](void* arg, grpc_error*) { + int* timer_fired = static_cast(arg); + ++*timer_fired; + }, + &timer_fired, grpc_schedule_on_exec_ctx)); + gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(1500)); + GPR_ASSERT(1 == timer_fired); + + // We expect to get 1 wakeup/second + 1 wakeup for the expired timer + maybe 1 + // wakeup during initialization. i.e. in 1.5 seconds we expect 2 or 3 wakeups. + // Actual number of wakeups is more due to bug + // https://github.com/grpc/grpc/issues/19947 + int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); + gpr_log(GPR_DEBUG, "wakeups: %" PRId64 "", wakeups); +} + +TEST_F(TimerTest, MultipleTimersExpire) { + MAYBE_SKIP_TEST; + grpc_core::ExecCtx exec_ctx; + const int kNumTimers = 10; + grpc_timer timers[kNumTimers]; + int timer_fired = 0; + for (int i = 0; i < kNumTimers; ++i) { + grpc_timer_init(&timers[i], 500 + i, + GRPC_CLOSURE_CREATE( + [](void* arg, grpc_error*) { + int* timer_fired = static_cast(arg); + ++*timer_fired; + }, + &timer_fired, grpc_schedule_on_exec_ctx)); + } + + gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(1500)); + GPR_ASSERT(kNumTimers == timer_fired); + + // We expect to get 1 wakeup/second + 1 wakeup for per timer fired + maybe 1 + // wakeup during initialization. i.e. in 1.5 seconds we expect 11 or 12 + // wakeups. Actual number of wakeups is more due to bug + // https://github.com/grpc/grpc/issues/19947 + int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); + gpr_log(GPR_DEBUG, "wakeups: %" PRId64 "", wakeups); +} + +TEST_F(TimerTest, CancelSomeTimers) { + MAYBE_SKIP_TEST; + grpc_core::ExecCtx exec_ctx; + const int kNumTimers = 10; + grpc_timer timers[kNumTimers]; + int timer_fired = 0; + for (int i = 0; i < kNumTimers; ++i) { + grpc_timer_init(&timers[i], 500 + i, + GRPC_CLOSURE_CREATE( + [](void* arg, grpc_error* error) { + if (error == GRPC_ERROR_CANCELLED) { + return; + } + int* timer_fired = static_cast(arg); + ++*timer_fired; + }, + &timer_fired, grpc_schedule_on_exec_ctx)); + } + for (int i = 0; i < kNumTimers / 2; ++i) { + grpc_timer_cancel(&timers[i]); + } + + gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(1500)); + GPR_ASSERT(kNumTimers / 2 == timer_fired); + + // We expect to get 1 wakeup/second + 1 wakeup per timer fired + maybe 1 + // wakeup during initialization. i.e. in 1.5 seconds we expect 6 or 7 wakeups. + // Actual number of wakeups is more due to bug + // https://github.com/grpc/grpc/issues/19947 + int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); + gpr_log(GPR_DEBUG, "wakeups: %" PRId64 "", wakeups); +} + +int main(int argc, char** argv) { + grpc::testing::TestEnvironment env(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 6dd3f1422e5..a6efca9014b 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -5988,6 +5988,30 @@ ], "uses_polling": true }, + { + "args": [], + "benchmark": false, + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": true, + "language": "c++", + "name": "timer_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "uses_polling": true + }, { "args": [], "benchmark": false, From 59564ebd9628c8e0159894427c614a13e8dd56e5 Mon Sep 17 00:00:00 2001 From: Hope Casey-Allen Date: Tue, 20 Aug 2019 16:02:53 -0700 Subject: [PATCH 408/661] Fix warnings to unblock gcc8 support --- test/core/http/httpcli_test.cc | 4 ++-- test/core/http/httpscli_test.cc | 4 ++-- test/core/http/parser_test.cc | 4 ++-- test/core/http/response_fuzzer.cc | 2 +- test/core/security/credentials_test.cc | 8 ++++---- test/core/security/jwt_verifier_test.cc | 2 +- test/core/security/oauth2_utils.cc | 2 +- test/core/transport/chttp2/hpack_encoder_test.cc | 4 ++-- test/cpp/microbenchmarks/bm_call_create.cc | 2 +- test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 4 ++-- test/cpp/microbenchmarks/bm_chttp2_transport.cc | 10 +++++----- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/test/core/http/httpcli_test.cc b/test/core/http/httpcli_test.cc index bfd75f86491..423cb700c6a 100644 --- a/test/core/http/httpcli_test.cc +++ b/test/core/http/httpcli_test.cc @@ -77,7 +77,7 @@ static void test_get(int port) { req.handshaker = &grpc_httpcli_plaintext; grpc_http_response response; - memset(&response, 0, sizeof(response)); + response = {}; grpc_resource_quota* resource_quota = grpc_resource_quota_create("test_get"); grpc_httpcli_get( &g_context, &g_pops, resource_quota, &req, n_seconds_time(15), @@ -116,7 +116,7 @@ static void test_post(int port) { req.handshaker = &grpc_httpcli_plaintext; grpc_http_response response; - memset(&response, 0, sizeof(response)); + response = {}; grpc_resource_quota* resource_quota = grpc_resource_quota_create("test_post"); grpc_httpcli_post( &g_context, &g_pops, resource_quota, &req, "hello", 5, n_seconds_time(15), diff --git a/test/core/http/httpscli_test.cc b/test/core/http/httpscli_test.cc index e7250c206d8..eb63367d750 100644 --- a/test/core/http/httpscli_test.cc +++ b/test/core/http/httpscli_test.cc @@ -81,7 +81,7 @@ static void test_get(int port) { req.handshaker = &grpc_httpcli_ssl; grpc_http_response response; - memset(&response, 0, sizeof(response)); + response = {}; grpc_resource_quota* resource_quota = grpc_resource_quota_create("test_get"); grpc_httpcli_get( &g_context, &g_pops, resource_quota, &req, n_seconds_time(15), @@ -121,7 +121,7 @@ static void test_post(int port) { req.handshaker = &grpc_httpcli_ssl; grpc_http_response response; - memset(&response, 0, sizeof(response)); + response = {}; grpc_resource_quota* resource_quota = grpc_resource_quota_create("test_post"); grpc_httpcli_post( &g_context, &g_pops, resource_quota, &req, "hello", 5, n_seconds_time(15), diff --git a/test/core/http/parser_test.cc b/test/core/http/parser_test.cc index d105b40bcd6..d3b2cb4060c 100644 --- a/test/core/http/parser_test.cc +++ b/test/core/http/parser_test.cc @@ -101,7 +101,7 @@ static void test_succeeds(grpc_slice_split_mode split_mode, grpc_slice* slices; va_list args; grpc_http_response response; - memset(&response, 0, sizeof(response)); + response = {}; grpc_split_slices(split_mode, &input_slice, 1, &slices, &num_slices); grpc_slice_unref(input_slice); @@ -155,7 +155,7 @@ static void test_fails(grpc_slice_split_mode split_mode, grpc_slice* slices; grpc_error* error = GRPC_ERROR_NONE; grpc_http_response response; - memset(&response, 0, sizeof(response)); + response = {}; grpc_split_slices(split_mode, &input_slice, 1, &slices, &num_slices); grpc_slice_unref(input_slice); diff --git a/test/core/http/response_fuzzer.cc b/test/core/http/response_fuzzer.cc index fc0904b1db7..cf82ccfe2ce 100644 --- a/test/core/http/response_fuzzer.cc +++ b/test/core/http/response_fuzzer.cc @@ -31,7 +31,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_http_parser parser; grpc_http_response response; grpc_init(); - memset(&response, 0, sizeof(response)); + response = {}; grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response); grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); GRPC_ERROR_UNREF(grpc_http_parser_parse(&parser, slice, nullptr)); diff --git a/test/core/security/credentials_test.cc b/test/core/security/credentials_test.cc index cbce595c354..525953978c2 100644 --- a/test/core/security/credentials_test.cc +++ b/test/core/security/credentials_test.cc @@ -149,7 +149,7 @@ static char* test_json_key_str(void) { static grpc_httpcli_response http_response(int status, const char* body) { grpc_httpcli_response response; - memset(&response, 0, sizeof(grpc_httpcli_response)); + response = {}; response.status = status; response.body = gpr_strdup(const_cast(body)); response.body_length = strlen(body); @@ -161,7 +161,7 @@ static grpc_httpcli_response http_response(int status, const char* body) { static void test_empty_md_array(void) { grpc_core::ExecCtx exec_ctx; grpc_credentials_mdelem_array md_array; - memset(&md_array, 0, sizeof(md_array)); + md_array = {}; GPR_ASSERT(md_array.md == nullptr); GPR_ASSERT(md_array.size == 0); grpc_credentials_mdelem_array_destroy(&md_array); @@ -170,7 +170,7 @@ static void test_empty_md_array(void) { static void test_add_to_empty_md_array(void) { grpc_core::ExecCtx exec_ctx; grpc_credentials_mdelem_array md_array; - memset(&md_array, 0, sizeof(md_array)); + md_array = {}; const char* key = "hello"; const char* value = "there blah blah blah blah blah blah blah"; grpc_mdelem md = grpc_mdelem_from_slices( @@ -185,7 +185,7 @@ static void test_add_to_empty_md_array(void) { static void test_add_abunch_to_md_array(void) { grpc_core::ExecCtx exec_ctx; grpc_credentials_mdelem_array md_array; - memset(&md_array, 0, sizeof(md_array)); + md_array = {}; const char* key = "hello"; const char* value = "there blah blah blah blah blah blah blah"; grpc_mdelem md = grpc_mdelem_from_slices( diff --git a/test/core/security/jwt_verifier_test.cc b/test/core/security/jwt_verifier_test.cc index 21a7aa47b9d..43a70f6955e 100644 --- a/test/core/security/jwt_verifier_test.cc +++ b/test/core/security/jwt_verifier_test.cc @@ -310,7 +310,7 @@ static char* good_google_email_keys(void) { static grpc_httpcli_response http_response(int status, char* body) { grpc_httpcli_response response; - memset(&response, 0, sizeof(grpc_httpcli_response)); + response = {}; response.status = status; response.body = body; response.body_length = strlen(body); diff --git a/test/core/security/oauth2_utils.cc b/test/core/security/oauth2_utils.cc index b24e7c180e1..8b4c795a9ff 100644 --- a/test/core/security/oauth2_utils.cc +++ b/test/core/security/oauth2_utils.cc @@ -71,7 +71,7 @@ static void destroy_after_shutdown(void* pollset, grpc_error* error) { char* grpc_test_fetch_oauth2_token_with_credentials( grpc_call_credentials* creds) { oauth2_request request; - memset(&request, 0, sizeof(request)); + request = {}; grpc_core::ExecCtx exec_ctx; grpc_closure destroy_after_shutdown_closure; grpc_auth_metadata_context null_ctx = {"", "", nullptr, nullptr}; diff --git a/test/core/transport/chttp2/hpack_encoder_test.cc b/test/core/transport/chttp2/hpack_encoder_test.cc index 6cbc914c7fa..707091bc129 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.cc +++ b/test/core/transport/chttp2/hpack_encoder_test.cc @@ -97,7 +97,7 @@ static void verify(const verify_params params, const char* expected, grpc_slice_buffer_init(&output); grpc_transport_one_way_stats stats; - memset(&stats, 0, sizeof(stats)); + stats = {}; grpc_encode_header_options hopt = { 0xdeadbeef, /* stream_id */ params.eof, /* is_eof */ @@ -217,7 +217,7 @@ static void verify_table_size_change_match_elem_size(const char* key, grpc_slice_buffer_init(&output); grpc_transport_one_way_stats stats; - memset(&stats, 0, sizeof(stats)); + stats = {}; grpc_encode_header_options hopt = { 0xdeadbeef, /* stream_id */ false, /* is_eof */ diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index aad94afca5b..e6c9fe699c3 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -456,7 +456,7 @@ class NoOp { class SendEmptyMetadata { public: SendEmptyMetadata() : op_payload_(nullptr) { - memset(&op_, 0, sizeof(op_)); + op_ = {}; op_.on_complete = GRPC_CLOSURE_INIT(&closure_, DoNothing, nullptr, grpc_schedule_on_exec_ctx); op_.send_initial_metadata = true; diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 1d2ddf13f6a..4950e7f7768 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -77,7 +77,7 @@ static void BM_HpackEncoderEncodeDeadline(benchmark::State& state) { new grpc_chttp2_hpack_compressor); grpc_chttp2_hpack_compressor_init(c.get()); grpc_transport_one_way_stats stats; - memset(&stats, 0, sizeof(stats)); + stats = {}; grpc_slice_buffer outbuf; grpc_slice_buffer_init(&outbuf); while (state.KeepRunning()) { @@ -127,7 +127,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) { new grpc_chttp2_hpack_compressor); grpc_chttp2_hpack_compressor_init(c.get()); grpc_transport_one_way_stats stats; - memset(&stats, 0, sizeof(stats)); + stats = {}; grpc_slice_buffer outbuf; grpc_slice_buffer_init(&outbuf); while (state.KeepRunning()) { diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index 3df979e8ddb..da3357304ba 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -262,7 +262,7 @@ static void BM_StreamCreateDestroy(benchmark::State& state) { auto* s = new Stream(&f); grpc_transport_stream_op_batch op; grpc_transport_stream_op_batch_payload op_payload(nullptr); - memset(&op, 0, sizeof(op)); + op = {}; op.cancel_stream = true; op.payload = &op_payload; op_payload.cancel_stream.cancel_error = GRPC_ERROR_CANCELLED; @@ -315,7 +315,7 @@ static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State& state) { std::unique_ptr done; auto reset_op = [&]() { - memset(&op, 0, sizeof(op)); + op = {}; op.payload = &op_payload; }; @@ -366,7 +366,7 @@ static void BM_TransportEmptyOp(benchmark::State& state) { grpc_transport_stream_op_batch op; grpc_transport_stream_op_batch_payload op_payload(nullptr); auto reset_op = [&]() { - memset(&op, 0, sizeof(op)); + op = {}; op.payload = &op_payload; }; std::unique_ptr c = MakeClosure([&](grpc_error* error) { @@ -398,7 +398,7 @@ static void BM_TransportStreamSend(benchmark::State& state) { grpc_transport_stream_op_batch op; grpc_transport_stream_op_batch_payload op_payload(nullptr); auto reset_op = [&]() { - memset(&op, 0, sizeof(op)); + op = {}; op.payload = &op_payload; }; // Create the send_message payload slice. @@ -533,7 +533,7 @@ static void BM_TransportStreamRecv(benchmark::State& state) { grpc_slice incoming_data = CreateIncomingDataSlice(state.range(0), 16384); auto reset_op = [&]() { - memset(&op, 0, sizeof(op)); + op = {}; op.payload = &op_payload; }; From e0b94db1b9c9059e2a64a8a98d89c3982b29f377 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Mon, 19 Aug 2019 08:47:46 -0700 Subject: [PATCH 409/661] Enforce abstract class rule --- test/core/channel/channelz_registry_test.cc | 31 +++++++++---------- .../resolvers/dns_resolver_test.cc | 18 ++++++++--- test/core/util/test_lb_policies.cc | 5 +++ 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/test/core/channel/channelz_registry_test.cc b/test/core/channel/channelz_registry_test.cc index 995182da249..39d3b1d5eeb 100644 --- a/test/core/channel/channelz_registry_test.cc +++ b/test/core/channel/channelz_registry_test.cc @@ -24,6 +24,7 @@ #include #include +#include #include "src/core/lib/channel/channel_trace.h" #include "src/core/lib/channel/channelz.h" @@ -33,7 +34,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/json/json.h" #include "src/core/lib/surface/channel.h" - #include "test/core/util/test_config.h" #include @@ -51,9 +51,13 @@ class ChannelzRegistryTest : public ::testing::Test { void TearDown() override { ChannelzRegistry::Shutdown(); } }; +static RefCountedPtr CreateTestNode() { + return MakeRefCounted(UniquePtr(gpr_strdup("test")), + UniquePtr(gpr_strdup("test"))); +} + TEST_F(ChannelzRegistryTest, UuidStartsAboveZeroTest) { - RefCountedPtr channelz_channel = - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel, nullptr); + RefCountedPtr channelz_channel = CreateTestNode(); intptr_t uuid = channelz_channel->uuid(); EXPECT_GT(uuid, 0) << "First uuid chose must be greater than zero. Zero if " "reserved according to " @@ -65,8 +69,7 @@ TEST_F(ChannelzRegistryTest, UuidsAreIncreasing) { std::vector> channelz_channels; channelz_channels.reserve(10); for (int i = 0; i < 10; ++i) { - channelz_channels.push_back(MakeRefCounted( - BaseNode::EntityType::kTopLevelChannel, nullptr)); + channelz_channels.push_back(CreateTestNode()); } for (size_t i = 1; i < channelz_channels.size(); ++i) { EXPECT_LT(channelz_channels[i - 1]->uuid(), channelz_channels[i]->uuid()) @@ -75,8 +78,7 @@ TEST_F(ChannelzRegistryTest, UuidsAreIncreasing) { } TEST_F(ChannelzRegistryTest, RegisterGetTest) { - RefCountedPtr channelz_channel = - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel, nullptr); + RefCountedPtr channelz_channel = CreateTestNode(); RefCountedPtr retrieved = ChannelzRegistry::Get(channelz_channel->uuid()); EXPECT_EQ(channelz_channel, retrieved); @@ -85,8 +87,7 @@ TEST_F(ChannelzRegistryTest, RegisterGetTest) { TEST_F(ChannelzRegistryTest, RegisterManyItems) { std::vector> channelz_channels; for (int i = 0; i < 100; i++) { - channelz_channels.push_back(MakeRefCounted( - BaseNode::EntityType::kTopLevelChannel, nullptr)); + channelz_channels.push_back(CreateTestNode()); RefCountedPtr retrieved = ChannelzRegistry::Get(channelz_channels[i]->uuid()); EXPECT_EQ(channelz_channels[i], retrieved); @@ -94,8 +95,7 @@ TEST_F(ChannelzRegistryTest, RegisterManyItems) { } TEST_F(ChannelzRegistryTest, NullIfNotPresentTest) { - RefCountedPtr channelz_channel = - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel, nullptr); + RefCountedPtr channelz_channel = CreateTestNode(); // try to pull out a uuid that does not exist. RefCountedPtr nonexistant = ChannelzRegistry::Get(channelz_channel->uuid() + 1); @@ -117,10 +117,8 @@ TEST_F(ChannelzRegistryTest, TestUnregistration) { std::vector> odd_channels; odd_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { - even_channels.push_back(MakeRefCounted( - BaseNode::EntityType::kTopLevelChannel, nullptr)); - odd_channels.push_back(MakeRefCounted( - BaseNode::EntityType::kTopLevelChannel, nullptr)); + even_channels.push_back(CreateTestNode()); + odd_channels.push_back(CreateTestNode()); odd_uuids.push_back(odd_channels[i]->uuid()); } } @@ -137,8 +135,7 @@ TEST_F(ChannelzRegistryTest, TestUnregistration) { std::vector> more_channels; more_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { - more_channels.push_back(MakeRefCounted( - BaseNode::EntityType::kTopLevelChannel, nullptr)); + more_channels.push_back(CreateTestNode()); RefCountedPtr retrieved = ChannelzRegistry::Get(more_channels[i]->uuid()); EXPECT_EQ(more_channels[i], retrieved); diff --git a/test/core/client_channel/resolvers/dns_resolver_test.cc b/test/core/client_channel/resolvers/dns_resolver_test.cc index 129866b7d7f..ce44fd51b82 100644 --- a/test/core/client_channel/resolvers/dns_resolver_test.cc +++ b/test/core/client_channel/resolvers/dns_resolver_test.cc @@ -24,11 +24,23 @@ #include "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h" #include "src/core/ext/filters/client_channel/resolver_registry.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/memory.h" #include "src/core/lib/iomgr/combiner.h" #include "test/core/util/test_config.h" static grpc_combiner* g_combiner; +class TestResultHandler : public grpc_core::Resolver::ResultHandler { + void ReturnResult(grpc_core::Resolver::Result result) override {} + void ReturnError(grpc_error* error) override {} +}; + +static grpc_core::UniquePtr +create_test_result_handler() { + return grpc_core::UniquePtr( + grpc_core::New()); +} + static void test_succeeds(grpc_core::ResolverFactory* factory, const char* string) { gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", string, @@ -39,8 +51,7 @@ static void test_succeeds(grpc_core::ResolverFactory* factory, grpc_core::ResolverArgs args; args.uri = uri; args.combiner = g_combiner; - args.result_handler = - grpc_core::MakeUnique(); + args.result_handler = create_test_result_handler(); grpc_core::OrphanablePtr resolver = factory->CreateResolver(std::move(args)); GPR_ASSERT(resolver != nullptr); @@ -57,8 +68,7 @@ static void test_fails(grpc_core::ResolverFactory* factory, grpc_core::ResolverArgs args; args.uri = uri; args.combiner = g_combiner; - args.result_handler = - grpc_core::MakeUnique(); + args.result_handler = create_test_result_handler(); grpc_core::OrphanablePtr resolver = factory->CreateResolver(std::move(args)); GPR_ASSERT(resolver == nullptr); diff --git a/test/core/util/test_lb_policies.cc b/test/core/util/test_lb_policies.cc index 5ee2f5fe049..77e186c6d49 100644 --- a/test/core/util/test_lb_policies.cc +++ b/test/core/util/test_lb_policies.cc @@ -233,6 +233,11 @@ class InterceptTrailingFactory : public LoadBalancingPolicyFactory { return kInterceptRecvTrailingMetadataLbPolicyName; } + RefCountedPtr ParseLoadBalancingConfig( + const grpc_json* json, grpc_error** error) const override { + return nullptr; + } + private: InterceptRecvTrailingMetadataCallback cb_; void* user_data_; From 7ec6e8a4de6eba4eb3a8298ceb5aa82c0209b3a1 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 16 Aug 2019 18:11:41 -0700 Subject: [PATCH 410/661] Remove nanopb from gRPC --- .clang_complete | 1 - BUILD.gn | 27 - CMakeLists.txt | 401 --- Makefile | 2 +- PYTHON-MANIFEST.in | 1 - bazel/grpc_deps.bzl | 14 - build.yaml | 18 +- cmake/nanopb.cmake | 15 - config.m4 | 1 - config.w32 | 1 - gRPC-C++.podspec | 364 +-- gRPC-Core.podspec | 2 - grpc.gyp | 4 - setup.py | 2 - .../SwiftSample.xcodeproj/project.pbxproj | 2 - .../tvOS-sample.xcodeproj/project.pbxproj | 2 - .../watchOS-sample.xcodeproj/project.pbxproj | 4 - templates/BUILD.gn.template | 17 +- templates/CMakeLists.txt.template | 3 - templates/config.m4.template | 1 - templates/config.w32.template | 1 - templates/gRPC-C++.podspec.template | 11 - templates/gRPC-Core.podspec.template | 6 +- templates/grpc.gyp.template | 1 - .../GRPCCppTests.xcodeproj/project.pbxproj | 2 - third_party/nanopb.BUILD | 19 - third_party/nanopb/.gitignore | 28 - third_party/nanopb/.travis.yml | 54 - third_party/nanopb/AUTHORS | 24 - third_party/nanopb/BUILD | 24 - third_party/nanopb/CHANGELOG.txt | 241 -- third_party/nanopb/CONTRIBUTING.md | 32 - third_party/nanopb/LICENSE.txt | 20 - third_party/nanopb/README.md | 71 - third_party/nanopb/docs/Makefile | 9 - third_party/nanopb/docs/concepts.rst | 392 --- third_party/nanopb/docs/generator_flow.svg | 2869 ----------------- third_party/nanopb/docs/index.rst | 127 - third_party/nanopb/docs/logo/logo.png | Bin 14973 -> 0 bytes third_party/nanopb/docs/logo/logo.svg | 1470 --------- third_party/nanopb/docs/logo/logo16px.png | Bin 854 -> 0 bytes third_party/nanopb/docs/logo/logo48px.png | Bin 2577 -> 0 bytes third_party/nanopb/docs/lsr.css | 240 -- third_party/nanopb/docs/menu.rst | 13 - third_party/nanopb/docs/migration.rst | 276 -- third_party/nanopb/docs/reference.rst | 770 ----- third_party/nanopb/docs/security.rst | 84 - .../examples/cmake_simple/CMakeLists.txt | 16 - .../nanopb/examples/cmake_simple/README.txt | 18 - .../nanopb/examples/cmake_simple/simple.c | 71 - .../nanopb/examples/cmake_simple/simple.proto | 9 - .../nanopb/examples/network_server/Makefile | 17 - .../nanopb/examples/network_server/README.txt | 60 - .../nanopb/examples/network_server/client.c | 142 - .../nanopb/examples/network_server/common.c | 40 - .../nanopb/examples/network_server/common.h | 9 - .../examples/network_server/fileproto.options | 13 - .../examples/network_server/fileproto.proto | 20 - .../nanopb/examples/network_server/server.c | 158 - third_party/nanopb/examples/simple/Makefile | 22 - third_party/nanopb/examples/simple/README.txt | 29 - third_party/nanopb/examples/simple/simple.c | 71 - .../nanopb/examples/simple/simple.proto | 9 - .../examples/using_double_on_avr/Makefile | 24 - .../examples/using_double_on_avr/README.txt | 25 - .../using_double_on_avr/decode_double.c | 33 - .../using_double_on_avr/double_conversion.c | 123 - .../using_double_on_avr/double_conversion.h | 26 - .../using_double_on_avr/doubleproto.proto | 15 - .../using_double_on_avr/encode_double.c | 25 - .../using_double_on_avr/test_conversions.c | 56 - .../examples/using_union_messages/Makefile | 20 - .../examples/using_union_messages/README.txt | 52 - .../examples/using_union_messages/decode.c | 96 - .../examples/using_union_messages/encode.c | 85 - .../using_union_messages/unionproto.proto | 32 - third_party/nanopb/extra/FindNanopb.cmake | 274 -- third_party/nanopb/extra/nanopb.mk | 37 - third_party/nanopb/extra/pb_syshdr.h | 112 - .../nanopb/generator/nanopb_generator.py | 1602 --------- third_party/nanopb/generator/proto/Makefile | 4 - .../nanopb/generator/proto/__init__.py | 0 .../proto/google/protobuf/descriptor.proto | 714 ---- .../nanopb/generator/proto/nanopb.proto | 98 - .../nanopb/generator/proto/plugin.proto | 148 - .../nanopb/generator/protoc-gen-nanopb | 13 - .../nanopb/generator/protoc-gen-nanopb.bat | 12 - third_party/nanopb/library.json | 22 - third_party/nanopb/pb.h | 579 ---- third_party/nanopb/pb_common.c | 97 - third_party/nanopb/pb_common.h | 42 - third_party/nanopb/pb_decode.c | 1347 -------- third_party/nanopb/pb_decode.h | 149 - third_party/nanopb/pb_encode.c | 696 ---- third_party/nanopb/pb_encode.h | 154 - third_party/nanopb/tests/Makefile | 21 - third_party/nanopb/tests/SConstruct | 155 - third_party/nanopb/tests/alltypes/SConscript | 35 - .../nanopb/tests/alltypes/alltypes.options | 3 - .../nanopb/tests/alltypes/alltypes.proto | 123 - .../nanopb/tests/alltypes/decode_alltypes.c | 221 -- .../nanopb/tests/alltypes/encode_alltypes.c | 149 - .../nanopb/tests/alltypes_callback/SConscript | 23 - .../tests/alltypes_callback/alltypes.options | 4 - .../decode_alltypes_callback.c | 429 --- .../encode_alltypes_callback.c | 402 --- .../nanopb/tests/alltypes_pointer/SConscript | 40 - .../tests/alltypes_pointer/alltypes.options | 3 - .../decode_alltypes_pointer.c | 180 -- .../encode_alltypes_pointer.c | 194 -- .../nanopb/tests/anonymous_oneof/SConscript | 30 - .../tests/anonymous_oneof/decode_oneof.c | 88 - .../nanopb/tests/anonymous_oneof/oneof.proto | 23 - .../tests/backwards_compatibility/SConscript | 11 - .../backwards_compatibility/alltypes_legacy.c | 153 - .../backwards_compatibility/alltypes_legacy.h | 274 -- .../alltypes_legacy.options | 3 - .../alltypes_legacy.proto | 110 - .../backwards_compatibility/decode_legacy.c | 199 -- .../backwards_compatibility/encode_legacy.c | 135 - .../nanopb/tests/basic_buffer/SConscript | 12 - .../nanopb/tests/basic_buffer/decode_buffer.c | 88 - .../nanopb/tests/basic_buffer/encode_buffer.c | 38 - .../nanopb/tests/basic_stream/SConscript | 12 - .../nanopb/tests/basic_stream/decode_stream.c | 84 - .../nanopb/tests/basic_stream/encode_stream.c | 40 - .../nanopb/tests/buffer_only/SConscript | 28 - third_party/nanopb/tests/callbacks/SConscript | 14 - .../nanopb/tests/callbacks/callbacks.proto | 18 - .../nanopb/tests/callbacks/decode_callbacks.c | 97 - .../nanopb/tests/callbacks/encode_callbacks.c | 92 - third_party/nanopb/tests/common/SConscript | 48 - .../nanopb/tests/common/malloc_wrappers.c | 54 - .../nanopb/tests/common/malloc_wrappers.h | 7 - .../tests/common/malloc_wrappers_syshdr.h | 15 - third_party/nanopb/tests/common/person.proto | 22 - .../nanopb/tests/common/test_helpers.h | 17 - .../nanopb/tests/common/unittestproto.proto | 43 - third_party/nanopb/tests/common/unittests.h | 14 - .../nanopb/tests/cxx_main_program/SConscript | 25 - .../nanopb/tests/cyclic_messages/SConscript | 11 - .../nanopb/tests/cyclic_messages/cyclic.proto | 27 - .../cyclic_messages/cyclic_callback.options | 7 - .../cyclic_messages/encode_cyclic_callback.c | 148 - .../nanopb/tests/decode_unittests/SConscript | 4 - .../tests/decode_unittests/decode_unittests.c | 344 -- .../nanopb/tests/encode_unittests/SConscript | 5 - .../tests/encode_unittests/encode_unittests.c | 355 -- .../nanopb/tests/enum_sizes/SConscript | 12 - .../nanopb/tests/enum_sizes/enumsizes.proto | 86 - .../tests/enum_sizes/enumsizes_unittests.c | 72 - .../nanopb/tests/extensions/SConscript | 16 - .../tests/extensions/decode_extensions.c | 60 - .../tests/extensions/encode_extensions.c | 54 - .../tests/extensions/extensions.options | 1 - .../nanopb/tests/extensions/extensions.proto | 19 - .../nanopb/tests/extra_fields/SConscript | 16 - .../person_with_extra_field.expected | 14 - .../nanopb/tests/field_size_16/SConscript | 29 - .../tests/field_size_16/alltypes.options | 3 - .../nanopb/tests/field_size_16/alltypes.proto | 121 - .../nanopb/tests/field_size_32/SConscript | 29 - .../tests/field_size_32/alltypes.options | 3 - .../nanopb/tests/field_size_32/alltypes.proto | 121 - third_party/nanopb/tests/fuzztest/SConscript | 43 - .../tests/fuzztest/alltypes_pointer.options | 3 - .../tests/fuzztest/alltypes_static.options | 3 - third_party/nanopb/tests/fuzztest/fuzzstub.c | 189 -- third_party/nanopb/tests/fuzztest/fuzztest.c | 432 --- .../nanopb/tests/fuzztest/generate_message.c | 101 - .../nanopb/tests/fuzztest/run_radamsa.sh | 12 - third_party/nanopb/tests/inline/SConscript | 16 - .../nanopb/tests/inline/inline.expected | 3 - third_party/nanopb/tests/inline/inline.proto | 17 - .../nanopb/tests/inline/inline_unittests.c | 73 - third_party/nanopb/tests/intsizes/SConscript | 12 - .../nanopb/tests/intsizes/intsizes.proto | 41 - .../tests/intsizes/intsizes_unittests.c | 122 - third_party/nanopb/tests/io_errors/SConscript | 15 - .../nanopb/tests/io_errors/alltypes.options | 3 - .../nanopb/tests/io_errors/io_errors.c | 140 - .../tests/io_errors_pointers/SConscript | 26 - .../tests/io_errors_pointers/alltypes.options | 3 - .../nanopb/tests/mem_release/SConscript | 13 - .../nanopb/tests/mem_release/mem_release.c | 187 -- .../tests/mem_release/mem_release.proto | 35 - .../nanopb/tests/message_sizes/SConscript | 11 - .../nanopb/tests/message_sizes/dummy.c | 9 - .../tests/message_sizes/messages1.proto | 29 - .../tests/message_sizes/messages2.proto | 10 - .../nanopb/tests/missing_fields/SConscript | 8 - .../tests/missing_fields/missing_fields.c | 53 - .../tests/missing_fields/missing_fields.proto | 140 - .../nanopb/tests/multiple_files/SConscript | 16 - .../tests/multiple_files/multifile1.options | 1 - .../tests/multiple_files/multifile1.proto | 34 - .../tests/multiple_files/multifile2.proto | 22 - .../multiple_files/subdir/multifile2.proto | 25 - .../multiple_files/test_multiple_files.c | 30 - third_party/nanopb/tests/no_errmsg/SConscript | 28 - .../nanopb/tests/no_messages/SConscript | 7 - .../tests/no_messages/no_messages.proto | 9 - third_party/nanopb/tests/oneof/SConscript | 33 - third_party/nanopb/tests/oneof/decode_oneof.c | 131 - third_party/nanopb/tests/oneof/encode_oneof.c | 64 - third_party/nanopb/tests/oneof/oneof.proto | 32 - third_party/nanopb/tests/options/SConscript | 9 - .../nanopb/tests/options/options.expected | 18 - .../nanopb/tests/options/options.proto | 91 - .../nanopb/tests/package_name/SConscript | 38 - .../tests/regression/issue_118/SConscript | 12 - .../tests/regression/issue_118/enumdef.proto | 8 - .../tests/regression/issue_118/enumuse.proto | 7 - .../tests/regression/issue_125/SConscript | 9 - .../issue_125/extensionbug.expected | 3 - .../regression/issue_125/extensionbug.options | 4 - .../regression/issue_125/extensionbug.proto | 18 - .../tests/regression/issue_141/SConscript | 8 - .../regression/issue_141/testproto.expected | 7 - .../regression/issue_141/testproto.proto | 52 - .../tests/regression/issue_145/SConscript | 9 - .../regression/issue_145/comments.expected | 3 - .../regression/issue_145/comments.options | 6 - .../tests/regression/issue_145/comments.proto | 7 - .../tests/regression/issue_166/SConscript | 13 - .../regression/issue_166/enum_encoded_size.c | 43 - .../tests/regression/issue_166/enums.proto | 18 - .../tests/regression/issue_172/SConscript | 16 - .../tests/regression/issue_172/msg_size.c | 9 - .../issue_172/submessage/submessage.options | 1 - .../issue_172/submessage/submessage.proto | 4 - .../tests/regression/issue_172/test.proto | 6 - .../tests/regression/issue_188/SConscript | 6 - .../tests/regression/issue_188/oneof.proto | 29 - .../tests/regression/issue_195/SConscript | 10 - .../tests/regression/issue_195/test.expected | 1 - .../tests/regression/issue_195/test.proto | 8 - .../tests/regression/issue_203/SConscript | 9 - .../tests/regression/issue_203/file1.proto | 10 - .../tests/regression/issue_203/file2.proto | 10 - .../tests/regression/issue_205/SConscript | 14 - .../regression/issue_205/size_corruption.c | 12 - .../issue_205/size_corruption.proto | 11 - .../nanopb/tests/site_scons/site_init.py | 109 - .../tests/site_scons/site_tools/nanopb.py | 126 - .../tests/special_characters/SConscript | 6 - .../funny-proto+name has.characters.proto | 1 - third_party/nanopb/tests/splint/SConscript | 16 - third_party/nanopb/tests/splint/splint.rc | 37 - .../nanopb/tools/make_linux_package.sh | 47 - third_party/nanopb/tools/make_mac_package.sh | 49 - .../nanopb/tools/make_windows_package.sh | 55 - third_party/nanopb/tools/set_version.sh | 10 - tools/codegen/core/gen_nano_proto.sh | 83 - tools/distrib/check_copyright.py | 12 - tools/doxygen/Doxyfile.c++.internal | 4 - .../run_tests/sanity/check_bazel_workspace.py | 4 - 257 files changed, 7 insertions(+), 23687 deletions(-) delete mode 100644 cmake/nanopb.cmake delete mode 100644 third_party/nanopb.BUILD delete mode 100644 third_party/nanopb/.gitignore delete mode 100644 third_party/nanopb/.travis.yml delete mode 100644 third_party/nanopb/AUTHORS delete mode 100644 third_party/nanopb/BUILD delete mode 100644 third_party/nanopb/CHANGELOG.txt delete mode 100644 third_party/nanopb/CONTRIBUTING.md delete mode 100644 third_party/nanopb/LICENSE.txt delete mode 100644 third_party/nanopb/README.md delete mode 100644 third_party/nanopb/docs/Makefile delete mode 100644 third_party/nanopb/docs/concepts.rst delete mode 100644 third_party/nanopb/docs/generator_flow.svg delete mode 100644 third_party/nanopb/docs/index.rst delete mode 100644 third_party/nanopb/docs/logo/logo.png delete mode 100644 third_party/nanopb/docs/logo/logo.svg delete mode 100644 third_party/nanopb/docs/logo/logo16px.png delete mode 100644 third_party/nanopb/docs/logo/logo48px.png delete mode 100644 third_party/nanopb/docs/lsr.css delete mode 100644 third_party/nanopb/docs/menu.rst delete mode 100644 third_party/nanopb/docs/migration.rst delete mode 100644 third_party/nanopb/docs/reference.rst delete mode 100644 third_party/nanopb/docs/security.rst delete mode 100644 third_party/nanopb/examples/cmake_simple/CMakeLists.txt delete mode 100644 third_party/nanopb/examples/cmake_simple/README.txt delete mode 100644 third_party/nanopb/examples/cmake_simple/simple.c delete mode 100644 third_party/nanopb/examples/cmake_simple/simple.proto delete mode 100644 third_party/nanopb/examples/network_server/Makefile delete mode 100644 third_party/nanopb/examples/network_server/README.txt delete mode 100644 third_party/nanopb/examples/network_server/client.c delete mode 100644 third_party/nanopb/examples/network_server/common.c delete mode 100644 third_party/nanopb/examples/network_server/common.h delete mode 100644 third_party/nanopb/examples/network_server/fileproto.options delete mode 100644 third_party/nanopb/examples/network_server/fileproto.proto delete mode 100644 third_party/nanopb/examples/network_server/server.c delete mode 100644 third_party/nanopb/examples/simple/Makefile delete mode 100644 third_party/nanopb/examples/simple/README.txt delete mode 100644 third_party/nanopb/examples/simple/simple.c delete mode 100644 third_party/nanopb/examples/simple/simple.proto delete mode 100644 third_party/nanopb/examples/using_double_on_avr/Makefile delete mode 100644 third_party/nanopb/examples/using_double_on_avr/README.txt delete mode 100644 third_party/nanopb/examples/using_double_on_avr/decode_double.c delete mode 100644 third_party/nanopb/examples/using_double_on_avr/double_conversion.c delete mode 100644 third_party/nanopb/examples/using_double_on_avr/double_conversion.h delete mode 100644 third_party/nanopb/examples/using_double_on_avr/doubleproto.proto delete mode 100644 third_party/nanopb/examples/using_double_on_avr/encode_double.c delete mode 100644 third_party/nanopb/examples/using_double_on_avr/test_conversions.c delete mode 100644 third_party/nanopb/examples/using_union_messages/Makefile delete mode 100644 third_party/nanopb/examples/using_union_messages/README.txt delete mode 100644 third_party/nanopb/examples/using_union_messages/decode.c delete mode 100644 third_party/nanopb/examples/using_union_messages/encode.c delete mode 100644 third_party/nanopb/examples/using_union_messages/unionproto.proto delete mode 100644 third_party/nanopb/extra/FindNanopb.cmake delete mode 100644 third_party/nanopb/extra/nanopb.mk delete mode 100644 third_party/nanopb/extra/pb_syshdr.h delete mode 100755 third_party/nanopb/generator/nanopb_generator.py delete mode 100644 third_party/nanopb/generator/proto/Makefile delete mode 100644 third_party/nanopb/generator/proto/__init__.py delete mode 100644 third_party/nanopb/generator/proto/google/protobuf/descriptor.proto delete mode 100644 third_party/nanopb/generator/proto/nanopb.proto delete mode 100644 third_party/nanopb/generator/proto/plugin.proto delete mode 100755 third_party/nanopb/generator/protoc-gen-nanopb delete mode 100644 third_party/nanopb/generator/protoc-gen-nanopb.bat delete mode 100644 third_party/nanopb/library.json delete mode 100644 third_party/nanopb/pb.h delete mode 100644 third_party/nanopb/pb_common.c delete mode 100644 third_party/nanopb/pb_common.h delete mode 100644 third_party/nanopb/pb_decode.c delete mode 100644 third_party/nanopb/pb_decode.h delete mode 100644 third_party/nanopb/pb_encode.c delete mode 100644 third_party/nanopb/pb_encode.h delete mode 100644 third_party/nanopb/tests/Makefile delete mode 100644 third_party/nanopb/tests/SConstruct delete mode 100644 third_party/nanopb/tests/alltypes/SConscript delete mode 100644 third_party/nanopb/tests/alltypes/alltypes.options delete mode 100644 third_party/nanopb/tests/alltypes/alltypes.proto delete mode 100644 third_party/nanopb/tests/alltypes/decode_alltypes.c delete mode 100644 third_party/nanopb/tests/alltypes/encode_alltypes.c delete mode 100644 third_party/nanopb/tests/alltypes_callback/SConscript delete mode 100644 third_party/nanopb/tests/alltypes_callback/alltypes.options delete mode 100644 third_party/nanopb/tests/alltypes_callback/decode_alltypes_callback.c delete mode 100644 third_party/nanopb/tests/alltypes_callback/encode_alltypes_callback.c delete mode 100644 third_party/nanopb/tests/alltypes_pointer/SConscript delete mode 100644 third_party/nanopb/tests/alltypes_pointer/alltypes.options delete mode 100644 third_party/nanopb/tests/alltypes_pointer/decode_alltypes_pointer.c delete mode 100644 third_party/nanopb/tests/alltypes_pointer/encode_alltypes_pointer.c delete mode 100644 third_party/nanopb/tests/anonymous_oneof/SConscript delete mode 100644 third_party/nanopb/tests/anonymous_oneof/decode_oneof.c delete mode 100644 third_party/nanopb/tests/anonymous_oneof/oneof.proto delete mode 100644 third_party/nanopb/tests/backwards_compatibility/SConscript delete mode 100644 third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.c delete mode 100644 third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.h delete mode 100644 third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.options delete mode 100644 third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.proto delete mode 100644 third_party/nanopb/tests/backwards_compatibility/decode_legacy.c delete mode 100644 third_party/nanopb/tests/backwards_compatibility/encode_legacy.c delete mode 100644 third_party/nanopb/tests/basic_buffer/SConscript delete mode 100644 third_party/nanopb/tests/basic_buffer/decode_buffer.c delete mode 100644 third_party/nanopb/tests/basic_buffer/encode_buffer.c delete mode 100644 third_party/nanopb/tests/basic_stream/SConscript delete mode 100644 third_party/nanopb/tests/basic_stream/decode_stream.c delete mode 100644 third_party/nanopb/tests/basic_stream/encode_stream.c delete mode 100644 third_party/nanopb/tests/buffer_only/SConscript delete mode 100644 third_party/nanopb/tests/callbacks/SConscript delete mode 100644 third_party/nanopb/tests/callbacks/callbacks.proto delete mode 100644 third_party/nanopb/tests/callbacks/decode_callbacks.c delete mode 100644 third_party/nanopb/tests/callbacks/encode_callbacks.c delete mode 100644 third_party/nanopb/tests/common/SConscript delete mode 100644 third_party/nanopb/tests/common/malloc_wrappers.c delete mode 100644 third_party/nanopb/tests/common/malloc_wrappers.h delete mode 100644 third_party/nanopb/tests/common/malloc_wrappers_syshdr.h delete mode 100644 third_party/nanopb/tests/common/person.proto delete mode 100644 third_party/nanopb/tests/common/test_helpers.h delete mode 100644 third_party/nanopb/tests/common/unittestproto.proto delete mode 100644 third_party/nanopb/tests/common/unittests.h delete mode 100644 third_party/nanopb/tests/cxx_main_program/SConscript delete mode 100644 third_party/nanopb/tests/cyclic_messages/SConscript delete mode 100644 third_party/nanopb/tests/cyclic_messages/cyclic.proto delete mode 100644 third_party/nanopb/tests/cyclic_messages/cyclic_callback.options delete mode 100644 third_party/nanopb/tests/cyclic_messages/encode_cyclic_callback.c delete mode 100644 third_party/nanopb/tests/decode_unittests/SConscript delete mode 100644 third_party/nanopb/tests/decode_unittests/decode_unittests.c delete mode 100644 third_party/nanopb/tests/encode_unittests/SConscript delete mode 100644 third_party/nanopb/tests/encode_unittests/encode_unittests.c delete mode 100644 third_party/nanopb/tests/enum_sizes/SConscript delete mode 100644 third_party/nanopb/tests/enum_sizes/enumsizes.proto delete mode 100644 third_party/nanopb/tests/enum_sizes/enumsizes_unittests.c delete mode 100644 third_party/nanopb/tests/extensions/SConscript delete mode 100644 third_party/nanopb/tests/extensions/decode_extensions.c delete mode 100644 third_party/nanopb/tests/extensions/encode_extensions.c delete mode 100644 third_party/nanopb/tests/extensions/extensions.options delete mode 100644 third_party/nanopb/tests/extensions/extensions.proto delete mode 100644 third_party/nanopb/tests/extra_fields/SConscript delete mode 100644 third_party/nanopb/tests/extra_fields/person_with_extra_field.expected delete mode 100644 third_party/nanopb/tests/field_size_16/SConscript delete mode 100644 third_party/nanopb/tests/field_size_16/alltypes.options delete mode 100644 third_party/nanopb/tests/field_size_16/alltypes.proto delete mode 100644 third_party/nanopb/tests/field_size_32/SConscript delete mode 100644 third_party/nanopb/tests/field_size_32/alltypes.options delete mode 100644 third_party/nanopb/tests/field_size_32/alltypes.proto delete mode 100644 third_party/nanopb/tests/fuzztest/SConscript delete mode 100644 third_party/nanopb/tests/fuzztest/alltypes_pointer.options delete mode 100644 third_party/nanopb/tests/fuzztest/alltypes_static.options delete mode 100644 third_party/nanopb/tests/fuzztest/fuzzstub.c delete mode 100644 third_party/nanopb/tests/fuzztest/fuzztest.c delete mode 100644 third_party/nanopb/tests/fuzztest/generate_message.c delete mode 100755 third_party/nanopb/tests/fuzztest/run_radamsa.sh delete mode 100644 third_party/nanopb/tests/inline/SConscript delete mode 100644 third_party/nanopb/tests/inline/inline.expected delete mode 100644 third_party/nanopb/tests/inline/inline.proto delete mode 100644 third_party/nanopb/tests/inline/inline_unittests.c delete mode 100644 third_party/nanopb/tests/intsizes/SConscript delete mode 100644 third_party/nanopb/tests/intsizes/intsizes.proto delete mode 100644 third_party/nanopb/tests/intsizes/intsizes_unittests.c delete mode 100644 third_party/nanopb/tests/io_errors/SConscript delete mode 100644 third_party/nanopb/tests/io_errors/alltypes.options delete mode 100644 third_party/nanopb/tests/io_errors/io_errors.c delete mode 100644 third_party/nanopb/tests/io_errors_pointers/SConscript delete mode 100644 third_party/nanopb/tests/io_errors_pointers/alltypes.options delete mode 100644 third_party/nanopb/tests/mem_release/SConscript delete mode 100644 third_party/nanopb/tests/mem_release/mem_release.c delete mode 100644 third_party/nanopb/tests/mem_release/mem_release.proto delete mode 100644 third_party/nanopb/tests/message_sizes/SConscript delete mode 100644 third_party/nanopb/tests/message_sizes/dummy.c delete mode 100644 third_party/nanopb/tests/message_sizes/messages1.proto delete mode 100644 third_party/nanopb/tests/message_sizes/messages2.proto delete mode 100644 third_party/nanopb/tests/missing_fields/SConscript delete mode 100644 third_party/nanopb/tests/missing_fields/missing_fields.c delete mode 100644 third_party/nanopb/tests/missing_fields/missing_fields.proto delete mode 100644 third_party/nanopb/tests/multiple_files/SConscript delete mode 100644 third_party/nanopb/tests/multiple_files/multifile1.options delete mode 100644 third_party/nanopb/tests/multiple_files/multifile1.proto delete mode 100644 third_party/nanopb/tests/multiple_files/multifile2.proto delete mode 100644 third_party/nanopb/tests/multiple_files/subdir/multifile2.proto delete mode 100644 third_party/nanopb/tests/multiple_files/test_multiple_files.c delete mode 100644 third_party/nanopb/tests/no_errmsg/SConscript delete mode 100644 third_party/nanopb/tests/no_messages/SConscript delete mode 100644 third_party/nanopb/tests/no_messages/no_messages.proto delete mode 100644 third_party/nanopb/tests/oneof/SConscript delete mode 100644 third_party/nanopb/tests/oneof/decode_oneof.c delete mode 100644 third_party/nanopb/tests/oneof/encode_oneof.c delete mode 100644 third_party/nanopb/tests/oneof/oneof.proto delete mode 100644 third_party/nanopb/tests/options/SConscript delete mode 100644 third_party/nanopb/tests/options/options.expected delete mode 100644 third_party/nanopb/tests/options/options.proto delete mode 100644 third_party/nanopb/tests/package_name/SConscript delete mode 100644 third_party/nanopb/tests/regression/issue_118/SConscript delete mode 100644 third_party/nanopb/tests/regression/issue_118/enumdef.proto delete mode 100644 third_party/nanopb/tests/regression/issue_118/enumuse.proto delete mode 100644 third_party/nanopb/tests/regression/issue_125/SConscript delete mode 100644 third_party/nanopb/tests/regression/issue_125/extensionbug.expected delete mode 100644 third_party/nanopb/tests/regression/issue_125/extensionbug.options delete mode 100644 third_party/nanopb/tests/regression/issue_125/extensionbug.proto delete mode 100644 third_party/nanopb/tests/regression/issue_141/SConscript delete mode 100644 third_party/nanopb/tests/regression/issue_141/testproto.expected delete mode 100644 third_party/nanopb/tests/regression/issue_141/testproto.proto delete mode 100644 third_party/nanopb/tests/regression/issue_145/SConscript delete mode 100644 third_party/nanopb/tests/regression/issue_145/comments.expected delete mode 100644 third_party/nanopb/tests/regression/issue_145/comments.options delete mode 100644 third_party/nanopb/tests/regression/issue_145/comments.proto delete mode 100644 third_party/nanopb/tests/regression/issue_166/SConscript delete mode 100644 third_party/nanopb/tests/regression/issue_166/enum_encoded_size.c delete mode 100644 third_party/nanopb/tests/regression/issue_166/enums.proto delete mode 100644 third_party/nanopb/tests/regression/issue_172/SConscript delete mode 100644 third_party/nanopb/tests/regression/issue_172/msg_size.c delete mode 100644 third_party/nanopb/tests/regression/issue_172/submessage/submessage.options delete mode 100644 third_party/nanopb/tests/regression/issue_172/submessage/submessage.proto delete mode 100644 third_party/nanopb/tests/regression/issue_172/test.proto delete mode 100644 third_party/nanopb/tests/regression/issue_188/SConscript delete mode 100644 third_party/nanopb/tests/regression/issue_188/oneof.proto delete mode 100644 third_party/nanopb/tests/regression/issue_195/SConscript delete mode 100644 third_party/nanopb/tests/regression/issue_195/test.expected delete mode 100644 third_party/nanopb/tests/regression/issue_195/test.proto delete mode 100644 third_party/nanopb/tests/regression/issue_203/SConscript delete mode 100644 third_party/nanopb/tests/regression/issue_203/file1.proto delete mode 100644 third_party/nanopb/tests/regression/issue_203/file2.proto delete mode 100644 third_party/nanopb/tests/regression/issue_205/SConscript delete mode 100644 third_party/nanopb/tests/regression/issue_205/size_corruption.c delete mode 100644 third_party/nanopb/tests/regression/issue_205/size_corruption.proto delete mode 100644 third_party/nanopb/tests/site_scons/site_init.py delete mode 100644 third_party/nanopb/tests/site_scons/site_tools/nanopb.py delete mode 100644 third_party/nanopb/tests/special_characters/SConscript delete mode 100644 third_party/nanopb/tests/special_characters/funny-proto+name has.characters.proto delete mode 100644 third_party/nanopb/tests/splint/SConscript delete mode 100644 third_party/nanopb/tests/splint/splint.rc delete mode 100755 third_party/nanopb/tools/make_linux_package.sh delete mode 100755 third_party/nanopb/tools/make_mac_package.sh delete mode 100755 third_party/nanopb/tools/make_windows_package.sh delete mode 100755 third_party/nanopb/tools/set_version.sh delete mode 100755 tools/codegen/core/gen_nano_proto.sh diff --git a/.clang_complete b/.clang_complete index f789455ea95..b198443c633 100644 --- a/.clang_complete +++ b/.clang_complete @@ -13,7 +13,6 @@ -Ithird_party/googletest/googlemock/include -Ithird_party/googletest/googletest/include -Ithird_party/googletest/include --Ithird_party/nanopb -Ithird_party/protobuf/src -Ithird_party/upb -Ithird_party/zlib diff --git a/BUILD.gn b/BUILD.gn index 1b157427087..eea022eac51 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -31,29 +31,6 @@ config("grpc_config") { ] } - - - source_set("nanopb") { - sources = [ - "third_party/nanopb/pb.h", - "third_party/nanopb/pb_common.c", - "third_party/nanopb/pb_common.h", - "third_party/nanopb/pb_decode.c", - "third_party/nanopb/pb_decode.h", - "third_party/nanopb/pb_encode.c", - "third_party/nanopb/pb_encode.h", - ] - deps = [ - ] - - public_configs = [ - ":grpc_config", - ] - include_dirs = [ - "third_party/nanopb", - ] - } - source_set("address_sorting") { @@ -939,7 +916,6 @@ config("grpc_config") { include_dirs = [ "third_party/cares", "third_party/address_sorting/include", - "third_party/nanopb", ] } @@ -1466,9 +1442,6 @@ config("grpc_config") { public_configs = [ ":grpc_config", ] - include_dirs = [ - "third_party/nanopb", - ] } # Only compile the plugin for the host architecture. diff --git a/CMakeLists.txt b/CMakeLists.txt index 86a77c95663..c6a54571868 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,7 +141,6 @@ include(cmake/address_sorting.cmake) include(cmake/benchmark.cmake) include(cmake/cares.cmake) include(cmake/gflags.cmake) -include(cmake/nanopb.cmake) include(cmake/protobuf.cmake) include(cmake/ssl.cmake) include(cmake/upb.cmake) @@ -792,7 +791,6 @@ target_include_directories(address_sorting PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -847,7 +845,6 @@ target_include_directories(alts_test_util PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -932,7 +929,6 @@ target_include_directories(gpr PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -1398,7 +1394,6 @@ target_include_directories(grpc PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -1805,7 +1800,6 @@ target_include_directories(grpc_cronet PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -2149,7 +2143,6 @@ target_include_directories(grpc_test_util PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -2490,7 +2483,6 @@ target_include_directories(grpc_test_util_unsecure PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -2881,7 +2873,6 @@ target_include_directories(grpc_unsecure PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -2985,7 +2976,6 @@ target_include_directories(reconnect_server PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -3034,7 +3024,6 @@ target_include_directories(test_tcp_server PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -3091,7 +3080,6 @@ target_include_directories(bm_callback_test_service_impl PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -3146,7 +3134,6 @@ target_include_directories(dns_test_util PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -3241,7 +3228,6 @@ target_include_directories(grpc++ PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -3570,7 +3556,6 @@ target_include_directories(grpc++_core_stats PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -3625,7 +3610,6 @@ target_include_directories(grpc++_error_details PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -3698,7 +3682,6 @@ target_include_directories(grpc++_proto_reflection_desc_db PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -3765,7 +3748,6 @@ target_include_directories(grpc++_reflection PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -3830,7 +3812,6 @@ target_include_directories(grpc++_test_config PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -3928,7 +3909,6 @@ target_include_directories(grpc++_test_util PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -4138,7 +4118,6 @@ target_include_directories(grpc++_test_util_unsecure PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -4350,7 +4329,6 @@ target_include_directories(grpc++_unsecure PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -4664,7 +4642,6 @@ target_include_directories(grpc_benchmark PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -4726,7 +4703,6 @@ target_include_directories(grpc_cli_libs PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -4791,7 +4767,6 @@ target_include_directories(grpc_plugin_support PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -4859,7 +4834,6 @@ target_include_directories(grpcpp_channelz PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -4945,7 +4919,6 @@ target_include_directories(http2_client_main PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5005,7 +4978,6 @@ target_include_directories(interop_client_helper PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5080,7 +5052,6 @@ target_include_directories(interop_client_main PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5134,7 +5105,6 @@ target_include_directories(interop_server_helper PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5207,7 +5177,6 @@ target_include_directories(interop_server_lib PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5261,7 +5230,6 @@ target_include_directories(interop_server_main PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5370,7 +5338,6 @@ target_include_directories(qps PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5422,7 +5389,6 @@ target_include_directories(grpc_csharp_ext PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5478,7 +5444,6 @@ target_include_directories(bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5527,7 +5492,6 @@ target_include_directories(bad_ssl_test_server PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5654,7 +5618,6 @@ target_include_directories(end2end_tests PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5781,7 +5744,6 @@ target_include_directories(end2end_nosec_tests PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5819,7 +5781,6 @@ target_include_directories(algorithm_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5856,7 +5817,6 @@ target_include_directories(alloc_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5893,7 +5853,6 @@ target_include_directories(alpn_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5930,7 +5889,6 @@ target_include_directories(arena_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -5967,7 +5925,6 @@ target_include_directories(avl_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6004,7 +5961,6 @@ target_include_directories(bad_server_response_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6042,7 +5998,6 @@ target_include_directories(bin_decoder_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6078,7 +6033,6 @@ target_include_directories(bin_encoder_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6115,7 +6069,6 @@ target_include_directories(buffer_list_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6153,7 +6106,6 @@ target_include_directories(channel_create_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6189,7 +6141,6 @@ target_include_directories(check_epollexclusive PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6224,7 +6175,6 @@ target_include_directories(chttp2_hpack_encoder_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6261,7 +6211,6 @@ target_include_directories(chttp2_stream_map_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6298,7 +6247,6 @@ target_include_directories(chttp2_varint_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6336,7 +6284,6 @@ target_include_directories(close_fd_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6374,7 +6321,6 @@ target_include_directories(cmdline_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6411,7 +6357,6 @@ target_include_directories(combiner_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6448,7 +6393,6 @@ target_include_directories(compression_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6485,7 +6429,6 @@ target_include_directories(concurrent_connectivity_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6522,7 +6465,6 @@ target_include_directories(connection_refused_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6559,7 +6501,6 @@ target_include_directories(dns_resolver_connectivity_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6596,7 +6537,6 @@ target_include_directories(dns_resolver_cooldown_using_ares_resolver_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6633,7 +6573,6 @@ target_include_directories(dns_resolver_cooldown_using_native_resolver_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6670,7 +6609,6 @@ target_include_directories(dns_resolver_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6708,7 +6646,6 @@ target_include_directories(dualstack_socket_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6746,7 +6683,6 @@ target_include_directories(endpoint_pair_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6783,7 +6719,6 @@ target_include_directories(error_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6821,7 +6756,6 @@ target_include_directories(ev_epollex_linux_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6859,7 +6793,6 @@ target_include_directories(fake_resolver_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6898,7 +6831,6 @@ target_include_directories(fake_transport_security_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6937,7 +6869,6 @@ target_include_directories(fd_conservation_posix_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -6976,7 +6907,6 @@ target_include_directories(fd_posix_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7014,7 +6944,6 @@ target_include_directories(fling_client PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7051,7 +6980,6 @@ target_include_directories(fling_server PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7089,7 +7017,6 @@ target_include_directories(fling_stream_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7128,7 +7055,6 @@ target_include_directories(fling_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7167,7 +7093,6 @@ target_include_directories(fork_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7206,7 +7131,6 @@ target_include_directories(goaway_server_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7244,7 +7168,6 @@ target_include_directories(gpr_cpu_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7281,7 +7204,6 @@ target_include_directories(gpr_env_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7318,7 +7240,6 @@ target_include_directories(gpr_host_port_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7355,7 +7276,6 @@ target_include_directories(gpr_log_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7392,7 +7312,6 @@ target_include_directories(gpr_manual_constructor_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7429,7 +7348,6 @@ target_include_directories(gpr_mpscq_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7466,7 +7384,6 @@ target_include_directories(gpr_spinlock_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7503,7 +7420,6 @@ target_include_directories(gpr_string_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7540,7 +7456,6 @@ target_include_directories(gpr_sync_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7577,7 +7492,6 @@ target_include_directories(gpr_thd_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7614,7 +7528,6 @@ target_include_directories(gpr_time_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7651,7 +7564,6 @@ target_include_directories(gpr_tls_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7688,7 +7600,6 @@ target_include_directories(gpr_useful_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7725,7 +7636,6 @@ target_include_directories(grpc_auth_context_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7762,7 +7672,6 @@ target_include_directories(grpc_b64_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7799,7 +7708,6 @@ target_include_directories(grpc_byte_buffer_reader_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7836,7 +7744,6 @@ target_include_directories(grpc_channel_args_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7873,7 +7780,6 @@ target_include_directories(grpc_channel_stack_builder_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7910,7 +7816,6 @@ target_include_directories(grpc_channel_stack_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7947,7 +7852,6 @@ target_include_directories(grpc_completion_queue_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -7984,7 +7888,6 @@ target_include_directories(grpc_completion_queue_threading_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8021,7 +7924,6 @@ target_include_directories(grpc_control_plane_credentials_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8058,7 +7960,6 @@ target_include_directories(grpc_create_jwt PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8094,7 +7995,6 @@ target_include_directories(grpc_credentials_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8131,7 +8031,6 @@ target_include_directories(grpc_ipv6_loopback_available_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8169,7 +8068,6 @@ target_include_directories(grpc_json_token_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8207,7 +8105,6 @@ target_include_directories(grpc_jwt_verifier_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8244,7 +8141,6 @@ target_include_directories(grpc_print_google_default_creds_token PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8279,7 +8175,6 @@ target_include_directories(grpc_security_connector_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8316,7 +8211,6 @@ target_include_directories(grpc_ssl_credentials_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8353,7 +8247,6 @@ target_include_directories(grpc_verify_jwt PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8389,7 +8282,6 @@ target_include_directories(handshake_client_ssl PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8430,7 +8322,6 @@ target_include_directories(handshake_server_ssl PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8471,7 +8362,6 @@ target_include_directories(handshake_server_with_readahead_handshaker PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8511,7 +8401,6 @@ target_include_directories(handshake_verify_peer_options PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8550,7 +8439,6 @@ target_include_directories(histogram_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8586,7 +8474,6 @@ target_include_directories(hpack_parser_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8623,7 +8510,6 @@ target_include_directories(hpack_table_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8660,7 +8546,6 @@ target_include_directories(http_parser_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8697,7 +8582,6 @@ target_include_directories(httpcli_format_request_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8735,7 +8619,6 @@ target_include_directories(httpcli_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8774,7 +8657,6 @@ target_include_directories(httpscli_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8812,7 +8694,6 @@ target_include_directories(init_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8849,7 +8730,6 @@ target_include_directories(inproc_callback_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8886,7 +8766,6 @@ target_include_directories(invalid_call_argument_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8923,7 +8802,6 @@ target_include_directories(json_rewrite PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8960,7 +8838,6 @@ target_include_directories(json_rewrite_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -8997,7 +8874,6 @@ target_include_directories(json_stream_error_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9034,7 +8910,6 @@ target_include_directories(json_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9071,7 +8946,6 @@ target_include_directories(lame_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9108,7 +8982,6 @@ target_include_directories(load_file_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9145,7 +9018,6 @@ target_include_directories(memory_usage_client PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9182,7 +9054,6 @@ target_include_directories(memory_usage_server PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9220,7 +9091,6 @@ target_include_directories(memory_usage_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9258,7 +9128,6 @@ target_include_directories(message_compress_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9295,7 +9164,6 @@ target_include_directories(minimal_stack_is_minimal_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9332,7 +9200,6 @@ target_include_directories(mpmcqueue_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9369,7 +9236,6 @@ target_include_directories(multiple_server_queues_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9406,7 +9272,6 @@ target_include_directories(murmur_hash_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9443,7 +9308,6 @@ target_include_directories(no_server_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9480,7 +9344,6 @@ target_include_directories(num_external_connectivity_watchers_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9517,7 +9380,6 @@ target_include_directories(parse_address_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9555,7 +9417,6 @@ target_include_directories(parse_address_with_named_scope_id_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9593,7 +9454,6 @@ target_include_directories(percent_encoding_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9631,7 +9491,6 @@ target_include_directories(resolve_address_using_ares_resolver_posix_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9669,7 +9528,6 @@ target_include_directories(resolve_address_using_ares_resolver_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9707,7 +9565,6 @@ target_include_directories(resolve_address_using_native_resolver_posix_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9745,7 +9602,6 @@ target_include_directories(resolve_address_using_native_resolver_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9782,7 +9638,6 @@ target_include_directories(resource_quota_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9819,7 +9674,6 @@ target_include_directories(secure_channel_create_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9856,7 +9710,6 @@ target_include_directories(secure_endpoint_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9893,7 +9746,6 @@ target_include_directories(sequential_connectivity_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9930,7 +9782,6 @@ target_include_directories(server_chttp2_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -9967,7 +9818,6 @@ target_include_directories(server_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10004,7 +9854,6 @@ target_include_directories(slice_buffer_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10041,7 +9890,6 @@ target_include_directories(slice_string_helpers_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10078,7 +9926,6 @@ target_include_directories(slice_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10115,7 +9962,6 @@ target_include_directories(sockaddr_resolver_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10152,7 +9998,6 @@ target_include_directories(sockaddr_utils_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10190,7 +10035,6 @@ target_include_directories(socket_utils_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10230,7 +10074,6 @@ target_include_directories(ssl_transport_security_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10268,7 +10111,6 @@ target_include_directories(status_conversion_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10305,7 +10147,6 @@ target_include_directories(stream_compression_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10342,7 +10183,6 @@ target_include_directories(stream_owned_slice_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10380,7 +10220,6 @@ target_include_directories(tcp_client_posix_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10418,7 +10257,6 @@ target_include_directories(tcp_client_uv_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10456,7 +10294,6 @@ target_include_directories(tcp_posix_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10495,7 +10332,6 @@ target_include_directories(tcp_server_posix_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10533,7 +10369,6 @@ target_include_directories(tcp_server_uv_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10570,7 +10405,6 @@ target_include_directories(threadpool_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10607,7 +10441,6 @@ target_include_directories(time_averaged_stats_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10644,7 +10477,6 @@ target_include_directories(timeout_encoding_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10681,7 +10513,6 @@ target_include_directories(timer_heap_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10718,7 +10549,6 @@ target_include_directories(timer_list_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10755,7 +10585,6 @@ target_include_directories(transport_connectivity_state_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10792,7 +10621,6 @@ target_include_directories(transport_metadata_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10830,7 +10658,6 @@ target_include_directories(transport_security_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10869,7 +10696,6 @@ target_include_directories(udp_server_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10907,7 +10733,6 @@ target_include_directories(uri_parser_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10946,7 +10771,6 @@ target_include_directories(alarm_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -10989,7 +10813,6 @@ target_include_directories(alts_counter_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11030,7 +10853,6 @@ target_include_directories(alts_crypt_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11072,7 +10894,6 @@ target_include_directories(alts_crypter_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11113,7 +10934,6 @@ target_include_directories(alts_frame_handler_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11155,7 +10975,6 @@ target_include_directories(alts_frame_protector_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11196,7 +11015,6 @@ target_include_directories(alts_grpc_record_protocol_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11237,7 +11055,6 @@ target_include_directories(alts_handshaker_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11278,7 +11095,6 @@ target_include_directories(alts_iovec_record_protocol_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11319,7 +11135,6 @@ target_include_directories(alts_security_connector_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11359,7 +11174,6 @@ target_include_directories(alts_tsi_handshaker_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11400,7 +11214,6 @@ target_include_directories(alts_tsi_utils_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11441,7 +11254,6 @@ target_include_directories(alts_zero_copy_grpc_protector_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11482,7 +11294,6 @@ target_include_directories(async_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11525,7 +11336,6 @@ target_include_directories(auth_property_iterator_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11568,7 +11378,6 @@ target_include_directories(backoff_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11609,7 +11418,6 @@ target_include_directories(bdp_estimator_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11653,7 +11461,6 @@ target_include_directories(bm_alarm PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11701,7 +11508,6 @@ target_include_directories(bm_arena PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11749,7 +11555,6 @@ target_include_directories(bm_byte_buffer PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11797,7 +11602,6 @@ target_include_directories(bm_call_create PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11845,7 +11649,6 @@ target_include_directories(bm_callback_streaming_ping_pong PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11894,7 +11697,6 @@ target_include_directories(bm_callback_unary_ping_pong PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11943,7 +11745,6 @@ target_include_directories(bm_channel PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -11991,7 +11792,6 @@ target_include_directories(bm_chttp2_hpack PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12039,7 +11839,6 @@ target_include_directories(bm_chttp2_transport PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12087,7 +11886,6 @@ target_include_directories(bm_closure PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12135,7 +11933,6 @@ target_include_directories(bm_cq PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12183,7 +11980,6 @@ target_include_directories(bm_cq_multiple_threads PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12231,7 +12027,6 @@ target_include_directories(bm_error PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12279,7 +12074,6 @@ target_include_directories(bm_fullstack_streaming_ping_pong PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12327,7 +12121,6 @@ target_include_directories(bm_fullstack_streaming_pump PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12375,7 +12168,6 @@ target_include_directories(bm_fullstack_trickle PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12423,7 +12215,6 @@ target_include_directories(bm_fullstack_unary_ping_pong PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12471,7 +12262,6 @@ target_include_directories(bm_metadata PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12519,7 +12309,6 @@ target_include_directories(bm_pollset PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12567,7 +12356,6 @@ target_include_directories(bm_threadpool PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12615,7 +12403,6 @@ target_include_directories(bm_timer PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12662,7 +12449,6 @@ target_include_directories(byte_stream_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12703,7 +12489,6 @@ target_include_directories(channel_arguments_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12744,7 +12529,6 @@ target_include_directories(channel_filter_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12792,7 +12576,6 @@ target_include_directories(channel_trace_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12835,7 +12618,6 @@ target_include_directories(channelz_registry_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12885,7 +12667,6 @@ target_include_directories(channelz_service_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12936,7 +12717,6 @@ target_include_directories(channelz_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -12979,7 +12759,6 @@ target_include_directories(check_gcp_environment_linux_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13019,7 +12798,6 @@ target_include_directories(check_gcp_environment_windows_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13059,7 +12837,6 @@ target_include_directories(chttp2_settings_timeout_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13100,7 +12877,6 @@ target_include_directories(cli_call_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13145,7 +12921,6 @@ target_include_directories(client_callback_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13195,7 +12970,6 @@ target_include_directories(client_channel_stress_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13239,7 +13013,6 @@ target_include_directories(client_crash_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13283,7 +13056,6 @@ target_include_directories(client_crash_test_server PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13328,7 +13100,6 @@ target_include_directories(client_interceptors_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13371,7 +13142,6 @@ target_include_directories(client_lb_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13463,7 +13233,6 @@ target_include_directories(codegen_test_full PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13555,7 +13324,6 @@ target_include_directories(codegen_test_minimal PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13596,7 +13364,6 @@ target_include_directories(context_list_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13637,7 +13404,6 @@ target_include_directories(credentials_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13678,7 +13444,6 @@ target_include_directories(cxx_byte_buffer_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13720,7 +13485,6 @@ target_include_directories(cxx_slice_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13762,7 +13526,6 @@ target_include_directories(cxx_string_ref_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13802,7 +13565,6 @@ target_include_directories(cxx_time_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13844,7 +13606,6 @@ target_include_directories(delegating_channel_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13888,7 +13649,6 @@ target_include_directories(end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13938,7 +13698,6 @@ target_include_directories(error_details_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -13978,7 +13737,6 @@ target_include_directories(exception_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14021,7 +13779,6 @@ target_include_directories(filter_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14061,7 +13818,6 @@ target_include_directories(gen_hpack_tables PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14092,7 +13848,6 @@ target_include_directories(gen_legal_metadata_characters PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14121,7 +13876,6 @@ target_include_directories(gen_percent_encoding_tables PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14153,7 +13907,6 @@ target_include_directories(generic_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14196,7 +13949,6 @@ target_include_directories(global_config_env_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14236,7 +13988,6 @@ target_include_directories(global_config_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14283,7 +14034,6 @@ target_include_directories(golden_file_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14325,7 +14075,6 @@ target_include_directories(grpc_alts_credentials_options_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14365,7 +14114,6 @@ target_include_directories(grpc_cli PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14409,7 +14157,6 @@ target_include_directories(grpc_core_map_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14449,7 +14196,6 @@ target_include_directories(grpc_cpp_plugin PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14491,7 +14237,6 @@ target_include_directories(grpc_csharp_plugin PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14535,7 +14280,6 @@ target_include_directories(grpc_fetch_oauth2 PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14577,7 +14321,6 @@ target_include_directories(grpc_linux_system_roots_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14616,7 +14359,6 @@ target_include_directories(grpc_node_plugin PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14658,7 +14400,6 @@ target_include_directories(grpc_objective_c_plugin PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14700,7 +14441,6 @@ target_include_directories(grpc_php_plugin PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14742,7 +14482,6 @@ target_include_directories(grpc_python_plugin PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14784,7 +14523,6 @@ target_include_directories(grpc_ruby_plugin PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14828,7 +14566,6 @@ target_include_directories(grpc_spiffe_security_connector_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14885,7 +14622,6 @@ target_include_directories(grpc_tool_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14938,7 +14674,6 @@ target_include_directories(grpclb_api_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -14987,7 +14722,6 @@ target_include_directories(grpclb_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15052,7 +14786,6 @@ target_include_directories(grpclb_fallback_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15097,7 +14830,6 @@ target_include_directories(h2_ssl_cert_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15139,7 +14871,6 @@ target_include_directories(h2_ssl_session_reuse_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15181,7 +14912,6 @@ target_include_directories(health_service_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15224,7 +14954,6 @@ target_include_directories(http2_client PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15269,7 +14998,6 @@ target_include_directories(hybrid_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15312,7 +15040,6 @@ target_include_directories(inlined_vector_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15355,7 +15082,6 @@ target_include_directories(inproc_sync_unary_ping_pong_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15402,7 +15128,6 @@ target_include_directories(interop_client PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15449,7 +15174,6 @@ target_include_directories(interop_server PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15498,7 +15222,6 @@ target_include_directories(interop_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15542,7 +15265,6 @@ target_include_directories(json_run_localhost PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15587,7 +15309,6 @@ target_include_directories(memory_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15629,7 +15350,6 @@ target_include_directories(message_allocator_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15679,7 +15399,6 @@ target_include_directories(metrics_client PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15721,7 +15440,6 @@ target_include_directories(mock_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15764,7 +15482,6 @@ target_include_directories(nonblocking_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15807,7 +15524,6 @@ target_include_directories(noop-benchmark PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15846,7 +15562,6 @@ target_include_directories(optional_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15888,7 +15603,6 @@ target_include_directories(orphanable_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15930,7 +15644,6 @@ target_include_directories(port_sharing_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -15974,7 +15687,6 @@ target_include_directories(proto_server_reflection_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16019,7 +15731,6 @@ target_include_directories(proto_utils_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16060,7 +15771,6 @@ target_include_directories(qps_interarrival_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16106,7 +15816,6 @@ target_include_directories(qps_json_driver PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16153,7 +15862,6 @@ target_include_directories(qps_openloop_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16200,7 +15908,6 @@ target_include_directories(qps_worker PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16246,7 +15953,6 @@ target_include_directories(raw_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16310,7 +16016,6 @@ target_include_directories(reconnect_interop_client PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16375,7 +16080,6 @@ target_include_directories(reconnect_interop_server PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16421,7 +16125,6 @@ target_include_directories(ref_counted_ptr_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16463,7 +16166,6 @@ target_include_directories(ref_counted_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16505,7 +16207,6 @@ target_include_directories(retry_throttle_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16546,7 +16247,6 @@ target_include_directories(secure_auth_context_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16590,7 +16290,6 @@ target_include_directories(secure_sync_unary_ping_pong_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16637,7 +16336,6 @@ target_include_directories(server_builder_plugin_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16694,7 +16392,6 @@ target_include_directories(server_builder_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16752,7 +16449,6 @@ target_include_directories(server_builder_with_socket_mutator_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16796,7 +16492,6 @@ target_include_directories(server_context_test_spouse_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16839,7 +16534,6 @@ target_include_directories(server_crash_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16883,7 +16577,6 @@ target_include_directories(server_crash_test_client PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16927,7 +16620,6 @@ target_include_directories(server_early_return_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -16971,7 +16663,6 @@ target_include_directories(server_interceptors_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17028,7 +16719,6 @@ target_include_directories(server_request_call_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17071,7 +16761,6 @@ target_include_directories(service_config_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17114,7 +16803,6 @@ target_include_directories(service_config_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17156,7 +16844,6 @@ target_include_directories(shutdown_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17199,7 +16886,6 @@ target_include_directories(slice_hash_table_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17240,7 +16926,6 @@ target_include_directories(slice_weak_hash_table_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17281,7 +16966,6 @@ target_include_directories(stats_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17323,7 +17007,6 @@ target_include_directories(status_metadata_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17362,7 +17045,6 @@ target_include_directories(status_util_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17402,7 +17084,6 @@ target_include_directories(streaming_throughput_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17477,7 +17158,6 @@ target_include_directories(stress_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17521,7 +17201,6 @@ target_include_directories(string_view_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17563,7 +17242,6 @@ target_include_directories(thread_manager_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17605,7 +17283,6 @@ target_include_directories(thread_stress_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17649,7 +17326,6 @@ target_include_directories(time_change_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17693,7 +17369,6 @@ target_include_directories(transport_pid_controller_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17736,7 +17411,6 @@ target_include_directories(transport_security_common_api_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17778,7 +17452,6 @@ target_include_directories(writes_per_rpc_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17836,7 +17509,6 @@ target_include_directories(xds_end2end_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17877,7 +17549,6 @@ target_include_directories(public_headers_must_be_c89 PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17910,7 +17581,6 @@ target_include_directories(bad_streaming_id_bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17952,7 +17622,6 @@ target_include_directories(badreq_bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -17994,7 +17663,6 @@ target_include_directories(connection_prefix_bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18036,7 +17704,6 @@ target_include_directories(duplicate_header_bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18078,7 +17745,6 @@ target_include_directories(head_of_line_blocking_bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18120,7 +17786,6 @@ target_include_directories(headers_bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18162,7 +17827,6 @@ target_include_directories(initial_settings_frame_bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18204,7 +17868,6 @@ target_include_directories(large_metadata_bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18246,7 +17909,6 @@ target_include_directories(out_of_bounds_bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18288,7 +17950,6 @@ target_include_directories(server_registered_method_bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18330,7 +17991,6 @@ target_include_directories(simple_request_bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18372,7 +18032,6 @@ target_include_directories(unknown_frame_bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18414,7 +18073,6 @@ target_include_directories(window_overflow_bad_client_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18455,7 +18113,6 @@ target_include_directories(bad_ssl_cert_server PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18495,7 +18152,6 @@ target_include_directories(bad_ssl_cert_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18533,7 +18189,6 @@ target_include_directories(h2_census_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18571,7 +18226,6 @@ target_include_directories(h2_compress_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18609,7 +18263,6 @@ target_include_directories(h2_fakesec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18648,7 +18301,6 @@ target_include_directories(h2_fd_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18687,7 +18339,6 @@ target_include_directories(h2_full_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18726,7 +18377,6 @@ target_include_directories(h2_full+pipe_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18765,7 +18415,6 @@ target_include_directories(h2_full+trace_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18803,7 +18452,6 @@ target_include_directories(h2_full+workarounds_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18841,7 +18489,6 @@ target_include_directories(h2_http_proxy_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18880,7 +18527,6 @@ target_include_directories(h2_local_ipv4_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18920,7 +18566,6 @@ target_include_directories(h2_local_ipv6_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18960,7 +18605,6 @@ target_include_directories(h2_local_uds_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -18999,7 +18643,6 @@ target_include_directories(h2_oauth2_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19037,7 +18680,6 @@ target_include_directories(h2_proxy_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19075,7 +18717,6 @@ target_include_directories(h2_sockpair_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19113,7 +18754,6 @@ target_include_directories(h2_sockpair+trace_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19151,7 +18791,6 @@ target_include_directories(h2_sockpair_1byte_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19189,7 +18828,6 @@ target_include_directories(h2_spiffe_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19227,7 +18865,6 @@ target_include_directories(h2_ssl_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19265,7 +18902,6 @@ target_include_directories(h2_ssl_cred_reload_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19303,7 +18939,6 @@ target_include_directories(h2_ssl_proxy_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19342,7 +18977,6 @@ target_include_directories(h2_uds_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19381,7 +19015,6 @@ target_include_directories(inproc_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19419,7 +19052,6 @@ target_include_directories(h2_census_nosec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19457,7 +19089,6 @@ target_include_directories(h2_compress_nosec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19496,7 +19127,6 @@ target_include_directories(h2_fd_nosec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19535,7 +19165,6 @@ target_include_directories(h2_full_nosec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19574,7 +19203,6 @@ target_include_directories(h2_full+pipe_nosec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19613,7 +19241,6 @@ target_include_directories(h2_full+trace_nosec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19651,7 +19278,6 @@ target_include_directories(h2_full+workarounds_nosec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19689,7 +19315,6 @@ target_include_directories(h2_http_proxy_nosec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19727,7 +19352,6 @@ target_include_directories(h2_proxy_nosec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19765,7 +19389,6 @@ target_include_directories(h2_sockpair_nosec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19803,7 +19426,6 @@ target_include_directories(h2_sockpair+trace_nosec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19841,7 +19463,6 @@ target_include_directories(h2_sockpair_1byte_nosec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19880,7 +19501,6 @@ target_include_directories(h2_uds_nosec_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19921,7 +19541,6 @@ target_include_directories(resolver_component_test_unsecure PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -19966,7 +19585,6 @@ target_include_directories(resolver_component_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20012,7 +19630,6 @@ target_include_directories(resolver_component_tests_runner_invoker_unsecure PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20058,7 +19675,6 @@ target_include_directories(resolver_component_tests_runner_invoker PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20103,7 +19719,6 @@ target_include_directories(address_sorting_test_unsecure PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20147,7 +19762,6 @@ target_include_directories(address_sorting_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20191,7 +19805,6 @@ target_include_directories(cancel_ares_query_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20235,7 +19848,6 @@ target_include_directories(alts_credentials_fuzzer_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20273,7 +19885,6 @@ target_include_directories(api_fuzzer_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20311,7 +19922,6 @@ target_include_directories(client_fuzzer_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20349,7 +19959,6 @@ target_include_directories(hpack_parser_fuzzer_test_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20387,7 +19996,6 @@ target_include_directories(http_request_fuzzer_test_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20425,7 +20033,6 @@ target_include_directories(http_response_fuzzer_test_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20463,7 +20070,6 @@ target_include_directories(json_fuzzer_test_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20501,7 +20107,6 @@ target_include_directories(nanopb_fuzzer_response_test_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20539,7 +20144,6 @@ target_include_directories(nanopb_fuzzer_serverlist_test_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20577,7 +20181,6 @@ target_include_directories(percent_decode_fuzzer_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20615,7 +20218,6 @@ target_include_directories(percent_encode_fuzzer_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20653,7 +20255,6 @@ target_include_directories(server_fuzzer_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20691,7 +20292,6 @@ target_include_directories(ssl_server_fuzzer_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} @@ -20729,7 +20329,6 @@ target_include_directories(uri_fuzzer_test_one_entry PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} diff --git a/Makefile b/Makefile index ec88bd3926c..5b809a28866 100644 --- a/Makefile +++ b/Makefile @@ -354,7 +354,7 @@ CXXFLAGS += -stdlib=libc++ LDFLAGS += -framework CoreFoundation endif CXXFLAGS += -Wnon-virtual-dtor -CPPFLAGS += -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/nanopb -Ithird_party/upb -Isrc/core/ext/upb-generated +CPPFLAGS += -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb -Isrc/core/ext/upb-generated COREFLAGS += -fno-rtti -fno-exceptions LDFLAGS += -g diff --git a/PYTHON-MANIFEST.in b/PYTHON-MANIFEST.in index aa044d84074..003b26a7d36 100644 --- a/PYTHON-MANIFEST.in +++ b/PYTHON-MANIFEST.in @@ -7,7 +7,6 @@ graft include/grpc graft third_party/address_sorting graft third_party/boringssl graft third_party/cares -graft third_party/nanopb graft third_party/upb graft third_party/zlib include src/python/grpcio/_parallel_compile_patch.py diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index b226f15aa2a..06307b844cb 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -8,11 +8,6 @@ load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps") def grpc_deps(): """Loads dependencies need to compile and test the grpc library.""" - native.bind( - name = "nanopb", - actual = "@com_github_nanopb_nanopb//:nanopb", - ) - native.bind( name = "upb_lib", actual = "@upb//:upb", @@ -129,15 +124,6 @@ def grpc_deps(): url = "https://github.com/google/protobuf/archive/09745575a923640154bcf307fba8aedff47f240a.tar.gz", ) - if "com_github_nanopb_nanopb" not in native.existing_rules(): - http_archive( - name = "com_github_nanopb_nanopb", - build_file = "@com_github_grpc_grpc//third_party:nanopb.BUILD", - sha256 = "8bbbb1e78d4ddb0a1919276924ab10d11b631df48b657d960e0c795a25515735", - strip_prefix = "nanopb-f8ac463766281625ad710900479130c7fcb4d63b", - url = "https://github.com/nanopb/nanopb/archive/f8ac463766281625ad710900479130c7fcb4d63b.tar.gz", - ) - if "com_github_google_googletest" not in native.existing_rules(): http_archive( name = "com_github_google_googletest", diff --git a/build.yaml b/build.yaml index f43964408d4..f06a2b99d87 100644 --- a/build.yaml +++ b/build.yaml @@ -589,7 +589,6 @@ filegroups: - grpc_transport_inproc_headers - grpc++_codegen_base - grpc++_internal_hdrs_only - - nanopb_headers - name: grpc++_config_proto public_headers: - include/grpc++/impl/codegen/config_protobuf.h @@ -1537,19 +1536,6 @@ filegroups: - name: grpcpp_channelz_proto src: - src/proto/grpc/channelz/channelz.proto -- name: nanopb - src: - - third_party/nanopb/pb_common.c - - third_party/nanopb/pb_decode.c - - third_party/nanopb/pb_encode.c - uses: - - nanopb_headers -- name: nanopb_headers - headers: - - third_party/nanopb/pb.h - - third_party/nanopb/pb_common.h - - third_party/nanopb/pb_decode.h - - third_party/nanopb/pb_encode.h - name: proto_gen_validate_upb headers: - src/core/ext/upb-generated/gogoproto/gogo.upb.h @@ -6202,8 +6188,8 @@ defaults: CPPFLAGS: -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers - -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/nanopb - -Ithird_party/upb -Isrc/core/ext/upb-generated + -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb + -Isrc/core/ext/upb-generated CXXFLAGS: -Wnon-virtual-dtor LDFLAGS: -g zlib: diff --git a/cmake/nanopb.cmake b/cmake/nanopb.cmake deleted file mode 100644 index cebf6da27cd..00000000000 --- a/cmake/nanopb.cmake +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2018 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set(_gRPC_NANOPB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/nanopb") diff --git a/config.m4 b/config.m4 index 2a074768f57..d78bdfc75ac 100644 --- a/config.m4 +++ b/config.m4 @@ -10,7 +10,6 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/address_sorting/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include) - PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/nanopb) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/upb) LIBS="-lpthread $LIBS" diff --git a/config.w32 b/config.w32 index 065da74bfb9..176ba2f340b 100644 --- a/config.w32 +++ b/config.w32 @@ -713,7 +713,6 @@ if (PHP_GRPC != "no") { "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+ "/I"+configure_module_dirname+"\\third_party\\address_sorting\\include "+ "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ - "/I"+configure_module_dirname+"\\third_party\\nanopb "+ "/I"+configure_module_dirname+"\\third_party\\upb "+ "/I"+configure_module_dirname+"\\third_party\\zlib "); diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 391eed9942f..d71773a7361 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -215,7 +215,6 @@ Pod::Spec.new do |s| ss.header_mappings_dir = '.' ss.dependency "#{s.name}/Interface", version ss.dependency 'gRPC-Core', grpc_version - ss.dependency 'nanopb', '~> 0.3' ss.source_files = 'include/grpcpp/impl/codegen/core_codegen.h', 'src/cpp/client/secure_credentials.h', @@ -228,10 +227,6 @@ Pod::Spec.new do |s| 'src/cpp/server/health/default_health_check_service.h', 'src/cpp/server/thread_pool_interface.h', 'src/cpp/thread_manager/thread_manager.h', - 'third_party/nanopb/pb.h', - 'third_party/nanopb/pb_common.h', - 'third_party/nanopb/pb_decode.h', - 'third_party/nanopb/pb_encode.h', 'src/cpp/client/insecure_credentials.cc', 'src/cpp/client/secure_credentials.cc', 'src/cpp/common/auth_property_iterator.cc', @@ -276,362 +271,7 @@ Pod::Spec.new do |s| 'src/cpp/util/string_ref.cc', 'src/cpp/util/time_cc.cc', 'src/cpp/codegen/codegen_init.cc', - 'src/cpp/client/cronet_credentials.cc', - 'src/core/lib/gpr/alloc.h', - 'src/core/lib/gpr/arena.h', - 'src/core/lib/gpr/env.h', - 'src/core/lib/gpr/mpscq.h', - 'src/core/lib/gpr/murmur_hash.h', - 'src/core/lib/gpr/spinlock.h', - 'src/core/lib/gpr/string.h', - 'src/core/lib/gpr/string_windows.h', - 'src/core/lib/gpr/time_precise.h', - 'src/core/lib/gpr/tls.h', - 'src/core/lib/gpr/tls_gcc.h', - 'src/core/lib/gpr/tls_msvc.h', - 'src/core/lib/gpr/tls_pthread.h', - 'src/core/lib/gpr/tmpfile.h', - 'src/core/lib/gpr/useful.h', - 'src/core/lib/gprpp/abstract.h', - 'src/core/lib/gprpp/arena.h', - 'src/core/lib/gprpp/atomic.h', - 'src/core/lib/gprpp/fork.h', - 'src/core/lib/gprpp/global_config.h', - 'src/core/lib/gprpp/global_config_custom.h', - 'src/core/lib/gprpp/global_config_env.h', - 'src/core/lib/gprpp/global_config_generic.h', - 'src/core/lib/gprpp/host_port.h', - 'src/core/lib/gprpp/manual_constructor.h', - 'src/core/lib/gprpp/map.h', - 'src/core/lib/gprpp/memory.h', - 'src/core/lib/gprpp/pair.h', - 'src/core/lib/gprpp/sync.h', - 'src/core/lib/gprpp/thd.h', - 'src/core/lib/profiling/timers.h', - 'src/core/ext/transport/chttp2/transport/bin_decoder.h', - 'src/core/ext/transport/chttp2/transport/bin_encoder.h', - 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', - 'src/core/ext/transport/chttp2/transport/context_list.h', - 'src/core/ext/transport/chttp2/transport/flow_control.h', - 'src/core/ext/transport/chttp2/transport/frame.h', - 'src/core/ext/transport/chttp2/transport/frame_data.h', - 'src/core/ext/transport/chttp2/transport/frame_goaway.h', - 'src/core/ext/transport/chttp2/transport/frame_ping.h', - 'src/core/ext/transport/chttp2/transport/frame_rst_stream.h', - 'src/core/ext/transport/chttp2/transport/frame_settings.h', - 'src/core/ext/transport/chttp2/transport/frame_window_update.h', - 'src/core/ext/transport/chttp2/transport/hpack_encoder.h', - 'src/core/ext/transport/chttp2/transport/hpack_parser.h', - 'src/core/ext/transport/chttp2/transport/hpack_table.h', - 'src/core/ext/transport/chttp2/transport/http2_settings.h', - 'src/core/ext/transport/chttp2/transport/huffsyms.h', - 'src/core/ext/transport/chttp2/transport/incoming_metadata.h', - 'src/core/ext/transport/chttp2/transport/internal.h', - 'src/core/ext/transport/chttp2/transport/stream_map.h', - 'src/core/ext/transport/chttp2/transport/varint.h', - 'src/core/ext/transport/chttp2/alpn/alpn.h', - 'src/core/ext/filters/http/client/http_client_filter.h', - 'src/core/ext/filters/http/message_compress/message_compress_filter.h', - 'src/core/ext/filters/http/server/http_server_filter.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h', - 'src/core/ext/filters/client_channel/lb_policy/xds/xds.h', - 'src/core/lib/security/context/security_context.h', - 'src/core/lib/security/credentials/alts/alts_credentials.h', - 'src/core/lib/security/credentials/composite/composite_credentials.h', - 'src/core/lib/security/credentials/credentials.h', - 'src/core/lib/security/credentials/fake/fake_credentials.h', - 'src/core/lib/security/credentials/google_default/google_default_credentials.h', - 'src/core/lib/security/credentials/iam/iam_credentials.h', - 'src/core/lib/security/credentials/jwt/json_token.h', - 'src/core/lib/security/credentials/jwt/jwt_credentials.h', - 'src/core/lib/security/credentials/jwt/jwt_verifier.h', - 'src/core/lib/security/credentials/local/local_credentials.h', - 'src/core/lib/security/credentials/oauth2/oauth2_credentials.h', - 'src/core/lib/security/credentials/plugin/plugin_credentials.h', - 'src/core/lib/security/credentials/ssl/ssl_credentials.h', - 'src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h', - 'src/core/lib/security/credentials/tls/spiffe_credentials.h', - 'src/core/lib/security/security_connector/alts/alts_security_connector.h', - 'src/core/lib/security/security_connector/fake/fake_security_connector.h', - 'src/core/lib/security/security_connector/load_system_roots.h', - 'src/core/lib/security/security_connector/load_system_roots_linux.h', - 'src/core/lib/security/security_connector/local/local_security_connector.h', - 'src/core/lib/security/security_connector/security_connector.h', - 'src/core/lib/security/security_connector/ssl/ssl_security_connector.h', - 'src/core/lib/security/security_connector/ssl_utils.h', - 'src/core/lib/security/security_connector/tls/spiffe_security_connector.h', - 'src/core/lib/security/transport/auth_filters.h', - 'src/core/lib/security/transport/secure_endpoint.h', - 'src/core/lib/security/transport/security_handshaker.h', - 'src/core/lib/security/transport/target_authority_table.h', - 'src/core/lib/security/transport/tsi_error.h', - 'src/core/lib/security/util/json_util.h', - 'src/core/tsi/alts/crypt/gsec.h', - 'src/core/tsi/alts/frame_protector/alts_counter.h', - 'src/core/tsi/alts/frame_protector/alts_crypter.h', - 'src/core/tsi/alts/frame_protector/alts_frame_protector.h', - 'src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h', - 'src/core/tsi/alts/frame_protector/frame_handler.h', - 'src/core/tsi/alts/handshaker/alts_handshaker_client.h', - 'src/core/tsi/alts/handshaker/alts_shared_resource.h', - 'src/core/tsi/alts/handshaker/alts_tsi_handshaker.h', - 'src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h', - 'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h', - 'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h', - 'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h', - 'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h', - 'src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h', - 'src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h', - 'src/core/lib/security/credentials/alts/check_gcp_environment.h', - 'src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h', - 'src/core/tsi/alts/handshaker/alts_tsi_utils.h', - 'src/core/tsi/alts/handshaker/transport_security_common_api.h', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h', - 'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h', - 'third_party/upb/upb/decode.h', - 'third_party/upb/upb/encode.h', - 'third_party/upb/upb/generated_util.h', - 'third_party/upb/upb/msg.h', - 'third_party/upb/upb/port_def.inc', - 'third_party/upb/upb/port_undef.inc', - 'third_party/upb/upb/table.int.h', - 'third_party/upb/upb/upb.h', - 'src/core/tsi/transport_security.h', - 'src/core/tsi/transport_security_interface.h', - 'src/core/ext/transport/chttp2/client/authority.h', - 'src/core/ext/transport/chttp2/client/chttp2_connector.h', - 'src/core/ext/filters/client_channel/backup_poller.h', - 'src/core/ext/filters/client_channel/client_channel.h', - 'src/core/ext/filters/client_channel/client_channel_channelz.h', - 'src/core/ext/filters/client_channel/client_channel_factory.h', - 'src/core/ext/filters/client_channel/connector.h', - 'src/core/ext/filters/client_channel/global_subchannel_pool.h', - 'src/core/ext/filters/client_channel/health/health_check_client.h', - 'src/core/ext/filters/client_channel/http_connect_handshaker.h', - 'src/core/ext/filters/client_channel/http_proxy.h', - 'src/core/ext/filters/client_channel/lb_policy.h', - 'src/core/ext/filters/client_channel/lb_policy_factory.h', - 'src/core/ext/filters/client_channel/lb_policy_registry.h', - 'src/core/ext/filters/client_channel/local_subchannel_pool.h', - 'src/core/ext/filters/client_channel/parse_address.h', - 'src/core/ext/filters/client_channel/proxy_mapper.h', - 'src/core/ext/filters/client_channel/proxy_mapper_registry.h', - 'src/core/ext/filters/client_channel/resolver.h', - 'src/core/ext/filters/client_channel/resolver_factory.h', - 'src/core/ext/filters/client_channel/resolver_registry.h', - 'src/core/ext/filters/client_channel/resolver_result_parsing.h', - 'src/core/ext/filters/client_channel/resolving_lb_policy.h', - 'src/core/ext/filters/client_channel/retry_throttle.h', - 'src/core/ext/filters/client_channel/server_address.h', - 'src/core/ext/filters/client_channel/service_config.h', - 'src/core/ext/filters/client_channel/subchannel.h', - 'src/core/ext/filters/client_channel/subchannel_interface.h', - 'src/core/ext/filters/client_channel/subchannel_pool_interface.h', - 'src/core/ext/filters/deadline/deadline_filter.h', - 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', - 'src/core/tsi/fake_transport_security.h', - 'src/core/tsi/local_transport_security.h', - 'src/core/tsi/ssl/session_cache/ssl_session.h', - 'src/core/tsi/ssl/session_cache/ssl_session_cache.h', - 'src/core/tsi/ssl_transport_security.h', - 'src/core/tsi/ssl_types.h', - 'src/core/tsi/transport_security_grpc.h', - 'src/core/tsi/grpc_shadow_boringssl.h', - 'src/core/ext/transport/chttp2/server/chttp2_server.h', - 'src/core/ext/transport/inproc/inproc_transport.h', - 'src/core/lib/avl/avl.h', - 'src/core/lib/backoff/backoff.h', - 'src/core/lib/channel/channel_args.h', - 'src/core/lib/channel/channel_stack.h', - 'src/core/lib/channel/channel_stack_builder.h', - 'src/core/lib/channel/channel_trace.h', - 'src/core/lib/channel/channelz.h', - 'src/core/lib/channel/channelz_registry.h', - 'src/core/lib/channel/connected_channel.h', - 'src/core/lib/channel/context.h', - 'src/core/lib/channel/handshaker.h', - 'src/core/lib/channel/handshaker_factory.h', - 'src/core/lib/channel/handshaker_registry.h', - 'src/core/lib/channel/status_util.h', - 'src/core/lib/compression/algorithm_metadata.h', - 'src/core/lib/compression/compression_args.h', - 'src/core/lib/compression/compression_internal.h', - 'src/core/lib/compression/message_compress.h', - 'src/core/lib/compression/stream_compression.h', - 'src/core/lib/compression/stream_compression_gzip.h', - 'src/core/lib/compression/stream_compression_identity.h', - 'src/core/lib/debug/stats.h', - 'src/core/lib/debug/stats_data.h', - 'src/core/lib/gprpp/debug_location.h', - 'src/core/lib/gprpp/inlined_vector.h', - 'src/core/lib/gprpp/optional.h', - 'src/core/lib/gprpp/orphanable.h', - 'src/core/lib/gprpp/ref_counted.h', - 'src/core/lib/gprpp/ref_counted_ptr.h', - 'src/core/lib/gprpp/string_view.h', - 'src/core/lib/http/format_request.h', - 'src/core/lib/http/httpcli.h', - 'src/core/lib/http/parser.h', - 'src/core/lib/iomgr/block_annotate.h', - 'src/core/lib/iomgr/buffer_list.h', - 'src/core/lib/iomgr/call_combiner.h', - 'src/core/lib/iomgr/cfstream_handle.h', - 'src/core/lib/iomgr/closure.h', - 'src/core/lib/iomgr/combiner.h', - 'src/core/lib/iomgr/dynamic_annotations.h', - 'src/core/lib/iomgr/endpoint.h', - 'src/core/lib/iomgr/endpoint_cfstream.h', - 'src/core/lib/iomgr/endpoint_pair.h', - 'src/core/lib/iomgr/error.h', - 'src/core/lib/iomgr/error_cfstream.h', - 'src/core/lib/iomgr/error_internal.h', - 'src/core/lib/iomgr/ev_epoll1_linux.h', - 'src/core/lib/iomgr/ev_epollex_linux.h', - 'src/core/lib/iomgr/ev_poll_posix.h', - 'src/core/lib/iomgr/ev_posix.h', - 'src/core/lib/iomgr/exec_ctx.h', - 'src/core/lib/iomgr/executor.h', - 'src/core/lib/iomgr/executor/mpmcqueue.h', - 'src/core/lib/iomgr/executor/threadpool.h', - 'src/core/lib/iomgr/gethostname.h', - 'src/core/lib/iomgr/grpc_if_nametoindex.h', - 'src/core/lib/iomgr/internal_errqueue.h', - 'src/core/lib/iomgr/iocp_windows.h', - 'src/core/lib/iomgr/iomgr.h', - 'src/core/lib/iomgr/iomgr_custom.h', - 'src/core/lib/iomgr/iomgr_internal.h', - 'src/core/lib/iomgr/iomgr_posix.h', - 'src/core/lib/iomgr/is_epollexclusive_available.h', - 'src/core/lib/iomgr/load_file.h', - 'src/core/lib/iomgr/lockfree_event.h', - 'src/core/lib/iomgr/nameser.h', - 'src/core/lib/iomgr/polling_entity.h', - 'src/core/lib/iomgr/pollset.h', - 'src/core/lib/iomgr/pollset_custom.h', - 'src/core/lib/iomgr/pollset_set.h', - 'src/core/lib/iomgr/pollset_set_custom.h', - 'src/core/lib/iomgr/pollset_set_windows.h', - 'src/core/lib/iomgr/pollset_windows.h', - 'src/core/lib/iomgr/port.h', - 'src/core/lib/iomgr/resolve_address.h', - 'src/core/lib/iomgr/resolve_address_custom.h', - 'src/core/lib/iomgr/resource_quota.h', - 'src/core/lib/iomgr/sockaddr.h', - 'src/core/lib/iomgr/sockaddr_custom.h', - 'src/core/lib/iomgr/sockaddr_posix.h', - 'src/core/lib/iomgr/sockaddr_utils.h', - 'src/core/lib/iomgr/sockaddr_windows.h', - 'src/core/lib/iomgr/socket_factory_posix.h', - 'src/core/lib/iomgr/socket_mutator.h', - 'src/core/lib/iomgr/socket_utils.h', - 'src/core/lib/iomgr/socket_utils_posix.h', - 'src/core/lib/iomgr/socket_windows.h', - 'src/core/lib/iomgr/sys_epoll_wrapper.h', - 'src/core/lib/iomgr/tcp_client.h', - 'src/core/lib/iomgr/tcp_client_posix.h', - 'src/core/lib/iomgr/tcp_custom.h', - 'src/core/lib/iomgr/tcp_posix.h', - 'src/core/lib/iomgr/tcp_server.h', - 'src/core/lib/iomgr/tcp_server_utils_posix.h', - 'src/core/lib/iomgr/tcp_windows.h', - 'src/core/lib/iomgr/time_averaged_stats.h', - 'src/core/lib/iomgr/timer.h', - 'src/core/lib/iomgr/timer_custom.h', - 'src/core/lib/iomgr/timer_heap.h', - 'src/core/lib/iomgr/timer_manager.h', - 'src/core/lib/iomgr/udp_server.h', - 'src/core/lib/iomgr/unix_sockets_posix.h', - 'src/core/lib/iomgr/wakeup_fd_pipe.h', - 'src/core/lib/iomgr/wakeup_fd_posix.h', - 'src/core/lib/json/json.h', - 'src/core/lib/json/json_common.h', - 'src/core/lib/json/json_reader.h', - 'src/core/lib/json/json_writer.h', - 'src/core/lib/slice/b64.h', - 'src/core/lib/slice/percent_encoding.h', - 'src/core/lib/slice/slice_hash_table.h', - 'src/core/lib/slice/slice_internal.h', - 'src/core/lib/slice/slice_string_helpers.h', - 'src/core/lib/slice/slice_utils.h', - 'src/core/lib/slice/slice_weak_hash_table.h', - 'src/core/lib/surface/api_trace.h', - 'src/core/lib/surface/call.h', - 'src/core/lib/surface/call_test_only.h', - 'src/core/lib/surface/channel.h', - 'src/core/lib/surface/channel_init.h', - 'src/core/lib/surface/channel_stack_type.h', - 'src/core/lib/surface/completion_queue.h', - 'src/core/lib/surface/completion_queue_factory.h', - 'src/core/lib/surface/event_string.h', - 'src/core/lib/surface/init.h', - 'src/core/lib/surface/lame_client.h', - 'src/core/lib/surface/server.h', - 'src/core/lib/surface/validate_metadata.h', - 'src/core/lib/transport/bdp_estimator.h', - 'src/core/lib/transport/byte_stream.h', - 'src/core/lib/transport/connectivity_state.h', - 'src/core/lib/transport/error_utils.h', - 'src/core/lib/transport/http2_errors.h', - 'src/core/lib/transport/metadata.h', - 'src/core/lib/transport/metadata_batch.h', - 'src/core/lib/transport/pid_controller.h', - 'src/core/lib/transport/static_metadata.h', - 'src/core/lib/transport/status_conversion.h', - 'src/core/lib/transport/status_metadata.h', - 'src/core/lib/transport/timeout_encoding.h', - 'src/core/lib/transport/transport.h', - 'src/core/lib/transport/transport_impl.h', - 'src/core/lib/uri/uri_parser.h', - 'src/core/lib/debug/trace.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', - 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', - 'src/core/ext/upb-generated/google/api/annotations.upb.h', - 'src/core/ext/upb-generated/google/api/http.upb.h', - 'src/core/ext/upb-generated/google/protobuf/any.upb.h', - 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', - 'src/core/ext/upb-generated/google/rpc/status.upb.h', - 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', - 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h', - 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h', - 'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h', - 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h', - 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.h', - 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h', - 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h', - 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h', - 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.h', - 'src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h', - 'src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h', - 'src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h', - 'src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h', - 'src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h', - 'src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h', - 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h', - 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h', - 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h', - 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h', - 'src/core/ext/upb-generated/envoy/type/percent.upb.h', - 'src/core/ext/upb-generated/envoy/type/range.upb.h', - 'src/core/ext/upb-generated/gogoproto/gogo.upb.h', - 'src/core/ext/upb-generated/validate/validate.upb.h', - 'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h', - 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h', - 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h', - 'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h', - 'src/core/ext/filters/max_age/max_age_filter.h', - 'src/core/ext/filters/message_size/message_size_filter.h', - 'src/core/ext/filters/http/client_authority_filter.h', - 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h', - 'src/core/ext/filters/workarounds/workaround_utils.h' + 'src/cpp/client/cronet_credentials.cc' ss.private_header_files = 'include/grpcpp/impl/codegen/core_codegen.h', 'src/cpp/client/secure_credentials.h', @@ -843,8 +483,6 @@ Pod::Spec.new do |s| end s.prepare_command = <<-END_OF_COMMAND - sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS==1\\\n #include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/core -type f -print | xargs grep -H -c '#include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/cpp -type f -print | xargs grep -H -c '#include 0.3' ss.compiler_flags = '-DGRPC_SHADOW_BORINGSSL_SYMBOLS' # To save you from scrolling, this is the last part of the podspec. @@ -1480,7 +1479,6 @@ Pod::Spec.new do |s| # TODO (mxyan): Instead of this hack, add include path "third_party" to C core's include path? s.prepare_command = <<-END_OF_COMMAND - sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS==1\\\n #include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/core -type f -print | xargs grep -H -c '#include ;#if COCOAPODS==1\\\n #include \\\n#else\\\n #include \\\n#endif;g' $(find src/core -type f \\( -path '*.h' -or -path '*.cc' \\) -print | xargs grep -H -c '#include <%! - def needs_nanopb(srcs): - return any(f.startswith("third_party/nanopb") - or f.endswith(".pb.h") - or f.endswith(".pb.c") - or f.endswith(".pb.cc") - or f.endswith("load_balancer_api.h") - or f.endswith("load_balancer_api.c") - for f in srcs) - %><%! def needs_address_sorting(sources): return needs_ares(sources) or any("address_sorting" in s for s in sources) @@ -87,15 +75,12 @@ dirs = ["third_party/cares"] if needs_address_sorting(sources): dirs.append("third_party/address_sorting/include") - if needs_nanopb(sources): - dirs.append("third_party/nanopb") return dirs %><%! def strip_sources(sources, name): return [f for f in sources if "ruby_generator" not in f - and ("third_party/nanopb" not in f or name == "nanopb") and ("health.pb" not in f or name == "health_proto")] %><%! @@ -126,7 +111,7 @@ %> % for lib in filegroups: - % if lib.name in ("nanopb", "health_proto"): + % if lib.name in ("health_proto"): ${cc_library(lib)} %endif %endfor diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index 8d01540453c..bcdd5f152ce 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -190,7 +190,6 @@ include(cmake/benchmark.cmake) include(cmake/cares.cmake) include(cmake/gflags.cmake) - include(cmake/nanopb.cmake) include(cmake/protobuf.cmake) include(cmake/ssl.cmake) include(cmake/upb.cmake) @@ -431,7 +430,6 @@ PRIVATE <%text>${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE <%text>${_gRPC_CARES_INCLUDE_DIR} PRIVATE <%text>${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE <%text>${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE <%text>${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE <%text>${_gRPC_SSL_INCLUDE_DIR} PRIVATE <%text>${_gRPC_UPB_GENERATED_DIR} @@ -530,7 +528,6 @@ PRIVATE <%text>${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE <%text>${_gRPC_CARES_INCLUDE_DIR} PRIVATE <%text>${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE <%text>${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE <%text>${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE <%text>${_gRPC_SSL_INCLUDE_DIR} PRIVATE <%text>${_gRPC_UPB_GENERATED_DIR} diff --git a/templates/config.m4.template b/templates/config.m4.template index 677c7ddf63a..794c6f3e86b 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -12,7 +12,6 @@ PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/address_sorting/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include) - PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/nanopb) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/upb) LIBS="-lpthread $LIBS" diff --git a/templates/config.w32.template b/templates/config.w32.template index 70920f3527d..2515863516c 100644 --- a/templates/config.w32.template +++ b/templates/config.w32.template @@ -30,7 +30,6 @@ "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+ "/I"+configure_module_dirname+"\\third_party\\address_sorting\\include "+ "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ - "/I"+configure_module_dirname+"\\third_party\\nanopb "+ "/I"+configure_module_dirname+"\\third_party\\upb "+ "/I"+configure_module_dirname+"\\third_party\\zlib "); <% diff --git a/templates/gRPC-C++.podspec.template b/templates/gRPC-C++.podspec.template index 6ee6798f95e..1e7771f29b1 100644 --- a/templates/gRPC-C++.podspec.template +++ b/templates/gRPC-C++.podspec.template @@ -67,10 +67,6 @@ excl_files += grpcpp_proto_files(filegroups) out = [file for file in out if file not in excl_files] - # Since some C++ source files directly included private headers in C core, we include all the - # C core headers in C++ Implementation subspec as well. - out += [file for file in grpc_private_headers(libs) if not file.startswith("third_party/nanopb/")] - out = filter_grpcpp(out) return out @@ -81,10 +77,6 @@ excl_files = grpcpp_proto_files(filegroups) out = [file for file in out if file not in excl_files] - # Since some C++ source files directly included private headers in C core, we intentionally - # keep the C core headers in \a out. But we should exclude nanopb headers. - out = [file for file in out if not file.startswith("third_party/nanopb/")] - out = filter_grpcpp(out) return out @@ -208,7 +200,6 @@ ss.header_mappings_dir = '.' ss.dependency "#{s.name}/Interface", version ss.dependency 'gRPC-Core', grpc_version - ss.dependency 'nanopb', '~> 0.3' ss.source_files = ${ruby_multiline_list(grpcpp_private_files(libs, filegroups), 22)} @@ -223,8 +214,6 @@ end s.prepare_command = <<-END_OF_COMMAND - sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS==1\\\n #include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/core -type f -print | xargs grep -H -c '#include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/cpp -type f -print | xargs grep -H -c '#include 0.3' ss.compiler_flags = '-DGRPC_SHADOW_BORINGSSL_SYMBOLS' # To save you from scrolling, this is the last part of the podspec. @@ -213,7 +212,6 @@ # TODO (mxyan): Instead of this hack, add include path "third_party" to C core's include path? s.prepare_command = <<-END_OF_COMMAND - sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS==1\\\n #include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/core -type f -print | xargs grep -H -c '#include ;#if COCOAPODS==1\\\n #include \\\n#else\\\n #include \\\n#endif;g' $(find src/core -type f \\( -path '*.h' -or -path '*.cc' \\) -print | xargs grep -H -c '#include -Michael Poole -Daniel Kan -Stan Hu -dch -Steffen Siering -Jens Steinhauser -Pavel Ilin -Kent Ryhorchuk -Martin Donath -Oliver Lee -Michael Haberler -Nicolas Colomer -Ivan Kravets -Kyle Manna -Benjamin Kamath -Andrew Ruder -Kenshi Kawaguchi -isotes -Maxim Khitrov -Yaniv Mordekhay -Ming Zhao -Google, Inc. -Tom Roeder diff --git a/third_party/nanopb/BUILD b/third_party/nanopb/BUILD deleted file mode 100644 index 1dc830eb018..00000000000 --- a/third_party/nanopb/BUILD +++ /dev/null @@ -1,24 +0,0 @@ -licenses(["notice"]) - -exports_files(["LICENSE.txt"]) - -package(default_visibility = ["//visibility:public"]) - -cc_library( - name = "nanopb", - srcs = [ - "pb_common.c", - "pb_decode.c", - "pb_encode.c", - ], - hdrs = [ - "pb.h", - "pb_common.h", - "pb_decode.h", - "pb_encode.h", - ], - defines = [ - "PB_FIELD_32BIT=1", - ], - visibility = ["//visibility:public"], -) diff --git a/third_party/nanopb/CHANGELOG.txt b/third_party/nanopb/CHANGELOG.txt deleted file mode 100644 index 8437688fc52..00000000000 --- a/third_party/nanopb/CHANGELOG.txt +++ /dev/null @@ -1,241 +0,0 @@ -nanopb-0.3.6 (2016-06-19) - Protect against corrupted _count fields in pb_release (#205) - Fix error in STATIC_ASSERT with multiple files (#203) - Add -D option to specify output directory (#193) - Generate MIN/MAX/ARRAYSIZE defines for enums (#194) - Generate comments about uncalculable message sizes (#195) - Documentation updates (#196, #201) - Improvements to test cases. - -nanopb-0.3.5 (2016-02-13) - NOTE: If you are using pb_syshdr.h, you will need to add uint_least8_t - definition. See docs/migration.rst for details. - - Fix generator crash with Enum inside Oneof (#188) - Fix some generator regressions related to .options file path (#172) - Add support for platforms without uint8_t (#191) - Allow const parameter to pb_istream_from_buffer (#152) - Ignore null pointers in pb_release() (#183) - Add support for anonymous unions (#184) - Add Python3 support to the generator (#169) - Add code generator insertion points to generated files (#178) - Improvements to CMake script (#181) - Improvements to test cases. - -nanopb-0.3.4 (2015-09-26) - Fix handling of unsigned 8- and 16-bit enums (issue 164) - Fix generator on systems where python = python3. (issue 155) - Fix compiler warning on GCC 5.x (issue 171) - Make the generator better handle imported .protos (issue 165) - Add packed_enum option to generator. - Add syntax= line to .proto files (issue 167) - Add PlatformIO registry manifest file. (pr 156) - -nanopb-0.3.3 (2015-04-10) - Fix missing files in Linux binary package (issue 146) - Fix generator bug when oneof is first field in a message. (issue 142) - Fix generator error when long_names:false is combined with Oneofs. (issue 147) - Fix oneof submessage initialization bug. (issue 149) - Fix problem with plugin options on Python 2.7.2 and older. (issue 153) - Fix crash when callback is inside oneof field. (issue 148) - Switch to .tar.gz format for Mac OS X packages. (issue 154) - Always define enum long names so that cross-file references work. (issue 118) - Add msgid generator option. (issue 151) - Improve comment support in .options files. (issue 145) - Updates for the CMake rule file, add cmake example. - Better error messages for syntax errors in .options file - -nanopb-0.3.2 (2015-01-24) - Fix memory leaks with PB_ENABLE_MALLOC with some submessage hierarchies (issue 138) - Implement support for oneofs (C unions). (issues 131, 141) - Add int_size option for generator (issue 139) - Add compilation option to disable struct packing. (issue 136) - Change PB_RETURN_ERROR() macro to avoid compiler warnings (issue 140) - Fix build problems with protoc 3.0.0 - Add support for POINTER type in extensions - Initialize also extension fields to defaults in pb_decode(). - Detect too large varint values when decoding. - -nanopb-0.3.1 (2014-09-11) - Fix security issue due to size_t overflows. (issue 132) - Fix memory leak with duplicated fields and PB_ENABLE_MALLOC - Fix crash if pb_release() is called twice. - Fix cyclic message support (issue 130) - Fix error in generated initializers for repeated pointer fields. - Improve tests (issues 113, 126) - -nanopb-0.3.0 (2014-08-26) - NOTE: See docs/migration.html or online at - http://koti.kapsi.fi/~jpa/nanopb/docs/migration.html - for changes in this version. Most importantly, you need to add - pb_common.c to the list of files to compile. - - Separated field iterator logic to pb_common.c (issue 128) - Change the _count fields to use pb_size_t datatype (issue 82) - Added PB_ prefix to macro names (issue 106) - Added #if version guard to generated files (issue 129) - Added migration document - -nanopb-0.2.9 (2014-08-09) - NOTE: If you are using the -e option with the generator, you have - to prepend . to the argument to get the same behaviour as before. - - Do not automatically add a dot with generator -e option. (issue 122) - Fix problem with .options file and extension fields. (issue 125) - Don't use SIZE_MAX macro, as it is not in C89. (issue 120) - Generate #defines for initializing message structures. (issue 79) - Add skip_message option to generator. (issue 121) - Add PB_PACKED_STRUCT support for Keil MDK-ARM toolchain (issue 119) - Give better messages about the .options file path. (issue 124) - Improved tests - -nanopb-0.2.8 (2014-05-20) - Fix security issue with PB_ENABLE_MALLOC. (issue 117) - Add option to not add timestamps to .pb.h and .pb.c preambles. (issue 115) - Documentation updates - Improved tests - -nanopb-0.2.7 (2014-04-07) - Fix bug with default values for extension fields (issue 111) - Fix some MISRA-C warnings (issue 91) - Implemented optional malloc() support (issue 80) - Changed pointer-type bytes field datatype - Add a "found" field to pb_extension_t (issue 112) - Add convenience function pb_get_encoded_size() (issue 16) - -nanopb-0.2.6 (2014-02-15) - Fix generator error with bytes callback fields (issue 99) - Fix warnings about large integer constants (issue 102) - Add comments to where STATIC_ASSERT is used (issue 96) - Add warning about unknown field names on .options (issue 105) - Move descriptor.proto to google/protobuf subdirectory (issue 104) - Improved tests - -nanopb-0.2.5 (2014-01-01) - Fix a bug with encoding negative values in int32 fields (issue 97) - Create binary packages of the generator + dependencies (issue 47) - Add support for pointer-type fields to the encoder (part of issue 80) - Fixed path in FindNanopb.cmake (issue 94) - Improved tests - -nanopb-0.2.4 (2013-11-07) - Remove the deprecated NANOPB_INTERNALS functions from public API. - Document the security model. - Check array and bytes max sizes when encoding (issue 90) - Add #defines for maximum encoded message size (issue 89) - Add #define tags for extension fields (issue 93) - Fix MISRA C violations (issue 91) - Clean up pb_field_t definition with typedefs. - -nanopb-0.2.3 (2013-09-18) - Improve compatibility by removing ternary operator from initializations (issue 88) - Fix build error on Visual C++ (issue 84, patch by Markus Schwarzenberg) - Don't stop on unsupported extension fields (issue 83) - Add an example pb_syshdr.h file for non-C99 compilers - Reorganize tests and examples into subfolders (issue 63) - Switch from Makefiles to scons for building the tests - Make the tests buildable on Windows - -nanopb-0.2.2 (2013-08-18) - Add support for extension fields (issue 17) - Fix unknown fields in empty message (issue 78) - Include the field tags in the generated .pb.h file. - Add pb_decode_delimited and pb_encode_delimited wrapper functions (issue 74) - Add a section in top of pb.h for changing compilation settings (issue 76) - Documentation improvements (issues 12, 77 and others) - Improved tests - -nanopb-0.2.1 (2013-04-14) - NOTE: The default callback function signature has changed. - If you don't want to update your code, define PB_OLD_CALLBACK_STYLE. - - Change the callback function to use void** (issue 69) - Add support for defining the nanopb options in a separate file (issue 12) - Add support for packed structs in IAR and MSVC (in addition to GCC) (issue 66) - Implement error message support for the encoder side (issue 7) - Handle unterminated strings when encoding (issue 68) - Fix bug with empty strings in repeated string callbacks (issue 73) - Fix regression in 0.2.0 with optional callback fields (issue 70) - Fix bugs with empty message types (issues 64, 65) - Fix some compiler warnings on clang (issue 67) - Some portability improvements (issues 60, 62) - Various new generator options - Improved tests - -nanopb-0.2.0 (2013-03-02) - NOTE: This release requires you to regenerate all .pb.c - files. Files generated by older versions will not - compile anymore. - - Reformat generated .pb.c files using macros (issue 58) - Rename PB_HTYPE_ARRAY -> PB_HTYPE_REPEATED - Separate PB_HTYPE to PB_ATYPE and PB_HTYPE - Move STATIC_ASSERTs to .pb.c file - Added CMake file (by Pavel Ilin) - Add option to give file extension to generator (by Michael Haberler) - Documentation updates - -nanopb-0.1.9 (2013-02-13) - Fixed error message bugs (issues 52, 56) - Sanitize #ifndef filename (issue 50) - Performance improvements - Add compile-time option PB_BUFFER_ONLY - Add Java package name to nanopb.proto - Check for sizeof(double) == 8 (issue 54) - Added generator option to ignore some fields. (issue 51) - Added generator option to make message structs packed. (issue 49) - Add more test cases. - -nanopb-0.1.8 (2012-12-13) - Fix bugs in the enum short names introduced in 0.1.7 (issues 42, 43) - Fix STATIC_ASSERT macro when using multiple .proto files. (issue 41) - Fix missing initialization of istream.errmsg - Make tests/Makefile work for non-gcc compilers (issue 40) - -nanopb-0.1.7 (2012-11-11) - Remove "skip" mode from pb_istream_t callbacks. Example implementation had a bug. (issue 37) - Add option to use shorter names for enum values (issue 38) - Improve options support in generator (issues 12, 30) - Add nanopb version number to generated files (issue 36) - Add extern "C" to generated headers (issue 35) - Add names for structs to allow forward declaration (issue 39) - Add buffer size check in example (issue 34) - Fix build warnings on MS compilers (issue 33) - -nanopb-0.1.6 (2012-09-02) - Reorganize the field decoder interface (issue 2) - Improve performance in submessage decoding (issue 28) - Implement error messages in the decoder side (issue 7) - Extended testcases (alltypes test is now complete). - Fix some compiler warnings (issues 25, 26, 27, 32). - -nanopb-0.1.5 (2012-08-04) - Fix bug in decoder with packed arrays (issue 23). - Extended testcases. - Fix some compiler warnings. - -nanopb-0.1.4 (2012-07-05) - Add compile-time options for easy-to-use >255 field support. - Improve the detection of missing required fields. - Added example on how to handle union messages. - Fix generator error with .proto without messages. - Fix problems that stopped the code from compiling with some compilers. - Fix some compiler warnings. - -nanopb-0.1.3 (2012-06-12) - Refactor the field encoder interface. - Improve generator error messages (issue 5) - Add descriptor.proto into the #include exclusion list - Fix some compiler warnings. - -nanopb-0.1.2 (2012-02-15) - Make the generator to generate include for other .proto files (issue 4). - Fixed generator not working on Windows (issue 3) - -nanopb-0.1.1 (2012-01-14) - Fixed bug in encoder with 'bytes' fields (issue 1). - Fixed a bug in the generator that caused a compiler error on sfixed32 and sfixed64 fields. - Extended testcases. - -nanopb-0.1.0 (2012-01-06) - First stable release. diff --git a/third_party/nanopb/CONTRIBUTING.md b/third_party/nanopb/CONTRIBUTING.md deleted file mode 100644 index 4041bc3caf7..00000000000 --- a/third_party/nanopb/CONTRIBUTING.md +++ /dev/null @@ -1,32 +0,0 @@ -Contributing to Nanopb development -================================== - -Reporting issues and requesting features ----------------------------------------- - -Feel free to report any issues you see or features you would like -to see in the future to the Github issue tracker. Using the templates -below is preferred: - -* [Report a bug](https://github.com/nanopb/nanopb/issues/new?body=**Steps%20to%20reproduce%20the%20issue**%0a%0a1.%0a2.%0a3.%0a%0a**What%20happens?**%0A%0A**What%20should%20happen?**&labels=Type-Defect) -* [Request a feature](https://github.com/nanopb/nanopb/issues/new?body=**What%20should%20the%20feature%20do?**%0A%0A**In%20what%20situation%20would%20the%20feature%20be%20useful?**&labels=Type-Enhancement) - -Requesting help ---------------- - -If there is something strange going on, but you do not know if -it is actually a bug in nanopb, try asking first on the -[discussion forum](https://groups.google.com/forum/#!forum/nanopb). - -Pull requests -------------- - -Pull requests are welcome! - -If it is not obvious from the commit message, please indicate the -same information as you would for an issue report: - -* What functionality it fixes/adds. -* How can the problem be reproduced / when would the feature be useful. - - diff --git a/third_party/nanopb/LICENSE.txt b/third_party/nanopb/LICENSE.txt deleted file mode 100644 index d11c9af1d7e..00000000000 --- a/third_party/nanopb/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2011 Petteri Aimonen - -This software is provided 'as-is', without any express or -implied warranty. In no event will the authors be held liable -for any damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source - distribution. diff --git a/third_party/nanopb/README.md b/third_party/nanopb/README.md deleted file mode 100644 index 2d35e85df24..00000000000 --- a/third_party/nanopb/README.md +++ /dev/null @@ -1,71 +0,0 @@ -Nanopb - Protocol Buffers for Embedded Systems -============================================== - -[![Build Status](https://travis-ci.org/nanopb/nanopb.svg?branch=master)](https://travis-ci.org/nanopb/nanopb) - -Nanopb is a small code-size Protocol Buffers implementation in ansi C. It is -especially suitable for use in microcontrollers, but fits any memory -restricted system. - -* **Homepage:** http://kapsi.fi/~jpa/nanopb/ -* **Documentation:** http://kapsi.fi/~jpa/nanopb/docs/ -* **Downloads:** http://kapsi.fi/~jpa/nanopb/download/ -* **Forum:** https://groups.google.com/forum/#!forum/nanopb - - - -Using the nanopb library ------------------------- -To use the nanopb library, you need to do two things: - -1. Compile your .proto files for nanopb, using protoc. -2. Include pb_encode.c and pb_decode.c in your project. - -The easiest way to get started is to study the project in "examples/simple". -It contains a Makefile, which should work directly under most Linux systems. -However, for any other kind of build system, see the manual steps in -README.txt in that folder. - - - -Using the Protocol Buffers compiler (protoc) --------------------------------------------- -The nanopb generator is implemented as a plugin for the Google's own protoc -compiler. This has the advantage that there is no need to reimplement the -basic parsing of .proto files. However, it does mean that you need the -Google's protobuf library in order to run the generator. - -If you have downloaded a binary package for nanopb (either Windows, Linux or -Mac OS X version), the 'protoc' binary is included in the 'generator-bin' -folder. In this case, you are ready to go. Simply run this command: - - generator-bin/protoc --nanopb_out=. myprotocol.proto - -However, if you are using a git checkout or a plain source distribution, you -need to provide your own version of protoc and the Google's protobuf library. -On Linux, the necessary packages are protobuf-compiler and python-protobuf. -On Windows, you can either build Google's protobuf library from source or use -one of the binary distributions of it. In either case, if you use a separate -protoc, you need to manually give the path to nanopb generator: - - protoc --plugin=protoc-gen-nanopb=nanopb/generator/protoc-gen-nanopb ... - - - -Running the tests ------------------ -If you want to perform further development of the nanopb core, or to verify -its functionality using your compiler and platform, you'll want to run the -test suite. The build rules for the test suite are implemented using Scons, -so you need to have that installed. To run the tests: - - cd tests - scons - -This will show the progress of various test cases. If the output does not -end in an error, the test cases were successful. - -Note: Mac OS X by default aliases 'clang' as 'gcc', while not actually -supporting the same command line options as gcc does. To run tests on -Mac OS X, use: "scons CC=clang CXX=clang". Same way can be used to run -tests with different compilers on any platform. diff --git a/third_party/nanopb/docs/Makefile b/third_party/nanopb/docs/Makefile deleted file mode 100644 index 0dbd97cfec3..00000000000 --- a/third_party/nanopb/docs/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -all: index.html concepts.html reference.html security.html migration.html \ - generator_flow.png - -%.png: %.svg - rsvg $< $@ - -%.html: %.rst - rst2html --stylesheet=lsr.css --link-stylesheet $< $@ - sed -i 's!!\n!' $@ diff --git a/third_party/nanopb/docs/concepts.rst b/third_party/nanopb/docs/concepts.rst deleted file mode 100644 index c43d829999e..00000000000 --- a/third_party/nanopb/docs/concepts.rst +++ /dev/null @@ -1,392 +0,0 @@ -====================== -Nanopb: Basic concepts -====================== - -.. include :: menu.rst - -The things outlined here are the underlying concepts of the nanopb design. - -.. contents:: - -Proto files -=========== -All Protocol Buffers implementations use .proto files to describe the message -format. The point of these files is to be a portable interface description -language. - -Compiling .proto files for nanopb ---------------------------------- -Nanopb uses the Google's protoc compiler to parse the .proto file, and then a -python script to generate the C header and source code from it:: - - user@host:~$ protoc -omessage.pb message.proto - user@host:~$ python ../generator/nanopb_generator.py message.pb - Writing to message.h and message.c - user@host:~$ - -Modifying generator behaviour ------------------------------ -Using generator options, you can set maximum sizes for fields in order to -allocate them statically. The preferred way to do this is to create an .options -file with the same name as your .proto file:: - - # Foo.proto - message Foo { - required string name = 1; - } - -:: - - # Foo.options - Foo.name max_size:16 - -For more information on this, see the `Proto file options`_ section in the -reference manual. - -.. _`Proto file options`: reference.html#proto-file-options - -Streams -======= - -Nanopb uses streams for accessing the data in encoded format. -The stream abstraction is very lightweight, and consists of a structure (*pb_ostream_t* or *pb_istream_t*) which contains a pointer to a callback function. - -There are a few generic rules for callback functions: - -#) Return false on IO errors. The encoding or decoding process will abort immediately. -#) Use state to store your own data, such as a file descriptor. -#) *bytes_written* and *bytes_left* are updated by pb_write and pb_read. -#) Your callback may be used with substreams. In this case *bytes_left*, *bytes_written* and *max_size* have smaller values than the original stream. Don't use these values to calculate pointers. -#) Always read or write the full requested length of data. For example, POSIX *recv()* needs the *MSG_WAITALL* parameter to accomplish this. - -Output streams --------------- - -:: - - struct _pb_ostream_t - { - bool (*callback)(pb_ostream_t *stream, const uint8_t *buf, size_t count); - void *state; - size_t max_size; - size_t bytes_written; - }; - -The *callback* for output stream may be NULL, in which case the stream simply counts the number of bytes written. In this case, *max_size* is ignored. - -Otherwise, if *bytes_written* + bytes_to_be_written is larger than *max_size*, pb_write returns false before doing anything else. If you don't want to limit the size of the stream, pass SIZE_MAX. - -**Example 1:** - -This is the way to get the size of the message without storing it anywhere:: - - Person myperson = ...; - pb_ostream_t sizestream = {0}; - pb_encode(&sizestream, Person_fields, &myperson); - printf("Encoded size is %d\n", sizestream.bytes_written); - -**Example 2:** - -Writing to stdout:: - - bool callback(pb_ostream_t *stream, const uint8_t *buf, size_t count) - { - FILE *file = (FILE*) stream->state; - return fwrite(buf, 1, count, file) == count; - } - - pb_ostream_t stdoutstream = {&callback, stdout, SIZE_MAX, 0}; - -Input streams -------------- -For input streams, there is one extra rule: - -#) You don't need to know the length of the message in advance. After getting EOF error when reading, set bytes_left to 0 and return false. Pb_decode will detect this and if the EOF was in a proper position, it will return true. - -Here is the structure:: - - struct _pb_istream_t - { - bool (*callback)(pb_istream_t *stream, uint8_t *buf, size_t count); - void *state; - size_t bytes_left; - }; - -The *callback* must always be a function pointer. *Bytes_left* is an upper limit on the number of bytes that will be read. You can use SIZE_MAX if your callback handles EOF as described above. - -**Example:** - -This function binds an input stream to stdin: - -:: - - bool callback(pb_istream_t *stream, uint8_t *buf, size_t count) - { - FILE *file = (FILE*)stream->state; - bool status; - - if (buf == NULL) - { - while (count-- && fgetc(file) != EOF); - return count == 0; - } - - status = (fread(buf, 1, count, file) == count); - - if (feof(file)) - stream->bytes_left = 0; - - return status; - } - - pb_istream_t stdinstream = {&callback, stdin, SIZE_MAX}; - -Data types -========== - -Most Protocol Buffers datatypes have directly corresponding C datatypes, such as int32 is int32_t, float is float and bool is bool. However, the variable-length datatypes are more complex: - -1) Strings, bytes and repeated fields of any type map to callback functions by default. -2) If there is a special option *(nanopb).max_size* specified in the .proto file, string maps to null-terminated char array and bytes map to a structure containing a char array and a size field. -3) If *(nanopb).type* is set to *FT_INLINE* and *(nanopb).max_size* is also set, then bytes map to an inline byte array of fixed size. -3) If there is a special option *(nanopb).max_count* specified on a repeated field, it maps to an array of whatever type is being repeated. Another field will be created for the actual number of entries stored. - -=============================================================================== ======================= - field in .proto autogenerated in .h -=============================================================================== ======================= -required string name = 1; pb_callback_t name; -required string name = 1 [(nanopb).max_size = 40]; char name[40]; -repeated string name = 1 [(nanopb).max_size = 40]; pb_callback_t name; -repeated string name = 1 [(nanopb).max_size = 40, (nanopb).max_count = 5]; | size_t name_count; - | char name[5][40]; -required bytes data = 1 [(nanopb).max_size = 40]; | typedef struct { - | size_t size; - | pb_byte_t bytes[40]; - | } Person_data_t; - | Person_data_t data; -required bytes data = 1 [(nanopb).max_size = 40, (nanopb.type) = FT_INLINE]; | pb_byte_t data[40]; -=============================================================================== ======================= - -The maximum lengths are checked in runtime. If string/bytes/array exceeds the allocated length, *pb_decode* will return false. - -Note: for the *bytes* datatype, the field length checking may not be exact. -The compiler may add some padding to the *pb_bytes_t* structure, and the nanopb runtime doesn't know how much of the structure size is padding. Therefore it uses the whole length of the structure for storing data, which is not very smart but shouldn't cause problems. In practise, this means that if you specify *(nanopb).max_size=5* on a *bytes* field, you may be able to store 6 bytes there. For the *string* field type, the length limit is exact. - -Field callbacks -=============== -When a field has dynamic length, nanopb cannot statically allocate storage for it. Instead, it allows you to handle the field in whatever way you want, using a callback function. - -The `pb_callback_t`_ structure contains a function pointer and a *void* pointer called *arg* you can use for passing data to the callback. If the function pointer is NULL, the field will be skipped. A pointer to the *arg* is passed to the function, so that it can modify it and retrieve the value. - -The actual behavior of the callback function is different in encoding and decoding modes. In encoding mode, the callback is called once and should write out everything, including field tags. In decoding mode, the callback is called repeatedly for every data item. - -.. _`pb_callback_t`: reference.html#pb-callback-t - -Encoding callbacks ------------------- -:: - - bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, void * const *arg); - -When encoding, the callback should write out complete fields, including the wire type and field number tag. It can write as many or as few fields as it likes. For example, if you want to write out an array as *repeated* field, you should do it all in a single call. - -Usually you can use `pb_encode_tag_for_field`_ to encode the wire type and tag number of the field. However, if you want to encode a repeated field as a packed array, you must call `pb_encode_tag`_ instead to specify a wire type of *PB_WT_STRING*. - -If the callback is used in a submessage, it will be called multiple times during a single call to `pb_encode`_. In this case, it must produce the same amount of data every time. If the callback is directly in the main message, it is called only once. - -.. _`pb_encode`: reference.html#pb-encode -.. _`pb_encode_tag_for_field`: reference.html#pb-encode-tag-for-field -.. _`pb_encode_tag`: reference.html#pb-encode-tag - -This callback writes out a dynamically sized string:: - - bool write_string(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) - { - char *str = get_string_from_somewhere(); - if (!pb_encode_tag_for_field(stream, field)) - return false; - - return pb_encode_string(stream, (uint8_t*)str, strlen(str)); - } - -Decoding callbacks ------------------- -:: - - bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void **arg); - -When decoding, the callback receives a length-limited substring that reads the contents of a single field. The field tag has already been read. For *string* and *bytes*, the length value has already been parsed, and is available at *stream->bytes_left*. - -The callback will be called multiple times for repeated fields. For packed fields, you can either read multiple values until the stream ends, or leave it to `pb_decode`_ to call your function over and over until all values have been read. - -.. _`pb_decode`: reference.html#pb-decode - -This callback reads multiple integers and prints them:: - - bool read_ints(pb_istream_t *stream, const pb_field_t *field, void **arg) - { - while (stream->bytes_left) - { - uint64_t value; - if (!pb_decode_varint(stream, &value)) - return false; - printf("%lld\n", value); - } - return true; - } - -Field description array -======================= - -For using the *pb_encode* and *pb_decode* functions, you need an array of pb_field_t constants describing the structure you wish to encode. This description is usually autogenerated from .proto file. - -For example this submessage in the Person.proto file:: - - message Person { - message PhoneNumber { - required string number = 1 [(nanopb).max_size = 40]; - optional PhoneType type = 2 [default = HOME]; - } - } - -generates this field description array for the structure *Person_PhoneNumber*:: - - const pb_field_t Person_PhoneNumber_fields[3] = { - PB_FIELD( 1, STRING , REQUIRED, STATIC, Person_PhoneNumber, number, number, 0), - PB_FIELD( 2, ENUM , OPTIONAL, STATIC, Person_PhoneNumber, type, number, &Person_PhoneNumber_type_default), - PB_LAST_FIELD - }; - -Oneof -===== -Protocol Buffers supports `oneof`_ sections. Here is an example of ``oneof`` usage:: - - message MsgType1 { - required int32 value = 1; - } - - message MsgType2 { - required bool value = 1; - } - - message MsgType3 { - required int32 value1 = 1; - required int32 value2 = 2; - } - - message MyMessage { - required uint32 uid = 1; - required uint32 pid = 2; - required uint32 utime = 3; - - oneof payload { - MsgType1 msg1 = 4; - MsgType2 msg2 = 5; - MsgType3 msg3 = 6; - } - } - -Nanopb will generate ``payload`` as a C union and add an additional field ``which_payload``:: - - typedef struct _MyMessage { - uint32_t uid; - uint32_t pid; - uint32_t utime; - pb_size_t which_payload; - union { - MsgType1 msg1; - MsgType2 msg2; - MsgType3 msg3; - } payload; - /* @@protoc_insertion_point(struct:MyMessage) */ - } MyMessage; - -``which_payload`` indicates which of the ``oneof`` fields is actually set. -The user is expected to set the filed manually using the correct field tag:: - - MyMessage msg = MyMessage_init_zero; - msg.payload.msg2.value = true; - msg.which_payload = MyMessage_msg2_tag; - -Notice that neither ``which_payload`` field nor the unused fileds in ``payload`` -will consume any space in the resulting encoded message. - -.. _`oneof`: https://developers.google.com/protocol-buffers/docs/reference/proto2-spec#oneof_and_oneof_field - -Extension fields -================ -Protocol Buffers supports a concept of `extension fields`_, which are -additional fields to a message, but defined outside the actual message. -The definition can even be in a completely separate .proto file. - -The base message is declared as extensible by keyword *extensions* in -the .proto file:: - - message MyMessage { - .. fields .. - extensions 100 to 199; - } - -For each extensible message, *nanopb_generator.py* declares an additional -callback field called *extensions*. The field and associated datatype -*pb_extension_t* forms a linked list of handlers. When an unknown field is -encountered, the decoder calls each handler in turn until either one of them -handles the field, or the list is exhausted. - -The actual extensions are declared using the *extend* keyword in the .proto, -and are in the global namespace:: - - extend MyMessage { - optional int32 myextension = 100; - } - -For each extension, *nanopb_generator.py* creates a constant of type -*pb_extension_type_t*. To link together the base message and the extension, -you have to: - -1. Allocate storage for your field, matching the datatype in the .proto. - For example, for a *int32* field, you need a *int32_t* variable to store - the value. -2. Create a *pb_extension_t* constant, with pointers to your variable and - to the generated *pb_extension_type_t*. -3. Set the *message.extensions* pointer to point to the *pb_extension_t*. - -An example of this is available in *tests/test_encode_extensions.c* and -*tests/test_decode_extensions.c*. - -.. _`extension fields`: https://developers.google.com/protocol-buffers/docs/proto#extensions - -Message framing -=============== -Protocol Buffers does not specify a method of framing the messages for transmission. -This is something that must be provided by the library user, as there is no one-size-fits-all -solution. Typical needs for a framing format are to: - -1. Encode the message length. -2. Encode the message type. -3. Perform any synchronization and error checking that may be needed depending on application. - -For example UDP packets already fullfill all the requirements, and TCP streams typically only -need a way to identify the message length and type. Lower level interfaces such as serial ports -may need a more robust frame format, such as HDLC (high-level data link control). - -Nanopb provides a few helpers to facilitate implementing framing formats: - -1. Functions *pb_encode_delimited* and *pb_decode_delimited* prefix the message data with a varint-encoded length. -2. Union messages and oneofs are supported in order to implement top-level container messages. -3. Message IDs can be specified using the *(nanopb_msgopt).msgid* option and can then be accessed from the header. - -Return values and error handling -================================ - -Most functions in nanopb return bool: *true* means success, *false* means failure. There is also some support for error messages for debugging purposes: the error messages go in *stream->errmsg*. - -The error messages help in guessing what is the underlying cause of the error. The most common error conditions are: - -1) Running out of memory, i.e. stack overflow. -2) Invalid field descriptors (would usually mean a bug in the generator). -3) IO errors in your own stream callbacks. -4) Errors that happen in your callback functions. -5) Exceeding the max_size or bytes_left of a stream. -6) Exceeding the max_size of a string or array field -7) Invalid protocol buffers binary message. diff --git a/third_party/nanopb/docs/generator_flow.svg b/third_party/nanopb/docs/generator_flow.svg deleted file mode 100644 index e30277a75f0..00000000000 --- a/third_party/nanopb/docs/generator_flow.svg +++ /dev/null @@ -1,2869 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MyMessage.proto - - - pb_encode( ); - pb_decode( ); - - - nanopb_generator.py - - - - - - - - - - - - - - - - - - MyMessage.pb.c - MyMessage.pb.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - c - - Nanopb library - - - - Protocol Buffersmessages - - - - - - - - - - - - - - - - - - - - - Data structures - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - User application - - - diff --git a/third_party/nanopb/docs/index.rst b/third_party/nanopb/docs/index.rst deleted file mode 100644 index afc7ee4fbfd..00000000000 --- a/third_party/nanopb/docs/index.rst +++ /dev/null @@ -1,127 +0,0 @@ -============================================= -Nanopb: Protocol Buffers with small code size -============================================= - -.. include :: menu.rst - -Nanopb is an ANSI-C library for encoding and decoding messages in Google's `Protocol Buffers`__ format with minimal requirements for RAM and code space. -It is primarily suitable for 32-bit microcontrollers. - -__ https://developers.google.com/protocol-buffers/docs/reference/overview - -Overall structure -================= - -For the runtime program, you always need *pb.h* for type declarations. -Depending on whether you want to encode, decode, or both, you also need *pb_encode.h/c* or *pb_decode.h/c*. - -The high-level encoding and decoding functions take an array of *pb_field_t* structures, which describes the fields of a message structure. Usually you want these autogenerated from a *.proto* file. The tool script *nanopb_generator.py* accomplishes this. - -.. image:: generator_flow.png - -So a typical project might include these files: - -1) Nanopb runtime library: - - pb.h - - pb_common.h and pb_common.c (always needed) - - pb_decode.h and pb_decode.c (needed for decoding messages) - - pb_encode.h and pb_encode.c (needed for encoding messages) -2) Protocol description (you can have many): - - person.proto (just an example) - - person.pb.c (autogenerated, contains initializers for const arrays) - - person.pb.h (autogenerated, contains type declarations) - -Features and limitations -======================== - -**Features** - -#) Pure C runtime -#) Small code size (2–10 kB depending on processor, plus any message definitions) -#) Small ram usage (typically ~300 bytes, plus any message structs) -#) Allows specifying maximum size for strings and arrays, so that they can be allocated statically. -#) No malloc needed: everything can be allocated statically or on the stack. Optional malloc support available. -#) You can use either encoder or decoder alone to cut the code size in half. -#) Support for most protobuf features, including: all data types, nested submessages, default values, repeated and optional fields, oneofs, packed arrays, extension fields. -#) Callback mechanism for handling messages larger than can fit in available RAM. -#) Extensive set of tests. - -**Limitations** - -#) Some speed has been sacrificed for code size. -#) Encoding is focused on writing to streams. For memory buffers only it could be made more efficient. -#) The deprecated Protocol Buffers feature called "groups" is not supported. -#) Fields in the generated structs are ordered by the tag number, instead of the natural ordering in .proto file. -#) Unknown fields are not preserved when decoding and re-encoding a message. -#) Reflection (runtime introspection) is not supported. E.g. you can't request a field by giving its name in a string. -#) Numeric arrays are always encoded as packed, even if not marked as packed in .proto. -#) Cyclic references between messages are supported only in callback and malloc mode. - -Getting started -=============== - -For starters, consider this simple message:: - - message Example { - required int32 value = 1; - } - -Save this in *message.proto* and compile it:: - - user@host:~$ protoc -omessage.pb message.proto - user@host:~$ python nanopb/generator/nanopb_generator.py message.pb - -You should now have in *message.pb.h*:: - - typedef struct { - int32_t value; - } Example; - - extern const pb_field_t Example_fields[2]; - -Now in your main program do this to encode a message:: - - Example mymessage = {42}; - uint8_t buffer[10]; - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - pb_encode(&stream, Example_fields, &mymessage); - -After that, buffer will contain the encoded message. -The number of bytes in the message is stored in *stream.bytes_written*. -You can feed the message to *protoc --decode=Example message.proto* to verify its validity. - -For a complete example of the simple case, see *example/simple.c*. -For a more complex example with network interface, see the *example/network_server* subdirectory. - -Compiler requirements -===================== -Nanopb should compile with most ansi-C compatible compilers. It however -requires a few header files to be available: - -#) *string.h*, with these functions: *strlen*, *memcpy*, *memset* -#) *stdint.h*, for definitions of *int32_t* etc. -#) *stddef.h*, for definition of *size_t* -#) *stdbool.h*, for definition of *bool* - -If these header files do not come with your compiler, you can use the -file *extra/pb_syshdr.h* instead. It contains an example of how to provide -the dependencies. You may have to edit it a bit to suit your custom platform. - -To use the pb_syshdr.h, define *PB_SYSTEM_HEADER* as *"pb_syshdr.h"* (including the quotes). -Similarly, you can provide a custom include file, which should provide all the dependencies -listed above. - -Running the test cases -====================== -Extensive unittests and test cases are included under the *tests* folder. - -To build the tests, you will need the `scons`__ build system. The tests should -be runnable on most platforms. Windows and Linux builds are regularly tested. - -__ http://www.scons.org/ - -In addition to the build system, you will also need a working Google Protocol -Buffers *protoc* compiler, and the Python bindings for Protocol Buffers. On -Debian-based systems, install the following packages: *protobuf-compiler*, -*python-protobuf* and *libprotobuf-dev*. - diff --git a/third_party/nanopb/docs/logo/logo.png b/third_party/nanopb/docs/logo/logo.png deleted file mode 100644 index 0d9534fa165cda53a29a848848c2e0a4c5ead3e5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14973 zcmZvDby!qi)b$-g1`ruKM7pF?x`siz1f)X&LApBz1PMv$F6kIRLK;QMpEL|2DIne5 z@AZA3@4s&zhGBSS?m1`QefC~^t$m`jG!zN&sPO;*AW&99yZ~Rj|2?4(z~3+C9B{xF zEO)rFE);wOK&>Ld_qZ-fhVB3$V*2k1p+Y_f{{W~w6bw9coZonOzjCt%yuH17-a6U4 zTfTC!=5cnj$=Z{o1^{|M86l_Zlf4`0n{J}ea(Atlv+(BQz&GZk3@$;ECRsQJw8n?G z3>V7mzzD@KBhu=|kB;6@Fw~Wm`_5Ttf*89{GqGrV8fYGnhxQ{C0GmpZb25 zR=7Ctf9G@Vgyx+AzLt`-d09%#e`lJcCS0?hGiCx7oJjTT<2WVeqf}TSiLAG=v9auX z0GpDNtY39RKVJRu#NJQ3;PbY{9G?-X^MC*s7nh6`(TFcK#%y8qz4ZYMgRErmRS~pj zL3>`0*di%jIBhI~vCAr^0|sO4HXzA2DX@9J{pDzo^Ko9_*{}H1^K-hS0jmX;FenL8 z7|bF@4w^_20QkQ0HWleY576(|aaBg}pZTzpUJ_k(5Ma(AF@nHc|)Q9Z?PG*jc+)Xr5)yQ0)N z6V`gW2+bq&AC%Y1pjApT=~%lj5RFhRm9;VKJWlisD(JLwzAt zI*x8u45eho(02X5RCwX7-!K(yUp2%ZU2A6qABJ-Th(Wfl9Rcv_y^-cpHS%xCs zzn7+nLKtw7%Y#2c)C$bRa-uZP*-1mK4M(RKT9nV(fT9qS`laYs+{czNYq;#j1s>v3 z+=)t(pIw%}-BZuA;qm2aE8|;4|JKGf*YiC3-H0}8JGYFN@?t~YGA2Ud1+Z_+E^Y`v__7@)bLx zxv}v!)V(u}G|2Q65-riF3u$)zodi^HSiJ}t^wsBWla*#7{~-0saC$s{aVaNctU}hT zu`3GeA<%W$``89$(sJbW^u{fzv8%PbMl(MFb`?|=da0|YI?t9gz!JAIC(TMoP&=W` z{a99tm+|ZIhzwoZ{oQr&8^f1H6^p7*%=h%3n1`EjX6e$*{}7|@_dj(jtH^+1L?QlU zhvQQOy_zJ%<8$JpChONcN6%*mSXj_|{KwyS^WAfv1YC7uVx_kiB)l_7@5iA|aQjJc zMqcZA=v`YH$ExTf(RB@V^`CX1pZmT3M90^CA;-dv)OU!#dTiX}@QXq)<3HT-nbV2$ zH8Tov(=VR-rD;PG9(&lRYY#m&;^`*GTs78x(+1nIPU|2PumZE>=T^ym*hlNXGxodL z`94&+OF!_&tg*^2Ak)sD1Xs;Yi=`q_1FLbTT(^QJLruEVcC2t#McM#q8j(nxpWGw0 zhcMo-*Z#~V*c30iHu&YK*&$Mb)a>Ua;RjYpYT`6p#@(g`EYWyx+TN3S>Jv8K} zg>;QboCSgw=!82X=v==OQ4kUm26NIpVxo>^qsc8XY)XUdn z(x7y z0;w-gmca3u^g`O-yzU>FskNJ`KoO5I8@6pfuX6m|tFG^_d#ZR2Y&N=d^6Bk76kOX> zc%ZytCEz<3ijDt>_Ou6c$3u4w7fsFr30Tc19P^_79N=LrzG4gbo;JfQ5eZJH6RiTu09nJdl z+rmvXf66dQx32|aH^0#MY~BZ9ooxHNm{JG}3vZ*VjnU$T;PqT=FwS z_wA~fn(4pwI4{u+JPF}pwWKIhyNKnr)^Z+f#9s9k&v6pl$bWZ+`oahC!mIfEpkpOY zVySiS^=+#;`#b%BF0a3j5v7t5D*>g_2^(GAd_aOg?=ei!|7_gJ?taNwRYhT`QDUGuYQ3;>(Zo0=T^74n2HK5 zTI|qg#knYH^vI*peMo+Vyt|iC0cH%fo?vK{t%?(&g~wR>m6=Qpxmtx@OD-Ksowp12 z`ppzRZT?mn9wd^T*+1BtfQSFZ^4LC=s!zF05mC_ToeAfdP)RtU7MZRBHeN(elGwVZ zpU>wgn7BuZO_g@dsK2QQZs*-Fu+-|bqT!PRkQH)Zl~q>Shx~zjWJ=V)fqurva$wDIZ*aoozJ z{>it0Hwz9hQcq-zb8#B0{ceI-4S+j{Pe>>XmxOgSitoh*Zs${>o=;c(w>1twFk)!+ z7?3NXk9$=BFphH#4H5=UdLHclZtiiVK@@2lq^>Dr$&7rg*effTvD^8Wwud_R8WM`B z%dH5C1S~@!@1N788MYpqnXKOkMTV4LPLufgXb_N6MDBsdpRf^+(bwyBRDu$vSDI znZ7AFuLlnvBn()=VxJSmK0iJt^yRMpguZecvJ%Mc;Z?s2YE(1&Z=xw$Mi$Ahs0XDF zbFmrD{>2-Xt{Z#9JPA2HG9WYY<#7zP62L`!CJtB~367Re@N991=z3aJqqc5JXw7}| zT0!h0V_k@dgBn*{a%030RJ3TgpkS{xgdHK}{;Eor24rea%ShNX5a#CQ3tHriZEi7d z&)!~Uaon^H7D@L_ZUO9eiIZepQMNi$(g-BKyfE&lBXP2dE<*=->SvV=j+nW=*ZiMe zlw)Yd{ipaOqlBcJbJDQ$o$`fVdZZj8rzq&~-@ai2EO!(Dy2N$XWf9zXI=N32&+)3O zOg)MF+wJY`@uBn+%F8e18#|^+6MQerWv(O!1qN@phlmj;CM}CR-8J%4q01)d4ppn= za(KGM3&F`*Q@n<9mIR&3A#PHlUw#;iiC#w1?% zWE|o}T_G+ZL?l&%E)gFj5@L}NgE(r_#7(YGDLh-v#Psy^^nItF7vIl(Q6i95bX~cY zd`fLvm z=*(y?b$A4$ytQ`Iwb&c1=UY7;nQpxxUIY~?NP@@D+IL#_9?Z+@)MPHBIY3JnD!Yb+ z8a2zZL?aj#&X8zEzhVc#@azRWqd_WJ73Js01+&~h`R6w^kr!yOn@j6$aFPXGW--5FCiX4p=(y#bx+{V7KGI|Bo^7)2pd%s5_IwHyfMd-H@20#g zNnbZU;Xh8H{0!Z#p4%^g&RyaA5nCg`^D!;$bAb%5t)1~}99_nKmrXZEAirUcS7fLj z3>>S@``8EP14(RoGUSWTWIeS9CL=p%Z1Mv8U9&~PVAmPb7!NqI9)$D1f2vbLiq%@a zf_(y8pUcjf=?s*3|Ni~a=1JxP>S4uT(V09LPneUGrD%+RFCwIPIVACYN!A^@$ecKS zCIHy^JRcDtyKvvuh0_D8E$*g*4hdhOj3_;B9!){fg3@C zhq!6OMRV&@Uuz)Xb7|>%E1tA9lEbnTW^s3O2^L`oEPbwzAphxnN-K)<$-!qB9UVnx zW@bv_>OyoaLq3T!kE|Suj&C-g(iG{ghs656N09{2qS0)WmK0j#zWSA&Xx*-B?xCyI zCdc0xZ5A{Zr7!?EoA+LPJ7DG3xZSES@!r3MMwM#7?^jl4ChWrxyj066<@_`Dp<~D2 zO$e!kO2*%4084z;m!y|jbVY>nybRq6x2EbDB)zy_{?}j@LJBdUr0Mvrl zPa$DdGx#oMUWwnTe~*;Zk6KcQ)a3||i+l8G;;p4~-GUBRe9tmpiDsS|AJiO9c4xqK zrp8X1iT?FVtg1wrH3=ma=bo_L8eg^#_{4`Y6?Q~!5Kfe+w-s*DiOc?)dCQRyt?+?d z!O!2HPNVn*9ppxjp4Yr%Q(8G4Oj<%BA{5mxo<_VBkJCXA|87cDDXs-A7Rrz;)~KkK z&bQoDQ&aOnrNbCB8#-#ku9s3j_6-okF?I{CE(t{Dggc=*F{W@JO3eN5T(%N34-q_} zh9~{GeMa1r{gzY`tNOPp!_U!B`fyG2WMdXNN!pPS89T$5Z@z`$QuMAIN(=^~W@l#! ziN>6%Ed9%wwTww{6{h^c`I{VmH#vrw){@kz;sO9SH+LR2Ep6vi(=K&>0&wJp-XtDOCI?o#gQ>1k#qj+&t9t5f?{gWqhfnqOk?;P8F2TnAr? zzC#R%!Rp_Qpy~7VR#fb>FA79~)*BWx*Fe~8Fpo|#Vp9Q&b4`xMqvo|Fd^}M4x)JH? zhKB?Mw~~oUH>E40pPC=ALe4)EF@tW;=XZJ;e7Rk0gxlKrn+>-QC@F^H9piaAGJmG&Oa4+uCl}fCZbZ=SkY0;h{kEsU?su z=FYmcwH57v@ymQk4wz}0UlScx6c-nNsduCSW~5Tsm?=Vc8%>x?1&`DLE7>y-mXSvmym(06`D`;%Q|EY1kM<<=F!c^bd!9ErwoSQai}xDv5;?w! z=}TYn~{kVdb00| z4ws5cNbJ`%(CCz?wd6*27CxBpZBa>qqVvH0`1SA4tQ?g*ItxM;008e=ujqQb%W(V) z-27%NyD#D6)X+ZH&goyjd;^Qu(j|S5ej!eDdJS}0kX-NfS_V_L`O%)5yE{8H6(^Ve z;%5dJfGmiJK!S;X_%e8dIib-x3L-88n&A&<99`YVni&FXw}=ye#>^70>2j~=S1&&V zx74&X6ct&zTbsWc>7`W%09!}LoNlq;Z1+1z2id4{J_!SwQSy)I@LRAxFE4xcFB3Qb zny@j+oR}BFIusZEo{zj*Yy1O>d1j@kB!sCwBnvw_0!N#6<7b<02~pM`KOJluYbeF9 zWXnv<%oqp_zhd6l-QD$|SvLiabT}&tW?H2Z{O=rwFU_;EvfeGH7JaAH1OS7spj!}z ze*o(`4Z@ zVB_gF?1MMO*T%+1_)Zst-tGFujAJ-EJ@S2OYAWCQ4LbW+r#)=gSu1Wu^l6{#@GlTH zNTsA&U!833|IL=^r_3r)Y}h)cS8lG}Zar_Q@%K_xRD4YuU*+NWdtM_QgG{OC>U4V| zZYBH8?=#a@aos`Ien+C-nRx;N0`r;%u0x+2g+AAX-Bzcpx9_F8%Tfbl-0vo{#oSBM zE-7C;L)ou>P8qZ}VX}otj?T@gWgpYI4f8(peGQP7%Rgw`=!;vq0l8&w1*h@NiBiq~ zPHE_RgwbWQ&IJT?j@~ruGjVZoA`cBSu_iwq`QX;)jc#F5--m9uDiV*8GFD(}VbbpqHKZ-BKYQGr0DCP99aBW`zK0jk)tGk$ z&7BxyVX>2dbPI*+@O>KpbHD%M#I^bqpZE>AW?TCE`!7~CaK*;Pmbwn_zm8Ejc_i4# zqP3C{21A4J$-LUia`Ki?=H}qtzreM)>2alm_RONR{G`FMLe^LjgxN&^MA~v9OSy+y zKQ}df~)^`IK|aMqjPY5{4a%4 zVqkyJs;OL;|2a0#r+$6()druOOSHAC>s~NJ?QbAh##X*>H1W{-C<|xl+Pn?<(}-Rb z&UltK@*BuyDr^I{{JwFAU!&<}GZiidMhpye`cjwS;GdNESpi4lxDUDI#$B^NUteAA z{ol~nuETWJF}u|tyX&hkJeB5wo3+4w|HY?6X}pV_Aieoxetur2*3sX&@731RzE#W z-=&+m`J#GCYH?kit5FSVDR3*y-0nVH{HuXe7i*#tGss}c36L6-1^oJ`w5*Q{>=@9g zli8h80h2HLW-!uAI<%WaA~))r7yP!zRJt^uf}^lxW@S;h4AWW0{5+b7QvIUr>`Aje z9ug7~oq5~a+goOB*tMFSS4aY`tG!!1?p;9v12ge2X#vmdkk+)uV36TuCLUx zR7}GAbZ(q%&$&9@C5y;22kDkBj!WqvC{zmqj$$LwOKTm&t-A|JdR0{^KX_;kF6g4W zyL%ch8cry60&BbY^Py{q^16`Y=EW0g8k+A*OBS606$C~2GV7A&$BISTV7U|ua^0>c z8shJEwS_#UR0+oQ*crk&!+av$?=Bnd(OxePV*jJ#p_jEz7qroMVz~q9or&=D?2pGX zvakK&Ij@8B;6X0k^2%wh(N4$t0tFs})8A}&L;Lgdb0!d~hHGzh%(y)a&E^#*j-scI z{hL-WE-$Cco5XX%ijf{>w&?$h2p$OmY#N)JWempXN`kwQK#JvXwirY2OioOl=GIn1 z#dT^ezChfH$um*Wi!N*FCZ&tDLy(<|Q!Rec#auZ1_3PJ<%a2*-Wxx^0KdkA|cQhMv zcbTv#2GX^lv5jt7IjGdop1&2K%TR_IJ7?$nY1{kC!gxwpzMrj=)7>-69ecB9AvJ7S zI~ZusU@#l{Mj^gcuFsGLGpz`wOD=jZ20A~cq!i7H>?aj}^&-S-m)9OduJ2t$O&UhO zC?7NqVB#%koS&kJ8%_Ab@IFgUHle7SUWkw=>Goe)8s> zY3;0Qc2d&7su8!p&X-V9Ka6e=(q0yT1SyDKBvT_}I(~q1L5~|HInuU zGHJe3`ioJ=@|^mpnJuMAwXJ?sJu~{^vOEOhG0|V|Dm88k>4w~eb1JS?PZiZIsY^D| z@?49}CS`G0UCs!^2NSeomW21-GSg+S2k73I9v&W&JEFshHQT*<^ZMaeeOtjU8l$ZI zy|gh1Mzm2X3-*%(sLtJZTBp$Ig8%+)spD^K%jk}0Bt*I+@h5jm6lG@8^GTn&(j;jK zP9)nqNsteKk)Jsd=Q7Vv>9IIQ(_f$M{Bn=lU|1EI2Eo|EwI$w#PHBoh1)b2(dPhF1<3-td|F2e$ zDcjYgV(Q+3q-wM4r+e*Dj2H$G@hrNTo_D|_aXNGvTFxsr-M;ys92^`BffZszVeOd> zU;xH`RPn)exnxQ1Yu}%ruFBr33%8ZO*IyjtHEJ;NX?&0=-jKH4s!8k84N0sQ9A=>J zru~v!i-q?W%)hI60QtNZHc*m!$ zqF#~=Nu!dEN4(zawptHx|AOCGj1^i$0uqp{XO6@BNV=p><5!Itg-C1YA z)m84KneXDKBr|Vb)4>(2FY)bp<-PycRYtvBwlJ7Yb93{3eRg{&xdodgSh1m^cUr$` zUin7cOfn3MnV@qP=jTm9@iD;OSBJJ@G ziu-4uH;?2iM;D{9rC}&d4(>hd%Ma3chX3TRrd6f{1C#Io6RryazVl z{6ShllikxCyjTo)vHNk)d8RN}&YE9@2P2FKtl0SY__Sabe~XWYGR>l(fzSP~np(Cf5vV9!(wceN7Lf)~trWG2clZ@fQ7>-K6-7MD^A?_> zPm+3dr6H#0WY0{Tar-yRnVL!Q9l6B~68PTs$aF*yR5x+dirN9- z{_eahFZ#!8&5G960lw+=eOFTv=LU>$dBNh*%HHbPqRJ+$l9ylYN81LrSJrSVNX=G{ zd>33xKBR8GMjm3LJr|!uA&$0UJv=e`@q?L(A(mCLUCoYmx%K%pQ$4= z9!*nhjOadsp#*!K6Wf*p#zg)2&kXZ7hM(W4&wg>W?DCVM@4i5abGJy60~_B-G#xBr z8eN8u-|rk8@PX6-KpMtf$<#(^3Ccy~x_Ds0ZwFN{n;Mf+-Wq*ApD$c4%u3wvFPQO= zI0_4_rfaPRh^tK7$a8Y0GN!)kvhx0xSGEDcKLc`mvK@qDGNk`aborfbX$tm!+4+iH zZ;w;@qP+cDdv|S$Neq<94h~%II**4X2*CpJP{@qMYI}5I;$2M*&-WEqhlO@3&X-k4 zFwT!8p0g6;f?Ur(TF__2f8kwGoH$;@6EDh0sQKlf{&RIe#@kNp8>)SK01D-EDrmyE zw2xb%;SD^ipHRsK8DvJ{4XNJxXBwVSJovvn8M?kF-X>pT2xVVdfPq^M zQHDY(3Q==kNTsMOhf|n!PiV@-+T{8^5TGOkKxpK8I;C&9(C&-fduH%;v3L1D$L z4i9<=gQ;Z=%#wv$PcE|xMb#6;gT!+{n)g5NEy>18n4nu12K%ztx;;8Q{nBM* zEzLac*JqpcAp~Nksk(5}54b?z73^W2gj=m_fIaW&n`&AI8`89zXq3uFJ6~&l#>uMZCdD>4%e^X~q(rR`7HPY(WUG zL_HH0PTAS`c=@|2hj11|lh_MfUH(&+yeUekOM*|#XitiPqzeBK_G>aFsCLR0GI9%o z0368Rx(y38ig)cF1ESa;F1Y|WnCUnc(C$ir76yN)rzIqZXspoMEa-zr-q`YVWsX?U zt1=99^u$Hjol}r19dalzhU*;kH{#q_{C@UvfEnDPe@F7-Q&Y*+vYruu3BaJyjtsmD zuqXuHpak((UhBu~`>n9wyr$>@Eg|0lvh@J)8qy21H@D zjqS*lGqC@l7W!**ALwQ+d<2|heldj>Xwp>vJ!AlEFfIV(K0ZTqZ^Ykm6X=o;Z903#{3hUMd&?I9m@W{TQpE^H4@{nz6auT5{mjLJV_np}E z=$vLN4DcukyDC*>Ec1o1XI_10zS$Cf>%Y_C{q+<1#?H=3&T|mRDzR*G5$2u!HW=&0<^KDaK~BP<+n6u*_!9~Oh|dRv^xtWcbB~@ zhqa>?;0g$6nG|&Moy7R^usaPpqU*87_BjV%mJQNDU`o&W|0+&`uAS#f&lVbA~OfSPRZ-AyPN6J#j_hxR}(1iXKp zhq2B}U{+)IOZ^V+{vaB+eugh6Sl_>J|H2rEb4U><{rpInZ8u%`vUQii;v}#li zF$CODcasD97+)wQ>~?u!V~z00-5^5xLU}+EBcI>99J9L)9;u%qqzM?{BQbq?O0C5x zB*KEB-FeB9a9|H`dATR`?C;=*IVpYm-)27F_vfF(;;;rG~8jLxZNT^*;UtmC_VyglwwOD3j#zn z$$|*n%16k7ywf3(v~!z=UnsvqJx7Pbg+*uDET5=1U@H5PvWR&C3>&5ON*DV&EN%x^F# zOk5zKkWIe`ieJn2=GR6GLoBGYHeag4!Sig^<0nrcW-z$Nn)KdX|JI5O<^dH$m^^|A zpwk=g+Ool1wVPP4mCt_<$z}|jDJ-s(YkHG*P~mikDcj+e>s%eVvEAZ*SqA$vFt=7b zBgX;w43t)ZIe{GcFwR#Nx-4>SkmlC@o$X2FhLDvp3mLhV=&xiCO+1F9YGlmmnBHU0 z$+V{xIx?yM%bIU*Ya1JXpb~tulpz1;YrXZ5%k^&a%5nr<@2iL>shVweQyeB9V+tFa zn}_~VKsP8k#R}U`la?tbXSG`Y%oP3t@&))|K49JyJsFjcy=pK2d+rv#b-p%y91gmA zq%9FJHS5dg-9c-ZvWCkLCcbsY)W5Y)%zM2mg>PsoRb_IQ4f`W3fAkqp8+g(N`!{Cku8q<3s#K_3k{Y@Tqb1aVyI~EBSb>q%YRS<}4#@_-tMP^_# zLB|zaWiG96&B#j8IaL|j<94pHw-d}nF=!T0bUOGKJ)+ohyQ9fC2jdRS+q|mzt7$k7 z202mr)zt(bFV#y1Ogf|KR z*`IP`YzC7fxq$e>TKzpIhVO3jvoIuzJ?)Mq%;$GPT*G=7eb@#=p*Q3Ues>DEvp6>G zwG9LbF$~^v@FMLY|LG6!Q@|aLl<*n-M3587suPmq3XnPcB{2rX*Z+Fqks|JIk1z=H zyC<0JeajzQ`l?R`VaUvRqD?opw}%L8m6?etK`mF37UW@Z{v7&*i0kp(=raGx>Ik@W zGYP&uy}XOVB$U(|ekaaIR;J5|L*K>h_!NUnC(fJ%Ud2#YnRuE>!$T_5EO$TLy~IDb zJZnNr+ygdHk>x@7^u>bzW13$EGLw(5qiivdZ4gP0u+hpU%i5ynILL@F*i)$q6Prne z*|is(VhfSqM*jx;e`=#L)EpPM#rfT&KXeg1WzK6a?#nZu$DyoSkanK@0aTI6?a_XI z=|hZTO8Flz^X_kKz2lbd$_(65t#=%?H?A@3nQ(G$qhHZV-|Bj|## zQ0x9K3063gu#aUmpTp6~7RGKg&s6GXQf?aby{KQInhZ(D$QhX@@CiMY=Pz}1EAF*% zE8B#9WHKUxjz5&!J+hN;ok$RlyH|yd72GeN(P*YHr2%qTzfgd*OtRif$kQ&?yDU_t zC91;;RU5;jr@YUyQ)EjuJ%A}APKU~o!Cy)P_DJFBc3!5phs0&qwLR*%Ko;QhbMwx3 z=im{1+T<4Nw-cv&x8~Dhuru?>cc5=Kji(y2_mR#I`Y>z zPw(iU3_<%TiLloOcnxXMMUMg!*ZsH+29G~;=BFv7I&V)`Up_Sg-BvPu9sxzY?9M0t z%gHQ*QN~H?B=>UB8weO<>QF&GL>9`VMru58Y4ExfXF!Z)ei2)4Gikd?=L<7{jd|Dh zBw+!Z37+x`^kElS1yyty`NJf~3G5zeDp`Nh*oDSJs+-oz%>){qmL`WHx8Sc2{`lPr5W!=( z+e*A+-)-+Ml0yh4>hb43FUUHgTO^D7)?I);e1=xlRZPHii>`e5dx`w+ z(+APY^_=W;Tcs2rg#jnUrg!SQ8G&ZdG1RB5_f<=GWZg8Ref8J_ht|eQ+_p}A^4!lc zLscgqZ&Nrwk6PC;J`UFmqdZmT5n6HyiJ72L3X0wbe?IWO?s-q3ARZ(J&h_E#ZIo?C zX2}Nrs)uyHh)`N zXlY)MIEbV`(0h=zc+>m&ugH_i5y2GsQ2sOHQxP4q1E(G68_arXosqRSk!9H7dn3VX zHTw}&=S4)_iLVv=#$=Kk?AD2a8>nH2e@6cqf0^)Urb*{SqF(WtLet`_y4;BVaC;wF ziY2n-AD8`pK6}rbia&lK54Rh=R?B$tto>?uZnLPrLd!UT<;EFkA5sh#Dl9E6HE$x1 zskExuFMiCxT(NZFgfCdcipfzp^S&}enm03SZ0Xy5;$AsZf8DoXN*Iam0mCQ(9P;xkK zSr@mGIIyDY-3LxEeJJWXW>E|hKv~6ch>(!be;}c=?Msf$KveH68;A1}HDthmYq*^U zDuG}n$w1Cy5^2Eorh)K9IjNc7CX0u+_e$sWp1h)>wu~u}hnO1;>o?=<$Dobv}o$ z!{7x0)u8U{2P$tx1qBe0?CcpGh0z9{Xx|*h2O}60`S991X)|i>l*-^J?li2SdZ)d; zJsy{pET{{1eQxF{5XAk^Nt48_@lQtoRfjVLyox>XPQJf_kKgL_Krx(LEK@LY1l|N|#miHfGERPtL|E`^8cA8Da)Q!wZWtn_~JQw7UT`{ar^n*~KH$m}Py2j5&aF%0#K^|kvR*WTYeu7y76P)#=gq4bB^XM%Klx` z-kB;;2K}bA!hbb_p-Ti(@^^CVq^$_NR*nNue_K&9$y+PoR(v@r)EZP%$?4~~x4wHw z95ny;@C7!Nibt&_y8;hM+t_S(1aUQI_m*_u# zMs*K#QwlyZ!81b6V}TV2uiG#on&KO+I-9<*c&|#!;~|!iC?E*k-d|QJWu%($CwqT> zYD$mv8?9PgTUK||E-zniE(x3uHH$LQ{XEX8zXrBx?rS_HP7gEJ4_vK-Nj&dSHc0h! zmZTMlTZDq6K;8fT=li|B%JNi?u~NGzZLnu#W-7kJE?5UAl>%37f!6fGy5-g`xOWC1 z687@;e!On`Z*tHkNAp3-Yd&OT)vi^nKCYEn5WC`9qCf9cUp!E3cl)9`*XX)(@tyl! zl8@w`n4IA##?Bj1RvYFOU0*L-$hT|6koC2UP!HveS7f>|L#t3NKhV_t+PswQeR_8G z3`)m92#)d))LVxT9>kVa8gXeUw-{?sR2ao86<>d~_2L*)-X65G%!_68BAdRP$u`@K zEI3ALItcS)vyX>PQvMWEYsIMu8pY`DQbiqXZ=S3xZ%79N3Z22jzW(0c=W~Tw!dTqh zP9XbscnUVnBtaS~zU7}isHDWDYCjr1KB~N(a_3z>i{2BOx+8c|Sx*<;!pu)^-G|M$H#ZHn1`qUzU`tPsB_$<`BxAVZU_;)F?uW{QB+M?! zL9!s!qKXtK00oG5wu-IefHQIHHQMi&q3_;{zq;}Rk4B(?+U`j_rB{__$DEa8rsPMiryf)4YET5c{ar!x$v6{}2o=Lj1iif%He|5)JK2S}HTQajK12 zC6*I{dg*q7fL}n@%}?BL__{OLHKgJ0bO(hVJc7&1%i~)|r2e%znV!!qK3k)Sw=#G7 zP?S2QxvPy5>?O`V#s>?5U#iArQiAl|68Ji$8nN$tmKDQcS0?J%-^zN4H@nKO-B2k> z@tZUUO@YWyL|a+<7CohFPi4SJ*Tw@bxG z7aRAL;jsH(6B9aal=cHQI9NXGg#`u6pqxM$2HR>^R^W(^!YU#Z@>C+uAhA^oZxcg}bQbN#8;fO#_N(*>?wNV(mWBrD5_ioWlZO+V9vGz&YH3OGnbGAZ!uo3eFJpA?? zJje$H<1G$jmp=IMe=UN> z50}W%p6hZ+A#OYG-170-!bm+D|Dq=Vz_KdM{q7dT9Q(Se=yN#uc}no}*U7LyMrcnP z$U=39k^gpA8h#E`!2DFCcLr>tS%3HLUD_i;!t0t}Cfrz9Gd*$$U32r`8rUCDNG2qM zPeR^+p2!!yzS;M7_%aJ|QoAB5at1#979<})p)h(v#zL^MHXCaxfZ_Xc&9(+amSyj$ zC~pLNOdS?chYI2xy!c|K60;;ub-XYJ2G#+>)O0>E`&cy`7JXU0Hj5_;Q#;t diff --git a/third_party/nanopb/docs/logo/logo.svg b/third_party/nanopb/docs/logo/logo.svg deleted file mode 100644 index 91ab28b6780..00000000000 --- a/third_party/nanopb/docs/logo/logo.svg +++ /dev/null @@ -1,1470 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - Pb - Pb - - - - - - - - - - - - - - - - - - nano - nano - - - - - diff --git a/third_party/nanopb/docs/logo/logo16px.png b/third_party/nanopb/docs/logo/logo16px.png deleted file mode 100644 index 8db0e2ef3f472f50b2c0b9ee4c545453f865ad2c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 854 zcmV-c1F8IpP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L017Dp017DqCuavK00007bV*G`2iyS# z5(76cq%NcY00P!YL_t(I%UzN`Xe?C}#=m>#&fb}woynSPOtNmWEG%KgLhvbA2sW_` zcELhIDpQz7o}eJeLLgQ?tZZDcu(nV6NcAkN0)pvGB*kWjgk*MS=Fa_dY_dz92Tpg+ zcfQ{_hcy}vktB&rl7zI@0szXg{4|c^@1>L-Yc0)YvwyVK7o78-FE1}&;Ysi;%goWy z5tU`R1mIg^%&SJD@%z@+*1Ib!D=SeHwc-{koVa;ZfE2X~bbUH7RB*D_s z61KOuQ4|HzG{x=hE%H2vwRU0KT8rs)`qS0b)pK5})s{Wa8>DH9<>h7c`+XEefxEjq zWLbu)s^FZ%YuubeN_n)ox%m+f!|=0uz5Yd#B$%T)=b*L5!@~nO=NJx$i)JE%wHDUe zT2)ow2qDDo#>NJeQn{F5Ezfg&|0I_YP}|4jDb=L#+Y|F=llbu6gcP5 zTI1~O3`!~N?d_r4?P4?Yse;?LbR8=(>c#9ijxYiohS`ZPObI9`?qtOVb zr>D5TzsGbs#mUJDdc7XB)=)~#cf&+gRsTvU-yk9Y0AmdGdL4&{hX8=p)z!tsvMd*A zt%VRG86&PdiJnw?F+wBjd zD0(S`2=Kp{BWbNsmL-a!fKm!X1SzHUeg6|iMCf!nFM=R=PDGfa%+G0zSs+wZ1tNm) z`v`*Ix5;F3z=#NpG1hLk|0JUKoO6rGkN1W#X7Nly2n0cJk*4X}L`3}2DqUY+KeN{U zVy)Fr7p9bga}J*8K}u=DF#L5gnGERBDtl@f0M^&nKh|1*XN(zGYu^L_&+~4C5Pu6H gei)C(XHV<@1J&fBKi_@Vod5s;07*qoM6N<$g0TRKQUCw| diff --git a/third_party/nanopb/docs/logo/logo48px.png b/third_party/nanopb/docs/logo/logo48px.png deleted file mode 100644 index b598c01186356d10ef4d4959690d0f792556ca9c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2577 zcmV+s3hwoZP)Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iyS# z5ikgE@7VAF011&vL_t(&-sM_-j2vYd|2^}uGqZcUz1!Q{-q(6uOCixldQCt%N-IGG z3LM4i1;R%V>S0qfVk4F0Dosd>^-?W~wW4T3BA6Hw#MmkY5kCl32(|*2_6&FJ-L~7i z>v6X?yE|X+JpSR#X6|T{M!nk_pJbBF%$u3#_rAa9dCkVjy%}yX&sI zt{NU5-c3Z8c%BExao~9#eBTE%!}GiXGjBY4^yn`x1OVa8tH+KVOK#er*<#fpQeRH{qUGys6>y0C2OZ zno&rW*XGxMMbe@P%EEdtw(11)P1Iw~7Gc!}oK6B$k*YyK6TYO zbw)kUgJoH;EDMQ50@-Z#L#Z_cKtygLk$Ab*?erI2*L7Uih2uEYLN-1=4rWF&nM7k_ zV>SDP&P$R6MN!mzKL30wm1?XRfWg7Rw_Ml#o@H6EZ5x$J1?6%X)6>&9b?Ov|24RSvxW^ zQmF}mvsqhPTfDBW?xlD<-tGH7Ow%lsN~PNhg~GvbOgf!@TvgSF6N!Wb;7_jW-a0Ze zGP#hO`g2-7pD#~NPTpXe<|{!EHyeiWyQZe5JHs)Plar4y^Ubd7PAZDBO4s$*T3T8z zI?E<%?lu1_5ZdzP%VU*F7tKKP(N97pFaeEdV71*@4ox)^_FF=5<)B$LJax7|7t82+dnikG&S!40?tcImMqz$s_K_~ z-$$iVfoYo0PfbnT&CDeLNTpJlhK7b;CK8D&0hqRJKW$mo=Ve*WWV2a`h^mcYP#k^N zbw`8{j|~qG|9D;jgx1;FxlK`&M?(;$Qt42!SnOfu5di4v>50Gh-g`e2LiD(<3r*9I zOeWFV+6o~AEXzWGRTYL|tf;H2`-`fo zR|1fShK5#ImbE&p=&4i+ot>RXr_-pbt3xangDlG+B1n=1Ns^$dDl|>IDHe+z>Fn%W zGp_&u;KYd&-*+76IsjveqCnU6=2$HDN_~C(y~SejX-(7WlgVVYugYXHP*oK~G;609 zZRZt5fu?C$Ns^w<<#NWn0sw%~(a~4RheG-pXSLI_BbbXEZ&XysoY85!wTurS7{R4Ufk*oc{#8EBe@8+cq>! zgRbk?zkfg0u3d{#sf4|I_u`E=-oT+lhp=wlI`sGV&zk*En+@s&OOkYv6e&da1?t+B zMARR--%3PJ5YZkYS`*ycOhgGHx`Bwk92vWXh+ZP1Z_H`UuNOk7<#HLm?^lD?w(aVy zGBXYyJczEYE-*6|FJ6q@yLV&r=FQMFZI=2GT;w=TuM~VZ2H+6@R{>ZB;QrwLWdL3T z@GSs~0HlbhDR|xupclYbg0Xi1xDCL~0J?}Md`A~EcZ4FDZQIohBZL3|^!N8;>(;Hf z_~MJPW5cqfY$&RL{tahQ2?8n*(Rbk00km?9Kd7D>_nApMNvRR)hshGFo5al=_;`1=4K?5 zNfe7k?Ao;p0|Nt9;Vf)3f^2jkq|k!^3e3DA5T$+s;2r==06ZHwcLKoW06q)gMP}X< z0Dcm{?Eo$U@H!DC04xP?2Y~09xm+j|{?5!(;fzNMR;YZ>l`N;GrmBG7fB$_rjx(#h z0N{;{jqM9pU{UZv0B`}^1mJ4{rM?5;DFBxN_zVCGz|P3nUI1Hycl;259^4xa`yXcJ z&d$zbilST*&OQM2_4R?7v0=jo?Af!YdT25}J`TrmuzUAz6bc3G+_@9BZCB4Fg4rKq zW_O|L06IE4zN_o{SEI6I2xP8QAF6&)RV1v?01&h%zZx4GyJey30Fue%mQtzILqtoW z{6Aa&6P4?u)L~}GvJ6#KrxS_9-3wWX0RXvNZjCI8cE`6z(snMB|`D~fW@ z#Kgo;7aTyKay$v3FDlK?o&D$))(u&fA%<>aPZEZEY((&wI{w-Ogw=o_l~O%Q6&2Ij!sZoui|p zzn%9j<-f5STZ9nT_`ZLs@B7UFbY^xWNh(N^^bbjrUd!cjkG=Wko9=?_iT_h;Y;644 nQyVO&=00000NkvXXu0mjf@tD#T diff --git a/third_party/nanopb/docs/lsr.css b/third_party/nanopb/docs/lsr.css deleted file mode 100644 index 429bce51f6e..00000000000 --- a/third_party/nanopb/docs/lsr.css +++ /dev/null @@ -1,240 +0,0 @@ -/* -Author: Peter Parente -Date: 2008/01/22 -Version: 1.0 (modified) -Copyright: This stylesheet has been placed in the public domain - free to edit and use for all uses. -*/ - -body { - font: 100% sans-serif; - background: #ffffff; - color: black; - margin: 2em; - padding: 0em 2em; -} - -p.topic-title { - font-weight: bold; -} - -table.docinfo { - text-align: left; - margin: 2em 0em; -} - -a[href] { - color: #436976; - background-color: transparent; -} - -a.toc-backref { - text-decoration: none; -} - -h1 a[href] { - color: #003a6b; - text-decoration: none; - background-color: transparent; -} - -a.strong { - font-weight: bold; -} - -img { - margin: 0; - border: 0; -} - -p { - margin: 0.5em 0 1em 0; - line-height: 1.5em; -} - -p a:visited { - color: purple; - background-color: transparent; -} - -p a:active { - color: red; - background-color: transparent; -} - -a:hover { - text-decoration: none; -} - -p img { - border: 0; - margin: 0; -} - -p.rubric { - font-weight: bold; - font-style: italic; -} - -em { - font-style: normal; - font-family: monospace; - font-weight: bold; -} - -pre { - border-left: 3px double #aaa; - padding: 5px 10px; - background-color: #f6f6f6; -} - -h1.title { - color: #003a6b; - font-size: 180%; - margin-bottom: 0em; -} - -h2.subtitle { - color: #003a6b; - border-bottom: 0px; -} - -h1, h2, h3, h4, h5, h6 { - color: #555; - background-color: transparent; - margin: 0em; - padding-top: 0.5em; -} - -h1 { - font-size: 150%; - margin-bottom: 0.5em; - border-bottom: 2px solid #aaa; -} - -h2 { - font-size: 130%; - margin-bottom: 0.5em; - border-bottom: 1px solid #aaa; -} - -h3 { - font-size: 120%; - margin-bottom: 0.5em; -} - -h4 { - font-size: 110%; - font-weight: bold; - margin-bottom: 0.5em; -} - -h5 { - font-size: 105%; - font-weight: bold; - margin-bottom: 0.5em; -} - -h6 { - font-size: 100%; - font-weight: bold; - margin-bottom: 0.5em; -} - -dt { - font-style: italic; -} - -dd { - margin-bottom: 1.5em; -} - -div.admonition, div.note, div.tip, div.caution, div.important { - margin: 2em 2em; - padding: 0em 1em; - border-top: 1px solid #aaa; - border-left: 1px solid #aaa; - border-bottom: 2px solid #555; - border-right: 2px solid #555; -} - -div.important { - background: transparent url('../images/important.png') 10px 2px no-repeat; -} - -div.caution { - background: transparent url('../images/caution.png') 10px 2px no-repeat; -} - -div.note { - background: transparent url('../images/note.png') 10px 2px no-repeat; -} - -div.tip { - background: transparent url('../images/tip.png') 10px 2px no-repeat; -} - -div.admonition-example { - background: transparent url('../images/tip.png') 10px 2px no-repeat; -} - -div.admonition-critical-example { - background: transparent url('../images/important.png') 10px 2px no-repeat; -} - -p.admonition-title { - font-weight: bold; - border-bottom: 1px solid #aaa; - padding-left: 30px; -} - -table.docutils { - text-align: left; - border: 1px solid gray; - border-collapse: collapse; - margin: 1.5em 0em; -} - -table.docutils caption { - font-style: italic; -} - -table.docutils td, table.docutils th { - padding: 0.25em 0.5em; -} - -th.field-name { - text-align: right; - width: 15em; -} - -table.docutils th { - font-family: monospace; - background-color: #f6f6f6; - vertical-align: middle; -} - -table.field-list { - border: none; -} - -div.sidebar { - margin: 2em 2em 2em 0em; - padding: 0em 1em; - border-top: 1px solid #aaa; - border-left: 1px solid #aaa; - border-bottom: 2px solid #555; - border-right: 2px solid #555; -} - -p.sidebar-title { - margin-bottom: 0em; - color: #003a6b; - border-bottom: 1px solid #aaa; - font-weight: bold; -} - -p.sidebar-subtitle { - margin-top: 0em; - font-style: italic; - color: #003a6b; -} diff --git a/third_party/nanopb/docs/menu.rst b/third_party/nanopb/docs/menu.rst deleted file mode 100644 index 2c110defc4e..00000000000 --- a/third_party/nanopb/docs/menu.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. sidebar :: Documentation index - - 1) `Overview`_ - 2) `Concepts`_ - 3) `API reference`_ - 4) `Security model`_ - 5) `Migration from older versions`_ - -.. _`Overview`: index.html -.. _`Concepts`: concepts.html -.. _`API reference`: reference.html -.. _`Security model`: security.html -.. _`Migration from older versions`: migration.html diff --git a/third_party/nanopb/docs/migration.rst b/third_party/nanopb/docs/migration.rst deleted file mode 100644 index cd5911f5714..00000000000 --- a/third_party/nanopb/docs/migration.rst +++ /dev/null @@ -1,276 +0,0 @@ -===================================== -Nanopb: Migration from older versions -===================================== - -.. include :: menu.rst - -This document details all the breaking changes that have been made to nanopb -since its initial release. For each change, the rationale and required -modifications of user applications are explained. Also any error indications -are included, in order to make it easier to find this document. - -.. contents :: - -Nanopb-0.3.5 (2016-02-13) -========================= - -Add support for platforms without uint8_t ------------------------------------------ -**Rationale:** Some platforms cannot access 8-bit sized values directly, and -do not define *uint8_t*. Nanopb previously didn't support these platforms. - -**Changes:** References to *uint8_t* were replaced with several alternatives, -one of them being a new *pb_byte_t* typedef. This in turn uses *uint_least8_t* -which means the smallest available type. - -**Required actions:** If your platform does not have a standards-compliant -*stdint.h*, it may lack the definition for *[u]int_least8_t*. This must be -added manually, example can be found in *extra/pb_syshdr.h*. - -**Error indications:** Compiler error: "unknown type name 'uint_least8_t'". - -Nanopb-0.3.2 (2015-01-24) -========================= - -Add support for OneOfs ----------------------- -**Rationale:** Previously nanopb did not support the *oneof* construct in -*.proto* files. Those fields were generated as regular *optional* fields. - -**Changes:** OneOfs are now generated as C unions. Callback fields are not -supported inside oneof and generator gives an error. - -**Required actions:** The generator option *no_unions* can be used to restore old -behaviour and to allow callbacks to be used. To use unions, one change is -needed: use *which_xxxx* field to detect which field is present, instead -of *has_xxxx*. Compare the value against *MyStruct_myfield_tag*. - -**Error indications:** Generator error: "Callback fields inside of oneof are -not supported". Compiler error: "Message" has no member named "has_xxxx". - -Nanopb-0.3.0 (2014-08-26) -========================= - -Separate field iterator logic to pb_common.c --------------------------------------------- -**Rationale:** Originally, the field iteration logic was simple enough to be -duplicated in *pb_decode.c* and *pb_encode.c*. New field types have made the -logic more complex, which required the creation of a new file to contain the -common functionality. - -**Changes:** There is a new file, *pb_common.c*, which must be included in -builds. - -**Required actions:** Add *pb_common.c* to build rules. This file is always -required. Either *pb_decode.c* or *pb_encode.c* can still be left out if some -functionality is not needed. - -**Error indications:** Linker error: undefined reference to -*pb_field_iter_begin*, *pb_field_iter_next* or similar. - -Change data type of field counts to pb_size_t ---------------------------------------------- -**Rationale:** Often nanopb is used with small arrays, such as 255 items or -less. Using a full *size_t* field to store the array count wastes memory if -there are many arrays. There already exists parameters *PB_FIELD_16BIT* and -*PB_FIELD_32BIT* which tell nanopb what is the maximum size of arrays in use. - -**Changes:** Generator will now use *pb_size_t* for the array *_count* fields. -The size of the type will be controlled by the *PB_FIELD_16BIT* and -*PB_FIELD_32BIT* compilation time options. - -**Required actions:** Regenerate all *.pb.h* files. In some cases casts to the -*pb_size_t* type may need to be added in the user code when accessing the -*_count* fields. - -**Error indications:** Incorrect data at runtime, crashes. But note that other -changes in the same version already require regenerating the files and have -better indications of errors, so this is only an issue for development -versions. - -Renamed some macros and identifiers ------------------------------------ -**Rationale:** Some names in nanopb core were badly chosen and conflicted with -ISO C99 reserved names or lacked a prefix. While they haven't caused trouble -so far, it is reasonable to switch to non-conflicting names as these are rarely -used from user code. - -**Changes:** The following identifier names have changed: - - * Macros: - - * STATIC_ASSERT(x) -> PB_STATIC_ASSERT(x) - * UNUSED(x) -> PB_UNUSED(x) - - * Include guards: - - * _PB_filename_ -> PB_filename_INCLUDED - - * Structure forward declaration tags: - - * _pb_field_t -> pb_field_s - * _pb_bytes_array_t -> pb_bytes_array_s - * _pb_callback_t -> pb_callback_s - * _pb_extension_type_t -> pb_extension_type_s - * _pb_extension_t -> pb_extension_s - * _pb_istream_t -> pb_istream_s - * _pb_ostream_t -> pb_ostream_s - -**Required actions:** Regenerate all *.pb.c* files. If you use any of the above -identifiers in your application code, perform search-replace to the new name. - -**Error indications:** Compiler errors on lines with the macro/type names. - -Nanopb-0.2.9 (2014-08-09) -========================= - -Change semantics of generator -e option ---------------------------------------- -**Rationale:** Some compilers do not accept filenames with two dots (like -in default extension .pb.c). The *-e* option to the generator allowed changing -the extension, but not skipping the extra dot. - -**Changes:** The *-e* option in generator will no longer add the prepending -dot. The default value has been adjusted accordingly to *.pb.c* to keep the -default behaviour the same as before. - -**Required actions:** Only if using the generator -e option. Add dot before -the parameter value on the command line. - -**Error indications:** File not found when trying to compile generated files. - -Nanopb-0.2.7 (2014-04-07) -========================= - -Changed pointer-type bytes field datatype ------------------------------------------ -**Rationale:** In the initial pointer encoding support since nanopb-0.2.5, -the bytes type used a separate *pb_bytes_ptr_t* type to represent *bytes* -fields. This made it easy to encode data from a separate, user-allocated -buffer. However, it made the internal logic more complex and was inconsistent -with the other types. - -**Changes:** Dynamically allocated bytes fields now have the *pb_bytes_array_t* -type, just like statically allocated ones. - -**Required actions:** Only if using pointer-type fields with the bytes datatype. -Change any access to *msg->field.size* to *msg->field->size*. Change any -allocation to reserve space of amount *PB_BYTES_ARRAY_T_ALLOCSIZE(n)*. If the -data pointer was begin assigned from external source, implement the field using -a callback function instead. - -**Error indications:** Compiler error: unknown type name *pb_bytes_ptr_t*. - -Nanopb-0.2.4 (2013-11-07) -========================= - -Remove the NANOPB_INTERNALS compilation option ----------------------------------------------- -**Rationale:** Having the option in the headers required the functions to -be non-static, even if the option is not used. This caused errors on some -static analysis tools. - -**Changes:** The *#ifdef* and associated functions were removed from the -header. - -**Required actions:** Only if the *NANOPB_INTERNALS* option was previously -used. Actions are as listed under nanopb-0.1.3 and nanopb-0.1.6. - -**Error indications:** Compiler warning: implicit declaration of function -*pb_dec_string*, *pb_enc_string*, or similar. - -Nanopb-0.2.1 (2013-04-14) -========================= - -Callback function signature ---------------------------- -**Rationale:** Previously the auxilary data to field callbacks was passed -as *void\**. This allowed passing of any data, but made it unnecessarily -complex to return a pointer from callback. - -**Changes:** The callback function parameter was changed to *void\*\**. - -**Required actions:** You can continue using the old callback style by -defining *PB_OLD_CALLBACK_STYLE*. Recommended action is to: - - * Change the callback signatures to contain *void\*\** for decoders and - *void \* const \** for encoders. - * Change the callback function body to use *\*arg* instead of *arg*. - -**Error indications:** Compiler warning: assignment from incompatible -pointer type, when initializing *funcs.encode* or *funcs.decode*. - -Nanopb-0.2.0 (2013-03-02) -========================= - -Reformatted generated .pb.c file using macros ---------------------------------------------- -**Rationale:** Previously the generator made a list of C *pb_field_t* -initializers in the .pb.c file. This led to a need to regenerate all .pb.c -files after even small changes to the *pb_field_t* definition. - -**Changes:** Macros were added to pb.h which allow for cleaner definition -of the .pb.c contents. By changing the macro definitions, changes to the -field structure are possible without breaking compatibility with old .pb.c -files. - -**Required actions:** Regenerate all .pb.c files from the .proto sources. - -**Error indications:** Compiler warning: implicit declaration of function -*pb_delta_end*. - -Changed pb_type_t definitions ------------------------------ -**Rationale:** The *pb_type_t* was previously an enumeration type. This -caused warnings on some compilers when using bitwise operations to set flags -inside the values. - -**Changes:** The *pb_type_t* was changed to *typedef uint8_t*. The values -were changed to *#define*. Some value names were changed for consistency. - -**Required actions:** Only if you directly access the `pb_field_t` contents -in your own code, something which is not usually done. Needed changes: - - * Change *PB_HTYPE_ARRAY* to *PB_HTYPE_REPEATED*. - * Change *PB_HTYPE_CALLBACK* to *PB_ATYPE()* and *PB_ATYPE_CALLBACK*. - -**Error indications:** Compiler error: *PB_HTYPE_ARRAY* or *PB_HTYPE_CALLBACK* -undeclared. - -Nanopb-0.1.6 (2012-09-02) -========================= - -Refactored field decoder interface ----------------------------------- -**Rationale:** Similarly to field encoders in nanopb-0.1.3. - -**Changes:** New functions with names *pb_decode_\** were added. - -**Required actions:** By defining NANOPB_INTERNALS, you can still keep using -the old functions. Recommended action is to replace any calls with the newer -*pb_decode_\** equivalents. - -**Error indications:** Compiler warning: implicit declaration of function -*pb_dec_string*, *pb_dec_varint*, *pb_dec_submessage* or similar. - -Nanopb-0.1.3 (2012-06-12) -========================= - -Refactored field encoder interface ----------------------------------- -**Rationale:** The old *pb_enc_\** functions were designed mostly for the -internal use by the core. Because they are internally accessed through -function pointers, their signatures had to be common. This led to a confusing -interface for external users. - -**Changes:** New functions with names *pb_encode_\** were added. These have -easier to use interfaces. The old functions are now only thin wrappers for -the new interface. - -**Required actions:** By defining NANOPB_INTERNALS, you can still keep using -the old functions. Recommended action is to replace any calls with the newer -*pb_encode_\** equivalents. - -**Error indications:** Compiler warning: implicit declaration of function -*pb_enc_string*, *pb_enc_varint, *pb_enc_submessage* or similar. - diff --git a/third_party/nanopb/docs/reference.rst b/third_party/nanopb/docs/reference.rst deleted file mode 100644 index ef3867a1172..00000000000 --- a/third_party/nanopb/docs/reference.rst +++ /dev/null @@ -1,770 +0,0 @@ -===================== -Nanopb: API reference -===================== - -.. include :: menu.rst - -.. contents :: - - - - -Compilation options -=================== -The following options can be specified in one of two ways: - -1. Using the -D switch on the C compiler command line. -2. By #defining them at the top of pb.h. - -You must have the same settings for the nanopb library and all code that -includes pb.h. - -============================ ================================================ -PB_NO_PACKED_STRUCTS Disable packed structs. Increases RAM usage but - is necessary on some platforms that do not - support unaligned memory access. -PB_ENABLE_MALLOC Set this to enable dynamic allocation support - in the decoder. -PB_MAX_REQUIRED_FIELDS Maximum number of required fields to check for - presence. Default value is 64. Increases stack - usage 1 byte per every 8 fields. Compiler - warning will tell if you need this. -PB_FIELD_16BIT Add support for tag numbers > 255 and fields - larger than 255 bytes or 255 array entries. - Increases code size 3 bytes per each field. - Compiler error will tell if you need this. -PB_FIELD_32BIT Add support for tag numbers > 65535 and fields - larger than 65535 bytes or 65535 array entries. - Increases code size 9 bytes per each field. - Compiler error will tell if you need this. -PB_NO_ERRMSG Disables the support for error messages; only - error information is the true/false return - value. Decreases the code size by a few hundred - bytes. -PB_BUFFER_ONLY Disables the support for custom streams. Only - supports encoding and decoding with memory - buffers. Speeds up execution and decreases code - size slightly. -PB_OLD_CALLBACK_STYLE Use the old function signature (void\* instead - of void\*\*) for callback fields. This was the - default until nanopb-0.2.1. -PB_SYSTEM_HEADER Replace the standard header files with a single - header file. It should define all the required - functions and typedefs listed on the - `overview page`_. Value must include quotes, - for example *#define PB_SYSTEM_HEADER "foo.h"*. -============================ ================================================ - -The PB_MAX_REQUIRED_FIELDS, PB_FIELD_16BIT and PB_FIELD_32BIT settings allow -raising some datatype limits to suit larger messages. Their need is recognized -automatically by C-preprocessor #if-directives in the generated .pb.h files. -The default setting is to use the smallest datatypes (least resources used). - -.. _`overview page`: index.html#compiler-requirements - - -Proto file options -================== -The generator behaviour can be adjusted using these options, defined in the -'nanopb.proto' file in the generator folder: - -============================ ================================================ -max_size Allocated size for *bytes* and *string* fields. -max_count Allocated number of entries in arrays - (*repeated* fields). -int_size Override the integer type of a field. - (To use e.g. uint8_t to save RAM.) -type Type of the generated field. Default value - is *FT_DEFAULT*, which selects automatically. - You can use *FT_CALLBACK*, *FT_POINTER*, - *FT_STATIC*, *FT_IGNORE*, or *FT_INLINE* to - force a callback field, a dynamically - allocated field, a static field, to - completely ignore the field or to - generate an inline bytes field. -long_names Prefix the enum name to the enum value in - definitions, i.e. *EnumName_EnumValue*. Enabled - by default. -packed_struct Make the generated structures packed. - NOTE: This cannot be used on CPUs that break - on unaligned accesses to variables. -skip_message Skip the whole message from generation. -no_unions Generate 'oneof' fields as optional fields - instead of C unions. -msgid Specifies a unique id for this message type. - Can be used by user code as an identifier. -anonymous_oneof Generate 'oneof' fields as anonymous unions. -============================ ================================================ - -These options can be defined for the .proto files before they are converted -using the nanopb-generatory.py. There are three ways to define the options: - -1. Using a separate .options file. - This is the preferred way as of nanopb-0.2.1, because it has the best - compatibility with other protobuf libraries. -2. Defining the options on the command line of nanopb_generator.py. - This only makes sense for settings that apply to a whole file. -3. Defining the options in the .proto file using the nanopb extensions. - This is the way used in nanopb-0.1, and will remain supported in the - future. It however sometimes causes trouble when using the .proto file - with other protobuf libraries. - -The effect of the options is the same no matter how they are given. The most -common purpose is to define maximum size for string fields in order to -statically allocate them. - -Defining the options in a .options file ---------------------------------------- -The preferred way to define options is to have a separate file -'myproto.options' in the same directory as the 'myproto.proto'. :: - - # myproto.proto - message MyMessage { - required string name = 1; - repeated int32 ids = 4; - } - -:: - - # myproto.options - MyMessage.name max_size:40 - MyMessage.ids max_count:5 - -The generator will automatically search for this file and read the -options from it. The file format is as follows: - -* Lines starting with '#' or '//' are regarded as comments. -* Blank lines are ignored. -* All other lines should start with a field name pattern, followed by one or - more options. For example: *"MyMessage.myfield max_size:5 max_count:10"*. -* The field name pattern is matched against a string of form *'Message.field'*. - For nested messages, the string is *'Message.SubMessage.field'*. -* The field name pattern may use the notation recognized by Python fnmatch(): - - - *\** matches any part of string, like 'Message.\*' for all fields - - *\?* matches any single character - - *[seq]* matches any of characters 's', 'e' and 'q' - - *[!seq]* matches any other character - -* The options are written as *'option_name:option_value'* and several options - can be defined on same line, separated by whitespace. -* Options defined later in the file override the ones specified earlier, so - it makes sense to define wildcard options first in the file and more specific - ones later. - -If preferred, the name of the options file can be set using the command line -switch *-f* to nanopb_generator.py. - -Defining the options on command line ------------------------------------- -The nanopb_generator.py has a simple command line option *-s OPTION:VALUE*. -The setting applies to the whole file that is being processed. - -Defining the options in the .proto file ---------------------------------------- -The .proto file format allows defining custom options for the fields. -The nanopb library comes with *nanopb.proto* which does exactly that, allowing -you do define the options directly in the .proto file:: - - import "nanopb.proto"; - - message MyMessage { - required string name = 1 [(nanopb).max_size = 40]; - repeated int32 ids = 4 [(nanopb).max_count = 5]; - } - -A small complication is that you have to set the include path of protoc so that -nanopb.proto can be found. This file, in turn, requires the file -*google/protobuf/descriptor.proto*. This is usually installed under -*/usr/include*. Therefore, to compile a .proto file which uses options, use a -protoc command similar to:: - - protoc -I/usr/include -Inanopb/generator -I. -omessage.pb message.proto - -The options can be defined in file, message and field scopes:: - - option (nanopb_fileopt).max_size = 20; // File scope - message Message - { - option (nanopb_msgopt).max_size = 30; // Message scope - required string fieldsize = 1 [(nanopb).max_size = 40]; // Field scope - } - - - - - - - - - -pb.h -==== - -pb_byte_t ---------- -Type used for storing byte-sized data, such as raw binary input and bytes-type fields. :: - - typedef uint_least8_t pb_byte_t; - -For most platforms this is equivalent to `uint8_t`. Some platforms however do not support -8-bit variables, and on those platforms 16 or 32 bits need to be used for each byte. - -pb_type_t ---------- -Type used to store the type of each field, to control the encoder/decoder behaviour. :: - - typedef uint_least8_t pb_type_t; - -The low-order nibble of the enumeration values defines the function that can be used for encoding and decoding the field data: - -=========================== ===== ================================================ -LTYPE identifier Value Storage format -=========================== ===== ================================================ -PB_LTYPE_VARINT 0x00 Integer. -PB_LTYPE_UVARINT 0x01 Unsigned integer. -PB_LTYPE_SVARINT 0x02 Integer, zigzag encoded. -PB_LTYPE_FIXED32 0x03 32-bit integer or floating point. -PB_LTYPE_FIXED64 0x04 64-bit integer or floating point. -PB_LTYPE_BYTES 0x05 Structure with *size_t* field and byte array. -PB_LTYPE_STRING 0x06 Null-terminated string. -PB_LTYPE_SUBMESSAGE 0x07 Submessage structure. -PB_LTYPE_EXTENSION 0x08 Point to *pb_extension_t*. -PB_LTYPE_FIXED_LENGTH_BYTES 0x09 Inline *pb_byte_t* array of fixed size. -=========================== ===== ================================================ - -The bits 4-5 define whether the field is required, optional or repeated: - -==================== ===== ================================================ -HTYPE identifier Value Field handling -==================== ===== ================================================ -PB_HTYPE_REQUIRED 0x00 Verify that field exists in decoded message. -PB_HTYPE_OPTIONAL 0x10 Use separate *has_* boolean to specify - whether the field is present. - (Unless it is a callback) -PB_HTYPE_REPEATED 0x20 A repeated field with preallocated array. - Separate *_count* for number of items. - (Unless it is a callback) -==================== ===== ================================================ - -The bits 6-7 define the how the storage for the field is allocated: - -==================== ===== ================================================ -ATYPE identifier Value Allocation method -==================== ===== ================================================ -PB_ATYPE_STATIC 0x00 Statically allocated storage in the structure. -PB_ATYPE_CALLBACK 0x40 A field with dynamic storage size. Struct field - actually contains a pointer to a callback - function. -==================== ===== ================================================ - - -pb_field_t ----------- -Describes a single structure field with memory position in relation to others. The descriptions are usually autogenerated. :: - - typedef struct pb_field_s pb_field_t; - struct pb_field_s { - pb_size_t tag; - pb_type_t type; - pb_size_t data_offset; - pb_ssize_t size_offset; - pb_size_t data_size; - pb_size_t array_size; - const void *ptr; - } pb_packed; - -:tag: Tag number of the field or 0 to terminate a list of fields. -:type: LTYPE, HTYPE and ATYPE of the field. -:data_offset: Offset of field data, relative to the end of the previous field. -:size_offset: Offset of *bool* flag for optional fields or *size_t* count for arrays, relative to field data. -:data_size: Size of a single data entry, in bytes. For PB_LTYPE_BYTES, the size of the byte array inside the containing structure. For PB_HTYPE_CALLBACK, size of the C data type if known. -:array_size: Maximum number of entries in an array, if it is an array type. -:ptr: Pointer to default value for optional fields, or to submessage description for PB_LTYPE_SUBMESSAGE. - -The *uint8_t* datatypes limit the maximum size of a single item to 255 bytes and arrays to 255 items. Compiler will give error if the values are too large. The types can be changed to larger ones by defining *PB_FIELD_16BIT*. - -pb_bytes_array_t ----------------- -An byte array with a field for storing the length:: - - typedef struct { - pb_size_t size; - pb_byte_t bytes[1]; - } pb_bytes_array_t; - -In an actual array, the length of *bytes* may be different. - -pb_callback_t -------------- -Part of a message structure, for fields with type PB_HTYPE_CALLBACK:: - - typedef struct _pb_callback_t pb_callback_t; - struct _pb_callback_t { - union { - bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void **arg); - bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, void * const *arg); - } funcs; - - void *arg; - }; - -A pointer to the *arg* is passed to the callback when calling. It can be used to store any information that the callback might need. - -Previously the function received just the value of *arg* instead of a pointer to it. This old behaviour can be enabled by defining *PB_OLD_CALLBACK_STYLE*. - -When calling `pb_encode`_, *funcs.encode* is used, and similarly when calling `pb_decode`_, *funcs.decode* is used. The function pointers are stored in the same memory location but are of incompatible types. You can set the function pointer to NULL to skip the field. - -pb_wire_type_t --------------- -Protocol Buffers wire types. These are used with `pb_encode_tag`_. :: - - typedef enum { - PB_WT_VARINT = 0, - PB_WT_64BIT = 1, - PB_WT_STRING = 2, - PB_WT_32BIT = 5 - } pb_wire_type_t; - -pb_extension_type_t -------------------- -Defines the handler functions and auxiliary data for a field that extends -another message. Usually autogenerated by *nanopb_generator.py*:: - - typedef struct { - bool (*decode)(pb_istream_t *stream, pb_extension_t *extension, - uint32_t tag, pb_wire_type_t wire_type); - bool (*encode)(pb_ostream_t *stream, const pb_extension_t *extension); - const void *arg; - } pb_extension_type_t; - -In the normal case, the function pointers are *NULL* and the decoder and -encoder use their internal implementations. The internal implementations -assume that *arg* points to a *pb_field_t* that describes the field in question. - -To implement custom processing of unknown fields, you can provide pointers -to your own functions. Their functionality is mostly the same as for normal -callback fields, except that they get called for any unknown field when decoding. - -pb_extension_t --------------- -Ties together the extension field type and the storage for the field value:: - - typedef struct { - const pb_extension_type_t *type; - void *dest; - pb_extension_t *next; - bool found; - } pb_extension_t; - -:type: Pointer to the structure that defines the callback functions. -:dest: Pointer to the variable that stores the field value - (as used by the default extension callback functions.) -:next: Pointer to the next extension handler, or *NULL*. -:found: Decoder sets this to true if the extension was found. - -PB_GET_ERROR ------------- -Get the current error message from a stream, or a placeholder string if -there is no error message:: - - #define PB_GET_ERROR(stream) (string expression) - -This should be used for printing errors, for example:: - - if (!pb_decode(...)) - { - printf("Decode failed: %s\n", PB_GET_ERROR(stream)); - } - -The macro only returns pointers to constant strings (in code memory), -so that there is no need to release the returned pointer. - -PB_RETURN_ERROR ---------------- -Set the error message and return false:: - - #define PB_RETURN_ERROR(stream,msg) (sets error and returns false) - -This should be used to handle error conditions inside nanopb functions -and user callback functions:: - - if (error_condition) - { - PB_RETURN_ERROR(stream, "something went wrong"); - } - -The *msg* parameter must be a constant string. - - - -pb_encode.h -=========== - -pb_ostream_from_buffer ----------------------- -Constructs an output stream for writing into a memory buffer. This is just a helper function, it doesn't do anything you couldn't do yourself in a callback function. It uses an internal callback that stores the pointer in stream *state* field. :: - - pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize); - -:buf: Memory buffer to write into. -:bufsize: Maximum number of bytes to write. -:returns: An output stream. - -After writing, you can check *stream.bytes_written* to find out how much valid data there is in the buffer. - -pb_write --------- -Writes data to an output stream. Always use this function, instead of trying to call stream callback manually. :: - - bool pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count); - -:stream: Output stream to write to. -:buf: Pointer to buffer with the data to be written. -:count: Number of bytes to write. -:returns: True on success, false if maximum length is exceeded or an IO error happens. - -If an error happens, *bytes_written* is not incremented. Depending on the callback used, calling pb_write again after it has failed once may be dangerous. Nanopb itself never does this, instead it returns the error to user application. The builtin pb_ostream_from_buffer is safe to call again after failed write. - -pb_encode ---------- -Encodes the contents of a structure as a protocol buffers message and writes it to output stream. :: - - bool pb_encode(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); - -:stream: Output stream to write to. -:fields: A field description array, usually autogenerated. -:src_struct: Pointer to the data that will be serialized. -:returns: True on success, false on IO error, on detectable errors in field description, or if a field encoder returns false. - -Normally pb_encode simply walks through the fields description array and serializes each field in turn. However, submessages must be serialized twice: first to calculate their size and then to actually write them to output. This causes some constraints for callback fields, which must return the same data on every call. - -pb_encode_delimited -------------------- -Calculates the length of the message, encodes it as varint and then encodes the message. :: - - bool pb_encode_delimited(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); - -(parameters are the same as for `pb_encode`_.) - -A common way to indicate the message length in Protocol Buffers is to prefix it with a varint. -This function does this, and it is compatible with *parseDelimitedFrom* in Google's protobuf library. - -.. sidebar:: Encoding fields manually - - The functions with names *pb_encode_\** are used when dealing with callback fields. The typical reason for using callbacks is to have an array of unlimited size. In that case, `pb_encode`_ will call your callback function, which in turn will call *pb_encode_\** functions repeatedly to write out values. - - The tag of a field must be encoded separately with `pb_encode_tag_for_field`_. After that, you can call exactly one of the content-writing functions to encode the payload of the field. For repeated fields, you can repeat this process multiple times. - - Writing packed arrays is a little bit more involved: you need to use `pb_encode_tag` and specify `PB_WT_STRING` as the wire type. Then you need to know exactly how much data you are going to write, and use `pb_encode_varint`_ to write out the number of bytes before writing the actual data. Substreams can be used to determine the number of bytes beforehand; see `pb_encode_submessage`_ source code for an example. - -pb_get_encoded_size -------------------- -Calculates the length of the encoded message. :: - - bool pb_get_encoded_size(size_t *size, const pb_field_t fields[], const void *src_struct); - -:size: Calculated size of the encoded message. -:fields: A field description array, usually autogenerated. -:src_struct: Pointer to the data that will be serialized. -:returns: True on success, false on detectable errors in field description or if a field encoder returns false. - -pb_encode_tag -------------- -Starts a field in the Protocol Buffers binary format: encodes the field number and the wire type of the data. :: - - bool pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number); - -:stream: Output stream to write to. 1-5 bytes will be written. -:wiretype: PB_WT_VARINT, PB_WT_64BIT, PB_WT_STRING or PB_WT_32BIT -:field_number: Identifier for the field, defined in the .proto file. You can get it from field->tag. -:returns: True on success, false on IO error. - -pb_encode_tag_for_field ------------------------ -Same as `pb_encode_tag`_, except takes the parameters from a *pb_field_t* structure. :: - - bool pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_t *field); - -:stream: Output stream to write to. 1-5 bytes will be written. -:field: Field description structure. Usually autogenerated. -:returns: True on success, false on IO error or unknown field type. - -This function only considers the LTYPE of the field. You can use it from your field callbacks, because the source generator writes correct LTYPE also for callback type fields. - -Wire type mapping is as follows: - -============================================= ============ -LTYPEs Wire type -============================================= ============ -VARINT, UVARINT, SVARINT PB_WT_VARINT -FIXED64 PB_WT_64BIT -STRING, BYTES, SUBMESSAGE, FIXED_LENGTH_BYTES PB_WT_STRING -FIXED32 PB_WT_32BIT -============================================= ============ - -pb_encode_varint ----------------- -Encodes a signed or unsigned integer in the varint_ format. Works for fields of type `bool`, `enum`, `int32`, `int64`, `uint32` and `uint64`:: - - bool pb_encode_varint(pb_ostream_t *stream, uint64_t value); - -:stream: Output stream to write to. 1-10 bytes will be written. -:value: Value to encode. Just cast e.g. int32_t directly to uint64_t. -:returns: True on success, false on IO error. - -.. _varint: http://code.google.com/apis/protocolbuffers/docs/encoding.html#varints - -pb_encode_svarint ------------------ -Encodes a signed integer in the 'zig-zagged' format. Works for fields of type `sint32` and `sint64`:: - - bool pb_encode_svarint(pb_ostream_t *stream, int64_t value); - -(parameters are the same as for `pb_encode_varint`_ - -pb_encode_string ----------------- -Writes the length of a string as varint and then contents of the string. Works for fields of type `bytes` and `string`:: - - bool pb_encode_string(pb_ostream_t *stream, const pb_byte_t *buffer, size_t size); - -:stream: Output stream to write to. -:buffer: Pointer to string data. -:size: Number of bytes in the string. Pass `strlen(s)` for strings. -:returns: True on success, false on IO error. - -pb_encode_fixed32 ------------------ -Writes 4 bytes to stream and swaps bytes on big-endian architectures. Works for fields of type `fixed32`, `sfixed32` and `float`:: - - bool pb_encode_fixed32(pb_ostream_t *stream, const void *value); - -:stream: Output stream to write to. -:value: Pointer to a 4-bytes large C variable, for example `uint32_t foo;`. -:returns: True on success, false on IO error. - -pb_encode_fixed64 ------------------ -Writes 8 bytes to stream and swaps bytes on big-endian architecture. Works for fields of type `fixed64`, `sfixed64` and `double`:: - - bool pb_encode_fixed64(pb_ostream_t *stream, const void *value); - -:stream: Output stream to write to. -:value: Pointer to a 8-bytes large C variable, for example `uint64_t foo;`. -:returns: True on success, false on IO error. - -pb_encode_submessage --------------------- -Encodes a submessage field, including the size header for it. Works for fields of any message type:: - - bool pb_encode_submessage(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); - -:stream: Output stream to write to. -:fields: Pointer to the autogenerated field description array for the submessage type, e.g. `MyMessage_fields`. -:src: Pointer to the structure where submessage data is. -:returns: True on success, false on IO errors, pb_encode errors or if submessage size changes between calls. - -In Protocol Buffers format, the submessage size must be written before the submessage contents. Therefore, this function has to encode the submessage twice in order to know the size beforehand. - -If the submessage contains callback fields, the callback function might misbehave and write out a different amount of data on the second call. This situation is recognized and *false* is returned, but garbage will be written to the output before the problem is detected. - - - - - - - - - - - - -pb_decode.h -=========== - -pb_istream_from_buffer ----------------------- -Helper function for creating an input stream that reads data from a memory buffer. :: - - pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize); - -:buf: Pointer to byte array to read from. -:bufsize: Size of the byte array. -:returns: An input stream ready to use. - -pb_read -------- -Read data from input stream. Always use this function, don't try to call the stream callback directly. :: - - bool pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count); - -:stream: Input stream to read from. -:buf: Buffer to store the data to, or NULL to just read data without storing it anywhere. -:count: Number of bytes to read. -:returns: True on success, false if *stream->bytes_left* is less than *count* or if an IO error occurs. - -End of file is signalled by *stream->bytes_left* being zero after pb_read returns false. - -pb_decode ---------- -Read and decode all fields of a structure. Reads until EOF on input stream. :: - - bool pb_decode(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); - -:stream: Input stream to read from. -:fields: A field description array. Usually autogenerated. -:dest_struct: Pointer to structure where data will be stored. -:returns: True on success, false on IO error, on detectable errors in field description, if a field encoder returns false or if a required field is missing. - -In Protocol Buffers binary format, EOF is only allowed between fields. If it happens anywhere else, pb_decode will return *false*. If pb_decode returns false, you cannot trust any of the data in the structure. - -In addition to EOF, the pb_decode implementation supports terminating a message with a 0 byte. This is compatible with the official Protocol Buffers because 0 is never a valid field tag. - -For optional fields, this function applies the default value and sets *has_* to false if the field is not present. - -If *PB_ENABLE_MALLOC* is defined, this function may allocate storage for any pointer type fields. -In this case, you have to call `pb_release`_ to release the memory after you are done with the message. -On error return `pb_decode` will release the memory itself. - -pb_decode_noinit ----------------- -Same as `pb_decode`_, except does not apply the default values to fields. :: - - bool pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); - -(parameters are the same as for `pb_decode`_.) - -The destination structure should be filled with zeros before calling this function. Doing a *memset* manually can be slightly faster than using `pb_decode`_ if you don't need any default values. - -In addition to decoding a single message, this function can be used to merge two messages, so that -values from previous message will remain if the new message does not contain a field. - -This function *will not* release the message even on error return. If you use *PB_ENABLE_MALLOC*, -you will need to call `pb_release`_ yourself. - -pb_decode_delimited -------------------- -Same as `pb_decode`_, except that it first reads a varint with the length of the message. :: - - bool pb_decode_delimited(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); - -(parameters are the same as for `pb_decode`_.) - -A common method to indicate message size in Protocol Buffers is to prefix it with a varint. -This function is compatible with *writeDelimitedTo* in the Google's Protocol Buffers library. - -pb_release ----------- -Releases any dynamically allocated fields:: - - void pb_release(const pb_field_t fields[], void *dest_struct); - -:fields: A field description array. Usually autogenerated. -:dest_struct: Pointer to structure where data is stored. If NULL, function does nothing. - -This function is only available if *PB_ENABLE_MALLOC* is defined. It will release any -pointer type fields in the structure and set the pointers to NULL. - -pb_decode_tag -------------- -Decode the tag that comes before field in the protobuf encoding:: - - bool pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof); - -:stream: Input stream to read from. -:wire_type: Pointer to variable where to store the wire type of the field. -:tag: Pointer to variable where to store the tag of the field. -:eof: Pointer to variable where to store end-of-file status. -:returns: True on success, false on error or EOF. - -When the message (stream) ends, this function will return false and set *eof* to true. On other -errors, *eof* will be set to false. - -pb_skip_field -------------- -Remove the data for a field from the stream, without actually decoding it:: - - bool pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type); - -:stream: Input stream to read from. -:wire_type: Type of field to skip. -:returns: True on success, false on IO error. - -.. sidebar:: Decoding fields manually - - The functions with names beginning with *pb_decode_* are used when dealing with callback fields. The typical reason for using callbacks is to have an array of unlimited size. In that case, `pb_decode`_ will call your callback function repeatedly, which can then store the values into e.g. filesystem in the order received in. - - For decoding numeric (including enumerated and boolean) values, use `pb_decode_varint`_, `pb_decode_svarint`_, `pb_decode_fixed32`_ and `pb_decode_fixed64`_. They take a pointer to a 32- or 64-bit C variable, which you may then cast to smaller datatype for storage. - - For decoding strings and bytes fields, the length has already been decoded. You can therefore check the total length in *stream->bytes_left* and read the data using `pb_read`_. - - Finally, for decoding submessages in a callback, simply use `pb_decode`_ and pass it the *SubMessage_fields* descriptor array. - -pb_decode_varint ----------------- -Read and decode a varint_ encoded integer. :: - - bool pb_decode_varint(pb_istream_t *stream, uint64_t *dest); - -:stream: Input stream to read from. 1-10 bytes will be read. -:dest: Storage for the decoded integer. Value is undefined on error. -:returns: True on success, false if value exceeds uint64_t range or an IO error happens. - -pb_decode_svarint ------------------ -Similar to `pb_decode_varint`_, except that it performs zigzag-decoding on the value. This corresponds to the Protocol Buffers *sint32* and *sint64* datatypes. :: - - bool pb_decode_svarint(pb_istream_t *stream, int64_t *dest); - -(parameters are the same as `pb_decode_varint`_) - -pb_decode_fixed32 ------------------ -Decode a *fixed32*, *sfixed32* or *float* value. :: - - bool pb_decode_fixed32(pb_istream_t *stream, void *dest); - -:stream: Input stream to read from. 4 bytes will be read. -:dest: Pointer to destination *int32_t*, *uint32_t* or *float*. -:returns: True on success, false on IO errors. - -This function reads 4 bytes from the input stream. -On big endian architectures, it then reverses the order of the bytes. -Finally, it writes the bytes to *dest*. - -pb_decode_fixed64 ------------------ -Decode a *fixed64*, *sfixed64* or *double* value. :: - - bool pb_decode_fixed64(pb_istream_t *stream, void *dest); - -:stream: Input stream to read from. 8 bytes will be read. -:dest: Pointer to destination *int64_t*, *uint64_t* or *double*. -:returns: True on success, false on IO errors. - -Same as `pb_decode_fixed32`_, except this reads 8 bytes. - -pb_make_string_substream ------------------------- -Decode the length for a field with wire type *PB_WT_STRING* and create a substream for reading the data. :: - - bool pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream); - -:stream: Original input stream to read the length and data from. -:substream: New substream that has limited length. Filled in by the function. -:returns: True on success, false if reading the length fails. - -This function uses `pb_decode_varint`_ to read an integer from the stream. This is interpreted as a number of bytes, and the substream is set up so that its `bytes_left` is initially the same as the length, and its callback function and state the same as the parent stream. - -pb_close_string_substream -------------------------- -Close the substream created with `pb_make_string_substream`_. :: - - void pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream); - -:stream: Original input stream to read the length and data from. -:substream: Substream to close - -This function copies back the state from the substream to the parent stream. -It must be called after done with the substream. diff --git a/third_party/nanopb/docs/security.rst b/third_party/nanopb/docs/security.rst deleted file mode 100644 index d85461229d0..00000000000 --- a/third_party/nanopb/docs/security.rst +++ /dev/null @@ -1,84 +0,0 @@ -====================== -Nanopb: Security model -====================== - -.. include :: menu.rst - -.. contents :: - - - -Importance of security in a Protocol Buffers library -==================================================== -In the context of protocol buffers, security comes into play when decoding -untrusted data. Naturally, if the attacker can modify the contents of a -protocol buffers message, he can feed the application any values possible. -Therefore the application itself must be prepared to receive untrusted values. - -Where nanopb plays a part is preventing the attacker from running arbitrary -code on the target system. Mostly this means that there must not be any -possibility to cause buffer overruns, memory corruption or invalid pointers -by the means of crafting a malicious message. - -Division of trusted and untrusted data -====================================== -The following data is regarded as **trusted**. It must be under the control of -the application writer. Malicious data in these structures could cause -security issues, such as execution of arbitrary code: - -1. Callback, pointer and extension fields in message structures given to - pb_encode() and pb_decode(). These fields are memory pointers, and are - generated depending on the message definition in the .proto file. -2. The automatically generated field definitions, i.e. *pb_field_t* lists. -3. Contents of the *pb_istream_t* and *pb_ostream_t* structures (this does not - mean the contents of the stream itself, just the stream definition). - -The following data is regarded as **untrusted**. Invalid/malicious data in -these will cause "garbage in, garbage out" behaviour. It will not cause -buffer overflows, information disclosure or other security problems: - -1. All data read from *pb_istream_t*. -2. All fields in message structures, except: - - - callbacks (*pb_callback_t* structures) - - pointer fields (malloc support) and *_count* fields for pointers - - extensions (*pb_extension_t* structures) - -Invariants -========== -The following invariants are maintained during operation, even if the -untrusted data has been maliciously crafted: - -1. Nanopb will never read more than *bytes_left* bytes from *pb_istream_t*. -2. Nanopb will never write more than *max_size* bytes to *pb_ostream_t*. -3. Nanopb will never access memory out of bounds of the message structure. -4. After pb_decode() returns successfully, the message structure will be - internally consistent: - - - The *count* fields of arrays will not exceed the array size. - - The *size* field of bytes will not exceed the allocated size. - - All string fields will have null terminator. - -5. After pb_encode() returns successfully, the resulting message is a valid - protocol buffers message. (Except if user-defined callbacks write incorrect - data.) - -Further considerations -====================== -Even if the nanopb library is free of any security issues, there are still -several possible attack vectors that the application author must consider. -The following list is not comprehensive: - -1. Stack usage may depend on the contents of the message. The message - definition places an upper bound on how much stack will be used. Tests - should be run with all fields present, to record the maximum possible - stack usage. -2. Callbacks can do anything. The code for the callbacks must be carefully - checked if they are used with untrusted data. -3. If using stream input, a maximum size should be set in *pb_istream_t* to - stop a denial of service attack from using an infinite message. -4. If using network sockets as streams, a timeout should be set to stop - denial of service attacks. -5. If using *malloc()* support, some method of limiting memory use should be - employed. This can be done by defining custom *pb_realloc()* function. - Nanopb will properly detect and handle failed memory allocations. diff --git a/third_party/nanopb/examples/cmake_simple/CMakeLists.txt b/third_party/nanopb/examples/cmake_simple/CMakeLists.txt deleted file mode 100644 index e5f33a028eb..00000000000 --- a/third_party/nanopb/examples/cmake_simple/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(NANOPB_CMAKE_SIMPLE C) - -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../extra) -find_package(Nanopb REQUIRED) -include_directories(${NANOPB_INCLUDE_DIRS}) - -nanopb_generate_cpp(PROTO_SRCS PROTO_HDRS simple.proto) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -#add_custom_target(generate_proto_sources DEPENDS ${PROTO_SRCS} ${PROTO_HDRS}) -set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} - PROPERTIES GENERATED TRUE) - -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -g -O0") - -add_executable(simple simple.c ${PROTO_SRCS} ${PROTO_HDRS}) diff --git a/third_party/nanopb/examples/cmake_simple/README.txt b/third_party/nanopb/examples/cmake_simple/README.txt deleted file mode 100644 index aa0f3f3a771..00000000000 --- a/third_party/nanopb/examples/cmake_simple/README.txt +++ /dev/null @@ -1,18 +0,0 @@ -Nanopb example "simple" using CMake -======================= - -This example is the same as the simple nanopb example but built using CMake. - -Example usage -------------- - -On Linux, create a build directory and then call cmake: - - nanopb/examples/cmake_simple$ mkdir build - nanopb/examples/cmake_simple$ cd build/ - nanopb/examples/cmake_simple/build$ cmake .. - nanopb/examples/cmake_simple/build$ make - -After that, you can run it with the command: ./simple - -On other platforms supported by CMake, refer to CMake instructions. diff --git a/third_party/nanopb/examples/cmake_simple/simple.c b/third_party/nanopb/examples/cmake_simple/simple.c deleted file mode 100644 index 1f6b137351c..00000000000 --- a/third_party/nanopb/examples/cmake_simple/simple.c +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include -#include "simple.pb.h" - -int main() -{ - /* This is the buffer where we will store our message. */ - uint8_t buffer[128]; - size_t message_length; - bool status; - - /* Encode our message */ - { - /* Allocate space on the stack to store the message data. - * - * Nanopb generates simple struct definitions for all the messages. - * - check out the contents of simple.pb.h! - * It is a good idea to always initialize your structures - * so that you do not have garbage data from RAM in there. - */ - SimpleMessage message = SimpleMessage_init_zero; - - /* Create a stream that will write to our buffer. */ - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - /* Fill in the lucky number */ - message.lucky_number = 13; - - /* Now we are ready to encode the message! */ - status = pb_encode(&stream, SimpleMessage_fields, &message); - message_length = stream.bytes_written; - - /* Then just check for any errors.. */ - if (!status) - { - printf("Encoding failed: %s\n", PB_GET_ERROR(&stream)); - return 1; - } - } - - /* Now we could transmit the message over network, store it in a file or - * wrap it to a pigeon's leg. - */ - - /* But because we are lazy, we will just decode it immediately. */ - - { - /* Allocate space for the decoded message. */ - SimpleMessage message = SimpleMessage_init_zero; - - /* Create a stream that reads from the buffer. */ - pb_istream_t stream = pb_istream_from_buffer(buffer, message_length); - - /* Now we are ready to decode the message. */ - status = pb_decode(&stream, SimpleMessage_fields, &message); - - /* Check for errors... */ - if (!status) - { - printf("Decoding failed: %s\n", PB_GET_ERROR(&stream)); - return 1; - } - - /* Print the data contained in the message. */ - printf("Your lucky number was %d!\n", message.lucky_number); - } - - return 0; -} - diff --git a/third_party/nanopb/examples/cmake_simple/simple.proto b/third_party/nanopb/examples/cmake_simple/simple.proto deleted file mode 100644 index 5c73a3b229e..00000000000 --- a/third_party/nanopb/examples/cmake_simple/simple.proto +++ /dev/null @@ -1,9 +0,0 @@ -// A very simple protocol definition, consisting of only -// one message. - -syntax = "proto2"; - -message SimpleMessage { - required int32 lucky_number = 1; -} - diff --git a/third_party/nanopb/examples/network_server/Makefile b/third_party/nanopb/examples/network_server/Makefile deleted file mode 100644 index 2c7639a15db..00000000000 --- a/third_party/nanopb/examples/network_server/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# Include the nanopb provided Makefile rules -include ../../extra/nanopb.mk - -# Compiler flags to enable all warnings & debug info -CFLAGS = -ansi -Wall -Werror -g -O0 -CFLAGS += -I$(NANOPB_DIR) - -all: server client - -.SUFFIXES: - -clean: - rm -f server client fileproto.pb.c fileproto.pb.h - -%: %.c common.c fileproto.pb.c - $(CC) $(CFLAGS) -o $@ $^ $(NANOPB_CORE) - diff --git a/third_party/nanopb/examples/network_server/README.txt b/third_party/nanopb/examples/network_server/README.txt deleted file mode 100644 index 7bdcbed5db3..00000000000 --- a/third_party/nanopb/examples/network_server/README.txt +++ /dev/null @@ -1,60 +0,0 @@ -Nanopb example "network_server" -=============================== - -This example demonstrates the use of nanopb to communicate over network -connections. It consists of a server that sends file listings, and of -a client that requests the file list from the server. - -Example usage -------------- - -user@host:~/nanopb/examples/network_server$ make # Build the example -protoc -ofileproto.pb fileproto.proto -python ../../generator/nanopb_generator.py fileproto.pb -Writing to fileproto.pb.h and fileproto.pb.c -cc -ansi -Wall -Werror -I .. -g -O0 -I../.. -o server server.c - ../../pb_decode.c ../../pb_encode.c fileproto.pb.c common.c -cc -ansi -Wall -Werror -I .. -g -O0 -I../.. -o client client.c - ../../pb_decode.c ../../pb_encode.c fileproto.pb.c common.c - -user@host:~/nanopb/examples/network_server$ ./server & # Start the server on background -[1] 24462 - -petteri@oddish:~/nanopb/examples/network_server$ ./client /bin # Request the server to list /bin -Got connection. -Listing directory: /bin -1327119 bzdiff -1327126 bzless -1327147 ps -1327178 ntfsmove -1327271 mv -1327187 mount -1327259 false -1327266 tempfile -1327285 zfgrep -1327165 gzexe -1327204 nc.openbsd -1327260 uname - - -Details of implementation -------------------------- -fileproto.proto contains the portable Google Protocol Buffers protocol definition. -It could be used as-is to implement a server or a client in any other language, for -example Python or Java. - -fileproto.options contains the nanopb-specific options for the protocol file. This -sets the amount of space allocated for file names when decoding messages. - -common.c/h contains functions that allow nanopb to read and write directly from -network socket. This way there is no need to allocate a separate buffer to store -the message. - -server.c contains the code to open a listening socket, to respond to clients and -to list directory contents. - -client.c contains the code to connect to a server, to send a request and to print -the response message. - -The code is implemented using the POSIX socket api, but it should be easy enough -to port into any other socket api, such as lwip. diff --git a/third_party/nanopb/examples/network_server/client.c b/third_party/nanopb/examples/network_server/client.c deleted file mode 100644 index 00f6dab855e..00000000000 --- a/third_party/nanopb/examples/network_server/client.c +++ /dev/null @@ -1,142 +0,0 @@ -/* This is a simple TCP client that connects to port 1234 and prints a list - * of files in a given directory. - * - * It directly deserializes and serializes messages from network, minimizing - * memory use. - * - * For flexibility, this example is implemented using posix api. - * In a real embedded system you would typically use some other kind of - * a communication and filesystem layer. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "fileproto.pb.h" -#include "common.h" - -/* This callback function will be called once for each filename received - * from the server. The filenames will be printed out immediately, so that - * no memory has to be allocated for them. - */ -bool printfile_callback(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - FileInfo fileinfo = {}; - - if (!pb_decode(stream, FileInfo_fields, &fileinfo)) - return false; - - printf("%-10lld %s\n", (long long)fileinfo.inode, fileinfo.name); - - return true; -} - -/* This function sends a request to socket 'fd' to list the files in - * directory given in 'path'. The results received from server will - * be printed to stdout. - */ -bool listdir(int fd, char *path) -{ - /* Construct and send the request to server */ - { - ListFilesRequest request = {}; - pb_ostream_t output = pb_ostream_from_socket(fd); - uint8_t zero = 0; - - /* In our protocol, path is optional. If it is not given, - * the server will list the root directory. */ - if (path == NULL) - { - request.has_path = false; - } - else - { - request.has_path = true; - if (strlen(path) + 1 > sizeof(request.path)) - { - fprintf(stderr, "Too long path.\n"); - return false; - } - - strcpy(request.path, path); - } - - /* Encode the request. It is written to the socket immediately - * through our custom stream. */ - if (!pb_encode(&output, ListFilesRequest_fields, &request)) - { - fprintf(stderr, "Encoding failed: %s\n", PB_GET_ERROR(&output)); - return false; - } - - /* We signal the end of request with a 0 tag. */ - pb_write(&output, &zero, 1); - } - - /* Read back the response from server */ - { - ListFilesResponse response = {}; - pb_istream_t input = pb_istream_from_socket(fd); - - /* Give a pointer to our callback function, which will handle the - * filenames as they arrive. */ - response.file.funcs.decode = &printfile_callback; - - if (!pb_decode(&input, ListFilesResponse_fields, &response)) - { - fprintf(stderr, "Decode failed: %s\n", PB_GET_ERROR(&input)); - return false; - } - - /* If the message from server decodes properly, but directory was - * not found on server side, we get path_error == true. */ - if (response.path_error) - { - fprintf(stderr, "Server reported error.\n"); - return false; - } - } - - return true; -} - -int main(int argc, char **argv) -{ - int sockfd; - struct sockaddr_in servaddr; - char *path = NULL; - - if (argc > 1) - path = argv[1]; - - sockfd = socket(AF_INET, SOCK_STREAM, 0); - - /* Connect to server running on localhost:1234 */ - memset(&servaddr, 0, sizeof(servaddr)); - servaddr.sin_family = AF_INET; - servaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - servaddr.sin_port = htons(1234); - - if (connect(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) != 0) - { - perror("connect"); - return 1; - } - - /* Send the directory listing request */ - if (!listdir(sockfd, path)) - return 2; - - /* Close connection */ - close(sockfd); - - return 0; -} diff --git a/third_party/nanopb/examples/network_server/common.c b/third_party/nanopb/examples/network_server/common.c deleted file mode 100644 index 04a5aa85c0b..00000000000 --- a/third_party/nanopb/examples/network_server/common.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Simple binding of nanopb streams to TCP sockets. - */ - -#include -#include -#include -#include - -#include "common.h" - -static bool write_callback(pb_ostream_t *stream, const uint8_t *buf, size_t count) -{ - int fd = (intptr_t)stream->state; - return send(fd, buf, count, 0) == count; -} - -static bool read_callback(pb_istream_t *stream, uint8_t *buf, size_t count) -{ - int fd = (intptr_t)stream->state; - int result; - - result = recv(fd, buf, count, MSG_WAITALL); - - if (result == 0) - stream->bytes_left = 0; /* EOF */ - - return result == count; -} - -pb_ostream_t pb_ostream_from_socket(int fd) -{ - pb_ostream_t stream = {&write_callback, (void*)(intptr_t)fd, SIZE_MAX, 0}; - return stream; -} - -pb_istream_t pb_istream_from_socket(int fd) -{ - pb_istream_t stream = {&read_callback, (void*)(intptr_t)fd, SIZE_MAX}; - return stream; -} diff --git a/third_party/nanopb/examples/network_server/common.h b/third_party/nanopb/examples/network_server/common.h deleted file mode 100644 index 8dab3b7c38c..00000000000 --- a/third_party/nanopb/examples/network_server/common.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _PB_EXAMPLE_COMMON_H_ -#define _PB_EXAMPLE_COMMON_H_ - -#include - -pb_ostream_t pb_ostream_from_socket(int fd); -pb_istream_t pb_istream_from_socket(int fd); - -#endif \ No newline at end of file diff --git a/third_party/nanopb/examples/network_server/fileproto.options b/third_party/nanopb/examples/network_server/fileproto.options deleted file mode 100644 index 29a2ab0e4a5..00000000000 --- a/third_party/nanopb/examples/network_server/fileproto.options +++ /dev/null @@ -1,13 +0,0 @@ -# This file defines the nanopb-specific options for the messages defined -# in fileproto.proto. -# -# If you come from high-level programming background, the hardcoded -# maximum lengths may disgust you. However, if your microcontroller only -# has a few kB of ram to begin with, setting reasonable limits for -# filenames is ok. -# -# On the other hand, using the callback interface, it is not necessary -# to set a limit on the number of files in the response. - -ListFilesRequest.path max_size:128 -FileInfo.name max_size:128 diff --git a/third_party/nanopb/examples/network_server/fileproto.proto b/third_party/nanopb/examples/network_server/fileproto.proto deleted file mode 100644 index 5640b8d5010..00000000000 --- a/third_party/nanopb/examples/network_server/fileproto.proto +++ /dev/null @@ -1,20 +0,0 @@ -// This defines protocol for a simple server that lists files. -// -// See also the nanopb-specific options in fileproto.options. - -syntax = "proto2"; - -message ListFilesRequest { - optional string path = 1 [default = "/"]; -} - -message FileInfo { - required uint64 inode = 1; - required string name = 2; -} - -message ListFilesResponse { - optional bool path_error = 1 [default = false]; - repeated FileInfo file = 2; -} - diff --git a/third_party/nanopb/examples/network_server/server.c b/third_party/nanopb/examples/network_server/server.c deleted file mode 100644 index 46a5f38d1d9..00000000000 --- a/third_party/nanopb/examples/network_server/server.c +++ /dev/null @@ -1,158 +0,0 @@ -/* This is a simple TCP server that listens on port 1234 and provides lists - * of files to clients, using a protocol defined in file_server.proto. - * - * It directly deserializes and serializes messages from network, minimizing - * memory use. - * - * For flexibility, this example is implemented using posix api. - * In a real embedded system you would typically use some other kind of - * a communication and filesystem layer. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "fileproto.pb.h" -#include "common.h" - -/* This callback function will be called once during the encoding. - * It will write out any number of FileInfo entries, without consuming unnecessary memory. - * This is accomplished by fetching the filenames one at a time and encoding them - * immediately. - */ -bool listdir_callback(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - DIR *dir = (DIR*) *arg; - struct dirent *file; - FileInfo fileinfo = {}; - - while ((file = readdir(dir)) != NULL) - { - fileinfo.inode = file->d_ino; - strncpy(fileinfo.name, file->d_name, sizeof(fileinfo.name)); - fileinfo.name[sizeof(fileinfo.name) - 1] = '\0'; - - /* This encodes the header for the field, based on the constant info - * from pb_field_t. */ - if (!pb_encode_tag_for_field(stream, field)) - return false; - - /* This encodes the data for the field, based on our FileInfo structure. */ - if (!pb_encode_submessage(stream, FileInfo_fields, &fileinfo)) - return false; - } - - return true; -} - -/* Handle one arriving client connection. - * Clients are expected to send a ListFilesRequest, terminated by a '0'. - * Server will respond with a ListFilesResponse message. - */ -void handle_connection(int connfd) -{ - DIR *directory = NULL; - - /* Decode the message from the client and open the requested directory. */ - { - ListFilesRequest request = {}; - pb_istream_t input = pb_istream_from_socket(connfd); - - if (!pb_decode(&input, ListFilesRequest_fields, &request)) - { - printf("Decode failed: %s\n", PB_GET_ERROR(&input)); - return; - } - - directory = opendir(request.path); - printf("Listing directory: %s\n", request.path); - } - - /* List the files in the directory and transmit the response to client */ - { - ListFilesResponse response = {}; - pb_ostream_t output = pb_ostream_from_socket(connfd); - - if (directory == NULL) - { - perror("opendir"); - - /* Directory was not found, transmit error status */ - response.has_path_error = true; - response.path_error = true; - response.file.funcs.encode = NULL; - } - else - { - /* Directory was found, transmit filenames */ - response.has_path_error = false; - response.file.funcs.encode = &listdir_callback; - response.file.arg = directory; - } - - if (!pb_encode(&output, ListFilesResponse_fields, &response)) - { - printf("Encoding failed: %s\n", PB_GET_ERROR(&output)); - } - } - - if (directory != NULL) - closedir(directory); -} - -int main(int argc, char **argv) -{ - int listenfd, connfd; - struct sockaddr_in servaddr; - int reuse = 1; - - /* Listen on localhost:1234 for TCP connections */ - listenfd = socket(AF_INET, SOCK_STREAM, 0); - setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)); - - memset(&servaddr, 0, sizeof(servaddr)); - servaddr.sin_family = AF_INET; - servaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - servaddr.sin_port = htons(1234); - if (bind(listenfd, (struct sockaddr*)&servaddr, sizeof(servaddr)) != 0) - { - perror("bind"); - return 1; - } - - if (listen(listenfd, 5) != 0) - { - perror("listen"); - return 1; - } - - for(;;) - { - /* Wait for a client */ - connfd = accept(listenfd, NULL, NULL); - - if (connfd < 0) - { - perror("accept"); - return 1; - } - - printf("Got connection.\n"); - - handle_connection(connfd); - - printf("Closing connection.\n"); - - close(connfd); - } - - return 0; -} diff --git a/third_party/nanopb/examples/simple/Makefile b/third_party/nanopb/examples/simple/Makefile deleted file mode 100644 index 970a865009a..00000000000 --- a/third_party/nanopb/examples/simple/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# Include the nanopb provided Makefile rules -include ../../extra/nanopb.mk - -# Compiler flags to enable all warnings & debug info -CFLAGS = -Wall -Werror -g -O0 -CFLAGS += -I$(NANOPB_DIR) - -# C source code files that are required -CSRC = simple.c # The main program -CSRC += simple.pb.c # The compiled protocol definition -CSRC += $(NANOPB_DIR)/pb_encode.c # The nanopb encoder -CSRC += $(NANOPB_DIR)/pb_decode.c # The nanopb decoder -CSRC += $(NANOPB_DIR)/pb_common.c # The nanopb common parts - -# Build rule for the main program -simple: $(CSRC) - $(CC) $(CFLAGS) -osimple $(CSRC) - -# Build rule for the protocol -simple.pb.c: simple.proto - $(PROTOC) $(PROTOC_OPTS) --nanopb_out=. simple.proto - diff --git a/third_party/nanopb/examples/simple/README.txt b/third_party/nanopb/examples/simple/README.txt deleted file mode 100644 index ee77bfc70c5..00000000000 --- a/third_party/nanopb/examples/simple/README.txt +++ /dev/null @@ -1,29 +0,0 @@ -Nanopb example "simple" -======================= - -This example demonstrates the very basic use of nanopb. It encodes and -decodes a simple message. - -The code uses four different API functions: - - * pb_ostream_from_buffer() to declare the output buffer that is to be used - * pb_encode() to encode a message - * pb_istream_from_buffer() to declare the input buffer that is to be used - * pb_decode() to decode a message - -Example usage -------------- - -On Linux, simply type "make" to build the example. After that, you can -run it with the command: ./simple - -On other platforms, you first have to compile the protocol definition using -the following command:: - - ../../generator-bin/protoc --nanopb_out=. simple.proto - -After that, add the following four files to your project and compile: - - simple.c simple.pb.c pb_encode.c pb_decode.c - - diff --git a/third_party/nanopb/examples/simple/simple.c b/third_party/nanopb/examples/simple/simple.c deleted file mode 100644 index 1f6b137351c..00000000000 --- a/third_party/nanopb/examples/simple/simple.c +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include -#include "simple.pb.h" - -int main() -{ - /* This is the buffer where we will store our message. */ - uint8_t buffer[128]; - size_t message_length; - bool status; - - /* Encode our message */ - { - /* Allocate space on the stack to store the message data. - * - * Nanopb generates simple struct definitions for all the messages. - * - check out the contents of simple.pb.h! - * It is a good idea to always initialize your structures - * so that you do not have garbage data from RAM in there. - */ - SimpleMessage message = SimpleMessage_init_zero; - - /* Create a stream that will write to our buffer. */ - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - /* Fill in the lucky number */ - message.lucky_number = 13; - - /* Now we are ready to encode the message! */ - status = pb_encode(&stream, SimpleMessage_fields, &message); - message_length = stream.bytes_written; - - /* Then just check for any errors.. */ - if (!status) - { - printf("Encoding failed: %s\n", PB_GET_ERROR(&stream)); - return 1; - } - } - - /* Now we could transmit the message over network, store it in a file or - * wrap it to a pigeon's leg. - */ - - /* But because we are lazy, we will just decode it immediately. */ - - { - /* Allocate space for the decoded message. */ - SimpleMessage message = SimpleMessage_init_zero; - - /* Create a stream that reads from the buffer. */ - pb_istream_t stream = pb_istream_from_buffer(buffer, message_length); - - /* Now we are ready to decode the message. */ - status = pb_decode(&stream, SimpleMessage_fields, &message); - - /* Check for errors... */ - if (!status) - { - printf("Decoding failed: %s\n", PB_GET_ERROR(&stream)); - return 1; - } - - /* Print the data contained in the message. */ - printf("Your lucky number was %d!\n", message.lucky_number); - } - - return 0; -} - diff --git a/third_party/nanopb/examples/simple/simple.proto b/third_party/nanopb/examples/simple/simple.proto deleted file mode 100644 index 5c73a3b229e..00000000000 --- a/third_party/nanopb/examples/simple/simple.proto +++ /dev/null @@ -1,9 +0,0 @@ -// A very simple protocol definition, consisting of only -// one message. - -syntax = "proto2"; - -message SimpleMessage { - required int32 lucky_number = 1; -} - diff --git a/third_party/nanopb/examples/using_double_on_avr/Makefile b/third_party/nanopb/examples/using_double_on_avr/Makefile deleted file mode 100644 index 874a64bdc98..00000000000 --- a/third_party/nanopb/examples/using_double_on_avr/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# Include the nanopb provided Makefile rules -include ../../extra/nanopb.mk - -# Compiler flags to enable all warnings & debug info -CFLAGS = -Wall -Werror -g -O0 -CFLAGS += -I$(NANOPB_DIR) - -all: run_tests - -.SUFFIXES: - -clean: - rm -f test_conversions encode_double decode_double doubleproto.pb.c doubleproto.pb.h - -test_conversions: test_conversions.c double_conversion.c - $(CC) $(CFLAGS) -o $@ $^ - -%: %.c double_conversion.c doubleproto.pb.c - $(CC) $(CFLAGS) -o $@ $^ $(NANOPB_CORE) - -run_tests: test_conversions encode_double decode_double - ./test_conversions - ./encode_double | ./decode_double - diff --git a/third_party/nanopb/examples/using_double_on_avr/README.txt b/third_party/nanopb/examples/using_double_on_avr/README.txt deleted file mode 100644 index d9fcdfc66d7..00000000000 --- a/third_party/nanopb/examples/using_double_on_avr/README.txt +++ /dev/null @@ -1,25 +0,0 @@ -Nanopb example "using_double_on_avr" -==================================== - -Some processors/compilers, such as AVR-GCC, do not support the double -datatype. Instead, they have sizeof(double) == 4. Because protocol -binary format uses the double encoding directly, this causes trouble -if the protocol in .proto requires double fields. - -This directory contains a solution to this problem. It uses uint64_t -to store the raw wire values, because its size is correct on all -platforms. The file double_conversion.c provides functions that -convert these values to/from floats, without relying on compiler -support. - -To use this method, you need to make some modifications to your code: - -1) Change all 'double' fields into 'fixed64' in the .proto. - -2) Whenever writing to a 'double' field, use float_to_double(). - -3) Whenever reading a 'double' field, use double_to_float(). - -The conversion routines are as accurate as the float datatype can -be. Furthermore, they should handle all special values (NaN, inf, denormalized -numbers) correctly. There are testcases in test_conversions.c. diff --git a/third_party/nanopb/examples/using_double_on_avr/decode_double.c b/third_party/nanopb/examples/using_double_on_avr/decode_double.c deleted file mode 100644 index 5802eca79e9..00000000000 --- a/third_party/nanopb/examples/using_double_on_avr/decode_double.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Decodes a double value into a float variable. - * Used to read double values with AVR code, which doesn't support double directly. - */ - -#include -#include -#include "double_conversion.h" -#include "doubleproto.pb.h" - -int main() -{ - uint8_t buffer[32]; - size_t count = fread(buffer, 1, sizeof(buffer), stdin); - pb_istream_t stream = pb_istream_from_buffer(buffer, count); - - AVRDoubleMessage message; - pb_decode(&stream, AVRDoubleMessage_fields, &message); - - float v1 = double_to_float(message.field1); - float v2 = double_to_float(message.field2); - - printf("Values: %f %f\n", v1, v2); - - if (v1 == 1234.5678f && - v2 == 0.00001f) - { - return 0; - } - else - { - return 1; - } -} diff --git a/third_party/nanopb/examples/using_double_on_avr/double_conversion.c b/third_party/nanopb/examples/using_double_on_avr/double_conversion.c deleted file mode 100644 index cf79b9a00da..00000000000 --- a/third_party/nanopb/examples/using_double_on_avr/double_conversion.c +++ /dev/null @@ -1,123 +0,0 @@ -/* Conversion routines for platforms that do not support 'double' directly. */ - -#include "double_conversion.h" -#include - -typedef union { - float f; - uint32_t i; -} conversion_t; - -/* Note: IEE 754 standard specifies float formats as follows: - * Single precision: sign, 8-bit exp, 23-bit frac. - * Double precision: sign, 11-bit exp, 52-bit frac. - */ - -uint64_t float_to_double(float value) -{ - conversion_t in; - in.f = value; - uint8_t sign; - int16_t exponent; - uint64_t mantissa; - - /* Decompose input value */ - sign = (in.i >> 31) & 1; - exponent = ((in.i >> 23) & 0xFF) - 127; - mantissa = in.i & 0x7FFFFF; - - if (exponent == 128) - { - /* Special value (NaN etc.) */ - exponent = 1024; - } - else if (exponent == -127) - { - if (!mantissa) - { - /* Zero */ - exponent = -1023; - } - else - { - /* Denormalized */ - mantissa <<= 1; - while (!(mantissa & 0x800000)) - { - mantissa <<= 1; - exponent--; - } - mantissa &= 0x7FFFFF; - } - } - - /* Combine fields */ - mantissa <<= 29; - mantissa |= (uint64_t)(exponent + 1023) << 52; - mantissa |= (uint64_t)sign << 63; - - return mantissa; -} - -float double_to_float(uint64_t value) -{ - uint8_t sign; - int16_t exponent; - uint32_t mantissa; - conversion_t out; - - /* Decompose input value */ - sign = (value >> 63) & 1; - exponent = ((value >> 52) & 0x7FF) - 1023; - mantissa = (value >> 28) & 0xFFFFFF; /* Highest 24 bits */ - - /* Figure if value is in range representable by floats. */ - if (exponent == 1024) - { - /* Special value */ - exponent = 128; - } - else if (exponent > 127) - { - /* Too large */ - if (sign) - return -INFINITY; - else - return INFINITY; - } - else if (exponent < -150) - { - /* Too small */ - if (sign) - return -0.0f; - else - return 0.0f; - } - else if (exponent < -126) - { - /* Denormalized */ - mantissa |= 0x1000000; - mantissa >>= (-126 - exponent); - exponent = -127; - } - - /* Round off mantissa */ - mantissa = (mantissa + 1) >> 1; - - /* Check if mantissa went over 2.0 */ - if (mantissa & 0x800000) - { - exponent += 1; - mantissa &= 0x7FFFFF; - mantissa >>= 1; - } - - /* Combine fields */ - out.i = mantissa; - out.i |= (uint32_t)(exponent + 127) << 23; - out.i |= (uint32_t)sign << 31; - - return out.f; -} - - diff --git a/third_party/nanopb/examples/using_double_on_avr/double_conversion.h b/third_party/nanopb/examples/using_double_on_avr/double_conversion.h deleted file mode 100644 index 62b6a8ae8d3..00000000000 --- a/third_party/nanopb/examples/using_double_on_avr/double_conversion.h +++ /dev/null @@ -1,26 +0,0 @@ -/* AVR-GCC does not have real double datatype. Instead its double - * is equal to float, i.e. 32 bit value. If you need to communicate - * with other systems that use double in their .proto files, you - * need to do some conversion. - * - * These functions use bitwise operations to mangle floats into doubles - * and then store them in uint64_t datatype. - */ - -#ifndef DOUBLE_CONVERSION -#define DOUBLE_CONVERSION - -#include - -/* Convert native 4-byte float into a 8-byte double. */ -extern uint64_t float_to_double(float value); - -/* Convert 8-byte double into native 4-byte float. - * Values are rounded to nearest, 0.5 away from zero. - * Overflowing values are converted to Inf or -Inf. - */ -extern float double_to_float(uint64_t value); - - -#endif - diff --git a/third_party/nanopb/examples/using_double_on_avr/doubleproto.proto b/third_party/nanopb/examples/using_double_on_avr/doubleproto.proto deleted file mode 100644 index 72d3f9c127f..00000000000 --- a/third_party/nanopb/examples/using_double_on_avr/doubleproto.proto +++ /dev/null @@ -1,15 +0,0 @@ -// A message containing doubles, as used by other applications. -syntax = "proto2"; - -message DoubleMessage { - required double field1 = 1; - required double field2 = 2; -} - -// A message containing doubles, but redefined using uint64_t. -// For use in AVR code. -message AVRDoubleMessage { - required fixed64 field1 = 1; - required fixed64 field2 = 2; -} - diff --git a/third_party/nanopb/examples/using_double_on_avr/encode_double.c b/third_party/nanopb/examples/using_double_on_avr/encode_double.c deleted file mode 100644 index cd532d4659c..00000000000 --- a/third_party/nanopb/examples/using_double_on_avr/encode_double.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Encodes a float value into a double on the wire. - * Used to emit doubles from AVR code, which doesn't support double directly. - */ - -#include -#include -#include "double_conversion.h" -#include "doubleproto.pb.h" - -int main() -{ - AVRDoubleMessage message = { - float_to_double(1234.5678f), - float_to_double(0.00001f) - }; - - uint8_t buffer[32]; - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - pb_encode(&stream, AVRDoubleMessage_fields, &message); - fwrite(buffer, 1, stream.bytes_written, stdout); - - return 0; -} - diff --git a/third_party/nanopb/examples/using_double_on_avr/test_conversions.c b/third_party/nanopb/examples/using_double_on_avr/test_conversions.c deleted file mode 100644 index 22620a6ae94..00000000000 --- a/third_party/nanopb/examples/using_double_on_avr/test_conversions.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "double_conversion.h" -#include -#include - -static const double testvalues[] = { - 0.0, -0.0, 0.1, -0.1, - M_PI, -M_PI, 123456.789, -123456.789, - INFINITY, -INFINITY, NAN, INFINITY - INFINITY, - 1e38, -1e38, 1e39, -1e39, - 1e-38, -1e-38, 1e-39, -1e-39, - 3.14159e-37,-3.14159e-37, 3.14159e-43, -3.14159e-43, - 1e-60, -1e-60, 1e-45, -1e-45, - 0.99999999999999, -0.99999999999999, 127.999999999999, -127.999999999999 -}; - -#define TESTVALUES_COUNT (sizeof(testvalues)/sizeof(testvalues[0])) - -int main() -{ - int status = 0; - int i; - for (i = 0; i < TESTVALUES_COUNT; i++) - { - double orig = testvalues[i]; - float expected_float = (float)orig; - double expected_double = (double)expected_float; - - float got_float = double_to_float(*(uint64_t*)&orig); - uint64_t got_double = float_to_double(got_float); - - uint32_t e1 = *(uint32_t*)&expected_float; - uint32_t g1 = *(uint32_t*)&got_float; - uint64_t e2 = *(uint64_t*)&expected_double; - uint64_t g2 = got_double; - - if (g1 != e1) - { - printf("%3d double_to_float fail: %08x != %08x\n", i, g1, e1); - status = 1; - } - - if (g2 != e2) - { - printf("%3d float_to_double fail: %016llx != %016llx\n", i, - (unsigned long long)g2, - (unsigned long long)e2); - status = 1; - } - } - - return status; -} - - - - diff --git a/third_party/nanopb/examples/using_union_messages/Makefile b/third_party/nanopb/examples/using_union_messages/Makefile deleted file mode 100644 index 66396a02eea..00000000000 --- a/third_party/nanopb/examples/using_union_messages/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Include the nanopb provided Makefile rules -include ../../extra/nanopb.mk - -# Compiler flags to enable all warnings & debug info -CFLAGS = -ansi -Wall -Werror -g -O0 -CFLAGS += -I$(NANOPB_DIR) - -all: encode decode - ./encode 1 | ./decode - ./encode 2 | ./decode - ./encode 3 | ./decode - -.SUFFIXES: - -clean: - rm -f encode unionproto.pb.h unionproto.pb.c - -%: %.c unionproto.pb.c - $(CC) $(CFLAGS) -o $@ $^ $(NANOPB_CORE) - diff --git a/third_party/nanopb/examples/using_union_messages/README.txt b/third_party/nanopb/examples/using_union_messages/README.txt deleted file mode 100644 index 7a1e75d4116..00000000000 --- a/third_party/nanopb/examples/using_union_messages/README.txt +++ /dev/null @@ -1,52 +0,0 @@ -Nanopb example "using_union_messages" -===================================== - -Union messages is a common technique in Google Protocol Buffers used to -represent a group of messages, only one of which is passed at a time. -It is described in Google's documentation: -https://developers.google.com/protocol-buffers/docs/techniques#union - -This directory contains an example on how to encode and decode union messages -with minimal memory usage. Usually, nanopb would allocate space to store -all of the possible messages at the same time, even though at most one of -them will be used at a time. - -By using some of the lower level nanopb APIs, we can manually generate the -top level message, so that we only need to allocate the one submessage that -we actually want. Similarly when decoding, we can manually read the tag of -the top level message, and only then allocate the memory for the submessage -after we already know its type. - - -Example usage -------------- - -Type `make` to run the example. It will build it and run commands like -following: - -./encode 1 | ./decode -Got MsgType1: 42 -./encode 2 | ./decode -Got MsgType2: true -./encode 3 | ./decode -Got MsgType3: 3 1415 - -This simply demonstrates that the "decode" program has correctly identified -the type of the received message, and managed to decode it. - - -Details of implementation -------------------------- - -unionproto.proto contains the protocol used in the example. It consists of -three messages: MsgType1, MsgType2 and MsgType3, which are collected together -into UnionMessage. - -encode.c takes one command line argument, which should be a number 1-3. It -then fills in and encodes the corresponding message, and writes it to stdout. - -decode.c reads a UnionMessage from stdin. Then it calls the function -decode_unionmessage_type() to determine the type of the message. After that, -the corresponding message is decoded and the contents of it printed to the -screen. - diff --git a/third_party/nanopb/examples/using_union_messages/decode.c b/third_party/nanopb/examples/using_union_messages/decode.c deleted file mode 100644 index b9f4af55c50..00000000000 --- a/third_party/nanopb/examples/using_union_messages/decode.c +++ /dev/null @@ -1,96 +0,0 @@ -/* This program reads a message from stdin, detects its type and decodes it. - */ - -#include -#include -#include - -#include -#include "unionproto.pb.h" - -/* This function reads manually the first tag from the stream and finds the - * corresponding message type. It doesn't yet decode the actual message. - * - * Returns a pointer to the MsgType_fields array, as an identifier for the - * message type. Returns null if the tag is of unknown type or an error occurs. - */ -const pb_field_t* decode_unionmessage_type(pb_istream_t *stream) -{ - pb_wire_type_t wire_type; - uint32_t tag; - bool eof; - - while (pb_decode_tag(stream, &wire_type, &tag, &eof)) - { - if (wire_type == PB_WT_STRING) - { - const pb_field_t *field; - for (field = UnionMessage_fields; field->tag != 0; field++) - { - if (field->tag == tag && (field->type & PB_LTYPE_SUBMESSAGE)) - { - /* Found our field. */ - return field->ptr; - } - } - } - - /* Wasn't our field.. */ - pb_skip_field(stream, wire_type); - } - - return NULL; -} - -bool decode_unionmessage_contents(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct) -{ - pb_istream_t substream; - bool status; - if (!pb_make_string_substream(stream, &substream)) - return false; - - status = pb_decode(&substream, fields, dest_struct); - pb_close_string_substream(stream, &substream); - return status; -} - -int main() -{ - /* Read the data into buffer */ - uint8_t buffer[512]; - size_t count = fread(buffer, 1, sizeof(buffer), stdin); - pb_istream_t stream = pb_istream_from_buffer(buffer, count); - - const pb_field_t *type = decode_unionmessage_type(&stream); - bool status = false; - - if (type == MsgType1_fields) - { - MsgType1 msg = {}; - status = decode_unionmessage_contents(&stream, MsgType1_fields, &msg); - printf("Got MsgType1: %d\n", msg.value); - } - else if (type == MsgType2_fields) - { - MsgType2 msg = {}; - status = decode_unionmessage_contents(&stream, MsgType2_fields, &msg); - printf("Got MsgType2: %s\n", msg.value ? "true" : "false"); - } - else if (type == MsgType3_fields) - { - MsgType3 msg = {}; - status = decode_unionmessage_contents(&stream, MsgType3_fields, &msg); - printf("Got MsgType3: %d %d\n", msg.value1, msg.value2); - } - - if (!status) - { - printf("Decode failed: %s\n", PB_GET_ERROR(&stream)); - return 1; - } - - return 0; -} - - - diff --git a/third_party/nanopb/examples/using_union_messages/encode.c b/third_party/nanopb/examples/using_union_messages/encode.c deleted file mode 100644 index e124bf91fa3..00000000000 --- a/third_party/nanopb/examples/using_union_messages/encode.c +++ /dev/null @@ -1,85 +0,0 @@ -/* This program takes a command line argument and encodes a message in - * one of MsgType1, MsgType2 or MsgType3. - */ - -#include -#include -#include - -#include -#include "unionproto.pb.h" - -/* This function is the core of the union encoding process. It handles - * the top-level pb_field_t array manually, in order to encode a correct - * field tag before the message. The pointer to MsgType_fields array is - * used as an unique identifier for the message type. - */ -bool encode_unionmessage(pb_ostream_t *stream, const pb_field_t messagetype[], const void *message) -{ - const pb_field_t *field; - for (field = UnionMessage_fields; field->tag != 0; field++) - { - if (field->ptr == messagetype) - { - /* This is our field, encode the message using it. */ - if (!pb_encode_tag_for_field(stream, field)) - return false; - - return pb_encode_submessage(stream, messagetype, message); - } - } - - /* Didn't find the field for messagetype */ - return false; -} - -int main(int argc, char **argv) -{ - if (argc != 2) - { - fprintf(stderr, "Usage: %s (1|2|3)\n", argv[0]); - return 1; - } - - uint8_t buffer[512]; - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - bool status = false; - int msgtype = atoi(argv[1]); - if (msgtype == 1) - { - /* Send message of type 1 */ - MsgType1 msg = {42}; - status = encode_unionmessage(&stream, MsgType1_fields, &msg); - } - else if (msgtype == 2) - { - /* Send message of type 2 */ - MsgType2 msg = {true}; - status = encode_unionmessage(&stream, MsgType2_fields, &msg); - } - else if (msgtype == 3) - { - /* Send message of type 3 */ - MsgType3 msg = {3, 1415}; - status = encode_unionmessage(&stream, MsgType3_fields, &msg); - } - else - { - fprintf(stderr, "Unknown message type: %d\n", msgtype); - return 2; - } - - if (!status) - { - fprintf(stderr, "Encoding failed!\n"); - return 3; - } - else - { - fwrite(buffer, 1, stream.bytes_written, stdout); - return 0; /* Success */ - } -} - - diff --git a/third_party/nanopb/examples/using_union_messages/unionproto.proto b/third_party/nanopb/examples/using_union_messages/unionproto.proto deleted file mode 100644 index 209df0d27a0..00000000000 --- a/third_party/nanopb/examples/using_union_messages/unionproto.proto +++ /dev/null @@ -1,32 +0,0 @@ -// This is an example of how to handle 'union' style messages -// with nanopb, without allocating memory for all the message types. -// -// There is no official type in Protocol Buffers for describing unions, -// but they are commonly implemented by filling out exactly one of -// several optional fields. - -syntax = "proto2"; - -message MsgType1 -{ - required int32 value = 1; -} - -message MsgType2 -{ - required bool value = 1; -} - -message MsgType3 -{ - required int32 value1 = 1; - required int32 value2 = 2; -} - -message UnionMessage -{ - optional MsgType1 msg1 = 1; - optional MsgType2 msg2 = 2; - optional MsgType3 msg3 = 3; -} - diff --git a/third_party/nanopb/extra/FindNanopb.cmake b/third_party/nanopb/extra/FindNanopb.cmake deleted file mode 100644 index 9afb21d0b1f..00000000000 --- a/third_party/nanopb/extra/FindNanopb.cmake +++ /dev/null @@ -1,274 +0,0 @@ -# This is an example script for use with CMake projects for locating and configuring -# the nanopb library. -# -# The following variables can be set and are optional: -# -# -# PROTOBUF_SRC_ROOT_FOLDER - When compiling with MSVC, if this cache variable is set -# the protobuf-default VS project build locations -# (vsprojects/Debug & vsprojects/Release) will be searched -# for libraries and binaries. -# -# NANOPB_IMPORT_DIRS - List of additional directories to be searched for -# imported .proto files. -# -# NANOPB_GENERATE_CPP_APPEND_PATH - By default -I will be passed to protoc -# for each directory where a proto file is referenced. -# Set to FALSE if you want to disable this behaviour. -# -# Defines the following variables: -# -# NANOPB_FOUND - Found the nanopb library (source&header files, generator tool, protoc compiler tool) -# NANOPB_INCLUDE_DIRS - Include directories for Google Protocol Buffers -# -# The following cache variables are also available to set or use: -# PROTOBUF_PROTOC_EXECUTABLE - The protoc compiler -# NANOPB_GENERATOR_SOURCE_DIR - The nanopb generator source -# -# ==================================================================== -# -# NANOPB_GENERATE_CPP (public function) -# SRCS = Variable to define with autogenerated -# source files -# HDRS = Variable to define with autogenerated -# header files -# ARGN = proto files -# -# ==================================================================== -# Example: -# -# set(NANOPB_SRC_ROOT_FOLDER "/path/to/nanopb") -# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${NANOPB_SRC_ROOT_FOLDER}/cmake) -# find_package( Nanopb REQUIRED ) -# include_directories(${NANOPB_INCLUDE_DIRS}) -# -# NANOPB_GENERATE_CPP(PROTO_SRCS PROTO_HDRS foo.proto) -# -# include_directories(${CMAKE_CURRENT_BINARY_DIR}) -# add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS}) -# -# ==================================================================== - -#============================================================================= -# Copyright 2009 Kitware, Inc. -# Copyright 2009-2011 Philip Lowman -# Copyright 2008 Esben Mose Hansen, Ange Optimization ApS -# -# 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 names of Kitware, Inc., the Insight Software Consortium, -# nor the names of their 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 -# HOLDER 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. -# -#============================================================================= -# -# Changes -# 2013.01.31 - Pavlo Ilin - used Modules/FindProtobuf.cmake from cmake 2.8.10 to -# write FindNanopb.cmake -# -#============================================================================= - - -function(NANOPB_GENERATE_CPP SRCS HDRS) - if(NOT ARGN) - return() - endif() - - if(NANOPB_GENERATE_CPP_APPEND_PATH) - # Create an include path for each file specified - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(ABS_PATH ${ABS_FIL} PATH) - - list(FIND _nanobp_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _nanobp_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() - set(_nanobp_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) - endif() - - if(DEFINED NANOPB_IMPORT_DIRS) - foreach(DIR ${NANOPB_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _nanobp_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _nanobp_include_path -I ${ABS_PATH}) - endif() - endforeach() - endif() - - set(${SRCS}) - set(${HDRS}) - - set(GENERATOR_PATH ${CMAKE_BINARY_DIR}/nanopb/generator) - - set(NANOPB_GENERATOR_EXECUTABLE ${GENERATOR_PATH}/nanopb_generator.py) - - set(GENERATOR_CORE_DIR ${GENERATOR_PATH}/proto) - set(GENERATOR_CORE_SRC - ${GENERATOR_CORE_DIR}/nanopb.proto - ${GENERATOR_CORE_DIR}/plugin.proto) - - # Treat the source diretory as immutable. - # - # Copy the generator directory to the build directory before - # compiling python and proto files. Fixes issues when using the - # same build directory with different python/protobuf versions - # as the binary build directory is discarded across builds. - # - add_custom_command( - OUTPUT ${NANOPB_GENERATOR_EXECUTABLE} ${GENERATOR_CORE_SRC} - COMMAND ${CMAKE_COMMAND} -E copy_directory - ARGS ${NANOPB_GENERATOR_SOURCE_DIR} ${GENERATOR_PATH} - VERBATIM) - - set(GENERATOR_CORE_PYTHON_SRC) - foreach(FIL ${GENERATOR_CORE_SRC}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - - set(output "${GENERATOR_CORE_DIR}/${FIL_WE}_pb2.py") - set(GENERATOR_CORE_PYTHON_SRC ${GENERATOR_CORE_PYTHON_SRC} ${output}) - add_custom_command( - OUTPUT ${output} - COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} - ARGS -I${GENERATOR_PATH}/proto - --python_out=${GENERATOR_CORE_DIR} ${ABS_FIL} - DEPENDS ${ABS_FIL} - VERBATIM) - endforeach() - - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - get_filename_component(FIL_DIR ${FIL} PATH) - set(NANOPB_OPTIONS_FILE ${FIL_DIR}/${FIL_WE}.options) - set(NANOPB_OPTIONS) - if(EXISTS ${NANOPB_OPTIONS_FILE}) - set(NANOPB_OPTIONS -f ${NANOPB_OPTIONS_FILE}) - endif() - - list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.c") - list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h") - - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb" - COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} - ARGS -I${GENERATOR_PATH} -I${GENERATOR_CORE_DIR} - -I${CMAKE_CURRENT_BINARY_DIR} ${_nanobp_include_path} - -o${FIL_WE}.pb ${ABS_FIL} - DEPENDS ${ABS_FIL} ${GENERATOR_CORE_PYTHON_SRC} - COMMENT "Running C++ protocol buffer compiler on ${FIL}" - VERBATIM ) - - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.c" - "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h" - COMMAND ${PYTHON_EXECUTABLE} - ARGS ${NANOPB_GENERATOR_EXECUTABLE} ${FIL_WE}.pb ${NANOPB_OPTIONS} - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb" - COMMENT "Running nanopb generator on ${FIL_WE}.pb" - VERBATIM ) - endforeach() - - set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) - set(${SRCS} ${${SRCS}} ${NANOPB_SRCS} PARENT_SCOPE) - set(${HDRS} ${${HDRS}} ${NANOPB_HDRS} PARENT_SCOPE) - -endfunction() - - - -# -# Main. -# - -# By default have NANOPB_GENERATE_CPP macro pass -I to protoc -# for each directory where a proto file is referenced. -if(NOT DEFINED NANOPB_GENERATE_CPP_APPEND_PATH) - set(NANOPB_GENERATE_CPP_APPEND_PATH TRUE) -endif() - -# Make a really good guess regarding location of NANOPB_SRC_ROOT_FOLDER -if(NOT DEFINED NANOPB_SRC_ROOT_FOLDER) - get_filename_component(NANOPB_SRC_ROOT_FOLDER - ${CMAKE_CURRENT_LIST_DIR}/.. ABSOLUTE) -endif() - -# Find the include directory -find_path(NANOPB_INCLUDE_DIRS - pb.h - PATHS ${NANOPB_SRC_ROOT_FOLDER} -) -mark_as_advanced(NANOPB_INCLUDE_DIRS) - -# Find nanopb source files -set(NANOPB_SRCS) -set(NANOPB_HDRS) -list(APPEND _nanopb_srcs pb_decode.c pb_encode.c pb_common.c) -list(APPEND _nanopb_hdrs pb_decode.h pb_encode.h pb_common.h pb.h) - -foreach(FIL ${_nanopb_srcs}) - find_file(${FIL}__nano_pb_file NAMES ${FIL} PATHS ${NANOPB_SRC_ROOT_FOLDER} ${NANOPB_INCLUDE_DIRS}) - list(APPEND NANOPB_SRCS "${${FIL}__nano_pb_file}") - mark_as_advanced(${FIL}__nano_pb_file) -endforeach() - -foreach(FIL ${_nanopb_hdrs}) - find_file(${FIL}__nano_pb_file NAMES ${FIL} PATHS ${NANOPB_INCLUDE_DIRS}) - mark_as_advanced(${FIL}__nano_pb_file) - list(APPEND NANOPB_HDRS "${${FIL}__nano_pb_file}") -endforeach() - -# Find the protoc Executable -find_program(PROTOBUF_PROTOC_EXECUTABLE - NAMES protoc - DOC "The Google Protocol Buffers Compiler" - PATHS - ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Release - ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Debug -) -mark_as_advanced(PROTOBUF_PROTOC_EXECUTABLE) - -# Find nanopb generator source dir -find_path(NANOPB_GENERATOR_SOURCE_DIR - NAMES nanopb_generator.py - DOC "nanopb generator source" - PATHS - ${NANOPB_SRC_ROOT_FOLDER}/generator -) -mark_as_advanced(NANOPB_GENERATOR_SOURCE_DIR) - -find_package(PythonInterp REQUIRED) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(NANOPB DEFAULT_MSG - NANOPB_INCLUDE_DIRS - NANOPB_SRCS NANOPB_HDRS - NANOPB_GENERATOR_SOURCE_DIR - PROTOBUF_PROTOC_EXECUTABLE - ) diff --git a/third_party/nanopb/extra/nanopb.mk b/third_party/nanopb/extra/nanopb.mk deleted file mode 100644 index 5c2cff560c5..00000000000 --- a/third_party/nanopb/extra/nanopb.mk +++ /dev/null @@ -1,37 +0,0 @@ -# This is an include file for Makefiles. It provides rules for building -# .pb.c and .pb.h files out of .proto, as well the path to nanopb core. - -# Path to the nanopb root directory -NANOPB_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))../) - -# Files for the nanopb core -NANOPB_CORE = $(NANOPB_DIR)/pb_encode.c $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_common.c - -# Check if we are running on Windows -ifdef windir -WINDOWS = 1 -endif -ifdef WINDIR -WINDOWS = 1 -endif - -# Check whether to use binary version of nanopb_generator or the -# system-supplied python interpreter. -ifneq "$(wildcard $(NANOPB_DIR)/generator-bin)" "" - # Binary package - PROTOC = $(NANOPB_DIR)/generator-bin/protoc - PROTOC_OPTS = -else - # Source only or git checkout - PROTOC = protoc - ifdef WINDOWS - PROTOC_OPTS = --plugin=protoc-gen-nanopb=$(NANOPB_DIR)/generator/protoc-gen-nanopb.bat - else - PROTOC_OPTS = --plugin=protoc-gen-nanopb=$(NANOPB_DIR)/generator/protoc-gen-nanopb - endif -endif - -# Rule for building .pb.c and .pb.h -%.pb.c %.pb.h: %.proto $(wildcard %.options) - $(PROTOC) $(PROTOC_OPTS) --nanopb_out=. $< - diff --git a/third_party/nanopb/extra/pb_syshdr.h b/third_party/nanopb/extra/pb_syshdr.h deleted file mode 100644 index 55d06a3acc0..00000000000 --- a/third_party/nanopb/extra/pb_syshdr.h +++ /dev/null @@ -1,112 +0,0 @@ -/* This is an example of a header file for platforms/compilers that do - * not come with stdint.h/stddef.h/stdbool.h/string.h. To use it, define - * PB_SYSTEM_HEADER as "pb_syshdr.h", including the quotes, and add the - * extra folder to your include path. - * - * It is very likely that you will need to customize this file to suit - * your platform. For any compiler that supports C99, this file should - * not be necessary. - */ - -#ifndef _PB_SYSHDR_H_ -#define _PB_SYSHDR_H_ - -/* stdint.h subset */ -#ifdef HAVE_STDINT_H -#include -#else -/* You will need to modify these to match the word size of your platform. */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; - -/* These are ok for most platforms, unless uint8_t is actually not available, - * in which case you should give the smallest available type. */ -typedef int8_t int_least8_t; -typedef uint8_t uint_least8_t; -typedef uint8_t uint_fast8_t; -typedef int16_t int_least16_t; -typedef uint16_t uint_least16_t; -#endif - -/* stddef.h subset */ -#ifdef HAVE_STDDEF_H -#include -#else - -typedef uint32_t size_t; -#define offsetof(st, m) ((size_t)(&((st *)0)->m)) - -#ifndef NULL -#define NULL 0 -#endif - -#endif - -/* stdbool.h subset */ -#ifdef HAVE_STDBOOL_H -#include -#else - -#ifndef __cplusplus -typedef int bool; -#define false 0 -#define true 1 -#endif - -#endif - -/* stdlib.h subset */ -#ifdef PB_ENABLE_MALLOC -#ifdef HAVE_STDLIB_H -#include -#else -void *realloc(void *ptr, size_t size); -void free(void *ptr); -#endif -#endif - -/* string.h subset */ -#ifdef HAVE_STRING_H -#include -#else - -/* Implementations are from the Public Domain C Library (PDCLib). */ -static size_t strlen( const char * s ) -{ - size_t rc = 0; - while ( s[rc] ) - { - ++rc; - } - return rc; -} - -static void * memcpy( void *s1, const void *s2, size_t n ) -{ - char * dest = (char *) s1; - const char * src = (const char *) s2; - while ( n-- ) - { - *dest++ = *src++; - } - return s1; -} - -static void * memset( void * s, int c, size_t n ) -{ - unsigned char * p = (unsigned char *) s; - while ( n-- ) - { - *p++ = (unsigned char) c; - } - return s; -} -#endif - -#endif diff --git a/third_party/nanopb/generator/nanopb_generator.py b/third_party/nanopb/generator/nanopb_generator.py deleted file mode 100755 index 973c7610fbe..00000000000 --- a/third_party/nanopb/generator/nanopb_generator.py +++ /dev/null @@ -1,1602 +0,0 @@ -#!/usr/bin/env python - -from __future__ import unicode_literals - -'''Generate header file for nanopb from a ProtoBuf FileDescriptorSet.''' -nanopb_version = "nanopb-0.3.7-dev" - -import sys -import re -from functools import reduce - -try: - # Add some dummy imports to keep packaging tools happy. - import google, distutils.util # bbfreeze seems to need these - import pkg_resources # pyinstaller / protobuf 2.5 seem to need these -except: - # Don't care, we will error out later if it is actually important. - pass - -try: - import google.protobuf.text_format as text_format - import google.protobuf.descriptor_pb2 as descriptor -except: - sys.stderr.write(''' - ************************************************************* - *** Could not import the Google protobuf Python libraries *** - *** Try installing package 'python-protobuf' or similar. *** - ************************************************************* - ''' + '\n') - raise - -try: - import proto.nanopb_pb2 as nanopb_pb2 - import proto.plugin_pb2 as plugin_pb2 -except: - sys.stderr.write(''' - ******************************************************************** - *** Failed to import the protocol definitions for generator. *** - *** You have to run 'make' in the nanopb/generator/proto folder. *** - ******************************************************************** - ''' + '\n') - raise - -# --------------------------------------------------------------------------- -# Generation of single fields -# --------------------------------------------------------------------------- - -import time -import os.path - -# Values are tuple (c type, pb type, encoded size, int_size_allowed) -FieldD = descriptor.FieldDescriptorProto -datatypes = { - FieldD.TYPE_BOOL: ('bool', 'BOOL', 1, False), - FieldD.TYPE_DOUBLE: ('double', 'DOUBLE', 8, False), - FieldD.TYPE_FIXED32: ('uint32_t', 'FIXED32', 4, False), - FieldD.TYPE_FIXED64: ('uint64_t', 'FIXED64', 8, False), - FieldD.TYPE_FLOAT: ('float', 'FLOAT', 4, False), - FieldD.TYPE_INT32: ('int32_t', 'INT32', 10, True), - FieldD.TYPE_INT64: ('int64_t', 'INT64', 10, True), - FieldD.TYPE_SFIXED32: ('int32_t', 'SFIXED32', 4, False), - FieldD.TYPE_SFIXED64: ('int64_t', 'SFIXED64', 8, False), - FieldD.TYPE_SINT32: ('int32_t', 'SINT32', 5, True), - FieldD.TYPE_SINT64: ('int64_t', 'SINT64', 10, True), - FieldD.TYPE_UINT32: ('uint32_t', 'UINT32', 5, True), - FieldD.TYPE_UINT64: ('uint64_t', 'UINT64', 10, True) -} - -# Integer size overrides (from .proto settings) -intsizes = { - nanopb_pb2.IS_8: 'int8_t', - nanopb_pb2.IS_16: 'int16_t', - nanopb_pb2.IS_32: 'int32_t', - nanopb_pb2.IS_64: 'int64_t', -} - -# String types (for python 2 / python 3 compatibility) -try: - strtypes = (unicode, str) -except NameError: - strtypes = (str, ) - -class Names: - '''Keeps a set of nested names and formats them to C identifier.''' - def __init__(self, parts = ()): - if isinstance(parts, Names): - parts = parts.parts - self.parts = tuple(parts) - - def __str__(self): - return '_'.join(self.parts) - - def __add__(self, other): - if isinstance(other, strtypes): - return Names(self.parts + (other,)) - elif isinstance(other, tuple): - return Names(self.parts + other) - else: - raise ValueError("Name parts should be of type str") - - def __eq__(self, other): - return isinstance(other, Names) and self.parts == other.parts - -def names_from_type_name(type_name): - '''Parse Names() from FieldDescriptorProto type_name''' - if type_name[0] != '.': - raise NotImplementedError("Lookup of non-absolute type names is not supported") - return Names(type_name[1:].split('.')) - -def varint_max_size(max_value): - '''Returns the maximum number of bytes a varint can take when encoded.''' - if max_value < 0: - max_value = 2**64 - max_value - for i in range(1, 11): - if (max_value >> (i * 7)) == 0: - return i - raise ValueError("Value too large for varint: " + str(max_value)) - -assert varint_max_size(-1) == 10 -assert varint_max_size(0) == 1 -assert varint_max_size(127) == 1 -assert varint_max_size(128) == 2 - -class EncodedSize: - '''Class used to represent the encoded size of a field or a message. - Consists of a combination of symbolic sizes and integer sizes.''' - def __init__(self, value = 0, symbols = []): - if isinstance(value, EncodedSize): - self.value = value.value - self.symbols = value.symbols - elif isinstance(value, strtypes + (Names,)): - self.symbols = [str(value)] - self.value = 0 - else: - self.value = value - self.symbols = symbols - - def __add__(self, other): - if isinstance(other, int): - return EncodedSize(self.value + other, self.symbols) - elif isinstance(other, strtypes + (Names,)): - return EncodedSize(self.value, self.symbols + [str(other)]) - elif isinstance(other, EncodedSize): - return EncodedSize(self.value + other.value, self.symbols + other.symbols) - else: - raise ValueError("Cannot add size: " + repr(other)) - - def __mul__(self, other): - if isinstance(other, int): - return EncodedSize(self.value * other, [str(other) + '*' + s for s in self.symbols]) - else: - raise ValueError("Cannot multiply size: " + repr(other)) - - def __str__(self): - if not self.symbols: - return str(self.value) - else: - return '(' + str(self.value) + ' + ' + ' + '.join(self.symbols) + ')' - - def upperlimit(self): - if not self.symbols: - return self.value - else: - return 2**32 - 1 - -class Enum: - def __init__(self, names, desc, enum_options): - '''desc is EnumDescriptorProto''' - - self.options = enum_options - self.names = names + desc.name - - if enum_options.long_names: - self.values = [(self.names + x.name, x.number) for x in desc.value] - else: - self.values = [(names + x.name, x.number) for x in desc.value] - - self.value_longnames = [self.names + x.name for x in desc.value] - self.packed = enum_options.packed_enum - - def has_negative(self): - for n, v in self.values: - if v < 0: - return True - return False - - def encoded_size(self): - return max([varint_max_size(v) for n,v in self.values]) - - def __str__(self): - result = 'typedef enum _%s {\n' % self.names - result += ',\n'.join([" %s = %d" % x for x in self.values]) - result += '\n}' - - if self.packed: - result += ' pb_packed' - - result += ' %s;' % self.names - - result += '\n#define _%s_MIN %s' % (self.names, self.values[0][0]) - result += '\n#define _%s_MAX %s' % (self.names, self.values[-1][0]) - result += '\n#define _%s_ARRAYSIZE ((%s)(%s+1))' % (self.names, self.names, self.values[-1][0]) - - if not self.options.long_names: - # Define the long names always so that enum value references - # from other files work properly. - for i, x in enumerate(self.values): - result += '\n#define %s %s' % (self.value_longnames[i], x[0]) - - return result - -class FieldMaxSize: - def __init__(self, worst = 0, checks = [], field_name = 'undefined'): - if isinstance(worst, list): - self.worst = max(i for i in worst if i is not None) - else: - self.worst = worst - - self.worst_field = field_name - self.checks = list(checks) - - def extend(self, extend, field_name = None): - self.worst = max(self.worst, extend.worst) - - if self.worst == extend.worst: - self.worst_field = extend.worst_field - - self.checks.extend(extend.checks) - -class Field: - def __init__(self, struct_name, desc, field_options): - '''desc is FieldDescriptorProto''' - self.tag = desc.number - self.struct_name = struct_name - self.union_name = None - self.name = desc.name - self.default = None - self.max_size = None - self.max_count = None - self.array_decl = "" - self.enc_size = None - self.ctype = None - - self.inline = None - if field_options.type == nanopb_pb2.FT_INLINE: - field_options.type = nanopb_pb2.FT_STATIC - self.inline = nanopb_pb2.FT_INLINE - - # Parse field options - if field_options.HasField("max_size"): - self.max_size = field_options.max_size - - if field_options.HasField("max_count"): - self.max_count = field_options.max_count - - if desc.HasField('default_value'): - self.default = desc.default_value - - # Check field rules, i.e. required/optional/repeated. - can_be_static = True - if desc.label == FieldD.LABEL_REQUIRED: - self.rules = 'REQUIRED' - elif desc.label == FieldD.LABEL_OPTIONAL: - self.rules = 'OPTIONAL' - elif desc.label == FieldD.LABEL_REPEATED: - self.rules = 'REPEATED' - if self.max_count is None: - can_be_static = False - else: - self.array_decl = '[%d]' % self.max_count - else: - raise NotImplementedError(desc.label) - - # Check if the field can be implemented with static allocation - # i.e. whether the data size is known. - if desc.type == FieldD.TYPE_STRING and self.max_size is None: - can_be_static = False - - if desc.type == FieldD.TYPE_BYTES and self.max_size is None: - can_be_static = False - - # Decide how the field data will be allocated - if field_options.type == nanopb_pb2.FT_DEFAULT: - if can_be_static: - field_options.type = nanopb_pb2.FT_STATIC - else: - field_options.type = nanopb_pb2.FT_CALLBACK - - if field_options.type == nanopb_pb2.FT_STATIC and not can_be_static: - raise Exception("Field %s is defined as static, but max_size or " - "max_count is not given." % self.name) - - if field_options.type == nanopb_pb2.FT_STATIC: - self.allocation = 'STATIC' - elif field_options.type == nanopb_pb2.FT_POINTER: - self.allocation = 'POINTER' - elif field_options.type == nanopb_pb2.FT_CALLBACK: - self.allocation = 'CALLBACK' - else: - raise NotImplementedError(field_options.type) - - # Decide the C data type to use in the struct. - if desc.type in datatypes: - self.ctype, self.pbtype, self.enc_size, isa = datatypes[desc.type] - - # Override the field size if user wants to use smaller integers - if isa and field_options.int_size != nanopb_pb2.IS_DEFAULT: - self.ctype = intsizes[field_options.int_size] - if desc.type == FieldD.TYPE_UINT32 or desc.type == FieldD.TYPE_UINT64: - self.ctype = 'u' + self.ctype; - elif desc.type == FieldD.TYPE_ENUM: - self.pbtype = 'ENUM' - self.ctype = names_from_type_name(desc.type_name) - if self.default is not None: - self.default = self.ctype + self.default - self.enc_size = None # Needs to be filled in when enum values are known - elif desc.type == FieldD.TYPE_STRING: - self.pbtype = 'STRING' - self.ctype = 'char' - if self.allocation == 'STATIC': - self.ctype = 'char' - self.array_decl += '[%d]' % self.max_size - self.enc_size = varint_max_size(self.max_size) + self.max_size - elif desc.type == FieldD.TYPE_BYTES: - self.pbtype = 'BYTES' - if self.allocation == 'STATIC': - # Inline STATIC for BYTES is like STATIC for STRING. - if self.inline: - self.ctype = 'pb_byte_t' - self.array_decl += '[%d]' % self.max_size - else: - self.ctype = self.struct_name + self.name + 't' - self.enc_size = varint_max_size(self.max_size) + self.max_size - elif self.allocation == 'POINTER': - self.ctype = 'pb_bytes_array_t' - elif desc.type == FieldD.TYPE_MESSAGE: - self.pbtype = 'MESSAGE' - self.ctype = self.submsgname = names_from_type_name(desc.type_name) - self.enc_size = None # Needs to be filled in after the message type is available - else: - raise NotImplementedError(desc.type) - - def __lt__(self, other): - return self.tag < other.tag - - def __str__(self): - result = '' - if self.allocation == 'POINTER': - if self.rules == 'REPEATED': - result += ' pb_size_t ' + self.name + '_count;\n' - - if self.pbtype == 'MESSAGE': - # Use struct definition, so recursive submessages are possible - result += ' struct _%s *%s;' % (self.ctype, self.name) - elif self.rules == 'REPEATED' and self.pbtype in ['STRING', 'BYTES']: - # String/bytes arrays need to be defined as pointers to pointers - result += ' %s **%s;' % (self.ctype, self.name) - else: - result += ' %s *%s;' % (self.ctype, self.name) - elif self.allocation == 'CALLBACK': - result += ' pb_callback_t %s;' % self.name - else: - if self.rules == 'OPTIONAL' and self.allocation == 'STATIC': - result += ' bool has_' + self.name + ';\n' - elif self.rules == 'REPEATED' and self.allocation == 'STATIC': - result += ' pb_size_t ' + self.name + '_count;\n' - result += ' %s %s%s;' % (self.ctype, self.name, self.array_decl) - return result - - def types(self): - '''Return definitions for any special types this field might need.''' - if self.pbtype == 'BYTES' and self.allocation == 'STATIC' and not self.inline: - result = 'typedef PB_BYTES_ARRAY_T(%d) %s;\n' % (self.max_size, self.ctype) - else: - result = '' - return result - - def get_dependencies(self): - '''Get list of type names used by this field.''' - if self.allocation == 'STATIC': - return [str(self.ctype)] - else: - return [] - - def get_initializer(self, null_init, inner_init_only = False): - '''Return literal expression for this field's default value. - null_init: If True, initialize to a 0 value instead of default from .proto - inner_init_only: If True, exclude initialization for any count/has fields - ''' - - inner_init = None - if self.pbtype == 'MESSAGE': - if null_init: - inner_init = '%s_init_zero' % self.ctype - else: - inner_init = '%s_init_default' % self.ctype - elif self.default is None or null_init: - if self.pbtype == 'STRING': - inner_init = '""' - elif self.pbtype == 'BYTES': - if self.inline: - inner_init = '{0}' - else: - inner_init = '{0, {0}}' - elif self.pbtype in ('ENUM', 'UENUM'): - inner_init = '(%s)0' % self.ctype - else: - inner_init = '0' - else: - if self.pbtype == 'STRING': - inner_init = self.default.replace('"', '\\"') - inner_init = '"' + inner_init + '"' - elif self.pbtype == 'BYTES': - data = ['0x%02x' % ord(c) for c in self.default] - if len(data) == 0: - if self.inline: - inner_init = '{0}' - else: - inner_init = '{0, {0}}' - else: - if self.inline: - inner_init = '{%s}' % ','.join(data) - else: - inner_init = '{%d, {%s}}' % (len(data), ','.join(data)) - elif self.pbtype in ['FIXED32', 'UINT32']: - inner_init = str(self.default) + 'u' - elif self.pbtype in ['FIXED64', 'UINT64']: - inner_init = str(self.default) + 'ull' - elif self.pbtype in ['SFIXED64', 'INT64']: - inner_init = str(self.default) + 'll' - else: - inner_init = str(self.default) - - if inner_init_only: - return inner_init - - outer_init = None - if self.allocation == 'STATIC': - if self.rules == 'REPEATED': - outer_init = '0, {' - outer_init += ', '.join([inner_init] * self.max_count) - outer_init += '}' - elif self.rules == 'OPTIONAL': - outer_init = 'false, ' + inner_init - else: - outer_init = inner_init - elif self.allocation == 'POINTER': - if self.rules == 'REPEATED': - outer_init = '0, NULL' - else: - outer_init = 'NULL' - elif self.allocation == 'CALLBACK': - if self.pbtype == 'EXTENSION': - outer_init = 'NULL' - else: - outer_init = '{{NULL}, NULL}' - - return outer_init - - def default_decl(self, declaration_only = False): - '''Return definition for this field's default value.''' - if self.default is None: - return None - - ctype = self.ctype - default = self.get_initializer(False, True) - array_decl = '' - - if self.pbtype == 'STRING': - if self.allocation != 'STATIC': - return None # Not implemented - array_decl = '[%d]' % self.max_size - elif self.pbtype == 'BYTES': - if self.allocation != 'STATIC': - return None # Not implemented - if self.inline: - array_decl = '[%d]' % self.max_size - - if declaration_only: - return 'extern const %s %s_default%s;' % (ctype, self.struct_name + self.name, array_decl) - else: - return 'const %s %s_default%s = %s;' % (ctype, self.struct_name + self.name, array_decl, default) - - def tags(self): - '''Return the #define for the tag number of this field.''' - identifier = '%s_%s_tag' % (self.struct_name, self.name) - return '#define %-40s %d\n' % (identifier, self.tag) - - def pb_field_t(self, prev_field_name): - '''Return the pb_field_t initializer to use in the constant array. - prev_field_name is the name of the previous field or None. - ''' - - if self.rules == 'ONEOF': - if self.anonymous: - result = ' PB_ANONYMOUS_ONEOF_FIELD(%s, ' % self.union_name - else: - result = ' PB_ONEOF_FIELD(%s, ' % self.union_name - else: - result = ' PB_FIELD(' - - result += '%3d, ' % self.tag - result += '%-8s, ' % self.pbtype - result += '%s, ' % self.rules - result += '%-8s, ' % (self.allocation if not self.inline else "INLINE") - result += '%s, ' % ("FIRST" if not prev_field_name else "OTHER") - result += '%s, ' % self.struct_name - result += '%s, ' % self.name - result += '%s, ' % (prev_field_name or self.name) - - if self.pbtype == 'MESSAGE': - result += '&%s_fields)' % self.submsgname - elif self.default is None: - result += '0)' - elif self.pbtype in ['BYTES', 'STRING'] and self.allocation != 'STATIC': - result += '0)' # Arbitrary size default values not implemented - elif self.rules == 'OPTEXT': - result += '0)' # Default value for extensions is not implemented - else: - result += '&%s_default)' % (self.struct_name + self.name) - - return result - - def get_last_field_name(self): - return self.name - - def largest_field_value(self): - '''Determine if this field needs 16bit or 32bit pb_field_t structure to compile properly. - Returns numeric value or a C-expression for assert.''' - check = [] - if self.pbtype == 'MESSAGE': - if self.rules == 'REPEATED' and self.allocation == 'STATIC': - check.append('pb_membersize(%s, %s[0])' % (self.struct_name, self.name)) - elif self.rules == 'ONEOF': - if self.anonymous: - check.append('pb_membersize(%s, %s)' % (self.struct_name, self.name)) - else: - check.append('pb_membersize(%s, %s.%s)' % (self.struct_name, self.union_name, self.name)) - else: - check.append('pb_membersize(%s, %s)' % (self.struct_name, self.name)) - - return FieldMaxSize([self.tag, self.max_size, self.max_count], - check, - ('%s.%s' % (self.struct_name, self.name))) - - def encoded_size(self, dependencies): - '''Return the maximum size that this field can take when encoded, - including the field tag. If the size cannot be determined, returns - None.''' - - if self.allocation != 'STATIC': - return None - - if self.pbtype == 'MESSAGE': - encsize = None - if str(self.submsgname) in dependencies: - submsg = dependencies[str(self.submsgname)] - encsize = submsg.encoded_size(dependencies) - if encsize is not None: - # Include submessage length prefix - encsize += varint_max_size(encsize.upperlimit()) - - if encsize is None: - # Submessage or its size cannot be found. - # This can occur if submessage is defined in different - # file, and it or its .options could not be found. - # Instead of direct numeric value, reference the size that - # has been #defined in the other file. - encsize = EncodedSize(self.submsgname + 'size') - - # We will have to make a conservative assumption on the length - # prefix size, though. - encsize += 5 - - elif self.pbtype in ['ENUM', 'UENUM']: - if str(self.ctype) in dependencies: - enumtype = dependencies[str(self.ctype)] - encsize = enumtype.encoded_size() - else: - # Conservative assumption - encsize = 10 - - elif self.enc_size is None: - raise RuntimeError("Could not determine encoded size for %s.%s" - % (self.struct_name, self.name)) - else: - encsize = EncodedSize(self.enc_size) - - encsize += varint_max_size(self.tag << 3) # Tag + wire type - - if self.rules == 'REPEATED': - # Decoders must be always able to handle unpacked arrays. - # Therefore we have to reserve space for it, even though - # we emit packed arrays ourselves. - encsize *= self.max_count - - return encsize - - -class ExtensionRange(Field): - def __init__(self, struct_name, range_start, field_options): - '''Implements a special pb_extension_t* field in an extensible message - structure. The range_start signifies the index at which the extensions - start. Not necessarily all tags above this are extensions, it is merely - a speed optimization. - ''' - self.tag = range_start - self.struct_name = struct_name - self.name = 'extensions' - self.pbtype = 'EXTENSION' - self.rules = 'OPTIONAL' - self.allocation = 'CALLBACK' - self.ctype = 'pb_extension_t' - self.array_decl = '' - self.default = None - self.max_size = 0 - self.max_count = 0 - self.inline = None - - def __str__(self): - return ' pb_extension_t *extensions;' - - def types(self): - return '' - - def tags(self): - return '' - - def encoded_size(self, dependencies): - # We exclude extensions from the count, because they cannot be known - # until runtime. Other option would be to return None here, but this - # way the value remains useful if extensions are not used. - return EncodedSize(0) - -class ExtensionField(Field): - def __init__(self, struct_name, desc, field_options): - self.fullname = struct_name + desc.name - self.extendee_name = names_from_type_name(desc.extendee) - Field.__init__(self, self.fullname + 'struct', desc, field_options) - - if self.rules != 'OPTIONAL': - self.skip = True - else: - self.skip = False - self.rules = 'OPTEXT' - - def tags(self): - '''Return the #define for the tag number of this field.''' - identifier = '%s_tag' % self.fullname - return '#define %-40s %d\n' % (identifier, self.tag) - - def extension_decl(self): - '''Declaration of the extension type in the .pb.h file''' - if self.skip: - msg = '/* Extension field %s was skipped because only "optional"\n' % self.fullname - msg +=' type of extension fields is currently supported. */\n' - return msg - - return ('extern const pb_extension_type_t %s; /* field type: %s */\n' % - (self.fullname, str(self).strip())) - - def extension_def(self): - '''Definition of the extension type in the .pb.c file''' - - if self.skip: - return '' - - result = 'typedef struct {\n' - result += str(self) - result += '\n} %s;\n\n' % self.struct_name - result += ('static const pb_field_t %s_field = \n %s;\n\n' % - (self.fullname, self.pb_field_t(None))) - result += 'const pb_extension_type_t %s = {\n' % self.fullname - result += ' NULL,\n' - result += ' NULL,\n' - result += ' &%s_field\n' % self.fullname - result += '};\n' - return result - - -# --------------------------------------------------------------------------- -# Generation of oneofs (unions) -# --------------------------------------------------------------------------- - -class OneOf(Field): - def __init__(self, struct_name, oneof_desc): - self.struct_name = struct_name - self.name = oneof_desc.name - self.ctype = 'union' - self.pbtype = 'oneof' - self.fields = [] - self.allocation = 'ONEOF' - self.default = None - self.rules = 'ONEOF' - self.anonymous = False - self.inline = None - - def add_field(self, field): - if field.allocation == 'CALLBACK': - raise Exception("Callback fields inside of oneof are not supported" - + " (field %s)" % field.name) - - field.union_name = self.name - field.rules = 'ONEOF' - field.anonymous = self.anonymous - self.fields.append(field) - self.fields.sort(key = lambda f: f.tag) - - # Sort by the lowest tag number inside union - self.tag = min([f.tag for f in self.fields]) - - def __str__(self): - result = '' - if self.fields: - result += ' pb_size_t which_' + self.name + ";\n" - result += ' union {\n' - for f in self.fields: - result += ' ' + str(f).replace('\n', '\n ') + '\n' - if self.anonymous: - result += ' };' - else: - result += ' } ' + self.name + ';' - return result - - def types(self): - return ''.join([f.types() for f in self.fields]) - - def get_dependencies(self): - deps = [] - for f in self.fields: - deps += f.get_dependencies() - return deps - - def get_initializer(self, null_init): - return '0, {' + self.fields[0].get_initializer(null_init) + '}' - - def default_decl(self, declaration_only = False): - return None - - def tags(self): - return ''.join([f.tags() for f in self.fields]) - - def pb_field_t(self, prev_field_name): - result = ',\n'.join([f.pb_field_t(prev_field_name) for f in self.fields]) - return result - - def get_last_field_name(self): - if self.anonymous: - return self.fields[-1].name - else: - return self.name + '.' + self.fields[-1].name - - def largest_field_value(self): - largest = FieldMaxSize() - for f in self.fields: - largest.extend(f.largest_field_value()) - return largest - - def encoded_size(self, dependencies): - '''Returns the size of the largest oneof field.''' - largest = EncodedSize(0) - for f in self.fields: - size = EncodedSize(f.encoded_size(dependencies)) - if size.value is None: - return None - elif size.symbols: - return None # Cannot resolve maximum of symbols - elif size.value > largest.value: - largest = size - - return largest - -# --------------------------------------------------------------------------- -# Generation of messages (structures) -# --------------------------------------------------------------------------- - - -class Message: - def __init__(self, names, desc, message_options): - self.name = names - self.fields = [] - self.oneofs = {} - no_unions = [] - - if message_options.msgid: - self.msgid = message_options.msgid - - if hasattr(desc, 'oneof_decl'): - for i, f in enumerate(desc.oneof_decl): - oneof_options = get_nanopb_suboptions(desc, message_options, self.name + f.name) - if oneof_options.no_unions: - no_unions.append(i) # No union, but add fields normally - elif oneof_options.type == nanopb_pb2.FT_IGNORE: - pass # No union and skip fields also - else: - oneof = OneOf(self.name, f) - if oneof_options.anonymous_oneof: - oneof.anonymous = True - self.oneofs[i] = oneof - self.fields.append(oneof) - - for f in desc.field: - field_options = get_nanopb_suboptions(f, message_options, self.name + f.name) - if field_options.type == nanopb_pb2.FT_IGNORE: - continue - - field = Field(self.name, f, field_options) - if (hasattr(f, 'oneof_index') and - f.HasField('oneof_index') and - f.oneof_index not in no_unions): - if f.oneof_index in self.oneofs: - self.oneofs[f.oneof_index].add_field(field) - else: - self.fields.append(field) - - if len(desc.extension_range) > 0: - field_options = get_nanopb_suboptions(desc, message_options, self.name + 'extensions') - range_start = min([r.start for r in desc.extension_range]) - if field_options.type != nanopb_pb2.FT_IGNORE: - self.fields.append(ExtensionRange(self.name, range_start, field_options)) - - self.packed = message_options.packed_struct - self.ordered_fields = self.fields[:] - self.ordered_fields.sort() - - def get_dependencies(self): - '''Get list of type names that this structure refers to.''' - deps = [] - for f in self.fields: - deps += f.get_dependencies() - return deps - - def __str__(self): - result = 'typedef struct _%s {\n' % self.name - - if not self.ordered_fields: - # Empty structs are not allowed in C standard. - # Therefore add a dummy field if an empty message occurs. - result += ' char dummy_field;' - - result += '\n'.join([str(f) for f in self.ordered_fields]) - result += '\n/* @@protoc_insertion_point(struct:%s) */' % self.name - result += '\n}' - - if self.packed: - result += ' pb_packed' - - result += ' %s;' % self.name - - if self.packed: - result = 'PB_PACKED_STRUCT_START\n' + result - result += '\nPB_PACKED_STRUCT_END' - - return result - - def types(self): - return ''.join([f.types() for f in self.fields]) - - def get_initializer(self, null_init): - if not self.ordered_fields: - return '{0}' - - parts = [] - for field in self.ordered_fields: - parts.append(field.get_initializer(null_init)) - return '{' + ', '.join(parts) + '}' - - def default_decl(self, declaration_only = False): - result = "" - for field in self.fields: - default = field.default_decl(declaration_only) - if default is not None: - result += default + '\n' - return result - - def count_required_fields(self): - '''Returns number of required fields inside this message''' - count = 0 - for f in self.fields: - if not isinstance(f, OneOf): - if f.rules == 'REQUIRED': - count += 1 - return count - - def count_all_fields(self): - count = 0 - for f in self.fields: - if isinstance(f, OneOf): - count += len(f.fields) - else: - count += 1 - return count - - def fields_declaration(self): - result = 'extern const pb_field_t %s_fields[%d];' % (self.name, self.count_all_fields() + 1) - return result - - def fields_definition(self): - result = 'const pb_field_t %s_fields[%d] = {\n' % (self.name, self.count_all_fields() + 1) - - prev = None - for field in self.ordered_fields: - result += field.pb_field_t(prev) - result += ',\n' - prev = field.get_last_field_name() - - result += ' PB_LAST_FIELD\n};' - return result - - def encoded_size(self, dependencies): - '''Return the maximum size that this message can take when encoded. - If the size cannot be determined, returns None. - ''' - size = EncodedSize(0) - for field in self.fields: - fsize = field.encoded_size(dependencies) - if fsize is None: - return None - size += fsize - - return size - - -# --------------------------------------------------------------------------- -# Processing of entire .proto files -# --------------------------------------------------------------------------- - -def iterate_messages(desc, names = Names()): - '''Recursively find all messages. For each, yield name, DescriptorProto.''' - if hasattr(desc, 'message_type'): - submsgs = desc.message_type - else: - submsgs = desc.nested_type - - for submsg in submsgs: - sub_names = names + submsg.name - yield sub_names, submsg - - for x in iterate_messages(submsg, sub_names): - yield x - -def iterate_extensions(desc, names = Names()): - '''Recursively find all extensions. - For each, yield name, FieldDescriptorProto. - ''' - for extension in desc.extension: - yield names, extension - - for subname, subdesc in iterate_messages(desc, names): - for extension in subdesc.extension: - yield subname, extension - -def toposort2(data): - '''Topological sort. - From http://code.activestate.com/recipes/577413-topological-sort/ - This function is under the MIT license. - ''' - for k, v in list(data.items()): - v.discard(k) # Ignore self dependencies - extra_items_in_deps = reduce(set.union, list(data.values()), set()) - set(data.keys()) - data.update(dict([(item, set()) for item in extra_items_in_deps])) - while True: - ordered = set(item for item,dep in list(data.items()) if not dep) - if not ordered: - break - for item in sorted(ordered): - yield item - data = dict([(item, (dep - ordered)) for item,dep in list(data.items()) - if item not in ordered]) - assert not data, "A cyclic dependency exists amongst %r" % data - -def sort_dependencies(messages): - '''Sort a list of Messages based on dependencies.''' - dependencies = {} - message_by_name = {} - for message in messages: - dependencies[str(message.name)] = set(message.get_dependencies()) - message_by_name[str(message.name)] = message - - for msgname in toposort2(dependencies): - if msgname in message_by_name: - yield message_by_name[msgname] - -def make_identifier(headername): - '''Make #ifndef identifier that contains uppercase A-Z and digits 0-9''' - result = "" - for c in headername.upper(): - if c.isalnum(): - result += c - else: - result += '_' - return result - -class ProtoFile: - def __init__(self, fdesc, file_options): - '''Takes a FileDescriptorProto and parses it.''' - self.fdesc = fdesc - self.file_options = file_options - self.dependencies = {} - self.parse() - - # Some of types used in this file probably come from the file itself. - # Thus it has implicit dependency on itself. - self.add_dependency(self) - - def parse(self): - self.enums = [] - self.messages = [] - self.extensions = [] - - if self.fdesc.package: - base_name = Names(self.fdesc.package.split('.')) - else: - base_name = Names() - - for enum in self.fdesc.enum_type: - enum_options = get_nanopb_suboptions(enum, self.file_options, base_name + enum.name) - self.enums.append(Enum(base_name, enum, enum_options)) - - for names, message in iterate_messages(self.fdesc, base_name): - message_options = get_nanopb_suboptions(message, self.file_options, names) - - if message_options.skip_message: - continue - - self.messages.append(Message(names, message, message_options)) - for enum in message.enum_type: - enum_options = get_nanopb_suboptions(enum, message_options, names + enum.name) - self.enums.append(Enum(names, enum, enum_options)) - - for names, extension in iterate_extensions(self.fdesc, base_name): - field_options = get_nanopb_suboptions(extension, self.file_options, names + extension.name) - if field_options.type != nanopb_pb2.FT_IGNORE: - self.extensions.append(ExtensionField(names, extension, field_options)) - - def add_dependency(self, other): - for enum in other.enums: - self.dependencies[str(enum.names)] = enum - - for msg in other.messages: - self.dependencies[str(msg.name)] = msg - - # Fix field default values where enum short names are used. - for enum in other.enums: - if not enum.options.long_names: - for message in self.messages: - for field in message.fields: - if field.default in enum.value_longnames: - idx = enum.value_longnames.index(field.default) - field.default = enum.values[idx][0] - - # Fix field data types where enums have negative values. - for enum in other.enums: - if not enum.has_negative(): - for message in self.messages: - for field in message.fields: - if field.pbtype == 'ENUM' and field.ctype == enum.names: - field.pbtype = 'UENUM' - - def generate_header(self, includes, headername, options): - '''Generate content for a header file. - Generates strings, which should be concatenated and stored to file. - ''' - - yield '/* Automatically generated nanopb header */\n' - if options.notimestamp: - yield '/* Generated by %s */\n\n' % (nanopb_version) - else: - yield '/* Generated by %s at %s. */\n\n' % (nanopb_version, time.asctime()) - - if self.fdesc.package: - symbol = make_identifier(self.fdesc.package + '_' + headername) - else: - symbol = make_identifier(headername) - yield '#ifndef PB_%s_INCLUDED\n' % symbol - yield '#define PB_%s_INCLUDED\n' % symbol - try: - yield options.libformat % ('pb.h') - except TypeError: - # no %s specified - use whatever was passed in as options.libformat - yield options.libformat - yield '\n' - - for incfile in includes: - noext = os.path.splitext(incfile)[0] - yield options.genformat % (noext + options.extension + '.h') - yield '\n' - - yield '/* @@protoc_insertion_point(includes) */\n' - - yield '#if PB_PROTO_HEADER_VERSION != 30\n' - yield '#error Regenerate this file with the current version of nanopb generator.\n' - yield '#endif\n' - yield '\n' - - yield '#ifdef __cplusplus\n' - yield 'extern "C" {\n' - yield '#endif\n\n' - - if self.enums: - yield '/* Enum definitions */\n' - for enum in self.enums: - yield str(enum) + '\n\n' - - if self.messages: - yield '/* Struct definitions */\n' - for msg in sort_dependencies(self.messages): - yield msg.types() - yield str(msg) + '\n\n' - - if self.extensions: - yield '/* Extensions */\n' - for extension in self.extensions: - yield extension.extension_decl() - yield '\n' - - if self.messages: - yield '/* Default values for struct fields */\n' - for msg in self.messages: - yield msg.default_decl(True) - yield '\n' - - yield '/* Initializer values for message structs */\n' - for msg in self.messages: - identifier = '%s_init_default' % msg.name - yield '#define %-40s %s\n' % (identifier, msg.get_initializer(False)) - for msg in self.messages: - identifier = '%s_init_zero' % msg.name - yield '#define %-40s %s\n' % (identifier, msg.get_initializer(True)) - yield '\n' - - yield '/* Field tags (for use in manual encoding/decoding) */\n' - for msg in sort_dependencies(self.messages): - for field in msg.fields: - yield field.tags() - for extension in self.extensions: - yield extension.tags() - yield '\n' - - yield '/* Struct field encoding specification for nanopb */\n' - for msg in self.messages: - yield msg.fields_declaration() + '\n' - yield '\n' - - yield '/* Maximum encoded size of messages (where known) */\n' - for msg in self.messages: - msize = msg.encoded_size(self.dependencies) - identifier = '%s_size' % msg.name - if msize is not None: - yield '#define %-40s %s\n' % (identifier, msize) - else: - yield '/* %s depends on runtime parameters */\n' % identifier - yield '\n' - - yield '/* Message IDs (where set with "msgid" option) */\n' - - yield '#ifdef PB_MSGID\n' - for msg in self.messages: - if hasattr(msg,'msgid'): - yield '#define PB_MSG_%d %s\n' % (msg.msgid, msg.name) - yield '\n' - - symbol = make_identifier(headername.split('.')[0]) - yield '#define %s_MESSAGES \\\n' % symbol - - for msg in self.messages: - m = "-1" - msize = msg.encoded_size(self.dependencies) - if msize is not None: - m = msize - if hasattr(msg,'msgid'): - yield '\tPB_MSG(%d,%s,%s) \\\n' % (msg.msgid, m, msg.name) - yield '\n' - - for msg in self.messages: - if hasattr(msg,'msgid'): - yield '#define %s_msgid %d\n' % (msg.name, msg.msgid) - yield '\n' - - yield '#endif\n\n' - - yield '#ifdef __cplusplus\n' - yield '} /* extern "C" */\n' - yield '#endif\n' - - # End of header - yield '/* @@protoc_insertion_point(eof) */\n' - yield '\n#endif\n' - - def generate_source(self, headername, options): - '''Generate content for a source file.''' - - yield '/* Automatically generated nanopb constant definitions */\n' - if options.notimestamp: - yield '/* Generated by %s */\n\n' % (nanopb_version) - else: - yield '/* Generated by %s at %s. */\n\n' % (nanopb_version, time.asctime()) - yield options.genformat % (headername) - yield '\n' - yield '/* @@protoc_insertion_point(includes) */\n' - - yield '#if PB_PROTO_HEADER_VERSION != 30\n' - yield '#error Regenerate this file with the current version of nanopb generator.\n' - yield '#endif\n' - yield '\n' - - for msg in self.messages: - yield msg.default_decl(False) - - yield '\n\n' - - for msg in self.messages: - yield msg.fields_definition() + '\n\n' - - for ext in self.extensions: - yield ext.extension_def() + '\n' - - # Add checks for numeric limits - if self.messages: - largest_msg = max(self.messages, key = lambda m: m.count_required_fields()) - largest_count = largest_msg.count_required_fields() - if largest_count > 64: - yield '\n/* Check that missing required fields will be properly detected */\n' - yield '#if PB_MAX_REQUIRED_FIELDS < %d\n' % largest_count - yield '#error Properly detecting missing required fields in %s requires \\\n' % largest_msg.name - yield ' setting PB_MAX_REQUIRED_FIELDS to %d or more.\n' % largest_count - yield '#endif\n' - - max_field = FieldMaxSize() - checks_msgnames = [] - for msg in self.messages: - checks_msgnames.append(msg.name) - for field in msg.fields: - max_field.extend(field.largest_field_value()) - - worst = max_field.worst - worst_field = max_field.worst_field - checks = max_field.checks - - if worst > 255 or checks: - yield '\n/* Check that field information fits in pb_field_t */\n' - - if worst > 65535 or checks: - yield '#if !defined(PB_FIELD_32BIT)\n' - if worst > 65535: - yield '#error Field descriptor for %s is too large. Define PB_FIELD_32BIT to fix this.\n' % worst_field - else: - assertion = ' && '.join(str(c) + ' < 65536' for c in checks) - msgs = '_'.join(str(n) for n in checks_msgnames) - yield '/* If you get an error here, it means that you need to define PB_FIELD_32BIT\n' - yield ' * compile-time option. You can do that in pb.h or on compiler command line.\n' - yield ' * \n' - yield ' * The reason you need to do this is that some of your messages contain tag\n' - yield ' * numbers or field sizes that are larger than what can fit in 8 or 16 bit\n' - yield ' * field descriptors.\n' - yield ' */\n' - yield 'PB_STATIC_ASSERT((%s), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_%s)\n'%(assertion,msgs) - yield '#endif\n\n' - - if worst < 65536: - yield '#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)\n' - if worst > 255: - yield '#error Field descriptor for %s is too large. Define PB_FIELD_16BIT to fix this.\n' % worst_field - else: - assertion = ' && '.join(str(c) + ' < 256' for c in checks) - msgs = '_'.join(str(n) for n in checks_msgnames) - yield '/* If you get an error here, it means that you need to define PB_FIELD_16BIT\n' - yield ' * compile-time option. You can do that in pb.h or on compiler command line.\n' - yield ' * \n' - yield ' * The reason you need to do this is that some of your messages contain tag\n' - yield ' * numbers or field sizes that are larger than what can fit in the default\n' - yield ' * 8 bit descriptors.\n' - yield ' */\n' - yield 'PB_STATIC_ASSERT((%s), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_%s)\n'%(assertion,msgs) - yield '#endif\n\n' - - # Add check for sizeof(double) - has_double = False - for msg in self.messages: - for field in msg.fields: - if field.ctype == 'double': - has_double = True - - if has_double: - yield '\n' - yield '/* On some platforms (such as AVR), double is really float.\n' - yield ' * These are not directly supported by nanopb, but see example_avr_double.\n' - yield ' * To get rid of this error, remove any double fields from your .proto.\n' - yield ' */\n' - yield 'PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)\n' - - yield '\n' - yield '/* @@protoc_insertion_point(eof) */\n' - -# --------------------------------------------------------------------------- -# Options parsing for the .proto files -# --------------------------------------------------------------------------- - -from fnmatch import fnmatch - -def read_options_file(infile): - '''Parse a separate options file to list: - [(namemask, options), ...] - ''' - results = [] - data = infile.read() - data = re.sub('/\*.*?\*/', '', data, flags = re.MULTILINE) - data = re.sub('//.*?$', '', data, flags = re.MULTILINE) - data = re.sub('#.*?$', '', data, flags = re.MULTILINE) - for i, line in enumerate(data.split('\n')): - line = line.strip() - if not line: - continue - - parts = line.split(None, 1) - - if len(parts) < 2: - sys.stderr.write("%s:%d: " % (infile.name, i + 1) + - "Option lines should have space between field name and options. " + - "Skipping line: '%s'\n" % line) - continue - - opts = nanopb_pb2.NanoPBOptions() - - try: - text_format.Merge(parts[1], opts) - except Exception as e: - sys.stderr.write("%s:%d: " % (infile.name, i + 1) + - "Unparseable option line: '%s'. " % line + - "Error: %s\n" % str(e)) - continue - results.append((parts[0], opts)) - - return results - -class Globals: - '''Ugly global variables, should find a good way to pass these.''' - verbose_options = False - separate_options = [] - matched_namemasks = set() - -def get_nanopb_suboptions(subdesc, options, name): - '''Get copy of options, and merge information from subdesc.''' - new_options = nanopb_pb2.NanoPBOptions() - new_options.CopyFrom(options) - - # Handle options defined in a separate file - dotname = '.'.join(name.parts) - for namemask, options in Globals.separate_options: - if fnmatch(dotname, namemask): - Globals.matched_namemasks.add(namemask) - new_options.MergeFrom(options) - - # Handle options defined in .proto - if isinstance(subdesc.options, descriptor.FieldOptions): - ext_type = nanopb_pb2.nanopb - elif isinstance(subdesc.options, descriptor.FileOptions): - ext_type = nanopb_pb2.nanopb_fileopt - elif isinstance(subdesc.options, descriptor.MessageOptions): - ext_type = nanopb_pb2.nanopb_msgopt - elif isinstance(subdesc.options, descriptor.EnumOptions): - ext_type = nanopb_pb2.nanopb_enumopt - else: - raise Exception("Unknown options type") - - if subdesc.options.HasExtension(ext_type): - ext = subdesc.options.Extensions[ext_type] - new_options.MergeFrom(ext) - - if Globals.verbose_options: - sys.stderr.write("Options for " + dotname + ": ") - sys.stderr.write(text_format.MessageToString(new_options) + "\n") - - return new_options - - -# --------------------------------------------------------------------------- -# Command line interface -# --------------------------------------------------------------------------- - -import sys -import os.path -from optparse import OptionParser - -optparser = OptionParser( - usage = "Usage: nanopb_generator.py [options] file.pb ...", - epilog = "Compile file.pb from file.proto by: 'protoc -ofile.pb file.proto'. " + - "Output will be written to file.pb.h and file.pb.c.") -optparser.add_option("-x", dest="exclude", metavar="FILE", action="append", default=[], - help="Exclude file from generated #include list.") -optparser.add_option("-e", "--extension", dest="extension", metavar="EXTENSION", default=".pb", - help="Set extension to use instead of '.pb' for generated files. [default: %default]") -optparser.add_option("-f", "--options-file", dest="options_file", metavar="FILE", default="%s.options", - help="Set name of a separate generator options file.") -optparser.add_option("-I", "--options-path", dest="options_path", metavar="DIR", - action="append", default = [], - help="Search for .options files additionally in this path") -optparser.add_option("-D", "--output-dir", dest="output_dir", - metavar="OUTPUTDIR", default=None, - help="Output directory of .pb.h and .pb.c files") -optparser.add_option("-Q", "--generated-include-format", dest="genformat", - metavar="FORMAT", default='#include "%s"\n', - help="Set format string to use for including other .pb.h files. [default: %default]") -optparser.add_option("-L", "--library-include-format", dest="libformat", - metavar="FORMAT", default='#include <%s>\n', - help="Set format string to use for including the nanopb pb.h header. [default: %default]") -optparser.add_option("-T", "--no-timestamp", dest="notimestamp", action="store_true", default=False, - help="Don't add timestamp to .pb.h and .pb.c preambles") -optparser.add_option("-q", "--quiet", dest="quiet", action="store_true", default=False, - help="Don't print anything except errors.") -optparser.add_option("-v", "--verbose", dest="verbose", action="store_true", default=False, - help="Print more information.") -optparser.add_option("-s", dest="settings", metavar="OPTION:VALUE", action="append", default=[], - help="Set generator option (max_size, max_count etc.).") - -def parse_file(filename, fdesc, options): - '''Parse a single file. Returns a ProtoFile instance.''' - toplevel_options = nanopb_pb2.NanoPBOptions() - for s in options.settings: - text_format.Merge(s, toplevel_options) - - if not fdesc: - data = open(filename, 'rb').read() - fdesc = descriptor.FileDescriptorSet.FromString(data).file[0] - - # Check if there is a separate .options file - had_abspath = False - try: - optfilename = options.options_file % os.path.splitext(filename)[0] - except TypeError: - # No %s specified, use the filename as-is - optfilename = options.options_file - had_abspath = True - - paths = ['.'] + options.options_path - for p in paths: - if os.path.isfile(os.path.join(p, optfilename)): - optfilename = os.path.join(p, optfilename) - if options.verbose: - sys.stderr.write('Reading options from ' + optfilename + '\n') - Globals.separate_options = read_options_file(open(optfilename, "rU")) - break - else: - # If we are given a full filename and it does not exist, give an error. - # However, don't give error when we automatically look for .options file - # with the same name as .proto. - if options.verbose or had_abspath: - sys.stderr.write('Options file not found: ' + optfilename + '\n') - Globals.separate_options = [] - - Globals.matched_namemasks = set() - - # Parse the file - file_options = get_nanopb_suboptions(fdesc, toplevel_options, Names([filename])) - f = ProtoFile(fdesc, file_options) - f.optfilename = optfilename - - return f - -def process_file(filename, fdesc, options, other_files = {}): - '''Process a single file. - filename: The full path to the .proto or .pb source file, as string. - fdesc: The loaded FileDescriptorSet, or None to read from the input file. - options: Command line options as they come from OptionsParser. - - Returns a dict: - {'headername': Name of header file, - 'headerdata': Data for the .h header file, - 'sourcename': Name of the source code file, - 'sourcedata': Data for the .c source code file - } - ''' - f = parse_file(filename, fdesc, options) - - # Provide dependencies if available - for dep in f.fdesc.dependency: - if dep in other_files: - f.add_dependency(other_files[dep]) - - # Decide the file names - noext = os.path.splitext(filename)[0] - headername = noext + options.extension + '.h' - sourcename = noext + options.extension + '.c' - headerbasename = os.path.basename(headername) - - # List of .proto files that should not be included in the C header file - # even if they are mentioned in the source .proto. - excludes = ['nanopb.proto', 'google/protobuf/descriptor.proto'] + options.exclude - includes = [d for d in f.fdesc.dependency if d not in excludes] - - headerdata = ''.join(f.generate_header(includes, headerbasename, options)) - sourcedata = ''.join(f.generate_source(headerbasename, options)) - - # Check if there were any lines in .options that did not match a member - unmatched = [n for n,o in Globals.separate_options if n not in Globals.matched_namemasks] - if unmatched and not options.quiet: - sys.stderr.write("Following patterns in " + f.optfilename + " did not match any fields: " - + ', '.join(unmatched) + "\n") - if not Globals.verbose_options: - sys.stderr.write("Use protoc --nanopb-out=-v:. to see a list of the field names.\n") - - return {'headername': headername, 'headerdata': headerdata, - 'sourcename': sourcename, 'sourcedata': sourcedata} - -def main_cli(): - '''Main function when invoked directly from the command line.''' - - options, filenames = optparser.parse_args() - - if not filenames: - optparser.print_help() - sys.exit(1) - - if options.quiet: - options.verbose = False - - if options.output_dir and not os.path.exists(options.output_dir): - optparser.print_help() - sys.stderr.write("\noutput_dir does not exist: %s\n" % options.output_dir) - sys.exit(1) - - - Globals.verbose_options = options.verbose - for filename in filenames: - results = process_file(filename, None, options) - - base_dir = options.output_dir or '' - to_write = [ - (os.path.join(base_dir, results['headername']), results['headerdata']), - (os.path.join(base_dir, results['sourcename']), results['sourcedata']), - ] - - if not options.quiet: - paths = " and ".join([x[0] for x in to_write]) - sys.stderr.write("Writing to %s\n" % paths) - - for path, data in to_write: - with open(path, 'w') as f: - f.write(data) - -def main_plugin(): - '''Main function when invoked as a protoc plugin.''' - - import io, sys - if sys.platform == "win32": - import os, msvcrt - # Set stdin and stdout to binary mode - msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) - msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) - - data = io.open(sys.stdin.fileno(), "rb").read() - - request = plugin_pb2.CodeGeneratorRequest.FromString(data) - - try: - # Versions of Python prior to 2.7.3 do not support unicode - # input to shlex.split(). Try to convert to str if possible. - params = str(request.parameter) - except UnicodeEncodeError: - params = request.parameter - - import shlex - args = shlex.split(params) - options, dummy = optparser.parse_args(args) - - Globals.verbose_options = options.verbose - - response = plugin_pb2.CodeGeneratorResponse() - - # Google's protoc does not currently indicate the full path of proto files. - # Instead always add the main file path to the search dirs, that works for - # the common case. - import os.path - options.options_path.append(os.path.dirname(request.file_to_generate[0])) - - # Process any include files first, in order to have them - # available as dependencies - other_files = {} - for fdesc in request.proto_file: - other_files[fdesc.name] = parse_file(fdesc.name, fdesc, options) - - for filename in request.file_to_generate: - for fdesc in request.proto_file: - if fdesc.name == filename: - results = process_file(filename, fdesc, options, other_files) - - f = response.file.add() - f.name = results['headername'] - f.content = results['headerdata'] - - f = response.file.add() - f.name = results['sourcename'] - f.content = results['sourcedata'] - - io.open(sys.stdout.fileno(), "wb").write(response.SerializeToString()) - -if __name__ == '__main__': - # Check if we are running as a plugin under protoc - if 'protoc-gen-' in sys.argv[0] or '--protoc-plugin' in sys.argv: - main_plugin() - else: - main_cli() diff --git a/third_party/nanopb/generator/proto/Makefile b/third_party/nanopb/generator/proto/Makefile deleted file mode 100644 index 89bfe52864e..00000000000 --- a/third_party/nanopb/generator/proto/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -all: nanopb_pb2.py plugin_pb2.py - -%_pb2.py: %.proto - protoc --python_out=. $< diff --git a/third_party/nanopb/generator/proto/__init__.py b/third_party/nanopb/generator/proto/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/third_party/nanopb/generator/proto/google/protobuf/descriptor.proto b/third_party/nanopb/generator/proto/google/protobuf/descriptor.proto deleted file mode 100644 index e17c0cc8abb..00000000000 --- a/third_party/nanopb/generator/proto/google/protobuf/descriptor.proto +++ /dev/null @@ -1,714 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. -// -// The messages in this file describe the definitions found in .proto files. -// A valid .proto file can be translated directly to a FileDescriptorProto -// without any other information (e.g. without reading its imports). - - -syntax = "proto2"; - -package google.protobuf; -option java_package = "com.google.protobuf"; -option java_outer_classname = "DescriptorProtos"; - -// descriptor.proto must be optimized for speed because reflection-based -// algorithms don't work during bootstrapping. -option optimize_for = SPEED; - -// The protocol compiler can output a FileDescriptorSet containing the .proto -// files it parses. -message FileDescriptorSet { - repeated FileDescriptorProto file = 1; -} - -// Describes a complete .proto file. -message FileDescriptorProto { - optional string name = 1; // file name, relative to root of source tree - optional string package = 2; // e.g. "foo", "foo.bar", etc. - - // Names of files imported by this file. - repeated string dependency = 3; - // Indexes of the public imported files in the dependency list above. - repeated int32 public_dependency = 10; - // Indexes of the weak imported files in the dependency list. - // For Google-internal migration only. Do not use. - repeated int32 weak_dependency = 11; - - // All top-level definitions in this file. - repeated DescriptorProto message_type = 4; - repeated EnumDescriptorProto enum_type = 5; - repeated ServiceDescriptorProto service = 6; - repeated FieldDescriptorProto extension = 7; - - optional FileOptions options = 8; - - // This field contains optional information about the original source code. - // You may safely remove this entire field without harming runtime - // functionality of the descriptors -- the information is needed only by - // development tools. - optional SourceCodeInfo source_code_info = 9; - - // The syntax of the proto file. - // The supported values are "proto2" and "proto3". - optional string syntax = 12; -} - -// Describes a message type. -message DescriptorProto { - optional string name = 1; - - repeated FieldDescriptorProto field = 2; - repeated FieldDescriptorProto extension = 6; - - repeated DescriptorProto nested_type = 3; - repeated EnumDescriptorProto enum_type = 4; - - message ExtensionRange { - optional int32 start = 1; - optional int32 end = 2; - } - repeated ExtensionRange extension_range = 5; - - repeated OneofDescriptorProto oneof_decl = 8; - - optional MessageOptions options = 7; -} - -// Describes a field within a message. -message FieldDescriptorProto { - enum Type { - // 0 is reserved for errors. - // Order is weird for historical reasons. - TYPE_DOUBLE = 1; - TYPE_FLOAT = 2; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - // negative values are likely. - TYPE_INT64 = 3; - TYPE_UINT64 = 4; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - // negative values are likely. - TYPE_INT32 = 5; - TYPE_FIXED64 = 6; - TYPE_FIXED32 = 7; - TYPE_BOOL = 8; - TYPE_STRING = 9; - TYPE_GROUP = 10; // Tag-delimited aggregate. - TYPE_MESSAGE = 11; // Length-delimited aggregate. - - // New in version 2. - TYPE_BYTES = 12; - TYPE_UINT32 = 13; - TYPE_ENUM = 14; - TYPE_SFIXED32 = 15; - TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; // Uses ZigZag encoding. - TYPE_SINT64 = 18; // Uses ZigZag encoding. - }; - - enum Label { - // 0 is reserved for errors - LABEL_OPTIONAL = 1; - LABEL_REQUIRED = 2; - LABEL_REPEATED = 3; - // TODO(sanjay): Should we add LABEL_MAP? - }; - - optional string name = 1; - optional int32 number = 3; - optional Label label = 4; - - // If type_name is set, this need not be set. If both this and type_name - // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - optional Type type = 5; - - // For message and enum types, this is the name of the type. If the name - // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - // rules are used to find the type (i.e. first the nested types within this - // message are searched, then within the parent, on up to the root - // namespace). - optional string type_name = 6; - - // For extensions, this is the name of the type being extended. It is - // resolved in the same manner as type_name. - optional string extendee = 2; - - // For numeric types, contains the original text representation of the value. - // For booleans, "true" or "false". - // For strings, contains the default text contents (not escaped in any way). - // For bytes, contains the C escaped value. All bytes >= 128 are escaped. - // TODO(kenton): Base-64 encode? - optional string default_value = 7; - - // If set, gives the index of a oneof in the containing type's oneof_decl - // list. This field is a member of that oneof. Extensions of a oneof should - // not set this since the oneof to which they belong will be inferred based - // on the extension range containing the extension's field number. - optional int32 oneof_index = 9; - - optional FieldOptions options = 8; -} - -// Describes a oneof. -message OneofDescriptorProto { - optional string name = 1; -} - -// Describes an enum type. -message EnumDescriptorProto { - optional string name = 1; - - repeated EnumValueDescriptorProto value = 2; - - optional EnumOptions options = 3; -} - -// Describes a value within an enum. -message EnumValueDescriptorProto { - optional string name = 1; - optional int32 number = 2; - - optional EnumValueOptions options = 3; -} - -// Describes a service. -message ServiceDescriptorProto { - optional string name = 1; - repeated MethodDescriptorProto method = 2; - - optional ServiceOptions options = 3; -} - -// Describes a method of a service. -message MethodDescriptorProto { - optional string name = 1; - - // Input and output type names. These are resolved in the same way as - // FieldDescriptorProto.type_name, but must refer to a message type. - optional string input_type = 2; - optional string output_type = 3; - - optional MethodOptions options = 4; - - // Identifies if client streams multiple client messages - optional bool client_streaming = 5 [default=false]; - // Identifies if server streams multiple server messages - optional bool server_streaming = 6 [default=false]; -} - - -// =================================================================== -// Options - -// Each of the definitions above may have "options" attached. These are -// just annotations which may cause code to be generated slightly differently -// or may contain hints for code that manipulates protocol messages. -// -// Clients may define custom options as extensions of the *Options messages. -// These extensions may not yet be known at parsing time, so the parser cannot -// store the values in them. Instead it stores them in a field in the *Options -// message called uninterpreted_option. This field must have the same name -// across all *Options messages. We then use this field to populate the -// extensions when we build a descriptor, at which point all protos have been -// parsed and so all extensions are known. -// -// Extension numbers for custom options may be chosen as follows: -// * For options which will only be used within a single application or -// organization, or for experimental options, use field numbers 50000 -// through 99999. It is up to you to ensure that you do not use the -// same number for multiple options. -// * For options which will be published and used publicly by multiple -// independent entities, e-mail protobuf-global-extension-registry@google.com -// to reserve extension numbers. Simply provide your project name (e.g. -// Object-C plugin) and your porject website (if available) -- there's no need -// to explain how you intend to use them. Usually you only need one extension -// number. You can declare multiple options with only one extension number by -// putting them in a sub-message. See the Custom Options section of the docs -// for examples: -// https://developers.google.com/protocol-buffers/docs/proto#options -// If this turns out to be popular, a web service will be set up -// to automatically assign option numbers. - - -message FileOptions { - - // Sets the Java package where classes generated from this .proto will be - // placed. By default, the proto package is used, but this is often - // inappropriate because proto packages do not normally start with backwards - // domain names. - optional string java_package = 1; - - - // If set, all the classes from the .proto file are wrapped in a single - // outer class with the given name. This applies to both Proto1 - // (equivalent to the old "--one_java_file" option) and Proto2 (where - // a .proto always translates to a single class, but you may want to - // explicitly choose the class name). - optional string java_outer_classname = 8; - - // If set true, then the Java code generator will generate a separate .java - // file for each top-level message, enum, and service defined in the .proto - // file. Thus, these types will *not* be nested inside the outer class - // named by java_outer_classname. However, the outer class will still be - // generated to contain the file's getDescriptor() method as well as any - // top-level extensions defined in the file. - optional bool java_multiple_files = 10 [default=false]; - - // If set true, then the Java code generator will generate equals() and - // hashCode() methods for all messages defined in the .proto file. - // - In the full runtime, this is purely a speed optimization, as the - // AbstractMessage base class includes reflection-based implementations of - // these methods. - //- In the lite runtime, setting this option changes the semantics of - // equals() and hashCode() to more closely match those of the full runtime; - // the generated methods compute their results based on field values rather - // than object identity. (Implementations should not assume that hashcodes - // will be consistent across runtimes or versions of the protocol compiler.) - optional bool java_generate_equals_and_hash = 20 [default=false]; - - // If set true, then the Java2 code generator will generate code that - // throws an exception whenever an attempt is made to assign a non-UTF-8 - // byte sequence to a string field. - // Message reflection will do the same. - // However, an extension field still accepts non-UTF-8 byte sequences. - // This option has no effect on when used with the lite runtime. - optional bool java_string_check_utf8 = 27 [default=false]; - - - // Generated classes can be optimized for speed or code size. - enum OptimizeMode { - SPEED = 1; // Generate complete code for parsing, serialization, - // etc. - CODE_SIZE = 2; // Use ReflectionOps to implement these methods. - LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. - } - optional OptimizeMode optimize_for = 9 [default=SPEED]; - - // Sets the Go package where structs generated from this .proto will be - // placed. If omitted, the Go package will be derived from the following: - // - The basename of the package import path, if provided. - // - Otherwise, the package statement in the .proto file, if present. - // - Otherwise, the basename of the .proto file, without extension. - optional string go_package = 11; - - - - // Should generic services be generated in each language? "Generic" services - // are not specific to any particular RPC system. They are generated by the - // main code generators in each language (without additional plugins). - // Generic services were the only kind of service generation supported by - // early versions of google.protobuf. - // - // Generic services are now considered deprecated in favor of using plugins - // that generate code specific to your particular RPC system. Therefore, - // these default to false. Old code which depends on generic services should - // explicitly set them to true. - optional bool cc_generic_services = 16 [default=false]; - optional bool java_generic_services = 17 [default=false]; - optional bool py_generic_services = 18 [default=false]; - - // Is this file deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for everything in the file, or it will be completely ignored; in the very - // least, this is a formalization for deprecating files. - optional bool deprecated = 23 [default=false]; - - - // Enables the use of arenas for the proto messages in this file. This applies - // only to generated classes for C++. - optional bool cc_enable_arenas = 31 [default=false]; - - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message MessageOptions { - // Set true to use the old proto1 MessageSet wire format for extensions. - // This is provided for backwards-compatibility with the MessageSet wire - // format. You should not use this for any other reason: It's less - // efficient, has fewer features, and is more complicated. - // - // The message must be defined exactly as follows: - // message Foo { - // option message_set_wire_format = true; - // extensions 4 to max; - // } - // Note that the message cannot have any defined fields; MessageSets only - // have extensions. - // - // All extensions of your type must be singular messages; e.g. they cannot - // be int32s, enums, or repeated messages. - // - // Because this is an option, the above two restrictions are not enforced by - // the protocol compiler. - optional bool message_set_wire_format = 1 [default=false]; - - // Disables the generation of the standard "descriptor()" accessor, which can - // conflict with a field of the same name. This is meant to make migration - // from proto1 easier; new code should avoid fields named "descriptor". - optional bool no_standard_descriptor_accessor = 2 [default=false]; - - // Is this message deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the message, or it will be completely ignored; in the very least, - // this is a formalization for deprecating messages. - optional bool deprecated = 3 [default=false]; - - // Whether the message is an automatically generated map entry type for the - // maps field. - // - // For maps fields: - // map map_field = 1; - // The parsed descriptor looks like: - // message MapFieldEntry { - // option map_entry = true; - // optional KeyType key = 1; - // optional ValueType value = 2; - // } - // repeated MapFieldEntry map_field = 1; - // - // Implementations may choose not to generate the map_entry=true message, but - // use a native map in the target language to hold the keys and values. - // The reflection APIs in such implementions still need to work as - // if the field is a repeated message field. - // - // NOTE: Do not set the option in .proto files. Always use the maps syntax - // instead. The option should only be implicitly set by the proto compiler - // parser. - optional bool map_entry = 7; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message FieldOptions { - // The ctype option instructs the C++ code generator to use a different - // representation of the field than it normally would. See the specific - // options below. This option is not yet implemented in the open source - // release -- sorry, we'll try to include it in a future version! - optional CType ctype = 1 [default = STRING]; - enum CType { - // Default mode. - STRING = 0; - - CORD = 1; - - STRING_PIECE = 2; - } - // The packed option can be enabled for repeated primitive fields to enable - // a more efficient representation on the wire. Rather than repeatedly - // writing the tag and type for each element, the entire array is encoded as - // a single length-delimited blob. - optional bool packed = 2; - - - - // Should this field be parsed lazily? Lazy applies only to message-type - // fields. It means that when the outer message is initially parsed, the - // inner message's contents will not be parsed but instead stored in encoded - // form. The inner message will actually be parsed when it is first accessed. - // - // This is only a hint. Implementations are free to choose whether to use - // eager or lazy parsing regardless of the value of this option. However, - // setting this option true suggests that the protocol author believes that - // using lazy parsing on this field is worth the additional bookkeeping - // overhead typically needed to implement it. - // - // This option does not affect the public interface of any generated code; - // all method signatures remain the same. Furthermore, thread-safety of the - // interface is not affected by this option; const methods remain safe to - // call from multiple threads concurrently, while non-const methods continue - // to require exclusive access. - // - // - // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outher message - // may return true even if the inner message has missing required fields. - // This is necessary because otherwise the inner message would have to be - // parsed in order to perform the check, defeating the purpose of lazy - // parsing. An implementation which chooses not to check required fields - // must be consistent about it. That is, for any particular sub-message, the - // implementation must either *always* check its required fields, or *never* - // check its required fields, regardless of whether or not the message has - // been parsed. - optional bool lazy = 5 [default=false]; - - // Is this field deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for accessors, or it will be completely ignored; in the very least, this - // is a formalization for deprecating fields. - optional bool deprecated = 3 [default=false]; - - // For Google-internal migration only. Do not use. - optional bool weak = 10 [default=false]; - - - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumOptions { - - // Set this option to true to allow mapping different tag names to the same - // value. - optional bool allow_alias = 2; - - // Is this enum deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum, or it will be completely ignored; in the very least, this - // is a formalization for deprecating enums. - optional bool deprecated = 3 [default=false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumValueOptions { - // Is this enum value deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum value, or it will be completely ignored; in the very least, - // this is a formalization for deprecating enum values. - optional bool deprecated = 1 [default=false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message ServiceOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this service deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the service, or it will be completely ignored; in the very least, - // this is a formalization for deprecating services. - optional bool deprecated = 33 [default=false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message MethodOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this method deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the method, or it will be completely ignored; in the very least, - // this is a formalization for deprecating methods. - optional bool deprecated = 33 [default=false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - - -// A message representing a option the parser does not recognize. This only -// appears in options protos created by the compiler::Parser class. -// DescriptorPool resolves these when building Descriptor objects. Therefore, -// options protos in descriptor objects (e.g. returned by Descriptor::options(), -// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -// in them. -message UninterpretedOption { - // The name of the uninterpreted option. Each string represents a segment in - // a dot-separated name. is_extension is true iff a segment represents an - // extension (denoted with parentheses in options specs in .proto files). - // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - // "foo.(bar.baz).qux". - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } - repeated NamePart name = 2; - - // The value of the uninterpreted option, in whatever type the tokenizer - // identified it as during parsing. Exactly one of these should be set. - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; -} - -// =================================================================== -// Optional source code info - -// Encapsulates information about the original source file from which a -// FileDescriptorProto was generated. -message SourceCodeInfo { - // A Location identifies a piece of source code in a .proto file which - // corresponds to a particular definition. This information is intended - // to be useful to IDEs, code indexers, documentation generators, and similar - // tools. - // - // For example, say we have a file like: - // message Foo { - // optional string foo = 1; - // } - // Let's look at just the field definition: - // optional string foo = 1; - // ^ ^^ ^^ ^ ^^^ - // a bc de f ghi - // We have the following locations: - // span path represents - // [a,i) [ 4, 0, 2, 0 ] The whole field definition. - // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - // - // Notes: - // - A location may refer to a repeated field itself (i.e. not to any - // particular index within it). This is used whenever a set of elements are - // logically enclosed in a single code segment. For example, an entire - // extend block (possibly containing multiple extension definitions) will - // have an outer location whose path refers to the "extensions" repeated - // field without an index. - // - Multiple locations may have the same path. This happens when a single - // logical declaration is spread out across multiple places. The most - // obvious example is the "extend" block again -- there may be multiple - // extend blocks in the same scope, each of which will have the same path. - // - A location's span is not always a subset of its parent's span. For - // example, the "extendee" of an extension declaration appears at the - // beginning of the "extend" block and is shared by all extensions within - // the block. - // - Just because a location's span is a subset of some other location's span - // does not mean that it is a descendent. For example, a "group" defines - // both a type and a field in a single declaration. Thus, the locations - // corresponding to the type and field and their components will overlap. - // - Code which tries to interpret locations should probably be designed to - // ignore those that it doesn't understand, as more types of locations could - // be recorded in the future. - repeated Location location = 1; - message Location { - // Identifies which part of the FileDescriptorProto was defined at this - // location. - // - // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition. For - // example, this path: - // [ 4, 3, 2, 7, 1 ] - // refers to: - // file.message_type(3) // 4, 3 - // .field(7) // 2, 7 - // .name() // 1 - // This is because FileDescriptorProto.message_type has field number 4: - // repeated DescriptorProto message_type = 4; - // and DescriptorProto.field has field number 2: - // repeated FieldDescriptorProto field = 2; - // and FieldDescriptorProto.name has field number 1: - // optional string name = 1; - // - // Thus, the above path gives the location of a field name. If we removed - // the last element: - // [ 4, 3, 2, 7 ] - // this path refers to the whole field declaration (from the beginning - // of the label to the terminating semicolon). - repeated int32 path = 1 [packed=true]; - - // Always has exactly three or four elements: start line, start column, - // end line (optional, otherwise assumed same as start line), end column. - // These are packed into a single field for efficiency. Note that line - // and column numbers are zero-based -- typically you will want to add - // 1 to each before displaying to a user. - repeated int32 span = 2 [packed=true]; - - // If this SourceCodeInfo represents a complete declaration, these are any - // comments appearing before and after the declaration which appear to be - // attached to the declaration. - // - // A series of line comments appearing on consecutive lines, with no other - // tokens appearing on those lines, will be treated as a single comment. - // - // Only the comment content is provided; comment markers (e.g. //) are - // stripped out. For block comments, leading whitespace and an asterisk - // will be stripped from the beginning of each line other than the first. - // Newlines are included in the output. - // - // Examples: - // - // optional int32 foo = 1; // Comment attached to foo. - // // Comment attached to bar. - // optional int32 bar = 2; - // - // optional string baz = 3; - // // Comment attached to baz. - // // Another line attached to baz. - // - // // Comment attached to qux. - // // - // // Another line attached to qux. - // optional double qux = 4; - // - // optional string corge = 5; - // /* Block comment attached - // * to corge. Leading asterisks - // * will be removed. */ - // /* Block comment attached to - // * grault. */ - // optional int32 grault = 6; - optional string leading_comments = 3; - optional string trailing_comments = 4; - } -} diff --git a/third_party/nanopb/generator/proto/nanopb.proto b/third_party/nanopb/generator/proto/nanopb.proto deleted file mode 100644 index 8aab19a1b5e..00000000000 --- a/third_party/nanopb/generator/proto/nanopb.proto +++ /dev/null @@ -1,98 +0,0 @@ -// Custom options for defining: -// - Maximum size of string/bytes -// - Maximum number of elements in array -// -// These are used by nanopb to generate statically allocable structures -// for memory-limited environments. - -syntax = "proto2"; -import "google/protobuf/descriptor.proto"; - -option java_package = "fi.kapsi.koti.jpa.nanopb"; - -enum FieldType { - FT_DEFAULT = 0; // Automatically decide field type, generate static field if possible. - FT_CALLBACK = 1; // Always generate a callback field. - FT_POINTER = 4; // Always generate a dynamically allocated field. - FT_STATIC = 2; // Generate a static field or raise an exception if not possible. - FT_IGNORE = 3; // Ignore the field completely. - FT_INLINE = 5; // Always generate an inline array of fixed size. -} - -enum IntSize { - IS_DEFAULT = 0; // Default, 32/64bit based on type in .proto - IS_8 = 8; - IS_16 = 16; - IS_32 = 32; - IS_64 = 64; -} - -// This is the inner options message, which basically defines options for -// a field. When it is used in message or file scope, it applies to all -// fields. -message NanoPBOptions { - // Allocated size for 'bytes' and 'string' fields. - optional int32 max_size = 1; - - // Allocated number of entries in arrays ('repeated' fields) - optional int32 max_count = 2; - - // Size of integer fields. Can save some memory if you don't need - // full 32 bits for the value. - optional IntSize int_size = 7 [default = IS_DEFAULT]; - - // Force type of field (callback or static allocation) - optional FieldType type = 3 [default = FT_DEFAULT]; - - // Use long names for enums, i.e. EnumName_EnumValue. - optional bool long_names = 4 [default = true]; - - // Add 'packed' attribute to generated structs. - // Note: this cannot be used on CPUs that break on unaligned - // accesses to variables. - optional bool packed_struct = 5 [default = false]; - - // Add 'packed' attribute to generated enums. - optional bool packed_enum = 10 [default = false]; - - // Skip this message - optional bool skip_message = 6 [default = false]; - - // Generate oneof fields as normal optional fields instead of union. - optional bool no_unions = 8 [default = false]; - - // integer type tag for a message - optional uint32 msgid = 9; - - // decode oneof as anonymous union - optional bool anonymous_oneof = 11 [default = false]; -} - -// Extensions to protoc 'Descriptor' type in order to define options -// inside a .proto file. -// -// Protocol Buffers extension number registry -// -------------------------------- -// Project: Nanopb -// Contact: Petteri Aimonen -// Web site: http://kapsi.fi/~jpa/nanopb -// Extensions: 1010 (all types) -// -------------------------------- - -extend google.protobuf.FileOptions { - optional NanoPBOptions nanopb_fileopt = 1010; -} - -extend google.protobuf.MessageOptions { - optional NanoPBOptions nanopb_msgopt = 1010; -} - -extend google.protobuf.EnumOptions { - optional NanoPBOptions nanopb_enumopt = 1010; -} - -extend google.protobuf.FieldOptions { - optional NanoPBOptions nanopb = 1010; -} - - diff --git a/third_party/nanopb/generator/proto/plugin.proto b/third_party/nanopb/generator/proto/plugin.proto deleted file mode 100644 index e627289b53e..00000000000 --- a/third_party/nanopb/generator/proto/plugin.proto +++ /dev/null @@ -1,148 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - -// Author: kenton@google.com (Kenton Varda) -// -// WARNING: The plugin interface is currently EXPERIMENTAL and is subject to -// change. -// -// protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is -// just a program that reads a CodeGeneratorRequest from stdin and writes a -// CodeGeneratorResponse to stdout. -// -// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead -// of dealing with the raw protocol defined here. -// -// A plugin executable needs only to be placed somewhere in the path. The -// plugin should be named "protoc-gen-$NAME", and will then be used when the -// flag "--${NAME}_out" is passed to protoc. - -syntax = "proto2"; -package google.protobuf.compiler; -option java_package = "com.google.protobuf.compiler"; -option java_outer_classname = "PluginProtos"; - -import "google/protobuf/descriptor.proto"; - -// An encoded CodeGeneratorRequest is written to the plugin's stdin. -message CodeGeneratorRequest { - // The .proto files that were explicitly listed on the command-line. The - // code generator should generate code only for these files. Each file's - // descriptor will be included in proto_file, below. - repeated string file_to_generate = 1; - - // The generator parameter passed on the command-line. - optional string parameter = 2; - - // FileDescriptorProtos for all files in files_to_generate and everything - // they import. The files will appear in topological order, so each file - // appears before any file that imports it. - // - // protoc guarantees that all proto_files will be written after - // the fields above, even though this is not technically guaranteed by the - // protobuf wire format. This theoretically could allow a plugin to stream - // in the FileDescriptorProtos and handle them one by one rather than read - // the entire set into memory at once. However, as of this writing, this - // is not similarly optimized on protoc's end -- it will store all fields in - // memory at once before sending them to the plugin. - repeated FileDescriptorProto proto_file = 15; -} - -// The plugin writes an encoded CodeGeneratorResponse to stdout. -message CodeGeneratorResponse { - // Error message. If non-empty, code generation failed. The plugin process - // should exit with status code zero even if it reports an error in this way. - // - // This should be used to indicate errors in .proto files which prevent the - // code generator from generating correct code. Errors which indicate a - // problem in protoc itself -- such as the input CodeGeneratorRequest being - // unparseable -- should be reported by writing a message to stderr and - // exiting with a non-zero status code. - optional string error = 1; - - // Represents a single generated file. - message File { - // The file name, relative to the output directory. The name must not - // contain "." or ".." components and must be relative, not be absolute (so, - // the file cannot lie outside the output directory). "/" must be used as - // the path separator, not "\". - // - // If the name is omitted, the content will be appended to the previous - // file. This allows the generator to break large files into small chunks, - // and allows the generated text to be streamed back to protoc so that large - // files need not reside completely in memory at one time. Note that as of - // this writing protoc does not optimize for this -- it will read the entire - // CodeGeneratorResponse before writing files to disk. - optional string name = 1; - - // If non-empty, indicates that the named file should already exist, and the - // content here is to be inserted into that file at a defined insertion - // point. This feature allows a code generator to extend the output - // produced by another code generator. The original generator may provide - // insertion points by placing special annotations in the file that look - // like: - // @@protoc_insertion_point(NAME) - // The annotation can have arbitrary text before and after it on the line, - // which allows it to be placed in a comment. NAME should be replaced with - // an identifier naming the point -- this is what other generators will use - // as the insertion_point. Code inserted at this point will be placed - // immediately above the line containing the insertion point (thus multiple - // insertions to the same point will come out in the order they were added). - // The double-@ is intended to make it unlikely that the generated code - // could contain things that look like insertion points by accident. - // - // For example, the C++ code generator places the following line in the - // .pb.h files that it generates: - // // @@protoc_insertion_point(namespace_scope) - // This line appears within the scope of the file's package namespace, but - // outside of any particular class. Another plugin can then specify the - // insertion_point "namespace_scope" to generate additional classes or - // other declarations that should be placed in this scope. - // - // Note that if the line containing the insertion point begins with - // whitespace, the same whitespace will be added to every line of the - // inserted text. This is useful for languages like Python, where - // indentation matters. In these languages, the insertion point comment - // should be indented the same amount as any inserted code will need to be - // in order to work correctly in that context. - // - // The code generator that generates the initial file and the one which - // inserts into it must both run as part of a single invocation of protoc. - // Code generators are executed in the order in which they appear on the - // command line. - // - // If |insertion_point| is present, |name| must also be present. - optional string insertion_point = 2; - - // The file contents. - optional string content = 15; - } - repeated File file = 15; -} diff --git a/third_party/nanopb/generator/protoc-gen-nanopb b/third_party/nanopb/generator/protoc-gen-nanopb deleted file mode 100755 index 358f97cf2ae..00000000000 --- a/third_party/nanopb/generator/protoc-gen-nanopb +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# This file is used to invoke nanopb_generator.py as a plugin -# to protoc on Linux and other *nix-style systems. -# Use it like this: -# protoc --plugin=nanopb=..../protoc-gen-nanopb --nanopb_out=dir foo.proto -# -# Note that if you use the binary package of nanopb, the protoc -# path is already set up properly and there is no need to give -# --plugin= on the command line. - -MYPATH=$(dirname "$0") -exec "$MYPATH/nanopb_generator.py" --protoc-plugin diff --git a/third_party/nanopb/generator/protoc-gen-nanopb.bat b/third_party/nanopb/generator/protoc-gen-nanopb.bat deleted file mode 100644 index 7624984e588..00000000000 --- a/third_party/nanopb/generator/protoc-gen-nanopb.bat +++ /dev/null @@ -1,12 +0,0 @@ -@echo off -:: This file is used to invoke nanopb_generator.py as a plugin -:: to protoc on Windows. -:: Use it like this: -:: protoc --plugin=nanopb=..../protoc-gen-nanopb.bat --nanopb_out=dir foo.proto -:: -:: Note that if you use the binary package of nanopb, the protoc -:: path is already set up properly and there is no need to give -:: --plugin= on the command line. - -set mydir=%~dp0 -python "%mydir%\nanopb_generator.py" --protoc-plugin diff --git a/third_party/nanopb/library.json b/third_party/nanopb/library.json deleted file mode 100644 index 30a56c94df2..00000000000 --- a/third_party/nanopb/library.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "Nanopb", - "keywords": "protocol buffers, protobuf, google", - "description": "Nanopb is a plain-C implementation of Google's Protocol Buffers data format. It is targeted at 32 bit microcontrollers, but is also fit for other embedded systems with tight (2-10 kB ROM, <1 kB RAM) memory constraints.", - "repository": { - "type": "git", - "url": "https://github.com/nanopb/nanopb.git" - }, - "authors": [{ - "name": "Petteri Aimonen", - "email": "jpa@nanopb.mail.kapsi.fi", - "url": "http://koti.kapsi.fi/jpa/nanopb/" - }], - "include": [ - "*.c", - "*.cpp", - "*.h" - ], - "examples": "examples/*/*.c", - "frameworks": "*", - "platforms": "*" -} diff --git a/third_party/nanopb/pb.h b/third_party/nanopb/pb.h deleted file mode 100644 index 62dca73f4fd..00000000000 --- a/third_party/nanopb/pb.h +++ /dev/null @@ -1,579 +0,0 @@ -/* Common parts of the nanopb library. Most of these are quite low-level - * stuff. For the high-level interface, see pb_encode.h and pb_decode.h. - */ - -#ifndef PB_H_INCLUDED -#define PB_H_INCLUDED - -/***************************************************************** - * Nanopb compilation time options. You can change these here by * - * uncommenting the lines, or on the compiler command line. * - *****************************************************************/ - -/* Enable support for dynamically allocated fields */ -/* #define PB_ENABLE_MALLOC 1 */ - -/* Define this if your CPU / compiler combination does not support - * unaligned memory access to packed structures. */ -/* #define PB_NO_PACKED_STRUCTS 1 */ - -/* Increase the number of required fields that are tracked. - * A compiler warning will tell if you need this. */ -/* #define PB_MAX_REQUIRED_FIELDS 256 */ - -/* Add support for tag numbers > 255 and fields larger than 255 bytes. */ -/* #define PB_FIELD_16BIT 1 */ - -/* Add support for tag numbers > 65536 and fields larger than 65536 bytes. */ -/* #define PB_FIELD_32BIT 1 */ - -/* Disable support for error messages in order to save some code space. */ -/* #define PB_NO_ERRMSG 1 */ - -/* Disable support for custom streams (support only memory buffers). */ -/* #define PB_BUFFER_ONLY 1 */ - -/* Switch back to the old-style callback function signature. - * This was the default until nanopb-0.2.1. */ -/* #define PB_OLD_CALLBACK_STYLE */ - - -/****************************************************************** - * You usually don't need to change anything below this line. * - * Feel free to look around and use the defined macros, though. * - ******************************************************************/ - - -/* Version of the nanopb library. Just in case you want to check it in - * your own program. */ -#define NANOPB_VERSION nanopb-0.3.7-dev - -/* Include all the system headers needed by nanopb. You will need the - * definitions of the following: - * - strlen, memcpy, memset functions - * - [u]int_least8_t, uint_fast8_t, [u]int_least16_t, [u]int32_t, [u]int64_t - * - size_t - * - bool - * - * If you don't have the standard header files, you can instead provide - * a custom header that defines or includes all this. In that case, - * define PB_SYSTEM_HEADER to the path of this file. - */ -#ifdef PB_SYSTEM_HEADER -#include PB_SYSTEM_HEADER -#else -#include -#include -#include -#include - -#ifdef PB_ENABLE_MALLOC -#include -#endif -#endif - -/* Macro for defining packed structures (compiler dependent). - * This just reduces memory requirements, but is not required. - */ -#if defined(PB_NO_PACKED_STRUCTS) - /* Disable struct packing */ -# define PB_PACKED_STRUCT_START -# define PB_PACKED_STRUCT_END -# define pb_packed -#elif defined(__GNUC__) || defined(__clang__) - /* For GCC and clang */ -# define PB_PACKED_STRUCT_START -# define PB_PACKED_STRUCT_END -# define pb_packed __attribute__((packed)) -#elif defined(__ICCARM__) || defined(__CC_ARM) - /* For IAR ARM and Keil MDK-ARM compilers */ -# define PB_PACKED_STRUCT_START _Pragma("pack(push, 1)") -# define PB_PACKED_STRUCT_END _Pragma("pack(pop)") -# define pb_packed -#elif defined(_MSC_VER) && (_MSC_VER >= 1500) - /* For Microsoft Visual C++ */ -# define PB_PACKED_STRUCT_START __pragma(pack(push, 1)) -# define PB_PACKED_STRUCT_END __pragma(pack(pop)) -# define pb_packed -#else - /* Unknown compiler */ -# define PB_PACKED_STRUCT_START -# define PB_PACKED_STRUCT_END -# define pb_packed -#endif - -/* Handly macro for suppressing unreferenced-parameter compiler warnings. */ -#ifndef PB_UNUSED -#define PB_UNUSED(x) (void)(x) -#endif - -/* Compile-time assertion, used for checking compatible compilation options. - * If this does not work properly on your compiler, use - * #define PB_NO_STATIC_ASSERT to disable it. - * - * But before doing that, check carefully the error message / place where it - * comes from to see if the error has a real cause. Unfortunately the error - * message is not always very clear to read, but you can see the reason better - * in the place where the PB_STATIC_ASSERT macro was called. - */ -#ifndef PB_NO_STATIC_ASSERT -#ifndef PB_STATIC_ASSERT -#define PB_STATIC_ASSERT(COND,MSG) typedef char PB_STATIC_ASSERT_MSG(MSG, __LINE__, __COUNTER__)[(COND)?1:-1]; -#define PB_STATIC_ASSERT_MSG(MSG, LINE, COUNTER) PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) -#define PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) pb_static_assertion_##MSG##LINE##COUNTER -#endif -#else -#define PB_STATIC_ASSERT(COND,MSG) -#endif - -/* Number of required fields to keep track of. */ -#ifndef PB_MAX_REQUIRED_FIELDS -#define PB_MAX_REQUIRED_FIELDS 64 -#endif - -#if PB_MAX_REQUIRED_FIELDS < 64 -#error You should not lower PB_MAX_REQUIRED_FIELDS from the default value (64). -#endif - -/* List of possible field types. These are used in the autogenerated code. - * Least-significant 4 bits tell the scalar type - * Most-significant 4 bits specify repeated/required/packed etc. - */ - -typedef uint_least8_t pb_type_t; - -/**** Field data types ****/ - -/* Numeric types */ -#define PB_LTYPE_VARINT 0x00 /* int32, int64, enum, bool */ -#define PB_LTYPE_UVARINT 0x01 /* uint32, uint64 */ -#define PB_LTYPE_SVARINT 0x02 /* sint32, sint64 */ -#define PB_LTYPE_FIXED32 0x03 /* fixed32, sfixed32, float */ -#define PB_LTYPE_FIXED64 0x04 /* fixed64, sfixed64, double */ - -/* Marker for last packable field type. */ -#define PB_LTYPE_LAST_PACKABLE 0x04 - -/* Byte array with pre-allocated buffer. - * data_size is the length of the allocated PB_BYTES_ARRAY structure. */ -#define PB_LTYPE_BYTES 0x05 - -/* String with pre-allocated buffer. - * data_size is the maximum length. */ -#define PB_LTYPE_STRING 0x06 - -/* Submessage - * submsg_fields is pointer to field descriptions */ -#define PB_LTYPE_SUBMESSAGE 0x07 - -/* Extension pseudo-field - * The field contains a pointer to pb_extension_t */ -#define PB_LTYPE_EXTENSION 0x08 - -/* Byte array with inline, pre-allocated byffer. - * data_size is the length of the inline, allocated buffer. - * This differs from PB_LTYPE_BYTES by defining the element as - * pb_byte_t[data_size] rather than pb_bytes_array_t. */ -#define PB_LTYPE_FIXED_LENGTH_BYTES 0x09 - -/* Number of declared LTYPES */ -#define PB_LTYPES_COUNT 0x0A -#define PB_LTYPE_MASK 0x0F - -/**** Field repetition rules ****/ - -#define PB_HTYPE_REQUIRED 0x00 -#define PB_HTYPE_OPTIONAL 0x10 -#define PB_HTYPE_REPEATED 0x20 -#define PB_HTYPE_ONEOF 0x30 -#define PB_HTYPE_MASK 0x30 - -/**** Field allocation types ****/ - -#define PB_ATYPE_STATIC 0x00 -#define PB_ATYPE_POINTER 0x80 -#define PB_ATYPE_CALLBACK 0x40 -#define PB_ATYPE_MASK 0xC0 - -#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK) -#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK) -#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK) - -/* Data type used for storing sizes of struct fields - * and array counts. - */ -#if defined(PB_FIELD_32BIT) - typedef uint32_t pb_size_t; - typedef int32_t pb_ssize_t; -#elif defined(PB_FIELD_16BIT) - typedef uint_least16_t pb_size_t; - typedef int_least16_t pb_ssize_t; -#else - typedef uint_least8_t pb_size_t; - typedef int_least8_t pb_ssize_t; -#endif -#define PB_SIZE_MAX ((pb_size_t)-1) - -/* Data type for storing encoded data and other byte streams. - * This typedef exists to support platforms where uint8_t does not exist. - * You can regard it as equivalent on uint8_t on other platforms. - */ -typedef uint_least8_t pb_byte_t; - -/* This structure is used in auto-generated constants - * to specify struct fields. - * You can change field sizes if you need structures - * larger than 256 bytes or field tags larger than 256. - * The compiler should complain if your .proto has such - * structures. Fix that by defining PB_FIELD_16BIT or - * PB_FIELD_32BIT. - */ -PB_PACKED_STRUCT_START -typedef struct pb_field_s pb_field_t; -struct pb_field_s { - pb_size_t tag; - pb_type_t type; - pb_size_t data_offset; /* Offset of field data, relative to previous field. */ - pb_ssize_t size_offset; /* Offset of array size or has-boolean, relative to data */ - pb_size_t data_size; /* Data size in bytes for a single item */ - pb_size_t array_size; /* Maximum number of entries in array */ - - /* Field definitions for submessage - * OR default value for all other non-array, non-callback types - * If null, then field will zeroed. */ - const void *ptr; -} pb_packed; -PB_PACKED_STRUCT_END - -/* Make sure that the standard integer types are of the expected sizes. - * Otherwise fixed32/fixed64 fields can break. - * - * If you get errors here, it probably means that your stdint.h is not - * correct for your platform. - */ -PB_STATIC_ASSERT(sizeof(int64_t) == 2 * sizeof(int32_t), INT64_T_WRONG_SIZE) -PB_STATIC_ASSERT(sizeof(uint64_t) == 2 * sizeof(uint32_t), UINT64_T_WRONG_SIZE) - -/* This structure is used for 'bytes' arrays. - * It has the number of bytes in the beginning, and after that an array. - * Note that actual structs used will have a different length of bytes array. - */ -#define PB_BYTES_ARRAY_T(n) struct { pb_size_t size; pb_byte_t bytes[n]; } -#define PB_BYTES_ARRAY_T_ALLOCSIZE(n) ((size_t)n + offsetof(pb_bytes_array_t, bytes)) - -struct pb_bytes_array_s { - pb_size_t size; - pb_byte_t bytes[1]; -}; -typedef struct pb_bytes_array_s pb_bytes_array_t; - -/* This structure is used for giving the callback function. - * It is stored in the message structure and filled in by the method that - * calls pb_decode. - * - * The decoding callback will be given a limited-length stream - * If the wire type was string, the length is the length of the string. - * If the wire type was a varint/fixed32/fixed64, the length is the length - * of the actual value. - * The function may be called multiple times (especially for repeated types, - * but also otherwise if the message happens to contain the field multiple - * times.) - * - * The encoding callback will receive the actual output stream. - * It should write all the data in one call, including the field tag and - * wire type. It can write multiple fields. - * - * The callback can be null if you want to skip a field. - */ -typedef struct pb_istream_s pb_istream_t; -typedef struct pb_ostream_s pb_ostream_t; -typedef struct pb_callback_s pb_callback_t; -struct pb_callback_s { -#ifdef PB_OLD_CALLBACK_STYLE - /* Deprecated since nanopb-0.2.1 */ - union { - bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void *arg); - bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, const void *arg); - } funcs; -#else - /* New function signature, which allows modifying arg contents in callback. */ - union { - bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void **arg); - bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, void * const *arg); - } funcs; -#endif - - /* Free arg for use by callback */ - void *arg; -}; - -/* Wire types. Library user needs these only in encoder callbacks. */ -typedef enum { - PB_WT_VARINT = 0, - PB_WT_64BIT = 1, - PB_WT_STRING = 2, - PB_WT_32BIT = 5 -} pb_wire_type_t; - -/* Structure for defining the handling of unknown/extension fields. - * Usually the pb_extension_type_t structure is automatically generated, - * while the pb_extension_t structure is created by the user. However, - * if you want to catch all unknown fields, you can also create a custom - * pb_extension_type_t with your own callback. - */ -typedef struct pb_extension_type_s pb_extension_type_t; -typedef struct pb_extension_s pb_extension_t; -struct pb_extension_type_s { - /* Called for each unknown field in the message. - * If you handle the field, read off all of its data and return true. - * If you do not handle the field, do not read anything and return true. - * If you run into an error, return false. - * Set to NULL for default handler. - */ - bool (*decode)(pb_istream_t *stream, pb_extension_t *extension, - uint32_t tag, pb_wire_type_t wire_type); - - /* Called once after all regular fields have been encoded. - * If you have something to write, do so and return true. - * If you do not have anything to write, just return true. - * If you run into an error, return false. - * Set to NULL for default handler. - */ - bool (*encode)(pb_ostream_t *stream, const pb_extension_t *extension); - - /* Free field for use by the callback. */ - const void *arg; -}; - -struct pb_extension_s { - /* Type describing the extension field. Usually you'll initialize - * this to a pointer to the automatically generated structure. */ - const pb_extension_type_t *type; - - /* Destination for the decoded data. This must match the datatype - * of the extension field. */ - void *dest; - - /* Pointer to the next extension handler, or NULL. - * If this extension does not match a field, the next handler is - * automatically called. */ - pb_extension_t *next; - - /* The decoder sets this to true if the extension was found. - * Ignored for encoding. */ - bool found; -}; - -/* Memory allocation functions to use. You can define pb_realloc and - * pb_free to custom functions if you want. */ -#ifdef PB_ENABLE_MALLOC -# ifndef pb_realloc -# define pb_realloc(ptr, size) realloc(ptr, size) -# endif -# ifndef pb_free -# define pb_free(ptr) free(ptr) -# endif -#endif - -/* This is used to inform about need to regenerate .pb.h/.pb.c files. */ -#define PB_PROTO_HEADER_VERSION 30 - -/* These macros are used to declare pb_field_t's in the constant array. */ -/* Size of a structure member, in bytes. */ -#define pb_membersize(st, m) (sizeof ((st*)0)->m) -/* Number of entries in an array. */ -#define pb_arraysize(st, m) (pb_membersize(st, m) / pb_membersize(st, m[0])) -/* Delta from start of one member to the start of another member. */ -#define pb_delta(st, m1, m2) ((int)offsetof(st, m1) - (int)offsetof(st, m2)) -/* Marks the end of the field list */ -#define PB_LAST_FIELD {0,(pb_type_t) 0,0,0,0,0,0} - -/* Macros for filling in the data_offset field */ -/* data_offset for first field in a message */ -#define PB_DATAOFFSET_FIRST(st, m1, m2) (offsetof(st, m1)) -/* data_offset for subsequent fields */ -#define PB_DATAOFFSET_OTHER(st, m1, m2) (offsetof(st, m1) - offsetof(st, m2) - pb_membersize(st, m2)) -/* Choose first/other based on m1 == m2 (deprecated, remains for backwards compatibility) */ -#define PB_DATAOFFSET_CHOOSE(st, m1, m2) (int)(offsetof(st, m1) == offsetof(st, m2) \ - ? PB_DATAOFFSET_FIRST(st, m1, m2) \ - : PB_DATAOFFSET_OTHER(st, m1, m2)) - -/* Required fields are the simplest. They just have delta (padding) from - * previous field end, and the size of the field. Pointer is used for - * submessages and default values. - */ -#define PB_REQUIRED_STATIC(tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_STATIC | PB_HTYPE_REQUIRED | ltype, \ - fd, 0, pb_membersize(st, m), 0, ptr} - -/* Optional fields add the delta to the has_ variable. */ -#define PB_OPTIONAL_STATIC(tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | ltype, \ - fd, \ - pb_delta(st, has_ ## m, m), \ - pb_membersize(st, m), 0, ptr} - -/* Repeated fields have a _count field and also the maximum number of entries. */ -#define PB_REPEATED_STATIC(tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_STATIC | PB_HTYPE_REPEATED | ltype, \ - fd, \ - pb_delta(st, m ## _count, m), \ - pb_membersize(st, m[0]), \ - pb_arraysize(st, m), ptr} - -#define PB_REQUIRED_INLINE(tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_STATIC | PB_HTYPE_REQUIRED | PB_LTYPE_FIXED_LENGTH_BYTES, \ - fd, 0, pb_membersize(st, m), 0, ptr} - -/* Optional fields add the delta to the has_ variable. */ -#define PB_OPTIONAL_INLINE(tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | PB_LTYPE_FIXED_LENGTH_BYTES, \ - fd, \ - pb_delta(st, has_ ## m, m), \ - pb_membersize(st, m), 0, ptr} - -/* INLINE does not support REPEATED fields. */ - -/* Allocated fields carry the size of the actual data, not the pointer */ -#define PB_REQUIRED_POINTER(tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_POINTER | PB_HTYPE_REQUIRED | ltype, \ - fd, 0, pb_membersize(st, m[0]), 0, ptr} - -/* Optional fields don't need a has_ variable, as information would be redundant */ -#define PB_OPTIONAL_POINTER(tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_POINTER | PB_HTYPE_OPTIONAL | ltype, \ - fd, 0, pb_membersize(st, m[0]), 0, ptr} - -/* Repeated fields have a _count field and a pointer to array of pointers */ -#define PB_REPEATED_POINTER(tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_POINTER | PB_HTYPE_REPEATED | ltype, \ - fd, pb_delta(st, m ## _count, m), \ - pb_membersize(st, m[0]), 0, ptr} - -/* Callbacks are much like required fields except with special datatype. */ -#define PB_REQUIRED_CALLBACK(tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_CALLBACK | PB_HTYPE_REQUIRED | ltype, \ - fd, 0, pb_membersize(st, m), 0, ptr} - -#define PB_OPTIONAL_CALLBACK(tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_CALLBACK | PB_HTYPE_OPTIONAL | ltype, \ - fd, 0, pb_membersize(st, m), 0, ptr} - -#define PB_REPEATED_CALLBACK(tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_CALLBACK | PB_HTYPE_REPEATED | ltype, \ - fd, 0, pb_membersize(st, m), 0, ptr} - -/* Optional extensions don't have the has_ field, as that would be redundant. */ -#define PB_OPTEXT_STATIC(tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | ltype, \ - 0, \ - 0, \ - pb_membersize(st, m), 0, ptr} - -#define PB_OPTEXT_POINTER(tag, st, m, fd, ltype, ptr) \ - PB_OPTIONAL_POINTER(tag, st, m, fd, ltype, ptr) - -/* INLINE does not support OPTEXT. */ - -#define PB_OPTEXT_CALLBACK(tag, st, m, fd, ltype, ptr) \ - PB_OPTIONAL_CALLBACK(tag, st, m, fd, ltype, ptr) - -/* The mapping from protobuf types to LTYPEs is done using these macros. */ -#define PB_LTYPE_MAP_BOOL PB_LTYPE_VARINT -#define PB_LTYPE_MAP_BYTES PB_LTYPE_BYTES -#define PB_LTYPE_MAP_DOUBLE PB_LTYPE_FIXED64 -#define PB_LTYPE_MAP_ENUM PB_LTYPE_VARINT -#define PB_LTYPE_MAP_UENUM PB_LTYPE_UVARINT -#define PB_LTYPE_MAP_FIXED32 PB_LTYPE_FIXED32 -#define PB_LTYPE_MAP_FIXED64 PB_LTYPE_FIXED64 -#define PB_LTYPE_MAP_FLOAT PB_LTYPE_FIXED32 -#define PB_LTYPE_MAP_INT32 PB_LTYPE_VARINT -#define PB_LTYPE_MAP_INT64 PB_LTYPE_VARINT -#define PB_LTYPE_MAP_MESSAGE PB_LTYPE_SUBMESSAGE -#define PB_LTYPE_MAP_SFIXED32 PB_LTYPE_FIXED32 -#define PB_LTYPE_MAP_SFIXED64 PB_LTYPE_FIXED64 -#define PB_LTYPE_MAP_SINT32 PB_LTYPE_SVARINT -#define PB_LTYPE_MAP_SINT64 PB_LTYPE_SVARINT -#define PB_LTYPE_MAP_STRING PB_LTYPE_STRING -#define PB_LTYPE_MAP_UINT32 PB_LTYPE_UVARINT -#define PB_LTYPE_MAP_UINT64 PB_LTYPE_UVARINT -#define PB_LTYPE_MAP_EXTENSION PB_LTYPE_EXTENSION - -/* This is the actual macro used in field descriptions. - * It takes these arguments: - * - Field tag number - * - Field type: BOOL, BYTES, DOUBLE, ENUM, UENUM, FIXED32, FIXED64, - * FLOAT, INT32, INT64, MESSAGE, SFIXED32, SFIXED64 - * SINT32, SINT64, STRING, UINT32, UINT64 or EXTENSION - * - Field rules: REQUIRED, OPTIONAL or REPEATED - * - Allocation: STATIC, INLINE, or CALLBACK - * - Placement: FIRST or OTHER, depending on if this is the first field in structure. - * - Message name - * - Field name - * - Previous field name (or field name again for first field) - * - Pointer to default value or submsg fields. - */ - -#define PB_FIELD(tag, type, rules, allocation, placement, message, field, prevfield, ptr) \ - PB_ ## rules ## _ ## allocation(tag, message, field, \ - PB_DATAOFFSET_ ## placement(message, field, prevfield), \ - PB_LTYPE_MAP_ ## type, ptr) - -/* Field description for oneof fields. This requires taking into account the - * union name also, that's why a separate set of macros is needed. - */ -#define PB_ONEOF_STATIC(u, tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_STATIC | PB_HTYPE_ONEOF | ltype, \ - fd, pb_delta(st, which_ ## u, u.m), \ - pb_membersize(st, u.m), 0, ptr} - -#define PB_ONEOF_POINTER(u, tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_POINTER | PB_HTYPE_ONEOF | ltype, \ - fd, pb_delta(st, which_ ## u, u.m), \ - pb_membersize(st, u.m[0]), 0, ptr} - -/* INLINE does not support ONEOF. */ - -#define PB_ONEOF_FIELD(union_name, tag, type, rules, allocation, placement, message, field, prevfield, ptr) \ - PB_ONEOF_ ## allocation(union_name, tag, message, field, \ - PB_DATAOFFSET_ ## placement(message, union_name.field, prevfield), \ - PB_LTYPE_MAP_ ## type, ptr) - -#define PB_ANONYMOUS_ONEOF_STATIC(u, tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_STATIC | PB_HTYPE_ONEOF | ltype, \ - fd, pb_delta(st, which_ ## u, m), \ - pb_membersize(st, m), 0, ptr} - -#define PB_ANONYMOUS_ONEOF_POINTER(u, tag, st, m, fd, ltype, ptr) \ - {tag, PB_ATYPE_POINTER | PB_HTYPE_ONEOF | ltype, \ - fd, pb_delta(st, which_ ## u, m), \ - pb_membersize(st, m[0]), 0, ptr} - -#define PB_ANONYMOUS_ONEOF_FIELD(union_name, tag, type, rules, allocation, placement, message, field, prevfield, ptr) \ - PB_ANONYMOUS_ONEOF_ ## allocation(union_name, tag, message, field, \ - PB_DATAOFFSET_ ## placement(message, field, prevfield), \ - PB_LTYPE_MAP_ ## type, ptr) - -/* These macros are used for giving out error messages. - * They are mostly a debugging aid; the main error information - * is the true/false return value from functions. - * Some code space can be saved by disabling the error - * messages if not used. - * - * PB_SET_ERROR() sets the error message if none has been set yet. - * msg must be a constant string literal. - * PB_GET_ERROR() always returns a pointer to a string. - * PB_RETURN_ERROR() sets the error and returns false from current - * function. - */ -#ifdef PB_NO_ERRMSG -#define PB_SET_ERROR(stream, msg) PB_UNUSED(stream) -#define PB_GET_ERROR(stream) "(errmsg disabled)" -#else -#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg)) -#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)") -#endif - -#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false - -#endif diff --git a/third_party/nanopb/pb_common.c b/third_party/nanopb/pb_common.c deleted file mode 100644 index 385c0193f8a..00000000000 --- a/third_party/nanopb/pb_common.c +++ /dev/null @@ -1,97 +0,0 @@ -/* pb_common.c: Common support functions for pb_encode.c and pb_decode.c. - * - * 2014 Petteri Aimonen - */ - -#include "pb_common.h" - -bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct) -{ - iter->start = fields; - iter->pos = fields; - iter->required_field_index = 0; - iter->dest_struct = dest_struct; - iter->pData = (char*)dest_struct + iter->pos->data_offset; - iter->pSize = (char*)iter->pData + iter->pos->size_offset; - - return (iter->pos->tag != 0); -} - -bool pb_field_iter_next(pb_field_iter_t *iter) -{ - const pb_field_t *prev_field = iter->pos; - - if (prev_field->tag == 0) - { - /* Handle empty message types, where the first field is already the terminator. - * In other cases, the iter->pos never points to the terminator. */ - return false; - } - - iter->pos++; - - if (iter->pos->tag == 0) - { - /* Wrapped back to beginning, reinitialize */ - (void)pb_field_iter_begin(iter, iter->start, iter->dest_struct); - return false; - } - else - { - /* Increment the pointers based on previous field size */ - size_t prev_size = prev_field->data_size; - - if (PB_HTYPE(prev_field->type) == PB_HTYPE_ONEOF && - PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF) - { - /* Don't advance pointers inside unions */ - prev_size = 0; - iter->pData = (char*)iter->pData - prev_field->data_offset; - } - else if (PB_ATYPE(prev_field->type) == PB_ATYPE_STATIC && - PB_HTYPE(prev_field->type) == PB_HTYPE_REPEATED) - { - /* In static arrays, the data_size tells the size of a single entry and - * array_size is the number of entries */ - prev_size *= prev_field->array_size; - } - else if (PB_ATYPE(prev_field->type) == PB_ATYPE_POINTER) - { - /* Pointer fields always have a constant size in the main structure. - * The data_size only applies to the dynamically allocated area. */ - prev_size = sizeof(void*); - } - - if (PB_HTYPE(prev_field->type) == PB_HTYPE_REQUIRED) - { - /* Count the required fields, in order to check their presence in the - * decoder. */ - iter->required_field_index++; - } - - iter->pData = (char*)iter->pData + prev_size + iter->pos->data_offset; - iter->pSize = (char*)iter->pData + iter->pos->size_offset; - return true; - } -} - -bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag) -{ - const pb_field_t *start = iter->pos; - - do { - if (iter->pos->tag == tag && - PB_LTYPE(iter->pos->type) != PB_LTYPE_EXTENSION) - { - /* Found the wanted field */ - return true; - } - - (void)pb_field_iter_next(iter); - } while (iter->pos != start); - - /* Searched all the way back to start, and found nothing. */ - return false; -} - - diff --git a/third_party/nanopb/pb_common.h b/third_party/nanopb/pb_common.h deleted file mode 100644 index 60b3d374914..00000000000 --- a/third_party/nanopb/pb_common.h +++ /dev/null @@ -1,42 +0,0 @@ -/* pb_common.h: Common support functions for pb_encode.c and pb_decode.c. - * These functions are rarely needed by applications directly. - */ - -#ifndef PB_COMMON_H_INCLUDED -#define PB_COMMON_H_INCLUDED - -#include "pb.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Iterator for pb_field_t list */ -struct pb_field_iter_s { - const pb_field_t *start; /* Start of the pb_field_t array */ - const pb_field_t *pos; /* Current position of the iterator */ - unsigned required_field_index; /* Zero-based index that counts only the required fields */ - void *dest_struct; /* Pointer to start of the structure */ - void *pData; /* Pointer to current field value */ - void *pSize; /* Pointer to count/has field */ -}; -typedef struct pb_field_iter_s pb_field_iter_t; - -/* Initialize the field iterator structure to beginning. - * Returns false if the message type is empty. */ -bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct); - -/* Advance the iterator to the next field. - * Returns false when the iterator wraps back to the first field. */ -bool pb_field_iter_next(pb_field_iter_t *iter); - -/* Advance the iterator until it points at a field with the given tag. - * Returns false if no such field exists. */ -bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif - diff --git a/third_party/nanopb/pb_decode.c b/third_party/nanopb/pb_decode.c deleted file mode 100644 index 7a4e29a8fda..00000000000 --- a/third_party/nanopb/pb_decode.c +++ /dev/null @@ -1,1347 +0,0 @@ -/* pb_decode.c -- decode a protobuf using minimal resources - * - * 2011 Petteri Aimonen - */ - -/* Use the GCC warn_unused_result attribute to check that all return values - * are propagated correctly. On other compilers and gcc before 3.4.0 just - * ignore the annotation. - */ -#if !defined(__GNUC__) || ( __GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) - #define checkreturn -#else - #define checkreturn __attribute__((warn_unused_result)) -#endif - -#include "pb.h" -#include "pb_decode.h" -#include "pb_common.h" - -/************************************** - * Declarations internal to this file * - **************************************/ - -typedef bool (*pb_decoder_t)(pb_istream_t *stream, const pb_field_t *field, void *dest) checkreturn; - -static bool checkreturn buf_read(pb_istream_t *stream, pb_byte_t *buf, size_t count); -static bool checkreturn pb_decode_varint32(pb_istream_t *stream, uint32_t *dest); -static bool checkreturn read_raw_value(pb_istream_t *stream, pb_wire_type_t wire_type, pb_byte_t *buf, size_t *size); -static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter); -static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter); -static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter); -static void iter_from_extension(pb_field_iter_t *iter, pb_extension_t *extension); -static bool checkreturn default_extension_decoder(pb_istream_t *stream, pb_extension_t *extension, uint32_t tag, pb_wire_type_t wire_type); -static bool checkreturn decode_extension(pb_istream_t *stream, uint32_t tag, pb_wire_type_t wire_type, pb_field_iter_t *iter); -static bool checkreturn find_extension_field(pb_field_iter_t *iter); -static void pb_field_set_to_default(pb_field_iter_t *iter); -static void pb_message_set_to_defaults(const pb_field_t fields[], void *dest_struct); -static bool checkreturn pb_dec_varint(pb_istream_t *stream, const pb_field_t *field, void *dest); -static bool checkreturn pb_dec_uvarint(pb_istream_t *stream, const pb_field_t *field, void *dest); -static bool checkreturn pb_dec_svarint(pb_istream_t *stream, const pb_field_t *field, void *dest); -static bool checkreturn pb_dec_fixed32(pb_istream_t *stream, const pb_field_t *field, void *dest); -static bool checkreturn pb_dec_fixed64(pb_istream_t *stream, const pb_field_t *field, void *dest); -static bool checkreturn pb_dec_bytes(pb_istream_t *stream, const pb_field_t *field, void *dest); -static bool checkreturn pb_dec_string(pb_istream_t *stream, const pb_field_t *field, void *dest); -static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_t *field, void *dest); -static bool checkreturn pb_skip_varint(pb_istream_t *stream); -static bool checkreturn pb_skip_string(pb_istream_t *stream); - -#ifdef PB_ENABLE_MALLOC -static bool checkreturn allocate_field(pb_istream_t *stream, void *pData, size_t data_size, size_t array_size); -static bool checkreturn pb_release_union_field(pb_istream_t *stream, pb_field_iter_t *iter); -static void pb_release_single_field(const pb_field_iter_t *iter); -#endif - -/* --- Function pointers to field decoders --- - * Order in the array must match pb_action_t LTYPE numbering. - */ -static const pb_decoder_t PB_DECODERS[PB_LTYPES_COUNT] = { - &pb_dec_varint, - &pb_dec_uvarint, - &pb_dec_svarint, - &pb_dec_fixed32, - &pb_dec_fixed64, - - &pb_dec_bytes, - &pb_dec_string, - &pb_dec_submessage, - NULL, /* extensions */ - &pb_dec_bytes /* PB_LTYPE_FIXED_LENGTH_BYTES */ -}; - -/******************************* - * pb_istream_t implementation * - *******************************/ - -static bool checkreturn buf_read(pb_istream_t *stream, pb_byte_t *buf, size_t count) -{ - const pb_byte_t *source = (const pb_byte_t*)stream->state; - stream->state = (pb_byte_t*)stream->state + count; - - if (buf != NULL) - { - while (count--) - *buf++ = *source++; - } - - return true; -} - -bool checkreturn pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count) -{ -#ifndef PB_BUFFER_ONLY - if (buf == NULL && stream->callback != buf_read) - { - /* Skip input bytes */ - pb_byte_t tmp[16]; - while (count > 16) - { - if (!pb_read(stream, tmp, 16)) - return false; - - count -= 16; - } - - return pb_read(stream, tmp, count); - } -#endif - - if (stream->bytes_left < count) - PB_RETURN_ERROR(stream, "end-of-stream"); - -#ifndef PB_BUFFER_ONLY - if (!stream->callback(stream, buf, count)) - PB_RETURN_ERROR(stream, "io error"); -#else - if (!buf_read(stream, buf, count)) - return false; -#endif - - stream->bytes_left -= count; - return true; -} - -/* Read a single byte from input stream. buf may not be NULL. - * This is an optimization for the varint decoding. */ -static bool checkreturn pb_readbyte(pb_istream_t *stream, pb_byte_t *buf) -{ - if (stream->bytes_left == 0) - PB_RETURN_ERROR(stream, "end-of-stream"); - -#ifndef PB_BUFFER_ONLY - if (!stream->callback(stream, buf, 1)) - PB_RETURN_ERROR(stream, "io error"); -#else - *buf = *(const pb_byte_t*)stream->state; - stream->state = (pb_byte_t*)stream->state + 1; -#endif - - stream->bytes_left--; - - return true; -} - -pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize) -{ - pb_istream_t stream; - /* Cast away the const from buf without a compiler error. We are - * careful to use it only in a const manner in the callbacks. - */ - union { - void *state; - const void *c_state; - } state; -#ifdef PB_BUFFER_ONLY - stream.callback = NULL; -#else - stream.callback = &buf_read; -#endif - state.c_state = buf; - stream.state = state.state; - stream.bytes_left = bufsize; -#ifndef PB_NO_ERRMSG - stream.errmsg = NULL; -#endif - return stream; -} - -/******************** - * Helper functions * - ********************/ - -static bool checkreturn pb_decode_varint32(pb_istream_t *stream, uint32_t *dest) -{ - pb_byte_t byte; - uint32_t result; - - if (!pb_readbyte(stream, &byte)) - return false; - - if ((byte & 0x80) == 0) - { - /* Quick case, 1 byte value */ - result = byte; - } - else - { - /* Multibyte case */ - uint_fast8_t bitpos = 7; - result = byte & 0x7F; - - do - { - if (bitpos >= 32) - PB_RETURN_ERROR(stream, "varint overflow"); - - if (!pb_readbyte(stream, &byte)) - return false; - - result |= (uint32_t)(byte & 0x7F) << bitpos; - bitpos = (uint_fast8_t)(bitpos + 7); - } while (byte & 0x80); - } - - *dest = result; - return true; -} - -bool checkreturn pb_decode_varint(pb_istream_t *stream, uint64_t *dest) -{ - pb_byte_t byte; - uint_fast8_t bitpos = 0; - uint64_t result = 0; - - do - { - if (bitpos >= 64) - PB_RETURN_ERROR(stream, "varint overflow"); - - if (!pb_readbyte(stream, &byte)) - return false; - - result |= (uint64_t)(byte & 0x7F) << bitpos; - bitpos = (uint_fast8_t)(bitpos + 7); - } while (byte & 0x80); - - *dest = result; - return true; -} - -bool checkreturn pb_skip_varint(pb_istream_t *stream) -{ - pb_byte_t byte; - do - { - if (!pb_read(stream, &byte, 1)) - return false; - } while (byte & 0x80); - return true; -} - -bool checkreturn pb_skip_string(pb_istream_t *stream) -{ - uint32_t length; - if (!pb_decode_varint32(stream, &length)) - return false; - - return pb_read(stream, NULL, length); -} - -bool checkreturn pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof) -{ - uint32_t temp; - *eof = false; - *wire_type = (pb_wire_type_t) 0; - *tag = 0; - - if (!pb_decode_varint32(stream, &temp)) - { - if (stream->bytes_left == 0) - *eof = true; - - return false; - } - - if (temp == 0) - { - *eof = true; /* Special feature: allow 0-terminated messages. */ - return false; - } - - *tag = temp >> 3; - *wire_type = (pb_wire_type_t)(temp & 7); - return true; -} - -bool checkreturn pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type) -{ - switch (wire_type) - { - case PB_WT_VARINT: return pb_skip_varint(stream); - case PB_WT_64BIT: return pb_read(stream, NULL, 8); - case PB_WT_STRING: return pb_skip_string(stream); - case PB_WT_32BIT: return pb_read(stream, NULL, 4); - default: PB_RETURN_ERROR(stream, "invalid wire_type"); - } -} - -/* Read a raw value to buffer, for the purpose of passing it to callback as - * a substream. Size is maximum size on call, and actual size on return. - */ -static bool checkreturn read_raw_value(pb_istream_t *stream, pb_wire_type_t wire_type, pb_byte_t *buf, size_t *size) -{ - size_t max_size = *size; - switch (wire_type) - { - case PB_WT_VARINT: - *size = 0; - do - { - (*size)++; - if (*size > max_size) return false; - if (!pb_read(stream, buf, 1)) return false; - } while (*buf++ & 0x80); - return true; - - case PB_WT_64BIT: - *size = 8; - return pb_read(stream, buf, 8); - - case PB_WT_32BIT: - *size = 4; - return pb_read(stream, buf, 4); - - default: PB_RETURN_ERROR(stream, "invalid wire_type"); - } -} - -/* Decode string length from stream and return a substream with limited length. - * Remember to close the substream using pb_close_string_substream(). - */ -bool checkreturn pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream) -{ - uint32_t size; - if (!pb_decode_varint32(stream, &size)) - return false; - - *substream = *stream; - if (substream->bytes_left < size) - PB_RETURN_ERROR(stream, "parent stream too short"); - - substream->bytes_left = size; - stream->bytes_left -= size; - return true; -} - -void pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream) -{ - stream->state = substream->state; - -#ifndef PB_NO_ERRMSG - stream->errmsg = substream->errmsg; -#endif -} - -/************************* - * Decode a single field * - *************************/ - -static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter) -{ - pb_type_t type; - pb_decoder_t func; - - type = iter->pos->type; - func = PB_DECODERS[PB_LTYPE(type)]; - - switch (PB_HTYPE(type)) - { - case PB_HTYPE_REQUIRED: - return func(stream, iter->pos, iter->pData); - - case PB_HTYPE_OPTIONAL: - *(bool*)iter->pSize = true; - return func(stream, iter->pos, iter->pData); - - case PB_HTYPE_REPEATED: - if (wire_type == PB_WT_STRING - && PB_LTYPE(type) <= PB_LTYPE_LAST_PACKABLE) - { - /* Packed array */ - bool status = true; - pb_size_t *size = (pb_size_t*)iter->pSize; - pb_istream_t substream; - if (!pb_make_string_substream(stream, &substream)) - return false; - - while (substream.bytes_left > 0 && *size < iter->pos->array_size) - { - void *pItem = (char*)iter->pData + iter->pos->data_size * (*size); - if (!func(&substream, iter->pos, pItem)) - { - status = false; - break; - } - (*size)++; - } - pb_close_string_substream(stream, &substream); - - if (substream.bytes_left != 0) - PB_RETURN_ERROR(stream, "array overflow"); - - return status; - } - else - { - /* Repeated field */ - pb_size_t *size = (pb_size_t*)iter->pSize; - void *pItem = (char*)iter->pData + iter->pos->data_size * (*size); - if (*size >= iter->pos->array_size) - PB_RETURN_ERROR(stream, "array overflow"); - - (*size)++; - return func(stream, iter->pos, pItem); - } - - case PB_HTYPE_ONEOF: - *(pb_size_t*)iter->pSize = iter->pos->tag; - if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE) - { - /* We memset to zero so that any callbacks are set to NULL. - * Then set any default values. */ - memset(iter->pData, 0, iter->pos->data_size); - pb_message_set_to_defaults((const pb_field_t*)iter->pos->ptr, iter->pData); - } - return func(stream, iter->pos, iter->pData); - - default: - PB_RETURN_ERROR(stream, "invalid field type"); - } -} - -#ifdef PB_ENABLE_MALLOC -/* Allocate storage for the field and store the pointer at iter->pData. - * array_size is the number of entries to reserve in an array. - * Zero size is not allowed, use pb_free() for releasing. - */ -static bool checkreturn allocate_field(pb_istream_t *stream, void *pData, size_t data_size, size_t array_size) -{ - void *ptr = *(void**)pData; - - if (data_size == 0 || array_size == 0) - PB_RETURN_ERROR(stream, "invalid size"); - - /* Check for multiplication overflows. - * This code avoids the costly division if the sizes are small enough. - * Multiplication is safe as long as only half of bits are set - * in either multiplicand. - */ - { - const size_t check_limit = (size_t)1 << (sizeof(size_t) * 4); - if (data_size >= check_limit || array_size >= check_limit) - { - const size_t size_max = (size_t)-1; - if (size_max / array_size < data_size) - { - PB_RETURN_ERROR(stream, "size too large"); - } - } - } - - /* Allocate new or expand previous allocation */ - /* Note: on failure the old pointer will remain in the structure, - * the message must be freed by caller also on error return. */ - ptr = pb_realloc(ptr, array_size * data_size); - if (ptr == NULL) - PB_RETURN_ERROR(stream, "realloc failed"); - - *(void**)pData = ptr; - return true; -} - -/* Clear a newly allocated item in case it contains a pointer, or is a submessage. */ -static void initialize_pointer_field(void *pItem, pb_field_iter_t *iter) -{ - if (PB_LTYPE(iter->pos->type) == PB_LTYPE_STRING || - PB_LTYPE(iter->pos->type) == PB_LTYPE_BYTES) - { - *(void**)pItem = NULL; - } - else if (PB_LTYPE(iter->pos->type) == PB_LTYPE_SUBMESSAGE) - { - pb_message_set_to_defaults((const pb_field_t *) iter->pos->ptr, pItem); - } -} -#endif - -static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter) -{ -#ifndef PB_ENABLE_MALLOC - PB_UNUSED(wire_type); - PB_UNUSED(iter); - PB_RETURN_ERROR(stream, "no malloc support"); -#else - pb_type_t type; - pb_decoder_t func; - - type = iter->pos->type; - func = PB_DECODERS[PB_LTYPE(type)]; - - switch (PB_HTYPE(type)) - { - case PB_HTYPE_REQUIRED: - case PB_HTYPE_OPTIONAL: - case PB_HTYPE_ONEOF: - if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE && - *(void**)iter->pData != NULL) - { - /* Duplicate field, have to release the old allocation first. */ - pb_release_single_field(iter); - } - - if (PB_HTYPE(type) == PB_HTYPE_ONEOF) - { - *(pb_size_t*)iter->pSize = iter->pos->tag; - } - - if (PB_LTYPE(type) == PB_LTYPE_STRING || - PB_LTYPE(type) == PB_LTYPE_BYTES) - { - return func(stream, iter->pos, iter->pData); - } - else - { - if (!allocate_field(stream, iter->pData, iter->pos->data_size, 1)) - return false; - - initialize_pointer_field(*(void**)iter->pData, iter); - return func(stream, iter->pos, *(void**)iter->pData); - } - - case PB_HTYPE_REPEATED: - if (wire_type == PB_WT_STRING - && PB_LTYPE(type) <= PB_LTYPE_LAST_PACKABLE) - { - /* Packed array, multiple items come in at once. */ - bool status = true; - pb_size_t *size = (pb_size_t*)iter->pSize; - size_t allocated_size = *size; - void *pItem; - pb_istream_t substream; - - if (!pb_make_string_substream(stream, &substream)) - return false; - - while (substream.bytes_left) - { - if ((size_t)*size + 1 > allocated_size) - { - /* Allocate more storage. This tries to guess the - * number of remaining entries. Round the division - * upwards. */ - allocated_size += (substream.bytes_left - 1) / iter->pos->data_size + 1; - - if (!allocate_field(&substream, iter->pData, iter->pos->data_size, allocated_size)) - { - status = false; - break; - } - } - - /* Decode the array entry */ - pItem = *(char**)iter->pData + iter->pos->data_size * (*size); - initialize_pointer_field(pItem, iter); - if (!func(&substream, iter->pos, pItem)) - { - status = false; - break; - } - - if (*size == PB_SIZE_MAX) - { -#ifndef PB_NO_ERRMSG - stream->errmsg = "too many array entries"; -#endif - status = false; - break; - } - - (*size)++; - } - pb_close_string_substream(stream, &substream); - - return status; - } - else - { - /* Normal repeated field, i.e. only one item at a time. */ - pb_size_t *size = (pb_size_t*)iter->pSize; - void *pItem; - - if (*size == PB_SIZE_MAX) - PB_RETURN_ERROR(stream, "too many array entries"); - - (*size)++; - if (!allocate_field(stream, iter->pData, iter->pos->data_size, *size)) - return false; - - pItem = *(char**)iter->pData + iter->pos->data_size * (*size - 1); - initialize_pointer_field(pItem, iter); - return func(stream, iter->pos, pItem); - } - - default: - PB_RETURN_ERROR(stream, "invalid field type"); - } -#endif -} - -static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter) -{ - pb_callback_t *pCallback = (pb_callback_t*)iter->pData; - -#ifdef PB_OLD_CALLBACK_STYLE - void *arg = pCallback->arg; -#else - void **arg = &(pCallback->arg); -#endif - - if (pCallback->funcs.decode == NULL) - return pb_skip_field(stream, wire_type); - - if (wire_type == PB_WT_STRING) - { - pb_istream_t substream; - - if (!pb_make_string_substream(stream, &substream)) - return false; - - do - { - if (!pCallback->funcs.decode(&substream, iter->pos, arg)) - PB_RETURN_ERROR(stream, "callback failed"); - } while (substream.bytes_left); - - pb_close_string_substream(stream, &substream); - return true; - } - else - { - /* Copy the single scalar value to stack. - * This is required so that we can limit the stream length, - * which in turn allows to use same callback for packed and - * not-packed fields. */ - pb_istream_t substream; - pb_byte_t buffer[10]; - size_t size = sizeof(buffer); - - if (!read_raw_value(stream, wire_type, buffer, &size)) - return false; - substream = pb_istream_from_buffer(buffer, size); - - return pCallback->funcs.decode(&substream, iter->pos, arg); - } -} - -static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter) -{ -#ifdef PB_ENABLE_MALLOC - /* When decoding an oneof field, check if there is old data that must be - * released first. */ - if (PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF) - { - if (!pb_release_union_field(stream, iter)) - return false; - } -#endif - - switch (PB_ATYPE(iter->pos->type)) - { - case PB_ATYPE_STATIC: - return decode_static_field(stream, wire_type, iter); - - case PB_ATYPE_POINTER: - return decode_pointer_field(stream, wire_type, iter); - - case PB_ATYPE_CALLBACK: - return decode_callback_field(stream, wire_type, iter); - - default: - PB_RETURN_ERROR(stream, "invalid field type"); - } -} - -static void iter_from_extension(pb_field_iter_t *iter, pb_extension_t *extension) -{ - /* Fake a field iterator for the extension field. - * It is not actually safe to advance this iterator, but decode_field - * will not even try to. */ - const pb_field_t *field = (const pb_field_t*)extension->type->arg; - (void)pb_field_iter_begin(iter, field, extension->dest); - iter->pData = extension->dest; - iter->pSize = &extension->found; - - if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) - { - /* For pointer extensions, the pointer is stored directly - * in the extension structure. This avoids having an extra - * indirection. */ - iter->pData = &extension->dest; - } -} - -/* Default handler for extension fields. Expects a pb_field_t structure - * in extension->type->arg. */ -static bool checkreturn default_extension_decoder(pb_istream_t *stream, - pb_extension_t *extension, uint32_t tag, pb_wire_type_t wire_type) -{ - const pb_field_t *field = (const pb_field_t*)extension->type->arg; - pb_field_iter_t iter; - - if (field->tag != tag) - return true; - - iter_from_extension(&iter, extension); - extension->found = true; - return decode_field(stream, wire_type, &iter); -} - -/* Try to decode an unknown field as an extension field. Tries each extension - * decoder in turn, until one of them handles the field or loop ends. */ -static bool checkreturn decode_extension(pb_istream_t *stream, - uint32_t tag, pb_wire_type_t wire_type, pb_field_iter_t *iter) -{ - pb_extension_t *extension = *(pb_extension_t* const *)iter->pData; - size_t pos = stream->bytes_left; - - while (extension != NULL && pos == stream->bytes_left) - { - bool status; - if (extension->type->decode) - status = extension->type->decode(stream, extension, tag, wire_type); - else - status = default_extension_decoder(stream, extension, tag, wire_type); - - if (!status) - return false; - - extension = extension->next; - } - - return true; -} - -/* Step through the iterator until an extension field is found or until all - * entries have been checked. There can be only one extension field per - * message. Returns false if no extension field is found. */ -static bool checkreturn find_extension_field(pb_field_iter_t *iter) -{ - const pb_field_t *start = iter->pos; - - do { - if (PB_LTYPE(iter->pos->type) == PB_LTYPE_EXTENSION) - return true; - (void)pb_field_iter_next(iter); - } while (iter->pos != start); - - return false; -} - -/* Initialize message fields to default values, recursively */ -static void pb_field_set_to_default(pb_field_iter_t *iter) -{ - pb_type_t type; - type = iter->pos->type; - - if (PB_LTYPE(type) == PB_LTYPE_EXTENSION) - { - pb_extension_t *ext = *(pb_extension_t* const *)iter->pData; - while (ext != NULL) - { - pb_field_iter_t ext_iter; - ext->found = false; - iter_from_extension(&ext_iter, ext); - pb_field_set_to_default(&ext_iter); - ext = ext->next; - } - } - else if (PB_ATYPE(type) == PB_ATYPE_STATIC) - { - bool init_data = true; - if (PB_HTYPE(type) == PB_HTYPE_OPTIONAL) - { - /* Set has_field to false. Still initialize the optional field - * itself also. */ - *(bool*)iter->pSize = false; - } - else if (PB_HTYPE(type) == PB_HTYPE_REPEATED || - PB_HTYPE(type) == PB_HTYPE_ONEOF) - { - /* REPEATED: Set array count to 0, no need to initialize contents. - ONEOF: Set which_field to 0. */ - *(pb_size_t*)iter->pSize = 0; - init_data = false; - } - - if (init_data) - { - if (PB_LTYPE(iter->pos->type) == PB_LTYPE_SUBMESSAGE) - { - /* Initialize submessage to defaults */ - pb_message_set_to_defaults((const pb_field_t *) iter->pos->ptr, iter->pData); - } - else if (iter->pos->ptr != NULL) - { - /* Initialize to default value */ - memcpy(iter->pData, iter->pos->ptr, iter->pos->data_size); - } - else - { - /* Initialize to zeros */ - memset(iter->pData, 0, iter->pos->data_size); - } - } - } - else if (PB_ATYPE(type) == PB_ATYPE_POINTER) - { - /* Initialize the pointer to NULL. */ - *(void**)iter->pData = NULL; - - /* Initialize array count to 0. */ - if (PB_HTYPE(type) == PB_HTYPE_REPEATED || - PB_HTYPE(type) == PB_HTYPE_ONEOF) - { - *(pb_size_t*)iter->pSize = 0; - } - } - else if (PB_ATYPE(type) == PB_ATYPE_CALLBACK) - { - /* Don't overwrite callback */ - } -} - -static void pb_message_set_to_defaults(const pb_field_t fields[], void *dest_struct) -{ - pb_field_iter_t iter; - - if (!pb_field_iter_begin(&iter, fields, dest_struct)) - return; /* Empty message type */ - - do - { - pb_field_set_to_default(&iter); - } while (pb_field_iter_next(&iter)); -} - -/********************* - * Decode all fields * - *********************/ - -bool checkreturn pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct) -{ - uint32_t fields_seen[(PB_MAX_REQUIRED_FIELDS + 31) / 32] = {0, 0}; - const uint32_t allbits = ~(uint32_t)0; - uint32_t extension_range_start = 0; - pb_field_iter_t iter; - - /* Return value ignored, as empty message types will be correctly handled by - * pb_field_iter_find() anyway. */ - (void)pb_field_iter_begin(&iter, fields, dest_struct); - - while (stream->bytes_left) - { - uint32_t tag; - pb_wire_type_t wire_type; - bool eof; - - if (!pb_decode_tag(stream, &wire_type, &tag, &eof)) - { - if (eof) - break; - else - return false; - } - - if (!pb_field_iter_find(&iter, tag)) - { - /* No match found, check if it matches an extension. */ - if (tag >= extension_range_start) - { - if (!find_extension_field(&iter)) - extension_range_start = (uint32_t)-1; - else - extension_range_start = iter.pos->tag; - - if (tag >= extension_range_start) - { - size_t pos = stream->bytes_left; - - if (!decode_extension(stream, tag, wire_type, &iter)) - return false; - - if (pos != stream->bytes_left) - { - /* The field was handled */ - continue; - } - } - } - - /* No match found, skip data */ - if (!pb_skip_field(stream, wire_type)) - return false; - continue; - } - - if (PB_HTYPE(iter.pos->type) == PB_HTYPE_REQUIRED - && iter.required_field_index < PB_MAX_REQUIRED_FIELDS) - { - uint32_t tmp = ((uint32_t)1 << (iter.required_field_index & 31)); - fields_seen[iter.required_field_index >> 5] |= tmp; - } - - if (!decode_field(stream, wire_type, &iter)) - return false; - } - - /* Check that all required fields were present. */ - { - /* First figure out the number of required fields by - * seeking to the end of the field array. Usually we - * are already close to end after decoding. - */ - unsigned req_field_count; - pb_type_t last_type; - unsigned i; - do { - req_field_count = iter.required_field_index; - last_type = iter.pos->type; - } while (pb_field_iter_next(&iter)); - - /* Fixup if last field was also required. */ - if (PB_HTYPE(last_type) == PB_HTYPE_REQUIRED && iter.pos->tag != 0) - req_field_count++; - - if (req_field_count > 0) - { - /* Check the whole words */ - for (i = 0; i < (req_field_count >> 5); i++) - { - if (fields_seen[i] != allbits) - PB_RETURN_ERROR(stream, "missing required field"); - } - - /* Check the remaining bits */ - if (fields_seen[req_field_count >> 5] != (allbits >> (32 - (req_field_count & 31)))) - PB_RETURN_ERROR(stream, "missing required field"); - } - } - - return true; -} - -bool checkreturn pb_decode(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct) -{ - bool status; - pb_message_set_to_defaults(fields, dest_struct); - status = pb_decode_noinit(stream, fields, dest_struct); - -#ifdef PB_ENABLE_MALLOC - if (!status) - pb_release(fields, dest_struct); -#endif - - return status; -} - -bool pb_decode_delimited(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct) -{ - pb_istream_t substream; - bool status; - - if (!pb_make_string_substream(stream, &substream)) - return false; - - status = pb_decode(&substream, fields, dest_struct); - pb_close_string_substream(stream, &substream); - return status; -} - -#ifdef PB_ENABLE_MALLOC -/* Given an oneof field, if there has already been a field inside this oneof, - * release it before overwriting with a different one. */ -static bool pb_release_union_field(pb_istream_t *stream, pb_field_iter_t *iter) -{ - pb_size_t old_tag = *(pb_size_t*)iter->pSize; /* Previous which_ value */ - pb_size_t new_tag = iter->pos->tag; /* New which_ value */ - - if (old_tag == 0) - return true; /* Ok, no old data in union */ - - if (old_tag == new_tag) - return true; /* Ok, old data is of same type => merge */ - - /* Release old data. The find can fail if the message struct contains - * invalid data. */ - if (!pb_field_iter_find(iter, old_tag)) - PB_RETURN_ERROR(stream, "invalid union tag"); - - pb_release_single_field(iter); - - /* Restore iterator to where it should be. - * This shouldn't fail unless the pb_field_t structure is corrupted. */ - if (!pb_field_iter_find(iter, new_tag)) - PB_RETURN_ERROR(stream, "iterator error"); - - return true; -} - -static void pb_release_single_field(const pb_field_iter_t *iter) -{ - pb_type_t type; - type = iter->pos->type; - - if (PB_HTYPE(type) == PB_HTYPE_ONEOF) - { - if (*(pb_size_t*)iter->pSize != iter->pos->tag) - return; /* This is not the current field in the union */ - } - - /* Release anything contained inside an extension or submsg. - * This has to be done even if the submsg itself is statically - * allocated. */ - if (PB_LTYPE(type) == PB_LTYPE_EXTENSION) - { - /* Release fields from all extensions in the linked list */ - pb_extension_t *ext = *(pb_extension_t**)iter->pData; - while (ext != NULL) - { - pb_field_iter_t ext_iter; - iter_from_extension(&ext_iter, ext); - pb_release_single_field(&ext_iter); - ext = ext->next; - } - } - else if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE) - { - /* Release fields in submessage or submsg array */ - void *pItem = iter->pData; - pb_size_t count = 1; - - if (PB_ATYPE(type) == PB_ATYPE_POINTER) - { - pItem = *(void**)iter->pData; - } - - if (PB_HTYPE(type) == PB_HTYPE_REPEATED) - { - count = *(pb_size_t*)iter->pSize; - - if (PB_ATYPE(type) == PB_ATYPE_STATIC && count > iter->pos->array_size) - { - /* Protect against corrupted _count fields */ - count = iter->pos->array_size; - } - } - - if (pItem) - { - while (count--) - { - pb_release((const pb_field_t*)iter->pos->ptr, pItem); - pItem = (char*)pItem + iter->pos->data_size; - } - } - } - - if (PB_ATYPE(type) == PB_ATYPE_POINTER) - { - if (PB_HTYPE(type) == PB_HTYPE_REPEATED && - (PB_LTYPE(type) == PB_LTYPE_STRING || - PB_LTYPE(type) == PB_LTYPE_BYTES)) - { - /* Release entries in repeated string or bytes array */ - void **pItem = *(void***)iter->pData; - pb_size_t count = *(pb_size_t*)iter->pSize; - while (count--) - { - pb_free(*pItem); - *pItem++ = NULL; - } - } - - if (PB_HTYPE(type) == PB_HTYPE_REPEATED) - { - /* We are going to release the array, so set the size to 0 */ - *(pb_size_t*)iter->pSize = 0; - } - - /* Release main item */ - pb_free(*(void**)iter->pData); - *(void**)iter->pData = NULL; - } -} - -void pb_release(const pb_field_t fields[], void *dest_struct) -{ - pb_field_iter_t iter; - - if (!dest_struct) - return; /* Ignore NULL pointers, similar to free() */ - - if (!pb_field_iter_begin(&iter, fields, dest_struct)) - return; /* Empty message type */ - - do - { - pb_release_single_field(&iter); - } while (pb_field_iter_next(&iter)); -} -#endif - -/* Field decoders */ - -bool pb_decode_svarint(pb_istream_t *stream, int64_t *dest) -{ - uint64_t value; - if (!pb_decode_varint(stream, &value)) - return false; - - if (value & 1) - *dest = (int64_t)(~(value >> 1)); - else - *dest = (int64_t)(value >> 1); - - return true; -} - -bool pb_decode_fixed32(pb_istream_t *stream, void *dest) -{ - pb_byte_t bytes[4]; - - if (!pb_read(stream, bytes, 4)) - return false; - - *(uint32_t*)dest = ((uint32_t)bytes[0] << 0) | - ((uint32_t)bytes[1] << 8) | - ((uint32_t)bytes[2] << 16) | - ((uint32_t)bytes[3] << 24); - return true; -} - -bool pb_decode_fixed64(pb_istream_t *stream, void *dest) -{ - pb_byte_t bytes[8]; - - if (!pb_read(stream, bytes, 8)) - return false; - - *(uint64_t*)dest = ((uint64_t)bytes[0] << 0) | - ((uint64_t)bytes[1] << 8) | - ((uint64_t)bytes[2] << 16) | - ((uint64_t)bytes[3] << 24) | - ((uint64_t)bytes[4] << 32) | - ((uint64_t)bytes[5] << 40) | - ((uint64_t)bytes[6] << 48) | - ((uint64_t)bytes[7] << 56); - - return true; -} - -static bool checkreturn pb_dec_varint(pb_istream_t *stream, const pb_field_t *field, void *dest) -{ - uint64_t value; - int64_t svalue; - int64_t clamped; - if (!pb_decode_varint(stream, &value)) - return false; - - /* See issue 97: Google's C++ protobuf allows negative varint values to - * be cast as int32_t, instead of the int64_t that should be used when - * encoding. Previous nanopb versions had a bug in encoding. In order to - * not break decoding of such messages, we cast <=32 bit fields to - * int32_t first to get the sign correct. - */ - if (field->data_size == sizeof(int64_t)) - svalue = (int64_t)value; - else - svalue = (int32_t)value; - - /* Cast to the proper field size, while checking for overflows */ - if (field->data_size == sizeof(int64_t)) - clamped = *(int64_t*)dest = svalue; - else if (field->data_size == sizeof(int32_t)) - clamped = *(int32_t*)dest = (int32_t)svalue; - else if (field->data_size == sizeof(int_least16_t)) - clamped = *(int_least16_t*)dest = (int_least16_t)svalue; - else if (field->data_size == sizeof(int_least8_t)) - clamped = *(int_least8_t*)dest = (int_least8_t)svalue; - else - PB_RETURN_ERROR(stream, "invalid data_size"); - - if (clamped != svalue) - PB_RETURN_ERROR(stream, "integer too large"); - - return true; -} - -static bool checkreturn pb_dec_uvarint(pb_istream_t *stream, const pb_field_t *field, void *dest) -{ - uint64_t value, clamped; - if (!pb_decode_varint(stream, &value)) - return false; - - /* Cast to the proper field size, while checking for overflows */ - if (field->data_size == sizeof(uint64_t)) - clamped = *(uint64_t*)dest = value; - else if (field->data_size == sizeof(uint32_t)) - clamped = *(uint32_t*)dest = (uint32_t)value; - else if (field->data_size == sizeof(uint_least16_t)) - clamped = *(uint_least16_t*)dest = (uint_least16_t)value; - else if (field->data_size == sizeof(uint_least8_t)) - clamped = *(uint_least8_t*)dest = (uint_least8_t)value; - else - PB_RETURN_ERROR(stream, "invalid data_size"); - - if (clamped != value) - PB_RETURN_ERROR(stream, "integer too large"); - - return true; -} - -static bool checkreturn pb_dec_svarint(pb_istream_t *stream, const pb_field_t *field, void *dest) -{ - int64_t value, clamped; - if (!pb_decode_svarint(stream, &value)) - return false; - - /* Cast to the proper field size, while checking for overflows */ - if (field->data_size == sizeof(int64_t)) - clamped = *(int64_t*)dest = value; - else if (field->data_size == sizeof(int32_t)) - clamped = *(int32_t*)dest = (int32_t)value; - else if (field->data_size == sizeof(int_least16_t)) - clamped = *(int_least16_t*)dest = (int_least16_t)value; - else if (field->data_size == sizeof(int_least8_t)) - clamped = *(int_least8_t*)dest = (int_least8_t)value; - else - PB_RETURN_ERROR(stream, "invalid data_size"); - - if (clamped != value) - PB_RETURN_ERROR(stream, "integer too large"); - - return true; -} - -static bool checkreturn pb_dec_fixed32(pb_istream_t *stream, const pb_field_t *field, void *dest) -{ - PB_UNUSED(field); - return pb_decode_fixed32(stream, dest); -} - -static bool checkreturn pb_dec_fixed64(pb_istream_t *stream, const pb_field_t *field, void *dest) -{ - PB_UNUSED(field); - return pb_decode_fixed64(stream, dest); -} - -static bool checkreturn pb_dec_bytes(pb_istream_t *stream, const pb_field_t *field, void *dest) -{ - uint32_t size; - size_t alloc_size; - pb_bytes_array_t *bdest; - - if (!pb_decode_varint32(stream, &size)) - return false; - - if (size > PB_SIZE_MAX) - PB_RETURN_ERROR(stream, "bytes overflow"); - - alloc_size = PB_BYTES_ARRAY_T_ALLOCSIZE(size); - if (size > alloc_size) - PB_RETURN_ERROR(stream, "size too large"); - - if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) - { -#ifndef PB_ENABLE_MALLOC - PB_RETURN_ERROR(stream, "no malloc support"); -#else - if (!allocate_field(stream, dest, alloc_size, 1)) - return false; - bdest = *(pb_bytes_array_t**)dest; -#endif - } - else - { - if (PB_LTYPE(field->type) == PB_LTYPE_FIXED_LENGTH_BYTES) { - if (size != field->data_size) - PB_RETURN_ERROR(stream, "incorrect inline bytes size"); - return pb_read(stream, (pb_byte_t*)dest, field->data_size); - } - - if (alloc_size > field->data_size) - PB_RETURN_ERROR(stream, "bytes overflow"); - bdest = (pb_bytes_array_t*)dest; - } - - bdest->size = (pb_size_t)size; - return pb_read(stream, bdest->bytes, size); -} - -static bool checkreturn pb_dec_string(pb_istream_t *stream, const pb_field_t *field, void *dest) -{ - uint32_t size; - size_t alloc_size; - bool status; - if (!pb_decode_varint32(stream, &size)) - return false; - - /* Space for null terminator */ - alloc_size = size + 1; - - if (alloc_size < size) - PB_RETURN_ERROR(stream, "size too large"); - - if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) - { -#ifndef PB_ENABLE_MALLOC - PB_RETURN_ERROR(stream, "no malloc support"); -#else - if (!allocate_field(stream, dest, alloc_size, 1)) - return false; - dest = *(void**)dest; -#endif - } - else - { - if (alloc_size > field->data_size) - PB_RETURN_ERROR(stream, "string overflow"); - } - - status = pb_read(stream, (pb_byte_t*)dest, size); - *((pb_byte_t*)dest + size) = 0; - return status; -} - -static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_t *field, void *dest) -{ - bool status; - pb_istream_t substream; - const pb_field_t* submsg_fields = (const pb_field_t*)field->ptr; - - if (!pb_make_string_substream(stream, &substream)) - return false; - - if (field->ptr == NULL) - PB_RETURN_ERROR(stream, "invalid field descriptor"); - - /* New array entries need to be initialized, while required and optional - * submessages have already been initialized in the top-level pb_decode. */ - if (PB_HTYPE(field->type) == PB_HTYPE_REPEATED) - status = pb_decode(&substream, submsg_fields, dest); - else - status = pb_decode_noinit(&substream, submsg_fields, dest); - - pb_close_string_substream(stream, &substream); - return status; -} diff --git a/third_party/nanopb/pb_decode.h b/third_party/nanopb/pb_decode.h deleted file mode 100644 index 1d9bb1945c1..00000000000 --- a/third_party/nanopb/pb_decode.h +++ /dev/null @@ -1,149 +0,0 @@ -/* pb_decode.h: Functions to decode protocol buffers. Depends on pb_decode.c. - * The main function is pb_decode. You also need an input stream, and the - * field descriptions created by nanopb_generator.py. - */ - -#ifndef PB_DECODE_H_INCLUDED -#define PB_DECODE_H_INCLUDED - -#include "pb.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Structure for defining custom input streams. You will need to provide - * a callback function to read the bytes from your storage, which can be - * for example a file or a network socket. - * - * The callback must conform to these rules: - * - * 1) Return false on IO errors. This will cause decoding to abort. - * 2) You can use state to store your own data (e.g. buffer pointer), - * and rely on pb_read to verify that no-body reads past bytes_left. - * 3) Your callback may be used with substreams, in which case bytes_left - * is different than from the main stream. Don't use bytes_left to compute - * any pointers. - */ -struct pb_istream_s -{ -#ifdef PB_BUFFER_ONLY - /* Callback pointer is not used in buffer-only configuration. - * Having an int pointer here allows binary compatibility but - * gives an error if someone tries to assign callback function. - */ - int *callback; -#else - bool (*callback)(pb_istream_t *stream, pb_byte_t *buf, size_t count); -#endif - - void *state; /* Free field for use by callback implementation */ - size_t bytes_left; - -#ifndef PB_NO_ERRMSG - const char *errmsg; -#endif -}; - -/*************************** - * Main decoding functions * - ***************************/ - -/* Decode a single protocol buffers message from input stream into a C structure. - * Returns true on success, false on any failure. - * The actual struct pointed to by dest must match the description in fields. - * Callback fields of the destination structure must be initialized by caller. - * All other fields will be initialized by this function. - * - * Example usage: - * MyMessage msg = {}; - * uint8_t buffer[64]; - * pb_istream_t stream; - * - * // ... read some data into buffer ... - * - * stream = pb_istream_from_buffer(buffer, count); - * pb_decode(&stream, MyMessage_fields, &msg); - */ -bool pb_decode(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); - -/* Same as pb_decode, except does not initialize the destination structure - * to default values. This is slightly faster if you need no default values - * and just do memset(struct, 0, sizeof(struct)) yourself. - * - * This can also be used for 'merging' two messages, i.e. update only the - * fields that exist in the new message. - * - * Note: If this function returns with an error, it will not release any - * dynamically allocated fields. You will need to call pb_release() yourself. - */ -bool pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); - -/* Same as pb_decode, except expects the stream to start with the message size - * encoded as varint. Corresponds to parseDelimitedFrom() in Google's - * protobuf API. - */ -bool pb_decode_delimited(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); - -#ifdef PB_ENABLE_MALLOC -/* Release any allocated pointer fields. If you use dynamic allocation, you should - * call this for any successfully decoded message when you are done with it. If - * pb_decode() returns with an error, the message is already released. - */ -void pb_release(const pb_field_t fields[], void *dest_struct); -#endif - - -/************************************** - * Functions for manipulating streams * - **************************************/ - -/* Create an input stream for reading from a memory buffer. - * - * Alternatively, you can use a custom stream that reads directly from e.g. - * a file or a network socket. - */ -pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize); - -/* Function to read from a pb_istream_t. You can use this if you need to - * read some custom header data, or to read data in field callbacks. - */ -bool pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count); - - -/************************************************ - * Helper functions for writing field callbacks * - ************************************************/ - -/* Decode the tag for the next field in the stream. Gives the wire type and - * field tag. At end of the message, returns false and sets eof to true. */ -bool pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof); - -/* Skip the field payload data, given the wire type. */ -bool pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type); - -/* Decode an integer in the varint format. This works for bool, enum, int32, - * int64, uint32 and uint64 field types. */ -bool pb_decode_varint(pb_istream_t *stream, uint64_t *dest); - -/* Decode an integer in the zig-zagged svarint format. This works for sint32 - * and sint64. */ -bool pb_decode_svarint(pb_istream_t *stream, int64_t *dest); - -/* Decode a fixed32, sfixed32 or float value. You need to pass a pointer to - * a 4-byte wide C variable. */ -bool pb_decode_fixed32(pb_istream_t *stream, void *dest); - -/* Decode a fixed64, sfixed64 or double value. You need to pass a pointer to - * a 8-byte wide C variable. */ -bool pb_decode_fixed64(pb_istream_t *stream, void *dest); - -/* Make a limited-length substream for reading a PB_WT_STRING field. */ -bool pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream); -void pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/third_party/nanopb/pb_encode.c b/third_party/nanopb/pb_encode.c deleted file mode 100644 index 4685614cf70..00000000000 --- a/third_party/nanopb/pb_encode.c +++ /dev/null @@ -1,696 +0,0 @@ -/* pb_encode.c -- encode a protobuf using minimal resources - * - * 2011 Petteri Aimonen - */ - -#include "pb.h" -#include "pb_encode.h" -#include "pb_common.h" - -/* Use the GCC warn_unused_result attribute to check that all return values - * are propagated correctly. On other compilers and gcc before 3.4.0 just - * ignore the annotation. - */ -#if !defined(__GNUC__) || ( __GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) - #define checkreturn -#else - #define checkreturn __attribute__((warn_unused_result)) -#endif - -/************************************** - * Declarations internal to this file * - **************************************/ -typedef bool (*pb_encoder_t)(pb_ostream_t *stream, const pb_field_t *field, const void *src) checkreturn; - -static bool checkreturn buf_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count); -static bool checkreturn encode_array(pb_ostream_t *stream, const pb_field_t *field, const void *pData, size_t count, pb_encoder_t func); -static bool checkreturn encode_field(pb_ostream_t *stream, const pb_field_t *field, const void *pData); -static bool checkreturn default_extension_encoder(pb_ostream_t *stream, const pb_extension_t *extension); -static bool checkreturn encode_extension_field(pb_ostream_t *stream, const pb_field_t *field, const void *pData); -static bool checkreturn pb_enc_varint(pb_ostream_t *stream, const pb_field_t *field, const void *src); -static bool checkreturn pb_enc_uvarint(pb_ostream_t *stream, const pb_field_t *field, const void *src); -static bool checkreturn pb_enc_svarint(pb_ostream_t *stream, const pb_field_t *field, const void *src); -static bool checkreturn pb_enc_fixed32(pb_ostream_t *stream, const pb_field_t *field, const void *src); -static bool checkreturn pb_enc_fixed64(pb_ostream_t *stream, const pb_field_t *field, const void *src); -static bool checkreturn pb_enc_bytes(pb_ostream_t *stream, const pb_field_t *field, const void *src); -static bool checkreturn pb_enc_string(pb_ostream_t *stream, const pb_field_t *field, const void *src); -static bool checkreturn pb_enc_submessage(pb_ostream_t *stream, const pb_field_t *field, const void *src); - -/* --- Function pointers to field encoders --- - * Order in the array must match pb_action_t LTYPE numbering. - */ -static const pb_encoder_t PB_ENCODERS[PB_LTYPES_COUNT] = { - &pb_enc_varint, - &pb_enc_uvarint, - &pb_enc_svarint, - &pb_enc_fixed32, - &pb_enc_fixed64, - - &pb_enc_bytes, - &pb_enc_string, - &pb_enc_submessage, - NULL, /* extensions */ - &pb_enc_bytes /* PB_LTYPE_FIXED_LENGTH_BYTES */ -}; - -/******************************* - * pb_ostream_t implementation * - *******************************/ - -static bool checkreturn buf_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count) -{ - pb_byte_t *dest = (pb_byte_t*)stream->state; - stream->state = dest + count; - - while (count--) - *dest++ = *buf++; - - return true; -} - -pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize) -{ - pb_ostream_t stream; -#ifdef PB_BUFFER_ONLY - stream.callback = (void*)1; /* Just a marker value */ -#else - stream.callback = &buf_write; -#endif - stream.state = buf; - stream.max_size = bufsize; - stream.bytes_written = 0; -#ifndef PB_NO_ERRMSG - stream.errmsg = NULL; -#endif - return stream; -} - -bool checkreturn pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count) -{ - if (stream->callback != NULL) - { - if (stream->bytes_written + count > stream->max_size) - PB_RETURN_ERROR(stream, "stream full"); - -#ifdef PB_BUFFER_ONLY - if (!buf_write(stream, buf, count)) - PB_RETURN_ERROR(stream, "io error"); -#else - if (!stream->callback(stream, buf, count)) - PB_RETURN_ERROR(stream, "io error"); -#endif - } - - stream->bytes_written += count; - return true; -} - -/************************* - * Encode a single field * - *************************/ - -/* Encode a static array. Handles the size calculations and possible packing. */ -static bool checkreturn encode_array(pb_ostream_t *stream, const pb_field_t *field, - const void *pData, size_t count, pb_encoder_t func) -{ - size_t i; - const void *p; - size_t size; - - if (count == 0) - return true; - - if (PB_ATYPE(field->type) != PB_ATYPE_POINTER && count > field->array_size) - PB_RETURN_ERROR(stream, "array max size exceeded"); - - /* We always pack arrays if the datatype allows it. */ - if (PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE) - { - if (!pb_encode_tag(stream, PB_WT_STRING, field->tag)) - return false; - - /* Determine the total size of packed array. */ - if (PB_LTYPE(field->type) == PB_LTYPE_FIXED32) - { - size = 4 * count; - } - else if (PB_LTYPE(field->type) == PB_LTYPE_FIXED64) - { - size = 8 * count; - } - else - { - pb_ostream_t sizestream = PB_OSTREAM_SIZING; - p = pData; - for (i = 0; i < count; i++) - { - if (!func(&sizestream, field, p)) - return false; - p = (const char*)p + field->data_size; - } - size = sizestream.bytes_written; - } - - if (!pb_encode_varint(stream, (uint64_t)size)) - return false; - - if (stream->callback == NULL) - return pb_write(stream, NULL, size); /* Just sizing.. */ - - /* Write the data */ - p = pData; - for (i = 0; i < count; i++) - { - if (!func(stream, field, p)) - return false; - p = (const char*)p + field->data_size; - } - } - else - { - p = pData; - for (i = 0; i < count; i++) - { - if (!pb_encode_tag_for_field(stream, field)) - return false; - - /* Normally the data is stored directly in the array entries, but - * for pointer-type string and bytes fields, the array entries are - * actually pointers themselves also. So we have to dereference once - * more to get to the actual data. */ - if (PB_ATYPE(field->type) == PB_ATYPE_POINTER && - (PB_LTYPE(field->type) == PB_LTYPE_STRING || - PB_LTYPE(field->type) == PB_LTYPE_BYTES)) - { - if (!func(stream, field, *(const void* const*)p)) - return false; - } - else - { - if (!func(stream, field, p)) - return false; - } - p = (const char*)p + field->data_size; - } - } - - return true; -} - -/* Encode a field with static or pointer allocation, i.e. one whose data - * is available to the encoder directly. */ -static bool checkreturn encode_basic_field(pb_ostream_t *stream, - const pb_field_t *field, const void *pData) -{ - pb_encoder_t func; - const void *pSize; - bool implicit_has = true; - - func = PB_ENCODERS[PB_LTYPE(field->type)]; - - if (field->size_offset) - pSize = (const char*)pData + field->size_offset; - else - pSize = &implicit_has; - - if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) - { - /* pData is a pointer to the field, which contains pointer to - * the data. If the 2nd pointer is NULL, it is interpreted as if - * the has_field was false. - */ - - pData = *(const void* const*)pData; - implicit_has = (pData != NULL); - } - - switch (PB_HTYPE(field->type)) - { - case PB_HTYPE_REQUIRED: - if (!pData) - PB_RETURN_ERROR(stream, "missing required field"); - if (!pb_encode_tag_for_field(stream, field)) - return false; - if (!func(stream, field, pData)) - return false; - break; - - case PB_HTYPE_OPTIONAL: - if (*(const bool*)pSize) - { - if (!pb_encode_tag_for_field(stream, field)) - return false; - - if (!func(stream, field, pData)) - return false; - } - break; - - case PB_HTYPE_REPEATED: - if (!encode_array(stream, field, pData, *(const pb_size_t*)pSize, func)) - return false; - break; - - case PB_HTYPE_ONEOF: - if (*(const pb_size_t*)pSize == field->tag) - { - if (!pb_encode_tag_for_field(stream, field)) - return false; - - if (!func(stream, field, pData)) - return false; - } - break; - - default: - PB_RETURN_ERROR(stream, "invalid field type"); - } - - return true; -} - -/* Encode a field with callback semantics. This means that a user function is - * called to provide and encode the actual data. */ -static bool checkreturn encode_callback_field(pb_ostream_t *stream, - const pb_field_t *field, const void *pData) -{ - const pb_callback_t *callback = (const pb_callback_t*)pData; - -#ifdef PB_OLD_CALLBACK_STYLE - const void *arg = callback->arg; -#else - void * const *arg = &(callback->arg); -#endif - - if (callback->funcs.encode != NULL) - { - if (!callback->funcs.encode(stream, field, arg)) - PB_RETURN_ERROR(stream, "callback error"); - } - return true; -} - -/* Encode a single field of any callback or static type. */ -static bool checkreturn encode_field(pb_ostream_t *stream, - const pb_field_t *field, const void *pData) -{ - switch (PB_ATYPE(field->type)) - { - case PB_ATYPE_STATIC: - case PB_ATYPE_POINTER: - return encode_basic_field(stream, field, pData); - - case PB_ATYPE_CALLBACK: - return encode_callback_field(stream, field, pData); - - default: - PB_RETURN_ERROR(stream, "invalid field type"); - } -} - -/* Default handler for extension fields. Expects to have a pb_field_t - * pointer in the extension->type->arg field. */ -static bool checkreturn default_extension_encoder(pb_ostream_t *stream, - const pb_extension_t *extension) -{ - const pb_field_t *field = (const pb_field_t*)extension->type->arg; - - if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) - { - /* For pointer extensions, the pointer is stored directly - * in the extension structure. This avoids having an extra - * indirection. */ - return encode_field(stream, field, &extension->dest); - } - else - { - return encode_field(stream, field, extension->dest); - } -} - -/* Walk through all the registered extensions and give them a chance - * to encode themselves. */ -static bool checkreturn encode_extension_field(pb_ostream_t *stream, - const pb_field_t *field, const void *pData) -{ - const pb_extension_t *extension = *(const pb_extension_t* const *)pData; - PB_UNUSED(field); - - while (extension) - { - bool status; - if (extension->type->encode) - status = extension->type->encode(stream, extension); - else - status = default_extension_encoder(stream, extension); - - if (!status) - return false; - - extension = extension->next; - } - - return true; -} - -/********************* - * Encode all fields * - *********************/ - -static void *remove_const(const void *p) -{ - /* Note: this casts away const, in order to use the common field iterator - * logic for both encoding and decoding. */ - union { - void *p1; - const void *p2; - } t; - t.p2 = p; - return t.p1; -} - -bool checkreturn pb_encode(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct) -{ - pb_field_iter_t iter; - if (!pb_field_iter_begin(&iter, fields, remove_const(src_struct))) - return true; /* Empty message type */ - - do { - if (PB_LTYPE(iter.pos->type) == PB_LTYPE_EXTENSION) - { - /* Special case for the extension field placeholder */ - if (!encode_extension_field(stream, iter.pos, iter.pData)) - return false; - } - else - { - /* Regular field */ - if (!encode_field(stream, iter.pos, iter.pData)) - return false; - } - } while (pb_field_iter_next(&iter)); - - return true; -} - -bool pb_encode_delimited(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct) -{ - return pb_encode_submessage(stream, fields, src_struct); -} - -bool pb_get_encoded_size(size_t *size, const pb_field_t fields[], const void *src_struct) -{ - pb_ostream_t stream = PB_OSTREAM_SIZING; - - if (!pb_encode(&stream, fields, src_struct)) - return false; - - *size = stream.bytes_written; - return true; -} - -/******************** - * Helper functions * - ********************/ -bool checkreturn pb_encode_varint(pb_ostream_t *stream, uint64_t value) -{ - pb_byte_t buffer[10]; - size_t i = 0; - - if (value <= 0x7F) - { - pb_byte_t v = (pb_byte_t)value; - return pb_write(stream, &v, 1); - } - - while (value) - { - buffer[i] = (pb_byte_t)((value & 0x7F) | 0x80); - value >>= 7; - i++; - } - buffer[i-1] &= 0x7F; /* Unset top bit on last byte */ - - return pb_write(stream, buffer, i); -} - -bool checkreturn pb_encode_svarint(pb_ostream_t *stream, int64_t value) -{ - uint64_t zigzagged; - if (value < 0) - zigzagged = ~((uint64_t)value << 1); - else - zigzagged = (uint64_t)value << 1; - - return pb_encode_varint(stream, zigzagged); -} - -bool checkreturn pb_encode_fixed32(pb_ostream_t *stream, const void *value) -{ - uint32_t val = *(const uint32_t*)value; - pb_byte_t bytes[4]; - bytes[0] = (pb_byte_t)(val & 0xFF); - bytes[1] = (pb_byte_t)((val >> 8) & 0xFF); - bytes[2] = (pb_byte_t)((val >> 16) & 0xFF); - bytes[3] = (pb_byte_t)((val >> 24) & 0xFF); - return pb_write(stream, bytes, 4); -} - -bool checkreturn pb_encode_fixed64(pb_ostream_t *stream, const void *value) -{ - uint64_t val = *(const uint64_t*)value; - pb_byte_t bytes[8]; - bytes[0] = (pb_byte_t)(val & 0xFF); - bytes[1] = (pb_byte_t)((val >> 8) & 0xFF); - bytes[2] = (pb_byte_t)((val >> 16) & 0xFF); - bytes[3] = (pb_byte_t)((val >> 24) & 0xFF); - bytes[4] = (pb_byte_t)((val >> 32) & 0xFF); - bytes[5] = (pb_byte_t)((val >> 40) & 0xFF); - bytes[6] = (pb_byte_t)((val >> 48) & 0xFF); - bytes[7] = (pb_byte_t)((val >> 56) & 0xFF); - return pb_write(stream, bytes, 8); -} - -bool checkreturn pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number) -{ - uint64_t tag = ((uint64_t)field_number << 3) | wiretype; - return pb_encode_varint(stream, tag); -} - -bool checkreturn pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_t *field) -{ - pb_wire_type_t wiretype; - switch (PB_LTYPE(field->type)) - { - case PB_LTYPE_VARINT: - case PB_LTYPE_UVARINT: - case PB_LTYPE_SVARINT: - wiretype = PB_WT_VARINT; - break; - - case PB_LTYPE_FIXED32: - wiretype = PB_WT_32BIT; - break; - - case PB_LTYPE_FIXED64: - wiretype = PB_WT_64BIT; - break; - - case PB_LTYPE_BYTES: - case PB_LTYPE_STRING: - case PB_LTYPE_SUBMESSAGE: - case PB_LTYPE_FIXED_LENGTH_BYTES: - wiretype = PB_WT_STRING; - break; - - default: - PB_RETURN_ERROR(stream, "invalid field type"); - } - - return pb_encode_tag(stream, wiretype, field->tag); -} - -bool checkreturn pb_encode_string(pb_ostream_t *stream, const pb_byte_t *buffer, size_t size) -{ - if (!pb_encode_varint(stream, (uint64_t)size)) - return false; - - return pb_write(stream, buffer, size); -} - -bool checkreturn pb_encode_submessage(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct) -{ - /* First calculate the message size using a non-writing substream. */ - pb_ostream_t substream = PB_OSTREAM_SIZING; - size_t size; - bool status; - - if (!pb_encode(&substream, fields, src_struct)) - { -#ifndef PB_NO_ERRMSG - stream->errmsg = substream.errmsg; -#endif - return false; - } - - size = substream.bytes_written; - - if (!pb_encode_varint(stream, (uint64_t)size)) - return false; - - if (stream->callback == NULL) - return pb_write(stream, NULL, size); /* Just sizing */ - - if (stream->bytes_written + size > stream->max_size) - PB_RETURN_ERROR(stream, "stream full"); - - /* Use a substream to verify that a callback doesn't write more than - * what it did the first time. */ - substream.callback = stream->callback; - substream.state = stream->state; - substream.max_size = size; - substream.bytes_written = 0; -#ifndef PB_NO_ERRMSG - substream.errmsg = NULL; -#endif - - status = pb_encode(&substream, fields, src_struct); - - stream->bytes_written += substream.bytes_written; - stream->state = substream.state; -#ifndef PB_NO_ERRMSG - stream->errmsg = substream.errmsg; -#endif - - if (substream.bytes_written != size) - PB_RETURN_ERROR(stream, "submsg size changed"); - - return status; -} - -/* Field encoders */ - -static bool checkreturn pb_enc_varint(pb_ostream_t *stream, const pb_field_t *field, const void *src) -{ - int64_t value = 0; - - if (field->data_size == sizeof(int_least8_t)) - value = *(const int_least8_t*)src; - else if (field->data_size == sizeof(int_least16_t)) - value = *(const int_least16_t*)src; - else if (field->data_size == sizeof(int32_t)) - value = *(const int32_t*)src; - else if (field->data_size == sizeof(int64_t)) - value = *(const int64_t*)src; - else - PB_RETURN_ERROR(stream, "invalid data_size"); - - return pb_encode_varint(stream, (uint64_t)value); -} - -static bool checkreturn pb_enc_uvarint(pb_ostream_t *stream, const pb_field_t *field, const void *src) -{ - uint64_t value = 0; - - if (field->data_size == sizeof(uint_least8_t)) - value = *(const uint_least8_t*)src; - else if (field->data_size == sizeof(uint_least16_t)) - value = *(const uint_least16_t*)src; - else if (field->data_size == sizeof(uint32_t)) - value = *(const uint32_t*)src; - else if (field->data_size == sizeof(uint64_t)) - value = *(const uint64_t*)src; - else - PB_RETURN_ERROR(stream, "invalid data_size"); - - return pb_encode_varint(stream, value); -} - -static bool checkreturn pb_enc_svarint(pb_ostream_t *stream, const pb_field_t *field, const void *src) -{ - int64_t value = 0; - - if (field->data_size == sizeof(int_least8_t)) - value = *(const int_least8_t*)src; - else if (field->data_size == sizeof(int_least16_t)) - value = *(const int_least16_t*)src; - else if (field->data_size == sizeof(int32_t)) - value = *(const int32_t*)src; - else if (field->data_size == sizeof(int64_t)) - value = *(const int64_t*)src; - else - PB_RETURN_ERROR(stream, "invalid data_size"); - - return pb_encode_svarint(stream, value); -} - -static bool checkreturn pb_enc_fixed64(pb_ostream_t *stream, const pb_field_t *field, const void *src) -{ - PB_UNUSED(field); - return pb_encode_fixed64(stream, src); -} - -static bool checkreturn pb_enc_fixed32(pb_ostream_t *stream, const pb_field_t *field, const void *src) -{ - PB_UNUSED(field); - return pb_encode_fixed32(stream, src); -} - -static bool checkreturn pb_enc_bytes(pb_ostream_t *stream, const pb_field_t *field, const void *src) -{ - const pb_bytes_array_t *bytes = NULL; - - if (PB_LTYPE(field->type) == PB_LTYPE_FIXED_LENGTH_BYTES) - return pb_encode_string(stream, (const pb_byte_t*)src, field->data_size); - - bytes = (const pb_bytes_array_t*)src; - - if (src == NULL) - { - /* Treat null pointer as an empty bytes field */ - return pb_encode_string(stream, NULL, 0); - } - - if (PB_ATYPE(field->type) == PB_ATYPE_STATIC && - PB_BYTES_ARRAY_T_ALLOCSIZE(bytes->size) > field->data_size) - { - PB_RETURN_ERROR(stream, "bytes size exceeded"); - } - - return pb_encode_string(stream, bytes->bytes, bytes->size); -} - -static bool checkreturn pb_enc_string(pb_ostream_t *stream, const pb_field_t *field, const void *src) -{ - size_t size = 0; - size_t max_size = field->data_size; - const char *p = (const char*)src; - - if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) - max_size = (size_t)-1; - - if (src == NULL) - { - size = 0; /* Treat null pointer as an empty string */ - } - else - { - /* strnlen() is not always available, so just use a loop */ - while (size < max_size && *p != '\0') - { - size++; - p++; - } - } - - return pb_encode_string(stream, (const pb_byte_t*)src, size); -} - -static bool checkreturn pb_enc_submessage(pb_ostream_t *stream, const pb_field_t *field, const void *src) -{ - if (field->ptr == NULL) - PB_RETURN_ERROR(stream, "invalid field descriptor"); - - return pb_encode_submessage(stream, (const pb_field_t*)field->ptr, src); -} - diff --git a/third_party/nanopb/pb_encode.h b/third_party/nanopb/pb_encode.h deleted file mode 100644 index d9909fb0137..00000000000 --- a/third_party/nanopb/pb_encode.h +++ /dev/null @@ -1,154 +0,0 @@ -/* pb_encode.h: Functions to encode protocol buffers. Depends on pb_encode.c. - * The main function is pb_encode. You also need an output stream, and the - * field descriptions created by nanopb_generator.py. - */ - -#ifndef PB_ENCODE_H_INCLUDED -#define PB_ENCODE_H_INCLUDED - -#include "pb.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Structure for defining custom output streams. You will need to provide - * a callback function to write the bytes to your storage, which can be - * for example a file or a network socket. - * - * The callback must conform to these rules: - * - * 1) Return false on IO errors. This will cause encoding to abort. - * 2) You can use state to store your own data (e.g. buffer pointer). - * 3) pb_write will update bytes_written after your callback runs. - * 4) Substreams will modify max_size and bytes_written. Don't use them - * to calculate any pointers. - */ -struct pb_ostream_s -{ -#ifdef PB_BUFFER_ONLY - /* Callback pointer is not used in buffer-only configuration. - * Having an int pointer here allows binary compatibility but - * gives an error if someone tries to assign callback function. - * Also, NULL pointer marks a 'sizing stream' that does not - * write anything. - */ - int *callback; -#else - bool (*callback)(pb_ostream_t *stream, const pb_byte_t *buf, size_t count); -#endif - void *state; /* Free field for use by callback implementation. */ - size_t max_size; /* Limit number of output bytes written (or use SIZE_MAX). */ - size_t bytes_written; /* Number of bytes written so far. */ - -#ifndef PB_NO_ERRMSG - const char *errmsg; -#endif -}; - -/*************************** - * Main encoding functions * - ***************************/ - -/* Encode a single protocol buffers message from C structure into a stream. - * Returns true on success, false on any failure. - * The actual struct pointed to by src_struct must match the description in fields. - * All required fields in the struct are assumed to have been filled in. - * - * Example usage: - * MyMessage msg = {}; - * uint8_t buffer[64]; - * pb_ostream_t stream; - * - * msg.field1 = 42; - * stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - * pb_encode(&stream, MyMessage_fields, &msg); - */ -bool pb_encode(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); - -/* Same as pb_encode, but prepends the length of the message as a varint. - * Corresponds to writeDelimitedTo() in Google's protobuf API. - */ -bool pb_encode_delimited(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); - -/* Encode the message to get the size of the encoded data, but do not store - * the data. */ -bool pb_get_encoded_size(size_t *size, const pb_field_t fields[], const void *src_struct); - -/************************************** - * Functions for manipulating streams * - **************************************/ - -/* Create an output stream for writing into a memory buffer. - * The number of bytes written can be found in stream.bytes_written after - * encoding the message. - * - * Alternatively, you can use a custom stream that writes directly to e.g. - * a file or a network socket. - */ -pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize); - -/* Pseudo-stream for measuring the size of a message without actually storing - * the encoded data. - * - * Example usage: - * MyMessage msg = {}; - * pb_ostream_t stream = PB_OSTREAM_SIZING; - * pb_encode(&stream, MyMessage_fields, &msg); - * printf("Message size is %d\n", stream.bytes_written); - */ -#ifndef PB_NO_ERRMSG -#define PB_OSTREAM_SIZING {0,0,0,0,0} -#else -#define PB_OSTREAM_SIZING {0,0,0,0} -#endif - -/* Function to write into a pb_ostream_t stream. You can use this if you need - * to append or prepend some custom headers to the message. - */ -bool pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count); - - -/************************************************ - * Helper functions for writing field callbacks * - ************************************************/ - -/* Encode field header based on type and field number defined in the field - * structure. Call this from the callback before writing out field contents. */ -bool pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_t *field); - -/* Encode field header by manually specifing wire type. You need to use this - * if you want to write out packed arrays from a callback field. */ -bool pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number); - -/* Encode an integer in the varint format. - * This works for bool, enum, int32, int64, uint32 and uint64 field types. */ -bool pb_encode_varint(pb_ostream_t *stream, uint64_t value); - -/* Encode an integer in the zig-zagged svarint format. - * This works for sint32 and sint64. */ -bool pb_encode_svarint(pb_ostream_t *stream, int64_t value); - -/* Encode a string or bytes type field. For strings, pass strlen(s) as size. */ -bool pb_encode_string(pb_ostream_t *stream, const pb_byte_t *buffer, size_t size); - -/* Encode a fixed32, sfixed32 or float value. - * You need to pass a pointer to a 4-byte wide C variable. */ -bool pb_encode_fixed32(pb_ostream_t *stream, const void *value); - -/* Encode a fixed64, sfixed64 or double value. - * You need to pass a pointer to a 8-byte wide C variable. */ -bool pb_encode_fixed64(pb_ostream_t *stream, const void *value); - -/* Encode a submessage field. - * You need to pass the pb_field_t array and pointer to struct, just like - * with pb_encode(). This internally encodes the submessage twice, first to - * calculate message size and then to actually write it out. - */ -bool pb_encode_submessage(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/third_party/nanopb/tests/Makefile b/third_party/nanopb/tests/Makefile deleted file mode 100644 index cee6bf67eb6..00000000000 --- a/third_party/nanopb/tests/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -all: - scons - -clean: - scons -c - -coverage: - rm -rf build coverage - - # LCOV does not like the newer gcov format - scons CC=gcc-4.6 CXX=gcc-4.6 - - # Collect the data - mkdir build/coverage - lcov --base-directory . --directory build/ --gcov-tool gcov-4.6 -c -o build/coverage/nanopb.info - - # Remove the test code from results - lcov -r build/coverage/nanopb.info '*tests*' -o build/coverage/nanopb.info - - # Generate HTML - genhtml -o build/coverage build/coverage/nanopb.info diff --git a/third_party/nanopb/tests/SConstruct b/third_party/nanopb/tests/SConstruct deleted file mode 100644 index d8ab9ab0ac9..00000000000 --- a/third_party/nanopb/tests/SConstruct +++ /dev/null @@ -1,155 +0,0 @@ -Help(''' -Type 'scons' to build and run all the available test cases. -It will automatically detect your platform and C compiler and -build appropriately. - -You can modify the behavious using following options: -CC Name of C compiler -CXX Name of C++ compiler -CCFLAGS Flags to pass to the C compiler -CXXFLAGS Flags to pass to the C++ compiler - -For example, for a clang build, use: -scons CC=clang CXX=clang++ -''') - -import os -env = Environment(ENV = os.environ, tools = ['default', 'nanopb']) - -# Allow overriding the compiler with scons CC=??? -if 'CC' in ARGUMENTS: env.Replace(CC = ARGUMENTS['CC']) -if 'CXX' in ARGUMENTS: env.Replace(CXX = ARGUMENTS['CXX']) -if 'CCFLAGS' in ARGUMENTS: env.Append(CCFLAGS = ARGUMENTS['CCFLAGS']) -if 'CXXFLAGS' in ARGUMENTS: env.Append(CXXFLAGS = ARGUMENTS['CXXFLAGS']) - -# Add the builders defined in site_init.py -add_nanopb_builders(env) - -# Path to the files shared by tests, and to the nanopb core. -env.Append(CPPPATH = ["#../", "$COMMON"]) - -# Path for finding nanopb.proto -env.Append(PROTOCPATH = '#../generator') - -# Check the compilation environment, unless we are just cleaning up. -if not env.GetOption('clean'): - def check_ccflags(context, flags, linkflags = ''): - '''Check if given CCFLAGS are supported''' - context.Message('Checking support for CCFLAGS="%s"... ' % flags) - oldflags = context.env['CCFLAGS'] - oldlinkflags = context.env['CCFLAGS'] - context.env.Append(CCFLAGS = flags) - context.env.Append(LINKFLAGS = linkflags) - result = context.TryCompile("int main() {return 0;}", '.c') - context.env.Replace(CCFLAGS = oldflags) - context.env.Replace(LINKFLAGS = oldlinkflags) - context.Result(result) - return result - - conf = Configure(env, custom_tests = {'CheckCCFLAGS': check_ccflags}) - - # If the platform doesn't support C99, use our own header file instead. - stdbool = conf.CheckCHeader('stdbool.h') - stdint = conf.CheckCHeader('stdint.h') - stddef = conf.CheckCHeader('stddef.h') - string = conf.CheckCHeader('string.h') - stdlib = conf.CheckCHeader('stdlib.h') - if not stdbool or not stdint or not stddef or not string: - conf.env.Append(CPPDEFINES = {'PB_SYSTEM_HEADER': '\\"pb_syshdr.h\\"'}) - conf.env.Append(CPPPATH = "#../extra") - conf.env.Append(SYSHDR = '\\"pb_syshdr.h\\"') - - if stdbool: conf.env.Append(CPPDEFINES = {'HAVE_STDBOOL_H': 1}) - if stdint: conf.env.Append(CPPDEFINES = {'HAVE_STDINT_H': 1}) - if stddef: conf.env.Append(CPPDEFINES = {'HAVE_STDDEF_H': 1}) - if string: conf.env.Append(CPPDEFINES = {'HAVE_STRING_H': 1}) - if stdlib: conf.env.Append(CPPDEFINES = {'HAVE_STDLIB_H': 1}) - - # Check if we can use pkg-config to find protobuf include path - status, output = conf.TryAction('pkg-config protobuf --variable=includedir > $TARGET') - if status: - conf.env.Append(PROTOCPATH = output.strip()) - else: - conf.env.Append(PROTOCPATH = '/usr/include') - - # Check protoc version - status, output = conf.TryAction('$PROTOC --version > $TARGET') - if status: - conf.env['PROTOC_VERSION'] = output - - # Check if libmudflap is available (only with GCC) - if 'gcc' in env['CC']: - if conf.CheckLib('mudflap'): - conf.env.Append(CCFLAGS = '-fmudflap') - conf.env.Append(LINKFLAGS = '-fmudflap') - - # Check if we can use extra strict warning flags (only with GCC) - extra = '-Wcast-qual -Wlogical-op -Wconversion' - extra += ' -fstrict-aliasing -Wstrict-aliasing=1' - extra += ' -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls' - extra += ' -Wstack-protector ' - if 'gcc' in env['CC']: - if conf.CheckCCFLAGS(extra): - conf.env.Append(CORECFLAGS = extra) - - # Check if we can use undefined behaviour sanitizer (only with clang) - extra = '-fsanitize=undefined ' - if 'clang' in env['CC']: - if conf.CheckCCFLAGS(extra, linkflags = extra): - conf.env.Append(CORECFLAGS = extra) - conf.env.Append(LINKFLAGS = extra) - - # End the config stuff - env = conf.Finish() - -# Initialize the CCFLAGS according to the compiler -if 'gcc' in env['CC']: - # GNU Compiler Collection - - # Debug info, warnings as errors - env.Append(CFLAGS = '-ansi -pedantic -g -Wall -Werror -fprofile-arcs -ftest-coverage ') - env.Append(CORECFLAGS = '-Wextra') - env.Append(LINKFLAGS = '-g --coverage') - - # We currently need uint64_t anyway, even though ANSI C90 otherwise.. - env.Append(CFLAGS = '-Wno-long-long') -elif 'clang' in env['CC']: - # CLang - env.Append(CFLAGS = '-ansi -g -Wall -Werror') - env.Append(CORECFLAGS = ' -Wextra -Wcast-qual -Wconversion') -elif 'cl' in env['CC']: - # Microsoft Visual C++ - - # Debug info on, warning level 2 for tests, warnings as errors - env.Append(CFLAGS = '/Zi /W2 /WX') - env.Append(LINKFLAGS = '/DEBUG') - - # More strict checks on the nanopb core - env.Append(CORECFLAGS = '/W4') -elif 'tcc' in env['CC']: - # Tiny C Compiler - env.Append(CFLAGS = '-Wall -Werror -g') - -env.SetDefault(CORECFLAGS = '') - -if 'clang' in env['CXX']: - env.Append(CXXFLAGS = '-g -Wall -Werror -Wextra -Wno-missing-field-initializers') -elif 'g++' in env['CXX'] or 'gcc' in env['CXX']: - env.Append(CXXFLAGS = '-g -Wall -Werror -Wextra -Wno-missing-field-initializers') -elif 'cl' in env['CXX']: - env.Append(CXXFLAGS = '/Zi /W2 /WX') - -# Now include the SConscript files from all subdirectories -import os.path -env['VARIANT_DIR'] = 'build' -env['BUILD'] = '#' + env['VARIANT_DIR'] -env['COMMON'] = '#' + env['VARIANT_DIR'] + '/common' - -# Include common/SConscript first to make sure its exports are available -# to other SConscripts. -SConscript("common/SConscript", exports = 'env', variant_dir = env['VARIANT_DIR'] + '/common') - -for subdir in Glob('*/SConscript') + Glob('regression/*/SConscript'): - if str(subdir).startswith("common"): continue - SConscript(subdir, exports = 'env', variant_dir = env['VARIANT_DIR'] + '/' + os.path.dirname(str(subdir))) - diff --git a/third_party/nanopb/tests/alltypes/SConscript b/third_party/nanopb/tests/alltypes/SConscript deleted file mode 100644 index 6c6238c681e..00000000000 --- a/third_party/nanopb/tests/alltypes/SConscript +++ /dev/null @@ -1,35 +0,0 @@ -# Build and run a test that encodes and decodes a message that contains -# all of the Protocol Buffers data types. - -Import("env") - -env.NanopbProto(["alltypes", "alltypes.options"]) -enc = env.Program(["encode_alltypes.c", "alltypes.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"]) -dec = env.Program(["decode_alltypes.c", "alltypes.pb.c", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"]) - -# Test the round-trip from nanopb encoder to nanopb decoder -env.RunTest(enc) -env.RunTest([dec, "encode_alltypes.output"]) - -# Re-encode the data using protoc, and check that the results from nanopb -# match byte-per-byte to the protoc output. -env.Decode("encode_alltypes.output.decoded", - ["encode_alltypes.output", "alltypes.proto"], - MESSAGE='AllTypes') -env.Encode("encode_alltypes.output.recoded", - ["encode_alltypes.output.decoded", "alltypes.proto"], - MESSAGE='AllTypes') -env.Compare(["encode_alltypes.output", "encode_alltypes.output.recoded"]) - -# Do the same checks with the optional fields present. -env.RunTest("optionals.output", enc, ARGS = ['1']) -env.RunTest("optionals.decout", [dec, "optionals.output"], ARGS = ['1']) -env.Decode("optionals.output.decoded", - ["optionals.output", "alltypes.proto"], - MESSAGE='AllTypes') -env.Encode("optionals.output.recoded", - ["optionals.output.decoded", "alltypes.proto"], - MESSAGE='AllTypes') -env.Compare(["optionals.output", "optionals.output.recoded"]) - - diff --git a/third_party/nanopb/tests/alltypes/alltypes.options b/third_party/nanopb/tests/alltypes/alltypes.options deleted file mode 100644 index b31e3cf0a9d..00000000000 --- a/third_party/nanopb/tests/alltypes/alltypes.options +++ /dev/null @@ -1,3 +0,0 @@ -* max_size:16 -* max_count:5 - diff --git a/third_party/nanopb/tests/alltypes/alltypes.proto b/third_party/nanopb/tests/alltypes/alltypes.proto deleted file mode 100644 index 3995c552972..00000000000 --- a/third_party/nanopb/tests/alltypes/alltypes.proto +++ /dev/null @@ -1,123 +0,0 @@ -syntax = "proto2"; -// package name placeholder - -message SubMessage { - required string substuff1 = 1 [default = "1"]; - required int32 substuff2 = 2 [default = 2]; - optional fixed32 substuff3 = 3 [default = 3]; -} - -message EmptyMessage { - -} - -enum HugeEnum { - Negative = -2147483647; /* protoc doesn't accept -2147483648 here */ - Positive = 2147483647; -} - -message Limits { - required int32 int32_min = 1 [default = 2147483647]; - required int32 int32_max = 2 [default = -2147483647]; - required uint32 uint32_min = 3 [default = 4294967295]; - required uint32 uint32_max = 4 [default = 0]; - required int64 int64_min = 5 [default = 9223372036854775807]; - required int64 int64_max = 6 [default = -9223372036854775807]; - required uint64 uint64_min = 7 [default = 18446744073709551615]; - required uint64 uint64_max = 8 [default = 0]; - required HugeEnum enum_min = 9 [default = Positive]; - required HugeEnum enum_max = 10 [default = Negative]; -} - -enum MyEnum { - Zero = 0; - First = 1; - Second = 2; - Truth = 42; -} - -message AllTypes { - required int32 req_int32 = 1; - required int64 req_int64 = 2; - required uint32 req_uint32 = 3; - required uint64 req_uint64 = 4; - required sint32 req_sint32 = 5; - required sint64 req_sint64 = 6; - required bool req_bool = 7; - - required fixed32 req_fixed32 = 8; - required sfixed32 req_sfixed32= 9; - required float req_float = 10; - - required fixed64 req_fixed64 = 11; - required sfixed64 req_sfixed64= 12; - required double req_double = 13; - - required string req_string = 14; - required bytes req_bytes = 15; - required SubMessage req_submsg = 16; - required MyEnum req_enum = 17; - required EmptyMessage req_emptymsg = 18; - - - repeated int32 rep_int32 = 21 [packed = true]; - repeated int64 rep_int64 = 22 [packed = true]; - repeated uint32 rep_uint32 = 23 [packed = true]; - repeated uint64 rep_uint64 = 24 [packed = true]; - repeated sint32 rep_sint32 = 25 [packed = true]; - repeated sint64 rep_sint64 = 26 [packed = true]; - repeated bool rep_bool = 27 [packed = true]; - - repeated fixed32 rep_fixed32 = 28 [packed = true]; - repeated sfixed32 rep_sfixed32= 29 [packed = true]; - repeated float rep_float = 30 [packed = true]; - - repeated fixed64 rep_fixed64 = 31 [packed = true]; - repeated sfixed64 rep_sfixed64= 32 [packed = true]; - repeated double rep_double = 33 [packed = true]; - - repeated string rep_string = 34; - repeated bytes rep_bytes = 35; - repeated SubMessage rep_submsg = 36; - repeated MyEnum rep_enum = 37 [packed = true]; - repeated EmptyMessage rep_emptymsg = 38; - - optional int32 opt_int32 = 41 [default = 4041]; - optional int64 opt_int64 = 42 [default = 4042]; - optional uint32 opt_uint32 = 43 [default = 4043]; - optional uint64 opt_uint64 = 44 [default = 4044]; - optional sint32 opt_sint32 = 45 [default = 4045]; - optional sint64 opt_sint64 = 46 [default = 4046]; - optional bool opt_bool = 47 [default = false]; - - optional fixed32 opt_fixed32 = 48 [default = 4048]; - optional sfixed32 opt_sfixed32= 49 [default = 4049]; - optional float opt_float = 50 [default = 4050]; - - optional fixed64 opt_fixed64 = 51 [default = 4051]; - optional sfixed64 opt_sfixed64= 52 [default = 4052]; - optional double opt_double = 53 [default = 4053]; - - optional string opt_string = 54 [default = "4054"]; - optional bytes opt_bytes = 55 [default = "4055"]; - optional SubMessage opt_submsg = 56; - optional MyEnum opt_enum = 57 [default = Second]; - optional EmptyMessage opt_emptymsg = 58; - - oneof oneof - { - SubMessage oneof_msg1 = 59; - EmptyMessage oneof_msg2 = 60; - } - - // Check that extreme integer values are handled correctly - required Limits req_limits = 98; - - // Just to make sure that the size of the fields has been calculated - // properly, i.e. otherwise a bug in last field might not be detected. - required int32 end = 99; - - - extensions 200 to 255; -} - diff --git a/third_party/nanopb/tests/alltypes/decode_alltypes.c b/third_party/nanopb/tests/alltypes/decode_alltypes.c deleted file mode 100644 index 458e51122ab..00000000000 --- a/third_party/nanopb/tests/alltypes/decode_alltypes.c +++ /dev/null @@ -1,221 +0,0 @@ -/* Tests the decoding of all types. - * This is the counterpart of test_encode3. - * Run e.g. ./test_encode3 | ./test_decode3 - */ - -#include -#include -#include -#include -#include "alltypes.pb.h" -#include "test_helpers.h" - -#define TEST(x) if (!(x)) { \ - printf("Test " #x " failed.\n"); \ - return false; \ - } - -/* This function is called once from main(), it handles - the decoding and checks the fields. */ -bool check_alltypes(pb_istream_t *stream, int mode) -{ - /* Uses _init_default to just make sure that it works. */ - AllTypes alltypes = AllTypes_init_default; - - /* Fill with garbage to better detect initialization errors */ - memset(&alltypes, 0xAA, sizeof(alltypes)); - alltypes.extensions = 0; - - if (!pb_decode(stream, AllTypes_fields, &alltypes)) - return false; - - TEST(alltypes.req_int32 == -1001); - TEST(alltypes.req_int64 == -1002); - TEST(alltypes.req_uint32 == 1003); - TEST(alltypes.req_uint64 == 1004); - TEST(alltypes.req_sint32 == -1005); - TEST(alltypes.req_sint64 == -1006); - TEST(alltypes.req_bool == true); - - TEST(alltypes.req_fixed32 == 1008); - TEST(alltypes.req_sfixed32 == -1009); - TEST(alltypes.req_float == 1010.0f); - - TEST(alltypes.req_fixed64 == 1011); - TEST(alltypes.req_sfixed64 == -1012); - TEST(alltypes.req_double == 1013.0f); - - TEST(strcmp(alltypes.req_string, "1014") == 0); - TEST(alltypes.req_bytes.size == 4); - TEST(memcmp(alltypes.req_bytes.bytes, "1015", 4) == 0); - TEST(strcmp(alltypes.req_submsg.substuff1, "1016") == 0); - TEST(alltypes.req_submsg.substuff2 == 1016); - TEST(alltypes.req_submsg.substuff3 == 3); - TEST(alltypes.req_enum == MyEnum_Truth); - - TEST(alltypes.rep_int32_count == 5 && alltypes.rep_int32[4] == -2001 && alltypes.rep_int32[0] == 0); - TEST(alltypes.rep_int64_count == 5 && alltypes.rep_int64[4] == -2002 && alltypes.rep_int64[0] == 0); - TEST(alltypes.rep_uint32_count == 5 && alltypes.rep_uint32[4] == 2003 && alltypes.rep_uint32[0] == 0); - TEST(alltypes.rep_uint64_count == 5 && alltypes.rep_uint64[4] == 2004 && alltypes.rep_uint64[0] == 0); - TEST(alltypes.rep_sint32_count == 5 && alltypes.rep_sint32[4] == -2005 && alltypes.rep_sint32[0] == 0); - TEST(alltypes.rep_sint64_count == 5 && alltypes.rep_sint64[4] == -2006 && alltypes.rep_sint64[0] == 0); - TEST(alltypes.rep_bool_count == 5 && alltypes.rep_bool[4] == true && alltypes.rep_bool[0] == false); - - TEST(alltypes.rep_fixed32_count == 5 && alltypes.rep_fixed32[4] == 2008 && alltypes.rep_fixed32[0] == 0); - TEST(alltypes.rep_sfixed32_count == 5 && alltypes.rep_sfixed32[4] == -2009 && alltypes.rep_sfixed32[0] == 0); - TEST(alltypes.rep_float_count == 5 && alltypes.rep_float[4] == 2010.0f && alltypes.rep_float[0] == 0.0f); - - TEST(alltypes.rep_fixed64_count == 5 && alltypes.rep_fixed64[4] == 2011 && alltypes.rep_fixed64[0] == 0); - TEST(alltypes.rep_sfixed64_count == 5 && alltypes.rep_sfixed64[4] == -2012 && alltypes.rep_sfixed64[0] == 0); - TEST(alltypes.rep_double_count == 5 && alltypes.rep_double[4] == 2013.0 && alltypes.rep_double[0] == 0.0); - - TEST(alltypes.rep_string_count == 5 && strcmp(alltypes.rep_string[4], "2014") == 0 && alltypes.rep_string[0][0] == '\0'); - TEST(alltypes.rep_bytes_count == 5 && alltypes.rep_bytes[4].size == 4 && alltypes.rep_bytes[0].size == 0); - TEST(memcmp(alltypes.rep_bytes[4].bytes, "2015", 4) == 0); - - TEST(alltypes.rep_submsg_count == 5); - TEST(strcmp(alltypes.rep_submsg[4].substuff1, "2016") == 0 && alltypes.rep_submsg[0].substuff1[0] == '\0'); - TEST(alltypes.rep_submsg[4].substuff2 == 2016 && alltypes.rep_submsg[0].substuff2 == 0); - TEST(alltypes.rep_submsg[4].substuff3 == 2016 && alltypes.rep_submsg[0].substuff3 == 3); - - TEST(alltypes.rep_enum_count == 5 && alltypes.rep_enum[4] == MyEnum_Truth && alltypes.rep_enum[0] == MyEnum_Zero); - TEST(alltypes.rep_emptymsg_count == 5); - - if (mode == 0) - { - /* Expect default values */ - TEST(alltypes.has_opt_int32 == false); - TEST(alltypes.opt_int32 == 4041); - TEST(alltypes.has_opt_int64 == false); - TEST(alltypes.opt_int64 == 4042); - TEST(alltypes.has_opt_uint32 == false); - TEST(alltypes.opt_uint32 == 4043); - TEST(alltypes.has_opt_uint64 == false); - TEST(alltypes.opt_uint64 == 4044); - TEST(alltypes.has_opt_sint32 == false); - TEST(alltypes.opt_sint32 == 4045); - TEST(alltypes.has_opt_sint64 == false); - TEST(alltypes.opt_sint64 == 4046); - TEST(alltypes.has_opt_bool == false); - TEST(alltypes.opt_bool == false); - - TEST(alltypes.has_opt_fixed32 == false); - TEST(alltypes.opt_fixed32 == 4048); - TEST(alltypes.has_opt_sfixed32 == false); - TEST(alltypes.opt_sfixed32 == 4049); - TEST(alltypes.has_opt_float == false); - TEST(alltypes.opt_float == 4050.0f); - - TEST(alltypes.has_opt_fixed64 == false); - TEST(alltypes.opt_fixed64 == 4051); - TEST(alltypes.has_opt_sfixed64 == false); - TEST(alltypes.opt_sfixed64 == 4052); - TEST(alltypes.has_opt_double == false); - TEST(alltypes.opt_double == 4053.0); - - TEST(alltypes.has_opt_string == false); - TEST(strcmp(alltypes.opt_string, "4054") == 0); - TEST(alltypes.has_opt_bytes == false); - TEST(alltypes.opt_bytes.size == 4); - TEST(memcmp(alltypes.opt_bytes.bytes, "4055", 4) == 0); - TEST(alltypes.has_opt_submsg == false); - TEST(strcmp(alltypes.opt_submsg.substuff1, "1") == 0); - TEST(alltypes.opt_submsg.substuff2 == 2); - TEST(alltypes.opt_submsg.substuff3 == 3); - TEST(alltypes.has_opt_enum == false); - TEST(alltypes.opt_enum == MyEnum_Second); - TEST(alltypes.has_opt_emptymsg == false); - - TEST(alltypes.which_oneof == 0); - } - else - { - /* Expect filled-in values */ - TEST(alltypes.has_opt_int32 == true); - TEST(alltypes.opt_int32 == 3041); - TEST(alltypes.has_opt_int64 == true); - TEST(alltypes.opt_int64 == 3042); - TEST(alltypes.has_opt_uint32 == true); - TEST(alltypes.opt_uint32 == 3043); - TEST(alltypes.has_opt_uint64 == true); - TEST(alltypes.opt_uint64 == 3044); - TEST(alltypes.has_opt_sint32 == true); - TEST(alltypes.opt_sint32 == 3045); - TEST(alltypes.has_opt_sint64 == true); - TEST(alltypes.opt_sint64 == 3046); - TEST(alltypes.has_opt_bool == true); - TEST(alltypes.opt_bool == true); - - TEST(alltypes.has_opt_fixed32 == true); - TEST(alltypes.opt_fixed32 == 3048); - TEST(alltypes.has_opt_sfixed32 == true); - TEST(alltypes.opt_sfixed32 == 3049); - TEST(alltypes.has_opt_float == true); - TEST(alltypes.opt_float == 3050.0f); - - TEST(alltypes.has_opt_fixed64 == true); - TEST(alltypes.opt_fixed64 == 3051); - TEST(alltypes.has_opt_sfixed64 == true); - TEST(alltypes.opt_sfixed64 == 3052); - TEST(alltypes.has_opt_double == true); - TEST(alltypes.opt_double == 3053.0); - - TEST(alltypes.has_opt_string == true); - TEST(strcmp(alltypes.opt_string, "3054") == 0); - TEST(alltypes.has_opt_bytes == true); - TEST(alltypes.opt_bytes.size == 4); - TEST(memcmp(alltypes.opt_bytes.bytes, "3055", 4) == 0); - TEST(alltypes.has_opt_submsg == true); - TEST(strcmp(alltypes.opt_submsg.substuff1, "3056") == 0); - TEST(alltypes.opt_submsg.substuff2 == 3056); - TEST(alltypes.opt_submsg.substuff3 == 3); - TEST(alltypes.has_opt_enum == true); - TEST(alltypes.opt_enum == MyEnum_Truth); - TEST(alltypes.has_opt_emptymsg == true); - - TEST(alltypes.which_oneof == AllTypes_oneof_msg1_tag); - TEST(strcmp(alltypes.oneof.oneof_msg1.substuff1, "4059") == 0); - TEST(alltypes.oneof.oneof_msg1.substuff2 == 4059); - } - - TEST(alltypes.req_limits.int32_min == INT32_MIN); - TEST(alltypes.req_limits.int32_max == INT32_MAX); - TEST(alltypes.req_limits.uint32_min == 0); - TEST(alltypes.req_limits.uint32_max == UINT32_MAX); - TEST(alltypes.req_limits.int64_min == INT64_MIN); - TEST(alltypes.req_limits.int64_max == INT64_MAX); - TEST(alltypes.req_limits.uint64_min == 0); - TEST(alltypes.req_limits.uint64_max == UINT64_MAX); - TEST(alltypes.req_limits.enum_min == HugeEnum_Negative); - TEST(alltypes.req_limits.enum_max == HugeEnum_Positive); - - TEST(alltypes.end == 1099); - - return true; -} - -int main(int argc, char **argv) -{ - uint8_t buffer[1024]; - size_t count; - pb_istream_t stream; - - /* Whether to expect the optional values or the default values. */ - int mode = (argc > 1) ? atoi(argv[1]) : 0; - - /* Read the data into buffer */ - SET_BINARY_MODE(stdin); - count = fread(buffer, 1, sizeof(buffer), stdin); - - /* Construct a pb_istream_t for reading from the buffer */ - stream = pb_istream_from_buffer(buffer, count); - - /* Decode and print out the stuff */ - if (!check_alltypes(&stream, mode)) - { - printf("Parsing failed: %s\n", PB_GET_ERROR(&stream)); - return 1; - } else { - return 0; - } -} diff --git a/third_party/nanopb/tests/alltypes/encode_alltypes.c b/third_party/nanopb/tests/alltypes/encode_alltypes.c deleted file mode 100644 index 16f4b29893b..00000000000 --- a/third_party/nanopb/tests/alltypes/encode_alltypes.c +++ /dev/null @@ -1,149 +0,0 @@ -/* Attempts to test all the datatypes supported by ProtoBuf. - */ - -#include -#include -#include -#include -#include "alltypes.pb.h" -#include "test_helpers.h" - -int main(int argc, char **argv) -{ - int mode = (argc > 1) ? atoi(argv[1]) : 0; - - /* Initialize the structure with constants */ - AllTypes alltypes = AllTypes_init_zero; - - alltypes.req_int32 = -1001; - alltypes.req_int64 = -1002; - alltypes.req_uint32 = 1003; - alltypes.req_uint64 = 1004; - alltypes.req_sint32 = -1005; - alltypes.req_sint64 = -1006; - alltypes.req_bool = true; - - alltypes.req_fixed32 = 1008; - alltypes.req_sfixed32 = -1009; - alltypes.req_float = 1010.0f; - - alltypes.req_fixed64 = 1011; - alltypes.req_sfixed64 = -1012; - alltypes.req_double = 1013.0; - - strcpy(alltypes.req_string, "1014"); - alltypes.req_bytes.size = 4; - memcpy(alltypes.req_bytes.bytes, "1015", 4); - strcpy(alltypes.req_submsg.substuff1, "1016"); - alltypes.req_submsg.substuff2 = 1016; - alltypes.req_enum = MyEnum_Truth; - - alltypes.rep_int32_count = 5; alltypes.rep_int32[4] = -2001; - alltypes.rep_int64_count = 5; alltypes.rep_int64[4] = -2002; - alltypes.rep_uint32_count = 5; alltypes.rep_uint32[4] = 2003; - alltypes.rep_uint64_count = 5; alltypes.rep_uint64[4] = 2004; - alltypes.rep_sint32_count = 5; alltypes.rep_sint32[4] = -2005; - alltypes.rep_sint64_count = 5; alltypes.rep_sint64[4] = -2006; - alltypes.rep_bool_count = 5; alltypes.rep_bool[4] = true; - - alltypes.rep_fixed32_count = 5; alltypes.rep_fixed32[4] = 2008; - alltypes.rep_sfixed32_count = 5; alltypes.rep_sfixed32[4] = -2009; - alltypes.rep_float_count = 5; alltypes.rep_float[4] = 2010.0f; - - alltypes.rep_fixed64_count = 5; alltypes.rep_fixed64[4] = 2011; - alltypes.rep_sfixed64_count = 5; alltypes.rep_sfixed64[4] = -2012; - alltypes.rep_double_count = 5; alltypes.rep_double[4] = 2013.0; - - alltypes.rep_string_count = 5; strcpy(alltypes.rep_string[4], "2014"); - alltypes.rep_bytes_count = 5; alltypes.rep_bytes[4].size = 4; - memcpy(alltypes.rep_bytes[4].bytes, "2015", 4); - - alltypes.rep_submsg_count = 5; - strcpy(alltypes.rep_submsg[4].substuff1, "2016"); - alltypes.rep_submsg[4].substuff2 = 2016; - alltypes.rep_submsg[4].has_substuff3 = true; - alltypes.rep_submsg[4].substuff3 = 2016; - - alltypes.rep_enum_count = 5; alltypes.rep_enum[4] = MyEnum_Truth; - alltypes.rep_emptymsg_count = 5; - - alltypes.req_limits.int32_min = INT32_MIN; - alltypes.req_limits.int32_max = INT32_MAX; - alltypes.req_limits.uint32_min = 0; - alltypes.req_limits.uint32_max = UINT32_MAX; - alltypes.req_limits.int64_min = INT64_MIN; - alltypes.req_limits.int64_max = INT64_MAX; - alltypes.req_limits.uint64_min = 0; - alltypes.req_limits.uint64_max = UINT64_MAX; - alltypes.req_limits.enum_min = HugeEnum_Negative; - alltypes.req_limits.enum_max = HugeEnum_Positive; - - if (mode != 0) - { - /* Fill in values for optional fields */ - alltypes.has_opt_int32 = true; - alltypes.opt_int32 = 3041; - alltypes.has_opt_int64 = true; - alltypes.opt_int64 = 3042; - alltypes.has_opt_uint32 = true; - alltypes.opt_uint32 = 3043; - alltypes.has_opt_uint64 = true; - alltypes.opt_uint64 = 3044; - alltypes.has_opt_sint32 = true; - alltypes.opt_sint32 = 3045; - alltypes.has_opt_sint64 = true; - alltypes.opt_sint64 = 3046; - alltypes.has_opt_bool = true; - alltypes.opt_bool = true; - - alltypes.has_opt_fixed32 = true; - alltypes.opt_fixed32 = 3048; - alltypes.has_opt_sfixed32 = true; - alltypes.opt_sfixed32 = 3049; - alltypes.has_opt_float = true; - alltypes.opt_float = 3050.0f; - - alltypes.has_opt_fixed64 = true; - alltypes.opt_fixed64 = 3051; - alltypes.has_opt_sfixed64 = true; - alltypes.opt_sfixed64 = 3052; - alltypes.has_opt_double = true; - alltypes.opt_double = 3053.0; - - alltypes.has_opt_string = true; - strcpy(alltypes.opt_string, "3054"); - alltypes.has_opt_bytes = true; - alltypes.opt_bytes.size = 4; - memcpy(alltypes.opt_bytes.bytes, "3055", 4); - alltypes.has_opt_submsg = true; - strcpy(alltypes.opt_submsg.substuff1, "3056"); - alltypes.opt_submsg.substuff2 = 3056; - alltypes.has_opt_enum = true; - alltypes.opt_enum = MyEnum_Truth; - alltypes.has_opt_emptymsg = true; - - alltypes.which_oneof = AllTypes_oneof_msg1_tag; - strcpy(alltypes.oneof.oneof_msg1.substuff1, "4059"); - alltypes.oneof.oneof_msg1.substuff2 = 4059; - } - - alltypes.end = 1099; - - { - uint8_t buffer[AllTypes_size]; - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - /* Now encode it and check if we succeeded. */ - if (pb_encode(&stream, AllTypes_fields, &alltypes)) - { - SET_BINARY_MODE(stdout); - fwrite(buffer, 1, stream.bytes_written, stdout); - return 0; /* Success */ - } - else - { - fprintf(stderr, "Encoding failed: %s\n", PB_GET_ERROR(&stream)); - return 1; /* Failure */ - } - } -} diff --git a/third_party/nanopb/tests/alltypes_callback/SConscript b/third_party/nanopb/tests/alltypes_callback/SConscript deleted file mode 100644 index a241f24ee11..00000000000 --- a/third_party/nanopb/tests/alltypes_callback/SConscript +++ /dev/null @@ -1,23 +0,0 @@ -# Test the AllTypes encoding & decoding using callbacks for all fields. - -Import("env") - -c = Copy("$TARGET", "$SOURCE") -env.Command("alltypes.proto", "#alltypes/alltypes.proto", c) - -env.NanopbProto(["alltypes", "alltypes.options"]) -enc = env.Program(["encode_alltypes_callback.c", "alltypes.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"]) -dec = env.Program(["decode_alltypes_callback.c", "alltypes.pb.c", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"]) - -refdec = "$BUILD/alltypes/decode_alltypes$PROGSUFFIX" - -# Encode and compare results -env.RunTest(enc) -env.RunTest("decode_alltypes.output", [refdec, "encode_alltypes_callback.output"]) -env.RunTest("decode_alltypes_callback.output", [dec, "encode_alltypes_callback.output"]) - -# Do the same thing with the optional fields present -env.RunTest("optionals.output", enc, ARGS = ['1']) -env.RunTest("optionals.refdecout", [refdec, "optionals.output"], ARGS = ['1']) -env.RunTest("optionals.decout", [dec, "optionals.output"], ARGS = ['1']) - diff --git a/third_party/nanopb/tests/alltypes_callback/alltypes.options b/third_party/nanopb/tests/alltypes_callback/alltypes.options deleted file mode 100644 index daee5224d25..00000000000 --- a/third_party/nanopb/tests/alltypes_callback/alltypes.options +++ /dev/null @@ -1,4 +0,0 @@ -# Generate all fields as callbacks. -AllTypes.* type:FT_CALLBACK -SubMessage.substuff1 max_size:16 -AllTypes.oneof no_unions:true diff --git a/third_party/nanopb/tests/alltypes_callback/decode_alltypes_callback.c b/third_party/nanopb/tests/alltypes_callback/decode_alltypes_callback.c deleted file mode 100644 index c53ab6ed6dc..00000000000 --- a/third_party/nanopb/tests/alltypes_callback/decode_alltypes_callback.c +++ /dev/null @@ -1,429 +0,0 @@ -/* Attempts to test all the datatypes supported by ProtoBuf when used as callback fields. - * Note that normally there would be no reason to use callback fields for this, - * because each encoder defined here only gives a single field. - */ - -#include -#include -#include -#include -#include "alltypes.pb.h" -#include "test_helpers.h" - -#define TEST(x) if (!(x)) { \ - printf("Test " #x " failed (in field %d).\n", field->tag); \ - return false; \ - } - -static bool read_varint(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - uint64_t value; - if (!pb_decode_varint(stream, &value)) - return false; - - TEST((int64_t)value == (long)*arg); - return true; -} - -static bool read_svarint(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - int64_t value; - if (!pb_decode_svarint(stream, &value)) - return false; - - TEST(value == (long)*arg); - return true; -} - -static bool read_fixed32(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - uint32_t value; - if (!pb_decode_fixed32(stream, &value)) - return false; - - TEST(value == *(uint32_t*)*arg); - return true; -} - -static bool read_fixed64(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - uint64_t value; - if (!pb_decode_fixed64(stream, &value)) - return false; - - TEST(value == *(uint64_t*)*arg); - return true; -} - -static bool read_string(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - uint8_t buf[16] = {0}; - size_t len = stream->bytes_left; - - if (len > sizeof(buf) - 1 || !pb_read(stream, buf, len)) - return false; - - TEST(strcmp((char*)buf, *arg) == 0); - return true; -} - -static bool read_submsg(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - SubMessage submsg = {""}; - - if (!pb_decode(stream, SubMessage_fields, &submsg)) - return false; - - TEST(memcmp(&submsg, *arg, sizeof(submsg))); - return true; -} - -static bool read_emptymsg(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - EmptyMessage emptymsg = {0}; - return pb_decode(stream, EmptyMessage_fields, &emptymsg); -} - -static bool read_repeated_varint(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - int32_t** expected = (int32_t**)arg; - uint64_t value; - if (!pb_decode_varint(stream, &value)) - return false; - - TEST(*(*expected)++ == value); - return true; -} - -static bool read_repeated_svarint(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - int32_t** expected = (int32_t**)arg; - int64_t value; - if (!pb_decode_svarint(stream, &value)) - return false; - - TEST(*(*expected)++ == value); - return true; -} - -static bool read_repeated_fixed32(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - uint32_t** expected = (uint32_t**)arg; - uint32_t value; - if (!pb_decode_fixed32(stream, &value)) - return false; - - TEST(*(*expected)++ == value); - return true; -} - -static bool read_repeated_fixed64(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - uint64_t** expected = (uint64_t**)arg; - uint64_t value; - if (!pb_decode_fixed64(stream, &value)) - return false; - - TEST(*(*expected)++ == value); - return true; -} - -static bool read_repeated_string(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - uint8_t*** expected = (uint8_t***)arg; - uint8_t buf[16] = {0}; - size_t len = stream->bytes_left; - - if (len > sizeof(buf) - 1 || !pb_read(stream, buf, len)) - return false; - - TEST(strcmp((char*)*(*expected)++, (char*)buf) == 0); - return true; -} - -static bool read_repeated_submsg(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - SubMessage** expected = (SubMessage**)arg; - SubMessage decoded = {""}; - if (!pb_decode(stream, SubMessage_fields, &decoded)) - return false; - - TEST(memcmp((*expected)++, &decoded, sizeof(decoded)) == 0); - return true; -} - -static bool read_limits(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - Limits decoded = {0}; - if (!pb_decode(stream, Limits_fields, &decoded)) - return false; - - TEST(decoded.int32_min == INT32_MIN); - TEST(decoded.int32_max == INT32_MAX); - TEST(decoded.uint32_min == 0); - TEST(decoded.uint32_max == UINT32_MAX); - TEST(decoded.int64_min == INT64_MIN); - TEST(decoded.int64_max == INT64_MAX); - TEST(decoded.uint64_min == 0); - TEST(decoded.uint64_max == UINT64_MAX); - TEST(decoded.enum_min == HugeEnum_Negative); - TEST(decoded.enum_max == HugeEnum_Positive); - - return true; -} - -/* This function is called once from main(), it handles - the decoding and checks the fields. */ -bool check_alltypes(pb_istream_t *stream, int mode) -{ - /* Values for use from callbacks through pointers. */ - uint32_t req_fixed32 = 1008; - int32_t req_sfixed32 = -1009; - float req_float = 1010.0f; - uint64_t req_fixed64 = 1011; - int64_t req_sfixed64 = -1012; - double req_double = 1013.0; - SubMessage req_submsg = {"1016", 1016}; - - int32_t rep_int32[5] = {0, 0, 0, 0, -2001}; - int32_t rep_int64[5] = {0, 0, 0, 0, -2002}; - int32_t rep_uint32[5] = {0, 0, 0, 0, 2003}; - int32_t rep_uint64[5] = {0, 0, 0, 0, 2004}; - int32_t rep_sint32[5] = {0, 0, 0, 0, -2005}; - int32_t rep_sint64[5] = {0, 0, 0, 0, -2006}; - int32_t rep_bool[5] = {false, false, false, false, true}; - uint32_t rep_fixed32[5] = {0, 0, 0, 0, 2008}; - int32_t rep_sfixed32[5] = {0, 0, 0, 0, -2009}; - float rep_float[5] = {0, 0, 0, 0, 2010.0f}; - uint64_t rep_fixed64[5] = {0, 0, 0, 0, 2011}; - int64_t rep_sfixed64[5] = {0, 0, 0, 0, -2012}; - double rep_double[5] = {0, 0, 0, 0, 2013.0}; - char* rep_string[5] = {"", "", "", "", "2014"}; - char* rep_bytes[5] = {"", "", "", "", "2015"}; - SubMessage rep_submsg[5] = {{"", 0, 0, 3}, - {"", 0, 0, 3}, - {"", 0, 0, 3}, - {"", 0, 0, 3}, - {"2016", 2016, true, 2016}}; - int32_t rep_enum[5] = {0, 0, 0, 0, MyEnum_Truth}; - - uint32_t opt_fixed32 = 3048; - int32_t opt_sfixed32 = 3049; - float opt_float = 3050.0f; - uint64_t opt_fixed64 = 3051; - int64_t opt_sfixed64 = 3052; - double opt_double = 3053.0f; - SubMessage opt_submsg = {"3056", 3056}; - - SubMessage oneof_msg1 = {"4059", 4059}; - - /* Bind callbacks for required fields */ - AllTypes alltypes; - - /* Fill with garbage to better detect initialization errors */ - memset(&alltypes, 0xAA, sizeof(alltypes)); - alltypes.extensions = 0; - - alltypes.req_int32.funcs.decode = &read_varint; - alltypes.req_int32.arg = (void*)-1001; - - alltypes.req_int64.funcs.decode = &read_varint; - alltypes.req_int64.arg = (void*)-1002; - - alltypes.req_uint32.funcs.decode = &read_varint; - alltypes.req_uint32.arg = (void*)1003; - - alltypes.req_uint32.funcs.decode = &read_varint; - alltypes.req_uint32.arg = (void*)1003; - - alltypes.req_uint64.funcs.decode = &read_varint; - alltypes.req_uint64.arg = (void*)1004; - - alltypes.req_sint32.funcs.decode = &read_svarint; - alltypes.req_sint32.arg = (void*)-1005; - - alltypes.req_sint64.funcs.decode = &read_svarint; - alltypes.req_sint64.arg = (void*)-1006; - - alltypes.req_bool.funcs.decode = &read_varint; - alltypes.req_bool.arg = (void*)true; - - alltypes.req_fixed32.funcs.decode = &read_fixed32; - alltypes.req_fixed32.arg = &req_fixed32; - - alltypes.req_sfixed32.funcs.decode = &read_fixed32; - alltypes.req_sfixed32.arg = &req_sfixed32; - - alltypes.req_float.funcs.decode = &read_fixed32; - alltypes.req_float.arg = &req_float; - - alltypes.req_fixed64.funcs.decode = &read_fixed64; - alltypes.req_fixed64.arg = &req_fixed64; - - alltypes.req_sfixed64.funcs.decode = &read_fixed64; - alltypes.req_sfixed64.arg = &req_sfixed64; - - alltypes.req_double.funcs.decode = &read_fixed64; - alltypes.req_double.arg = &req_double; - - alltypes.req_string.funcs.decode = &read_string; - alltypes.req_string.arg = "1014"; - - alltypes.req_bytes.funcs.decode = &read_string; - alltypes.req_bytes.arg = "1015"; - - alltypes.req_submsg.funcs.decode = &read_submsg; - alltypes.req_submsg.arg = &req_submsg; - - alltypes.req_enum.funcs.decode = &read_varint; - alltypes.req_enum.arg = (void*)MyEnum_Truth; - - alltypes.req_emptymsg.funcs.decode = &read_emptymsg; - - /* Bind callbacks for repeated fields */ - alltypes.rep_int32.funcs.decode = &read_repeated_varint; - alltypes.rep_int32.arg = rep_int32; - - alltypes.rep_int64.funcs.decode = &read_repeated_varint; - alltypes.rep_int64.arg = rep_int64; - - alltypes.rep_uint32.funcs.decode = &read_repeated_varint; - alltypes.rep_uint32.arg = rep_uint32; - - alltypes.rep_uint64.funcs.decode = &read_repeated_varint; - alltypes.rep_uint64.arg = rep_uint64; - - alltypes.rep_sint32.funcs.decode = &read_repeated_svarint; - alltypes.rep_sint32.arg = rep_sint32; - - alltypes.rep_sint64.funcs.decode = &read_repeated_svarint; - alltypes.rep_sint64.arg = rep_sint64; - - alltypes.rep_bool.funcs.decode = &read_repeated_varint; - alltypes.rep_bool.arg = rep_bool; - - alltypes.rep_fixed32.funcs.decode = &read_repeated_fixed32; - alltypes.rep_fixed32.arg = rep_fixed32; - - alltypes.rep_sfixed32.funcs.decode = &read_repeated_fixed32; - alltypes.rep_sfixed32.arg = rep_sfixed32; - - alltypes.rep_float.funcs.decode = &read_repeated_fixed32; - alltypes.rep_float.arg = rep_float; - - alltypes.rep_fixed64.funcs.decode = &read_repeated_fixed64; - alltypes.rep_fixed64.arg = rep_fixed64; - - alltypes.rep_sfixed64.funcs.decode = &read_repeated_fixed64; - alltypes.rep_sfixed64.arg = rep_sfixed64; - - alltypes.rep_double.funcs.decode = &read_repeated_fixed64; - alltypes.rep_double.arg = rep_double; - - alltypes.rep_string.funcs.decode = &read_repeated_string; - alltypes.rep_string.arg = rep_string; - - alltypes.rep_bytes.funcs.decode = &read_repeated_string; - alltypes.rep_bytes.arg = rep_bytes; - - alltypes.rep_submsg.funcs.decode = &read_repeated_submsg; - alltypes.rep_submsg.arg = rep_submsg; - - alltypes.rep_enum.funcs.decode = &read_repeated_varint; - alltypes.rep_enum.arg = rep_enum; - - alltypes.rep_emptymsg.funcs.decode = &read_emptymsg; - - alltypes.req_limits.funcs.decode = &read_limits; - - alltypes.end.funcs.decode = &read_varint; - alltypes.end.arg = (void*)1099; - - /* Bind callbacks for optional fields */ - if (mode == 1) - { - alltypes.opt_int32.funcs.decode = &read_varint; - alltypes.opt_int32.arg = (void*)3041; - - alltypes.opt_int64.funcs.decode = &read_varint; - alltypes.opt_int64.arg = (void*)3042; - - alltypes.opt_uint32.funcs.decode = &read_varint; - alltypes.opt_uint32.arg = (void*)3043; - - alltypes.opt_uint64.funcs.decode = &read_varint; - alltypes.opt_uint64.arg = (void*)3044; - - alltypes.opt_sint32.funcs.decode = &read_svarint; - alltypes.opt_sint32.arg = (void*)3045; - - alltypes.opt_sint64.funcs.decode = &read_svarint; - alltypes.opt_sint64.arg = (void*)3046; - - alltypes.opt_bool.funcs.decode = &read_varint; - alltypes.opt_bool.arg = (void*)true; - - alltypes.opt_fixed32.funcs.decode = &read_fixed32; - alltypes.opt_fixed32.arg = &opt_fixed32; - - alltypes.opt_sfixed32.funcs.decode = &read_fixed32; - alltypes.opt_sfixed32.arg = &opt_sfixed32; - - alltypes.opt_float.funcs.decode = &read_fixed32; - alltypes.opt_float.arg = &opt_float; - - alltypes.opt_fixed64.funcs.decode = &read_fixed64; - alltypes.opt_fixed64.arg = &opt_fixed64; - - alltypes.opt_sfixed64.funcs.decode = &read_fixed64; - alltypes.opt_sfixed64.arg = &opt_sfixed64; - - alltypes.opt_double.funcs.decode = &read_fixed64; - alltypes.opt_double.arg = &opt_double; - - alltypes.opt_string.funcs.decode = &read_string; - alltypes.opt_string.arg = "3054"; - - alltypes.opt_bytes.funcs.decode = &read_string; - alltypes.opt_bytes.arg = "3055"; - - alltypes.opt_submsg.funcs.decode = &read_submsg; - alltypes.opt_submsg.arg = &opt_submsg; - - alltypes.opt_enum.funcs.decode = &read_varint; - alltypes.opt_enum.arg = (void*)MyEnum_Truth; - - alltypes.opt_emptymsg.funcs.decode = &read_emptymsg; - - alltypes.oneof_msg1.funcs.decode = &read_submsg; - alltypes.oneof_msg1.arg = &oneof_msg1; - } - - return pb_decode(stream, AllTypes_fields, &alltypes); -} - -int main(int argc, char **argv) -{ - uint8_t buffer[1024]; - size_t count; - pb_istream_t stream; - - /* Whether to expect the optional values or the default values. */ - int mode = (argc > 1) ? atoi(argv[1]) : 0; - - /* Read the data into buffer */ - SET_BINARY_MODE(stdin); - count = fread(buffer, 1, sizeof(buffer), stdin); - - /* Construct a pb_istream_t for reading from the buffer */ - stream = pb_istream_from_buffer(buffer, count); - - /* Decode and print out the stuff */ - if (!check_alltypes(&stream, mode)) - { - printf("Parsing failed: %s\n", PB_GET_ERROR(&stream)); - return 1; - } else { - return 0; - } -} diff --git a/third_party/nanopb/tests/alltypes_callback/encode_alltypes_callback.c b/third_party/nanopb/tests/alltypes_callback/encode_alltypes_callback.c deleted file mode 100644 index abc43f5800e..00000000000 --- a/third_party/nanopb/tests/alltypes_callback/encode_alltypes_callback.c +++ /dev/null @@ -1,402 +0,0 @@ -/* Attempts to test all the datatypes supported by ProtoBuf when used as callback fields. - * Note that normally there would be no reason to use callback fields for this, - * because each encoder defined here only gives a single field. - */ - -#include -#include -#include -#include -#include "alltypes.pb.h" -#include "test_helpers.h" - -static bool write_varint(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - return pb_encode_tag_for_field(stream, field) && - pb_encode_varint(stream, (long)*arg); -} - -static bool write_svarint(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - return pb_encode_tag_for_field(stream, field) && - pb_encode_svarint(stream, (long)*arg); -} - -static bool write_fixed32(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - return pb_encode_tag_for_field(stream, field) && - pb_encode_fixed32(stream, *arg); -} - -static bool write_fixed64(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - return pb_encode_tag_for_field(stream, field) && - pb_encode_fixed64(stream, *arg); -} - -static bool write_string(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - return pb_encode_tag_for_field(stream, field) && - pb_encode_string(stream, *arg, strlen(*arg)); -} - -static bool write_submsg(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - - return pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, SubMessage_fields, *arg); -} - -static bool write_emptymsg(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - EmptyMessage emptymsg = {0}; - return pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, EmptyMessage_fields, &emptymsg); -} - -static bool write_repeated_varint(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - return pb_encode_tag_for_field(stream, field) && - pb_encode_varint(stream, 0) && - pb_encode_tag_for_field(stream, field) && - pb_encode_varint(stream, 0) && - pb_encode_tag_for_field(stream, field) && - pb_encode_varint(stream, 0) && - pb_encode_tag_for_field(stream, field) && - pb_encode_varint(stream, 0) && - pb_encode_tag_for_field(stream, field) && - pb_encode_varint(stream, (long)*arg); -} - -static bool write_repeated_svarint(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - return pb_encode_tag_for_field(stream, field) && - pb_encode_svarint(stream, 0) && - pb_encode_tag_for_field(stream, field) && - pb_encode_svarint(stream, 0) && - pb_encode_tag_for_field(stream, field) && - pb_encode_svarint(stream, 0) && - pb_encode_tag_for_field(stream, field) && - pb_encode_svarint(stream, 0) && - pb_encode_tag_for_field(stream, field) && - pb_encode_svarint(stream, (long)*arg); -} - -static bool write_repeated_fixed32(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - uint32_t dummy = 0; - - /* Make it a packed field */ - return pb_encode_tag(stream, PB_WT_STRING, field->tag) && - pb_encode_varint(stream, 5 * 4) && /* Number of bytes */ - pb_encode_fixed32(stream, &dummy) && - pb_encode_fixed32(stream, &dummy) && - pb_encode_fixed32(stream, &dummy) && - pb_encode_fixed32(stream, &dummy) && - pb_encode_fixed32(stream, *arg); -} - -static bool write_repeated_fixed64(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - uint64_t dummy = 0; - - /* Make it a packed field */ - return pb_encode_tag(stream, PB_WT_STRING, field->tag) && - pb_encode_varint(stream, 5 * 8) && /* Number of bytes */ - pb_encode_fixed64(stream, &dummy) && - pb_encode_fixed64(stream, &dummy) && - pb_encode_fixed64(stream, &dummy) && - pb_encode_fixed64(stream, &dummy) && - pb_encode_fixed64(stream, *arg); -} - -static bool write_repeated_string(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - return pb_encode_tag_for_field(stream, field) && - pb_encode_string(stream, 0, 0) && - pb_encode_tag_for_field(stream, field) && - pb_encode_string(stream, 0, 0) && - pb_encode_tag_for_field(stream, field) && - pb_encode_string(stream, 0, 0) && - pb_encode_tag_for_field(stream, field) && - pb_encode_string(stream, 0, 0) && - pb_encode_tag_for_field(stream, field) && - pb_encode_string(stream, *arg, strlen(*arg)); -} - -static bool write_repeated_submsg(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - SubMessage dummy = {""}; - - return pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, SubMessage_fields, &dummy) && - pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, SubMessage_fields, &dummy) && - pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, SubMessage_fields, &dummy) && - pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, SubMessage_fields, &dummy) && - pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, SubMessage_fields, *arg); -} - -static bool write_limits(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - Limits limits = {0}; - limits.int32_min = INT32_MIN; - limits.int32_max = INT32_MAX; - limits.uint32_min = 0; - limits.uint32_max = UINT32_MAX; - limits.int64_min = INT64_MIN; - limits.int64_max = INT64_MAX; - limits.uint64_min = 0; - limits.uint64_max = UINT64_MAX; - limits.enum_min = HugeEnum_Negative; - limits.enum_max = HugeEnum_Positive; - - return pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, Limits_fields, &limits); -} - -static bool write_repeated_emptymsg(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - EmptyMessage emptymsg = {0}; - return pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, EmptyMessage_fields, &emptymsg) && - pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, EmptyMessage_fields, &emptymsg) && - pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, EmptyMessage_fields, &emptymsg) && - pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, EmptyMessage_fields, &emptymsg) && - pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, EmptyMessage_fields, &emptymsg); -} - -int main(int argc, char **argv) -{ - int mode = (argc > 1) ? atoi(argv[1]) : 0; - - /* Values for use from callbacks through pointers. */ - uint32_t req_fixed32 = 1008; - int32_t req_sfixed32 = -1009; - float req_float = 1010.0f; - uint64_t req_fixed64 = 1011; - int64_t req_sfixed64 = -1012; - double req_double = 1013.0; - SubMessage req_submsg = {"1016", 1016}; - - uint32_t rep_fixed32 = 2008; - int32_t rep_sfixed32 = -2009; - float rep_float = 2010.0f; - uint64_t rep_fixed64 = 2011; - int64_t rep_sfixed64 = -2012; - double rep_double = 2013.0; - SubMessage rep_submsg = {"2016", 2016, true, 2016}; - - uint32_t opt_fixed32 = 3048; - int32_t opt_sfixed32 = 3049; - float opt_float = 3050.0f; - uint64_t opt_fixed64 = 3051; - int64_t opt_sfixed64 = 3052; - double opt_double = 3053.0f; - SubMessage opt_submsg = {"3056", 3056}; - - SubMessage oneof_msg1 = {"4059", 4059}; - - /* Bind callbacks for required fields */ - AllTypes alltypes = {{{0}}}; - - alltypes.req_int32.funcs.encode = &write_varint; - alltypes.req_int32.arg = (void*)-1001; - - alltypes.req_int64.funcs.encode = &write_varint; - alltypes.req_int64.arg = (void*)-1002; - - alltypes.req_uint32.funcs.encode = &write_varint; - alltypes.req_uint32.arg = (void*)1003; - - alltypes.req_uint32.funcs.encode = &write_varint; - alltypes.req_uint32.arg = (void*)1003; - - alltypes.req_uint64.funcs.encode = &write_varint; - alltypes.req_uint64.arg = (void*)1004; - - alltypes.req_sint32.funcs.encode = &write_svarint; - alltypes.req_sint32.arg = (void*)-1005; - - alltypes.req_sint64.funcs.encode = &write_svarint; - alltypes.req_sint64.arg = (void*)-1006; - - alltypes.req_bool.funcs.encode = &write_varint; - alltypes.req_bool.arg = (void*)true; - - alltypes.req_fixed32.funcs.encode = &write_fixed32; - alltypes.req_fixed32.arg = &req_fixed32; - - alltypes.req_sfixed32.funcs.encode = &write_fixed32; - alltypes.req_sfixed32.arg = &req_sfixed32; - - alltypes.req_float.funcs.encode = &write_fixed32; - alltypes.req_float.arg = &req_float; - - alltypes.req_fixed64.funcs.encode = &write_fixed64; - alltypes.req_fixed64.arg = &req_fixed64; - - alltypes.req_sfixed64.funcs.encode = &write_fixed64; - alltypes.req_sfixed64.arg = &req_sfixed64; - - alltypes.req_double.funcs.encode = &write_fixed64; - alltypes.req_double.arg = &req_double; - - alltypes.req_string.funcs.encode = &write_string; - alltypes.req_string.arg = "1014"; - - alltypes.req_bytes.funcs.encode = &write_string; - alltypes.req_bytes.arg = "1015"; - - alltypes.req_submsg.funcs.encode = &write_submsg; - alltypes.req_submsg.arg = &req_submsg; - - alltypes.req_enum.funcs.encode = &write_varint; - alltypes.req_enum.arg = (void*)MyEnum_Truth; - - alltypes.req_emptymsg.funcs.encode = &write_emptymsg; - - /* Bind callbacks for repeated fields */ - alltypes.rep_int32.funcs.encode = &write_repeated_varint; - alltypes.rep_int32.arg = (void*)-2001; - - alltypes.rep_int64.funcs.encode = &write_repeated_varint; - alltypes.rep_int64.arg = (void*)-2002; - - alltypes.rep_uint32.funcs.encode = &write_repeated_varint; - alltypes.rep_uint32.arg = (void*)2003; - - alltypes.rep_uint64.funcs.encode = &write_repeated_varint; - alltypes.rep_uint64.arg = (void*)2004; - - alltypes.rep_sint32.funcs.encode = &write_repeated_svarint; - alltypes.rep_sint32.arg = (void*)-2005; - - alltypes.rep_sint64.funcs.encode = &write_repeated_svarint; - alltypes.rep_sint64.arg = (void*)-2006; - - alltypes.rep_bool.funcs.encode = &write_repeated_varint; - alltypes.rep_bool.arg = (void*)true; - - alltypes.rep_fixed32.funcs.encode = &write_repeated_fixed32; - alltypes.rep_fixed32.arg = &rep_fixed32; - - alltypes.rep_sfixed32.funcs.encode = &write_repeated_fixed32; - alltypes.rep_sfixed32.arg = &rep_sfixed32; - - alltypes.rep_float.funcs.encode = &write_repeated_fixed32; - alltypes.rep_float.arg = &rep_float; - - alltypes.rep_fixed64.funcs.encode = &write_repeated_fixed64; - alltypes.rep_fixed64.arg = &rep_fixed64; - - alltypes.rep_sfixed64.funcs.encode = &write_repeated_fixed64; - alltypes.rep_sfixed64.arg = &rep_sfixed64; - - alltypes.rep_double.funcs.encode = &write_repeated_fixed64; - alltypes.rep_double.arg = &rep_double; - - alltypes.rep_string.funcs.encode = &write_repeated_string; - alltypes.rep_string.arg = "2014"; - - alltypes.rep_bytes.funcs.encode = &write_repeated_string; - alltypes.rep_bytes.arg = "2015"; - - alltypes.rep_submsg.funcs.encode = &write_repeated_submsg; - alltypes.rep_submsg.arg = &rep_submsg; - - alltypes.rep_enum.funcs.encode = &write_repeated_varint; - alltypes.rep_enum.arg = (void*)MyEnum_Truth; - - alltypes.rep_emptymsg.funcs.encode = &write_repeated_emptymsg; - - alltypes.req_limits.funcs.encode = &write_limits; - - /* Bind callbacks for optional fields */ - if (mode != 0) - { - alltypes.opt_int32.funcs.encode = &write_varint; - alltypes.opt_int32.arg = (void*)3041; - - alltypes.opt_int64.funcs.encode = &write_varint; - alltypes.opt_int64.arg = (void*)3042; - - alltypes.opt_uint32.funcs.encode = &write_varint; - alltypes.opt_uint32.arg = (void*)3043; - - alltypes.opt_uint64.funcs.encode = &write_varint; - alltypes.opt_uint64.arg = (void*)3044; - - alltypes.opt_sint32.funcs.encode = &write_svarint; - alltypes.opt_sint32.arg = (void*)3045; - - alltypes.opt_sint64.funcs.encode = &write_svarint; - alltypes.opt_sint64.arg = (void*)3046; - - alltypes.opt_bool.funcs.encode = &write_varint; - alltypes.opt_bool.arg = (void*)true; - - alltypes.opt_fixed32.funcs.encode = &write_fixed32; - alltypes.opt_fixed32.arg = &opt_fixed32; - - alltypes.opt_sfixed32.funcs.encode = &write_fixed32; - alltypes.opt_sfixed32.arg = &opt_sfixed32; - - alltypes.opt_float.funcs.encode = &write_fixed32; - alltypes.opt_float.arg = &opt_float; - - alltypes.opt_fixed64.funcs.encode = &write_fixed64; - alltypes.opt_fixed64.arg = &opt_fixed64; - - alltypes.opt_sfixed64.funcs.encode = &write_fixed64; - alltypes.opt_sfixed64.arg = &opt_sfixed64; - - alltypes.opt_double.funcs.encode = &write_fixed64; - alltypes.opt_double.arg = &opt_double; - - alltypes.opt_string.funcs.encode = &write_string; - alltypes.opt_string.arg = "3054"; - - alltypes.opt_bytes.funcs.encode = &write_string; - alltypes.opt_bytes.arg = "3055"; - - alltypes.opt_submsg.funcs.encode = &write_submsg; - alltypes.opt_submsg.arg = &opt_submsg; - - alltypes.opt_enum.funcs.encode = &write_varint; - alltypes.opt_enum.arg = (void*)MyEnum_Truth; - - alltypes.opt_emptymsg.funcs.encode = &write_emptymsg; - - alltypes.oneof_msg1.funcs.encode = &write_submsg; - alltypes.oneof_msg1.arg = &oneof_msg1; - } - - alltypes.end.funcs.encode = &write_varint; - alltypes.end.arg = (void*)1099; - - { - uint8_t buffer[2048]; - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - /* Now encode it and check if we succeeded. */ - if (pb_encode(&stream, AllTypes_fields, &alltypes)) - { - SET_BINARY_MODE(stdout); - fwrite(buffer, 1, stream.bytes_written, stdout); - return 0; /* Success */ - } - else - { - fprintf(stderr, "Encoding failed: %s\n", PB_GET_ERROR(&stream)); - return 1; /* Failure */ - } - } -} diff --git a/third_party/nanopb/tests/alltypes_pointer/SConscript b/third_party/nanopb/tests/alltypes_pointer/SConscript deleted file mode 100644 index b095ae037fc..00000000000 --- a/third_party/nanopb/tests/alltypes_pointer/SConscript +++ /dev/null @@ -1,40 +0,0 @@ -# Encode the AllTypes message using pointers for all fields, and verify the -# output against the normal AllTypes test case. - -Import("env", "malloc_env") - -c = Copy("$TARGET", "$SOURCE") -env.Command("alltypes.proto", "#alltypes/alltypes.proto", c) - -env.NanopbProto(["alltypes", "alltypes.options"]) -enc = malloc_env.Program(["encode_alltypes_pointer.c", - "alltypes.pb.c", - "$COMMON/pb_encode_with_malloc.o", - "$COMMON/pb_common_with_malloc.o", - "$COMMON/malloc_wrappers.o"]) -dec = malloc_env.Program(["decode_alltypes_pointer.c", - "alltypes.pb.c", - "$COMMON/pb_decode_with_malloc.o", - "$COMMON/pb_common_with_malloc.o", - "$COMMON/malloc_wrappers.o"]) - -# Encode and compare results to non-pointer alltypes test case -env.RunTest(enc) -env.Compare(["encode_alltypes_pointer.output", "$BUILD/alltypes/encode_alltypes.output"]) - -# Decode (under valgrind if available) -valgrind = env.WhereIs('valgrind') -kwargs = {} -if valgrind: - kwargs['COMMAND'] = valgrind - kwargs['ARGS'] = ["-q", "--error-exitcode=99", dec[0].abspath] - -env.RunTest("decode_alltypes.output", [dec, "encode_alltypes_pointer.output"], **kwargs) - -# Do the same thing with the optional fields present -env.RunTest("optionals.output", enc, ARGS = ['1']) -env.Compare(["optionals.output", "$BUILD/alltypes/optionals.output"]) - -kwargs['ARGS'] = kwargs.get('ARGS', []) + ['1'] -env.RunTest("optionals.decout", [dec, "optionals.output"], **kwargs) - diff --git a/third_party/nanopb/tests/alltypes_pointer/alltypes.options b/third_party/nanopb/tests/alltypes_pointer/alltypes.options deleted file mode 100644 index 52abeb7fec9..00000000000 --- a/third_party/nanopb/tests/alltypes_pointer/alltypes.options +++ /dev/null @@ -1,3 +0,0 @@ -# Generate all fields as pointers. -* type:FT_POINTER - diff --git a/third_party/nanopb/tests/alltypes_pointer/decode_alltypes_pointer.c b/third_party/nanopb/tests/alltypes_pointer/decode_alltypes_pointer.c deleted file mode 100644 index 1dbb6c55d16..00000000000 --- a/third_party/nanopb/tests/alltypes_pointer/decode_alltypes_pointer.c +++ /dev/null @@ -1,180 +0,0 @@ -#include -#include -#include -#include -#include "alltypes.pb.h" -#include "test_helpers.h" - -#define TEST(x) if (!(x)) { \ - fprintf(stderr, "Test " #x " failed.\n"); \ - status = false; \ - } - -/* This function is called once from main(), it handles - the decoding and checks the fields. */ -bool check_alltypes(pb_istream_t *stream, int mode) -{ - bool status = true; - AllTypes alltypes; - - /* Fill with garbage to better detect initialization errors */ - memset(&alltypes, 0xAA, sizeof(alltypes)); - alltypes.extensions = 0; - - if (!pb_decode(stream, AllTypes_fields, &alltypes)) - return false; - - TEST(alltypes.req_int32 && *alltypes.req_int32 == -1001); - TEST(alltypes.req_int64 && *alltypes.req_int64 == -1002); - TEST(alltypes.req_uint32 && *alltypes.req_uint32 == 1003); - TEST(alltypes.req_uint64 && *alltypes.req_uint64 == 1004); - TEST(alltypes.req_sint32 && *alltypes.req_sint32 == -1005); - TEST(alltypes.req_sint64 && *alltypes.req_sint64 == -1006); - TEST(alltypes.req_bool && *alltypes.req_bool == true); - - TEST(alltypes.req_fixed32 && *alltypes.req_fixed32 == 1008); - TEST(alltypes.req_sfixed32 && *alltypes.req_sfixed32 == -1009); - TEST(alltypes.req_float && *alltypes.req_float == 1010.0f); - - TEST(alltypes.req_fixed64 && *alltypes.req_fixed64 == 1011); - TEST(alltypes.req_sfixed64 && *alltypes.req_sfixed64 == -1012); - TEST(alltypes.req_double && *alltypes.req_double == 1013.0f); - - TEST(alltypes.req_string && strcmp(alltypes.req_string, "1014") == 0); - TEST(alltypes.req_bytes && alltypes.req_bytes->size == 4); - TEST(alltypes.req_bytes && memcmp(&alltypes.req_bytes->bytes, "1015", 4) == 0); - TEST(alltypes.req_submsg && alltypes.req_submsg->substuff1 - && strcmp(alltypes.req_submsg->substuff1, "1016") == 0); - TEST(alltypes.req_submsg && alltypes.req_submsg->substuff2 - && *alltypes.req_submsg->substuff2 == 1016); - TEST(*alltypes.req_enum == MyEnum_Truth); - - TEST(alltypes.rep_int32_count == 5 && alltypes.rep_int32[4] == -2001 && alltypes.rep_int32[0] == 0); - TEST(alltypes.rep_int64_count == 5 && alltypes.rep_int64[4] == -2002 && alltypes.rep_int64[0] == 0); - TEST(alltypes.rep_uint32_count == 5 && alltypes.rep_uint32[4] == 2003 && alltypes.rep_uint32[0] == 0); - TEST(alltypes.rep_uint64_count == 5 && alltypes.rep_uint64[4] == 2004 && alltypes.rep_uint64[0] == 0); - TEST(alltypes.rep_sint32_count == 5 && alltypes.rep_sint32[4] == -2005 && alltypes.rep_sint32[0] == 0); - TEST(alltypes.rep_sint64_count == 5 && alltypes.rep_sint64[4] == -2006 && alltypes.rep_sint64[0] == 0); - TEST(alltypes.rep_bool_count == 5 && alltypes.rep_bool[4] == true && alltypes.rep_bool[0] == false); - - TEST(alltypes.rep_fixed32_count == 5 && alltypes.rep_fixed32[4] == 2008 && alltypes.rep_fixed32[0] == 0); - TEST(alltypes.rep_sfixed32_count == 5 && alltypes.rep_sfixed32[4] == -2009 && alltypes.rep_sfixed32[0] == 0); - TEST(alltypes.rep_float_count == 5 && alltypes.rep_float[4] == 2010.0f && alltypes.rep_float[0] == 0.0f); - - TEST(alltypes.rep_fixed64_count == 5 && alltypes.rep_fixed64[4] == 2011 && alltypes.rep_fixed64[0] == 0); - TEST(alltypes.rep_sfixed64_count == 5 && alltypes.rep_sfixed64[4] == -2012 && alltypes.rep_sfixed64[0] == 0); - TEST(alltypes.rep_double_count == 5 && alltypes.rep_double[4] == 2013.0 && alltypes.rep_double[0] == 0.0); - - TEST(alltypes.rep_string_count == 5 && strcmp(alltypes.rep_string[4], "2014") == 0 && alltypes.rep_string[0][0] == '\0'); - TEST(alltypes.rep_bytes_count == 5 && alltypes.rep_bytes[4]->size == 4 && alltypes.rep_bytes[0]->size == 0); - TEST(memcmp(&alltypes.rep_bytes[4]->bytes, "2015", 4) == 0); - - TEST(alltypes.rep_submsg_count == 5); - TEST(strcmp(alltypes.rep_submsg[4].substuff1, "2016") == 0 && alltypes.rep_submsg[0].substuff1[0] == '\0'); - TEST(*alltypes.rep_submsg[4].substuff2 == 2016 && *alltypes.rep_submsg[0].substuff2 == 0); - TEST(*alltypes.rep_submsg[4].substuff3 == 2016 && alltypes.rep_submsg[0].substuff3 == NULL); - - TEST(alltypes.rep_enum_count == 5 && alltypes.rep_enum[4] == MyEnum_Truth && alltypes.rep_enum[0] == MyEnum_Zero); - TEST(alltypes.rep_emptymsg_count == 5); - - if (mode == 0) - { - /* Expect that optional values are not present */ - TEST(alltypes.opt_int32 == NULL); - TEST(alltypes.opt_int64 == NULL); - TEST(alltypes.opt_uint32 == NULL); - TEST(alltypes.opt_uint64 == NULL); - TEST(alltypes.opt_sint32 == NULL); - TEST(alltypes.opt_sint64 == NULL); - TEST(alltypes.opt_bool == NULL); - - TEST(alltypes.opt_fixed32 == NULL); - TEST(alltypes.opt_sfixed32 == NULL); - TEST(alltypes.opt_float == NULL); - TEST(alltypes.opt_fixed64 == NULL); - TEST(alltypes.opt_sfixed64 == NULL); - TEST(alltypes.opt_double == NULL); - - TEST(alltypes.opt_string == NULL); - TEST(alltypes.opt_bytes == NULL); - TEST(alltypes.opt_submsg == NULL); - TEST(alltypes.opt_enum == NULL); - - TEST(alltypes.which_oneof == 0); - } - else - { - /* Expect filled-in values */ - TEST(alltypes.opt_int32 && *alltypes.opt_int32 == 3041); - TEST(alltypes.opt_int64 && *alltypes.opt_int64 == 3042); - TEST(alltypes.opt_uint32 && *alltypes.opt_uint32 == 3043); - TEST(alltypes.opt_uint64 && *alltypes.opt_uint64 == 3044); - TEST(alltypes.opt_sint32 && *alltypes.opt_sint32 == 3045); - TEST(alltypes.opt_sint64 && *alltypes.opt_sint64 == 3046); - TEST(alltypes.opt_bool && *alltypes.opt_bool == true); - - TEST(alltypes.opt_fixed32 && *alltypes.opt_fixed32 == 3048); - TEST(alltypes.opt_sfixed32 && *alltypes.opt_sfixed32== 3049); - TEST(alltypes.opt_float && *alltypes.opt_float == 3050.0f); - TEST(alltypes.opt_fixed64 && *alltypes.opt_fixed64 == 3051); - TEST(alltypes.opt_sfixed64 && *alltypes.opt_sfixed64== 3052); - TEST(alltypes.opt_double && *alltypes.opt_double == 3053.0); - - TEST(alltypes.opt_string && strcmp(alltypes.opt_string, "3054") == 0); - TEST(alltypes.opt_bytes && alltypes.opt_bytes->size == 4); - TEST(alltypes.opt_bytes && memcmp(&alltypes.opt_bytes->bytes, "3055", 4) == 0); - TEST(alltypes.opt_submsg && strcmp(alltypes.opt_submsg->substuff1, "3056") == 0); - TEST(alltypes.opt_submsg && *alltypes.opt_submsg->substuff2 == 3056); - TEST(alltypes.opt_enum && *alltypes.opt_enum == MyEnum_Truth); - TEST(alltypes.opt_emptymsg); - - TEST(alltypes.which_oneof == AllTypes_oneof_msg1_tag); - TEST(alltypes.oneof.oneof_msg1 && strcmp(alltypes.oneof.oneof_msg1->substuff1, "4059") == 0); - TEST(alltypes.oneof.oneof_msg1->substuff2 && *alltypes.oneof.oneof_msg1->substuff2 == 4059); - } - - TEST(alltypes.req_limits->int32_min && *alltypes.req_limits->int32_min == INT32_MIN); - TEST(alltypes.req_limits->int32_max && *alltypes.req_limits->int32_max == INT32_MAX); - TEST(alltypes.req_limits->uint32_min && *alltypes.req_limits->uint32_min == 0); - TEST(alltypes.req_limits->uint32_max && *alltypes.req_limits->uint32_max == UINT32_MAX); - TEST(alltypes.req_limits->int64_min && *alltypes.req_limits->int64_min == INT64_MIN); - TEST(alltypes.req_limits->int64_max && *alltypes.req_limits->int64_max == INT64_MAX); - TEST(alltypes.req_limits->uint64_min && *alltypes.req_limits->uint64_min == 0); - TEST(alltypes.req_limits->uint64_max && *alltypes.req_limits->uint64_max == UINT64_MAX); - TEST(alltypes.req_limits->enum_min && *alltypes.req_limits->enum_min == HugeEnum_Negative); - TEST(alltypes.req_limits->enum_max && *alltypes.req_limits->enum_max == HugeEnum_Positive); - - TEST(alltypes.end && *alltypes.end == 1099); - - pb_release(AllTypes_fields, &alltypes); - - return status; -} - -int main(int argc, char **argv) -{ - uint8_t buffer[1024]; - size_t count; - pb_istream_t stream; - - /* Whether to expect the optional values or the default values. */ - int mode = (argc > 1) ? atoi(argv[1]) : 0; - - /* Read the data into buffer */ - SET_BINARY_MODE(stdin); - count = fread(buffer, 1, sizeof(buffer), stdin); - - /* Construct a pb_istream_t for reading from the buffer */ - stream = pb_istream_from_buffer(buffer, count); - - /* Decode and verify the message */ - if (!check_alltypes(&stream, mode)) - { - fprintf(stderr, "Test failed: %s\n", PB_GET_ERROR(&stream)); - return 1; - } - else - { - return 0; - } -} diff --git a/third_party/nanopb/tests/alltypes_pointer/encode_alltypes_pointer.c b/third_party/nanopb/tests/alltypes_pointer/encode_alltypes_pointer.c deleted file mode 100644 index 7b52662f702..00000000000 --- a/third_party/nanopb/tests/alltypes_pointer/encode_alltypes_pointer.c +++ /dev/null @@ -1,194 +0,0 @@ -/* Attempts to test all the datatypes supported by ProtoBuf. - */ - -#include -#include -#include -#include -#include "alltypes.pb.h" -#include "test_helpers.h" - -int main(int argc, char **argv) -{ - int mode = (argc > 1) ? atoi(argv[1]) : 0; - - /* Values for required fields */ - int32_t req_int32 = -1001; - int64_t req_int64 = -1002; - uint32_t req_uint32 = 1003; - uint64_t req_uint64 = 1004; - int32_t req_sint32 = -1005; - int64_t req_sint64 = -1006; - bool req_bool = true; - uint32_t req_fixed32 = 1008; - int32_t req_sfixed32 = -1009; - float req_float = 1010.0f; - uint64_t req_fixed64 = 1011; - int64_t req_sfixed64 = -1012; - double req_double = 1013.0; - char* req_string = "1014"; - PB_BYTES_ARRAY_T(4) req_bytes = {4, {'1', '0', '1', '5'}}; - static int32_t req_substuff = 1016; - SubMessage req_submsg = {"1016", &req_substuff}; - MyEnum req_enum = MyEnum_Truth; - EmptyMessage req_emptymsg = {0}; - - int32_t end = 1099; - - /* Values for repeated fields */ - int32_t rep_int32[5] = {0, 0, 0, 0, -2001}; - int64_t rep_int64[5] = {0, 0, 0, 0, -2002}; - uint32_t rep_uint32[5] = {0, 0, 0, 0, 2003}; - uint64_t rep_uint64[5] = {0, 0, 0, 0, 2004}; - int32_t rep_sint32[5] = {0, 0, 0, 0, -2005}; - int64_t rep_sint64[5] = {0, 0, 0, 0, -2006}; - bool rep_bool[5] = {false, false, false, false, true}; - uint32_t rep_fixed32[5] = {0, 0, 0, 0, 2008}; - int32_t rep_sfixed32[5] = {0, 0, 0, 0, -2009}; - float rep_float[5] = {0, 0, 0, 0, 2010.0f}; - uint64_t rep_fixed64[5] = {0, 0, 0, 0, 2011}; - int64_t rep_sfixed64[5] = {0, 0, 0, 0, -2012}; - double rep_double[5] = {0, 0, 0, 0, 2013.0f}; - char* rep_string[5] = {"", "", "", "", "2014"}; - static PB_BYTES_ARRAY_T(4) rep_bytes_4 = {4, {'2', '0', '1', '5'}}; - pb_bytes_array_t *rep_bytes[5]= {NULL, NULL, NULL, NULL, (pb_bytes_array_t*)&rep_bytes_4}; - static int32_t rep_sub2zero = 0; - static int32_t rep_substuff2 = 2016; - static uint32_t rep_substuff3 = 2016; - SubMessage rep_submsg[5] = {{"", &rep_sub2zero}, - {"", &rep_sub2zero}, - {"", &rep_sub2zero}, - {"", &rep_sub2zero}, - {"2016", &rep_substuff2, &rep_substuff3}}; - MyEnum rep_enum[5] = {0, 0, 0, 0, MyEnum_Truth}; - EmptyMessage rep_emptymsg[5] = {{0}, {0}, {0}, {0}, {0}}; - - /* Values for optional fields */ - int32_t opt_int32 = 3041; - int64_t opt_int64 = 3042; - uint32_t opt_uint32 = 3043; - uint64_t opt_uint64 = 3044; - int32_t opt_sint32 = 3045; - int64_t opt_sint64 = 3046; - bool opt_bool = true; - uint32_t opt_fixed32 = 3048; - int32_t opt_sfixed32 = 3049; - float opt_float = 3050.0f; - uint64_t opt_fixed64 = 3051; - int64_t opt_sfixed64 = 3052; - double opt_double = 3053.0; - char* opt_string = "3054"; - PB_BYTES_ARRAY_T(4) opt_bytes = {4, {'3', '0', '5', '5'}}; - static int32_t opt_substuff = 3056; - SubMessage opt_submsg = {"3056", &opt_substuff}; - MyEnum opt_enum = MyEnum_Truth; - EmptyMessage opt_emptymsg = {0}; - - static int32_t oneof_substuff = 4059; - SubMessage oneof_msg1 = {"4059", &oneof_substuff}; - - /* Values for the Limits message. */ - static int32_t int32_min = INT32_MIN; - static int32_t int32_max = INT32_MAX; - static uint32_t uint32_min = 0; - static uint32_t uint32_max = UINT32_MAX; - static int64_t int64_min = INT64_MIN; - static int64_t int64_max = INT64_MAX; - static uint64_t uint64_min = 0; - static uint64_t uint64_max = UINT64_MAX; - static HugeEnum enum_min = HugeEnum_Negative; - static HugeEnum enum_max = HugeEnum_Positive; - Limits req_limits = {&int32_min, &int32_max, - &uint32_min, &uint32_max, - &int64_min, &int64_max, - &uint64_min, &uint64_max, - &enum_min, &enum_max}; - - /* Initialize the message struct with pointers to the fields. */ - AllTypes alltypes = {0}; - - alltypes.req_int32 = &req_int32; - alltypes.req_int64 = &req_int64; - alltypes.req_uint32 = &req_uint32; - alltypes.req_uint64 = &req_uint64; - alltypes.req_sint32 = &req_sint32; - alltypes.req_sint64 = &req_sint64; - alltypes.req_bool = &req_bool; - alltypes.req_fixed32 = &req_fixed32; - alltypes.req_sfixed32 = &req_sfixed32; - alltypes.req_float = &req_float; - alltypes.req_fixed64 = &req_fixed64; - alltypes.req_sfixed64 = &req_sfixed64; - alltypes.req_double = &req_double; - alltypes.req_string = req_string; - alltypes.req_bytes = (pb_bytes_array_t*)&req_bytes; - alltypes.req_submsg = &req_submsg; - alltypes.req_enum = &req_enum; - alltypes.req_emptymsg = &req_emptymsg; - alltypes.req_limits = &req_limits; - - alltypes.rep_int32_count = 5; alltypes.rep_int32 = rep_int32; - alltypes.rep_int64_count = 5; alltypes.rep_int64 = rep_int64; - alltypes.rep_uint32_count = 5; alltypes.rep_uint32 = rep_uint32; - alltypes.rep_uint64_count = 5; alltypes.rep_uint64 = rep_uint64; - alltypes.rep_sint32_count = 5; alltypes.rep_sint32 = rep_sint32; - alltypes.rep_sint64_count = 5; alltypes.rep_sint64 = rep_sint64; - alltypes.rep_bool_count = 5; alltypes.rep_bool = rep_bool; - alltypes.rep_fixed32_count = 5; alltypes.rep_fixed32 = rep_fixed32; - alltypes.rep_sfixed32_count = 5; alltypes.rep_sfixed32 = rep_sfixed32; - alltypes.rep_float_count = 5; alltypes.rep_float = rep_float; - alltypes.rep_fixed64_count = 5; alltypes.rep_fixed64 = rep_fixed64; - alltypes.rep_sfixed64_count = 5; alltypes.rep_sfixed64 = rep_sfixed64; - alltypes.rep_double_count = 5; alltypes.rep_double = rep_double; - alltypes.rep_string_count = 5; alltypes.rep_string = rep_string; - alltypes.rep_bytes_count = 5; alltypes.rep_bytes = rep_bytes; - alltypes.rep_submsg_count = 5; alltypes.rep_submsg = rep_submsg; - alltypes.rep_enum_count = 5; alltypes.rep_enum = rep_enum; - alltypes.rep_emptymsg_count = 5; alltypes.rep_emptymsg = rep_emptymsg; - - if (mode != 0) - { - /* Fill in values for optional fields */ - alltypes.opt_int32 = &opt_int32; - alltypes.opt_int64 = &opt_int64; - alltypes.opt_uint32 = &opt_uint32; - alltypes.opt_uint64 = &opt_uint64; - alltypes.opt_sint32 = &opt_sint32; - alltypes.opt_sint64 = &opt_sint64; - alltypes.opt_bool = &opt_bool; - alltypes.opt_fixed32 = &opt_fixed32; - alltypes.opt_sfixed32 = &opt_sfixed32; - alltypes.opt_float = &opt_float; - alltypes.opt_fixed64 = &opt_fixed64; - alltypes.opt_sfixed64 = &opt_sfixed64; - alltypes.opt_double = &opt_double; - alltypes.opt_string = opt_string; - alltypes.opt_bytes = (pb_bytes_array_t*)&opt_bytes; - alltypes.opt_submsg = &opt_submsg; - alltypes.opt_enum = &opt_enum; - alltypes.opt_emptymsg = &opt_emptymsg; - - alltypes.which_oneof = AllTypes_oneof_msg1_tag; - alltypes.oneof.oneof_msg1 = &oneof_msg1; - } - - alltypes.end = &end; - - { - uint8_t buffer[4096]; - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - /* Now encode it and check if we succeeded. */ - if (pb_encode(&stream, AllTypes_fields, &alltypes)) - { - SET_BINARY_MODE(stdout); - fwrite(buffer, 1, stream.bytes_written, stdout); - return 0; /* Success */ - } - else - { - fprintf(stderr, "Encoding failed: %s\n", PB_GET_ERROR(&stream)); - return 1; /* Failure */ - } - } -} diff --git a/third_party/nanopb/tests/anonymous_oneof/SConscript b/third_party/nanopb/tests/anonymous_oneof/SConscript deleted file mode 100644 index 106722875fd..00000000000 --- a/third_party/nanopb/tests/anonymous_oneof/SConscript +++ /dev/null @@ -1,30 +0,0 @@ -# Test anonymous_oneof generator option - -Import('env') - -import re - -match = None -if 'PROTOC_VERSION' in env: - match = re.search('([0-9]+).([0-9]+).([0-9]+)', env['PROTOC_VERSION']) - -if match: - version = map(int, match.groups()) - -# Oneof is supported by protoc >= 2.6.0 -if env.GetOption('clean') or (match and (version[0] > 2 or (version[0] == 2 and version[1] >= 6))): - # Anonymous oneofs are supported by clang and gcc - if 'clang' in env['CC'] or 'gcc' in env['CC']: - env2 = env.Clone() - if '-pedantic' in env2['CFLAGS']: - env2['CFLAGS'].remove('-pedantic') - env2.NanopbProto('oneof') - - dec = env2.Program(['decode_oneof.c', - 'oneof.pb.c', - '$COMMON/pb_decode.o', - '$COMMON/pb_common.o']) - - env2.RunTest("message1.txt", [dec, '$BUILD/oneof/message1.pb'], ARGS = ['1']) - env2.RunTest("message2.txt", [dec, '$BUILD/oneof/message2.pb'], ARGS = ['2']) - env2.RunTest("message3.txt", [dec, '$BUILD/oneof/message3.pb'], ARGS = ['3']) diff --git a/third_party/nanopb/tests/anonymous_oneof/decode_oneof.c b/third_party/nanopb/tests/anonymous_oneof/decode_oneof.c deleted file mode 100644 index 0f774dbc906..00000000000 --- a/third_party/nanopb/tests/anonymous_oneof/decode_oneof.c +++ /dev/null @@ -1,88 +0,0 @@ -/* Decode a message using oneof fields */ - -#include -#include -#include -#include -#include "oneof.pb.h" -#include "test_helpers.h" -#include "unittests.h" - -/* Test the 'AnonymousOneOfMessage' */ -int test_oneof_1(pb_istream_t *stream, int option) -{ - AnonymousOneOfMessage msg; - int status = 0; - - /* To better catch initialization errors */ - memset(&msg, 0xAA, sizeof(msg)); - - if (!pb_decode(stream, AnonymousOneOfMessage_fields, &msg)) - { - printf("Decoding failed: %s\n", PB_GET_ERROR(stream)); - return 1; - } - - /* Check that the basic fields work normally */ - TEST(msg.prefix == 123); - TEST(msg.suffix == 321); - - /* Check that we got the right oneof according to command line */ - if (option == 1) - { - TEST(msg.which_values == AnonymousOneOfMessage_first_tag); - TEST(msg.first == 999); - } - else if (option == 2) - { - TEST(msg.which_values == AnonymousOneOfMessage_second_tag); - TEST(strcmp(msg.second, "abcd") == 0); - } - else if (option == 3) - { - TEST(msg.which_values == AnonymousOneOfMessage_third_tag); - TEST(msg.third.array[0] == 1); - TEST(msg.third.array[1] == 2); - TEST(msg.third.array[2] == 3); - TEST(msg.third.array[3] == 4); - TEST(msg.third.array[4] == 5); - } - - return status; -} - -int main(int argc, char **argv) -{ - uint8_t buffer[AnonymousOneOfMessage_size]; - size_t count; - int option; - - if (argc != 2) - { - fprintf(stderr, "Usage: decode_oneof [number]\n"); - return 1; - } - option = atoi(argv[1]); - - SET_BINARY_MODE(stdin); - count = fread(buffer, 1, sizeof(buffer), stdin); - - if (!feof(stdin)) - { - printf("Message does not fit in buffer\n"); - return 1; - } - - { - int status = 0; - pb_istream_t stream; - - stream = pb_istream_from_buffer(buffer, count); - status = test_oneof_1(&stream, option); - - if (status != 0) - return status; - } - - return 0; -} diff --git a/third_party/nanopb/tests/anonymous_oneof/oneof.proto b/third_party/nanopb/tests/anonymous_oneof/oneof.proto deleted file mode 100644 index d56285c04d6..00000000000 --- a/third_party/nanopb/tests/anonymous_oneof/oneof.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto2"; - -import 'nanopb.proto'; - -message SubMessage -{ - repeated int32 array = 1 [(nanopb).max_count = 8]; -} - -/* Oneof in a message with other fields */ -message AnonymousOneOfMessage -{ - option (nanopb_msgopt).anonymous_oneof = true; - required int32 prefix = 1; - oneof values - { - int32 first = 5; - string second = 6 [(nanopb).max_size = 8]; - SubMessage third = 7; - } - required int32 suffix = 99; -} - diff --git a/third_party/nanopb/tests/backwards_compatibility/SConscript b/third_party/nanopb/tests/backwards_compatibility/SConscript deleted file mode 100644 index 81b031827b0..00000000000 --- a/third_party/nanopb/tests/backwards_compatibility/SConscript +++ /dev/null @@ -1,11 +0,0 @@ -# Check that the old generated .pb.c/.pb.h files are still compatible with the -# current version of nanopb. - -Import("env") - -enc = env.Program(["encode_legacy.c", "alltypes_legacy.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"]) -dec = env.Program(["decode_legacy.c", "alltypes_legacy.c", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"]) - -env.RunTest(enc) -env.RunTest([dec, "encode_legacy.output"]) - diff --git a/third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.c b/third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.c deleted file mode 100644 index 7311fd45715..00000000000 --- a/third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.c +++ /dev/null @@ -1,153 +0,0 @@ -/* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.3.0-dev at Tue Aug 19 17:53:24 2014. */ - -#include "alltypes_legacy.h" - -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - -const char SubMessage_substuff1_default[16] = "1"; -const int32_t SubMessage_substuff2_default = 2; -const uint32_t SubMessage_substuff3_default = 3u; -const int32_t Limits_int32_min_default = 2147483647; -const int32_t Limits_int32_max_default = -2147483647; -const uint32_t Limits_uint32_min_default = 4294967295u; -const uint32_t Limits_uint32_max_default = 0u; -const int64_t Limits_int64_min_default = 9223372036854775807ll; -const int64_t Limits_int64_max_default = -9223372036854775807ll; -const uint64_t Limits_uint64_min_default = 18446744073709551615ull; -const uint64_t Limits_uint64_max_default = 0ull; -const HugeEnum Limits_enum_min_default = HugeEnum_Positive; -const HugeEnum Limits_enum_max_default = HugeEnum_Negative; -const int32_t AllTypes_opt_int32_default = 4041; -const int64_t AllTypes_opt_int64_default = 4042ll; -const uint32_t AllTypes_opt_uint32_default = 4043u; -const uint64_t AllTypes_opt_uint64_default = 4044ull; -const int32_t AllTypes_opt_sint32_default = 4045; -const int64_t AllTypes_opt_sint64_default = 4046; -const bool AllTypes_opt_bool_default = false; -const uint32_t AllTypes_opt_fixed32_default = 4048u; -const int32_t AllTypes_opt_sfixed32_default = 4049; -const float AllTypes_opt_float_default = 4050; -const uint64_t AllTypes_opt_fixed64_default = 4051ull; -const int64_t AllTypes_opt_sfixed64_default = 4052ll; -const double AllTypes_opt_double_default = 4053; -const char AllTypes_opt_string_default[16] = "4054"; -const AllTypes_opt_bytes_t AllTypes_opt_bytes_default = {4, {0x34,0x30,0x35,0x35}}; -const MyEnum AllTypes_opt_enum_default = MyEnum_Second; - - -const pb_field_t SubMessage_fields[4] = { - PB_FIELD( 1, STRING , REQUIRED, STATIC , FIRST, SubMessage, substuff1, substuff1, &SubMessage_substuff1_default), - PB_FIELD( 2, INT32 , REQUIRED, STATIC , OTHER, SubMessage, substuff2, substuff1, &SubMessage_substuff2_default), - PB_FIELD( 3, FIXED32 , OPTIONAL, STATIC , OTHER, SubMessage, substuff3, substuff2, &SubMessage_substuff3_default), - PB_LAST_FIELD -}; - -const pb_field_t EmptyMessage_fields[1] = { - PB_LAST_FIELD -}; - -const pb_field_t Limits_fields[11] = { - PB_FIELD( 1, INT32 , REQUIRED, STATIC , FIRST, Limits, int32_min, int32_min, &Limits_int32_min_default), - PB_FIELD( 2, INT32 , REQUIRED, STATIC , OTHER, Limits, int32_max, int32_min, &Limits_int32_max_default), - PB_FIELD( 3, UINT32 , REQUIRED, STATIC , OTHER, Limits, uint32_min, int32_max, &Limits_uint32_min_default), - PB_FIELD( 4, UINT32 , REQUIRED, STATIC , OTHER, Limits, uint32_max, uint32_min, &Limits_uint32_max_default), - PB_FIELD( 5, INT64 , REQUIRED, STATIC , OTHER, Limits, int64_min, uint32_max, &Limits_int64_min_default), - PB_FIELD( 6, INT64 , REQUIRED, STATIC , OTHER, Limits, int64_max, int64_min, &Limits_int64_max_default), - PB_FIELD( 7, UINT64 , REQUIRED, STATIC , OTHER, Limits, uint64_min, int64_max, &Limits_uint64_min_default), - PB_FIELD( 8, UINT64 , REQUIRED, STATIC , OTHER, Limits, uint64_max, uint64_min, &Limits_uint64_max_default), - PB_FIELD( 9, ENUM , REQUIRED, STATIC , OTHER, Limits, enum_min, uint64_max, &Limits_enum_min_default), - PB_FIELD( 10, ENUM , REQUIRED, STATIC , OTHER, Limits, enum_max, enum_min, &Limits_enum_max_default), - PB_LAST_FIELD -}; - -const pb_field_t AllTypes_fields[54] = { - PB_FIELD( 1, INT32 , REQUIRED, STATIC , FIRST, AllTypes, req_int32, req_int32, 0), - PB_FIELD( 2, INT64 , REQUIRED, STATIC , OTHER, AllTypes, req_int64, req_int32, 0), - PB_FIELD( 3, UINT32 , REQUIRED, STATIC , OTHER, AllTypes, req_uint32, req_int64, 0), - PB_FIELD( 4, UINT64 , REQUIRED, STATIC , OTHER, AllTypes, req_uint64, req_uint32, 0), - PB_FIELD( 5, SINT32 , REQUIRED, STATIC , OTHER, AllTypes, req_sint32, req_uint64, 0), - PB_FIELD( 6, SINT64 , REQUIRED, STATIC , OTHER, AllTypes, req_sint64, req_sint32, 0), - PB_FIELD( 7, BOOL , REQUIRED, STATIC , OTHER, AllTypes, req_bool, req_sint64, 0), - PB_FIELD( 8, FIXED32 , REQUIRED, STATIC , OTHER, AllTypes, req_fixed32, req_bool, 0), - PB_FIELD( 9, SFIXED32, REQUIRED, STATIC , OTHER, AllTypes, req_sfixed32, req_fixed32, 0), - PB_FIELD( 10, FLOAT , REQUIRED, STATIC , OTHER, AllTypes, req_float, req_sfixed32, 0), - PB_FIELD( 11, FIXED64 , REQUIRED, STATIC , OTHER, AllTypes, req_fixed64, req_float, 0), - PB_FIELD( 12, SFIXED64, REQUIRED, STATIC , OTHER, AllTypes, req_sfixed64, req_fixed64, 0), - PB_FIELD( 13, DOUBLE , REQUIRED, STATIC , OTHER, AllTypes, req_double, req_sfixed64, 0), - PB_FIELD( 14, STRING , REQUIRED, STATIC , OTHER, AllTypes, req_string, req_double, 0), - PB_FIELD( 15, BYTES , REQUIRED, STATIC , OTHER, AllTypes, req_bytes, req_string, 0), - PB_FIELD( 16, MESSAGE , REQUIRED, STATIC , OTHER, AllTypes, req_submsg, req_bytes, &SubMessage_fields), - PB_FIELD( 17, ENUM , REQUIRED, STATIC , OTHER, AllTypes, req_enum, req_submsg, 0), - PB_FIELD( 21, INT32 , REPEATED, STATIC , OTHER, AllTypes, rep_int32, req_enum, 0), - PB_FIELD( 22, INT64 , REPEATED, STATIC , OTHER, AllTypes, rep_int64, rep_int32, 0), - PB_FIELD( 23, UINT32 , REPEATED, STATIC , OTHER, AllTypes, rep_uint32, rep_int64, 0), - PB_FIELD( 24, UINT64 , REPEATED, STATIC , OTHER, AllTypes, rep_uint64, rep_uint32, 0), - PB_FIELD( 25, SINT32 , REPEATED, STATIC , OTHER, AllTypes, rep_sint32, rep_uint64, 0), - PB_FIELD( 26, SINT64 , REPEATED, STATIC , OTHER, AllTypes, rep_sint64, rep_sint32, 0), - PB_FIELD( 27, BOOL , REPEATED, STATIC , OTHER, AllTypes, rep_bool, rep_sint64, 0), - PB_FIELD( 28, FIXED32 , REPEATED, STATIC , OTHER, AllTypes, rep_fixed32, rep_bool, 0), - PB_FIELD( 29, SFIXED32, REPEATED, STATIC , OTHER, AllTypes, rep_sfixed32, rep_fixed32, 0), - PB_FIELD( 30, FLOAT , REPEATED, STATIC , OTHER, AllTypes, rep_float, rep_sfixed32, 0), - PB_FIELD( 31, FIXED64 , REPEATED, STATIC , OTHER, AllTypes, rep_fixed64, rep_float, 0), - PB_FIELD( 32, SFIXED64, REPEATED, STATIC , OTHER, AllTypes, rep_sfixed64, rep_fixed64, 0), - PB_FIELD( 33, DOUBLE , REPEATED, STATIC , OTHER, AllTypes, rep_double, rep_sfixed64, 0), - PB_FIELD( 34, STRING , REPEATED, STATIC , OTHER, AllTypes, rep_string, rep_double, 0), - PB_FIELD( 35, BYTES , REPEATED, STATIC , OTHER, AllTypes, rep_bytes, rep_string, 0), - PB_FIELD( 36, MESSAGE , REPEATED, STATIC , OTHER, AllTypes, rep_submsg, rep_bytes, &SubMessage_fields), - PB_FIELD( 37, ENUM , REPEATED, STATIC , OTHER, AllTypes, rep_enum, rep_submsg, 0), - PB_FIELD( 41, INT32 , OPTIONAL, STATIC , OTHER, AllTypes, opt_int32, rep_enum, &AllTypes_opt_int32_default), - PB_FIELD( 42, INT64 , OPTIONAL, STATIC , OTHER, AllTypes, opt_int64, opt_int32, &AllTypes_opt_int64_default), - PB_FIELD( 43, UINT32 , OPTIONAL, STATIC , OTHER, AllTypes, opt_uint32, opt_int64, &AllTypes_opt_uint32_default), - PB_FIELD( 44, UINT64 , OPTIONAL, STATIC , OTHER, AllTypes, opt_uint64, opt_uint32, &AllTypes_opt_uint64_default), - PB_FIELD( 45, SINT32 , OPTIONAL, STATIC , OTHER, AllTypes, opt_sint32, opt_uint64, &AllTypes_opt_sint32_default), - PB_FIELD( 46, SINT64 , OPTIONAL, STATIC , OTHER, AllTypes, opt_sint64, opt_sint32, &AllTypes_opt_sint64_default), - PB_FIELD( 47, BOOL , OPTIONAL, STATIC , OTHER, AllTypes, opt_bool, opt_sint64, &AllTypes_opt_bool_default), - PB_FIELD( 48, FIXED32 , OPTIONAL, STATIC , OTHER, AllTypes, opt_fixed32, opt_bool, &AllTypes_opt_fixed32_default), - PB_FIELD( 49, SFIXED32, OPTIONAL, STATIC , OTHER, AllTypes, opt_sfixed32, opt_fixed32, &AllTypes_opt_sfixed32_default), - PB_FIELD( 50, FLOAT , OPTIONAL, STATIC , OTHER, AllTypes, opt_float, opt_sfixed32, &AllTypes_opt_float_default), - PB_FIELD( 51, FIXED64 , OPTIONAL, STATIC , OTHER, AllTypes, opt_fixed64, opt_float, &AllTypes_opt_fixed64_default), - PB_FIELD( 52, SFIXED64, OPTIONAL, STATIC , OTHER, AllTypes, opt_sfixed64, opt_fixed64, &AllTypes_opt_sfixed64_default), - PB_FIELD( 53, DOUBLE , OPTIONAL, STATIC , OTHER, AllTypes, opt_double, opt_sfixed64, &AllTypes_opt_double_default), - PB_FIELD( 54, STRING , OPTIONAL, STATIC , OTHER, AllTypes, opt_string, opt_double, &AllTypes_opt_string_default), - PB_FIELD( 55, BYTES , OPTIONAL, STATIC , OTHER, AllTypes, opt_bytes, opt_string, &AllTypes_opt_bytes_default), - PB_FIELD( 56, MESSAGE , OPTIONAL, STATIC , OTHER, AllTypes, opt_submsg, opt_bytes, &SubMessage_fields), - PB_FIELD( 57, ENUM , OPTIONAL, STATIC , OTHER, AllTypes, opt_enum, opt_submsg, &AllTypes_opt_enum_default), - PB_FIELD( 99, INT32 , REQUIRED, STATIC , OTHER, AllTypes, end, opt_enum, 0), - PB_FIELD(200, EXTENSION, OPTIONAL, CALLBACK, OTHER, AllTypes, extensions, end, 0), - PB_LAST_FIELD -}; - - -/* Check that field information fits in pb_field_t */ -#if !defined(PB_FIELD_32BIT) -/* If you get an error here, it means that you need to define PB_FIELD_32BIT - * compile-time option. You can do that in pb.h or on compiler command line. - * - * The reason you need to do this is that some of your messages contain tag - * numbers or field sizes that are larger than what can fit in 8 or 16 bit - * field descriptors. - */ -PB_STATIC_ASSERT((pb_membersize(AllTypes, req_submsg) < 65536 && pb_membersize(AllTypes, rep_submsg[0]) < 65536 && pb_membersize(AllTypes, opt_submsg) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_SubMessage_EmptyMessage_Limits_AllTypes) -#endif - -#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT) -/* If you get an error here, it means that you need to define PB_FIELD_16BIT - * compile-time option. You can do that in pb.h or on compiler command line. - * - * The reason you need to do this is that some of your messages contain tag - * numbers or field sizes that are larger than what can fit in the default - * 8 bit descriptors. - */ -PB_STATIC_ASSERT((pb_membersize(AllTypes, req_submsg) < 256 && pb_membersize(AllTypes, rep_submsg[0]) < 256 && pb_membersize(AllTypes, opt_submsg) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_SubMessage_EmptyMessage_Limits_AllTypes) -#endif - - -/* On some platforms (such as AVR), double is really float. - * These are not directly supported by nanopb, but see example_avr_double. - * To get rid of this error, remove any double fields from your .proto. - */ -PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES) - diff --git a/third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.h b/third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.h deleted file mode 100644 index 4e0a63be465..00000000000 --- a/third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.h +++ /dev/null @@ -1,274 +0,0 @@ -/* Automatically generated nanopb header */ -/* Generated by nanopb-0.3.0-dev at Tue Aug 19 17:53:24 2014. */ - -#ifndef PB_ALLTYPES_LEGACY_H_INCLUDED -#define PB_ALLTYPES_LEGACY_H_INCLUDED -#include - -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Enum definitions */ -typedef enum _HugeEnum { - HugeEnum_Negative = -2147483647, - HugeEnum_Positive = 2147483647 -} HugeEnum; - -typedef enum _MyEnum { - MyEnum_Zero = 0, - MyEnum_First = 1, - MyEnum_Second = 2, - MyEnum_Truth = 42 -} MyEnum; - -/* Struct definitions */ -typedef struct _EmptyMessage { - uint8_t dummy_field; -} EmptyMessage; - -typedef struct _Limits { - int32_t int32_min; - int32_t int32_max; - uint32_t uint32_min; - uint32_t uint32_max; - int64_t int64_min; - int64_t int64_max; - uint64_t uint64_min; - uint64_t uint64_max; - HugeEnum enum_min; - HugeEnum enum_max; -} Limits; - -typedef struct _SubMessage { - char substuff1[16]; - int32_t substuff2; - bool has_substuff3; - uint32_t substuff3; -} SubMessage; - -typedef PB_BYTES_ARRAY_T(16) AllTypes_req_bytes_t; - -typedef PB_BYTES_ARRAY_T(16) AllTypes_rep_bytes_t; - -typedef PB_BYTES_ARRAY_T(16) AllTypes_opt_bytes_t; - -typedef struct _AllTypes { - int32_t req_int32; - int64_t req_int64; - uint32_t req_uint32; - uint64_t req_uint64; - int32_t req_sint32; - int64_t req_sint64; - bool req_bool; - uint32_t req_fixed32; - int32_t req_sfixed32; - float req_float; - uint64_t req_fixed64; - int64_t req_sfixed64; - double req_double; - char req_string[16]; - AllTypes_req_bytes_t req_bytes; - SubMessage req_submsg; - MyEnum req_enum; - pb_size_t rep_int32_count; - int32_t rep_int32[5]; - pb_size_t rep_int64_count; - int64_t rep_int64[5]; - pb_size_t rep_uint32_count; - uint32_t rep_uint32[5]; - pb_size_t rep_uint64_count; - uint64_t rep_uint64[5]; - pb_size_t rep_sint32_count; - int32_t rep_sint32[5]; - pb_size_t rep_sint64_count; - int64_t rep_sint64[5]; - pb_size_t rep_bool_count; - bool rep_bool[5]; - pb_size_t rep_fixed32_count; - uint32_t rep_fixed32[5]; - pb_size_t rep_sfixed32_count; - int32_t rep_sfixed32[5]; - pb_size_t rep_float_count; - float rep_float[5]; - pb_size_t rep_fixed64_count; - uint64_t rep_fixed64[5]; - pb_size_t rep_sfixed64_count; - int64_t rep_sfixed64[5]; - pb_size_t rep_double_count; - double rep_double[5]; - pb_size_t rep_string_count; - char rep_string[5][16]; - pb_size_t rep_bytes_count; - AllTypes_rep_bytes_t rep_bytes[5]; - pb_size_t rep_submsg_count; - SubMessage rep_submsg[5]; - pb_size_t rep_enum_count; - MyEnum rep_enum[5]; - bool has_opt_int32; - int32_t opt_int32; - bool has_opt_int64; - int64_t opt_int64; - bool has_opt_uint32; - uint32_t opt_uint32; - bool has_opt_uint64; - uint64_t opt_uint64; - bool has_opt_sint32; - int32_t opt_sint32; - bool has_opt_sint64; - int64_t opt_sint64; - bool has_opt_bool; - bool opt_bool; - bool has_opt_fixed32; - uint32_t opt_fixed32; - bool has_opt_sfixed32; - int32_t opt_sfixed32; - bool has_opt_float; - float opt_float; - bool has_opt_fixed64; - uint64_t opt_fixed64; - bool has_opt_sfixed64; - int64_t opt_sfixed64; - bool has_opt_double; - double opt_double; - bool has_opt_string; - char opt_string[16]; - bool has_opt_bytes; - AllTypes_opt_bytes_t opt_bytes; - bool has_opt_submsg; - SubMessage opt_submsg; - bool has_opt_enum; - MyEnum opt_enum; - int32_t end; - pb_extension_t *extensions; -} AllTypes; - -/* Default values for struct fields */ -extern const char SubMessage_substuff1_default[16]; -extern const int32_t SubMessage_substuff2_default; -extern const uint32_t SubMessage_substuff3_default; -extern const int32_t Limits_int32_min_default; -extern const int32_t Limits_int32_max_default; -extern const uint32_t Limits_uint32_min_default; -extern const uint32_t Limits_uint32_max_default; -extern const int64_t Limits_int64_min_default; -extern const int64_t Limits_int64_max_default; -extern const uint64_t Limits_uint64_min_default; -extern const uint64_t Limits_uint64_max_default; -extern const HugeEnum Limits_enum_min_default; -extern const HugeEnum Limits_enum_max_default; -extern const int32_t AllTypes_opt_int32_default; -extern const int64_t AllTypes_opt_int64_default; -extern const uint32_t AllTypes_opt_uint32_default; -extern const uint64_t AllTypes_opt_uint64_default; -extern const int32_t AllTypes_opt_sint32_default; -extern const int64_t AllTypes_opt_sint64_default; -extern const bool AllTypes_opt_bool_default; -extern const uint32_t AllTypes_opt_fixed32_default; -extern const int32_t AllTypes_opt_sfixed32_default; -extern const float AllTypes_opt_float_default; -extern const uint64_t AllTypes_opt_fixed64_default; -extern const int64_t AllTypes_opt_sfixed64_default; -extern const double AllTypes_opt_double_default; -extern const char AllTypes_opt_string_default[16]; -extern const AllTypes_opt_bytes_t AllTypes_opt_bytes_default; -extern const MyEnum AllTypes_opt_enum_default; - -/* Initializer values for message structs */ -#define SubMessage_init_default {"1", 2, false, 3u} -#define EmptyMessage_init_default {0} -#define Limits_init_default {2147483647, -2147483647, 4294967295u, 0u, 9223372036854775807ll, -9223372036854775807ll, 18446744073709551615ull, 0ull, HugeEnum_Positive, HugeEnum_Negative} -#define AllTypes_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", {0, {0}}, SubMessage_init_default, (MyEnum)0, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {"", "", "", "", ""}, 0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, 0, {SubMessage_init_default, SubMessage_init_default, SubMessage_init_default, SubMessage_init_default, SubMessage_init_default}, 0, {(MyEnum)0, (MyEnum)0, (MyEnum)0, (MyEnum)0, (MyEnum)0}, false, 4041, false, 4042ll, false, 4043u, false, 4044ull, false, 4045, false, 4046, false, false, false, 4048u, false, 4049, false, 4050, false, 4051ull, false, 4052ll, false, 4053, false, "4054", false, {4, {0x34,0x30,0x35,0x35}}, false, SubMessage_init_default, false, MyEnum_Second, 0, NULL} -#define SubMessage_init_zero {"", 0, false, 0} -#define EmptyMessage_init_zero {0} -#define Limits_init_zero {0, 0, 0, 0, 0, 0, 0, 0, (HugeEnum)0, (HugeEnum)0} -#define AllTypes_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", {0, {0}}, SubMessage_init_zero, (MyEnum)0, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0}, 0, {"", "", "", "", ""}, 0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, 0, {SubMessage_init_zero, SubMessage_init_zero, SubMessage_init_zero, SubMessage_init_zero, SubMessage_init_zero}, 0, {(MyEnum)0, (MyEnum)0, (MyEnum)0, (MyEnum)0, (MyEnum)0}, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, "", false, {0, {0}}, false, SubMessage_init_zero, false, (MyEnum)0, 0, NULL} - -/* Field tags (for use in manual encoding/decoding) */ -#define Limits_int32_min_tag 1 -#define Limits_int32_max_tag 2 -#define Limits_uint32_min_tag 3 -#define Limits_uint32_max_tag 4 -#define Limits_int64_min_tag 5 -#define Limits_int64_max_tag 6 -#define Limits_uint64_min_tag 7 -#define Limits_uint64_max_tag 8 -#define Limits_enum_min_tag 9 -#define Limits_enum_max_tag 10 -#define SubMessage_substuff1_tag 1 -#define SubMessage_substuff2_tag 2 -#define SubMessage_substuff3_tag 3 -#define AllTypes_req_int32_tag 1 -#define AllTypes_req_int64_tag 2 -#define AllTypes_req_uint32_tag 3 -#define AllTypes_req_uint64_tag 4 -#define AllTypes_req_sint32_tag 5 -#define AllTypes_req_sint64_tag 6 -#define AllTypes_req_bool_tag 7 -#define AllTypes_req_fixed32_tag 8 -#define AllTypes_req_sfixed32_tag 9 -#define AllTypes_req_float_tag 10 -#define AllTypes_req_fixed64_tag 11 -#define AllTypes_req_sfixed64_tag 12 -#define AllTypes_req_double_tag 13 -#define AllTypes_req_string_tag 14 -#define AllTypes_req_bytes_tag 15 -#define AllTypes_req_submsg_tag 16 -#define AllTypes_req_enum_tag 17 -#define AllTypes_rep_int32_tag 21 -#define AllTypes_rep_int64_tag 22 -#define AllTypes_rep_uint32_tag 23 -#define AllTypes_rep_uint64_tag 24 -#define AllTypes_rep_sint32_tag 25 -#define AllTypes_rep_sint64_tag 26 -#define AllTypes_rep_bool_tag 27 -#define AllTypes_rep_fixed32_tag 28 -#define AllTypes_rep_sfixed32_tag 29 -#define AllTypes_rep_float_tag 30 -#define AllTypes_rep_fixed64_tag 31 -#define AllTypes_rep_sfixed64_tag 32 -#define AllTypes_rep_double_tag 33 -#define AllTypes_rep_string_tag 34 -#define AllTypes_rep_bytes_tag 35 -#define AllTypes_rep_submsg_tag 36 -#define AllTypes_rep_enum_tag 37 -#define AllTypes_opt_int32_tag 41 -#define AllTypes_opt_int64_tag 42 -#define AllTypes_opt_uint32_tag 43 -#define AllTypes_opt_uint64_tag 44 -#define AllTypes_opt_sint32_tag 45 -#define AllTypes_opt_sint64_tag 46 -#define AllTypes_opt_bool_tag 47 -#define AllTypes_opt_fixed32_tag 48 -#define AllTypes_opt_sfixed32_tag 49 -#define AllTypes_opt_float_tag 50 -#define AllTypes_opt_fixed64_tag 51 -#define AllTypes_opt_sfixed64_tag 52 -#define AllTypes_opt_double_tag 53 -#define AllTypes_opt_string_tag 54 -#define AllTypes_opt_bytes_tag 55 -#define AllTypes_opt_submsg_tag 56 -#define AllTypes_opt_enum_tag 57 -#define AllTypes_end_tag 99 - -/* Struct field encoding specification for nanopb */ -extern const pb_field_t SubMessage_fields[4]; -extern const pb_field_t EmptyMessage_fields[1]; -extern const pb_field_t Limits_fields[11]; -extern const pb_field_t AllTypes_fields[54]; - -/* Maximum encoded size of messages (where known) */ -#define SubMessage_size 34 -#define EmptyMessage_size 0 -#define Limits_size 90 -#define AllTypes_size 1362 - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.options b/third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.options deleted file mode 100644 index b31e3cf0a9d..00000000000 --- a/third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.options +++ /dev/null @@ -1,3 +0,0 @@ -* max_size:16 -* max_count:5 - diff --git a/third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.proto b/third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.proto deleted file mode 100644 index f5bc35ce40a..00000000000 --- a/third_party/nanopb/tests/backwards_compatibility/alltypes_legacy.proto +++ /dev/null @@ -1,110 +0,0 @@ -syntax = "proto2"; - -message SubMessage { - required string substuff1 = 1 [default = "1"]; - required int32 substuff2 = 2 [default = 2]; - optional fixed32 substuff3 = 3 [default = 3]; -} - -message EmptyMessage { - -} - -enum HugeEnum { - Negative = -2147483647; /* protoc doesn't accept -2147483648 here */ - Positive = 2147483647; -} - -message Limits { - required int32 int32_min = 1 [default = 2147483647]; - required int32 int32_max = 2 [default = -2147483647]; - required uint32 uint32_min = 3 [default = 4294967295]; - required uint32 uint32_max = 4 [default = 0]; - required int64 int64_min = 5 [default = 9223372036854775807]; - required int64 int64_max = 6 [default = -9223372036854775807]; - required uint64 uint64_min = 7 [default = 18446744073709551615]; - required uint64 uint64_max = 8 [default = 0]; - required HugeEnum enum_min = 9 [default = Positive]; - required HugeEnum enum_max = 10 [default = Negative]; -} - -enum MyEnum { - Zero = 0; - First = 1; - Second = 2; - Truth = 42; -} - -message AllTypes { - required int32 req_int32 = 1; - required int64 req_int64 = 2; - required uint32 req_uint32 = 3; - required uint64 req_uint64 = 4; - required sint32 req_sint32 = 5; - required sint64 req_sint64 = 6; - required bool req_bool = 7; - - required fixed32 req_fixed32 = 8; - required sfixed32 req_sfixed32= 9; - required float req_float = 10; - - required fixed64 req_fixed64 = 11; - required sfixed64 req_sfixed64= 12; - required double req_double = 13; - - required string req_string = 14; - required bytes req_bytes = 15; - required SubMessage req_submsg = 16; - required MyEnum req_enum = 17; - - - repeated int32 rep_int32 = 21 [packed = true]; - repeated int64 rep_int64 = 22 [packed = true]; - repeated uint32 rep_uint32 = 23 [packed = true]; - repeated uint64 rep_uint64 = 24 [packed = true]; - repeated sint32 rep_sint32 = 25 [packed = true]; - repeated sint64 rep_sint64 = 26 [packed = true]; - repeated bool rep_bool = 27 [packed = true]; - - repeated fixed32 rep_fixed32 = 28 [packed = true]; - repeated sfixed32 rep_sfixed32= 29 [packed = true]; - repeated float rep_float = 30 [packed = true]; - - repeated fixed64 rep_fixed64 = 31 [packed = true]; - repeated sfixed64 rep_sfixed64= 32 [packed = true]; - repeated double rep_double = 33 [packed = true]; - - repeated string rep_string = 34; - repeated bytes rep_bytes = 35; - repeated SubMessage rep_submsg = 36; - repeated MyEnum rep_enum = 37 [packed = true]; - - optional int32 opt_int32 = 41 [default = 4041]; - optional int64 opt_int64 = 42 [default = 4042]; - optional uint32 opt_uint32 = 43 [default = 4043]; - optional uint64 opt_uint64 = 44 [default = 4044]; - optional sint32 opt_sint32 = 45 [default = 4045]; - optional sint64 opt_sint64 = 46 [default = 4046]; - optional bool opt_bool = 47 [default = false]; - - optional fixed32 opt_fixed32 = 48 [default = 4048]; - optional sfixed32 opt_sfixed32= 49 [default = 4049]; - optional float opt_float = 50 [default = 4050]; - - optional fixed64 opt_fixed64 = 51 [default = 4051]; - optional sfixed64 opt_sfixed64= 52 [default = 4052]; - optional double opt_double = 53 [default = 4053]; - - optional string opt_string = 54 [default = "4054"]; - optional bytes opt_bytes = 55 [default = "4055"]; - optional SubMessage opt_submsg = 56; - optional MyEnum opt_enum = 57 [default = Second]; - - // Just to make sure that the size of the fields has been calculated - // properly, i.e. otherwise a bug in last field might not be detected. - required int32 end = 99; - - - extensions 200 to 255; -} - diff --git a/third_party/nanopb/tests/backwards_compatibility/decode_legacy.c b/third_party/nanopb/tests/backwards_compatibility/decode_legacy.c deleted file mode 100644 index 5f5b6bbe76b..00000000000 --- a/third_party/nanopb/tests/backwards_compatibility/decode_legacy.c +++ /dev/null @@ -1,199 +0,0 @@ -/* Tests the decoding of all types. - * This is a backwards-compatibility test, using alltypes_legacy.h. - * It is similar to decode_alltypes, but duplicated in order to allow - * decode_alltypes to test any new features introduced later. - * - * Run e.g. ./encode_legacy | ./decode_legacy - */ - -#include -#include -#include -#include -#include "alltypes_legacy.h" -#include "test_helpers.h" - -#define TEST(x) if (!(x)) { \ - printf("Test " #x " failed.\n"); \ - return false; \ - } - -/* This function is called once from main(), it handles - the decoding and checks the fields. */ -bool check_alltypes(pb_istream_t *stream, int mode) -{ - AllTypes alltypes = {0}; - - if (!pb_decode(stream, AllTypes_fields, &alltypes)) - return false; - - TEST(alltypes.req_int32 == -1001); - TEST(alltypes.req_int64 == -1002); - TEST(alltypes.req_uint32 == 1003); - TEST(alltypes.req_uint64 == 1004); - TEST(alltypes.req_sint32 == -1005); - TEST(alltypes.req_sint64 == -1006); - TEST(alltypes.req_bool == true); - - TEST(alltypes.req_fixed32 == 1008); - TEST(alltypes.req_sfixed32 == -1009); - TEST(alltypes.req_float == 1010.0f); - - TEST(alltypes.req_fixed64 == 1011); - TEST(alltypes.req_sfixed64 == -1012); - TEST(alltypes.req_double == 1013.0f); - - TEST(strcmp(alltypes.req_string, "1014") == 0); - TEST(alltypes.req_bytes.size == 4); - TEST(memcmp(alltypes.req_bytes.bytes, "1015", 4) == 0); - TEST(strcmp(alltypes.req_submsg.substuff1, "1016") == 0); - TEST(alltypes.req_submsg.substuff2 == 1016); - TEST(alltypes.req_submsg.substuff3 == 3); - TEST(alltypes.req_enum == MyEnum_Truth); - - TEST(alltypes.rep_int32_count == 5 && alltypes.rep_int32[4] == -2001 && alltypes.rep_int32[0] == 0); - TEST(alltypes.rep_int64_count == 5 && alltypes.rep_int64[4] == -2002 && alltypes.rep_int64[0] == 0); - TEST(alltypes.rep_uint32_count == 5 && alltypes.rep_uint32[4] == 2003 && alltypes.rep_uint32[0] == 0); - TEST(alltypes.rep_uint64_count == 5 && alltypes.rep_uint64[4] == 2004 && alltypes.rep_uint64[0] == 0); - TEST(alltypes.rep_sint32_count == 5 && alltypes.rep_sint32[4] == -2005 && alltypes.rep_sint32[0] == 0); - TEST(alltypes.rep_sint64_count == 5 && alltypes.rep_sint64[4] == -2006 && alltypes.rep_sint64[0] == 0); - TEST(alltypes.rep_bool_count == 5 && alltypes.rep_bool[4] == true && alltypes.rep_bool[0] == false); - - TEST(alltypes.rep_fixed32_count == 5 && alltypes.rep_fixed32[4] == 2008 && alltypes.rep_fixed32[0] == 0); - TEST(alltypes.rep_sfixed32_count == 5 && alltypes.rep_sfixed32[4] == -2009 && alltypes.rep_sfixed32[0] == 0); - TEST(alltypes.rep_float_count == 5 && alltypes.rep_float[4] == 2010.0f && alltypes.rep_float[0] == 0.0f); - - TEST(alltypes.rep_fixed64_count == 5 && alltypes.rep_fixed64[4] == 2011 && alltypes.rep_fixed64[0] == 0); - TEST(alltypes.rep_sfixed64_count == 5 && alltypes.rep_sfixed64[4] == -2012 && alltypes.rep_sfixed64[0] == 0); - TEST(alltypes.rep_double_count == 5 && alltypes.rep_double[4] == 2013.0 && alltypes.rep_double[0] == 0.0); - - TEST(alltypes.rep_string_count == 5 && strcmp(alltypes.rep_string[4], "2014") == 0 && alltypes.rep_string[0][0] == '\0'); - TEST(alltypes.rep_bytes_count == 5 && alltypes.rep_bytes[4].size == 4 && alltypes.rep_bytes[0].size == 0); - TEST(memcmp(alltypes.rep_bytes[4].bytes, "2015", 4) == 0); - - TEST(alltypes.rep_submsg_count == 5); - TEST(strcmp(alltypes.rep_submsg[4].substuff1, "2016") == 0 && alltypes.rep_submsg[0].substuff1[0] == '\0'); - TEST(alltypes.rep_submsg[4].substuff2 == 2016 && alltypes.rep_submsg[0].substuff2 == 0); - TEST(alltypes.rep_submsg[4].substuff3 == 2016 && alltypes.rep_submsg[0].substuff3 == 3); - - TEST(alltypes.rep_enum_count == 5 && alltypes.rep_enum[4] == MyEnum_Truth && alltypes.rep_enum[0] == MyEnum_Zero); - - if (mode == 0) - { - /* Expect default values */ - TEST(alltypes.has_opt_int32 == false); - TEST(alltypes.opt_int32 == 4041); - TEST(alltypes.has_opt_int64 == false); - TEST(alltypes.opt_int64 == 4042); - TEST(alltypes.has_opt_uint32 == false); - TEST(alltypes.opt_uint32 == 4043); - TEST(alltypes.has_opt_uint64 == false); - TEST(alltypes.opt_uint64 == 4044); - TEST(alltypes.has_opt_sint32 == false); - TEST(alltypes.opt_sint32 == 4045); - TEST(alltypes.has_opt_sint64 == false); - TEST(alltypes.opt_sint64 == 4046); - TEST(alltypes.has_opt_bool == false); - TEST(alltypes.opt_bool == false); - - TEST(alltypes.has_opt_fixed32 == false); - TEST(alltypes.opt_fixed32 == 4048); - TEST(alltypes.has_opt_sfixed32 == false); - TEST(alltypes.opt_sfixed32 == 4049); - TEST(alltypes.has_opt_float == false); - TEST(alltypes.opt_float == 4050.0f); - - TEST(alltypes.has_opt_fixed64 == false); - TEST(alltypes.opt_fixed64 == 4051); - TEST(alltypes.has_opt_sfixed64 == false); - TEST(alltypes.opt_sfixed64 == 4052); - TEST(alltypes.has_opt_double == false); - TEST(alltypes.opt_double == 4053.0); - - TEST(alltypes.has_opt_string == false); - TEST(strcmp(alltypes.opt_string, "4054") == 0); - TEST(alltypes.has_opt_bytes == false); - TEST(alltypes.opt_bytes.size == 4); - TEST(memcmp(alltypes.opt_bytes.bytes, "4055", 4) == 0); - TEST(alltypes.has_opt_submsg == false); - TEST(strcmp(alltypes.opt_submsg.substuff1, "1") == 0); - TEST(alltypes.opt_submsg.substuff2 == 2); - TEST(alltypes.opt_submsg.substuff3 == 3); - TEST(alltypes.has_opt_enum == false); - TEST(alltypes.opt_enum == MyEnum_Second); - } - else - { - /* Expect filled-in values */ - TEST(alltypes.has_opt_int32 == true); - TEST(alltypes.opt_int32 == 3041); - TEST(alltypes.has_opt_int64 == true); - TEST(alltypes.opt_int64 == 3042); - TEST(alltypes.has_opt_uint32 == true); - TEST(alltypes.opt_uint32 == 3043); - TEST(alltypes.has_opt_uint64 == true); - TEST(alltypes.opt_uint64 == 3044); - TEST(alltypes.has_opt_sint32 == true); - TEST(alltypes.opt_sint32 == 3045); - TEST(alltypes.has_opt_sint64 == true); - TEST(alltypes.opt_sint64 == 3046); - TEST(alltypes.has_opt_bool == true); - TEST(alltypes.opt_bool == true); - - TEST(alltypes.has_opt_fixed32 == true); - TEST(alltypes.opt_fixed32 == 3048); - TEST(alltypes.has_opt_sfixed32 == true); - TEST(alltypes.opt_sfixed32 == 3049); - TEST(alltypes.has_opt_float == true); - TEST(alltypes.opt_float == 3050.0f); - - TEST(alltypes.has_opt_fixed64 == true); - TEST(alltypes.opt_fixed64 == 3051); - TEST(alltypes.has_opt_sfixed64 == true); - TEST(alltypes.opt_sfixed64 == 3052); - TEST(alltypes.has_opt_double == true); - TEST(alltypes.opt_double == 3053.0); - - TEST(alltypes.has_opt_string == true); - TEST(strcmp(alltypes.opt_string, "3054") == 0); - TEST(alltypes.has_opt_bytes == true); - TEST(alltypes.opt_bytes.size == 4); - TEST(memcmp(alltypes.opt_bytes.bytes, "3055", 4) == 0); - TEST(alltypes.has_opt_submsg == true); - TEST(strcmp(alltypes.opt_submsg.substuff1, "3056") == 0); - TEST(alltypes.opt_submsg.substuff2 == 3056); - TEST(alltypes.opt_submsg.substuff3 == 3); - TEST(alltypes.has_opt_enum == true); - TEST(alltypes.opt_enum == MyEnum_Truth); - } - - TEST(alltypes.end == 1099); - - return true; -} - -int main(int argc, char **argv) -{ - uint8_t buffer[1024]; - size_t count; - pb_istream_t stream; - - /* Whether to expect the optional values or the default values. */ - int mode = (argc > 1) ? atoi(argv[1]) : 0; - - /* Read the data into buffer */ - SET_BINARY_MODE(stdin); - count = fread(buffer, 1, sizeof(buffer), stdin); - - /* Construct a pb_istream_t for reading from the buffer */ - stream = pb_istream_from_buffer(buffer, count); - - /* Decode and print out the stuff */ - if (!check_alltypes(&stream, mode)) - { - printf("Parsing failed: %s\n", PB_GET_ERROR(&stream)); - return 1; - } else { - return 0; - } -} diff --git a/third_party/nanopb/tests/backwards_compatibility/encode_legacy.c b/third_party/nanopb/tests/backwards_compatibility/encode_legacy.c deleted file mode 100644 index 5c9d41b3d6c..00000000000 --- a/third_party/nanopb/tests/backwards_compatibility/encode_legacy.c +++ /dev/null @@ -1,135 +0,0 @@ -/* Attempts to test all the datatypes supported by ProtoBuf. - * This is a backwards-compatibility test, using alltypes_legacy.h. - * It is similar to encode_alltypes, but duplicated in order to allow - * encode_alltypes to test any new features introduced later. - */ - -#include -#include -#include -#include -#include "alltypes_legacy.h" -#include "test_helpers.h" - -int main(int argc, char **argv) -{ - int mode = (argc > 1) ? atoi(argv[1]) : 0; - - /* Initialize the structure with constants */ - AllTypes alltypes = {0}; - - alltypes.req_int32 = -1001; - alltypes.req_int64 = -1002; - alltypes.req_uint32 = 1003; - alltypes.req_uint64 = 1004; - alltypes.req_sint32 = -1005; - alltypes.req_sint64 = -1006; - alltypes.req_bool = true; - - alltypes.req_fixed32 = 1008; - alltypes.req_sfixed32 = -1009; - alltypes.req_float = 1010.0f; - - alltypes.req_fixed64 = 1011; - alltypes.req_sfixed64 = -1012; - alltypes.req_double = 1013.0; - - strcpy(alltypes.req_string, "1014"); - alltypes.req_bytes.size = 4; - memcpy(alltypes.req_bytes.bytes, "1015", 4); - strcpy(alltypes.req_submsg.substuff1, "1016"); - alltypes.req_submsg.substuff2 = 1016; - alltypes.req_enum = MyEnum_Truth; - - alltypes.rep_int32_count = 5; alltypes.rep_int32[4] = -2001; - alltypes.rep_int64_count = 5; alltypes.rep_int64[4] = -2002; - alltypes.rep_uint32_count = 5; alltypes.rep_uint32[4] = 2003; - alltypes.rep_uint64_count = 5; alltypes.rep_uint64[4] = 2004; - alltypes.rep_sint32_count = 5; alltypes.rep_sint32[4] = -2005; - alltypes.rep_sint64_count = 5; alltypes.rep_sint64[4] = -2006; - alltypes.rep_bool_count = 5; alltypes.rep_bool[4] = true; - - alltypes.rep_fixed32_count = 5; alltypes.rep_fixed32[4] = 2008; - alltypes.rep_sfixed32_count = 5; alltypes.rep_sfixed32[4] = -2009; - alltypes.rep_float_count = 5; alltypes.rep_float[4] = 2010.0f; - - alltypes.rep_fixed64_count = 5; alltypes.rep_fixed64[4] = 2011; - alltypes.rep_sfixed64_count = 5; alltypes.rep_sfixed64[4] = -2012; - alltypes.rep_double_count = 5; alltypes.rep_double[4] = 2013.0; - - alltypes.rep_string_count = 5; strcpy(alltypes.rep_string[4], "2014"); - alltypes.rep_bytes_count = 5; alltypes.rep_bytes[4].size = 4; - memcpy(alltypes.rep_bytes[4].bytes, "2015", 4); - - alltypes.rep_submsg_count = 5; - strcpy(alltypes.rep_submsg[4].substuff1, "2016"); - alltypes.rep_submsg[4].substuff2 = 2016; - alltypes.rep_submsg[4].has_substuff3 = true; - alltypes.rep_submsg[4].substuff3 = 2016; - - alltypes.rep_enum_count = 5; alltypes.rep_enum[4] = MyEnum_Truth; - - if (mode != 0) - { - /* Fill in values for optional fields */ - alltypes.has_opt_int32 = true; - alltypes.opt_int32 = 3041; - alltypes.has_opt_int64 = true; - alltypes.opt_int64 = 3042; - alltypes.has_opt_uint32 = true; - alltypes.opt_uint32 = 3043; - alltypes.has_opt_uint64 = true; - alltypes.opt_uint64 = 3044; - alltypes.has_opt_sint32 = true; - alltypes.opt_sint32 = 3045; - alltypes.has_opt_sint64 = true; - alltypes.opt_sint64 = 3046; - alltypes.has_opt_bool = true; - alltypes.opt_bool = true; - - alltypes.has_opt_fixed32 = true; - alltypes.opt_fixed32 = 3048; - alltypes.has_opt_sfixed32 = true; - alltypes.opt_sfixed32 = 3049; - alltypes.has_opt_float = true; - alltypes.opt_float = 3050.0f; - - alltypes.has_opt_fixed64 = true; - alltypes.opt_fixed64 = 3051; - alltypes.has_opt_sfixed64 = true; - alltypes.opt_sfixed64 = 3052; - alltypes.has_opt_double = true; - alltypes.opt_double = 3053.0; - - alltypes.has_opt_string = true; - strcpy(alltypes.opt_string, "3054"); - alltypes.has_opt_bytes = true; - alltypes.opt_bytes.size = 4; - memcpy(alltypes.opt_bytes.bytes, "3055", 4); - alltypes.has_opt_submsg = true; - strcpy(alltypes.opt_submsg.substuff1, "3056"); - alltypes.opt_submsg.substuff2 = 3056; - alltypes.has_opt_enum = true; - alltypes.opt_enum = MyEnum_Truth; - } - - alltypes.end = 1099; - - { - uint8_t buffer[1024]; - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - /* Now encode it and check if we succeeded. */ - if (pb_encode(&stream, AllTypes_fields, &alltypes)) - { - SET_BINARY_MODE(stdout); - fwrite(buffer, 1, stream.bytes_written, stdout); - return 0; /* Success */ - } - else - { - fprintf(stderr, "Encoding failed!\n"); - return 1; /* Failure */ - } - } -} diff --git a/third_party/nanopb/tests/basic_buffer/SConscript b/third_party/nanopb/tests/basic_buffer/SConscript deleted file mode 100644 index acaf5ffa27e..00000000000 --- a/third_party/nanopb/tests/basic_buffer/SConscript +++ /dev/null @@ -1,12 +0,0 @@ -# Build and run a basic round-trip test using memory buffer encoding. - -Import("env") - -enc = env.Program(["encode_buffer.c", "$COMMON/person.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"]) -dec = env.Program(["decode_buffer.c", "$COMMON/person.pb.c", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"]) - -env.RunTest(enc) -env.RunTest([dec, "encode_buffer.output"]) -env.Decode(["encode_buffer.output", "$COMMON/person.proto"], MESSAGE = "Person") -env.Compare(["decode_buffer.output", "encode_buffer.decoded"]) - diff --git a/third_party/nanopb/tests/basic_buffer/decode_buffer.c b/third_party/nanopb/tests/basic_buffer/decode_buffer.c deleted file mode 100644 index 291d164ca3e..00000000000 --- a/third_party/nanopb/tests/basic_buffer/decode_buffer.c +++ /dev/null @@ -1,88 +0,0 @@ -/* A very simple decoding test case, using person.proto. - * Produces output compatible with protoc --decode. - * Reads the encoded data from stdin and prints the values - * to stdout as text. - * - * Run e.g. ./test_encode1 | ./test_decode1 - */ - -#include -#include -#include "person.pb.h" -#include "test_helpers.h" - -/* This function is called once from main(), it handles - the decoding and printing. */ -bool print_person(pb_istream_t *stream) -{ - int i; - Person person = Person_init_zero; - - if (!pb_decode(stream, Person_fields, &person)) - return false; - - /* Now the decoding is done, rest is just to print stuff out. */ - - printf("name: \"%s\"\n", person.name); - printf("id: %ld\n", (long)person.id); - - if (person.has_email) - printf("email: \"%s\"\n", person.email); - - for (i = 0; i < person.phone_count; i++) - { - Person_PhoneNumber *phone = &person.phone[i]; - printf("phone {\n"); - printf(" number: \"%s\"\n", phone->number); - - if (phone->has_type) - { - switch (phone->type) - { - case Person_PhoneType_WORK: - printf(" type: WORK\n"); - break; - - case Person_PhoneType_HOME: - printf(" type: HOME\n"); - break; - - case Person_PhoneType_MOBILE: - printf(" type: MOBILE\n"); - break; - } - } - printf("}\n"); - } - - return true; -} - -int main() -{ - uint8_t buffer[Person_size]; - pb_istream_t stream; - size_t count; - - /* Read the data into buffer */ - SET_BINARY_MODE(stdin); - count = fread(buffer, 1, sizeof(buffer), stdin); - - if (!feof(stdin)) - { - printf("Message does not fit in buffer\n"); - return 1; - } - - /* Construct a pb_istream_t for reading from the buffer */ - stream = pb_istream_from_buffer(buffer, count); - - /* Decode and print out the stuff */ - if (!print_person(&stream)) - { - printf("Parsing failed: %s\n", PB_GET_ERROR(&stream)); - return 1; - } else { - return 0; - } -} diff --git a/third_party/nanopb/tests/basic_buffer/encode_buffer.c b/third_party/nanopb/tests/basic_buffer/encode_buffer.c deleted file mode 100644 index c412c14e7ae..00000000000 --- a/third_party/nanopb/tests/basic_buffer/encode_buffer.c +++ /dev/null @@ -1,38 +0,0 @@ -/* A very simple encoding test case using person.proto. - * Just puts constant data in the fields and encodes into - * buffer, which is then written to stdout. - */ - -#include -#include -#include "person.pb.h" -#include "test_helpers.h" - -int main() -{ - uint8_t buffer[Person_size]; - pb_ostream_t stream; - - /* Initialize the structure with constants */ - Person person = {"Test Person 99", 99, true, "test@person.com", - 3, {{"555-12345678", true, Person_PhoneType_MOBILE}, - {"99-2342", false, 0}, - {"1234-5678", true, Person_PhoneType_WORK}, - }}; - - stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - /* Now encode it and check if we succeeded. */ - if (pb_encode(&stream, Person_fields, &person)) - { - /* Write the result data to stdout */ - SET_BINARY_MODE(stdout); - fwrite(buffer, 1, stream.bytes_written, stdout); - return 0; /* Success */ - } - else - { - fprintf(stderr, "Encoding failed: %s\n", PB_GET_ERROR(&stream)); - return 1; /* Failure */ - } -} diff --git a/third_party/nanopb/tests/basic_stream/SConscript b/third_party/nanopb/tests/basic_stream/SConscript deleted file mode 100644 index 7d6685623fe..00000000000 --- a/third_party/nanopb/tests/basic_stream/SConscript +++ /dev/null @@ -1,12 +0,0 @@ -# Build and run a basic round-trip test using direct stream encoding. - -Import("env") - -enc = env.Program(["encode_stream.c", "$COMMON/person.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"]) -dec = env.Program(["decode_stream.c", "$COMMON/person.pb.c", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"]) - -env.RunTest(enc) -env.RunTest([dec, "encode_stream.output"]) -env.Decode(["encode_stream.output", "$COMMON/person.proto"], MESSAGE = "Person") -env.Compare(["decode_stream.output", "encode_stream.decoded"]) - diff --git a/third_party/nanopb/tests/basic_stream/decode_stream.c b/third_party/nanopb/tests/basic_stream/decode_stream.c deleted file mode 100644 index 798dcc506f3..00000000000 --- a/third_party/nanopb/tests/basic_stream/decode_stream.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Same as test_decode1 but reads from stdin directly. - */ - -#include -#include -#include "person.pb.h" -#include "test_helpers.h" - -/* This function is called once from main(), it handles - the decoding and printing. - Ugly copy-paste from test_decode1.c. */ -bool print_person(pb_istream_t *stream) -{ - int i; - Person person = Person_init_zero; - - if (!pb_decode(stream, Person_fields, &person)) - return false; - - /* Now the decoding is done, rest is just to print stuff out. */ - - printf("name: \"%s\"\n", person.name); - printf("id: %ld\n", (long)person.id); - - if (person.has_email) - printf("email: \"%s\"\n", person.email); - - for (i = 0; i < person.phone_count; i++) - { - Person_PhoneNumber *phone = &person.phone[i]; - printf("phone {\n"); - printf(" number: \"%s\"\n", phone->number); - - if (phone->has_type) - { - switch (phone->type) - { - case Person_PhoneType_WORK: - printf(" type: WORK\n"); - break; - - case Person_PhoneType_HOME: - printf(" type: HOME\n"); - break; - - case Person_PhoneType_MOBILE: - printf(" type: MOBILE\n"); - break; - } - } - printf("}\n"); - } - - return true; -} - -/* This binds the pb_istream_t to stdin */ -bool callback(pb_istream_t *stream, uint8_t *buf, size_t count) -{ - FILE *file = (FILE*)stream->state; - bool status; - - status = (fread(buf, 1, count, file) == count); - - if (feof(file)) - stream->bytes_left = 0; - - return status; -} - -int main() -{ - pb_istream_t stream = {&callback, NULL, SIZE_MAX}; - stream.state = stdin; - SET_BINARY_MODE(stdin); - - if (!print_person(&stream)) - { - printf("Parsing failed: %s\n", PB_GET_ERROR(&stream)); - return 1; - } else { - return 0; - } -} diff --git a/third_party/nanopb/tests/basic_stream/encode_stream.c b/third_party/nanopb/tests/basic_stream/encode_stream.c deleted file mode 100644 index 7f571c4127d..00000000000 --- a/third_party/nanopb/tests/basic_stream/encode_stream.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Same as test_encode1.c, except writes directly to stdout. - */ - -#include -#include -#include "person.pb.h" -#include "test_helpers.h" - -/* This binds the pb_ostream_t into the stdout stream */ -bool streamcallback(pb_ostream_t *stream, const uint8_t *buf, size_t count) -{ - FILE *file = (FILE*) stream->state; - return fwrite(buf, 1, count, file) == count; -} - -int main() -{ - /* Initialize the structure with constants */ - Person person = {"Test Person 99", 99, true, "test@person.com", - 3, {{"555-12345678", true, Person_PhoneType_MOBILE}, - {"99-2342", false, 0}, - {"1234-5678", true, Person_PhoneType_WORK}, - }}; - - /* Prepare the stream, output goes directly to stdout */ - pb_ostream_t stream = {&streamcallback, NULL, SIZE_MAX, 0}; - stream.state = stdout; - SET_BINARY_MODE(stdout); - - /* Now encode it and check if we succeeded. */ - if (pb_encode(&stream, Person_fields, &person)) - { - return 0; /* Success */ - } - else - { - fprintf(stderr, "Encoding failed: %s\n", PB_GET_ERROR(&stream)); - return 1; /* Failure */ - } -} diff --git a/third_party/nanopb/tests/buffer_only/SConscript b/third_party/nanopb/tests/buffer_only/SConscript deleted file mode 100644 index 55b747b000d..00000000000 --- a/third_party/nanopb/tests/buffer_only/SConscript +++ /dev/null @@ -1,28 +0,0 @@ -# Run the alltypes test case, but compile with PB_BUFFER_ONLY=1 - -Import("env") - -# Take copy of the files for custom build. -c = Copy("$TARGET", "$SOURCE") -env.Command("alltypes.pb.h", "$BUILD/alltypes/alltypes.pb.h", c) -env.Command("alltypes.pb.c", "$BUILD/alltypes/alltypes.pb.c", c) -env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c) -env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c) - -# Define the compilation options -opts = env.Clone() -opts.Append(CPPDEFINES = {'PB_BUFFER_ONLY': 1}) - -# Build new version of core -strict = opts.Clone() -strict.Append(CFLAGS = strict['CORECFLAGS']) -strict.Object("pb_decode_bufonly.o", "$NANOPB/pb_decode.c") -strict.Object("pb_encode_bufonly.o", "$NANOPB/pb_encode.c") -strict.Object("pb_common_bufonly.o", "$NANOPB/pb_common.c") - -# Now build and run the test normally. -enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_bufonly.o", "pb_common_bufonly.o"]) -dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_bufonly.o", "pb_common_bufonly.o"]) - -env.RunTest(enc) -env.RunTest([dec, "encode_alltypes.output"]) diff --git a/third_party/nanopb/tests/callbacks/SConscript b/third_party/nanopb/tests/callbacks/SConscript deleted file mode 100644 index 445214397d6..00000000000 --- a/third_party/nanopb/tests/callbacks/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -# Test the functionality of the callback fields. - -Import("env") - -env.NanopbProto("callbacks") -enc = env.Program(["encode_callbacks.c", "callbacks.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"]) -dec = env.Program(["decode_callbacks.c", "callbacks.pb.c", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"]) - -env.RunTest(enc) -env.RunTest([dec, "encode_callbacks.output"]) - -env.Decode(["encode_callbacks.output", "callbacks.proto"], MESSAGE = "TestMessage") -env.Compare(["decode_callbacks.output", "encode_callbacks.decoded"]) - diff --git a/third_party/nanopb/tests/callbacks/callbacks.proto b/third_party/nanopb/tests/callbacks/callbacks.proto deleted file mode 100644 index 96ac744d53d..00000000000 --- a/third_party/nanopb/tests/callbacks/callbacks.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto2"; - -message SubMessage { - optional string stringvalue = 1; - repeated int32 int32value = 2; - repeated fixed32 fixed32value = 3; - repeated fixed64 fixed64value = 4; -} - -message TestMessage { - optional string stringvalue = 1; - repeated int32 int32value = 2; - repeated fixed32 fixed32value = 3; - repeated fixed64 fixed64value = 4; - optional SubMessage submsg = 5; - repeated string repeatedstring = 6; -} - diff --git a/third_party/nanopb/tests/callbacks/decode_callbacks.c b/third_party/nanopb/tests/callbacks/decode_callbacks.c deleted file mode 100644 index 45724d0be01..00000000000 --- a/third_party/nanopb/tests/callbacks/decode_callbacks.c +++ /dev/null @@ -1,97 +0,0 @@ -/* Decoding testcase for callback fields. - * Run e.g. ./test_encode_callbacks | ./test_decode_callbacks - */ - -#include -#include -#include "callbacks.pb.h" -#include "test_helpers.h" - -bool print_string(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - uint8_t buffer[1024] = {0}; - - /* We could read block-by-block to avoid the large buffer... */ - if (stream->bytes_left > sizeof(buffer) - 1) - return false; - - if (!pb_read(stream, buffer, stream->bytes_left)) - return false; - - /* Print the string, in format comparable with protoc --decode. - * Format comes from the arg defined in main(). - */ - printf((char*)*arg, buffer); - return true; -} - -bool print_int32(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - uint64_t value; - if (!pb_decode_varint(stream, &value)) - return false; - - printf((char*)*arg, (long)value); - return true; -} - -bool print_fixed32(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - uint32_t value; - if (!pb_decode_fixed32(stream, &value)) - return false; - - printf((char*)*arg, (long)value); - return true; -} - -bool print_fixed64(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - uint64_t value; - if (!pb_decode_fixed64(stream, &value)) - return false; - - printf((char*)*arg, (long)value); - return true; -} - -int main() -{ - uint8_t buffer[1024]; - size_t length; - pb_istream_t stream; - /* Note: empty initializer list initializes the struct with all-0. - * This is recommended so that unused callbacks are set to NULL instead - * of crashing at runtime. - */ - TestMessage testmessage = {{{NULL}}}; - - SET_BINARY_MODE(stdin); - length = fread(buffer, 1, 1024, stdin); - stream = pb_istream_from_buffer(buffer, length); - - testmessage.submsg.stringvalue.funcs.decode = &print_string; - testmessage.submsg.stringvalue.arg = "submsg {\n stringvalue: \"%s\"\n"; - testmessage.submsg.int32value.funcs.decode = &print_int32; - testmessage.submsg.int32value.arg = " int32value: %ld\n"; - testmessage.submsg.fixed32value.funcs.decode = &print_fixed32; - testmessage.submsg.fixed32value.arg = " fixed32value: %ld\n"; - testmessage.submsg.fixed64value.funcs.decode = &print_fixed64; - testmessage.submsg.fixed64value.arg = " fixed64value: %ld\n}\n"; - - testmessage.stringvalue.funcs.decode = &print_string; - testmessage.stringvalue.arg = "stringvalue: \"%s\"\n"; - testmessage.int32value.funcs.decode = &print_int32; - testmessage.int32value.arg = "int32value: %ld\n"; - testmessage.fixed32value.funcs.decode = &print_fixed32; - testmessage.fixed32value.arg = "fixed32value: %ld\n"; - testmessage.fixed64value.funcs.decode = &print_fixed64; - testmessage.fixed64value.arg = "fixed64value: %ld\n"; - testmessage.repeatedstring.funcs.decode = &print_string; - testmessage.repeatedstring.arg = "repeatedstring: \"%s\"\n"; - - if (!pb_decode(&stream, TestMessage_fields, &testmessage)) - return 1; - - return 0; -} diff --git a/third_party/nanopb/tests/callbacks/encode_callbacks.c b/third_party/nanopb/tests/callbacks/encode_callbacks.c deleted file mode 100644 index 6cb67b1e64d..00000000000 --- a/third_party/nanopb/tests/callbacks/encode_callbacks.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Encoding testcase for callback fields */ - -#include -#include -#include -#include "callbacks.pb.h" -#include "test_helpers.h" - -bool encode_string(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - char *str = "Hello world!"; - - if (!pb_encode_tag_for_field(stream, field)) - return false; - - return pb_encode_string(stream, (uint8_t*)str, strlen(str)); -} - -bool encode_int32(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - if (!pb_encode_tag_for_field(stream, field)) - return false; - - return pb_encode_varint(stream, 42); -} - -bool encode_fixed32(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - uint32_t value = 42; - - if (!pb_encode_tag_for_field(stream, field)) - return false; - - return pb_encode_fixed32(stream, &value); -} - -bool encode_fixed64(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - uint64_t value = 42; - - if (!pb_encode_tag_for_field(stream, field)) - return false; - - return pb_encode_fixed64(stream, &value); -} - -bool encode_repeatedstring(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - char *str[4] = {"Hello world!", "", "Test", "Test2"}; - int i; - - for (i = 0; i < 4; i++) - { - if (!pb_encode_tag_for_field(stream, field)) - return false; - - if (!pb_encode_string(stream, (uint8_t*)str[i], strlen(str[i]))) - return false; - } - return true; -} - -int main() -{ - uint8_t buffer[1024]; - pb_ostream_t stream; - TestMessage testmessage = {{{NULL}}}; - - stream = pb_ostream_from_buffer(buffer, 1024); - - testmessage.stringvalue.funcs.encode = &encode_string; - testmessage.int32value.funcs.encode = &encode_int32; - testmessage.fixed32value.funcs.encode = &encode_fixed32; - testmessage.fixed64value.funcs.encode = &encode_fixed64; - - testmessage.has_submsg = true; - testmessage.submsg.stringvalue.funcs.encode = &encode_string; - testmessage.submsg.int32value.funcs.encode = &encode_int32; - testmessage.submsg.fixed32value.funcs.encode = &encode_fixed32; - testmessage.submsg.fixed64value.funcs.encode = &encode_fixed64; - - testmessage.repeatedstring.funcs.encode = &encode_repeatedstring; - - if (!pb_encode(&stream, TestMessage_fields, &testmessage)) - return 1; - - SET_BINARY_MODE(stdout); - if (fwrite(buffer, stream.bytes_written, 1, stdout) != 1) - return 2; - - return 0; -} diff --git a/third_party/nanopb/tests/common/SConscript b/third_party/nanopb/tests/common/SConscript deleted file mode 100644 index 05e2f852e8d..00000000000 --- a/third_party/nanopb/tests/common/SConscript +++ /dev/null @@ -1,48 +0,0 @@ -# Build the common files needed by multiple test cases - -Import('env') - -# Protocol definitions for the encode/decode_unittests -env.NanopbProto("unittestproto") - -# Protocol definitions for basic_buffer/stream tests -env.NanopbProto("person") - -#-------------------------------------------- -# Binaries of the pb_decode.c and pb_encode.c -# These are built using more strict warning flags. -strict = env.Clone() -strict.Append(CFLAGS = strict['CORECFLAGS']) -strict.Object("pb_decode.o", "$NANOPB/pb_decode.c") -strict.Object("pb_encode.o", "$NANOPB/pb_encode.c") -strict.Object("pb_common.o", "$NANOPB/pb_common.c") - -#----------------------------------------------- -# Binaries of pb_decode etc. with malloc support -# Uses malloc_wrappers.c to count allocations. -malloc_env = env.Clone() -malloc_env.Append(CPPDEFINES = {'PB_ENABLE_MALLOC': 1, - 'PB_SYSTEM_HEADER': '\\"malloc_wrappers_syshdr.h\\"'}) -malloc_env.Append(CPPPATH = ["$COMMON"]) - -if 'SYSHDR' in malloc_env: - malloc_env.Append(CPPDEFINES = {'PB_OLD_SYSHDR': malloc_env['SYSHDR']}) - -# Disable libmudflap, because it will confuse valgrind -# and other memory leak detection tools. -if '-fmudflap' in env["CCFLAGS"]: - malloc_env["CCFLAGS"].remove("-fmudflap") - malloc_env["LINKFLAGS"].remove("-fmudflap") - malloc_env["LIBS"].remove("mudflap") - -malloc_strict = malloc_env.Clone() -malloc_strict.Append(CFLAGS = malloc_strict['CORECFLAGS']) -malloc_strict.Object("pb_decode_with_malloc.o", "$NANOPB/pb_decode.c") -malloc_strict.Object("pb_encode_with_malloc.o", "$NANOPB/pb_encode.c") -malloc_strict.Object("pb_common_with_malloc.o", "$NANOPB/pb_common.c") - -malloc_env.Object("malloc_wrappers.o", "malloc_wrappers.c") -malloc_env.Depends("$NANOPB/pb.h", ["malloc_wrappers_syshdr.h", "malloc_wrappers.h"]) - -Export("malloc_env") - diff --git a/third_party/nanopb/tests/common/malloc_wrappers.c b/third_party/nanopb/tests/common/malloc_wrappers.c deleted file mode 100644 index ad69f1cef6e..00000000000 --- a/third_party/nanopb/tests/common/malloc_wrappers.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "malloc_wrappers.h" -#include -#include -#include - -static size_t alloc_count = 0; - -/* Allocate memory and place check values before and after. */ -void* malloc_with_check(size_t size) -{ - size_t size32 = (size + 3) / 4 + 3; - uint32_t *buf = malloc(size32 * sizeof(uint32_t)); - buf[0] = size32; - buf[1] = 0xDEADBEEF; - buf[size32 - 1] = 0xBADBAD; - return buf + 2; -} - -/* Free memory allocated with malloc_with_check() and do the checks. */ -void free_with_check(void *mem) -{ - uint32_t *buf = (uint32_t*)mem - 2; - assert(buf[1] == 0xDEADBEEF); - assert(buf[buf[0] - 1] == 0xBADBAD); - free(buf); -} - -/* Track memory usage */ -void* counting_realloc(void *ptr, size_t size) -{ - /* Don't allocate crazy amounts of RAM when fuzzing */ - if (size > 1000000) - return NULL; - - if (!ptr && size) - alloc_count++; - - return realloc(ptr, size); -} - -void counting_free(void *ptr) -{ - if (ptr) - { - assert(alloc_count > 0); - alloc_count--; - free(ptr); - } -} - -size_t get_alloc_count() -{ - return alloc_count; -} diff --git a/third_party/nanopb/tests/common/malloc_wrappers.h b/third_party/nanopb/tests/common/malloc_wrappers.h deleted file mode 100644 index 7eec7952711..00000000000 --- a/third_party/nanopb/tests/common/malloc_wrappers.h +++ /dev/null @@ -1,7 +0,0 @@ -#include - -void* malloc_with_check(size_t size); -void free_with_check(void *mem); -void* counting_realloc(void *ptr, size_t size); -void counting_free(void *ptr); -size_t get_alloc_count(); diff --git a/third_party/nanopb/tests/common/malloc_wrappers_syshdr.h b/third_party/nanopb/tests/common/malloc_wrappers_syshdr.h deleted file mode 100644 index d295d9ed0b3..00000000000 --- a/third_party/nanopb/tests/common/malloc_wrappers_syshdr.h +++ /dev/null @@ -1,15 +0,0 @@ -/* This is just a wrapper in order to get our own malloc wrappers into nanopb core. */ - -#define pb_realloc(ptr,size) counting_realloc(ptr,size) -#define pb_free(ptr) counting_free(ptr) - -#ifdef PB_OLD_SYSHDR -#include PB_OLD_SYSHDR -#else -#include -#include -#include -#include -#endif - -#include diff --git a/third_party/nanopb/tests/common/person.proto b/third_party/nanopb/tests/common/person.proto deleted file mode 100644 index becefdf3f2e..00000000000 --- a/third_party/nanopb/tests/common/person.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto2"; - -import "nanopb.proto"; - -message Person { - required string name = 1 [(nanopb).max_size = 40]; - required int32 id = 2; - optional string email = 3 [(nanopb).max_size = 40]; - - enum PhoneType { - MOBILE = 0; - HOME = 1; - WORK = 2; - } - - message PhoneNumber { - required string number = 1 [(nanopb).max_size = 40]; - optional PhoneType type = 2 [default = HOME]; - } - - repeated PhoneNumber phone = 4 [(nanopb).max_count = 5]; -} diff --git a/third_party/nanopb/tests/common/test_helpers.h b/third_party/nanopb/tests/common/test_helpers.h deleted file mode 100644 index f77760a521b..00000000000 --- a/third_party/nanopb/tests/common/test_helpers.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Compatibility helpers for the test programs. */ - -#ifndef _TEST_HELPERS_H_ -#define _TEST_HELPERS_H_ - -#ifdef _WIN32 -#include -#include -#define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) - -#else -#define SET_BINARY_MODE(file) - -#endif - - -#endif diff --git a/third_party/nanopb/tests/common/unittestproto.proto b/third_party/nanopb/tests/common/unittestproto.proto deleted file mode 100644 index 23b5b97f877..00000000000 --- a/third_party/nanopb/tests/common/unittestproto.proto +++ /dev/null @@ -1,43 +0,0 @@ -syntax = "proto2"; - -import 'nanopb.proto'; - -message IntegerArray { - repeated int32 data = 1 [(nanopb).max_count = 10]; -} - -message FloatArray { - repeated float data = 1 [(nanopb).max_count = 10]; -} - -message StringMessage { - required string data = 1 [(nanopb).max_size = 10]; -} - -message BytesMessage { - required bytes data = 1 [(nanopb).max_size = 16]; -} - -message CallbackArray { - // We cheat a bit and use this message for testing other types, too. - // Nanopb does not care about the actual defined data type for callback - // fields. - repeated int32 data = 1; -} - -message IntegerContainer { - required IntegerArray submsg = 1; -} - -message CallbackContainer { - required CallbackArray submsg = 1; -} - -message CallbackContainerContainer { - required CallbackContainer submsg = 1; -} - -message StringPointerContainer { - repeated string rep_str = 1 [(nanopb).type = FT_POINTER]; -} - diff --git a/third_party/nanopb/tests/common/unittests.h b/third_party/nanopb/tests/common/unittests.h deleted file mode 100644 index c2b470aded7..00000000000 --- a/third_party/nanopb/tests/common/unittests.h +++ /dev/null @@ -1,14 +0,0 @@ -#include - -#define COMMENT(x) printf("\n----" x "----\n"); -#define STR(x) #x -#define STR2(x) STR(x) -#define TEST(x) \ - if (!(x)) { \ - fprintf(stderr, "\033[31;1mFAILED:\033[22;39m " __FILE__ ":" STR2(__LINE__) " " #x "\n"); \ - status = 1; \ - } else { \ - printf("\033[32;1mOK:\033[22;39m " #x "\n"); \ - } - - diff --git a/third_party/nanopb/tests/cxx_main_program/SConscript b/third_party/nanopb/tests/cxx_main_program/SConscript deleted file mode 100644 index edb88127190..00000000000 --- a/third_party/nanopb/tests/cxx_main_program/SConscript +++ /dev/null @@ -1,25 +0,0 @@ -# Run the alltypes test case, but compile it as C++ instead. -# In fact, compile the entire nanopb using C++ compiler. - -Import("env") - -# This is needed to get INT32_MIN etc. macros defined -env = env.Clone() -env.Append(CPPDEFINES = ['__STDC_LIMIT_MACROS']) - -# Copy the files to .cxx extension in order to force C++ build. -c = Copy("$TARGET", "$SOURCE") -env.Command("pb_encode.cxx", "#../pb_encode.c", c) -env.Command("pb_decode.cxx", "#../pb_decode.c", c) -env.Command("pb_common.cxx", "#../pb_common.c", c) -env.Command("alltypes.pb.h", "$BUILD/alltypes/alltypes.pb.h", c) -env.Command("alltypes.pb.cxx", "$BUILD/alltypes/alltypes.pb.c", c) -env.Command("encode_alltypes.cxx", "$BUILD/alltypes/encode_alltypes.c", c) -env.Command("decode_alltypes.cxx", "$BUILD/alltypes/decode_alltypes.c", c) - -# Now build and run the test normally. -enc = env.Program(["encode_alltypes.cxx", "alltypes.pb.cxx", "pb_encode.cxx", "pb_common.cxx"]) -dec = env.Program(["decode_alltypes.cxx", "alltypes.pb.cxx", "pb_decode.cxx", "pb_common.cxx"]) - -env.RunTest(enc) -env.RunTest([dec, "encode_alltypes.output"]) diff --git a/third_party/nanopb/tests/cyclic_messages/SConscript b/third_party/nanopb/tests/cyclic_messages/SConscript deleted file mode 100644 index c782001c95d..00000000000 --- a/third_party/nanopb/tests/cyclic_messages/SConscript +++ /dev/null @@ -1,11 +0,0 @@ -Import("env") - -# Encode cyclic messages with callback fields - -c = Copy("$TARGET", "$SOURCE") -env.Command("cyclic_callback.proto", "cyclic.proto", c) -env.NanopbProto(["cyclic_callback", "cyclic_callback.options"]) - -enc_callback = env.Program(["encode_cyclic_callback.c", "cyclic_callback.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"]) - - diff --git a/third_party/nanopb/tests/cyclic_messages/cyclic.proto b/third_party/nanopb/tests/cyclic_messages/cyclic.proto deleted file mode 100644 index 8cab0b142e3..00000000000 --- a/third_party/nanopb/tests/cyclic_messages/cyclic.proto +++ /dev/null @@ -1,27 +0,0 @@ -// Test structures with cyclic references. -// These can only be handled in pointer/callback mode, -// see associated .options files. - -syntax = "proto2"; - -message TreeNode -{ - optional int32 leaf = 1; - optional TreeNode left = 2; - optional TreeNode right = 3; -} - -message Dictionary -{ - repeated KeyValuePair dictItem = 1; -} - -message KeyValuePair -{ - required string key = 1; - optional string stringValue = 2; - optional int32 intValue = 3; - optional Dictionary dictValue = 4; - optional TreeNode treeValue = 5; -} - diff --git a/third_party/nanopb/tests/cyclic_messages/cyclic_callback.options b/third_party/nanopb/tests/cyclic_messages/cyclic_callback.options deleted file mode 100644 index fd4e1e1c46e..00000000000 --- a/third_party/nanopb/tests/cyclic_messages/cyclic_callback.options +++ /dev/null @@ -1,7 +0,0 @@ -TreeNode.left type:FT_CALLBACK -TreeNode.right type:FT_CALLBACK - -Dictionary.data type:FT_CALLBACK -KeyValuePair.key max_size:8 -KeyValuePair.stringValue max_size:8 -KeyValuePair.treeValue type:FT_CALLBACK diff --git a/third_party/nanopb/tests/cyclic_messages/encode_cyclic_callback.c b/third_party/nanopb/tests/cyclic_messages/encode_cyclic_callback.c deleted file mode 100644 index 7f67e70c632..00000000000 --- a/third_party/nanopb/tests/cyclic_messages/encode_cyclic_callback.c +++ /dev/null @@ -1,148 +0,0 @@ -/* This program parses an input string in a format a bit like JSON: - * {'foobar': 1234, 'xyz': 'abc', 'tree': [[[1, 2], 3], [4, 5]]} - * and encodes it as protobuf - * - * Note: The string parsing here is not in any way intended to be robust - * nor safe against buffer overflows. It is just for this test. - */ - -#include -#include -#include -#include -#include "cyclic_callback.pb.h" - -static char *find_end_of_item(char *p) -{ - int depth = 0; - do { - if (*p == '[' || *p == '{') depth++; - if (*p == ']' || *p == '}') depth--; - p++; - } while (depth > 0 || (*p != ',' && *p != '}')); - - if (*p == '}') - return p; /* End of parent dict */ - - p++; - while (*p == ' ') p++; - return p; -} - -/* Parse a tree in format [[1 2] 3] and encode it directly to protobuf */ -static bool encode_tree(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - TreeNode tree = TreeNode_init_zero; - char *p = (char*)*arg; - - if (*p == '[') - { - /* This is a tree branch */ - p++; - tree.left.funcs.encode = encode_tree; - tree.left.arg = p; - - p = find_end_of_item(p); - tree.right.funcs.encode = encode_tree; - tree.right.arg = p; - } - else - { - /* This is a leaf node */ - tree.has_leaf = true; - tree.leaf = atoi(p); - } - - return pb_encode_tag_for_field(stream, field) && - pb_encode_submessage(stream, TreeNode_fields, &tree); -} - -/* Parse a dictionary in format {'name': value} and encode it directly to protobuf */ -static bool encode_dictionary(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - int textlen; - char *p = (char*)*arg; - if (*p == '{') p++; - while (*p != '}') - { - KeyValuePair pair = KeyValuePair_init_zero; - - if (*p != '\'') - PB_RETURN_ERROR(stream, "invalid key, missing quote"); - - p++; /* Starting quote of key */ - textlen = strchr(p, '\'') - p; - strncpy(pair.key, p, textlen); - pair.key[textlen] = 0; - p += textlen + 2; - - while (*p == ' ') p++; - - if (*p == '[') - { - /* Value is a tree */ - pair.treeValue.funcs.encode = encode_tree; - pair.treeValue.arg = p; - } - else if (*p == '\'') - { - /* Value is a string */ - pair.has_stringValue = true; - p++; - textlen = strchr(p, '\'') - p; - strncpy(pair.stringValue, p, textlen); - pair.stringValue[textlen] = 0; - } - else if (*p == '{') - { - /* Value is a dictionary */ - pair.has_dictValue = true; - pair.dictValue.dictItem.funcs.encode = encode_dictionary; - pair.dictValue.dictItem.arg = p; - } - else - { - /* Value is integer */ - pair.has_intValue = true; - pair.intValue = atoi(p); - } - - p = find_end_of_item(p); - - if (!pb_encode_tag_for_field(stream, field)) - return false; - - if (!pb_encode_submessage(stream, KeyValuePair_fields, &pair)) - return false; - } - - return true; -} - - -int main(int argc, char *argv[]) -{ - uint8_t buffer[256]; - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - Dictionary dict = Dictionary_init_zero; - - if (argc <= 1) - { - fprintf(stderr, "Usage: %s \"{'foobar': 1234, ...}\"\n", argv[0]); - return 1; - } - - dict.dictItem.funcs.encode = encode_dictionary; - dict.dictItem.arg = argv[1]; - - if (!pb_encode(&stream, Dictionary_fields, &dict)) - { - fprintf(stderr, "Encoding error: %s\n", PB_GET_ERROR(&stream)); - return 1; - } - - fwrite(buffer, 1, stream.bytes_written, stdout); - return 0; -} - - diff --git a/third_party/nanopb/tests/decode_unittests/SConscript b/third_party/nanopb/tests/decode_unittests/SConscript deleted file mode 100644 index 369b9dc71fc..00000000000 --- a/third_party/nanopb/tests/decode_unittests/SConscript +++ /dev/null @@ -1,4 +0,0 @@ -Import('env') -p = env.Program(["decode_unittests.c", "$COMMON/unittestproto.pb.c"]) -env.RunTest(p) - diff --git a/third_party/nanopb/tests/decode_unittests/decode_unittests.c b/third_party/nanopb/tests/decode_unittests/decode_unittests.c deleted file mode 100644 index 47f0fbdbd8a..00000000000 --- a/third_party/nanopb/tests/decode_unittests/decode_unittests.c +++ /dev/null @@ -1,344 +0,0 @@ -/* This includes the whole .c file to get access to static functions. */ -#define PB_ENABLE_MALLOC -#include "pb_common.c" -#include "pb_decode.c" - -#include -#include -#include "unittests.h" -#include "unittestproto.pb.h" - -#define S(x) pb_istream_from_buffer((uint8_t*)x, sizeof(x) - 1) - -bool stream_callback(pb_istream_t *stream, uint8_t *buf, size_t count) -{ - if (stream->state != NULL) - return false; /* Simulate error */ - - if (buf != NULL) - memset(buf, 'x', count); - return true; -} - -/* Verifies that the stream passed to callback matches the byte array pointed to by arg. */ -bool callback_check(pb_istream_t *stream, const pb_field_t *field, void **arg) -{ - int i; - uint8_t byte; - pb_bytes_array_t *ref = (pb_bytes_array_t*) *arg; - - for (i = 0; i < ref->size; i++) - { - if (!pb_read(stream, &byte, 1)) - return false; - - if (byte != ref->bytes[i]) - return false; - } - - return true; -} - -int main() -{ - int status = 0; - - { - uint8_t buffer1[] = "foobartest1234"; - uint8_t buffer2[sizeof(buffer1)]; - pb_istream_t stream = pb_istream_from_buffer(buffer1, sizeof(buffer1)); - - COMMENT("Test pb_read and pb_istream_t"); - TEST(pb_read(&stream, buffer2, 6)) - TEST(memcmp(buffer2, "foobar", 6) == 0) - TEST(stream.bytes_left == sizeof(buffer1) - 6) - TEST(pb_read(&stream, buffer2 + 6, stream.bytes_left)) - TEST(memcmp(buffer1, buffer2, sizeof(buffer1)) == 0) - TEST(stream.bytes_left == 0) - TEST(!pb_read(&stream, buffer2, 1)) - } - - { - uint8_t buffer[20]; - pb_istream_t stream = {&stream_callback, NULL, 20}; - - COMMENT("Test pb_read with custom callback"); - TEST(pb_read(&stream, buffer, 5)) - TEST(memcmp(buffer, "xxxxx", 5) == 0) - TEST(!pb_read(&stream, buffer, 50)) - stream.state = (void*)1; /* Simulated error return from callback */ - TEST(!pb_read(&stream, buffer, 5)) - stream.state = NULL; - TEST(pb_read(&stream, buffer, 15)) - } - - { - pb_istream_t s; - uint64_t u; - int64_t i; - - COMMENT("Test pb_decode_varint"); - TEST((s = S("\x00"), pb_decode_varint(&s, &u) && u == 0)); - TEST((s = S("\x01"), pb_decode_varint(&s, &u) && u == 1)); - TEST((s = S("\xAC\x02"), pb_decode_varint(&s, &u) && u == 300)); - TEST((s = S("\xFF\xFF\xFF\xFF\x0F"), pb_decode_varint(&s, &u) && u == UINT32_MAX)); - TEST((s = S("\xFF\xFF\xFF\xFF\x0F"), pb_decode_varint(&s, (uint64_t*)&i) && i == UINT32_MAX)); - TEST((s = S("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), - pb_decode_varint(&s, (uint64_t*)&i) && i == -1)); - TEST((s = S("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), - pb_decode_varint(&s, &u) && u == UINT64_MAX)); - TEST((s = S("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), - !pb_decode_varint(&s, &u))); - } - - { - pb_istream_t s; - uint32_t u; - - COMMENT("Test pb_decode_varint32"); - TEST((s = S("\x00"), pb_decode_varint32(&s, &u) && u == 0)); - TEST((s = S("\x01"), pb_decode_varint32(&s, &u) && u == 1)); - TEST((s = S("\xAC\x02"), pb_decode_varint32(&s, &u) && u == 300)); - TEST((s = S("\xFF\xFF\xFF\xFF\x0F"), pb_decode_varint32(&s, &u) && u == UINT32_MAX)); - TEST((s = S("\xFF\xFF\xFF\xFF\xFF\x01"), !pb_decode_varint32(&s, &u))); - } - - { - pb_istream_t s; - COMMENT("Test pb_skip_varint"); - TEST((s = S("\x00""foobar"), pb_skip_varint(&s) && s.bytes_left == 6)) - TEST((s = S("\xAC\x02""foobar"), pb_skip_varint(&s) && s.bytes_left == 6)) - TEST((s = S("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01""foobar"), - pb_skip_varint(&s) && s.bytes_left == 6)) - TEST((s = S("\xFF"), !pb_skip_varint(&s))) - } - - { - pb_istream_t s; - COMMENT("Test pb_skip_string") - TEST((s = S("\x00""foobar"), pb_skip_string(&s) && s.bytes_left == 6)) - TEST((s = S("\x04""testfoobar"), pb_skip_string(&s) && s.bytes_left == 6)) - TEST((s = S("\x04"), !pb_skip_string(&s))) - TEST((s = S("\xFF"), !pb_skip_string(&s))) - } - - { - pb_istream_t s = S("\x01\x00"); - pb_field_t f = {1, PB_LTYPE_VARINT, 0, 0, 4, 0, 0}; - uint32_t d; - COMMENT("Test pb_dec_varint using uint32_t") - TEST(pb_dec_varint(&s, &f, &d) && d == 1) - - /* Verify that no more than data_size is written. */ - d = 0xFFFFFFFF; - f.data_size = 1; - TEST(pb_dec_varint(&s, &f, &d) && (d == 0xFFFFFF00 || d == 0x00FFFFFF)) - } - - { - pb_istream_t s; - pb_field_t f = {1, PB_LTYPE_SVARINT, 0, 0, 4, 0, 0}; - int32_t d; - - COMMENT("Test pb_dec_svarint using int32_t") - TEST((s = S("\x01"), pb_dec_svarint(&s, &f, &d) && d == -1)) - TEST((s = S("\x02"), pb_dec_svarint(&s, &f, &d) && d == 1)) - TEST((s = S("\xfe\xff\xff\xff\x0f"), pb_dec_svarint(&s, &f, &d) && d == INT32_MAX)) - TEST((s = S("\xff\xff\xff\xff\x0f"), pb_dec_svarint(&s, &f, &d) && d == INT32_MIN)) - } - - { - pb_istream_t s; - pb_field_t f = {1, PB_LTYPE_SVARINT, 0, 0, 8, 0, 0}; - uint64_t d; - - COMMENT("Test pb_dec_svarint using uint64_t") - TEST((s = S("\x01"), pb_dec_svarint(&s, &f, &d) && d == -1)) - TEST((s = S("\x02"), pb_dec_svarint(&s, &f, &d) && d == 1)) - TEST((s = S("\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), pb_dec_svarint(&s, &f, &d) && d == INT64_MAX)) - TEST((s = S("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), pb_dec_svarint(&s, &f, &d) && d == INT64_MIN)) - } - - { - pb_istream_t s; - pb_field_t f = {1, PB_LTYPE_FIXED32, 0, 0, 4, 0, 0}; - float d; - - COMMENT("Test pb_dec_fixed32 using float (failures here may be caused by imperfect rounding)") - TEST((s = S("\x00\x00\x00\x00"), pb_dec_fixed32(&s, &f, &d) && d == 0.0f)) - TEST((s = S("\x00\x00\xc6\x42"), pb_dec_fixed32(&s, &f, &d) && d == 99.0f)) - TEST((s = S("\x4e\x61\x3c\xcb"), pb_dec_fixed32(&s, &f, &d) && d == -12345678.0f)) - TEST((s = S("\x00"), !pb_dec_fixed32(&s, &f, &d) && d == -12345678.0f)) - } - - { - pb_istream_t s; - pb_field_t f = {1, PB_LTYPE_FIXED64, 0, 0, 8, 0, 0}; - double d; - - COMMENT("Test pb_dec_fixed64 using double (failures here may be caused by imperfect rounding)") - TEST((s = S("\x00\x00\x00\x00\x00\x00\x00\x00"), pb_dec_fixed64(&s, &f, &d) && d == 0.0)) - TEST((s = S("\x00\x00\x00\x00\x00\xc0\x58\x40"), pb_dec_fixed64(&s, &f, &d) && d == 99.0)) - TEST((s = S("\x00\x00\x00\xc0\x29\x8c\x67\xc1"), pb_dec_fixed64(&s, &f, &d) && d == -12345678.0f)) - } - - { - pb_istream_t s; - struct { pb_size_t size; uint8_t bytes[5]; } d; - pb_field_t f = {1, PB_LTYPE_BYTES, 0, 0, sizeof(d), 0, 0}; - - COMMENT("Test pb_dec_bytes") - TEST((s = S("\x00"), pb_dec_bytes(&s, &f, &d) && d.size == 0)) - TEST((s = S("\x01\xFF"), pb_dec_bytes(&s, &f, &d) && d.size == 1 && d.bytes[0] == 0xFF)) - TEST((s = S("\x05xxxxx"), pb_dec_bytes(&s, &f, &d) && d.size == 5)) - TEST((s = S("\x05xxxx"), !pb_dec_bytes(&s, &f, &d))) - - /* Note: the size limit on bytes-fields is not strictly obeyed, as - * the compiler may add some padding to the struct. Using this padding - * is not a very good thing to do, but it is difficult to avoid when - * we use only a single uint8_t to store the size of the field. - * Therefore this tests against a 10-byte string, while otherwise even - * 6 bytes should error out. - */ - TEST((s = S("\x10xxxxxxxxxx"), !pb_dec_bytes(&s, &f, &d))) - } - - { - pb_istream_t s; - pb_field_t f = {1, PB_LTYPE_STRING, 0, 0, 5, 0, 0}; - char d[5]; - - COMMENT("Test pb_dec_string") - TEST((s = S("\x00"), pb_dec_string(&s, &f, &d) && d[0] == '\0')) - TEST((s = S("\x04xyzz"), pb_dec_string(&s, &f, &d) && strcmp(d, "xyzz") == 0)) - TEST((s = S("\x05xyzzy"), !pb_dec_string(&s, &f, &d))) - } - - { - pb_istream_t s; - IntegerArray dest; - - COMMENT("Testing pb_decode with repeated int32 field") - TEST((s = S(""), pb_decode(&s, IntegerArray_fields, &dest) && dest.data_count == 0)) - TEST((s = S("\x08\x01\x08\x02"), pb_decode(&s, IntegerArray_fields, &dest) - && dest.data_count == 2 && dest.data[0] == 1 && dest.data[1] == 2)) - s = S("\x08\x01\x08\x02\x08\x03\x08\x04\x08\x05\x08\x06\x08\x07\x08\x08\x08\x09\x08\x0A"); - TEST(pb_decode(&s, IntegerArray_fields, &dest) && dest.data_count == 10 && dest.data[9] == 10) - s = S("\x08\x01\x08\x02\x08\x03\x08\x04\x08\x05\x08\x06\x08\x07\x08\x08\x08\x09\x08\x0A\x08\x0B"); - TEST(!pb_decode(&s, IntegerArray_fields, &dest)) - } - - { - pb_istream_t s; - IntegerArray dest; - - COMMENT("Testing pb_decode with packed int32 field") - TEST((s = S("\x0A\x00"), pb_decode(&s, IntegerArray_fields, &dest) - && dest.data_count == 0)) - TEST((s = S("\x0A\x01\x01"), pb_decode(&s, IntegerArray_fields, &dest) - && dest.data_count == 1 && dest.data[0] == 1)) - TEST((s = S("\x0A\x0A\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A"), pb_decode(&s, IntegerArray_fields, &dest) - && dest.data_count == 10 && dest.data[0] == 1 && dest.data[9] == 10)) - TEST((s = S("\x0A\x0B\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B"), !pb_decode(&s, IntegerArray_fields, &dest))) - - /* Test invalid wire data */ - TEST((s = S("\x0A\xFF"), !pb_decode(&s, IntegerArray_fields, &dest))) - TEST((s = S("\x0A\x01"), !pb_decode(&s, IntegerArray_fields, &dest))) - } - - { - pb_istream_t s; - IntegerArray dest; - - COMMENT("Testing pb_decode with unknown fields") - TEST((s = S("\x18\x0F\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest) - && dest.data_count == 1 && dest.data[0] == 1)) - TEST((s = S("\x19\x00\x00\x00\x00\x00\x00\x00\x00\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest) - && dest.data_count == 1 && dest.data[0] == 1)) - TEST((s = S("\x1A\x00\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest) - && dest.data_count == 1 && dest.data[0] == 1)) - TEST((s = S("\x1B\x08\x01"), !pb_decode(&s, IntegerArray_fields, &dest))) - TEST((s = S("\x1D\x00\x00\x00\x00\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest) - && dest.data_count == 1 && dest.data[0] == 1)) - } - - { - pb_istream_t s; - CallbackArray dest; - struct { pb_size_t size; uint8_t bytes[10]; } ref; - dest.data.funcs.decode = &callback_check; - dest.data.arg = &ref; - - COMMENT("Testing pb_decode with callbacks") - /* Single varint */ - ref.size = 1; ref.bytes[0] = 0x55; - TEST((s = S("\x08\x55"), pb_decode(&s, CallbackArray_fields, &dest))) - /* Packed varint */ - ref.size = 3; ref.bytes[0] = ref.bytes[1] = ref.bytes[2] = 0x55; - TEST((s = S("\x0A\x03\x55\x55\x55"), pb_decode(&s, CallbackArray_fields, &dest))) - /* Packed varint with loop */ - ref.size = 1; ref.bytes[0] = 0x55; - TEST((s = S("\x0A\x03\x55\x55\x55"), pb_decode(&s, CallbackArray_fields, &dest))) - /* Single fixed32 */ - ref.size = 4; ref.bytes[0] = ref.bytes[1] = ref.bytes[2] = ref.bytes[3] = 0xAA; - TEST((s = S("\x0D\xAA\xAA\xAA\xAA"), pb_decode(&s, CallbackArray_fields, &dest))) - /* Single fixed64 */ - ref.size = 8; memset(ref.bytes, 0xAA, 8); - TEST((s = S("\x09\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"), pb_decode(&s, CallbackArray_fields, &dest))) - /* Unsupported field type */ - TEST((s = S("\x0B\x00"), !pb_decode(&s, CallbackArray_fields, &dest))) - - /* Just make sure that our test function works */ - ref.size = 1; ref.bytes[0] = 0x56; - TEST((s = S("\x08\x55"), !pb_decode(&s, CallbackArray_fields, &dest))) - } - - { - pb_istream_t s; - IntegerArray dest; - - COMMENT("Testing pb_decode message termination") - TEST((s = S(""), pb_decode(&s, IntegerArray_fields, &dest))) - TEST((s = S("\x00"), pb_decode(&s, IntegerArray_fields, &dest))) - TEST((s = S("\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest))) - TEST((s = S("\x08\x01\x00"), pb_decode(&s, IntegerArray_fields, &dest))) - TEST((s = S("\x08"), !pb_decode(&s, IntegerArray_fields, &dest))) - } - - { - pb_istream_t s; - IntegerContainer dest = {{0}}; - - COMMENT("Testing pb_decode_delimited") - TEST((s = S("\x09\x0A\x07\x0A\x05\x01\x02\x03\x04\x05"), - pb_decode_delimited(&s, IntegerContainer_fields, &dest)) && - dest.submsg.data_count == 5) - } - - { - pb_istream_t s = {0}; - void *data = NULL; - - COMMENT("Testing allocate_field") - TEST(allocate_field(&s, &data, 10, 10) && data != NULL); - TEST(allocate_field(&s, &data, 10, 20) && data != NULL); - - { - void *oldvalue = data; - size_t very_big = (size_t)-1; - size_t somewhat_big = very_big / 2 + 1; - size_t not_so_big = (size_t)1 << (4 * sizeof(size_t)); - - TEST(!allocate_field(&s, &data, very_big, 2) && data == oldvalue); - TEST(!allocate_field(&s, &data, somewhat_big, 2) && data == oldvalue); - TEST(!allocate_field(&s, &data, not_so_big, not_so_big) && data == oldvalue); - } - - pb_free(data); - } - - if (status != 0) - fprintf(stdout, "\n\nSome tests FAILED!\n"); - - return status; -} diff --git a/third_party/nanopb/tests/encode_unittests/SConscript b/third_party/nanopb/tests/encode_unittests/SConscript deleted file mode 100644 index bf6d1404c31..00000000000 --- a/third_party/nanopb/tests/encode_unittests/SConscript +++ /dev/null @@ -1,5 +0,0 @@ -# Build and run the stand-alone unit tests for the nanopb encoder part. - -Import('env') -p = env.Program(["encode_unittests.c", "$COMMON/unittestproto.pb.c"]) -env.RunTest(p) diff --git a/third_party/nanopb/tests/encode_unittests/encode_unittests.c b/third_party/nanopb/tests/encode_unittests/encode_unittests.c deleted file mode 100644 index 583af5c6c46..00000000000 --- a/third_party/nanopb/tests/encode_unittests/encode_unittests.c +++ /dev/null @@ -1,355 +0,0 @@ -/* This includes the whole .c file to get access to static functions. */ -#include "pb_common.c" -#include "pb_encode.c" - -#include -#include -#include "unittests.h" -#include "unittestproto.pb.h" - -bool streamcallback(pb_ostream_t *stream, const uint8_t *buf, size_t count) -{ - /* Allow only 'x' to be written */ - while (count--) - { - if (*buf++ != 'x') - return false; - } - return true; -} - -bool fieldcallback(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - int value = 0x55; - if (!pb_encode_tag_for_field(stream, field)) - return false; - return pb_encode_varint(stream, value); -} - -bool crazyfieldcallback(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) -{ - /* This callback writes different amount of data the second time. */ - uint32_t *state = (uint32_t*)arg; - *state <<= 8; - if (!pb_encode_tag_for_field(stream, field)) - return false; - return pb_encode_varint(stream, *state); -} - -/* Check that expression x writes data y. - * Y is a string, which may contain null bytes. Null terminator is ignored. - */ -#define WRITES(x, y) \ -memset(buffer, 0xAA, sizeof(buffer)), \ -s = pb_ostream_from_buffer(buffer, sizeof(buffer)), \ -(x) && \ -memcmp(buffer, y, sizeof(y) - 1) == 0 && \ -buffer[sizeof(y) - 1] == 0xAA - -int main() -{ - int status = 0; - - { - uint8_t buffer1[] = "foobartest1234"; - uint8_t buffer2[sizeof(buffer1)]; - pb_ostream_t stream = pb_ostream_from_buffer(buffer2, sizeof(buffer1)); - - COMMENT("Test pb_write and pb_ostream_t"); - TEST(pb_write(&stream, buffer1, sizeof(buffer1))); - TEST(memcmp(buffer1, buffer2, sizeof(buffer1)) == 0); - TEST(!pb_write(&stream, buffer1, 1)); - TEST(stream.bytes_written == sizeof(buffer1)); - } - - { - uint8_t buffer1[] = "xxxxxxx"; - pb_ostream_t stream = {&streamcallback, 0, SIZE_MAX, 0}; - - COMMENT("Test pb_write with custom callback"); - TEST(pb_write(&stream, buffer1, 5)); - buffer1[0] = 'a'; - TEST(!pb_write(&stream, buffer1, 5)); - } - - { - uint8_t buffer[30]; - pb_ostream_t s; - - COMMENT("Test pb_encode_varint") - TEST(WRITES(pb_encode_varint(&s, 0), "\0")); - TEST(WRITES(pb_encode_varint(&s, 1), "\1")); - TEST(WRITES(pb_encode_varint(&s, 0x7F), "\x7F")); - TEST(WRITES(pb_encode_varint(&s, 0x80), "\x80\x01")); - TEST(WRITES(pb_encode_varint(&s, UINT32_MAX), "\xFF\xFF\xFF\xFF\x0F")); - TEST(WRITES(pb_encode_varint(&s, UINT64_MAX), "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01")); - } - - { - uint8_t buffer[30]; - pb_ostream_t s; - - COMMENT("Test pb_encode_tag") - TEST(WRITES(pb_encode_tag(&s, PB_WT_STRING, 5), "\x2A")); - TEST(WRITES(pb_encode_tag(&s, PB_WT_VARINT, 99), "\x98\x06")); - } - - { - uint8_t buffer[30]; - pb_ostream_t s; - pb_field_t field = {10, PB_LTYPE_SVARINT}; - - COMMENT("Test pb_encode_tag_for_field") - TEST(WRITES(pb_encode_tag_for_field(&s, &field), "\x50")); - - field.type = PB_LTYPE_FIXED64; - TEST(WRITES(pb_encode_tag_for_field(&s, &field), "\x51")); - - field.type = PB_LTYPE_STRING; - TEST(WRITES(pb_encode_tag_for_field(&s, &field), "\x52")); - - field.type = PB_LTYPE_FIXED32; - TEST(WRITES(pb_encode_tag_for_field(&s, &field), "\x55")); - } - - { - uint8_t buffer[30]; - pb_ostream_t s; - - COMMENT("Test pb_encode_string") - TEST(WRITES(pb_encode_string(&s, (const uint8_t*)"abcd", 4), "\x04""abcd")); - TEST(WRITES(pb_encode_string(&s, (const uint8_t*)"abcd\x00", 5), "\x05""abcd\x00")); - TEST(WRITES(pb_encode_string(&s, (const uint8_t*)"", 0), "\x00")); - } - - { - uint8_t buffer[30]; - pb_ostream_t s; - uint8_t value = 1; - int32_t max = INT32_MAX; - int32_t min = INT32_MIN; - int64_t lmax = INT64_MAX; - int64_t lmin = INT64_MIN; - pb_field_t field = {1, PB_LTYPE_VARINT, 0, 0, sizeof(value)}; - - COMMENT("Test pb_enc_varint and pb_enc_svarint") - TEST(WRITES(pb_enc_varint(&s, &field, &value), "\x01")); - - field.data_size = sizeof(max); - TEST(WRITES(pb_enc_svarint(&s, &field, &max), "\xfe\xff\xff\xff\x0f")); - TEST(WRITES(pb_enc_svarint(&s, &field, &min), "\xff\xff\xff\xff\x0f")); - - field.data_size = sizeof(lmax); - TEST(WRITES(pb_enc_svarint(&s, &field, &lmax), "\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01")); - TEST(WRITES(pb_enc_svarint(&s, &field, &lmin), "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01")); - } - - { - uint8_t buffer[30]; - pb_ostream_t s; - float fvalue; - double dvalue; - - COMMENT("Test pb_enc_fixed32 using float") - fvalue = 0.0f; - TEST(WRITES(pb_enc_fixed32(&s, NULL, &fvalue), "\x00\x00\x00\x00")) - fvalue = 99.0f; - TEST(WRITES(pb_enc_fixed32(&s, NULL, &fvalue), "\x00\x00\xc6\x42")) - fvalue = -12345678.0f; - TEST(WRITES(pb_enc_fixed32(&s, NULL, &fvalue), "\x4e\x61\x3c\xcb")) - - COMMENT("Test pb_enc_fixed64 using double") - dvalue = 0.0; - TEST(WRITES(pb_enc_fixed64(&s, NULL, &dvalue), "\x00\x00\x00\x00\x00\x00\x00\x00")) - dvalue = 99.0; - TEST(WRITES(pb_enc_fixed64(&s, NULL, &dvalue), "\x00\x00\x00\x00\x00\xc0\x58\x40")) - dvalue = -12345678.0; - TEST(WRITES(pb_enc_fixed64(&s, NULL, &dvalue), "\x00\x00\x00\xc0\x29\x8c\x67\xc1")) - } - - { - uint8_t buffer[30]; - pb_ostream_t s; - struct { pb_size_t size; uint8_t bytes[5]; } value = {5, {'x', 'y', 'z', 'z', 'y'}}; - - COMMENT("Test pb_enc_bytes") - TEST(WRITES(pb_enc_bytes(&s, &BytesMessage_fields[0], &value), "\x05xyzzy")) - value.size = 0; - TEST(WRITES(pb_enc_bytes(&s, &BytesMessage_fields[0], &value), "\x00")) - } - - { - uint8_t buffer[30]; - pb_ostream_t s; - char value[30] = "xyzzy"; - - COMMENT("Test pb_enc_string") - TEST(WRITES(pb_enc_string(&s, &StringMessage_fields[0], &value), "\x05xyzzy")) - value[0] = '\0'; - TEST(WRITES(pb_enc_string(&s, &StringMessage_fields[0], &value), "\x00")) - memset(value, 'x', 30); - TEST(WRITES(pb_enc_string(&s, &StringMessage_fields[0], &value), "\x0Axxxxxxxxxx")) - } - - { - uint8_t buffer[10]; - pb_ostream_t s; - IntegerArray msg = {5, {1, 2, 3, 4, 5}}; - - COMMENT("Test pb_encode with int32 array") - - TEST(WRITES(pb_encode(&s, IntegerArray_fields, &msg), "\x0A\x05\x01\x02\x03\x04\x05")) - - msg.data_count = 0; - TEST(WRITES(pb_encode(&s, IntegerArray_fields, &msg), "")) - - msg.data_count = 10; - TEST(!pb_encode(&s, IntegerArray_fields, &msg)) - } - - { - uint8_t buffer[10]; - pb_ostream_t s; - FloatArray msg = {1, {99.0f}}; - - COMMENT("Test pb_encode with float array") - - TEST(WRITES(pb_encode(&s, FloatArray_fields, &msg), - "\x0A\x04\x00\x00\xc6\x42")) - - msg.data_count = 0; - TEST(WRITES(pb_encode(&s, FloatArray_fields, &msg), "")) - - msg.data_count = 3; - TEST(!pb_encode(&s, FloatArray_fields, &msg)) - } - - { - uint8_t buffer[50]; - pb_ostream_t s; - FloatArray msg = {1, {99.0f}}; - - COMMENT("Test array size limit in pb_encode") - - s = pb_ostream_from_buffer(buffer, sizeof(buffer)); - TEST((msg.data_count = 10) && pb_encode(&s, FloatArray_fields, &msg)) - - s = pb_ostream_from_buffer(buffer, sizeof(buffer)); - TEST((msg.data_count = 11) && !pb_encode(&s, FloatArray_fields, &msg)) - } - - { - uint8_t buffer[10]; - pb_ostream_t s; - CallbackArray msg; - - msg.data.funcs.encode = &fieldcallback; - - COMMENT("Test pb_encode with callback field.") - TEST(WRITES(pb_encode(&s, CallbackArray_fields, &msg), "\x08\x55")) - } - - { - uint8_t buffer[10]; - pb_ostream_t s; - IntegerContainer msg = {{5, {1,2,3,4,5}}}; - - COMMENT("Test pb_encode with packed array in a submessage.") - TEST(WRITES(pb_encode(&s, IntegerContainer_fields, &msg), - "\x0A\x07\x0A\x05\x01\x02\x03\x04\x05")) - } - - { - uint8_t buffer[32]; - pb_ostream_t s; - BytesMessage msg = {{3, "xyz"}}; - - COMMENT("Test pb_encode with bytes message.") - TEST(WRITES(pb_encode(&s, BytesMessage_fields, &msg), - "\x0A\x03xyz")) - - msg.data.size = 17; /* More than maximum */ - TEST(!pb_encode(&s, BytesMessage_fields, &msg)) - } - - - { - uint8_t buffer[20]; - pb_ostream_t s; - IntegerContainer msg = {{5, {1,2,3,4,5}}}; - - COMMENT("Test pb_encode_delimited.") - TEST(WRITES(pb_encode_delimited(&s, IntegerContainer_fields, &msg), - "\x09\x0A\x07\x0A\x05\x01\x02\x03\x04\x05")) - } - - { - IntegerContainer msg = {{5, {1,2,3,4,5}}}; - size_t size; - - COMMENT("Test pb_get_encoded_size.") - TEST(pb_get_encoded_size(&size, IntegerContainer_fields, &msg) && - size == 9); - } - - { - uint8_t buffer[10]; - pb_ostream_t s; - CallbackContainer msg; - CallbackContainerContainer msg2; - uint32_t state = 1; - - msg.submsg.data.funcs.encode = &fieldcallback; - msg2.submsg.submsg.data.funcs.encode = &fieldcallback; - - COMMENT("Test pb_encode with callback field in a submessage.") - TEST(WRITES(pb_encode(&s, CallbackContainer_fields, &msg), "\x0A\x02\x08\x55")) - TEST(WRITES(pb_encode(&s, CallbackContainerContainer_fields, &msg2), - "\x0A\x04\x0A\x02\x08\x55")) - - /* Misbehaving callback: varying output between calls */ - msg.submsg.data.funcs.encode = &crazyfieldcallback; - msg.submsg.data.arg = &state; - msg2.submsg.submsg.data.funcs.encode = &crazyfieldcallback; - msg2.submsg.submsg.data.arg = &state; - - TEST(!pb_encode(&s, CallbackContainer_fields, &msg)) - state = 1; - TEST(!pb_encode(&s, CallbackContainerContainer_fields, &msg2)) - } - - { - uint8_t buffer[StringMessage_size]; - pb_ostream_t s; - StringMessage msg = {"0123456789"}; - - s = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - COMMENT("Test that StringMessage_size is correct") - - TEST(pb_encode(&s, StringMessage_fields, &msg)); - TEST(s.bytes_written == StringMessage_size); - } - - { - uint8_t buffer[128]; - pb_ostream_t s; - StringPointerContainer msg = StringPointerContainer_init_zero; - char *strs[1] = {NULL}; - char zstr[] = "Z"; - - COMMENT("Test string pointer encoding."); - - msg.rep_str = strs; - msg.rep_str_count = 1; - TEST(WRITES(pb_encode(&s, StringPointerContainer_fields, &msg), "\x0a\x00")) - - strs[0] = zstr; - TEST(WRITES(pb_encode(&s, StringPointerContainer_fields, &msg), "\x0a\x01Z")) - } - - if (status != 0) - fprintf(stdout, "\n\nSome tests FAILED!\n"); - - return status; -} diff --git a/third_party/nanopb/tests/enum_sizes/SConscript b/third_party/nanopb/tests/enum_sizes/SConscript deleted file mode 100644 index 048592ed838..00000000000 --- a/third_party/nanopb/tests/enum_sizes/SConscript +++ /dev/null @@ -1,12 +0,0 @@ -# Test that different sizes of enum fields are properly encoded and decoded. - -Import('env') - -env.NanopbProto('enumsizes') - -p = env.Program(["enumsizes_unittests.c", - "enumsizes.pb.c", - "$COMMON/pb_encode.o", - "$COMMON/pb_decode.o", - "$COMMON/pb_common.o"]) -env.RunTest(p) diff --git a/third_party/nanopb/tests/enum_sizes/enumsizes.proto b/third_party/nanopb/tests/enum_sizes/enumsizes.proto deleted file mode 100644 index a85d4160135..00000000000 --- a/third_party/nanopb/tests/enum_sizes/enumsizes.proto +++ /dev/null @@ -1,86 +0,0 @@ -/* Test handling of enums with different value ranges. - * Depending on compiler and the packed_enum setting, the datatypes - * for enums can be either signed or unsigned. In past this has caused - * a bit of a problem for the encoder/decoder (issue #164). - */ - -syntax = "proto2"; - -import 'nanopb.proto'; - -option (nanopb_fileopt).long_names = false; - -enum UnpackedUint8 { - option (nanopb_enumopt).packed_enum = false; - UU8_MIN = 0; - UU8_MAX = 255; -} - -enum PackedUint8 { - option (nanopb_enumopt).packed_enum = true; - PU8_MIN = 0; - PU8_MAX = 255; -} - -enum UnpackedInt8 { - option (nanopb_enumopt).packed_enum = false; - UI8_MIN = -128; - UI8_MAX = 127; -} - -enum PackedInt8 { - option (nanopb_enumopt).packed_enum = true; - PI8_MIN = -128; - PI8_MAX = 127; -} - -enum UnpackedUint16 { - option (nanopb_enumopt).packed_enum = false; - UU16_MIN = 0; - UU16_MAX = 65535; -} - -enum PackedUint16 { - option (nanopb_enumopt).packed_enum = true; - PU16_MIN = 0; - PU16_MAX = 65535; -} - -enum UnpackedInt16 { - option (nanopb_enumopt).packed_enum = false; - UI16_MIN = -32768; - UI16_MAX = 32767; -} - -enum PackedInt16 { - option (nanopb_enumopt).packed_enum = true; - PI16_MIN = -32768; - PI16_MAX = 32767; -} - -/* Protobuf supports enums up to 32 bits. - * The 32 bit case is covered by HugeEnum in the alltypes test. - */ - -message PackedEnums { - required PackedUint8 u8_min = 1; - required PackedUint8 u8_max = 2; - required PackedInt8 i8_min = 3; - required PackedInt8 i8_max = 4; - required PackedUint16 u16_min = 5; - required PackedUint16 u16_max = 6; - required PackedInt16 i16_min = 7; - required PackedInt16 i16_max = 8; -} - -message UnpackedEnums { - required UnpackedUint8 u8_min = 1; - required UnpackedUint8 u8_max = 2; - required UnpackedInt8 i8_min = 3; - required UnpackedInt8 i8_max = 4; - required UnpackedUint16 u16_min = 5; - required UnpackedUint16 u16_max = 6; - required UnpackedInt16 i16_min = 7; - required UnpackedInt16 i16_max = 8; -} - diff --git a/third_party/nanopb/tests/enum_sizes/enumsizes_unittests.c b/third_party/nanopb/tests/enum_sizes/enumsizes_unittests.c deleted file mode 100644 index 5606895a66a..00000000000 --- a/third_party/nanopb/tests/enum_sizes/enumsizes_unittests.c +++ /dev/null @@ -1,72 +0,0 @@ -#include -#include -#include -#include -#include "unittests.h" -#include "enumsizes.pb.h" - -int main() -{ - int status = 0; - - UnpackedEnums msg1 = { - UU8_MIN, UU8_MAX, - UI8_MIN, UI8_MAX, - UU16_MIN, UU16_MAX, - UI16_MIN, UI16_MAX, - }; - - PackedEnums msg2; - UnpackedEnums msg3; - uint8_t buf[256]; - size_t msgsize; - - COMMENT("Step 1: unpacked enums -> protobuf"); - { - pb_ostream_t s = pb_ostream_from_buffer(buf, sizeof(buf)); - TEST(pb_encode(&s, UnpackedEnums_fields, &msg1)); - msgsize = s.bytes_written; - } - - COMMENT("Step 2: protobuf -> packed enums"); - { - pb_istream_t s = pb_istream_from_buffer(buf, msgsize); - TEST(pb_decode(&s, PackedEnums_fields, &msg2)); - - TEST(msg1.u8_min == (int)msg2.u8_min); - TEST(msg1.u8_max == (int)msg2.u8_max); - TEST(msg1.i8_min == (int)msg2.i8_min); - TEST(msg1.i8_max == (int)msg2.i8_max); - TEST(msg1.u16_min == (int)msg2.u16_min); - TEST(msg1.u16_max == (int)msg2.u16_max); - TEST(msg1.i16_min == (int)msg2.i16_min); - TEST(msg1.i16_max == (int)msg2.i16_max); - } - - COMMENT("Step 3: packed enums -> protobuf"); - { - pb_ostream_t s = pb_ostream_from_buffer(buf, sizeof(buf)); - TEST(pb_encode(&s, PackedEnums_fields, &msg2)); - msgsize = s.bytes_written; - } - - COMMENT("Step 4: protobuf -> unpacked enums"); - { - pb_istream_t s = pb_istream_from_buffer(buf, msgsize); - TEST(pb_decode(&s, UnpackedEnums_fields, &msg3)); - - TEST(msg1.u8_min == (int)msg3.u8_min); - TEST(msg1.u8_max == (int)msg3.u8_max); - TEST(msg1.i8_min == (int)msg3.i8_min); - TEST(msg1.i8_max == (int)msg3.i8_max); - TEST(msg1.u16_min == (int)msg2.u16_min); - TEST(msg1.u16_max == (int)msg2.u16_max); - TEST(msg1.i16_min == (int)msg2.i16_min); - TEST(msg1.i16_max == (int)msg2.i16_max); - } - - if (status != 0) - fprintf(stdout, "\n\nSome tests FAILED!\n"); - - return status; -} diff --git a/third_party/nanopb/tests/extensions/SConscript b/third_party/nanopb/tests/extensions/SConscript deleted file mode 100644 index a2c87428289..00000000000 --- a/third_party/nanopb/tests/extensions/SConscript +++ /dev/null @@ -1,16 +0,0 @@ -# Test the support for extension fields. - -Import("env") - -# We use the files from the alltypes test case -incpath = env.Clone() -incpath.Append(PROTOCPATH = '$BUILD/alltypes') -incpath.Append(CPPPATH = '$BUILD/alltypes') - -incpath.NanopbProto(["extensions", "extensions.options"]) -enc = incpath.Program(["encode_extensions.c", "extensions.pb.c", "$BUILD/alltypes/alltypes.pb$OBJSUFFIX", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"]) -dec = incpath.Program(["decode_extensions.c", "extensions.pb.c", "$BUILD/alltypes/alltypes.pb$OBJSUFFIX", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"]) - -env.RunTest(enc) -env.RunTest([dec, "encode_extensions.output"]) - diff --git a/third_party/nanopb/tests/extensions/decode_extensions.c b/third_party/nanopb/tests/extensions/decode_extensions.c deleted file mode 100644 index e43743804ad..00000000000 --- a/third_party/nanopb/tests/extensions/decode_extensions.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Test decoding of extension fields. */ - -#include -#include -#include -#include -#include "alltypes.pb.h" -#include "extensions.pb.h" -#include "test_helpers.h" - -#define TEST(x) if (!(x)) { \ - printf("Test " #x " failed.\n"); \ - return 2; \ - } - -int main(int argc, char **argv) -{ - uint8_t buffer[1024]; - size_t count; - pb_istream_t stream; - - AllTypes alltypes = {0}; - int32_t extensionfield1; - pb_extension_t ext1; - ExtensionMessage extensionfield2; - pb_extension_t ext2; - - /* Read the message data */ - SET_BINARY_MODE(stdin); - count = fread(buffer, 1, sizeof(buffer), stdin); - stream = pb_istream_from_buffer(buffer, count); - - /* Add the extensions */ - alltypes.extensions = &ext1; - - ext1.type = &AllTypes_extensionfield1; - ext1.dest = &extensionfield1; - ext1.next = &ext2; - - ext2.type = &ExtensionMessage_AllTypes_extensionfield2; - ext2.dest = &extensionfield2; - ext2.next = NULL; - - /* Decode the message */ - if (!pb_decode(&stream, AllTypes_fields, &alltypes)) - { - printf("Parsing failed: %s\n", PB_GET_ERROR(&stream)); - return 1; - } - - /* Check that the extensions decoded properly */ - TEST(ext1.found) - TEST(extensionfield1 == 12345) - TEST(ext2.found) - TEST(strcmp(extensionfield2.test1, "test") == 0) - TEST(extensionfield2.test2 == 54321) - - return 0; -} - diff --git a/third_party/nanopb/tests/extensions/encode_extensions.c b/third_party/nanopb/tests/extensions/encode_extensions.c deleted file mode 100644 index 00745826f4d..00000000000 --- a/third_party/nanopb/tests/extensions/encode_extensions.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Tests extension fields. - */ - -#include -#include -#include -#include -#include "alltypes.pb.h" -#include "extensions.pb.h" -#include "test_helpers.h" - -int main(int argc, char **argv) -{ - uint8_t buffer[1024]; - pb_ostream_t stream; - - AllTypes alltypes = {0}; - int32_t extensionfield1 = 12345; - pb_extension_t ext1; - ExtensionMessage extensionfield2 = {"test", 54321}; - pb_extension_t ext2; - - /* Set up the extensions */ - alltypes.extensions = &ext1; - - ext1.type = &AllTypes_extensionfield1; - ext1.dest = &extensionfield1; - ext1.next = &ext2; - - ext2.type = &ExtensionMessage_AllTypes_extensionfield2; - ext2.dest = &extensionfield2; - ext2.next = NULL; - - /* Set up the output stream */ - stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - /* Now encode the message and check if we succeeded. */ - if (pb_encode(&stream, AllTypes_fields, &alltypes)) - { - SET_BINARY_MODE(stdout); - fwrite(buffer, 1, stream.bytes_written, stdout); - return 0; /* Success */ - } - else - { - fprintf(stderr, "Encoding failed: %s\n", PB_GET_ERROR(&stream)); - return 1; /* Failure */ - } - - /* Check that the field tags are properly generated */ - (void)AllTypes_extensionfield1_tag; - (void)ExtensionMessage_AllTypes_extensionfield2_tag; -} - diff --git a/third_party/nanopb/tests/extensions/extensions.options b/third_party/nanopb/tests/extensions/extensions.options deleted file mode 100644 index a5cd61dd35b..00000000000 --- a/third_party/nanopb/tests/extensions/extensions.options +++ /dev/null @@ -1 +0,0 @@ -* max_size:16 diff --git a/third_party/nanopb/tests/extensions/extensions.proto b/third_party/nanopb/tests/extensions/extensions.proto deleted file mode 100644 index fcd5b43bdbd..00000000000 --- a/third_party/nanopb/tests/extensions/extensions.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto2"; - -import 'alltypes.proto'; - -extend AllTypes { - optional int32 AllTypes_extensionfield1 = 255 [default = 5]; -} - -message ExtensionMessage { - extend AllTypes { - optional ExtensionMessage AllTypes_extensionfield2 = 254; - // required ExtensionMessage AllTypes_extensionfield3 = 253; // No longer allowed by protobuf 3 - repeated ExtensionMessage AllTypes_extensionfield4 = 252; - } - - required string test1 = 1; - required int32 test2 = 2; -} - diff --git a/third_party/nanopb/tests/extra_fields/SConscript b/third_party/nanopb/tests/extra_fields/SConscript deleted file mode 100644 index 75ac5c5e761..00000000000 --- a/third_party/nanopb/tests/extra_fields/SConscript +++ /dev/null @@ -1,16 +0,0 @@ -# Test that the decoder properly handles unknown fields in the input. - -Import("env") - -dec = env.GetBuildPath('$BUILD/basic_buffer/${PROGPREFIX}decode_buffer${PROGSUFFIX}') -env.RunTest('person_with_extra_field.output', [dec, "person_with_extra_field.pb"]) -env.Compare(["person_with_extra_field.output", "person_with_extra_field.expected"]) - -dec = env.GetBuildPath('$BUILD/basic_stream/${PROGPREFIX}decode_stream${PROGSUFFIX}') -env.RunTest('person_with_extra_field_stream.output', [dec, "person_with_extra_field.pb"]) -env.Compare(["person_with_extra_field_stream.output", "person_with_extra_field.expected"]) - -# This uses the backwards compatibility alltypes test, so that -# alltypes_with_extra_fields.pb doesn't have to be remade so often. -dec2 = env.GetBuildPath('$BUILD/backwards_compatibility/${PROGPREFIX}decode_legacy${PROGSUFFIX}') -env.RunTest('alltypes_with_extra_fields.output', [dec2, 'alltypes_with_extra_fields.pb']) diff --git a/third_party/nanopb/tests/extra_fields/person_with_extra_field.expected b/third_party/nanopb/tests/extra_fields/person_with_extra_field.expected deleted file mode 100644 index da9c32df655..00000000000 --- a/third_party/nanopb/tests/extra_fields/person_with_extra_field.expected +++ /dev/null @@ -1,14 +0,0 @@ -name: "Test Person 99" -id: 99 -email: "test@person.com" -phone { - number: "555-12345678" - type: MOBILE -} -phone { - number: "99-2342" -} -phone { - number: "1234-5678" - type: WORK -} diff --git a/third_party/nanopb/tests/field_size_16/SConscript b/third_party/nanopb/tests/field_size_16/SConscript deleted file mode 100644 index ffb29c4e1a3..00000000000 --- a/third_party/nanopb/tests/field_size_16/SConscript +++ /dev/null @@ -1,29 +0,0 @@ -# Run the alltypes test case, but compile with PB_FIELD_16BIT=1. -# Also the .proto file has been modified to have high indexes. - -Import("env") - -# Take copy of the files for custom build. -c = Copy("$TARGET", "$SOURCE") -env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c) -env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c) - -env.NanopbProto(["alltypes", "alltypes.options"]) - -# Define the compilation options -opts = env.Clone() -opts.Append(CPPDEFINES = {'PB_FIELD_16BIT': 1}) - -# Build new version of core -strict = opts.Clone() -strict.Append(CFLAGS = strict['CORECFLAGS']) -strict.Object("pb_decode_fields16.o", "$NANOPB/pb_decode.c") -strict.Object("pb_encode_fields16.o", "$NANOPB/pb_encode.c") -strict.Object("pb_common_fields16.o", "$NANOPB/pb_common.c") - -# Now build and run the test normally. -enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_fields16.o", "pb_common_fields16.o"]) -dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_fields16.o", "pb_common_fields16.o"]) - -env.RunTest(enc) -env.RunTest([dec, "encode_alltypes.output"]) diff --git a/third_party/nanopb/tests/field_size_16/alltypes.options b/third_party/nanopb/tests/field_size_16/alltypes.options deleted file mode 100644 index b31e3cf0a9d..00000000000 --- a/third_party/nanopb/tests/field_size_16/alltypes.options +++ /dev/null @@ -1,3 +0,0 @@ -* max_size:16 -* max_count:5 - diff --git a/third_party/nanopb/tests/field_size_16/alltypes.proto b/third_party/nanopb/tests/field_size_16/alltypes.proto deleted file mode 100644 index ba1ec383c9a..00000000000 --- a/third_party/nanopb/tests/field_size_16/alltypes.proto +++ /dev/null @@ -1,121 +0,0 @@ -syntax = "proto2"; - -message SubMessage { - required string substuff1 = 1 [default = "1"]; - required int32 substuff2 = 2 [default = 2]; - optional fixed32 substuff3 = 65535 [default = 3]; -} - -message EmptyMessage { - -} - -enum HugeEnum { - Negative = -2147483647; /* protoc doesn't accept -2147483648 here */ - Positive = 2147483647; -} - -message Limits { - required int32 int32_min = 1; - required int32 int32_max = 2; - required uint32 uint32_min = 3; - required uint32 uint32_max = 4; - required int64 int64_min = 5; - required int64 int64_max = 6; - required uint64 uint64_min = 7; - required uint64 uint64_max = 8; - required HugeEnum enum_min = 9; - required HugeEnum enum_max = 10; -} - -enum MyEnum { - Zero = 0; - First = 1; - Second = 2; - Truth = 42; -} - -message AllTypes { - required int32 req_int32 = 1; - required int64 req_int64 = 2; - required uint32 req_uint32 = 3; - required uint64 req_uint64 = 4; - required sint32 req_sint32 = 5; - required sint64 req_sint64 = 6; - required bool req_bool = 7; - - required fixed32 req_fixed32 = 8; - required sfixed32 req_sfixed32= 9; - required float req_float = 10; - - required fixed64 req_fixed64 = 11; - required sfixed64 req_sfixed64= 12; - required double req_double = 13; - - required string req_string = 14; - required bytes req_bytes = 15; - required SubMessage req_submsg = 16; - required MyEnum req_enum = 17; - required EmptyMessage req_emptymsg = 18; - - - repeated int32 rep_int32 = 21; - repeated int64 rep_int64 = 22; - repeated uint32 rep_uint32 = 23; - repeated uint64 rep_uint64 = 24; - repeated sint32 rep_sint32 = 25; - repeated sint64 rep_sint64 = 26; - repeated bool rep_bool = 27; - - repeated fixed32 rep_fixed32 = 28; - repeated sfixed32 rep_sfixed32= 29; - repeated float rep_float = 30; - - repeated fixed64 rep_fixed64 = 10031; - repeated sfixed64 rep_sfixed64= 10032; - repeated double rep_double = 10033; - - repeated string rep_string = 10034; - repeated bytes rep_bytes = 10035; - repeated SubMessage rep_submsg = 10036; - repeated MyEnum rep_enum = 10037; - repeated EmptyMessage rep_emptymsg = 10038; - - optional int32 opt_int32 = 10041 [default = 4041]; - optional int64 opt_int64 = 10042 [default = 4042]; - optional uint32 opt_uint32 = 10043 [default = 4043]; - optional uint64 opt_uint64 = 10044 [default = 4044]; - optional sint32 opt_sint32 = 10045 [default = 4045]; - optional sint64 opt_sint64 = 10046 [default = 4046]; - optional bool opt_bool = 10047 [default = false]; - - optional fixed32 opt_fixed32 = 10048 [default = 4048]; - optional sfixed32 opt_sfixed32= 10049 [default = 4049]; - optional float opt_float = 10050 [default = 4050]; - - optional fixed64 opt_fixed64 = 10051 [default = 4051]; - optional sfixed64 opt_sfixed64= 10052 [default = 4052]; - optional double opt_double = 10053 [default = 4053]; - - optional string opt_string = 10054 [default = "4054"]; - optional bytes opt_bytes = 10055 [default = "4055"]; - optional SubMessage opt_submsg = 10056; - optional MyEnum opt_enum = 10057 [default = Second]; - optional EmptyMessage opt_emptymsg = 10058; - - oneof oneof - { - SubMessage oneof_msg1 = 10059; - EmptyMessage oneof_msg2 = 10060; - } - - // Check that extreme integer values are handled correctly - required Limits req_limits = 98; - - // Just to make sure that the size of the fields has been calculated - // properly, i.e. otherwise a bug in last field might not be detected. - required int32 end = 10099; - - extensions 200 to 255; -} - diff --git a/third_party/nanopb/tests/field_size_32/SConscript b/third_party/nanopb/tests/field_size_32/SConscript deleted file mode 100644 index 0b8dc0e3a6b..00000000000 --- a/third_party/nanopb/tests/field_size_32/SConscript +++ /dev/null @@ -1,29 +0,0 @@ -# Run the alltypes test case, but compile with PB_FIELD_32BIT=1. -# Also the .proto file has been modified to have high indexes. - -Import("env") - -# Take copy of the files for custom build. -c = Copy("$TARGET", "$SOURCE") -env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c) -env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c) - -env.NanopbProto(["alltypes", "alltypes.options"]) - -# Define the compilation options -opts = env.Clone() -opts.Append(CPPDEFINES = {'PB_FIELD_32BIT': 1}) - -# Build new version of core -strict = opts.Clone() -strict.Append(CFLAGS = strict['CORECFLAGS']) -strict.Object("pb_decode_fields32.o", "$NANOPB/pb_decode.c") -strict.Object("pb_encode_fields32.o", "$NANOPB/pb_encode.c") -strict.Object("pb_common_fields32.o", "$NANOPB/pb_common.c") - -# Now build and run the test normally. -enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_fields32.o", "pb_common_fields32.o"]) -dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_fields32.o", "pb_common_fields32.o"]) - -env.RunTest(enc) -env.RunTest([dec, "encode_alltypes.output"]) diff --git a/third_party/nanopb/tests/field_size_32/alltypes.options b/third_party/nanopb/tests/field_size_32/alltypes.options deleted file mode 100644 index b31e3cf0a9d..00000000000 --- a/third_party/nanopb/tests/field_size_32/alltypes.options +++ /dev/null @@ -1,3 +0,0 @@ -* max_size:16 -* max_count:5 - diff --git a/third_party/nanopb/tests/field_size_32/alltypes.proto b/third_party/nanopb/tests/field_size_32/alltypes.proto deleted file mode 100644 index 02ee1a6a7fd..00000000000 --- a/third_party/nanopb/tests/field_size_32/alltypes.proto +++ /dev/null @@ -1,121 +0,0 @@ -syntax = "proto2"; - -message SubMessage { - required string substuff1 = 1 [default = "1"]; - required int32 substuff2 = 2 [default = 2]; - optional fixed32 substuff3 = 12365535 [default = 3]; -} - -message EmptyMessage { - -} - -enum HugeEnum { - Negative = -2147483647; /* protoc doesn't accept -2147483648 here */ - Positive = 2147483647; -} - -message Limits { - required int32 int32_min = 1; - required int32 int32_max = 2; - required uint32 uint32_min = 3; - required uint32 uint32_max = 4; - required int64 int64_min = 5; - required int64 int64_max = 6; - required uint64 uint64_min = 7; - required uint64 uint64_max = 8; - required HugeEnum enum_min = 9; - required HugeEnum enum_max = 10; -} - -enum MyEnum { - Zero = 0; - First = 1; - Second = 2; - Truth = 42; -} - -message AllTypes { - required int32 req_int32 = 1; - required int64 req_int64 = 2; - required uint32 req_uint32 = 3; - required uint64 req_uint64 = 4; - required sint32 req_sint32 = 5; - required sint64 req_sint64 = 6; - required bool req_bool = 7; - - required fixed32 req_fixed32 = 8; - required sfixed32 req_sfixed32= 9; - required float req_float = 10; - - required fixed64 req_fixed64 = 11; - required sfixed64 req_sfixed64= 12; - required double req_double = 13; - - required string req_string = 14; - required bytes req_bytes = 15; - required SubMessage req_submsg = 16; - required MyEnum req_enum = 17; - required EmptyMessage req_emptymsg = 18; - - - repeated int32 rep_int32 = 21; - repeated int64 rep_int64 = 22; - repeated uint32 rep_uint32 = 23; - repeated uint64 rep_uint64 = 24; - repeated sint32 rep_sint32 = 25; - repeated sint64 rep_sint64 = 26; - repeated bool rep_bool = 27; - - repeated fixed32 rep_fixed32 = 28; - repeated sfixed32 rep_sfixed32= 29; - repeated float rep_float = 30; - - repeated fixed64 rep_fixed64 = 10031; - repeated sfixed64 rep_sfixed64= 10032; - repeated double rep_double = 10033; - - repeated string rep_string = 10034; - repeated bytes rep_bytes = 10035; - repeated SubMessage rep_submsg = 10036; - repeated MyEnum rep_enum = 10037; - repeated EmptyMessage rep_emptymsg = 10038; - - optional int32 opt_int32 = 10041 [default = 4041]; - optional int64 opt_int64 = 10042 [default = 4042]; - optional uint32 opt_uint32 = 10043 [default = 4043]; - optional uint64 opt_uint64 = 10044 [default = 4044]; - optional sint32 opt_sint32 = 10045 [default = 4045]; - optional sint64 opt_sint64 = 10046 [default = 4046]; - optional bool opt_bool = 10047 [default = false]; - - optional fixed32 opt_fixed32 = 10048 [default = 4048]; - optional sfixed32 opt_sfixed32= 10049 [default = 4049]; - optional float opt_float = 10050 [default = 4050]; - - optional fixed64 opt_fixed64 = 10051 [default = 4051]; - optional sfixed64 opt_sfixed64= 10052 [default = 4052]; - optional double opt_double = 10053 [default = 4053]; - - optional string opt_string = 10054 [default = "4054"]; - optional bytes opt_bytes = 10055 [default = "4055"]; - optional SubMessage opt_submsg = 10056; - optional MyEnum opt_enum = 10057 [default = Second]; - optional EmptyMessage opt_emptymsg = 10058; - - oneof oneof - { - SubMessage oneof_msg1 = 10059; - EmptyMessage oneof_msg2 = 10060; - } - - // Check that extreme integer values are handled correctly - required Limits req_limits = 98; - - // Just to make sure that the size of the fields has been calculated - // properly, i.e. otherwise a bug in last field might not be detected. - required int32 end = 13432099; - - extensions 200 to 255; -} - diff --git a/third_party/nanopb/tests/fuzztest/SConscript b/third_party/nanopb/tests/fuzztest/SConscript deleted file mode 100644 index d2fb689c39f..00000000000 --- a/third_party/nanopb/tests/fuzztest/SConscript +++ /dev/null @@ -1,43 +0,0 @@ -# Run a fuzz test to verify robustness against corrupted/malicious data. - -Import("env", "malloc_env") - -def set_pkgname(src, dst, pkgname): - data = open(str(src)).read() - placeholder = '// package name placeholder' - assert placeholder in data - data = data.replace(placeholder, 'package %s;' % pkgname) - open(str(dst), 'w').write(data) - -# We want both pointer and static versions of the AllTypes message -# Prefix them with package name. -env.Command("alltypes_static.proto", "#alltypes/alltypes.proto", - lambda target, source, env: set_pkgname(source[0], target[0], 'alltypes_static')) -env.Command("alltypes_pointer.proto", "#alltypes/alltypes.proto", - lambda target, source, env: set_pkgname(source[0], target[0], 'alltypes_pointer')) - -p1 = env.NanopbProto(["alltypes_pointer", "alltypes_pointer.options"]) -p2 = env.NanopbProto(["alltypes_static", "alltypes_static.options"]) -fuzz = malloc_env.Program(["fuzztest.c", - "alltypes_pointer.pb.c", - "alltypes_static.pb.c", - "$COMMON/pb_encode_with_malloc.o", - "$COMMON/pb_decode_with_malloc.o", - "$COMMON/pb_common_with_malloc.o", - "$COMMON/malloc_wrappers.o"]) - -env.RunTest(fuzz) - -fuzzstub = malloc_env.Program(["fuzzstub.c", - "alltypes_pointer.pb.c", - "alltypes_static.pb.c", - "$COMMON/pb_encode_with_malloc.o", - "$COMMON/pb_decode_with_malloc.o", - "$COMMON/pb_common_with_malloc.o", - "$COMMON/malloc_wrappers.o"]) - -generate_message = malloc_env.Program(["generate_message.c", - "alltypes_static.pb.c", - "$COMMON/pb_encode.o", - "$COMMON/pb_common.o"]) - diff --git a/third_party/nanopb/tests/fuzztest/alltypes_pointer.options b/third_party/nanopb/tests/fuzztest/alltypes_pointer.options deleted file mode 100644 index 52abeb7fec9..00000000000 --- a/third_party/nanopb/tests/fuzztest/alltypes_pointer.options +++ /dev/null @@ -1,3 +0,0 @@ -# Generate all fields as pointers. -* type:FT_POINTER - diff --git a/third_party/nanopb/tests/fuzztest/alltypes_static.options b/third_party/nanopb/tests/fuzztest/alltypes_static.options deleted file mode 100644 index 1c10637c31b..00000000000 --- a/third_party/nanopb/tests/fuzztest/alltypes_static.options +++ /dev/null @@ -1,3 +0,0 @@ -* max_size:32 -* max_count:8 -*.extensions type:FT_IGNORE diff --git a/third_party/nanopb/tests/fuzztest/fuzzstub.c b/third_party/nanopb/tests/fuzztest/fuzzstub.c deleted file mode 100644 index ec9e2afefb0..00000000000 --- a/third_party/nanopb/tests/fuzztest/fuzzstub.c +++ /dev/null @@ -1,189 +0,0 @@ -/* Fuzz testing for the nanopb core. - * This can be used with external fuzzers, e.g. radamsa. - * It performs most of the same checks as fuzztest, but does not feature data generation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "alltypes_static.pb.h" -#include "alltypes_pointer.pb.h" - -#define BUFSIZE 4096 - -static bool do_static_decode(uint8_t *buffer, size_t msglen, bool assert_success) -{ - pb_istream_t stream; - bool status; - - alltypes_static_AllTypes *msg = malloc_with_check(sizeof(alltypes_static_AllTypes)); - stream = pb_istream_from_buffer(buffer, msglen); - status = pb_decode(&stream, alltypes_static_AllTypes_fields, msg); - - if (!status && assert_success) - { - /* Anything that was successfully encoded, should be decodeable. - * One exception: strings without null terminator are encoded up - * to end of buffer, but refused on decode because the terminator - * would not fit. */ - if (strcmp(stream.errmsg, "string overflow") != 0) - assert(status); - } - - free_with_check(msg); - return status; -} - -static bool do_pointer_decode(uint8_t *buffer, size_t msglen, bool assert_success) -{ - pb_istream_t stream; - bool status; - alltypes_pointer_AllTypes *msg; - - msg = malloc_with_check(sizeof(alltypes_pointer_AllTypes)); - memset(msg, 0, sizeof(alltypes_pointer_AllTypes)); - stream = pb_istream_from_buffer(buffer, msglen); - - assert(get_alloc_count() == 0); - status = pb_decode(&stream, alltypes_pointer_AllTypes_fields, msg); - - if (assert_success) - assert(status); - - pb_release(alltypes_pointer_AllTypes_fields, msg); - assert(get_alloc_count() == 0); - - free_with_check(msg); - - return status; -} - -/* Do a decode -> encode -> decode -> encode roundtrip */ -static void do_static_roundtrip(uint8_t *buffer, size_t msglen) -{ - bool status; - uint8_t *buf2 = malloc_with_check(BUFSIZE); - uint8_t *buf3 = malloc_with_check(BUFSIZE); - size_t msglen2, msglen3; - alltypes_static_AllTypes *msg1 = malloc_with_check(sizeof(alltypes_static_AllTypes)); - alltypes_static_AllTypes *msg2 = malloc_with_check(sizeof(alltypes_static_AllTypes)); - memset(msg1, 0, sizeof(alltypes_static_AllTypes)); - memset(msg2, 0, sizeof(alltypes_static_AllTypes)); - - { - pb_istream_t stream = pb_istream_from_buffer(buffer, msglen); - status = pb_decode(&stream, alltypes_static_AllTypes_fields, msg1); - assert(status); - } - - { - pb_ostream_t stream = pb_ostream_from_buffer(buf2, BUFSIZE); - status = pb_encode(&stream, alltypes_static_AllTypes_fields, msg1); - assert(status); - msglen2 = stream.bytes_written; - } - - { - pb_istream_t stream = pb_istream_from_buffer(buf2, msglen2); - status = pb_decode(&stream, alltypes_static_AllTypes_fields, msg2); - assert(status); - } - - { - pb_ostream_t stream = pb_ostream_from_buffer(buf3, BUFSIZE); - status = pb_encode(&stream, alltypes_static_AllTypes_fields, msg2); - assert(status); - msglen3 = stream.bytes_written; - } - - assert(msglen2 == msglen3); - assert(memcmp(buf2, buf3, msglen2) == 0); - - free_with_check(msg1); - free_with_check(msg2); - free_with_check(buf2); - free_with_check(buf3); -} - -/* Do decode -> encode -> decode -> encode roundtrip */ -static void do_pointer_roundtrip(uint8_t *buffer, size_t msglen) -{ - bool status; - uint8_t *buf2 = malloc_with_check(BUFSIZE); - uint8_t *buf3 = malloc_with_check(BUFSIZE); - size_t msglen2, msglen3; - alltypes_pointer_AllTypes *msg1 = malloc_with_check(sizeof(alltypes_pointer_AllTypes)); - alltypes_pointer_AllTypes *msg2 = malloc_with_check(sizeof(alltypes_pointer_AllTypes)); - memset(msg1, 0, sizeof(alltypes_pointer_AllTypes)); - memset(msg2, 0, sizeof(alltypes_pointer_AllTypes)); - - { - pb_istream_t stream = pb_istream_from_buffer(buffer, msglen); - status = pb_decode(&stream, alltypes_pointer_AllTypes_fields, msg1); - assert(status); - } - - { - pb_ostream_t stream = pb_ostream_from_buffer(buf2, BUFSIZE); - status = pb_encode(&stream, alltypes_pointer_AllTypes_fields, msg1); - assert(status); - msglen2 = stream.bytes_written; - } - - { - pb_istream_t stream = pb_istream_from_buffer(buf2, msglen2); - status = pb_decode(&stream, alltypes_pointer_AllTypes_fields, msg2); - assert(status); - } - - { - pb_ostream_t stream = pb_ostream_from_buffer(buf3, BUFSIZE); - status = pb_encode(&stream, alltypes_pointer_AllTypes_fields, msg2); - assert(status); - msglen3 = stream.bytes_written; - } - - assert(msglen2 == msglen3); - assert(memcmp(buf2, buf3, msglen2) == 0); - - pb_release(alltypes_pointer_AllTypes_fields, msg1); - pb_release(alltypes_pointer_AllTypes_fields, msg2); - free_with_check(msg1); - free_with_check(msg2); - free_with_check(buf2); - free_with_check(buf3); -} - -static void run_iteration() -{ - uint8_t *buffer = malloc_with_check(BUFSIZE); - size_t msglen; - bool status; - - msglen = fread(buffer, 1, BUFSIZE, stdin); - - status = do_static_decode(buffer, msglen, false); - - if (status) - do_static_roundtrip(buffer, msglen); - - status = do_pointer_decode(buffer, msglen, false); - - if (status) - do_pointer_roundtrip(buffer, msglen); - - free_with_check(buffer); -} - -int main(int argc, char **argv) -{ - run_iteration(); - - return 0; -} - diff --git a/third_party/nanopb/tests/fuzztest/fuzztest.c b/third_party/nanopb/tests/fuzztest/fuzztest.c deleted file mode 100644 index ee851ec0892..00000000000 --- a/third_party/nanopb/tests/fuzztest/fuzztest.c +++ /dev/null @@ -1,432 +0,0 @@ -/* Fuzz testing for the nanopb core. - * Attempts to verify all the properties defined in the security model document. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "alltypes_static.pb.h" -#include "alltypes_pointer.pb.h" - -static uint64_t random_seed; - -/* Uses xorshift64 here instead of rand() for both speed and - * reproducibility across platforms. */ -static uint32_t rand_word() -{ - random_seed ^= random_seed >> 12; - random_seed ^= random_seed << 25; - random_seed ^= random_seed >> 27; - return random_seed * 2685821657736338717ULL; -} - -/* Get a random integer in range, with approximately flat distribution. */ -static int rand_int(int min, int max) -{ - return rand_word() % (max + 1 - min) + min; -} - -static bool rand_bool() -{ - return rand_word() & 1; -} - -/* Get a random byte, with skewed distribution. - * Important corner cases like 0xFF, 0x00 and 0xFE occur more - * often than other values. */ -static uint8_t rand_byte() -{ - uint32_t w = rand_word(); - uint8_t b = w & 0xFF; - if (w & 0x100000) - b >>= (w >> 8) & 7; - if (w & 0x200000) - b <<= (w >> 12) & 7; - if (w & 0x400000) - b ^= 0xFF; - return b; -} - -/* Get a random length, with skewed distribution. - * Favors the shorter lengths, but always atleast 1. */ -static size_t rand_len(size_t max) -{ - uint32_t w = rand_word(); - size_t s; - if (w & 0x800000) - w &= 3; - else if (w & 0x400000) - w &= 15; - else if (w & 0x200000) - w &= 255; - - s = (w % max); - if (s == 0) - s = 1; - - return s; -} - -/* Fills a buffer with random data with skewed distribution. */ -static void rand_fill(uint8_t *buf, size_t count) -{ - while (count--) - *buf++ = rand_byte(); -} - -/* Fill with random protobuf-like data */ -static size_t rand_fill_protobuf(uint8_t *buf, size_t min_bytes, size_t max_bytes, int min_tag) -{ - pb_ostream_t stream = pb_ostream_from_buffer(buf, max_bytes); - - while(stream.bytes_written < min_bytes) - { - pb_wire_type_t wt = rand_int(0, 3); - if (wt == 3) wt = 5; /* Gap in values */ - - if (!pb_encode_tag(&stream, wt, rand_int(min_tag, min_tag + 512))) - break; - - if (wt == PB_WT_VARINT) - { - uint64_t value; - rand_fill((uint8_t*)&value, sizeof(value)); - pb_encode_varint(&stream, value); - } - else if (wt == PB_WT_64BIT) - { - uint64_t value; - rand_fill((uint8_t*)&value, sizeof(value)); - pb_encode_fixed64(&stream, &value); - } - else if (wt == PB_WT_32BIT) - { - uint32_t value; - rand_fill((uint8_t*)&value, sizeof(value)); - pb_encode_fixed32(&stream, &value); - } - else if (wt == PB_WT_STRING) - { - size_t len; - uint8_t *buf; - - if (min_bytes > stream.bytes_written) - len = rand_len(min_bytes - stream.bytes_written); - else - len = 0; - - buf = malloc(len); - pb_encode_varint(&stream, len); - rand_fill(buf, len); - pb_write(&stream, buf, len); - free(buf); - } - } - - return stream.bytes_written; -} - -/* Given a buffer of data, mess it up a bit */ -static void rand_mess(uint8_t *buf, size_t count) -{ - int m = rand_int(0, 3); - - if (m == 0) - { - /* Replace random substring */ - int s = rand_int(0, count - 1); - int l = rand_len(count - s); - rand_fill(buf + s, l); - } - else if (m == 1) - { - /* Swap random bytes */ - int a = rand_int(0, count - 1); - int b = rand_int(0, count - 1); - int x = buf[a]; - buf[a] = buf[b]; - buf[b] = x; - } - else if (m == 2) - { - /* Duplicate substring */ - int s = rand_int(0, count - 2); - int l = rand_len((count - s) / 2); - memcpy(buf + s + l, buf + s, l); - } - else if (m == 3) - { - /* Add random protobuf noise */ - int s = rand_int(0, count - 1); - int l = rand_len(count - s); - rand_fill_protobuf(buf + s, l, count - s, 1); - } -} - -/* Some default data to put in the message */ -static const alltypes_static_AllTypes initval = alltypes_static_AllTypes_init_default; - -#define BUFSIZE 4096 - -static bool do_static_encode(uint8_t *buffer, size_t *msglen) -{ - pb_ostream_t stream; - bool status; - - /* Allocate a message and fill it with defaults */ - alltypes_static_AllTypes *msg = malloc_with_check(sizeof(alltypes_static_AllTypes)); - memcpy(msg, &initval, sizeof(initval)); - - /* Apply randomness to the data before encoding */ - while (rand_int(0, 7)) - rand_mess((uint8_t*)msg, sizeof(alltypes_static_AllTypes)); - - stream = pb_ostream_from_buffer(buffer, BUFSIZE); - status = pb_encode(&stream, alltypes_static_AllTypes_fields, msg); - assert(stream.bytes_written <= BUFSIZE); - assert(stream.bytes_written <= alltypes_static_AllTypes_size); - - *msglen = stream.bytes_written; - pb_release(alltypes_static_AllTypes_fields, msg); - free_with_check(msg); - - return status; -} - -/* Append or prepend protobuf noise */ -static void do_protobuf_noise(uint8_t *buffer, size_t *msglen) -{ - int m = rand_int(0, 2); - size_t max_size = BUFSIZE - 32 - *msglen; - if (m == 1) - { - /* Prepend */ - uint8_t *tmp = malloc_with_check(BUFSIZE); - size_t s = rand_fill_protobuf(tmp, rand_len(max_size), BUFSIZE - *msglen, 512); - memmove(buffer + s, buffer, *msglen); - memcpy(buffer, tmp, s); - free_with_check(tmp); - *msglen += s; - } - else if (m == 2) - { - /* Append */ - size_t s = rand_fill_protobuf(buffer + *msglen, rand_len(max_size), BUFSIZE - *msglen, 512); - *msglen += s; - } -} - -static bool do_static_decode(uint8_t *buffer, size_t msglen, bool assert_success) -{ - pb_istream_t stream; - bool status; - - alltypes_static_AllTypes *msg = malloc_with_check(sizeof(alltypes_static_AllTypes)); - rand_fill((uint8_t*)msg, sizeof(alltypes_static_AllTypes)); - stream = pb_istream_from_buffer(buffer, msglen); - status = pb_decode(&stream, alltypes_static_AllTypes_fields, msg); - - if (!status && assert_success) - { - /* Anything that was successfully encoded, should be decodeable. - * One exception: strings without null terminator are encoded up - * to end of buffer, but refused on decode because the terminator - * would not fit. */ - if (strcmp(stream.errmsg, "string overflow") != 0) - assert(status); - } - - free_with_check(msg); - return status; -} - -static bool do_pointer_decode(uint8_t *buffer, size_t msglen, bool assert_success) -{ - pb_istream_t stream; - bool status; - alltypes_pointer_AllTypes *msg; - - msg = malloc_with_check(sizeof(alltypes_pointer_AllTypes)); - memset(msg, 0, sizeof(alltypes_pointer_AllTypes)); - stream = pb_istream_from_buffer(buffer, msglen); - - assert(get_alloc_count() == 0); - status = pb_decode(&stream, alltypes_pointer_AllTypes_fields, msg); - - if (assert_success) - assert(status); - - pb_release(alltypes_pointer_AllTypes_fields, msg); - assert(get_alloc_count() == 0); - - free_with_check(msg); - - return status; -} - -/* Do a decode -> encode -> decode -> encode roundtrip */ -static void do_static_roundtrip(uint8_t *buffer, size_t msglen) -{ - bool status; - uint8_t *buf2 = malloc_with_check(BUFSIZE); - uint8_t *buf3 = malloc_with_check(BUFSIZE); - size_t msglen2, msglen3; - alltypes_static_AllTypes *msg1 = malloc_with_check(sizeof(alltypes_static_AllTypes)); - alltypes_static_AllTypes *msg2 = malloc_with_check(sizeof(alltypes_static_AllTypes)); - memset(msg1, 0, sizeof(alltypes_static_AllTypes)); - memset(msg2, 0, sizeof(alltypes_static_AllTypes)); - - { - pb_istream_t stream = pb_istream_from_buffer(buffer, msglen); - status = pb_decode(&stream, alltypes_static_AllTypes_fields, msg1); - assert(status); - } - - { - pb_ostream_t stream = pb_ostream_from_buffer(buf2, BUFSIZE); - status = pb_encode(&stream, alltypes_static_AllTypes_fields, msg1); - assert(status); - msglen2 = stream.bytes_written; - } - - { - pb_istream_t stream = pb_istream_from_buffer(buf2, msglen2); - status = pb_decode(&stream, alltypes_static_AllTypes_fields, msg2); - assert(status); - } - - { - pb_ostream_t stream = pb_ostream_from_buffer(buf3, BUFSIZE); - status = pb_encode(&stream, alltypes_static_AllTypes_fields, msg2); - assert(status); - msglen3 = stream.bytes_written; - } - - assert(msglen2 == msglen3); - assert(memcmp(buf2, buf3, msglen2) == 0); - - free_with_check(msg1); - free_with_check(msg2); - free_with_check(buf2); - free_with_check(buf3); -} - -/* Do decode -> encode -> decode -> encode roundtrip */ -static void do_pointer_roundtrip(uint8_t *buffer, size_t msglen) -{ - bool status; - uint8_t *buf2 = malloc_with_check(BUFSIZE); - uint8_t *buf3 = malloc_with_check(BUFSIZE); - size_t msglen2, msglen3; - alltypes_pointer_AllTypes *msg1 = malloc_with_check(sizeof(alltypes_pointer_AllTypes)); - alltypes_pointer_AllTypes *msg2 = malloc_with_check(sizeof(alltypes_pointer_AllTypes)); - memset(msg1, 0, sizeof(alltypes_pointer_AllTypes)); - memset(msg2, 0, sizeof(alltypes_pointer_AllTypes)); - - { - pb_istream_t stream = pb_istream_from_buffer(buffer, msglen); - status = pb_decode(&stream, alltypes_pointer_AllTypes_fields, msg1); - assert(status); - } - - { - pb_ostream_t stream = pb_ostream_from_buffer(buf2, BUFSIZE); - status = pb_encode(&stream, alltypes_pointer_AllTypes_fields, msg1); - assert(status); - msglen2 = stream.bytes_written; - } - - { - pb_istream_t stream = pb_istream_from_buffer(buf2, msglen2); - status = pb_decode(&stream, alltypes_pointer_AllTypes_fields, msg2); - assert(status); - } - - { - pb_ostream_t stream = pb_ostream_from_buffer(buf3, BUFSIZE); - status = pb_encode(&stream, alltypes_pointer_AllTypes_fields, msg2); - assert(status); - msglen3 = stream.bytes_written; - } - - assert(msglen2 == msglen3); - assert(memcmp(buf2, buf3, msglen2) == 0); - - pb_release(alltypes_pointer_AllTypes_fields, msg1); - pb_release(alltypes_pointer_AllTypes_fields, msg2); - free_with_check(msg1); - free_with_check(msg2); - free_with_check(buf2); - free_with_check(buf3); -} - -static void run_iteration() -{ - uint8_t *buffer = malloc_with_check(BUFSIZE); - size_t msglen; - bool status; - - rand_fill(buffer, BUFSIZE); - - if (do_static_encode(buffer, &msglen)) - { - do_protobuf_noise(buffer, &msglen); - - status = do_static_decode(buffer, msglen, true); - - if (status) - do_static_roundtrip(buffer, msglen); - - status = do_pointer_decode(buffer, msglen, true); - - if (status) - do_pointer_roundtrip(buffer, msglen); - - /* Apply randomness to the encoded data */ - while (rand_bool()) - rand_mess(buffer, BUFSIZE); - - /* Apply randomness to encoded data length */ - if (rand_bool()) - msglen = rand_int(0, BUFSIZE); - - status = do_static_decode(buffer, msglen, false); - do_pointer_decode(buffer, msglen, status); - - if (status) - { - do_static_roundtrip(buffer, msglen); - do_pointer_roundtrip(buffer, msglen); - } - } - - free_with_check(buffer); -} - -int main(int argc, char **argv) -{ - int i; - if (argc > 1) - { - random_seed = atol(argv[1]); - } - else - { - random_seed = time(NULL); - } - - fprintf(stderr, "Random seed: %llu\n", (long long unsigned)random_seed); - - for (i = 0; i < 10000; i++) - { - run_iteration(); - } - - return 0; -} - diff --git a/third_party/nanopb/tests/fuzztest/generate_message.c b/third_party/nanopb/tests/fuzztest/generate_message.c deleted file mode 100644 index 6e49299056e..00000000000 --- a/third_party/nanopb/tests/fuzztest/generate_message.c +++ /dev/null @@ -1,101 +0,0 @@ -/* Generates a random, valid protobuf message. Useful to seed - * external fuzzers such as afl-fuzz. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "alltypes_static.pb.h" - -static uint64_t random_seed; - -/* Uses xorshift64 here instead of rand() for both speed and - * reproducibility across platforms. */ -static uint32_t rand_word() -{ - random_seed ^= random_seed >> 12; - random_seed ^= random_seed << 25; - random_seed ^= random_seed >> 27; - return random_seed * 2685821657736338717ULL; -} - -/* Fills a buffer with random data. */ -static void rand_fill(uint8_t *buf, size_t count) -{ - while (count--) - { - *buf++ = rand_word() & 0xff; - } -} - -/* Check that size/count fields do not exceed their max size. - * Otherwise we would have to loop pretty long in generate_message(). - * Note that there may still be a few encoding errors from submessages. - */ -static void limit_sizes(alltypes_static_AllTypes *msg) -{ - pb_field_iter_t iter; - pb_field_iter_begin(&iter, alltypes_static_AllTypes_fields, msg); - while (pb_field_iter_next(&iter)) - { - if (PB_LTYPE(iter.pos->type) == PB_LTYPE_BYTES) - { - ((pb_bytes_array_t*)iter.pData)->size %= iter.pos->data_size - PB_BYTES_ARRAY_T_ALLOCSIZE(0); - } - - if (PB_HTYPE(iter.pos->type) == PB_HTYPE_REPEATED) - { - *((pb_size_t*)iter.pSize) %= iter.pos->array_size; - } - - if (PB_HTYPE(iter.pos->type) == PB_HTYPE_ONEOF) - { - /* Set the oneof to this message type with 50% chance. */ - if (rand_word() & 1) - { - *((pb_size_t*)iter.pSize) = iter.pos->tag; - } - } - } -} - -static void generate_message() -{ - alltypes_static_AllTypes msg; - uint8_t buf[8192]; - pb_ostream_t stream = {0}; - - do { - if (stream.errmsg) - fprintf(stderr, "Encoder error: %s\n", stream.errmsg); - - stream = pb_ostream_from_buffer(buf, sizeof(buf)); - rand_fill((void*)&msg, sizeof(msg)); - limit_sizes(&msg); - } while (!pb_encode(&stream, alltypes_static_AllTypes_fields, &msg)); - - fwrite(buf, 1, stream.bytes_written, stdout); -} - -int main(int argc, char **argv) -{ - if (argc > 1) - { - random_seed = atol(argv[1]); - } - else - { - random_seed = time(NULL); - } - - fprintf(stderr, "Random seed: %llu\n", (long long unsigned)random_seed); - - generate_message(); - - return 0; -} - diff --git a/third_party/nanopb/tests/fuzztest/run_radamsa.sh b/third_party/nanopb/tests/fuzztest/run_radamsa.sh deleted file mode 100755 index 52cd40a8690..00000000000 --- a/third_party/nanopb/tests/fuzztest/run_radamsa.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -TMP=`tempfile` - -echo $TMP -while true -do - radamsa sample_data/* > $TMP - $1 < $TMP - test $? -gt 127 && break -done - diff --git a/third_party/nanopb/tests/inline/SConscript b/third_party/nanopb/tests/inline/SConscript deleted file mode 100644 index 34371fda18d..00000000000 --- a/third_party/nanopb/tests/inline/SConscript +++ /dev/null @@ -1,16 +0,0 @@ -# Test that inlined bytes fields work. - -Import("env") - -env.NanopbProto("inline") -env.Object("inline.pb.c") - -env.Match(["inline.pb.h", "inline.expected"]) - -p = env.Program(["inline_unittests.c", - "inline.pb.c", - "$COMMON/pb_encode.o", - "$COMMON/pb_decode.o", - "$COMMON/pb_common.o"]) - -env.RunTest(p) diff --git a/third_party/nanopb/tests/inline/inline.expected b/third_party/nanopb/tests/inline/inline.expected deleted file mode 100644 index 593e972bac9..00000000000 --- a/third_party/nanopb/tests/inline/inline.expected +++ /dev/null @@ -1,3 +0,0 @@ -pb_byte_t data\[32\]; -bool has_data; -pb_byte_t data\[64\]; diff --git a/third_party/nanopb/tests/inline/inline.proto b/third_party/nanopb/tests/inline/inline.proto deleted file mode 100644 index 6e511f0a256..00000000000 --- a/third_party/nanopb/tests/inline/inline.proto +++ /dev/null @@ -1,17 +0,0 @@ -/* Test nanopb option parsing. - * options.expected lists the patterns that are searched for in the output. - */ - -syntax = "proto2"; - -import "nanopb.proto"; - -message Message1 -{ - required bytes data = 1 [(nanopb).type = FT_INLINE, (nanopb).max_size = 32]; -} - -message Message2 -{ - optional bytes data = 1 [(nanopb).type = FT_INLINE, (nanopb).max_size = 64]; -} diff --git a/third_party/nanopb/tests/inline/inline_unittests.c b/third_party/nanopb/tests/inline/inline_unittests.c deleted file mode 100644 index b5834c7e029..00000000000 --- a/third_party/nanopb/tests/inline/inline_unittests.c +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include -#include -#include -#include "unittests.h" -#include "inline.pb.h" - -int main() -{ - int status = 0; - int i = 0; - COMMENT("Test inline byte fields"); - - { - Message1 msg1 = Message1_init_zero; - TEST(sizeof(msg1.data) == 32); - } - - { - Message1 msg1 = Message1_init_zero; - pb_byte_t msg1_buffer[Message1_size]; - pb_ostream_t ostream = pb_ostream_from_buffer(msg1_buffer, Message1_size); - Message1 msg1_deserialized = Message1_init_zero; - pb_istream_t istream = pb_istream_from_buffer(msg1_buffer, Message1_size); - - for (i = 0; i < 32; i++) { - msg1.data[i] = i; - } - - TEST(pb_encode(&ostream, Message1_fields, &msg1)); - TEST(ostream.bytes_written == Message1_size); - - TEST(pb_decode(&istream, Message1_fields, &msg1_deserialized)); - - TEST(istream.bytes_left == 0); - TEST(memcmp(&msg1_deserialized, &msg1, sizeof(msg1)) == 0); - } - - { - Message2 msg2 = {true, {0}}; - Message2 msg2_no_data = {false, {1}}; - pb_byte_t msg2_buffer[Message2_size]; - pb_ostream_t ostream = pb_ostream_from_buffer(msg2_buffer, Message2_size); - Message2 msg2_deserialized = Message2_init_zero; - pb_istream_t istream = pb_istream_from_buffer(msg2_buffer, Message2_size); - - for (i = 0; i < 64; i++) { - msg2.data[i] = i; - } - - TEST(pb_encode(&ostream, Message2_fields, &msg2)); - TEST(ostream.bytes_written == Message2_size); - - TEST(pb_decode(&istream, Message2_fields, &msg2_deserialized)); - - TEST(istream.bytes_left == 0); - TEST(memcmp(&msg2_deserialized, &msg2, sizeof(msg2)) == 0); - TEST(msg2_deserialized.has_data); - - memset(msg2_buffer, 0, sizeof(msg2_buffer)); - ostream = pb_ostream_from_buffer(msg2_buffer, Message2_size); - TEST(pb_encode(&ostream, Message2_fields, &msg2_no_data)); - istream = pb_istream_from_buffer(msg2_buffer, Message2_size); - TEST(pb_decode(&istream, Message2_fields, &msg2_deserialized)); - TEST(!msg2_deserialized.has_data); - TEST(memcmp(&msg2_deserialized, &msg2, sizeof(msg2)) != 0); - } - - if (status != 0) - fprintf(stdout, "\n\nSome tests FAILED!\n"); - - return status; -} diff --git a/third_party/nanopb/tests/intsizes/SConscript b/third_party/nanopb/tests/intsizes/SConscript deleted file mode 100644 index a90680bcfc0..00000000000 --- a/third_party/nanopb/tests/intsizes/SConscript +++ /dev/null @@ -1,12 +0,0 @@ -# Test that the int_size option in .proto works. - -Import('env') - -env.NanopbProto('intsizes') - -p = env.Program(["intsizes_unittests.c", - "intsizes.pb.c", - "$COMMON/pb_encode.o", - "$COMMON/pb_decode.o", - "$COMMON/pb_common.o"]) -env.RunTest(p) diff --git a/third_party/nanopb/tests/intsizes/intsizes.proto b/third_party/nanopb/tests/intsizes/intsizes.proto deleted file mode 100644 index 91444d41d68..00000000000 --- a/third_party/nanopb/tests/intsizes/intsizes.proto +++ /dev/null @@ -1,41 +0,0 @@ -/* Test the integer size overriding in nanopb options. - * This allows to use 8- and 16-bit integer variables, which are not supported - * directly by Google Protobuf. - * - * The int_size setting will override the number of bits, but keep the type - * otherwise. E.g. uint32 + IS_8 => uint8_t - */ - -syntax = "proto2"; - -import 'nanopb.proto'; - -message IntSizes { - required int32 req_int8 = 1 [(nanopb).int_size = IS_8]; - required uint32 req_uint8 = 2 [(nanopb).int_size = IS_8]; - required sint32 req_sint8 = 3 [(nanopb).int_size = IS_8]; - required int32 req_int16 = 4 [(nanopb).int_size = IS_16]; - required uint32 req_uint16 = 5 [(nanopb).int_size = IS_16]; - required sint32 req_sint16 = 6 [(nanopb).int_size = IS_16]; - required int32 req_int32 = 7 [(nanopb).int_size = IS_32]; - required uint32 req_uint32 = 8 [(nanopb).int_size = IS_32]; - required sint32 req_sint32 = 9 [(nanopb).int_size = IS_32]; - required int32 req_int64 = 10 [(nanopb).int_size = IS_64]; - required uint32 req_uint64 = 11 [(nanopb).int_size = IS_64]; - required sint32 req_sint64 = 12 [(nanopb).int_size = IS_64]; -} - -message DefaultSizes { - required int32 req_int8 = 1 ; - required uint32 req_uint8 = 2 ; - required sint32 req_sint8 = 3 ; - required int32 req_int16 = 4 ; - required uint32 req_uint16 = 5 ; - required sint32 req_sint16 = 6 ; - required int32 req_int32 = 7 ; - required uint32 req_uint32 = 8 ; - required sint32 req_sint32 = 9 ; - required int64 req_int64 = 10; - required uint64 req_uint64 = 11; - required sint64 req_sint64 = 12; -} diff --git a/third_party/nanopb/tests/intsizes/intsizes_unittests.c b/third_party/nanopb/tests/intsizes/intsizes_unittests.c deleted file mode 100644 index 79ef0369672..00000000000 --- a/third_party/nanopb/tests/intsizes/intsizes_unittests.c +++ /dev/null @@ -1,122 +0,0 @@ -#include -#include -#include -#include -#include "unittests.h" -#include "intsizes.pb.h" - -#define S(x) pb_istream_from_buffer((uint8_t*)x, sizeof(x) - 1) - -/* This is a macro instead of function in order to get the actual values - * into the TEST() lines in output */ -#define TEST_ROUNDTRIP(int8, uint8, sint8, \ - int16, uint16, sint16, \ - int32, uint32, sint32, \ - int64, uint64, sint64, expected_result) \ -{ \ - uint8_t buffer1[128], buffer2[128]; \ - size_t msgsize; \ - DefaultSizes msg1 = DefaultSizes_init_zero; \ - IntSizes msg2 = IntSizes_init_zero; \ - \ - msg1.req_int8 = int8; \ - msg1.req_uint8 = uint8; \ - msg1.req_sint8 = sint8; \ - msg1.req_int16 = int16; \ - msg1.req_uint16 = uint16; \ - msg1.req_sint16 = sint16; \ - msg1.req_int32 = int32; \ - msg1.req_uint32 = uint32; \ - msg1.req_sint32 = sint32; \ - msg1.req_int64 = int64; \ - msg1.req_uint64 = uint64; \ - msg1.req_sint64 = sint64; \ - \ - { \ - pb_ostream_t s = pb_ostream_from_buffer(buffer1, sizeof(buffer1)); \ - TEST(pb_encode(&s, DefaultSizes_fields, &msg1)); \ - msgsize = s.bytes_written; \ - } \ - \ - { \ - pb_istream_t s = pb_istream_from_buffer(buffer1, msgsize); \ - TEST(pb_decode(&s, IntSizes_fields, &msg2) == expected_result); \ - if (expected_result) \ - { \ - TEST( (int64_t)msg2.req_int8 == int8); \ - TEST((uint64_t)msg2.req_uint8 == uint8); \ - TEST( (int64_t)msg2.req_sint8 == sint8); \ - TEST( (int64_t)msg2.req_int16 == int16); \ - TEST((uint64_t)msg2.req_uint16 == uint16); \ - TEST( (int64_t)msg2.req_sint16 == sint16); \ - TEST( (int64_t)msg2.req_int32 == int32); \ - TEST((uint64_t)msg2.req_uint32 == uint32); \ - TEST( (int64_t)msg2.req_sint32 == sint32); \ - TEST( (int64_t)msg2.req_int64 == int64); \ - TEST((uint64_t)msg2.req_uint64 == uint64); \ - TEST( (int64_t)msg2.req_sint64 == sint64); \ - } \ - } \ - \ - if (expected_result) \ - { \ - pb_ostream_t s = pb_ostream_from_buffer(buffer2, sizeof(buffer2)); \ - TEST(pb_encode(&s, IntSizes_fields, &msg2)); \ - TEST(s.bytes_written == msgsize); \ - TEST(memcmp(buffer1, buffer2, msgsize) == 0); \ - } \ -} - -int main() -{ - int status = 0; - - { - IntSizes msg = IntSizes_init_zero; - - COMMENT("Test field sizes"); - TEST(sizeof(msg.req_int8) == 1); - TEST(sizeof(msg.req_uint8) == 1); - TEST(sizeof(msg.req_sint8) == 1); - TEST(sizeof(msg.req_int16) == 2); - TEST(sizeof(msg.req_uint16) == 2); - TEST(sizeof(msg.req_sint16) == 2); - TEST(sizeof(msg.req_int32) == 4); - TEST(sizeof(msg.req_uint32) == 4); - TEST(sizeof(msg.req_sint32) == 4); - TEST(sizeof(msg.req_int64) == 8); - TEST(sizeof(msg.req_uint64) == 8); - TEST(sizeof(msg.req_sint64) == 8); - } - - COMMENT("Test roundtrip at maximum value"); - TEST_ROUNDTRIP(127, 255, 127, - 32767, 65535, 32767, - INT32_MAX, UINT32_MAX, INT32_MAX, - INT64_MAX, UINT64_MAX, INT64_MAX, true); - - COMMENT("Test roundtrip at minimum value"); - TEST_ROUNDTRIP(-128, 0, -128, - -32768, 0, -32768, - INT32_MIN, 0, INT32_MIN, - INT64_MIN, 0, INT64_MIN, true); - - COMMENT("Test overflow detection"); - TEST_ROUNDTRIP(-129, 0, -128, - -32768, 0, -32768, - INT32_MIN, 0, INT32_MIN, - INT64_MIN, 0, INT64_MIN, false); - TEST_ROUNDTRIP(127, 256, 127, - 32767, 65535, 32767, - INT32_MAX, UINT32_MAX, INT32_MAX, - INT64_MAX, UINT64_MAX, INT64_MAX, false); - TEST_ROUNDTRIP(-128, 0, -128, - -32768, 0, -32769, - INT32_MIN, 0, INT32_MIN, - INT64_MIN, 0, INT64_MIN, false); - - if (status != 0) - fprintf(stdout, "\n\nSome tests FAILED!\n"); - - return status; -} \ No newline at end of file diff --git a/third_party/nanopb/tests/io_errors/SConscript b/third_party/nanopb/tests/io_errors/SConscript deleted file mode 100644 index 60146cc09bb..00000000000 --- a/third_party/nanopb/tests/io_errors/SConscript +++ /dev/null @@ -1,15 +0,0 @@ -# Simulate io errors when encoding and decoding - -Import("env") - -c = Copy("$TARGET", "$SOURCE") -env.Command("alltypes.proto", "#alltypes/alltypes.proto", c) - -env.NanopbProto(["alltypes", "alltypes.options"]) - -ioerr = env.Program(["io_errors.c", "alltypes.pb.c", - "$COMMON/pb_encode.o", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"]) - -env.RunTest("io_errors.output", [ioerr, "$BUILD/alltypes/encode_alltypes.output"]) - - diff --git a/third_party/nanopb/tests/io_errors/alltypes.options b/third_party/nanopb/tests/io_errors/alltypes.options deleted file mode 100644 index b31e3cf0a9d..00000000000 --- a/third_party/nanopb/tests/io_errors/alltypes.options +++ /dev/null @@ -1,3 +0,0 @@ -* max_size:16 -* max_count:5 - diff --git a/third_party/nanopb/tests/io_errors/io_errors.c b/third_party/nanopb/tests/io_errors/io_errors.c deleted file mode 100644 index 76f35b08381..00000000000 --- a/third_party/nanopb/tests/io_errors/io_errors.c +++ /dev/null @@ -1,140 +0,0 @@ -/* Simulate IO errors after each byte in a stream. - * Verifies proper error propagation. - */ - -#include -#include -#include -#include "alltypes.pb.h" -#include "test_helpers.h" - -typedef struct -{ - uint8_t *buffer; - size_t fail_after; -} faulty_stream_t; - -bool read_callback(pb_istream_t *stream, uint8_t *buf, size_t count) -{ - faulty_stream_t *state = stream->state; - - while (count--) - { - if (state->fail_after == 0) - PB_RETURN_ERROR(stream, "simulated"); - state->fail_after--; - *buf++ = *state->buffer++; - } - - return true; -} -bool write_callback(pb_ostream_t *stream, const uint8_t *buf, size_t count) -{ - faulty_stream_t *state = stream->state; - - while (count--) - { - if (state->fail_after == 0) - PB_RETURN_ERROR(stream, "simulated"); - state->fail_after--; - *state->buffer++ = *buf++; - } - - return true; -} - -int main() -{ - uint8_t buffer[2048]; - size_t msglen; - AllTypes msg = AllTypes_init_zero; - - /* Get some base data to run the tests with */ - SET_BINARY_MODE(stdin); - msglen = fread(buffer, 1, sizeof(buffer), stdin); - - /* Test IO errors on decoding */ - { - bool status; - pb_istream_t stream = {&read_callback, NULL, SIZE_MAX}; - faulty_stream_t fs; - size_t i; - - for (i = 0; i < msglen; i++) - { - stream.bytes_left = msglen; - stream.state = &fs; - fs.buffer = buffer; - fs.fail_after = i; - - status = pb_decode(&stream, AllTypes_fields, &msg); - if (status != false) - { - fprintf(stderr, "Unexpected success in decode\n"); - return 2; - } - else if (strcmp(stream.errmsg, "simulated") != 0) - { - fprintf(stderr, "Wrong error in decode: %s\n", stream.errmsg); - return 3; - } - } - - stream.bytes_left = msglen; - stream.state = &fs; - fs.buffer = buffer; - fs.fail_after = msglen; - status = pb_decode(&stream, AllTypes_fields, &msg); - - if (!status) - { - fprintf(stderr, "Decoding failed: %s\n", stream.errmsg); - return 4; - } - } - - /* Test IO errors on encoding */ - { - bool status; - pb_ostream_t stream = {&write_callback, NULL, SIZE_MAX, 0}; - faulty_stream_t fs; - size_t i; - - for (i = 0; i < msglen; i++) - { - stream.max_size = msglen; - stream.bytes_written = 0; - stream.state = &fs; - fs.buffer = buffer; - fs.fail_after = i; - - status = pb_encode(&stream, AllTypes_fields, &msg); - if (status != false) - { - fprintf(stderr, "Unexpected success in encode\n"); - return 5; - } - else if (strcmp(stream.errmsg, "simulated") != 0) - { - fprintf(stderr, "Wrong error in encode: %s\n", stream.errmsg); - return 6; - } - } - - stream.max_size = msglen; - stream.bytes_written = 0; - stream.state = &fs; - fs.buffer = buffer; - fs.fail_after = msglen; - status = pb_encode(&stream, AllTypes_fields, &msg); - - if (!status) - { - fprintf(stderr, "Encoding failed: %s\n", stream.errmsg); - return 7; - } - } - - return 0; -} - diff --git a/third_party/nanopb/tests/io_errors_pointers/SConscript b/third_party/nanopb/tests/io_errors_pointers/SConscript deleted file mode 100644 index 03727df9c9f..00000000000 --- a/third_party/nanopb/tests/io_errors_pointers/SConscript +++ /dev/null @@ -1,26 +0,0 @@ -# Simulate io errors when encoding and decoding - -Import("env", "malloc_env") - -c = Copy("$TARGET", "$SOURCE") -env.Command("alltypes.proto", "#alltypes/alltypes.proto", c) -env.Command("io_errors.c", "#io_errors/io_errors.c", c) - -env.NanopbProto(["alltypes", "alltypes.options"]) - -ioerr = env.Program(["io_errors.c", "alltypes.pb.c", - "$COMMON/pb_encode_with_malloc.o", - "$COMMON/pb_decode_with_malloc.o", - "$COMMON/pb_common_with_malloc.o", - "$COMMON/malloc_wrappers.o"]) - -# Run tests under valgrind if available -valgrind = env.WhereIs('valgrind') -kwargs = {} -if valgrind: - kwargs['COMMAND'] = valgrind - kwargs['ARGS'] = ["-q", "--error-exitcode=99", ioerr[0].abspath] - -env.RunTest("io_errors.output", [ioerr, "$BUILD/alltypes/encode_alltypes.output"], **kwargs) - - diff --git a/third_party/nanopb/tests/io_errors_pointers/alltypes.options b/third_party/nanopb/tests/io_errors_pointers/alltypes.options deleted file mode 100644 index 52abeb7fec9..00000000000 --- a/third_party/nanopb/tests/io_errors_pointers/alltypes.options +++ /dev/null @@ -1,3 +0,0 @@ -# Generate all fields as pointers. -* type:FT_POINTER - diff --git a/third_party/nanopb/tests/mem_release/SConscript b/third_party/nanopb/tests/mem_release/SConscript deleted file mode 100644 index 6754e28509a..00000000000 --- a/third_party/nanopb/tests/mem_release/SConscript +++ /dev/null @@ -1,13 +0,0 @@ -Import("env", "malloc_env") - -env.NanopbProto("mem_release.proto") - -test = malloc_env.Program(["mem_release.c", - "mem_release.pb.c", - "$COMMON/pb_encode_with_malloc.o", - "$COMMON/pb_decode_with_malloc.o", - "$COMMON/pb_common_with_malloc.o", - "$COMMON/malloc_wrappers.o"]) - -env.RunTest(test) - diff --git a/third_party/nanopb/tests/mem_release/mem_release.c b/third_party/nanopb/tests/mem_release/mem_release.c deleted file mode 100644 index dc6f87dea47..00000000000 --- a/third_party/nanopb/tests/mem_release/mem_release.c +++ /dev/null @@ -1,187 +0,0 @@ -/* Make sure that all fields are freed in various scenarios. */ - -#include -#include -#include -#include -#include -#include "mem_release.pb.h" - -#define TEST(x) if (!(x)) { \ - fprintf(stderr, "Test " #x " on line %d failed.\n", __LINE__); \ - return false; \ - } - -static char *test_str_arr[] = {"1", "2", ""}; -static SubMessage test_msg_arr[] = {SubMessage_init_zero, SubMessage_init_zero}; -static pb_extension_t ext1, ext2; - -static void fill_TestMessage(TestMessage *msg) -{ - msg->static_req_submsg.dynamic_str = "12345"; - msg->static_req_submsg.dynamic_str_arr_count = 3; - msg->static_req_submsg.dynamic_str_arr = test_str_arr; - msg->static_req_submsg.dynamic_submsg_count = 2; - msg->static_req_submsg.dynamic_submsg = test_msg_arr; - msg->static_req_submsg.dynamic_submsg[1].dynamic_str = "abc"; - msg->static_opt_submsg.dynamic_str = "abc"; - msg->static_rep_submsg_count = 2; - msg->static_rep_submsg[1].dynamic_str = "abc"; - msg->has_static_opt_submsg = true; - msg->dynamic_submsg = &msg->static_req_submsg; - - msg->extensions = &ext1; - ext1.type = &dynamic_ext; - ext1.dest = &msg->static_req_submsg; - ext1.next = &ext2; - ext2.type = &static_ext; - ext2.dest = &msg->static_req_submsg; - ext2.next = NULL; -} - -/* Basic fields, nested submessages, extensions */ -static bool test_TestMessage() -{ - uint8_t buffer[256]; - size_t msgsize; - - /* Construct a message with various fields filled in */ - { - TestMessage msg = TestMessage_init_zero; - pb_ostream_t stream; - - fill_TestMessage(&msg); - - stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - if (!pb_encode(&stream, TestMessage_fields, &msg)) - { - fprintf(stderr, "Encode failed: %s\n", PB_GET_ERROR(&stream)); - return false; - } - msgsize = stream.bytes_written; - } - - /* Output encoded message for debug */ - SET_BINARY_MODE(stdout); - fwrite(buffer, 1, msgsize, stdout); - - /* Decode memory using dynamic allocation */ - { - TestMessage msg = TestMessage_init_zero; - pb_istream_t stream; - SubMessage ext2_dest; - - msg.extensions = &ext1; - ext1.type = &dynamic_ext; - ext1.dest = NULL; - ext1.next = &ext2; - ext2.type = &static_ext; - ext2.dest = &ext2_dest; - ext2.next = NULL; - - stream = pb_istream_from_buffer(buffer, msgsize); - if (!pb_decode(&stream, TestMessage_fields, &msg)) - { - fprintf(stderr, "Decode failed: %s\n", PB_GET_ERROR(&stream)); - return false; - } - - /* Make sure it encodes back to same data */ - { - uint8_t buffer2[256]; - pb_ostream_t ostream = pb_ostream_from_buffer(buffer2, sizeof(buffer2)); - TEST(pb_encode(&ostream, TestMessage_fields, &msg)); - TEST(ostream.bytes_written == msgsize); - TEST(memcmp(buffer, buffer2, msgsize) == 0); - } - - /* Make sure that malloc counters work */ - TEST(get_alloc_count() > 0); - - /* Make sure that pb_release releases everything */ - pb_release(TestMessage_fields, &msg); - TEST(get_alloc_count() == 0); - - /* Check that double-free is a no-op */ - pb_release(TestMessage_fields, &msg); - TEST(get_alloc_count() == 0); - } - - return true; -} - -/* Oneofs */ -static bool test_OneofMessage() -{ - uint8_t buffer[256]; - size_t msgsize; - - { - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - /* Encode first with TestMessage */ - { - OneofMessage msg = OneofMessage_init_zero; - msg.which_msgs = OneofMessage_msg1_tag; - - fill_TestMessage(&msg.msgs.msg1); - - if (!pb_encode(&stream, OneofMessage_fields, &msg)) - { - fprintf(stderr, "Encode failed: %s\n", PB_GET_ERROR(&stream)); - return false; - } - } - - /* Encode second with SubMessage, invoking 'merge' behaviour */ - { - OneofMessage msg = OneofMessage_init_zero; - msg.which_msgs = OneofMessage_msg2_tag; - - msg.first = 999; - msg.msgs.msg2.dynamic_str = "ABCD"; - msg.last = 888; - - if (!pb_encode(&stream, OneofMessage_fields, &msg)) - { - fprintf(stderr, "Encode failed: %s\n", PB_GET_ERROR(&stream)); - return false; - } - } - msgsize = stream.bytes_written; - } - - { - OneofMessage msg = OneofMessage_init_zero; - pb_istream_t stream = pb_istream_from_buffer(buffer, msgsize); - if (!pb_decode(&stream, OneofMessage_fields, &msg)) - { - fprintf(stderr, "Decode failed: %s\n", PB_GET_ERROR(&stream)); - return false; - } - - TEST(msg.first == 999); - TEST(msg.which_msgs == OneofMessage_msg2_tag); - TEST(msg.msgs.msg2.dynamic_str); - TEST(strcmp(msg.msgs.msg2.dynamic_str, "ABCD") == 0); - TEST(msg.msgs.msg2.dynamic_str_arr == NULL); - TEST(msg.msgs.msg2.dynamic_submsg == NULL); - TEST(msg.last == 888); - - pb_release(OneofMessage_fields, &msg); - TEST(get_alloc_count() == 0); - pb_release(OneofMessage_fields, &msg); - TEST(get_alloc_count() == 0); - } - - return true; -} - -int main() -{ - if (test_TestMessage() && test_OneofMessage()) - return 0; - else - return 1; -} - diff --git a/third_party/nanopb/tests/mem_release/mem_release.proto b/third_party/nanopb/tests/mem_release/mem_release.proto deleted file mode 100644 index 0816dc22d61..00000000000 --- a/third_party/nanopb/tests/mem_release/mem_release.proto +++ /dev/null @@ -1,35 +0,0 @@ -syntax = "proto2"; -import "nanopb.proto"; - -message SubMessage -{ - optional string dynamic_str = 1 [(nanopb).type = FT_POINTER]; - repeated string dynamic_str_arr = 2 [(nanopb).type = FT_POINTER]; - repeated SubMessage dynamic_submsg = 3 [(nanopb).type = FT_POINTER]; -} - -message TestMessage -{ - required SubMessage static_req_submsg = 1 [(nanopb).type = FT_STATIC]; - optional SubMessage dynamic_submsg = 2 [(nanopb).type = FT_POINTER]; - optional SubMessage static_opt_submsg = 3 [(nanopb).type = FT_STATIC]; - repeated SubMessage static_rep_submsg = 4 [(nanopb).type = FT_STATIC, (nanopb).max_count=2]; - extensions 100 to 200; -} - -extend TestMessage -{ - optional SubMessage dynamic_ext = 100 [(nanopb).type = FT_POINTER]; - optional SubMessage static_ext = 101 [(nanopb).type = FT_STATIC]; -} - -message OneofMessage -{ - required int32 first = 1; - oneof msgs - { - TestMessage msg1 = 2; - SubMessage msg2 = 3; - } - required int32 last = 4; -} diff --git a/third_party/nanopb/tests/message_sizes/SConscript b/third_party/nanopb/tests/message_sizes/SConscript deleted file mode 100644 index e7524e02589..00000000000 --- a/third_party/nanopb/tests/message_sizes/SConscript +++ /dev/null @@ -1,11 +0,0 @@ -# Test the generation of message size #defines - -Import('env') - -incpath = env.Clone() -incpath.Append(PROTOCPATH = '#message_sizes') - -incpath.NanopbProto("messages1") -incpath.NanopbProto("messages2") - -incpath.Program(['dummy.c', 'messages1.pb.c', 'messages2.pb.c']) diff --git a/third_party/nanopb/tests/message_sizes/dummy.c b/third_party/nanopb/tests/message_sizes/dummy.c deleted file mode 100644 index 767ad463b8a..00000000000 --- a/third_party/nanopb/tests/message_sizes/dummy.c +++ /dev/null @@ -1,9 +0,0 @@ -/* Just test that the file can be compiled successfully. */ - -#include "messages2.pb.h" - -int main() -{ - return xmit_size; -} - diff --git a/third_party/nanopb/tests/message_sizes/messages1.proto b/third_party/nanopb/tests/message_sizes/messages1.proto deleted file mode 100644 index b66fad71f4c..00000000000 --- a/third_party/nanopb/tests/message_sizes/messages1.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto2"; - -enum MessageStatus { - FAIL = 0; - OK = 1; -}; - -message MessageInfo { - required fixed32 msg_id = 1; - optional fixed32 interface_id = 2; -} - -message MessageResponseInfo { - required fixed64 interface_id = 1; - required fixed32 seq = 2; - required fixed32 msg_id = 3; -} - -message MessageHeader { - required MessageInfo info = 1; - optional MessageResponseInfo response_info = 2; - optional MessageResponse response = 3; -} - -message MessageResponse { - required MessageStatus status = 1; - required fixed32 seq = 2; -} - diff --git a/third_party/nanopb/tests/message_sizes/messages2.proto b/third_party/nanopb/tests/message_sizes/messages2.proto deleted file mode 100644 index 6761408073e..00000000000 --- a/third_party/nanopb/tests/message_sizes/messages2.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto2"; - -import 'nanopb.proto'; -import 'messages1.proto'; - -message xmit { - required MessageHeader header = 1; - required bytes data = 2 [(nanopb).max_size = 128]; -} - diff --git a/third_party/nanopb/tests/missing_fields/SConscript b/third_party/nanopb/tests/missing_fields/SConscript deleted file mode 100644 index 86ba0833a25..00000000000 --- a/third_party/nanopb/tests/missing_fields/SConscript +++ /dev/null @@ -1,8 +0,0 @@ -# Check that the decoder properly detects when required fields are missing. - -Import("env") - -env.NanopbProto("missing_fields") -test = env.Program(["missing_fields.c", "missing_fields.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"]) -env.RunTest(test) - diff --git a/third_party/nanopb/tests/missing_fields/missing_fields.c b/third_party/nanopb/tests/missing_fields/missing_fields.c deleted file mode 100644 index 8aded82743b..00000000000 --- a/third_party/nanopb/tests/missing_fields/missing_fields.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Checks that missing required fields are detected properly */ - -#include -#include -#include -#include "missing_fields.pb.h" - -int main() -{ - uint8_t buffer[512]; - size_t size; - - /* Create a message with one missing field */ - { - MissingField msg = {0}; - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - if (!pb_encode(&stream, MissingField_fields, &msg)) - { - printf("Encode failed.\n"); - return 1; - } - - size = stream.bytes_written; - } - - /* Test that it decodes properly if we don't require that field */ - { - MissingField msg = {0}; - pb_istream_t stream = pb_istream_from_buffer(buffer, size); - - if (!pb_decode(&stream, MissingField_fields, &msg)) - { - printf("Decode failed: %s\n", PB_GET_ERROR(&stream)); - return 2; - } - } - - /* Test that it does *not* decode properly if we require the field */ - { - AllFields msg = {0}; - pb_istream_t stream = pb_istream_from_buffer(buffer, size); - - if (pb_decode(&stream, AllFields_fields, &msg)) - { - printf("Decode didn't detect missing field.\n"); - return 3; - } - } - - return 0; /* All ok */ -} - diff --git a/third_party/nanopb/tests/missing_fields/missing_fields.proto b/third_party/nanopb/tests/missing_fields/missing_fields.proto deleted file mode 100644 index cc5e550b158..00000000000 --- a/third_party/nanopb/tests/missing_fields/missing_fields.proto +++ /dev/null @@ -1,140 +0,0 @@ -/* Test for one missing field among many */ - -syntax = "proto2"; - -message AllFields -{ - required int32 field1 = 1; - required int32 field2 = 2; - required int32 field3 = 3; - required int32 field4 = 4; - required int32 field5 = 5; - required int32 field6 = 6; - required int32 field7 = 7; - required int32 field8 = 8; - required int32 field9 = 9; - required int32 field10 = 10; - required int32 field11 = 11; - required int32 field12 = 12; - required int32 field13 = 13; - required int32 field14 = 14; - required int32 field15 = 15; - required int32 field16 = 16; - required int32 field17 = 17; - required int32 field18 = 18; - required int32 field19 = 19; - required int32 field20 = 20; - required int32 field21 = 21; - required int32 field22 = 22; - required int32 field23 = 23; - required int32 field24 = 24; - required int32 field25 = 25; - required int32 field26 = 26; - required int32 field27 = 27; - required int32 field28 = 28; - required int32 field29 = 29; - required int32 field30 = 30; - required int32 field31 = 31; - required int32 field32 = 32; - required int32 field33 = 33; - required int32 field34 = 34; - required int32 field35 = 35; - required int32 field36 = 36; - required int32 field37 = 37; - required int32 field38 = 38; - required int32 field39 = 39; - required int32 field40 = 40; - required int32 field41 = 41; - required int32 field42 = 42; - required int32 field43 = 43; - required int32 field44 = 44; - required int32 field45 = 45; - required int32 field46 = 46; - required int32 field47 = 47; - required int32 field48 = 48; - required int32 field49 = 49; - required int32 field50 = 50; - required int32 field51 = 51; - required int32 field52 = 52; - required int32 field53 = 53; - required int32 field54 = 54; - required int32 field55 = 55; - required int32 field56 = 56; - required int32 field57 = 57; - required int32 field58 = 58; - required int32 field59 = 59; - required int32 field60 = 60; - required int32 field61 = 61; - required int32 field62 = 62; - required int32 field63 = 63; - required int32 field64 = 64; -} - -message MissingField -{ - required int32 field1 = 1; - required int32 field2 = 2; - required int32 field3 = 3; - required int32 field4 = 4; - required int32 field5 = 5; - required int32 field6 = 6; - required int32 field7 = 7; - required int32 field8 = 8; - required int32 field9 = 9; - required int32 field10 = 10; - required int32 field11 = 11; - required int32 field12 = 12; - required int32 field13 = 13; - required int32 field14 = 14; - required int32 field15 = 15; - required int32 field16 = 16; - required int32 field17 = 17; - required int32 field18 = 18; - required int32 field19 = 19; - required int32 field20 = 20; - required int32 field21 = 21; - required int32 field22 = 22; - required int32 field23 = 23; - required int32 field24 = 24; - required int32 field25 = 25; - required int32 field26 = 26; - required int32 field27 = 27; - required int32 field28 = 28; - required int32 field29 = 29; - required int32 field30 = 30; - required int32 field31 = 31; - required int32 field32 = 32; - required int32 field33 = 33; - required int32 field34 = 34; - required int32 field35 = 35; - required int32 field36 = 36; - required int32 field37 = 37; - required int32 field38 = 38; - required int32 field39 = 39; - required int32 field40 = 40; - required int32 field41 = 41; - required int32 field42 = 42; - required int32 field43 = 43; - required int32 field44 = 44; - required int32 field45 = 45; - required int32 field46 = 46; - required int32 field47 = 47; - required int32 field48 = 48; - required int32 field49 = 49; - required int32 field50 = 50; - required int32 field51 = 51; - required int32 field52 = 52; - required int32 field53 = 53; - required int32 field54 = 54; - required int32 field55 = 55; - required int32 field56 = 56; - required int32 field57 = 57; - required int32 field58 = 58; - required int32 field59 = 59; - required int32 field60 = 60; - required int32 field61 = 61; - required int32 field62 = 62; -/* required int32 field63 = 63; */ - required int32 field64 = 64; -} - diff --git a/third_party/nanopb/tests/multiple_files/SConscript b/third_party/nanopb/tests/multiple_files/SConscript deleted file mode 100644 index b1281e17383..00000000000 --- a/third_party/nanopb/tests/multiple_files/SConscript +++ /dev/null @@ -1,16 +0,0 @@ -# Test that multiple .proto files don't cause name collisions. - -Import("env") - -incpath = env.Clone() -incpath.Append(PROTOCPATH = '#multiple_files') -incpath.Append(CPPPATH = '$BUILD/multiple_files') - -incpath.NanopbProto(["multifile1", "multifile1.options"]) -incpath.NanopbProto("multifile2") -incpath.NanopbProto("subdir/multifile2") -test = incpath.Program(["test_multiple_files.c", "multifile1.pb.c", - "multifile2.pb.c", "subdir/multifile2.pb.c"]) - -env.RunTest(test) - diff --git a/third_party/nanopb/tests/multiple_files/multifile1.options b/third_party/nanopb/tests/multiple_files/multifile1.options deleted file mode 100644 index c44d2669409..00000000000 --- a/third_party/nanopb/tests/multiple_files/multifile1.options +++ /dev/null @@ -1 +0,0 @@ -StaticMessage.repint32 max_count:5 diff --git a/third_party/nanopb/tests/multiple_files/multifile1.proto b/third_party/nanopb/tests/multiple_files/multifile1.proto deleted file mode 100644 index 18f2c672ce0..00000000000 --- a/third_party/nanopb/tests/multiple_files/multifile1.proto +++ /dev/null @@ -1,34 +0,0 @@ -syntax = "proto2"; - -message SubMessage { - optional string stringvalue = 1; - repeated int32 int32value = 2; - repeated fixed32 fixed32value = 3; - repeated fixed64 fixed64value = 4; -} - -message TestMessage { - optional string stringvalue = 1; - repeated int32 int32value = 2; - repeated fixed32 fixed32value = 3; - repeated fixed64 fixed64value = 4; - optional SubMessage submsg = 5; - repeated string repeatedstring = 6; -} - -message StaticMessage { - repeated fixed32 repint32 = 1; -} - -enum SignedEnum { - SE_MIN = -128; - SE_MAX = 127; -} - -enum UnsignedEnum { - UE_MIN = 0; - UE_MAX = 255; -} - - - diff --git a/third_party/nanopb/tests/multiple_files/multifile2.proto b/third_party/nanopb/tests/multiple_files/multifile2.proto deleted file mode 100644 index 4af45fd9acf..00000000000 --- a/third_party/nanopb/tests/multiple_files/multifile2.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Test if including generated header file for this file + implicit include of -// multifile2.pb.h still compiles. Used with test_compiles.c. -syntax = "proto2"; - -import "multifile1.proto"; - -message Callback2Message { - required TestMessage tstmsg = 1; - required SubMessage submsg = 2; -} - -message OneofMessage { - oneof msgs { - StaticMessage tstmsg = 1; - } -} - -message Enums { - required SignedEnum senum = 1; - required UnsignedEnum uenum = 2; -} - diff --git a/third_party/nanopb/tests/multiple_files/subdir/multifile2.proto b/third_party/nanopb/tests/multiple_files/subdir/multifile2.proto deleted file mode 100644 index 847a9290364..00000000000 --- a/third_party/nanopb/tests/multiple_files/subdir/multifile2.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto2"; - -package subdir; - -import "multifile1.proto"; - -message Callback2Message { - required TestMessage tstmsg = 1; - required SubMessage submsg = 2; -} - -message OneofMessage { - oneof msgs { - StaticMessage tstmsg = 1; - } -} - -message Enums { - required SignedEnum senum = 1; - required UnsignedEnum uenum = 2; -} - -message SubdirMessage { - required int32 foo = 1 [default = 15]; -} diff --git a/third_party/nanopb/tests/multiple_files/test_multiple_files.c b/third_party/nanopb/tests/multiple_files/test_multiple_files.c deleted file mode 100644 index 70a3e596413..00000000000 --- a/third_party/nanopb/tests/multiple_files/test_multiple_files.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Tests if this still compiles when multiple .proto files are involved. - */ - -#include -#include -#include "unittests.h" -#include "multifile2.pb.h" -#include "subdir/multifile2.pb.h" - -int main() -{ - int status = 0; - - /* Test that included file options are properly loaded */ - TEST(OneofMessage_size == 27); - - /* Check that enum signedness is detected properly */ - TEST(PB_LTYPE(Enums_fields[0].type) == PB_LTYPE_VARINT); - TEST(PB_LTYPE(Enums_fields[1].type) == PB_LTYPE_UVARINT); - - /* Test that subdir file is correctly included */ - { - subdir_SubdirMessage foo = subdir_SubdirMessage_init_default; - TEST(foo.foo == 15); - /* TEST(subdir_OneofMessage_size == 27); */ /* TODO: Issue #172 */ - } - - return status; -} diff --git a/third_party/nanopb/tests/no_errmsg/SConscript b/third_party/nanopb/tests/no_errmsg/SConscript deleted file mode 100644 index 629bfa68433..00000000000 --- a/third_party/nanopb/tests/no_errmsg/SConscript +++ /dev/null @@ -1,28 +0,0 @@ -# Run the alltypes test case, but compile with PB_NO_ERRMSG=1 - -Import("env") - -# Take copy of the files for custom build. -c = Copy("$TARGET", "$SOURCE") -env.Command("alltypes.pb.h", "$BUILD/alltypes/alltypes.pb.h", c) -env.Command("alltypes.pb.c", "$BUILD/alltypes/alltypes.pb.c", c) -env.Command("encode_alltypes.c", "$BUILD/alltypes/encode_alltypes.c", c) -env.Command("decode_alltypes.c", "$BUILD/alltypes/decode_alltypes.c", c) - -# Define the compilation options -opts = env.Clone() -opts.Append(CPPDEFINES = {'PB_NO_ERRMSG': 1}) - -# Build new version of core -strict = opts.Clone() -strict.Append(CFLAGS = strict['CORECFLAGS']) -strict.Object("pb_decode_noerr.o", "$NANOPB/pb_decode.c") -strict.Object("pb_encode_noerr.o", "$NANOPB/pb_encode.c") -strict.Object("pb_common_noerr.o", "$NANOPB/pb_common.c") - -# Now build and run the test normally. -enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode_noerr.o", "pb_common_noerr.o"]) -dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode_noerr.o", "pb_common_noerr.o"]) - -env.RunTest(enc) -env.RunTest([dec, "encode_alltypes.output"]) diff --git a/third_party/nanopb/tests/no_messages/SConscript b/third_party/nanopb/tests/no_messages/SConscript deleted file mode 100644 index 6492e2cf9c1..00000000000 --- a/third_party/nanopb/tests/no_messages/SConscript +++ /dev/null @@ -1,7 +0,0 @@ -# Test that a .proto file without any messages compiles fine. - -Import("env") - -env.NanopbProto("no_messages") -env.Object('no_messages.pb.c') - diff --git a/third_party/nanopb/tests/no_messages/no_messages.proto b/third_party/nanopb/tests/no_messages/no_messages.proto deleted file mode 100644 index 45bb2e6660d..00000000000 --- a/third_party/nanopb/tests/no_messages/no_messages.proto +++ /dev/null @@ -1,9 +0,0 @@ -/* Test that a file without any messages works. */ - -syntax = "proto2"; - -enum Test { - First = 1; -} - - diff --git a/third_party/nanopb/tests/oneof/SConscript b/third_party/nanopb/tests/oneof/SConscript deleted file mode 100644 index 22634fb0b20..00000000000 --- a/third_party/nanopb/tests/oneof/SConscript +++ /dev/null @@ -1,33 +0,0 @@ -# Test the 'oneof' feature for generating C unions. - -Import('env') - -import re - -match = None -if 'PROTOC_VERSION' in env: - match = re.search('([0-9]+).([0-9]+).([0-9]+)', env['PROTOC_VERSION']) - -if match: - version = map(int, match.groups()) - -# Oneof is supported by protoc >= 2.6.0 -if env.GetOption('clean') or (match and (version[0] > 2 or (version[0] == 2 and version[1] >= 6))): - env.NanopbProto('oneof') - - enc = env.Program(['encode_oneof.c', - 'oneof.pb.c', - '$COMMON/pb_encode.o', - '$COMMON/pb_common.o']) - - dec = env.Program(['decode_oneof.c', - 'oneof.pb.c', - '$COMMON/pb_decode.o', - '$COMMON/pb_common.o']) - - env.RunTest("message1.pb", enc, ARGS = ['1']) - env.RunTest("message1.txt", [dec, 'message1.pb'], ARGS = ['1']) - env.RunTest("message2.pb", enc, ARGS = ['2']) - env.RunTest("message2.txt", [dec, 'message2.pb'], ARGS = ['2']) - env.RunTest("message3.pb", enc, ARGS = ['3']) - env.RunTest("message3.txt", [dec, 'message3.pb'], ARGS = ['3']) diff --git a/third_party/nanopb/tests/oneof/decode_oneof.c b/third_party/nanopb/tests/oneof/decode_oneof.c deleted file mode 100644 index 37075cd66ef..00000000000 --- a/third_party/nanopb/tests/oneof/decode_oneof.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Decode a message using oneof fields */ - -#include -#include -#include -#include -#include "oneof.pb.h" -#include "test_helpers.h" -#include "unittests.h" - -/* Test the 'OneOfMessage' */ -int test_oneof_1(pb_istream_t *stream, int option) -{ - OneOfMessage msg; - int status = 0; - - /* To better catch initialization errors */ - memset(&msg, 0xAA, sizeof(msg)); - - if (!pb_decode(stream, OneOfMessage_fields, &msg)) - { - printf("Decoding failed: %s\n", PB_GET_ERROR(stream)); - return 1; - } - - /* Check that the basic fields work normally */ - TEST(msg.prefix == 123); - TEST(msg.suffix == 321); - - /* Check that we got the right oneof according to command line */ - if (option == 1) - { - TEST(msg.which_values == OneOfMessage_first_tag); - TEST(msg.values.first == 999); - } - else if (option == 2) - { - TEST(msg.which_values == OneOfMessage_second_tag); - TEST(strcmp(msg.values.second, "abcd") == 0); - } - else if (option == 3) - { - TEST(msg.which_values == OneOfMessage_third_tag); - TEST(msg.values.third.array[0] == 1); - TEST(msg.values.third.array[1] == 2); - TEST(msg.values.third.array[2] == 3); - TEST(msg.values.third.array[3] == 4); - TEST(msg.values.third.array[4] == 5); - } - - return status; -} - - -/* Test the 'PlainOneOfMessage' */ -int test_oneof_2(pb_istream_t *stream, int option) -{ - PlainOneOfMessage msg = PlainOneOfMessage_init_zero; - int status = 0; - - if (!pb_decode(stream, PlainOneOfMessage_fields, &msg)) - { - printf("Decoding failed: %s\n", PB_GET_ERROR(stream)); - return 1; - } - - /* Check that we got the right oneof according to command line */ - if (option == 1) - { - TEST(msg.which_values == OneOfMessage_first_tag); - TEST(msg.values.first == 999); - } - else if (option == 2) - { - TEST(msg.which_values == OneOfMessage_second_tag); - TEST(strcmp(msg.values.second, "abcd") == 0); - } - else if (option == 3) - { - TEST(msg.which_values == OneOfMessage_third_tag); - TEST(msg.values.third.array[0] == 1); - TEST(msg.values.third.array[1] == 2); - TEST(msg.values.third.array[2] == 3); - TEST(msg.values.third.array[3] == 4); - TEST(msg.values.third.array[4] == 5); - } - - return status; -} - -int main(int argc, char **argv) -{ - uint8_t buffer[OneOfMessage_size]; - size_t count; - int option; - - if (argc != 2) - { - fprintf(stderr, "Usage: decode_oneof [number]\n"); - return 1; - } - option = atoi(argv[1]); - - SET_BINARY_MODE(stdin); - count = fread(buffer, 1, sizeof(buffer), stdin); - - if (!feof(stdin)) - { - printf("Message does not fit in buffer\n"); - return 1; - } - - { - int status = 0; - pb_istream_t stream; - - stream = pb_istream_from_buffer(buffer, count); - status = test_oneof_1(&stream, option); - - if (status != 0) - return status; - - stream = pb_istream_from_buffer(buffer, count); - status = test_oneof_2(&stream, option); - - if (status != 0) - return status; - } - - return 0; -} diff --git a/third_party/nanopb/tests/oneof/encode_oneof.c b/third_party/nanopb/tests/oneof/encode_oneof.c deleted file mode 100644 index 913d2d43896..00000000000 --- a/third_party/nanopb/tests/oneof/encode_oneof.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Encode a message using oneof fields */ - -#include -#include -#include -#include "oneof.pb.h" -#include "test_helpers.h" - -int main(int argc, char **argv) -{ - uint8_t buffer[OneOfMessage_size]; - OneOfMessage msg = OneOfMessage_init_zero; - pb_ostream_t stream; - int option; - - if (argc != 2) - { - fprintf(stderr, "Usage: encode_oneof [number]\n"); - return 1; - } - option = atoi(argv[1]); - - /* Prefix and suffix are used to test that the union does not disturb - * other fields in the same message. */ - msg.prefix = 123; - - /* We encode one of the 'values' fields based on command line argument */ - if (option == 1) - { - msg.which_values = OneOfMessage_first_tag; - msg.values.first = 999; - } - else if (option == 2) - { - msg.which_values = OneOfMessage_second_tag; - strcpy(msg.values.second, "abcd"); - } - else if (option == 3) - { - msg.which_values = OneOfMessage_third_tag; - msg.values.third.array_count = 5; - msg.values.third.array[0] = 1; - msg.values.third.array[1] = 2; - msg.values.third.array[2] = 3; - msg.values.third.array[3] = 4; - msg.values.third.array[4] = 5; - } - - msg.suffix = 321; - - stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - if (pb_encode(&stream, OneOfMessage_fields, &msg)) - { - SET_BINARY_MODE(stdout); - fwrite(buffer, 1, stream.bytes_written, stdout); - return 0; - } - else - { - fprintf(stderr, "Encoding failed: %s\n", PB_GET_ERROR(&stream)); - return 1; - } -} diff --git a/third_party/nanopb/tests/oneof/oneof.proto b/third_party/nanopb/tests/oneof/oneof.proto deleted file mode 100644 index b4fe56f2b64..00000000000 --- a/third_party/nanopb/tests/oneof/oneof.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto2"; - -import 'nanopb.proto'; - -message SubMessage -{ - repeated int32 array = 1 [(nanopb).max_count = 8]; -} - -/* Oneof in a message with other fields */ -message OneOfMessage -{ - required int32 prefix = 1; - oneof values - { - int32 first = 5; - string second = 6 [(nanopb).max_size = 8]; - SubMessage third = 7; - } - required int32 suffix = 99; -} - -/* Oneof in a message by itself */ -message PlainOneOfMessage -{ - oneof values - { - int32 first = 5; - string second = 6 [(nanopb).max_size = 8]; - SubMessage third = 7; - } -} \ No newline at end of file diff --git a/third_party/nanopb/tests/options/SConscript b/third_party/nanopb/tests/options/SConscript deleted file mode 100644 index 89a00fa5ecc..00000000000 --- a/third_party/nanopb/tests/options/SConscript +++ /dev/null @@ -1,9 +0,0 @@ -# Test that the generator options work as expected. - -Import("env") - -env.NanopbProto("options") -env.Object('options.pb.c') - -env.Match(['options.pb.h', 'options.expected']) - diff --git a/third_party/nanopb/tests/options/options.expected b/third_party/nanopb/tests/options/options.expected deleted file mode 100644 index 63ba0fd8926..00000000000 --- a/third_party/nanopb/tests/options/options.expected +++ /dev/null @@ -1,18 +0,0 @@ -char filesize\[20\]; -char msgsize\[30\]; -char fieldsize\[40\]; -pb_callback_t int32_callback; -\sEnumValue1 = 1 -Message5_EnumValue1 -} pb_packed my_packed_struct; -! skipped_field -! SkippedMessage -#define PB_MSG_103 Message3 -#define PB_MSG_104 Message4 -#define PB_MSG_105 Message5 -#define OPTIONS_MESSAGES \\ -\s+PB_MSG\(103,[0-9]*,Message3\) \\ -\s+PB_MSG\(104,-1,Message4\) \\ -\s+PB_MSG\(105,[0-9]*,Message5\) \\ -#define Message5_msgid 105 - diff --git a/third_party/nanopb/tests/options/options.proto b/third_party/nanopb/tests/options/options.proto deleted file mode 100644 index aa722b526d6..00000000000 --- a/third_party/nanopb/tests/options/options.proto +++ /dev/null @@ -1,91 +0,0 @@ -/* Test nanopb option parsing. - * options.expected lists the patterns that are searched for in the output. - */ - -syntax = "proto2"; - -import "nanopb.proto"; - -// File level options -option (nanopb_fileopt).max_size = 20; - -message Message1 -{ - required string filesize = 1; -} - -// Message level options -message Message2 -{ - option (nanopb_msgopt).max_size = 30; - required string msgsize = 1; -} - -// Field level options -message Message3 -{ - option (nanopb_msgopt).msgid = 103; - required string fieldsize = 1 [(nanopb).max_size = 40]; -} - -// Forced callback field -message Message4 -{ - option (nanopb_msgopt).msgid = 104; - required int32 int32_callback = 1 [(nanopb).type = FT_CALLBACK]; -} - -// Short enum names -enum Enum1 -{ - option (nanopb_enumopt).long_names = false; - EnumValue1 = 1; - EnumValue2 = 2; -} - -message EnumTest -{ - required Enum1 field = 1 [default = EnumValue2]; -} - -// Short enum names inside message -message Message5 -{ - option (nanopb_msgopt).msgid = 105; - enum Enum2 - { - option (nanopb_enumopt).long_names = false; - EnumValue1 = 1; - } - required Enum2 field = 1 [default = EnumValue1]; -} - -// Packed structure -message my_packed_struct -{ - option (nanopb_msgopt).packed_struct = true; - optional int32 myfield = 1; -} - -// Message with ignored field -message Message6 -{ - required int32 field1 = 1; - optional int32 skipped_field = 2 [(nanopb).type = FT_IGNORE]; -} - -// Message that is skipped -message SkippedMessage -{ - option (nanopb_msgopt).skip_message = true; - required int32 foo = 1; -} - -// Message with oneof field -message OneofMessage -{ - oneof foo { - int32 bar = 1; - } -} - diff --git a/third_party/nanopb/tests/package_name/SConscript b/third_party/nanopb/tests/package_name/SConscript deleted file mode 100644 index 4afc5037378..00000000000 --- a/third_party/nanopb/tests/package_name/SConscript +++ /dev/null @@ -1,38 +0,0 @@ -# Check that alltypes test case works also when the .proto file defines -# a package name. - -Import("env") - -def set_pkgname(src, dst, pkgname): - data = open(str(src)).read() - placeholder = '// package name placeholder' - assert placeholder in data - data = data.replace(placeholder, 'package %s;' % pkgname) - open(str(dst), 'w').write(data) - -# Build a modified alltypes.proto -env.Command("alltypes.proto", "#alltypes/alltypes.proto", - lambda target, source, env: set_pkgname(source[0], target[0], 'test.package')) -env.Command("alltypes.options", "#alltypes/alltypes.options", Copy("$TARGET", "$SOURCE")) -env.NanopbProto(["alltypes", "alltypes.options"]) - -# Build a modified encode_alltypes.c -def modify_c(target, source, env): - '''Add package name to type names in .c file.''' - - data = open(str(source[0]), 'r').read() - - type_names = ['AllTypes', 'MyEnum', 'HugeEnum'] - for name in type_names: - data = data.replace(name, 'test_package_' + name) - - open(str(target[0]), 'w').write(data) - return 0 -env.Command("encode_alltypes.c", "#alltypes/encode_alltypes.c", modify_c) - -# Encode and compare results to original alltypes testcase -enc = env.Program(["encode_alltypes.c", "alltypes.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"]) -refdec = "$BUILD/alltypes/decode_alltypes$PROGSUFFIX" -env.RunTest(enc) -env.Compare(["encode_alltypes.output", "$BUILD/alltypes/encode_alltypes.output"]) - diff --git a/third_party/nanopb/tests/regression/issue_118/SConscript b/third_party/nanopb/tests/regression/issue_118/SConscript deleted file mode 100644 index 833d9dec720..00000000000 --- a/third_party/nanopb/tests/regression/issue_118/SConscript +++ /dev/null @@ -1,12 +0,0 @@ -# Regression test for Issue 118: Short enum names in imported proto files are not honoured - -Import("env") -env = env.Clone() -env.Append(PROTOCPATH = "#regression/issue_118") - -env.NanopbProto("enumdef") -env.Object('enumdef.pb.c') - -env.NanopbProto(["enumuse", "enumdef.proto"]) -env.Object('enumuse.pb.c') - diff --git a/third_party/nanopb/tests/regression/issue_118/enumdef.proto b/third_party/nanopb/tests/regression/issue_118/enumdef.proto deleted file mode 100644 index 46845bc9e26..00000000000 --- a/third_party/nanopb/tests/regression/issue_118/enumdef.proto +++ /dev/null @@ -1,8 +0,0 @@ -syntax = "proto2"; - -import 'nanopb.proto'; - -enum MyEnum { - option (nanopb_enumopt).long_names = false; - FOOBAR = 1; -} diff --git a/third_party/nanopb/tests/regression/issue_118/enumuse.proto b/third_party/nanopb/tests/regression/issue_118/enumuse.proto deleted file mode 100644 index 4afc45211ce..00000000000 --- a/third_party/nanopb/tests/regression/issue_118/enumuse.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto2"; - -import 'enumdef.proto'; - -message MyMessage { - required MyEnum myenum = 1 [default = FOOBAR]; -} diff --git a/third_party/nanopb/tests/regression/issue_125/SConscript b/third_party/nanopb/tests/regression/issue_125/SConscript deleted file mode 100644 index f2155e634d0..00000000000 --- a/third_party/nanopb/tests/regression/issue_125/SConscript +++ /dev/null @@ -1,9 +0,0 @@ -# Regression test for Issue 125: Wrong identifier name for extension fields - -Import("env") - -env.NanopbProto(["extensionbug", "extensionbug.options"]) -env.Object('extensionbug.pb.c') - -env.Match(['extensionbug.pb.h', 'extensionbug.expected']) - diff --git a/third_party/nanopb/tests/regression/issue_125/extensionbug.expected b/third_party/nanopb/tests/regression/issue_125/extensionbug.expected deleted file mode 100644 index fc213354052..00000000000 --- a/third_party/nanopb/tests/regression/issue_125/extensionbug.expected +++ /dev/null @@ -1,3 +0,0 @@ -pb_extension_type_t Message2_extras -uint32_t field2 - diff --git a/third_party/nanopb/tests/regression/issue_125/extensionbug.options b/third_party/nanopb/tests/regression/issue_125/extensionbug.options deleted file mode 100644 index 30b464a4151..00000000000 --- a/third_party/nanopb/tests/regression/issue_125/extensionbug.options +++ /dev/null @@ -1,4 +0,0 @@ -* type:FT_IGNORE - -Message2.extras type:FT_STATIC -Message2.field2 type:FT_STATIC diff --git a/third_party/nanopb/tests/regression/issue_125/extensionbug.proto b/third_party/nanopb/tests/regression/issue_125/extensionbug.proto deleted file mode 100644 index fd1e74f105c..00000000000 --- a/third_party/nanopb/tests/regression/issue_125/extensionbug.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto2"; - -message Message1 -{ - optional uint32 fieldA = 1; - extensions 30 to max; -} - -message Message2 -{ - extend Message1 - { - optional Message2 extras = 30; - } - - optional uint32 field1 = 1; - optional uint32 field2 = 2; -} diff --git a/third_party/nanopb/tests/regression/issue_141/SConscript b/third_party/nanopb/tests/regression/issue_141/SConscript deleted file mode 100644 index b6526beda56..00000000000 --- a/third_party/nanopb/tests/regression/issue_141/SConscript +++ /dev/null @@ -1,8 +0,0 @@ -# Regression test for issue 141: wrong encoded size #define for oneof messages - -Import("env") - -env.NanopbProto("testproto") -env.Object('testproto.pb.c') -env.Match(['testproto.pb.h', 'testproto.expected']) - diff --git a/third_party/nanopb/tests/regression/issue_141/testproto.expected b/third_party/nanopb/tests/regression/issue_141/testproto.expected deleted file mode 100644 index 75bc195c8d6..00000000000 --- a/third_party/nanopb/tests/regression/issue_141/testproto.expected +++ /dev/null @@ -1,7 +0,0 @@ -define SubMessage_size \s* 88 -define OneOfMessage_size \s* 113 -define topMessage_size \s* 70 -define MyMessage1_size \s* 46 -define MyMessage2_size \s* 8 -define MyMessage3_size \s* 5 -define MyMessage4_size \s* 18 diff --git a/third_party/nanopb/tests/regression/issue_141/testproto.proto b/third_party/nanopb/tests/regression/issue_141/testproto.proto deleted file mode 100644 index a445c68a2a0..00000000000 --- a/third_party/nanopb/tests/regression/issue_141/testproto.proto +++ /dev/null @@ -1,52 +0,0 @@ -syntax = "proto2"; - -import 'nanopb.proto'; - -message SubMessage -{ - repeated int32 array = 1 [(nanopb).max_count = 8]; -} - -message OneOfMessage -{ - required int32 prefix = 1; - oneof values - { - int32 first = 5; - string second = 6 [(nanopb).max_size = 8]; - SubMessage third = 7; - } - required int32 suffix = 99; -} - -message topMessage { - required int32 start = 1; - oneof msg { - MyMessage1 msg1 = 2; - MyMessage2 msg2 = 3; - } - required int32 end = 4; -} - -message MyMessage1 { - required uint32 n1 = 1; - required uint32 n2 = 2; - required string s = 3 [(nanopb).max_size = 32]; -} - -message MyMessage2 { - required uint32 num = 1; - required bool b = 2; -} - -message MyMessage3 { - required bool bbb = 1; - required string ss = 2 [(nanopb).max_size = 1]; -} - -message MyMessage4 { - required bool bbbb = 1; - required string sss = 2 [(nanopb).max_size = 2]; - required uint32 num = 3; - required uint32 num2 = 4; -} diff --git a/third_party/nanopb/tests/regression/issue_145/SConscript b/third_party/nanopb/tests/regression/issue_145/SConscript deleted file mode 100644 index 0b793a7ac49..00000000000 --- a/third_party/nanopb/tests/regression/issue_145/SConscript +++ /dev/null @@ -1,9 +0,0 @@ -# Regression test for Issue 145: Allow /* */ and // comments in .options files - -Import("env") - -env.NanopbProto(["comments", "comments.options"]) -env.Object('comments.pb.c') - -env.Match(['comments.pb.h', 'comments.expected']) - diff --git a/third_party/nanopb/tests/regression/issue_145/comments.expected b/third_party/nanopb/tests/regression/issue_145/comments.expected deleted file mode 100644 index 7f874587b7f..00000000000 --- a/third_party/nanopb/tests/regression/issue_145/comments.expected +++ /dev/null @@ -1,3 +0,0 @@ -char foo\[5\]; -char bar\[16\]; - diff --git a/third_party/nanopb/tests/regression/issue_145/comments.options b/third_party/nanopb/tests/regression/issue_145/comments.options deleted file mode 100644 index 89959ba2358..00000000000 --- a/third_party/nanopb/tests/regression/issue_145/comments.options +++ /dev/null @@ -1,6 +0,0 @@ -/* Block comment */ -# Line comment -// Line comment -DummyMessage.foo /* Block comment */ max_size:5 -DummyMessage.bar max_size:16 # Line comment ### - diff --git a/third_party/nanopb/tests/regression/issue_145/comments.proto b/third_party/nanopb/tests/regression/issue_145/comments.proto deleted file mode 100644 index 621779f54ce..00000000000 --- a/third_party/nanopb/tests/regression/issue_145/comments.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto2"; - -message DummyMessage { - required string foo = 1; - required string bar = 2; -} - diff --git a/third_party/nanopb/tests/regression/issue_166/SConscript b/third_party/nanopb/tests/regression/issue_166/SConscript deleted file mode 100644 index c50b91939db..00000000000 --- a/third_party/nanopb/tests/regression/issue_166/SConscript +++ /dev/null @@ -1,13 +0,0 @@ -# Verify that the maximum encoded size is calculated properly -# for enums. - -Import('env') - -env.NanopbProto('enums') - -p = env.Program(["enum_encoded_size.c", - "enums.pb.c", - "$COMMON/pb_encode.o", - "$COMMON/pb_common.o"]) -env.RunTest(p) - diff --git a/third_party/nanopb/tests/regression/issue_166/enum_encoded_size.c b/third_party/nanopb/tests/regression/issue_166/enum_encoded_size.c deleted file mode 100644 index 84e1c7de717..00000000000 --- a/third_party/nanopb/tests/regression/issue_166/enum_encoded_size.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include -#include "unittests.h" -#include "enums.pb.h" - -int main() -{ - int status = 0; - - uint8_t buf[256]; - SignedMsg msg1; - UnsignedMsg msg2; - pb_ostream_t s; - - { - COMMENT("Test negative value of signed enum"); - /* Negative value should take up the maximum size */ - msg1.value = SignedEnum_SE_MIN; - s = pb_ostream_from_buffer(buf, sizeof(buf)); - TEST(pb_encode(&s, SignedMsg_fields, &msg1)); - TEST(s.bytes_written == SignedMsg_size); - - COMMENT("Test positive value of signed enum"); - /* Positive value should be smaller */ - msg1.value = SignedEnum_SE_MAX; - s = pb_ostream_from_buffer(buf, sizeof(buf)); - TEST(pb_encode(&s, SignedMsg_fields, &msg1)); - TEST(s.bytes_written < SignedMsg_size); - } - - { - COMMENT("Test positive value of unsigned enum"); - /* This should take up the maximum size */ - msg2.value = UnsignedEnum_UE_MAX; - s = pb_ostream_from_buffer(buf, sizeof(buf)); - TEST(pb_encode(&s, UnsignedMsg_fields, &msg2)); - TEST(s.bytes_written == UnsignedMsg_size); - } - - return status; -} - diff --git a/third_party/nanopb/tests/regression/issue_166/enums.proto b/third_party/nanopb/tests/regression/issue_166/enums.proto deleted file mode 100644 index 36948044bf9..00000000000 --- a/third_party/nanopb/tests/regression/issue_166/enums.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto2"; - -enum SignedEnum { - SE_MIN = -1; - SE_MAX = 255; -} - -enum UnsignedEnum { - UE_MAX = 65536; -} - -message SignedMsg { - required SignedEnum value = 1; -} - -message UnsignedMsg { - required UnsignedEnum value = 1; -} diff --git a/third_party/nanopb/tests/regression/issue_172/SConscript b/third_party/nanopb/tests/regression/issue_172/SConscript deleted file mode 100644 index 49c919e8059..00000000000 --- a/third_party/nanopb/tests/regression/issue_172/SConscript +++ /dev/null @@ -1,16 +0,0 @@ -# Verify that _size define is generated for messages that have -# includes from another directory. - -Import('env') - -incpath = env.Clone() -incpath.Append(PROTOCPATH="#regression/issue_172/submessage") -incpath.Append(CPPPATH="$BUILD/regression/issue_172/submessage") -incpath.NanopbProto('test') -incpath.NanopbProto(['submessage/submessage', 'submessage/submessage.options']) - -p = incpath.Program(["msg_size.c", - "test.pb.c", - "submessage/submessage.pb.c"]) - - diff --git a/third_party/nanopb/tests/regression/issue_172/msg_size.c b/third_party/nanopb/tests/regression/issue_172/msg_size.c deleted file mode 100644 index be45acb4fb5..00000000000 --- a/third_party/nanopb/tests/regression/issue_172/msg_size.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "test.pb.h" - -PB_STATIC_ASSERT(testmessage_size >= 1+1+1+1+16, TESTMESSAGE_SIZE_IS_WRONG) - -int main() -{ - return 0; -} - diff --git a/third_party/nanopb/tests/regression/issue_172/submessage/submessage.options b/third_party/nanopb/tests/regression/issue_172/submessage/submessage.options deleted file mode 100644 index 12fb1984e90..00000000000 --- a/third_party/nanopb/tests/regression/issue_172/submessage/submessage.options +++ /dev/null @@ -1 +0,0 @@ -submessage.data max_size: 16 diff --git a/third_party/nanopb/tests/regression/issue_172/submessage/submessage.proto b/third_party/nanopb/tests/regression/issue_172/submessage/submessage.proto deleted file mode 100644 index ce6804afa85..00000000000 --- a/third_party/nanopb/tests/regression/issue_172/submessage/submessage.proto +++ /dev/null @@ -1,4 +0,0 @@ -syntax = "proto2"; -message submessage { - required bytes data = 1; -} diff --git a/third_party/nanopb/tests/regression/issue_172/test.proto b/third_party/nanopb/tests/regression/issue_172/test.proto deleted file mode 100644 index fbd97be5b0d..00000000000 --- a/third_party/nanopb/tests/regression/issue_172/test.proto +++ /dev/null @@ -1,6 +0,0 @@ -syntax = "proto2"; -import "submessage.proto"; - -message testmessage { - optional submessage sub = 1; -} diff --git a/third_party/nanopb/tests/regression/issue_188/SConscript b/third_party/nanopb/tests/regression/issue_188/SConscript deleted file mode 100644 index 6bc32712b12..00000000000 --- a/third_party/nanopb/tests/regression/issue_188/SConscript +++ /dev/null @@ -1,6 +0,0 @@ -# Regression test for issue with Enums inside OneOf. - -Import('env') - -env.NanopbProto('oneof') - diff --git a/third_party/nanopb/tests/regression/issue_188/oneof.proto b/third_party/nanopb/tests/regression/issue_188/oneof.proto deleted file mode 100644 index e37f5c02767..00000000000 --- a/third_party/nanopb/tests/regression/issue_188/oneof.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto2"; - -message MessageOne -{ - required uint32 one = 1; - required uint32 two = 2; - required uint32 three = 3; - required int32 four = 4; -} - -enum EnumTwo -{ - SOME_ENUM_1 = 1; - SOME_ENUM_2 = 5; - SOME_ENUM_3 = 6; - SOME_ENUM_4 = 9; - SOME_ENUM_5 = 10; - SOME_ENUM_6 = 12; - SOME_ENUM_7 = 39; - SOME_ENUM_8 = 401; -} - -message OneofMessage -{ - oneof payload { - MessageOne message = 1; - EnumTwo enum = 2; - } -} diff --git a/third_party/nanopb/tests/regression/issue_195/SConscript b/third_party/nanopb/tests/regression/issue_195/SConscript deleted file mode 100644 index 78326d325e6..00000000000 --- a/third_party/nanopb/tests/regression/issue_195/SConscript +++ /dev/null @@ -1,10 +0,0 @@ -# Regression test for Issue 195: Message size not calculated if a submessage includes -# bytes. Basically a non-working #define being generated. - -Import("env") - -env.NanopbProto(["test"]) -env.Object('test.pb.c') - -env.Match(['test.pb.h', 'test.expected']) - diff --git a/third_party/nanopb/tests/regression/issue_195/test.expected b/third_party/nanopb/tests/regression/issue_195/test.expected deleted file mode 100644 index 83ea7ab8692..00000000000 --- a/third_party/nanopb/tests/regression/issue_195/test.expected +++ /dev/null @@ -1 +0,0 @@ -/\* TestMessage_size depends diff --git a/third_party/nanopb/tests/regression/issue_195/test.proto b/third_party/nanopb/tests/regression/issue_195/test.proto deleted file mode 100644 index 7a77d69dc51..00000000000 --- a/third_party/nanopb/tests/regression/issue_195/test.proto +++ /dev/null @@ -1,8 +0,0 @@ -message TestMessage { - required uint32 id = 1; - required bytes payload = 2; -} -message EncapsulatedMessage { - required uint32 id = 1; - required TestMessage test = 2; -} diff --git a/third_party/nanopb/tests/regression/issue_203/SConscript b/third_party/nanopb/tests/regression/issue_203/SConscript deleted file mode 100644 index 8b4d6cc702b..00000000000 --- a/third_party/nanopb/tests/regression/issue_203/SConscript +++ /dev/null @@ -1,9 +0,0 @@ -# Regression test for issue with multiple files generated at once - -Import('env') - -env.Command(['file1.pb.c', 'file1.pb.h', 'file2.pb.c', 'file2.pb.h'], ['file1.proto', 'file2.proto'], - env['NANOPB_PROTO_CMD']) - -env.Object('file1.pb.c') -env.Object('file2.pb.c') diff --git a/third_party/nanopb/tests/regression/issue_203/file1.proto b/third_party/nanopb/tests/regression/issue_203/file1.proto deleted file mode 100644 index dae250b8426..00000000000 --- a/third_party/nanopb/tests/regression/issue_203/file1.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto2"; - -message SubMessage1 { - required int32 foo = 1; -} - -message Message1 { - required SubMessage1 bar = 1; -} - diff --git a/third_party/nanopb/tests/regression/issue_203/file2.proto b/third_party/nanopb/tests/regression/issue_203/file2.proto deleted file mode 100644 index 513b0f0d778..00000000000 --- a/third_party/nanopb/tests/regression/issue_203/file2.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto2"; - -message SubMessage2 { - required int32 foo = 1; -} - -message Message2 { - required SubMessage2 bar = 1; -} - diff --git a/third_party/nanopb/tests/regression/issue_205/SConscript b/third_party/nanopb/tests/regression/issue_205/SConscript deleted file mode 100644 index ed8899ddfc7..00000000000 --- a/third_party/nanopb/tests/regression/issue_205/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -# Check that pb_release() correctly handles corrupted size fields of -# static arrays. - -Import('env', 'malloc_env') - -env.NanopbProto('size_corruption') - -p = malloc_env.Program(["size_corruption.c", - "size_corruption.pb.c", - "$COMMON/pb_decode_with_malloc.o", - "$COMMON/pb_common_with_malloc.o", - "$COMMON/malloc_wrappers.o"]) -env.RunTest(p) - diff --git a/third_party/nanopb/tests/regression/issue_205/size_corruption.c b/third_party/nanopb/tests/regression/issue_205/size_corruption.c deleted file mode 100644 index 08cef45786b..00000000000 --- a/third_party/nanopb/tests/regression/issue_205/size_corruption.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "size_corruption.pb.h" -#include - -int main() -{ - MainMessage msg = MainMessage_init_zero; - msg.bar_count = (pb_size_t)-1; - pb_release(MainMessage_fields, &msg); - - return 0; -} - diff --git a/third_party/nanopb/tests/regression/issue_205/size_corruption.proto b/third_party/nanopb/tests/regression/issue_205/size_corruption.proto deleted file mode 100644 index 6c9c2453abd..00000000000 --- a/third_party/nanopb/tests/regression/issue_205/size_corruption.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto2"; -import 'nanopb.proto'; - -message SubMessage { - repeated int32 foo = 1 [(nanopb).type = FT_POINTER]; -} - -message MainMessage { - repeated SubMessage bar = 1 [(nanopb).max_count = 5]; -} - diff --git a/third_party/nanopb/tests/site_scons/site_init.py b/third_party/nanopb/tests/site_scons/site_init.py deleted file mode 100644 index da5f6d65176..00000000000 --- a/third_party/nanopb/tests/site_scons/site_init.py +++ /dev/null @@ -1,109 +0,0 @@ -import subprocess -import sys -import re - -try: - # Make terminal colors work on windows - import colorama - colorama.init() -except ImportError: - pass - -def add_nanopb_builders(env): - '''Add the necessary builder commands for nanopb tests.''' - - # Build command that runs a test program and saves the output - def run_test(target, source, env): - if len(source) > 1: - infile = open(str(source[1])) - else: - infile = None - - if env.has_key("COMMAND"): - args = [env["COMMAND"]] - else: - args = [str(source[0])] - - if env.has_key('ARGS'): - args.extend(env['ARGS']) - - print 'Command line: ' + str(args) - pipe = subprocess.Popen(args, - stdin = infile, - stdout = open(str(target[0]), 'w'), - stderr = sys.stderr) - result = pipe.wait() - if result == 0: - print '\033[32m[ OK ]\033[0m Ran ' + args[0] - else: - print '\033[31m[FAIL]\033[0m Program ' + args[0] + ' returned ' + str(result) - return result - - run_test_builder = Builder(action = run_test, - suffix = '.output') - env.Append(BUILDERS = {'RunTest': run_test_builder}) - - # Build command that decodes a message using protoc - def decode_actions(source, target, env, for_signature): - esc = env['ESCAPE'] - dirs = ' '.join(['-I' + esc(env.GetBuildPath(d)) for d in env['PROTOCPATH']]) - return '$PROTOC $PROTOCFLAGS %s --decode=%s %s <%s >%s' % ( - dirs, env['MESSAGE'], esc(str(source[1])), esc(str(source[0])), esc(str(target[0]))) - - decode_builder = Builder(generator = decode_actions, - suffix = '.decoded') - env.Append(BUILDERS = {'Decode': decode_builder}) - - # Build command that encodes a message using protoc - def encode_actions(source, target, env, for_signature): - esc = env['ESCAPE'] - dirs = ' '.join(['-I' + esc(env.GetBuildPath(d)) for d in env['PROTOCPATH']]) - return '$PROTOC $PROTOCFLAGS %s --encode=%s %s <%s >%s' % ( - dirs, env['MESSAGE'], esc(str(source[1])), esc(str(source[0])), esc(str(target[0]))) - - encode_builder = Builder(generator = encode_actions, - suffix = '.encoded') - env.Append(BUILDERS = {'Encode': encode_builder}) - - # Build command that asserts that two files be equal - def compare_files(target, source, env): - data1 = open(str(source[0]), 'rb').read() - data2 = open(str(source[1]), 'rb').read() - if data1 == data2: - print '\033[32m[ OK ]\033[0m Files equal: ' + str(source[0]) + ' and ' + str(source[1]) - return 0 - else: - print '\033[31m[FAIL]\033[0m Files differ: ' + str(source[0]) + ' and ' + str(source[1]) - return 1 - - compare_builder = Builder(action = compare_files, - suffix = '.equal') - env.Append(BUILDERS = {'Compare': compare_builder}) - - # Build command that checks that each pattern in source2 is found in source1. - def match_files(target, source, env): - data = open(str(source[0]), 'rU').read() - patterns = open(str(source[1])) - for pattern in patterns: - if pattern.strip(): - invert = False - if pattern.startswith('! '): - invert = True - pattern = pattern[2:] - - status = re.search(pattern.strip(), data, re.MULTILINE) - - if not status and not invert: - print '\033[31m[FAIL]\033[0m Pattern not found in ' + str(source[0]) + ': ' + pattern - return 1 - elif status and invert: - print '\033[31m[FAIL]\033[0m Pattern should not exist, but does in ' + str(source[0]) + ': ' + pattern - return 1 - else: - print '\033[32m[ OK ]\033[0m All patterns found in ' + str(source[0]) - return 0 - - match_builder = Builder(action = match_files, suffix = '.matched') - env.Append(BUILDERS = {'Match': match_builder}) - - diff --git a/third_party/nanopb/tests/site_scons/site_tools/nanopb.py b/third_party/nanopb/tests/site_scons/site_tools/nanopb.py deleted file mode 100644 index c72a45d3b4d..00000000000 --- a/third_party/nanopb/tests/site_scons/site_tools/nanopb.py +++ /dev/null @@ -1,126 +0,0 @@ -''' -Scons Builder for nanopb .proto definitions. - -This tool will locate the nanopb generator and use it to generate .pb.c and -.pb.h files from the .proto files. - -Basic example -------------- -# Build myproto.pb.c and myproto.pb.h from myproto.proto -myproto = env.NanopbProto("myproto") - -# Link nanopb core to the program -env.Append(CPPPATH = "$NANOB") -myprog = env.Program(["myprog.c", myproto, "$NANOPB/pb_encode.c", "$NANOPB/pb_decode.c"]) - -Configuration options ---------------------- -Normally, this script is used in the test environment of nanopb and it locates -the nanopb generator by a relative path. If this script is used in another -application, the path to nanopb root directory has to be defined: - -env.SetDefault(NANOPB = "path/to/nanopb") - -Additionally, the path to protoc and the options to give to protoc can be -defined manually: - -env.SetDefault(PROTOC = "path/to/protoc") -env.SetDefault(PROTOCFLAGS = "--plugin=protoc-gen-nanopb=path/to/protoc-gen-nanopb") -''' - -import SCons.Action -import SCons.Builder -import SCons.Util -import os.path - -class NanopbWarning(SCons.Warnings.Warning): - pass -SCons.Warnings.enableWarningClass(NanopbWarning) - -def _detect_nanopb(env): - '''Find the path to nanopb root directory.''' - if env.has_key('NANOPB'): - # Use nanopb dir given by user - return env['NANOPB'] - - p = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')) - if os.path.isdir(p) and os.path.isfile(os.path.join(p, 'pb.h')): - # Assume we are running under tests/site_scons/site_tools - return p - - raise SCons.Errors.StopError(NanopbWarning, - "Could not find the nanopb root directory") - -def _detect_protoc(env): - '''Find the path to the protoc compiler.''' - if env.has_key('PROTOC'): - # Use protoc defined by user - return env['PROTOC'] - - n = _detect_nanopb(env) - p1 = os.path.join(n, 'generator-bin', 'protoc' + env['PROGSUFFIX']) - if os.path.exists(p1): - # Use protoc bundled with binary package - return env['ESCAPE'](p1) - - p = env.WhereIs('protoc') - if p: - # Use protoc from path - return env['ESCAPE'](p) - - raise SCons.Errors.StopError(NanopbWarning, - "Could not find the protoc compiler") - -def _detect_protocflags(env): - '''Find the options to use for protoc.''' - if env.has_key('PROTOCFLAGS'): - return env['PROTOCFLAGS'] - - p = _detect_protoc(env) - n = _detect_nanopb(env) - p1 = os.path.join(n, 'generator-bin', 'protoc' + env['PROGSUFFIX']) - if p == env['ESCAPE'](p1): - # Using the bundled protoc, no options needed - return '' - - e = env['ESCAPE'] - if env['PLATFORM'] == 'win32': - return e('--plugin=protoc-gen-nanopb=' + os.path.join(n, 'generator', 'protoc-gen-nanopb.bat')) - else: - return e('--plugin=protoc-gen-nanopb=' + os.path.join(n, 'generator', 'protoc-gen-nanopb')) - -def _nanopb_proto_actions(source, target, env, for_signature): - esc = env['ESCAPE'] - dirs = ' '.join(['-I' + esc(env.GetBuildPath(d)) for d in env['PROTOCPATH']]) - return '$PROTOC $PROTOCFLAGS %s --nanopb_out=. %s' % (dirs, esc(str(source[0]))) - -def _nanopb_proto_emitter(target, source, env): - basename = os.path.splitext(str(source[0]))[0] - target.append(basename + '.pb.h') - - if os.path.exists(basename + '.options'): - source.append(basename + '.options') - - return target, source - -_nanopb_proto_builder = SCons.Builder.Builder( - generator = _nanopb_proto_actions, - suffix = '.pb.c', - src_suffix = '.proto', - emitter = _nanopb_proto_emitter) - -def generate(env): - '''Add Builder for nanopb protos.''' - - env['NANOPB'] = _detect_nanopb(env) - env['PROTOC'] = _detect_protoc(env) - env['PROTOCFLAGS'] = _detect_protocflags(env) - - env.SetDefault(PROTOCPATH = ['.', os.path.join(env['NANOPB'], 'generator', 'proto')]) - - env.SetDefault(NANOPB_PROTO_CMD = '$PROTOC $PROTOCFLAGS --nanopb_out=. $SOURCES') - env['BUILDERS']['NanopbProto'] = _nanopb_proto_builder - -def exists(env): - return _detect_protoc(env) and _detect_protoc_opts(env) - diff --git a/third_party/nanopb/tests/special_characters/SConscript b/third_party/nanopb/tests/special_characters/SConscript deleted file mode 100644 index 2309cf2ef5b..00000000000 --- a/third_party/nanopb/tests/special_characters/SConscript +++ /dev/null @@ -1,6 +0,0 @@ -# Test that special characters in .proto filenames work. - -Import('env') - -env.NanopbProto("funny-proto+name has.characters.proto") -env.Object("funny-proto+name has.characters.pb.c") diff --git a/third_party/nanopb/tests/special_characters/funny-proto+name has.characters.proto b/third_party/nanopb/tests/special_characters/funny-proto+name has.characters.proto deleted file mode 100644 index 26b2cb1b0af..00000000000 --- a/third_party/nanopb/tests/special_characters/funny-proto+name has.characters.proto +++ /dev/null @@ -1 +0,0 @@ -syntax="proto2"; diff --git a/third_party/nanopb/tests/splint/SConscript b/third_party/nanopb/tests/splint/SConscript deleted file mode 100644 index cd4b5b9df60..00000000000 --- a/third_party/nanopb/tests/splint/SConscript +++ /dev/null @@ -1,16 +0,0 @@ -# Check the nanopb core using splint - -Import('env') - -p = env.WhereIs('splint') - -if p: - env.Command('pb_decode.splint', '$NANOPB/pb_decode.c', - 'splint -f splint/splint.rc $SOURCE 2> $TARGET') - - env.Command('pb_encode.splint', '$NANOPB/pb_encode.c', - 'splint -f splint/splint.rc $SOURCE 2> $TARGET') - - env.Command('pb_common.splint', '$NANOPB/pb_common.c', - 'splint -f splint/splint.rc $SOURCE 2> $TARGET') - diff --git a/third_party/nanopb/tests/splint/splint.rc b/third_party/nanopb/tests/splint/splint.rc deleted file mode 100644 index e47d3c21c0d..00000000000 --- a/third_party/nanopb/tests/splint/splint.rc +++ /dev/null @@ -1,37 +0,0 @@ -+checks -+partial -+matchanyintegral -+strictlib --nullassign --predboolint --predboolptr -+ptrnegate --switchloopbreak -+ignoresigns --infloopsuncon --type - -# splint's memory checks don't quite work without annotations --mustfreeonly --compmempass --nullret --observertrans --statictrans --compdestroy --nullpass --nullstate --compdef --usereleased --temptrans --dependenttrans --kepttrans --branchstate --immediatetrans --mustfreefresh - -# These tests give false positives, compiler typically has -# better warnings for these. --noret --noeffect --usedef - diff --git a/third_party/nanopb/tools/make_linux_package.sh b/third_party/nanopb/tools/make_linux_package.sh deleted file mode 100755 index 6598936a6b2..00000000000 --- a/third_party/nanopb/tools/make_linux_package.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -# Run this script in the top nanopb directory to create a binary package -# for Linux users. - -set -e -set -x - -VERSION=`git describe --always`-linux-x86 -DEST=dist/$VERSION - -rm -rf $DEST -mkdir -p $DEST - -# Export the files from newest commit -git archive HEAD | tar x -C $DEST - -# Rebuild the Python .proto files -make -BC $DEST/generator/proto - -# Make the nanopb generator available as a protoc plugin -cp $DEST/generator/nanopb_generator.py $DEST/generator/protoc-gen-nanopb.py - -# Package the Python libraries -( cd $DEST/generator; bbfreeze nanopb_generator.py protoc-gen-nanopb.py ) -mv $DEST/generator/dist $DEST/generator-bin - -# Remove temp file -rm $DEST/generator/protoc-gen-nanopb.py - -# Package the protoc compiler -cp `which protoc` $DEST/generator-bin/protoc.bin -LIBPROTOC=$(ldd `which protoc` | grep -o '/.*libprotoc[^ ]*') -LIBPROTOBUF=$(ldd `which protoc` | grep -o '/.*libprotobuf[^ ]*') -cp $LIBPROTOC $LIBPROTOBUF $DEST/generator-bin/ -cat > $DEST/generator-bin/protoc << EOF -#!/bin/bash -SCRIPTDIR=\$(dirname "\$0") -export LD_LIBRARY_PATH=\$SCRIPTDIR -export PATH=\$SCRIPTDIR:\$PATH -exec "\$SCRIPTDIR/protoc.bin" "\$@" -EOF -chmod +x $DEST/generator-bin/protoc - -# Tar it all up -( cd dist; tar -czf $VERSION.tar.gz $VERSION ) - diff --git a/third_party/nanopb/tools/make_mac_package.sh b/third_party/nanopb/tools/make_mac_package.sh deleted file mode 100755 index 32bba5cca98..00000000000 --- a/third_party/nanopb/tools/make_mac_package.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# Run this script in the top nanopb directory to create a binary package -# for Mac OS X users. - -# Requires: protobuf, python-protobuf, pyinstaller - -set -e -set -x - -VERSION=`git describe --always`-macosx-x86 -DEST=dist/$VERSION - -rm -rf $DEST -mkdir -p $DEST - -# Export the files from newest commit -git archive HEAD | tar x -C $DEST - -# Rebuild the Python .proto files -make -BC $DEST/generator/proto - -# Package the Python libraries -( cd $DEST/generator; pyinstaller nanopb_generator.py ) -mv $DEST/generator/dist/nanopb_generator $DEST/generator-bin - -# Remove temp files -rm -rf $DEST/generator/dist $DEST/generator/build $DEST/generator/nanopb_generator.spec - -# Make the nanopb generator available as a protoc plugin -cp $DEST/generator-bin/nanopb_generator $DEST/generator-bin/protoc-gen-nanopb - -# Package the protoc compiler -cp `which protoc` $DEST/generator-bin/protoc.bin -LIBPROTOC=$(otool -L `which protoc` | grep -o '/.*libprotoc[^ ]*') -LIBPROTOBUF=$(otool -L `which protoc` | grep -o '/.*libprotobuf[^ ]*') -cp $LIBPROTOC $LIBPROTOBUF $DEST/generator-bin/ -cat > $DEST/generator-bin/protoc << EOF -#!/bin/bash -SCRIPTDIR=\$(dirname "\$0") -export DYLD_LIBRARY_PATH=\$SCRIPTDIR -export PATH=\$SCRIPTDIR:\$PATH -exec "\$SCRIPTDIR/protoc.bin" "\$@" -EOF -chmod +x $DEST/generator-bin/protoc - -# Tar it all up -( cd dist; tar -czf $VERSION.tar.gz $VERSION ) - diff --git a/third_party/nanopb/tools/make_windows_package.sh b/third_party/nanopb/tools/make_windows_package.sh deleted file mode 100755 index 72de6f3394a..00000000000 --- a/third_party/nanopb/tools/make_windows_package.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -# Run this script in the top nanopb directory to create a binary package -# for Windows users. This script is designed to run under MingW/MSYS bash -# and requires the following tools: git, make, zip, unix2dos - -set -e -set -x - -VERSION=`git describe --always`-windows-x86 -DEST=dist/$VERSION - -rm -rf $DEST -mkdir -p $DEST - -# Export the files from newest commit -git archive HEAD | tar x -C $DEST - -# Rebuild the Python .proto files -make -BC $DEST/generator/proto - -# Make the nanopb generator available as a protoc plugin -cp $DEST/generator/nanopb_generator.py $DEST/generator/protoc-gen-nanopb.py - -# Package the Python libraries -( cd $DEST/generator; bbfreeze nanopb_generator.py protoc-gen-nanopb.py ) -mv $DEST/generator/dist $DEST/generator-bin - -# Remove temp file -rm $DEST/generator/protoc-gen-nanopb.py - -# The python interpreter requires MSVCR90.dll. -# FIXME: Find a way around hardcoding this path -cp /c/windows/winsxs/x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4974_none_50940634bcb759cb/MSVCR90.DLL $DEST/generator-bin/ -cat > $DEST/generator-bin/Microsoft.VC90.CRT.manifest < - - - - KSaO8M0iCtPF6YEr79P1dZsnomY= ojDmTgpYMFRKJYkPcM6ckpYkWUU= tVogb8kezDre2mXShlIqpp8ErIg= - -EOF - -# Package the protoc compiler -cp `which protoc.exe` $DEST/generator-bin/ -cp `which MSVCR100.DLL` $DEST/generator-bin/ -cp `which MSVCP100.DLL` $DEST/generator-bin/ - -# Convert line breaks for convenience -find $DEST -name '*.c' -o -name '*.h' -o -name '*.txt' \ - -o -name '*.proto' -o -name '*.py' -o -name '*.options' \ - -exec unix2dos '{}' \; - -# Zip it all up -( cd dist; zip -r $VERSION.zip $VERSION ) diff --git a/third_party/nanopb/tools/set_version.sh b/third_party/nanopb/tools/set_version.sh deleted file mode 100755 index e15a859d8a1..00000000000 --- a/third_party/nanopb/tools/set_version.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# Run this from the top directory of nanopb tree. -# e.g. user@localhost:~/nanopb$ tools/set_version.sh nanopb-0.1.9-dev -# It sets the version number in pb.h and generator/nanopb_generator.py. - -sed -i -e 's/nanopb_version\s*=\s*"[^"]*"/nanopb_version = "'$1'"/' generator/nanopb_generator.py -sed -i -e 's/#define\s*NANOPB_VERSION\s*.*/#define NANOPB_VERSION '$1'/' pb.h - - diff --git a/tools/codegen/core/gen_nano_proto.sh b/tools/codegen/core/gen_nano_proto.sh deleted file mode 100755 index 15495917467..00000000000 --- a/tools/codegen/core/gen_nano_proto.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash - -# Copyright 2016 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Example usage: -# tools/codegen/core/gen_nano_proto.sh \ -# src/proto/grpc/lb/v1/load_balancer.proto \ -# $PWD/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1 \ -# src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1 -# -# Exit statuses: -# 1: Incorrect number of arguments -# 2: Input proto file (1st argument) doesn't exist or is not a regular file. -# 3: Options file for nanopb not found in same dir as the input proto file. -# 4: Output dir not an absolute path. -# 5: Couldn't create output directory (2nd argument). - -set -ex -if [ $# -lt 2 ] || [ $# -gt 3 ]; then - echo "Usage: $0 [grpc path]" - exit 1 -fi - -readonly GRPC_ROOT="$PWD" -readonly INPUT_PROTO="$1" -readonly OUTPUT_DIR="$2" -readonly GRPC_OUTPUT_DIR="${3:-$OUTPUT_DIR}" -readonly EXPECTED_OPTIONS_FILE_PATH="${1%.*}.options" - -if [[ ! -f "$INPUT_PROTO" ]]; then - echo "Input proto file '$INPUT_PROTO' doesn't exist." - exit 2 -fi - -if [[ ! -f "${EXPECTED_OPTIONS_FILE_PATH}" ]]; then - echo "Input proto file may need .options file to be correctly compiled." -fi - -if [[ "${OUTPUT_DIR:0:1}" != '/' ]]; then - echo "The output directory must be an absolute path. Got '$OUTPUT_DIR'" - exit 4 -fi - -mkdir -p "$OUTPUT_DIR" -if [ $? != 0 ]; then - echo "Error creating output directory $OUTPUT_DIR" - exit 5 -fi - -readonly VENV_DIR=$(mktemp -d) -readonly VENV_NAME="nanopb-$(date '+%Y%m%d_%H%M%S_%N')" -pushd $VENV_DIR -virtualenv $VENV_NAME -. $VENV_NAME/bin/activate -popd - -# this should be the same version as the submodule we compile against -# ideally we'd update this as a template to ensure that -pip install protobuf==3.6.0 - -pushd "$(dirname $INPUT_PROTO)" > /dev/null - -protoc \ ---plugin=protoc-gen-nanopb="$GRPC_ROOT/third_party/nanopb/generator/protoc-gen-nanopb" \ ---nanopb_out='-T -Q#include\ \"'"${GRPC_OUTPUT_DIR}"'/%s\" -L#include\ \"pb.h\"'":$OUTPUT_DIR" \ -"$(basename $INPUT_PROTO)" - -deactivate -rm -rf $VENV_DIR - -popd > /dev/null diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index a67802b2a2c..602a1574a4e 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -75,18 +75,6 @@ _EXEMPT = frozenset(( 'examples/python/multiplex/route_guide_pb2_grpc.py', 'examples/python/route_guide/route_guide_pb2.py', 'examples/python/route_guide/route_guide_pb2_grpc.py', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h', - 'src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c', - 'src/core/tsi/alts/handshaker/altscontext.pb.h', - 'src/core/tsi/alts/handshaker/altscontext.pb.c', - 'src/core/tsi/alts/handshaker/handshaker.pb.h', - 'src/core/tsi/alts/handshaker/handshaker.pb.c', - 'src/core/tsi/alts/handshaker/transport_security_common.pb.h', - 'src/core/tsi/alts/handshaker/transport_security_common.pb.c', # An older file originally from outside gRPC. 'src/php/tests/bootstrap.php', diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 3e6b641c8e4..3b7af742baa 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1292,10 +1292,6 @@ src/cpp/util/byte_buffer_cc.cc \ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ -third_party/nanopb/pb.h \ -third_party/nanopb/pb_common.h \ -third_party/nanopb/pb_decode.h \ -third_party/nanopb/pb_encode.h \ third_party/upb/upb/decode.c \ third_party/upb/upb/decode.h \ third_party/upb/upb/encode.c \ diff --git a/tools/run_tests/sanity/check_bazel_workspace.py b/tools/run_tests/sanity/check_bazel_workspace.py index 73b13a883d8..ea9ad81c1f6 100755 --- a/tools/run_tests/sanity/check_bazel_workspace.py +++ b/tools/run_tests/sanity/check_bazel_workspace.py @@ -49,7 +49,6 @@ _GRPC_DEP_NAMES = [ 'com_google_protobuf', 'com_github_google_googletest', 'com_github_gflags_gflags', - 'com_github_nanopb_nanopb', 'com_github_google_benchmark', 'com_github_cares_cares', 'com_google_absl', @@ -147,12 +146,9 @@ names_without_bazel_only_deps = names_and_urls.keys() for dep_name in _GRPC_BAZEL_ONLY_DEPS: names_without_bazel_only_deps.remove(dep_name) archive_urls = [names_and_urls[name] for name in names_without_bazel_only_deps] -# Exclude nanopb from the check: it's not a submodule for distribution reasons, -# but it's a workspace dependency to enable users to use their own version. workspace_git_hashes = { re.search(git_hash_pattern, url).group() for url in archive_urls - if 'nanopb' not in url } if len(workspace_git_hashes) == 0: print("(Likely) parse error, did not find any bazel git dependencies.") From 8ce740cfe0dea62ab7eeffdfa218b012af6fc9aa Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 21 Aug 2019 14:24:06 -0700 Subject: [PATCH 411/661] Switch py_proto_library from using src to deps to conform with google3 --- bazel/python_rules.bzl | 8 ++++---- bazel/test/python_test_repo/BUILD | 6 +++--- src/proto/grpc/testing/BUILD | 6 +++--- src/proto/grpc/testing/proto2/BUILD.bazel | 4 ++-- src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel | 2 +- .../grpcio_health_checking/grpc_health/v1/BUILD.bazel | 2 +- .../grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl index 0f00d53b6fb..12f51f8b172 100644 --- a/bazel/python_rules.bzl +++ b/bazel/python_rules.bzl @@ -61,22 +61,22 @@ _generate_pb2_src = rule( def py_proto_library( name, - srcs, + deps, **kwargs): """Generate python code for a protobuf. Args: name: The name of the target. - srcs: A list of proto_library dependencies. Must contain a single element. + deps: A list of proto_library dependencies. Must contain a single element. """ codegen_target = "_{}_codegen".format(name) - if len(srcs) != 1: + if len(deps) != 1: fail("Can only compile a single proto at a time.") _generate_pb2_src( name = codegen_target, - deps = srcs, + deps = deps, **kwargs ) diff --git a/bazel/test/python_test_repo/BUILD b/bazel/test/python_test_repo/BUILD index 0df3700ec93..8aba6a78528 100644 --- a/bazel/test/python_test_repo/BUILD +++ b/bazel/test/python_test_repo/BUILD @@ -29,7 +29,7 @@ proto_library( py_proto_library( name = "helloworld_py_pb2", - srcs = [":helloworld_proto"], + deps = [":helloworld_proto"], ) py_grpc_library( @@ -40,12 +40,12 @@ py_grpc_library( py_proto_library( name = "duration_py_pb2", - srcs = ["@com_google_protobuf//:duration_proto"], + deps = ["@com_google_protobuf//:duration_proto"], ) py_proto_library( name = "timestamp_py_pb2", - srcs = ["@com_google_protobuf//:timestamp_proto"], + deps = ["@com_google_protobuf//:timestamp_proto"], ) py_test( diff --git a/src/proto/grpc/testing/BUILD b/src/proto/grpc/testing/BUILD index 8bea8ed7ca0..bc481606500 100644 --- a/src/proto/grpc/testing/BUILD +++ b/src/proto/grpc/testing/BUILD @@ -75,7 +75,7 @@ proto_library( py_proto_library( name = "empty_py_pb2", - srcs = [":empty_proto_descriptor"], + deps = [":empty_proto_descriptor"], ) py_grpc_library( @@ -97,7 +97,7 @@ proto_library( py_proto_library( name = "py_messages_proto", - srcs = [":messages_proto_descriptor"], + deps = [":messages_proto_descriptor"], ) py_grpc_library( @@ -206,7 +206,7 @@ proto_library( py_proto_library( name = "py_test_proto", - srcs = [":test_proto_descriptor"], + deps = [":test_proto_descriptor"], ) py_grpc_library( diff --git a/src/proto/grpc/testing/proto2/BUILD.bazel b/src/proto/grpc/testing/proto2/BUILD.bazel index 668d0a484ea..8acb233302a 100644 --- a/src/proto/grpc/testing/proto2/BUILD.bazel +++ b/src/proto/grpc/testing/proto2/BUILD.bazel @@ -10,7 +10,7 @@ proto_library( py_proto_library( name = "empty2_proto", - srcs = [":empty2_proto_descriptor"], + deps = [":empty2_proto_descriptor"], ) proto_library( @@ -23,6 +23,6 @@ proto_library( py_proto_library( name = "empty2_extensions_proto", - srcs = [":empty2_extensions_proto_descriptor"], + deps = [":empty2_extensions_proto_descriptor"], ) diff --git a/src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel b/src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel index c0a7e3d3026..5f4e512e9f4 100644 --- a/src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel +++ b/src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel @@ -3,7 +3,7 @@ package(default_visibility = ["//visibility:public"]) py_proto_library( name = "channelz_py_pb2", - srcs = ["//src/proto/grpc/channelz:channelz_proto_descriptors"], + deps = ["//src/proto/grpc/channelz:channelz_proto_descriptors"], ) py_grpc_library( diff --git a/src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel b/src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel index 0ee176f0506..62a44df7707 100644 --- a/src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel +++ b/src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel @@ -3,7 +3,7 @@ package(default_visibility = ["//visibility:public"]) py_proto_library( name = "health_py_pb2", - srcs = ["//src/proto/grpc/health/v1:health_proto_descriptor",], + deps = ["//src/proto/grpc/health/v1:health_proto_descriptor",], ) py_grpc_library( diff --git a/src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel b/src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel index 49bc517caf1..10077fd9568 100644 --- a/src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel +++ b/src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel @@ -5,7 +5,7 @@ package(default_visibility = ["//visibility:public"]) py_proto_library( name = "reflection_py_pb2", - srcs = ["//src/proto/grpc/reflection/v1alpha:reflection_proto_descriptor",], + deps = ["//src/proto/grpc/reflection/v1alpha:reflection_proto_descriptor",], ) py_grpc_library( From ba04bafede63e1760385f14f40d8d322699e31ed Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 21 Aug 2019 14:39:54 -0700 Subject: [PATCH 412/661] And the examples directory --- examples/python/cancellation/BUILD.bazel | 2 +- examples/python/multiprocessing/BUILD | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/python/cancellation/BUILD.bazel b/examples/python/cancellation/BUILD.bazel index 41b394a07a2..17b1b20168e 100644 --- a/examples/python/cancellation/BUILD.bazel +++ b/examples/python/cancellation/BUILD.bazel @@ -26,7 +26,7 @@ proto_library( py_proto_library( name = "hash_name_py_pb2", - srcs = [":hash_name_proto"], + deps = [":hash_name_proto"], ) py_grpc_library( diff --git a/examples/python/multiprocessing/BUILD b/examples/python/multiprocessing/BUILD index 257523f14bb..490aea0c1e6 100644 --- a/examples/python/multiprocessing/BUILD +++ b/examples/python/multiprocessing/BUILD @@ -23,7 +23,7 @@ proto_library( py_proto_library( name = "prime_proto_pb2", - srcs = [":prime_proto"], + deps = [":prime_proto"], ) py_grpc_library( From 013ac94821951e456ff99f0326caba1bb88bf1e1 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 21 Aug 2019 15:10:02 -0700 Subject: [PATCH 413/661] And another --- examples/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/BUILD b/examples/BUILD index 6f801963c6e..1455d25dc76 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -67,7 +67,7 @@ proto_library( py_proto_library( name = "helloworld_py_pb2", - srcs = [":protos/helloworld_proto"], + deps = [":protos/helloworld_proto"], ) py_grpc_library( From 28b06712352ed5e264647437fe3fe6f0de1b9d10 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Wed, 21 Aug 2019 15:53:56 -0700 Subject: [PATCH 414/661] Make MethodHandler and related interfaces generic --- BUILD | 2 + BUILD.gn | 1 + CMakeLists.txt | 5 +- Makefile | 4 + build.yaml | 1 + gRPC-C++.podspec | 1 + include/grpcpp/impl/codegen/byte_buffer.h | 27 +-- .../impl/codegen/completion_queue_impl.h | 33 ++-- include/grpcpp/impl/codegen/method_handler.h | 73 ++++++++ .../grpcpp/impl/codegen/method_handler_impl.h | 176 ++++++++++-------- .../impl/codegen/security/auth_context.h | 6 +- .../grpcpp/impl/codegen/server_context_impl.h | 31 ++- .../grpcpp/impl/codegen/server_interface.h | 2 + .../grpcpp/impl/codegen/sync_stream_impl.h | 10 +- include/grpcpp/support/method_handler.h | 24 +++ src/compiler/cpp_generator.cc | 4 +- src/cpp/server/server_cc.cc | 2 +- tools/doxygen/Doxyfile.c++ | 1 + tools/doxygen/Doxyfile.c++.internal | 1 + 19 files changed, 268 insertions(+), 136 deletions(-) create mode 100644 include/grpcpp/impl/codegen/method_handler.h create mode 100644 include/grpcpp/support/method_handler.h diff --git a/BUILD b/BUILD index c510757c35d..04f53e18248 100644 --- a/BUILD +++ b/BUILD @@ -280,6 +280,7 @@ GRPCXX_PUBLIC_HDRS = [ "include/grpcpp/support/config.h", "include/grpcpp/support/interceptor.h", "include/grpcpp/support/message_allocator.h", + "include/grpcpp/support/method_handler.h", "include/grpcpp/support/proto_buffer_reader.h", "include/grpcpp/support/proto_buffer_writer.h", "include/grpcpp/support/server_callback.h", @@ -2027,6 +2028,7 @@ grpc_cc_library( "include/grpcpp/impl/codegen/interceptor_common.h", "include/grpcpp/impl/codegen/message_allocator.h", "include/grpcpp/impl/codegen/metadata_map.h", + "include/grpcpp/impl/codegen/method_handler.h", "include/grpcpp/impl/codegen/method_handler_impl.h", "include/grpcpp/impl/codegen/rpc_method.h", "include/grpcpp/impl/codegen/rpc_service_method.h", diff --git a/BUILD.gn b/BUILD.gn index eea022eac51..6ee85b19383 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1107,6 +1107,7 @@ config("grpc_config") { "include/grpcpp/impl/codegen/interceptor_common.h", "include/grpcpp/impl/codegen/message_allocator.h", "include/grpcpp/impl/codegen/metadata_map.h", + "include/grpcpp/impl/codegen/method_handler.h", "include/grpcpp/impl/codegen/method_handler_impl.h", "include/grpcpp/impl/codegen/proto_buffer_reader.h", "include/grpcpp/impl/codegen/proto_buffer_writer.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 65aadb7cf1a..d204d3799da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3480,6 +3480,7 @@ foreach(_hdr include/grpcpp/impl/codegen/interceptor_common.h include/grpcpp/impl/codegen/message_allocator.h include/grpcpp/impl/codegen/metadata_map.h + include/grpcpp/impl/codegen/method_handler.h include/grpcpp/impl/codegen/method_handler_impl.h include/grpcpp/impl/codegen/rpc_method.h include/grpcpp/impl/codegen/rpc_service_method.h @@ -3993,6 +3994,7 @@ foreach(_hdr include/grpcpp/impl/codegen/interceptor_common.h include/grpcpp/impl/codegen/message_allocator.h include/grpcpp/impl/codegen/metadata_map.h + include/grpcpp/impl/codegen/method_handler.h include/grpcpp/impl/codegen/method_handler_impl.h include/grpcpp/impl/codegen/rpc_method.h include/grpcpp/impl/codegen/rpc_service_method.h @@ -4202,6 +4204,7 @@ foreach(_hdr include/grpcpp/impl/codegen/interceptor_common.h include/grpcpp/impl/codegen/message_allocator.h include/grpcpp/impl/codegen/metadata_map.h + include/grpcpp/impl/codegen/method_handler.h include/grpcpp/impl/codegen/method_handler_impl.h include/grpcpp/impl/codegen/rpc_method.h include/grpcpp/impl/codegen/rpc_service_method.h @@ -4580,6 +4583,7 @@ foreach(_hdr include/grpcpp/impl/codegen/interceptor_common.h include/grpcpp/impl/codegen/message_allocator.h include/grpcpp/impl/codegen/metadata_map.h + include/grpcpp/impl/codegen/method_handler.h include/grpcpp/impl/codegen/method_handler_impl.h include/grpcpp/impl/codegen/rpc_method.h include/grpcpp/impl/codegen/rpc_service_method.h @@ -17370,7 +17374,6 @@ target_include_directories(timer_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} diff --git a/Makefile b/Makefile index e28b9bb2f45..ef0a86eb36a 100644 --- a/Makefile +++ b/Makefile @@ -5857,6 +5857,7 @@ PUBLIC_HEADERS_CXX += \ include/grpcpp/impl/codegen/interceptor_common.h \ include/grpcpp/impl/codegen/message_allocator.h \ include/grpcpp/impl/codegen/metadata_map.h \ + include/grpcpp/impl/codegen/method_handler.h \ include/grpcpp/impl/codegen/method_handler_impl.h \ include/grpcpp/impl/codegen/rpc_method.h \ include/grpcpp/impl/codegen/rpc_service_method.h \ @@ -6328,6 +6329,7 @@ PUBLIC_HEADERS_CXX += \ include/grpcpp/impl/codegen/interceptor_common.h \ include/grpcpp/impl/codegen/message_allocator.h \ include/grpcpp/impl/codegen/metadata_map.h \ + include/grpcpp/impl/codegen/method_handler.h \ include/grpcpp/impl/codegen/method_handler_impl.h \ include/grpcpp/impl/codegen/rpc_method.h \ include/grpcpp/impl/codegen/rpc_service_method.h \ @@ -6506,6 +6508,7 @@ PUBLIC_HEADERS_CXX += \ include/grpcpp/impl/codegen/interceptor_common.h \ include/grpcpp/impl/codegen/message_allocator.h \ include/grpcpp/impl/codegen/metadata_map.h \ + include/grpcpp/impl/codegen/method_handler.h \ include/grpcpp/impl/codegen/method_handler_impl.h \ include/grpcpp/impl/codegen/rpc_method.h \ include/grpcpp/impl/codegen/rpc_service_method.h \ @@ -6888,6 +6891,7 @@ PUBLIC_HEADERS_CXX += \ include/grpcpp/impl/codegen/interceptor_common.h \ include/grpcpp/impl/codegen/message_allocator.h \ include/grpcpp/impl/codegen/metadata_map.h \ + include/grpcpp/impl/codegen/method_handler.h \ include/grpcpp/impl/codegen/method_handler_impl.h \ include/grpcpp/impl/codegen/rpc_method.h \ include/grpcpp/impl/codegen/rpc_service_method.h \ diff --git a/build.yaml b/build.yaml index ee5a45e26fd..454ce09facc 100644 --- a/build.yaml +++ b/build.yaml @@ -378,6 +378,7 @@ filegroups: - include/grpcpp/impl/codegen/interceptor_common.h - include/grpcpp/impl/codegen/message_allocator.h - include/grpcpp/impl/codegen/metadata_map.h + - include/grpcpp/impl/codegen/method_handler.h - include/grpcpp/impl/codegen/method_handler_impl.h - include/grpcpp/impl/codegen/rpc_method.h - include/grpcpp/impl/codegen/rpc_service_method.h diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index d71773a7361..80ea8c6b30a 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -186,6 +186,7 @@ Pod::Spec.new do |s| 'include/grpcpp/impl/codegen/interceptor_common.h', 'include/grpcpp/impl/codegen/message_allocator.h', 'include/grpcpp/impl/codegen/metadata_map.h', + 'include/grpcpp/impl/codegen/method_handler.h', 'include/grpcpp/impl/codegen/method_handler_impl.h', 'include/grpcpp/impl/codegen/rpc_method.h', 'include/grpcpp/impl/codegen/rpc_service_method.h', diff --git a/include/grpcpp/impl/codegen/byte_buffer.h b/include/grpcpp/impl/codegen/byte_buffer.h index 0b7be6fc753..7fb678d5f7f 100644 --- a/include/grpcpp/impl/codegen/byte_buffer.h +++ b/include/grpcpp/impl/codegen/byte_buffer.h @@ -36,6 +36,12 @@ template class CallbackUnaryHandler; template class CallbackServerStreamingHandler; +template +class RpcMethodHandler; +template +class ServerStreamingHandler; +template <::grpc::StatusCode code> +class ErrorMethodHandler; } // namespace internal } // namespace grpc_impl @@ -51,21 +57,10 @@ class CallOpSendMessage; template class CallOpRecvMessage; class CallOpGenericRecvMessage; -class MethodHandler; -template -class RpcMethodHandler; -template -class ServerStreamingHandler; -template -class ErrorMethodHandler; class ExternalConnectionAcceptorImpl; template class DeserializeFuncType; class GrpcByteBufferPeer; -template -class RpcMethodHandler; -template -class ServerStreamingHandler; } // namespace internal /// A sequence of bytes. @@ -175,19 +170,17 @@ class ByteBuffer final { friend class internal::CallOpRecvMessage; friend class internal::CallOpGenericRecvMessage; template - friend class RpcMethodHandler; - template - friend class ServerStreamingHandler; + friend class ::grpc_impl::internal::RpcMethodHandler; template - friend class internal::RpcMethodHandler; + friend class ::grpc_impl::internal::ServerStreamingHandler; template - friend class internal::ServerStreamingHandler; + friend class ::grpc_impl::internal::RpcMethodHandler; template friend class ::grpc_impl::internal::CallbackUnaryHandler; template friend class ::grpc_impl::internal::CallbackServerStreamingHandler; template - friend class internal::ErrorMethodHandler; + friend class ::grpc_impl::internal::ErrorMethodHandler; template friend class internal::DeserializeFuncType; friend class ProtoBufferReader; diff --git a/include/grpcpp/impl/codegen/completion_queue_impl.h b/include/grpcpp/impl/codegen/completion_queue_impl.h index 7716a57e84a..7cb3d2288c6 100644 --- a/include/grpcpp/impl/codegen/completion_queue_impl.h +++ b/include/grpcpp/impl/codegen/completion_queue_impl.h @@ -60,28 +60,27 @@ class ServerWriter; namespace internal { template class ServerReaderWriterBody; -} // namespace internal -} // namespace grpc_impl -namespace grpc { - -class ChannelInterface; -class ServerInterface; -namespace internal { -class CompletionQueueTag; -class RpcMethod; template class RpcMethodHandler; template class ClientStreamingHandler; template class ServerStreamingHandler; -template -class BidiStreamingHandler; template class TemplatedBidiStreamingHandler; -template +template <::grpc::StatusCode code> class ErrorMethodHandler; +} // namespace internal +} // namespace grpc_impl +namespace grpc { + +class ChannelInterface; +class ServerInterface; + +namespace internal { +class CompletionQueueTag; +class RpcMethod; template class BlockingUnaryCallImpl; template @@ -266,15 +265,15 @@ class CompletionQueue : private ::grpc::GrpcLibraryCodegen { template friend class ::grpc_impl::internal::ServerReaderWriterBody; template - friend class ::grpc::internal::RpcMethodHandler; + friend class ::grpc_impl::internal::RpcMethodHandler; template - friend class ::grpc::internal::ClientStreamingHandler; + friend class ::grpc_impl::internal::ClientStreamingHandler; template - friend class ::grpc::internal::ServerStreamingHandler; + friend class ::grpc_impl::internal::ServerStreamingHandler; template - friend class ::grpc::internal::TemplatedBidiStreamingHandler; + friend class ::grpc_impl::internal::TemplatedBidiStreamingHandler; template <::grpc::StatusCode code> - friend class ::grpc::internal::ErrorMethodHandler; + friend class ::grpc_impl::internal::ErrorMethodHandler; friend class ::grpc_impl::Server; friend class ::grpc_impl::ServerContext; friend class ::grpc::ServerInterface; diff --git a/include/grpcpp/impl/codegen/method_handler.h b/include/grpcpp/impl/codegen/method_handler.h new file mode 100644 index 00000000000..4b0f594f237 --- /dev/null +++ b/include/grpcpp/impl/codegen/method_handler.h @@ -0,0 +1,73 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_H +#define GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_H + +#include + +namespace grpc { + +namespace internal { + +template +using BidiStreamingHandler = + ::grpc_impl::internal::BidiStreamingHandler; + +template +using RpcMethodHandler = + ::grpc_impl::internal::RpcMethodHandler; + +template +using ClientStreamingHandler = + ::grpc_impl::internal::ClientStreamingHandler; + +template +using ServerStreamingHandler = + ::grpc_impl::internal::ServerStreamingHandler; + +template +using TemplatedBidiStreamingHandler = + ::grpc_impl::internal::TemplatedBidiStreamingHandler; + +template +using StreamedUnaryHandler = + ::grpc_impl::internal::StreamedUnaryHandler; + +template +using SplitServerStreamingHandler = + ::grpc_impl::internal::SplitServerStreamingHandler; + +template +using ErrorMethodHandler = ::grpc_impl::internal::ErrorMethodHandler; + +using UnknownMethodHandler = ::grpc_impl::internal::UnknownMethodHandler; + +using ResourceExhaustedHandler = + ::grpc_impl::internal::ResourceExhaustedHandler; + +} // namespace internal + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_H diff --git a/include/grpcpp/impl/codegen/method_handler_impl.h b/include/grpcpp/impl/codegen/method_handler_impl.h index 1903f898ba8..c36599800ca 100644 --- a/include/grpcpp/impl/codegen/method_handler_impl.h +++ b/include/grpcpp/impl/codegen/method_handler_impl.h @@ -22,9 +22,9 @@ #include #include #include -#include +#include -namespace grpc { +namespace grpc_impl { namespace internal { @@ -36,12 +36,13 @@ namespace internal { // Additionally, we don't need to return if we caught an exception or not; // the handling is the same in either case. template -Status CatchingFunctionHandler(Callable&& handler) { +::grpc::Status CatchingFunctionHandler(Callable&& handler) { #if GRPC_ALLOW_EXCEPTIONS try { return handler(); } catch (...) { - return Status(StatusCode::UNKNOWN, "Unexpected error in RPC handling"); + return ::grpc::Status(::grpc::StatusCode::UNKNOWN, + "Unexpected error in RPC handling"); } #else // GRPC_ALLOW_EXCEPTIONS return handler(); @@ -50,18 +51,18 @@ Status CatchingFunctionHandler(Callable&& handler) { /// A wrapper class of an application provided rpc method handler. template -class RpcMethodHandler : public MethodHandler { +class RpcMethodHandler : public ::grpc::internal::MethodHandler { public: RpcMethodHandler( - std::function + std::function<::grpc::Status(ServiceType*, ::grpc_impl::ServerContext*, + const RequestType*, ResponseType*)> func, ServiceType* service) : func_(func), service_(service) {} void RunHandler(const HandlerParameter& param) final { ResponseType rsp; - Status status = param.status; + ::grpc::Status status = param.status; if (status.ok()) { status = CatchingFunctionHandler([this, ¶m, &rsp] { return func_(service_, param.server_context, @@ -71,8 +72,9 @@ class RpcMethodHandler : public MethodHandler { } GPR_CODEGEN_ASSERT(!param.server_context->sent_initial_metadata_); - CallOpSet + ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, + ::grpc::internal::CallOpSendMessage, + ::grpc::internal::CallOpServerSendStatus> ops; ops.SendInitialMetadata(¶m.server_context->initial_metadata_, param.server_context->initial_metadata_flags()); @@ -87,13 +89,15 @@ class RpcMethodHandler : public MethodHandler { param.call->cq()->Pluck(&ops); } - void* Deserialize(grpc_call* call, grpc_byte_buffer* req, Status* status, - void** handler_data) final { - ByteBuffer buf; + void* Deserialize(grpc_call* call, grpc_byte_buffer* req, + ::grpc::Status* status, void** handler_data) final { + ::grpc::ByteBuffer buf; buf.set_buffer(req); - auto* request = new (g_core_codegen_interface->grpc_call_arena_alloc( - call, sizeof(RequestType))) RequestType(); - *status = SerializationTraits::Deserialize(&buf, request); + auto* request = + new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc( + call, sizeof(RequestType))) RequestType(); + *status = + ::grpc::SerializationTraits::Deserialize(&buf, request); buf.Release(); if (status->ok()) { return request; @@ -104,8 +108,8 @@ class RpcMethodHandler : public MethodHandler { private: /// Application provided rpc handler function. - std::function + std::function<::grpc::Status(ServiceType*, ::grpc_impl::ServerContext*, + const RequestType*, ResponseType*)> func_; // The class the above handler function lives in. ServiceType* service_; @@ -113,24 +117,28 @@ class RpcMethodHandler : public MethodHandler { /// A wrapper class of an application provided client streaming handler. template -class ClientStreamingHandler : public MethodHandler { +class ClientStreamingHandler : public ::grpc::internal::MethodHandler { public: ClientStreamingHandler( - std::function*, ResponseType*)> + std::function<::grpc::Status(ServiceType*, ::grpc_impl::ServerContext*, + ::grpc_impl::ServerReader*, + ResponseType*)> func, ServiceType* service) : func_(func), service_(service) {} void RunHandler(const HandlerParameter& param) final { - ServerReader reader(param.call, param.server_context); + ::grpc_impl::ServerReader reader(param.call, + param.server_context); ResponseType rsp; - Status status = CatchingFunctionHandler([this, ¶m, &reader, &rsp] { - return func_(service_, param.server_context, &reader, &rsp); - }); - - CallOpSet + ::grpc::Status status = + CatchingFunctionHandler([this, ¶m, &reader, &rsp] { + return func_(service_, param.server_context, &reader, &rsp); + }); + + ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, + ::grpc::internal::CallOpSendMessage, + ::grpc::internal::CallOpServerSendStatus> ops; if (!param.server_context->sent_initial_metadata_) { ops.SendInitialMetadata(¶m.server_context->initial_metadata_, @@ -148,27 +156,30 @@ class ClientStreamingHandler : public MethodHandler { } private: - std::function*, ResponseType*)> + std::function<::grpc::Status(ServiceType*, ::grpc_impl::ServerContext*, + ::grpc_impl::ServerReader*, + ResponseType*)> func_; ServiceType* service_; }; /// A wrapper class of an application provided server streaming handler. template -class ServerStreamingHandler : public MethodHandler { +class ServerStreamingHandler : public ::grpc::internal::MethodHandler { public: ServerStreamingHandler( - std::function*)> + std::function<::grpc::Status(ServiceType*, ::grpc_impl::ServerContext*, + const RequestType*, + ::grpc_impl::ServerWriter*)> func, ServiceType* service) : func_(func), service_(service) {} void RunHandler(const HandlerParameter& param) final { - Status status = param.status; + ::grpc::Status status = param.status; if (status.ok()) { - ServerWriter writer(param.call, param.server_context); + ::grpc_impl::ServerWriter writer(param.call, + param.server_context); status = CatchingFunctionHandler([this, ¶m, &writer] { return func_(service_, param.server_context, static_cast(param.request), &writer); @@ -176,7 +187,9 @@ class ServerStreamingHandler : public MethodHandler { static_cast(param.request)->~RequestType(); } - CallOpSet ops; + ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, + ::grpc::internal::CallOpServerSendStatus> + ops; if (!param.server_context->sent_initial_metadata_) { ops.SendInitialMetadata(¶m.server_context->initial_metadata_, param.server_context->initial_metadata_flags()); @@ -192,13 +205,15 @@ class ServerStreamingHandler : public MethodHandler { param.call->cq()->Pluck(&ops); } - void* Deserialize(grpc_call* call, grpc_byte_buffer* req, Status* status, - void** handler_data) final { - ByteBuffer buf; + void* Deserialize(grpc_call* call, grpc_byte_buffer* req, + ::grpc::Status* status, void** handler_data) final { + ::grpc::ByteBuffer buf; buf.set_buffer(req); - auto* request = new (g_core_codegen_interface->grpc_call_arena_alloc( - call, sizeof(RequestType))) RequestType(); - *status = SerializationTraits::Deserialize(&buf, request); + auto* request = + new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc( + call, sizeof(RequestType))) RequestType(); + *status = + ::grpc::SerializationTraits::Deserialize(&buf, request); buf.Release(); if (status->ok()) { return request; @@ -208,8 +223,9 @@ class ServerStreamingHandler : public MethodHandler { } private: - std::function*)> + std::function<::grpc::Status(ServiceType*, ::grpc_impl::ServerContext*, + const RequestType*, + ::grpc_impl::ServerWriter*)> func_; ServiceType* service_; }; @@ -222,19 +238,22 @@ class ServerStreamingHandler : public MethodHandler { /// Instead, it is expected to be an implicitly-captured argument of func /// (through bind or something along those lines) template -class TemplatedBidiStreamingHandler : public MethodHandler { +class TemplatedBidiStreamingHandler : public ::grpc::internal::MethodHandler { public: TemplatedBidiStreamingHandler( - std::function func) + std::function<::grpc::Status(::grpc_impl::ServerContext*, Streamer*)> + func) : func_(func), write_needed_(WriteNeeded) {} void RunHandler(const HandlerParameter& param) final { Streamer stream(param.call, param.server_context); - Status status = CatchingFunctionHandler([this, ¶m, &stream] { + ::grpc::Status status = CatchingFunctionHandler([this, ¶m, &stream] { return func_(param.server_context, &stream); }); - CallOpSet ops; + ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, + ::grpc::internal::CallOpServerSendStatus> + ops; if (!param.server_context->sent_initial_metadata_) { ops.SendInitialMetadata(¶m.server_context->initial_metadata_, param.server_context->initial_metadata_flags()); @@ -244,8 +263,8 @@ class TemplatedBidiStreamingHandler : public MethodHandler { if (write_needed_ && status.ok()) { // If we needed a write but never did one, we need to mark the // status as a fail - status = Status(StatusCode::INTERNAL, - "Service did not provide response message"); + status = ::grpc::Status(::grpc::StatusCode::INTERNAL, + "Service did not provide response message"); } } ops.ServerSendStatus(¶m.server_context->trailing_metadata_, status); @@ -257,59 +276,65 @@ class TemplatedBidiStreamingHandler : public MethodHandler { } private: - std::function func_; + std::function<::grpc::Status(::grpc_impl::ServerContext*, Streamer*)> func_; const bool write_needed_; }; template class BidiStreamingHandler : public TemplatedBidiStreamingHandler< - ServerReaderWriter, false> { + ::grpc_impl::ServerReaderWriter, false> { public: BidiStreamingHandler( - std::function*)> + std::function<::grpc::Status( + ServiceType*, ::grpc_impl::ServerContext*, + ::grpc_impl::ServerReaderWriter*)> func, ServiceType* service) : TemplatedBidiStreamingHandler< - ServerReaderWriter, false>(std::bind( - func, service, std::placeholders::_1, std::placeholders::_2)) {} + ::grpc_impl::ServerReaderWriter, false>( + std::bind(func, service, std::placeholders::_1, + std::placeholders::_2)) {} }; template class StreamedUnaryHandler : public TemplatedBidiStreamingHandler< - ServerUnaryStreamer, true> { + ::grpc_impl::ServerUnaryStreamer, true> { public: explicit StreamedUnaryHandler( - std::function*)> + std::function<::grpc::Status( + ::grpc_impl::ServerContext*, + ::grpc_impl::ServerUnaryStreamer*)> func) : TemplatedBidiStreamingHandler< - ServerUnaryStreamer, true>(func) {} + ::grpc_impl::ServerUnaryStreamer, true>( + func) {} }; template class SplitServerStreamingHandler : public TemplatedBidiStreamingHandler< - ServerSplitStreamer, false> { + ::grpc_impl::ServerSplitStreamer, false> { public: explicit SplitServerStreamingHandler( - std::function*)> + std::function<::grpc::Status( + ::grpc_impl::ServerContext*, + ::grpc_impl::ServerSplitStreamer*)> func) : TemplatedBidiStreamingHandler< - ServerSplitStreamer, false>(func) {} + ::grpc_impl::ServerSplitStreamer, false>( + func) {} }; /// General method handler class for errors that prevent real method use /// e.g., handle unknown method by returning UNIMPLEMENTED error. -template -class ErrorMethodHandler : public MethodHandler { +template <::grpc::StatusCode code> +class ErrorMethodHandler : public ::grpc::internal::MethodHandler { public: template static void FillOps(::grpc_impl::ServerContext* context, T* ops) { - Status status(code, ""); + ::grpc::Status status(code, ""); if (!context->sent_initial_metadata_) { ops->SendInitialMetadata(&context->initial_metadata_, context->initial_metadata_flags()); @@ -322,27 +347,30 @@ class ErrorMethodHandler : public MethodHandler { } void RunHandler(const HandlerParameter& param) final { - CallOpSet ops; + ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, + ::grpc::internal::CallOpServerSendStatus> + ops; FillOps(param.server_context, &ops); param.call->PerformOps(&ops); param.call->cq()->Pluck(&ops); } - void* Deserialize(grpc_call* call, grpc_byte_buffer* req, Status* status, - void** handler_data) final { + void* Deserialize(grpc_call* call, grpc_byte_buffer* req, + ::grpc::Status* status, void** handler_data) final { // We have to destroy any request payload if (req != nullptr) { - g_core_codegen_interface->grpc_byte_buffer_destroy(req); + ::grpc::g_core_codegen_interface->grpc_byte_buffer_destroy(req); } return nullptr; } }; -typedef ErrorMethodHandler UnknownMethodHandler; -typedef ErrorMethodHandler +typedef ErrorMethodHandler<::grpc::StatusCode::UNIMPLEMENTED> + UnknownMethodHandler; +typedef ErrorMethodHandler<::grpc::StatusCode::RESOURCE_EXHAUSTED> ResourceExhaustedHandler; } // namespace internal -} // namespace grpc +} // namespace grpc_impl #endif // GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H diff --git a/include/grpcpp/impl/codegen/security/auth_context.h b/include/grpcpp/impl/codegen/security/auth_context.h index 0e30f7cc3f4..6c0089ca424 100644 --- a/include/grpcpp/impl/codegen/security/auth_context.h +++ b/include/grpcpp/impl/codegen/security/auth_context.h @@ -32,7 +32,7 @@ struct grpc_auth_property_iterator; namespace grpc { class SecureAuthContext; -typedef std::pair AuthProperty; +typedef std::pair AuthProperty; class AuthPropertyIterator : public std::iterator { @@ -86,8 +86,8 @@ class AuthContext { /// Mutation functions: should only be used by an AuthMetadataProcessor. virtual void AddProperty(const grpc::string& key, - const grpc::string_ref& value) = 0; - virtual bool SetPeerIdentityPropertyName(const grpc::string& name) = 0; + const string_ref& value) = 0; + virtual bool SetPeerIdentityPropertyName(const string& name) = 0; }; } // namespace grpc diff --git a/include/grpcpp/impl/codegen/server_context_impl.h b/include/grpcpp/impl/codegen/server_context_impl.h index 72137f153b1..7e2a5720199 100644 --- a/include/grpcpp/impl/codegen/server_context_impl.h +++ b/include/grpcpp/impl/codegen/server_context_impl.h @@ -68,9 +68,19 @@ template class CallbackServerStreamingHandler; template class CallbackBidiHandler; +template +class ClientStreamingHandler; +template +class RpcMethodHandler; template class ServerReaderWriterBody; +template +class ServerStreamingHandler; class ServerReactor; +template +class TemplatedBidiStreamingHandler; +template <::grpc::StatusCode code> +class ErrorMethodHandler; } // namespace internal } // namespace grpc_impl @@ -79,20 +89,9 @@ class GenericServerContext; class ServerInterface; namespace internal { -template -class ClientStreamingHandler; -template -class ServerStreamingHandler; -template -class RpcMethodHandler; -template -class TemplatedBidiStreamingHandler; -template -class ErrorMethodHandler; class Call; } // namespace internal -class ServerInterface; namespace testing { class InteropServerContextInspector; class ServerContextTestSpouse; @@ -293,13 +292,13 @@ class ServerContext { template friend class ::grpc_impl::internal::ServerReaderWriterBody; template - friend class ::grpc::internal::RpcMethodHandler; + friend class ::grpc_impl::internal::RpcMethodHandler; template - friend class ::grpc::internal::ClientStreamingHandler; + friend class ::grpc_impl::internal::ClientStreamingHandler; template - friend class ::grpc::internal::ServerStreamingHandler; + friend class ::grpc_impl::internal::ServerStreamingHandler; template - friend class ::grpc::internal::TemplatedBidiStreamingHandler; + friend class ::grpc_impl::internal::TemplatedBidiStreamingHandler; template friend class ::grpc_impl::internal::CallbackUnaryHandler; template @@ -309,7 +308,7 @@ class ServerContext { template friend class ::grpc_impl::internal::CallbackBidiHandler; template <::grpc::StatusCode code> - friend class ::grpc::internal::ErrorMethodHandler; + friend class ::grpc_impl::internal::ErrorMethodHandler; friend class ::grpc_impl::ClientContext; friend class ::grpc::GenericServerContext; diff --git a/include/grpcpp/impl/codegen/server_interface.h b/include/grpcpp/impl/codegen/server_interface.h index a375d3c0b4c..46c4ebb11a5 100644 --- a/include/grpcpp/impl/codegen/server_interface.h +++ b/include/grpcpp/impl/codegen/server_interface.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -52,6 +53,7 @@ class ServerAsyncStreamingInterface; namespace experimental { class CallbackGenericService; +class ServerInterceptorFactoryInterface; } // namespace experimental class ServerInterface : public internal::CallHook { diff --git a/include/grpcpp/impl/codegen/sync_stream_impl.h b/include/grpcpp/impl/codegen/sync_stream_impl.h index dc764e0e27b..ec9cf49862d 100644 --- a/include/grpcpp/impl/codegen/sync_stream_impl.h +++ b/include/grpcpp/impl/codegen/sync_stream_impl.h @@ -613,7 +613,7 @@ class ServerReader final : public ServerReaderInterface { ServerContext* const ctx_; template - friend class ::grpc::internal::ClientStreamingHandler; + friend class ::grpc_impl::internal::ClientStreamingHandler; ServerReader(::grpc::internal::Call* call, ::grpc_impl::ServerContext* ctx) : call_(call), ctx_(ctx) {} @@ -688,7 +688,7 @@ class ServerWriter final : public ServerWriterInterface { ::grpc_impl::ServerContext* const ctx_; template - friend class ::grpc::internal::ServerStreamingHandler; + friend class ::grpc_impl::internal::ServerStreamingHandler; ServerWriter(::grpc::internal::Call* call, ::grpc_impl::ServerContext* ctx) : call_(call), ctx_(ctx) {} @@ -800,7 +800,7 @@ class ServerReaderWriter final : public ServerReaderWriterInterface { private: internal::ServerReaderWriterBody body_; - friend class ::grpc::internal::TemplatedBidiStreamingHandler< + friend class ::grpc_impl::internal::TemplatedBidiStreamingHandler< ServerReaderWriter, false>; ServerReaderWriter(::grpc::internal::Call* call, ::grpc_impl::ServerContext* ctx) @@ -870,7 +870,7 @@ class ServerUnaryStreamer final bool read_done_; bool write_done_; - friend class ::grpc::internal::TemplatedBidiStreamingHandler< + friend class ::grpc_impl::internal::TemplatedBidiStreamingHandler< ServerUnaryStreamer, true>; ServerUnaryStreamer(::grpc::internal::Call* call, ::grpc_impl::ServerContext* ctx) @@ -932,7 +932,7 @@ class ServerSplitStreamer final internal::ServerReaderWriterBody body_; bool read_done_; - friend class ::grpc::internal::TemplatedBidiStreamingHandler< + friend class ::grpc_impl::internal::TemplatedBidiStreamingHandler< ServerSplitStreamer, false>; ServerSplitStreamer(::grpc::internal::Call* call, ::grpc_impl::ServerContext* ctx) diff --git a/include/grpcpp/support/method_handler.h b/include/grpcpp/support/method_handler.h new file mode 100644 index 00000000000..038e76c8af8 --- /dev/null +++ b/include/grpcpp/support/method_handler.h @@ -0,0 +1,24 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_METHOD_HANDLER_H +#define GRPCPP_SUPPORT_METHOD_HANDLER_H + +#include + +#endif // GRPCPP_SUPPORT_METHOD_HANDLER_H diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 044647d9a81..e63bdf6de98 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -144,7 +144,7 @@ grpc::string GetHeaderIncludes(grpc_generator::File* file, "grpcpp/impl/codegen/client_callback.h", "grpcpp/impl/codegen/client_context.h", "grpcpp/impl/codegen/completion_queue.h", - "grpcpp/impl/codegen/method_handler_impl.h", + "grpcpp/impl/codegen/method_handler.h", "grpcpp/impl/codegen/proto_utils.h", "grpcpp/impl/codegen/rpc_method.h", "grpcpp/impl/codegen/server_callback.h", @@ -1657,7 +1657,7 @@ grpc::string GetSourceIncludes(grpc_generator::File* file, "grpcpp/impl/codegen/channel_interface.h", "grpcpp/impl/codegen/client_unary_call.h", "grpcpp/impl/codegen/client_callback.h", - "grpcpp/impl/codegen/method_handler_impl.h", + "grpcpp/impl/codegen/method_handler.h", "grpcpp/impl/codegen/rpc_service_method.h", "grpcpp/impl/codegen/server_callback.h", "grpcpp/impl/codegen/service_type.h", diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 02cfb59c0e6..f7984645c42 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -31,9 +31,9 @@ #include #include #include +#include #include #include -#include #include #include #include diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 168e6c8d770..cef7cc20b1d 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -979,6 +979,7 @@ include/grpcpp/impl/codegen/interceptor.h \ include/grpcpp/impl/codegen/interceptor_common.h \ include/grpcpp/impl/codegen/message_allocator.h \ include/grpcpp/impl/codegen/metadata_map.h \ +include/grpcpp/impl/codegen/method_handler.h \ include/grpcpp/impl/codegen/method_handler_impl.h \ include/grpcpp/impl/codegen/proto_buffer_reader.h \ include/grpcpp/impl/codegen/proto_buffer_writer.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 3b7af742baa..6359c45665a 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -981,6 +981,7 @@ include/grpcpp/impl/codegen/interceptor.h \ include/grpcpp/impl/codegen/interceptor_common.h \ include/grpcpp/impl/codegen/message_allocator.h \ include/grpcpp/impl/codegen/metadata_map.h \ +include/grpcpp/impl/codegen/method_handler.h \ include/grpcpp/impl/codegen/method_handler_impl.h \ include/grpcpp/impl/codegen/proto_buffer_reader.h \ include/grpcpp/impl/codegen/proto_buffer_writer.h \ From 6b3bd74e686e65ee7a0ec8913ef2ecacef34cbcf Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Wed, 21 Aug 2019 16:17:13 -0700 Subject: [PATCH 415/661] Fix CMakeLists.txt --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d204d3799da..40dcf9e3ec4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -792,6 +792,7 @@ target_include_directories(address_sorting PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} + PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} From 957a686a70b2cd2c386182eaafd14224e8bc6338 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Wed, 21 Aug 2019 16:20:26 -0700 Subject: [PATCH 416/661] Fix the nano pb from CMakeLists.txt --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40dcf9e3ec4..d204d3799da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -792,7 +792,6 @@ target_include_directories(address_sorting PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} From 2b8ad5ee56ccd68a9092084e1bcaf760f3eae1f8 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Wed, 21 Aug 2019 16:30:51 -0700 Subject: [PATCH 417/661] Fix golden test compilation --- test/cpp/codegen/compiler_test_golden | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/codegen/compiler_test_golden b/test/cpp/codegen/compiler_test_golden index 34fb5bfb53f..2c144f7d003 100644 --- a/test/cpp/codegen/compiler_test_golden +++ b/test/cpp/codegen/compiler_test_golden @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include From 66e1a2c92bb78dc522c537ce26a6dd5d535cca3c Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Wed, 21 Aug 2019 18:42:07 -0700 Subject: [PATCH 418/661] Generate projects --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65aadb7cf1a..28cd26555f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17370,7 +17370,6 @@ target_include_directories(timer_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} From 20e2964ada045d5bb95ef14d105a39f97a4ed1ae Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Wed, 21 Aug 2019 16:12:31 -0700 Subject: [PATCH 419/661] cfstream_test: workaround Apple CFStream bug --- CMakeLists.txt | 1 - test/cpp/end2end/cfstream_test.cc | 27 ++++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65aadb7cf1a..28cd26555f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17370,7 +17370,6 @@ target_include_directories(timer_test PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} PRIVATE ${_gRPC_CARES_INCLUDE_DIR} PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} PRIVATE ${_gRPC_UPB_GENERATED_DIR} diff --git a/test/cpp/end2end/cfstream_test.cc b/test/cpp/end2end/cfstream_test.cc index 1c9320861fd..35b5b7b835d 100644 --- a/test/cpp/end2end/cfstream_test.cc +++ b/test/cpp/end2end/cfstream_test.cc @@ -195,7 +195,22 @@ class CFStreamTest : public ::testing::TestWithParam { void ShutdownCQ() { cq_.Shutdown(); } - bool CQNext(void** tag, bool* ok) { return cq_.Next(tag, ok); } + bool CQNext(void** tag, bool* ok) { + auto deadline = std::chrono::system_clock::now() + std::chrono::seconds(10); + auto ret = cq_.AsyncNext(tag, ok, deadline); + if (ret == grpc::CompletionQueue::GOT_EVENT) { + return true; + } else if (ret == grpc::CompletionQueue::SHUTDOWN) { + return false; + } else { + GPR_ASSERT(ret == grpc::CompletionQueue::TIMEOUT); + // This can happen if we hit the Apple CFStream bug which results in the + // read stream hanging. We are ignoring hangs and timeouts, but these + // tests are still useful as they can catch memory memory corruptions, + // crashes and other bugs that don't result in test hang/timeout. + return false; + } + } bool WaitForChannelNotReady(Channel* channel, int timeout_seconds = 5) { const gpr_timespec deadline = @@ -391,7 +406,10 @@ TEST_P(CFStreamTest, NetworkFlapRpcsInFlight) { } delete call; } - EXPECT_EQ(total_completions, rpcs_sent); + // Remove line below and uncomment the following line after Apple CFStream + // bug has been fixed. + (void)rpcs_sent; + // EXPECT_EQ(total_completions, rpcs_sent); }); for (int i = 0; i < 100; ++i) { @@ -432,7 +450,10 @@ TEST_P(CFStreamTest, ConcurrentRpc) { } delete call; } - EXPECT_EQ(total_completions, rpcs_sent); + // Remove line below and uncomment the following line after Apple CFStream + // bug has been fixed. + (void)rpcs_sent; + // EXPECT_EQ(total_completions, rpcs_sent); }); for (int i = 0; i < 10; ++i) { From 69c97800323891d664d6fe738dc21140632bc52b Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 22 Aug 2019 12:08:30 -0700 Subject: [PATCH 420/661] clang-format --- src/objective-c/GRPCClient/GRPCCallOptions.h | 2 ++ src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.h b/src/objective-c/GRPCClient/GRPCCallOptions.h index d01c8285662..e4261b5b5f9 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.h +++ b/src/objective-c/GRPCClient/GRPCCallOptions.h @@ -158,6 +158,8 @@ NS_ASSUME_NONNULL_BEGIN * identifier defined in \a GRPCTransport or provided by a non-native transport * implementation. If the option is left to be NULL, gRPC will use its default * transport. + * + * This is currently an experimental option. */ @property(readonly) GRPCTransportId transport; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m b/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m index a1441221b15..5b5fc6263c5 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m @@ -18,8 +18,8 @@ #import "NSError+GRPC.h" -#include #import +#include @implementation NSError (GRPC) + (instancetype)grpc_errorFromStatusCode:(grpc_status_code)statusCode From f66f047841cd027b6b86a5149fd5d3375a4b5fea Mon Sep 17 00:00:00 2001 From: Hope Casey-Allen Date: Wed, 21 Aug 2019 10:56:08 -0700 Subject: [PATCH 421/661] Update googletest version to fix BoringSSL support --- Makefile | 2 +- bazel/grpc_deps.bzl | 16 ++++++++++++---- templates/Makefile.template | 2 +- third_party/googletest | 2 +- tools/run_tests/sanity/check_bazel_workspace.py | 2 ++ tools/run_tests/sanity/check_submodules.sh | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index ec88bd3926c..64fd19748ce 100644 --- a/Makefile +++ b/Makefile @@ -451,7 +451,7 @@ USE_BUILT_PROTOC = false endif GTEST_LIB = -Ithird_party/googletest/googletest/include -Ithird_party/googletest/googletest third_party/googletest/googletest/src/gtest-all.cc -Ithird_party/googletest/googlemock/include -Ithird_party/googletest/googlemock third_party/googletest/googlemock/src/gmock-all.cc -GTEST_LIB += -lgflags +GTEST_LIB += -lgflags -std=c++11 ifeq ($(V),1) E = @: Q = diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index b226f15aa2a..d34214b7f37 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -67,7 +67,7 @@ def grpc_deps(): name = "gtest", actual = "@com_github_google_googletest//:gtest", ) - + native.bind( name = "benchmark", actual = "@com_github_google_benchmark//:benchmark", @@ -141,9 +141,17 @@ def grpc_deps(): if "com_github_google_googletest" not in native.existing_rules(): http_archive( name = "com_github_google_googletest", - sha256 = "d0d447b4feeedca837a0d46a289d4223089b32ac2f84545fa4982755cc8919be", - strip_prefix = "googletest-2fe3bd994b3189899d93f1d5a881e725e046fdc2", - url = "https://github.com/google/googletest/archive/2fe3bd994b3189899d93f1d5a881e725e046fdc2.tar.gz", + sha256 = "443d383db648ebb8e391382c0ab63263b7091d03197f304390baac10f178a468", + strip_prefix = "googletest-c9ccac7cb7345901884aabf5d1a786cfa6e2f397", + url = "https://github.com/google/googletest/archive/c9ccac7cb7345901884aabf5d1a786cfa6e2f397.tar.gz", # 2019-08-19 + ) + + if "rules_cc" not in native.existing_rules(): + http_archive( + name = "rules_cc", + sha256 = "35f2fb4ea0b3e61ad64a369de284e4fbbdcdba71836a5555abb5e194cf119509", + strip_prefix = "rules_cc-624b5d59dfb45672d4239422fa1e3de1822ee110", + url = "https://github.com/bazelbuild/rules_cc/archive/624b5d59dfb45672d4239422fa1e3de1822ee110.tar.gz", #2019-08-15 ) if "com_github_gflags_gflags" not in native.existing_rules(): diff --git a/templates/Makefile.template b/templates/Makefile.template index 89415fa69b5..b17423cc4aa 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -321,7 +321,7 @@ endif GTEST_LIB = -Ithird_party/googletest/googletest/include -Ithird_party/googletest/googletest third_party/googletest/googletest/src/gtest-all.cc -Ithird_party/googletest/googlemock/include -Ithird_party/googletest/googlemock third_party/googletest/googlemock/src/gmock-all.cc - GTEST_LIB += -lgflags + GTEST_LIB += -lgflags -std=c++11 ifeq ($(V),1) E = @: Q = diff --git a/third_party/googletest b/third_party/googletest index 2fe3bd994b3..c9ccac7cb73 160000 --- a/third_party/googletest +++ b/third_party/googletest @@ -1 +1 @@ -Subproject commit 2fe3bd994b3189899d93f1d5a881e725e046fdc2 +Subproject commit c9ccac7cb7345901884aabf5d1a786cfa6e2f397 diff --git a/tools/run_tests/sanity/check_bazel_workspace.py b/tools/run_tests/sanity/check_bazel_workspace.py index 73b13a883d8..9100330d256 100755 --- a/tools/run_tests/sanity/check_bazel_workspace.py +++ b/tools/run_tests/sanity/check_bazel_workspace.py @@ -48,6 +48,7 @@ _GRPC_DEP_NAMES = [ 'zlib', 'com_google_protobuf', 'com_github_google_googletest', + 'rules_cc', 'com_github_gflags_gflags', 'com_github_nanopb_nanopb', 'com_github_google_benchmark', @@ -67,6 +68,7 @@ _GRPC_DEP_NAMES = [ ] _GRPC_BAZEL_ONLY_DEPS = [ + 'rules_cc', 'com_google_absl', 'io_opencensus_cpp', _BAZEL_SKYLIB_DEP_NAME, diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index d5eb6677796..39f3e26266c 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -35,7 +35,7 @@ cat << EOF | awk '{ print $1 }' | sort > "$want_submodules" a83394157ad97f4dadbc8ed81f56ad5b3a72e542 third_party/envoy-api (heads/master) 28f50e0fed19872e0fd50dd23ce2ee8cd759338e third_party/gflags (v2.2.0-5-g30dbc81) 80ed4d0bbf65d57cc267dfc63bd2584557f11f9b third_party/googleapis (common-protos-1_3_1-915-g80ed4d0bb) - 2fe3bd994b3189899d93f1d5a881e725e046fdc2 third_party/googletest (release-1.8.1) + c9ccac7cb7345901884aabf5d1a786cfa6e2f397 third_party/googletest (6e2f397) 6599cac0965be8e5a835ab7a5684bbef033d5ad0 third_party/libcxx (heads/release_60) 9245d481eb3e890f708ff2d7dadf2a10c04748ba third_party/libcxxabi (heads/release_60) 09745575a923640154bcf307fba8aedff47f240a third_party/protobuf (v3.7.0-rc.2-247-g09745575) From 9a41e12a4f75b391a78cdd88a254dec99ad87932 Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Thu, 22 Aug 2019 16:00:04 -0700 Subject: [PATCH 422/661] Skip timer test when running under event manager --- test/cpp/common/timer_test.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/cpp/common/timer_test.cc b/test/cpp/common/timer_test.cc index f5083d66e76..0ce6633088f 100644 --- a/test/cpp/common/timer_test.cc +++ b/test/cpp/common/timer_test.cc @@ -27,6 +27,10 @@ #include "src/core/lib/iomgr/timer_manager.h" #include "test/core/util/test_config.h" +#ifdef GRPC_POSIX_SOCKET +#include "src/core/lib/iomgr/ev_posix.h" +#endif + // MAYBE_SKIP_TEST is a macro to determine if this particular test configuration // should be skipped based on a decision made at SetUp time. #define MAYBE_SKIP_TEST \ @@ -39,9 +43,17 @@ class TimerTest : public ::testing::Test { protected: void SetUp() override { - // Skip test if slowdown factor > 1. - do_not_test_ = (grpc_test_slowdown_factor() != 1); grpc_init(); + // Skip test if slowdown factor > 1, or we are + // using event manager. +#ifdef GRPC_POSIX_SOCKET + if (grpc_test_slowdown_factor() != 1 || + grpc_event_engine_run_in_background()) { +#else + if (grpc_test_slowdown_factor() != 1) { +#endif + do_not_test_ = true; + } } void TearDown() override { grpc_shutdown_blocking(); } From 5d646ff9ff03712df1ffb6bf135890f3af07caae Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Fri, 23 Aug 2019 08:05:46 -0700 Subject: [PATCH 423/661] Make Map<> copyable. --- src/core/lib/gprpp/map.h | 71 +++++++++++++++++++++++++++++++++++++ test/core/gprpp/map_test.cc | 29 +++++++++++++++ 2 files changed, 100 insertions(+) diff --git a/src/core/lib/gprpp/map.h b/src/core/lib/gprpp/map.h index 8f0a26146b1..705b605e5b9 100644 --- a/src/core/lib/gprpp/map.h +++ b/src/core/lib/gprpp/map.h @@ -63,6 +63,7 @@ class Map { typedef Pair value_type; typedef Compare key_compare; class iterator; + class const_iterator; Map() = default; ~Map() { clear(); } @@ -83,6 +84,22 @@ class Map { return *this; } + // Copyable. + Map(const Map& other) { + for (const auto& p : other) { + emplace(p); + } + } + Map& operator=(const Map& other) { + if (this != &other) { + clear(); + for (const auto& p : other) { + emplace(p); + } + } + return *this; + } + T& operator[](key_type&& key); T& operator[](const key_type& key); iterator find(const key_type& k); @@ -117,6 +134,13 @@ class Map { iterator end() { return iterator(this, nullptr); } + const_iterator begin() const { + Entry* curr = GetMinEntry(root_); + return const_iterator(this, curr); + } + + const_iterator end() const { return const_iterator(this, nullptr); } + iterator lower_bound(const Key& k) { // This is a workaround for "const key_compare compare;" // because some versions of compilers cannot build this by requiring @@ -209,6 +233,53 @@ class Map::iterator GrpcMap* map_; }; +template +class Map::const_iterator + : public std::iterator, int32_t, + Pair*, Pair&> { + public: + const_iterator(const const_iterator& iter) + : curr_(iter.curr_), map_(iter.map_) {} + bool operator==(const const_iterator& rhs) const { + return (curr_ == rhs.curr_); + } + bool operator!=(const const_iterator& rhs) const { + return (curr_ != rhs.curr_); + } + + const_iterator& operator++() { + curr_ = map_->InOrderSuccessor(curr_); + return *this; + } + + const_iterator operator++(int) { + Entry* prev = curr_; + curr_ = map_->InOrderSuccessor(curr_); + return const_iterator(map_, prev); + } + + const_iterator& operator=(const const_iterator& other) { + if (this != &other) { + this->curr_ = other.curr_; + this->map_ = other.map_; + } + return *this; + } + + // operator*() + const value_type& operator*() const { return curr_->pair; } + + // operator->() + const value_type* operator->() const { return &curr_->pair; } + + private: + friend class Map; + using GrpcMap = typename ::grpc_core::Map; + const_iterator(const GrpcMap* map, Entry* curr) : curr_(curr), map_(map) {} + Entry* curr_; + const GrpcMap* map_; +}; + template T& Map::operator[](key_type&& key) { auto iter = find(key); diff --git a/test/core/gprpp/map_test.cc b/test/core/gprpp/map_test.cc index 21aeee82486..b0be7960b57 100644 --- a/test/core/gprpp/map_test.cc +++ b/test/core/gprpp/map_test.cc @@ -466,6 +466,35 @@ TEST_F(MapTest, MoveAssignment) { EXPECT_EQ(test_map2.end(), test_map2.find("xxx")); } +// Test copy ctor +TEST_F(MapTest, CopyCtor) { + Map test_map; + for (int i = 0; i < 5; i++) { + test_map.emplace(kKeys[i], Payload(i)); + } + Map test_map2 = test_map; + for (int i = 0; i < 5; i++) { + EXPECT_EQ(i, test_map.find(kKeys[i])->second.data()); + EXPECT_EQ(i, test_map2.find(kKeys[i])->second.data()); + } +} + +// Test copy assignment +TEST_F(MapTest, CopyAssignment) { + Map test_map; + for (int i = 0; i < 5; i++) { + test_map.emplace(kKeys[i], Payload(i)); + } + Map test_map2; + test_map2.emplace("xxx", Payload(123)); + test_map2 = test_map; + for (int i = 0; i < 5; i++) { + EXPECT_EQ(i, test_map.find(kKeys[i])->second.data()); + EXPECT_EQ(i, test_map2.find(kKeys[i])->second.data()); + } + EXPECT_EQ(test_map2.end(), test_map2.find("xxx")); +} + } // namespace testing } // namespace grpc_core From 5a9a8a6be80d94a09618285cb3c68b8a88810f05 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 23 Aug 2019 08:33:33 -0700 Subject: [PATCH 424/661] Add .history to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 01e7867c20a..ed1669c4ccc 100644 --- a/.gitignore +++ b/.gitignore @@ -140,6 +140,7 @@ bm_*.json # Visual Studio Code artifacts .vscode/* +.history/ # Clion artifacts cmake-build-debug/ From a031f0ffd6f70011f8bd44576fdb31bee09e0aba Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 23 Aug 2019 08:41:35 -0700 Subject: [PATCH 425/661] Remove all nanopb defines --- CMakeLists.txt | 2 - Makefile | 2 +- build.yaml | 3 +- config.m4 | 4 +- config.w32 | 1 - gRPC-C++.podspec | 2 +- gRPC-Core.podspec | 4 +- grpc.gyp | 3 - setup.py | 1 - src/objective-c/tests/BUILD | 3 - .../tests/Tests.xcodeproj/project.pbxproj | 3 - templates/CMakeLists.txt.template | 2 - templates/config.m4.template | 4 +- templates/config.w32.template | 1 - templates/gRPC-C++.podspec.template | 2 +- templates/gRPC-Core.podspec.template | 4 +- .../CFStreamTests.xcodeproj/project.pbxproj | 2 - tools/bazel.rc | 1 - tools/distrib/check_nanopb_output.sh | 59 ------------------- 19 files changed, 12 insertions(+), 91 deletions(-) delete mode 100755 tools/distrib/check_nanopb_output.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 28cd26555f2..f1552a56c1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,8 +96,6 @@ endif() set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) -add_definitions(-DPB_FIELD_32BIT) - if (MSVC) include(cmake/msvc_static_runtime.cmake) add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS) diff --git a/Makefile b/Makefile index 8400bae76bb..5189f704297 100644 --- a/Makefile +++ b/Makefile @@ -354,7 +354,7 @@ CXXFLAGS += -stdlib=libc++ LDFLAGS += -framework CoreFoundation endif CXXFLAGS += -Wnon-virtual-dtor -CPPFLAGS += -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb -Isrc/core/ext/upb-generated +CPPFLAGS += -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb -Isrc/core/ext/upb-generated COREFLAGS += -fno-rtti -fno-exceptions LDFLAGS += -g diff --git a/build.yaml b/build.yaml index ee5a45e26fd..cbdbf8a60bc 100644 --- a/build.yaml +++ b/build.yaml @@ -6200,8 +6200,7 @@ defaults: CPPFLAGS: -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers - -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb - -Isrc/core/ext/upb-generated + -Wno-maybe-uninitialized -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb -Isrc/core/ext/upb-generated CXXFLAGS: -Wnon-virtual-dtor LDFLAGS: -g zlib: diff --git a/config.m4 b/config.m4 index d78bdfc75ac..79f69aa36e4 100644 --- a/config.m4 +++ b/config.m4 @@ -14,8 +14,8 @@ if test "$PHP_GRPC" != "no"; then LIBS="-lpthread $LIBS" - CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2 -D PB_FIELD_32BIT=1" - CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2 -D PB_FIELD_32BIT=1" + CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2" + CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2" GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD" PHP_REQUIRE_CXX() PHP_ADD_LIBRARY(pthread) diff --git a/config.w32 b/config.w32 index 176ba2f340b..994363a0f1f 100644 --- a/config.w32 +++ b/config.w32 @@ -706,7 +706,6 @@ if (PHP_GRPC != "no") { EXTENSION("grpc", grpc_source, null, "/DOPENSSL_NO_ASM /D_GNU_SOURCE /DWIN32_LEAN_AND_MEAN "+ "/D_HAS_EXCEPTIONS=0 /DNOMINMAX /DGRPC_ARES=0 /D_WIN32_WINNT=0x600 "+ - "/DPB_FIELD_32BIT "+ "/I"+configure_module_dirname+" "+ "/I"+configure_module_dirname+"\\include "+ "/I"+configure_module_dirname+"\\src\\core\\ext\\upb-generated "+ diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index d71773a7361..881e8959651 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -56,7 +56,7 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(PODS_TARGET_SRCROOT)/include"', 'USER_HEADER_SEARCH_PATHS' => '"$(PODS_TARGET_SRCROOT)"', - 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1" "PB_NO_PACKED_STRUCTS=1"', + 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1"', 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', 'CLANG_WARN_DOCUMENTATION_COMMENTS' => 'NO', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 1d27716a8b8..e6f926ca166 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -91,12 +91,12 @@ Pod::Spec.new do |s| # build. 'USE_HEADERMAP' => 'NO', 'ALWAYS_SEARCH_USER_PATHS' => 'NO', - 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1" "PB_NO_PACKED_STRUCTS=1"', + 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1"', 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } s.default_subspecs = 'Interface', 'Implementation' - s.compiler_flags = '-DGRPC_ARES=0', '-DPB_FIELD_32BIT' + s.compiler_flags = '-DGRPC_ARES=0' s.libraries = 'c++' # Like many other C libraries, gRPC-Core has its public headers under `include//` and its diff --git a/grpc.gyp b/grpc.gyp index 3b517e1894a..3b86e613131 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -66,7 +66,6 @@ '-Wno-sign-compare', '-Wno-missing-field-initializers', '-Wno-maybe-uninitialized', - '-DPB_FIELD_32BIT', '-DOSATOMIC_USE_INLINED=1', '-Ithird_party/upb', '-Isrc/core/ext/upb-generated', @@ -155,7 +154,6 @@ '-Wno-sign-compare', '-Wno-missing-field-initializers', '-Wno-maybe-uninitialized', - '-DPB_FIELD_32BIT', '-DOSATOMIC_USE_INLINED=1', '-Ithird_party/upb', '-Isrc/core/ext/upb-generated', @@ -176,7 +174,6 @@ '-Wno-sign-compare', '-Wno-missing-field-initializers', '-Wno-maybe-uninitialized', - '-DPB_FIELD_32BIT', '-DOSATOMIC_USE_INLINED=1', '-Ithird_party/upb', '-Isrc/core/ext/upb-generated', diff --git a/setup.py b/setup.py index 05159d0a7b4..609b18e01b5 100644 --- a/setup.py +++ b/setup.py @@ -161,7 +161,6 @@ if EXTRA_ENV_COMPILE_ARGS is None: EXTRA_ENV_COMPILE_ARGS += ' -std=gnu99 -fvisibility=hidden -fno-wrapv -fno-exceptions' elif "darwin" in sys.platform: EXTRA_ENV_COMPILE_ARGS += ' -stdlib=libc++ -fvisibility=hidden -fno-wrapv -fno-exceptions' -EXTRA_ENV_COMPILE_ARGS += ' -DPB_FIELD_32BIT' if EXTRA_ENV_LINK_ARGS is None: EXTRA_ENV_LINK_ARGS = '' diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index d34807f017f..fed92596b17 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -63,9 +63,6 @@ grpc_objc_testing_library( data = [":TestCertificates"], defines = [ "DEBUG=1", - "PB_FIELD_32BIT=1", - "PB_NO_PACKED_STRUCTS=1", - "PB_ENABLE_MALLOC=1", "HOST_PORT_LOCALSSL=localhost:5051", "HOST_PORT_LOCAL=localhost:5050", "HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com", diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index a54dca59b9c..a88838fdc8b 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -1721,9 +1721,6 @@ "$(inherited)", "COCOAPODS=1", "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1", - "PB_FIELD_32BIT=1", - "PB_NO_PACKED_STRUCTS=1", - "PB_ENABLE_MALLOC=1", "GRPC_TEST_OBJC=1", ); INFOPLIST_FILE = MacTests/Info.plist; diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index bcdd5f152ce..b6a0e83056f 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -145,8 +145,6 @@ ## Some libraries are shared even with BUILD_SHARED_LIBRARIES=OFF set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) - add_definitions(-DPB_FIELD_32BIT) - if (MSVC) include(cmake/msvc_static_runtime.cmake) add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS) diff --git a/templates/config.m4.template b/templates/config.m4.template index 794c6f3e86b..4dbeeafb86a 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -16,8 +16,8 @@ LIBS="-lpthread $LIBS" - CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2 -D PB_FIELD_32BIT=1" - CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2 -D PB_FIELD_32BIT=1" + CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2" + CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2" GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD" PHP_REQUIRE_CXX() PHP_ADD_LIBRARY(pthread) diff --git a/templates/config.w32.template b/templates/config.w32.template index 2515863516c..2a7d5e38c8f 100644 --- a/templates/config.w32.template +++ b/templates/config.w32.template @@ -23,7 +23,6 @@ EXTENSION("grpc", grpc_source, null, "/DOPENSSL_NO_ASM /D_GNU_SOURCE /DWIN32_LEAN_AND_MEAN "+ "/D_HAS_EXCEPTIONS=0 /DNOMINMAX /DGRPC_ARES=0 /D_WIN32_WINNT=0x600 "+ - "/DPB_FIELD_32BIT "+ "/I"+configure_module_dirname+" "+ "/I"+configure_module_dirname+"\\include "+ "/I"+configure_module_dirname+"\\src\\core\\ext\\upb-generated "+ diff --git a/templates/gRPC-C++.podspec.template b/templates/gRPC-C++.podspec.template index 1e7771f29b1..87fd462819f 100644 --- a/templates/gRPC-C++.podspec.template +++ b/templates/gRPC-C++.podspec.template @@ -170,7 +170,7 @@ s.pod_target_xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(PODS_TARGET_SRCROOT)/include"', 'USER_HEADER_SEARCH_PATHS' => '"$(PODS_TARGET_SRCROOT)"', - 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1" "PB_NO_PACKED_STRUCTS=1"', + 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1"', 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', 'CLANG_WARN_DOCUMENTATION_COMMENTS' => 'NO', diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 728fc59e692..9b77723a854 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -144,12 +144,12 @@ # build. 'USE_HEADERMAP' => 'NO', 'ALWAYS_SEARCH_USER_PATHS' => 'NO', - 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1" "PB_NO_PACKED_STRUCTS=1"', + 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1"', 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } s.default_subspecs = 'Interface', 'Implementation' - s.compiler_flags = '-DGRPC_ARES=0', '-DPB_FIELD_32BIT' + s.compiler_flags = '-DGRPC_ARES=0' s.libraries = 'c++' # Like many other C libraries, gRPC-Core has its public headers under `include//` and its diff --git a/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/project.pbxproj b/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/project.pbxproj index c24151f0fa7..58f067c9515 100644 --- a/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/project.pbxproj +++ b/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/project.pbxproj @@ -271,8 +271,6 @@ "$(inherited)", "COCOAPODS=1", "$(inherited)", - "PB_FIELD_32BIT=1", - "PB_NO_PACKED_STRUCTS=1", "GRPC_CFSTREAM=1", ); INFOPLIST_FILE = Info.plist; diff --git a/tools/bazel.rc b/tools/bazel.rc index e2d49355d8f..b24f603ddda 100644 --- a/tools/bazel.rc +++ b/tools/bazel.rc @@ -75,7 +75,6 @@ build:ubsan --linkopt=-fsanitize=undefined build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1:suppressions=test/core/util/ubsan_suppressions.txt # For some reasons, these two stopped being propagated, so, redeclaring them here. # That's a hack that needs to be removed once we understand what's going on. -build:ubsan --copt=-DPB_FIELD_32BIT=1 build:ubsan --copt=-DGRPC_PORT_ISOLATED_RUNTIME=1 build:basicprof --strip=never diff --git a/tools/distrib/check_nanopb_output.sh b/tools/distrib/check_nanopb_output.sh deleted file mode 100755 index 573e02e98ff..00000000000 --- a/tools/distrib/check_nanopb_output.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex - -readonly NANOPB_HEALTH_TMP_OUTPUT="$(mktemp -d)" -readonly NANOPB_TMP_OUTPUT="$(mktemp -d)" -readonly PROTOBUF_INSTALL_PREFIX="$(mktemp -d)" - -# install protoc version 3 -pushd third_party/protobuf -./autogen.sh -./configure --prefix="$PROTOBUF_INSTALL_PREFIX" -make -j 8 -make install -#ldconfig -popd - -readonly PROTOC_BIN_PATH="$PROTOBUF_INSTALL_PREFIX/bin" -if [ ! -x "$PROTOBUF_INSTALL_PREFIX/bin/protoc" ]; then - echo "Error: protoc not found in temp install dir '$PROTOBUF_INSTALL_PREFIX'" - exit 1 -fi - -# stack up and change to nanopb's proto generator directory -pushd third_party/nanopb/generator/proto -export PATH="$PROTOC_BIN_PATH:$PATH" -make -j 8 -# back to the root directory -popd - -# -# checks for health.proto -# -readonly HEALTH_GRPC_OUTPUT_PATH='src/core/ext/filters/client_channel/health' -# nanopb-compile the proto to a temp location -./tools/codegen/core/gen_nano_proto.sh \ - src/proto/grpc/health/v1/health.proto \ - "$NANOPB_HEALTH_TMP_OUTPUT" \ - "$HEALTH_GRPC_OUTPUT_PATH" -# compare outputs to checked compiled code -for NANOPB_OUTPUT_FILE in $NANOPB_HEALTH_TMP_OUTPUT/*.pb.*; do - if ! diff "$NANOPB_OUTPUT_FILE" "${HEALTH_GRPC_OUTPUT_PATH}/$(basename $NANOPB_OUTPUT_FILE)"; then - echo "Outputs differ: $NANOPB_HEALTH_TMP_OUTPUT vs $HEALTH_GRPC_OUTPUT_PATH" - exit 2 - fi -done From de6255941a5e1c2fb2d50e57f84e38c09f45023d Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Fri, 23 Aug 2019 08:46:09 -0700 Subject: [PATCH 426/661] Fix gettid() naming conflict --- src/core/lib/gpr/log_linux.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/lib/gpr/log_linux.cc b/src/core/lib/gpr/log_linux.cc index 561276f0c20..81026e5689b 100644 --- a/src/core/lib/gpr/log_linux.cc +++ b/src/core/lib/gpr/log_linux.cc @@ -40,7 +40,9 @@ #include #include -static long gettid(void) { return syscall(__NR_gettid); } +// Not naming it as gettid() to avoid duplicate declarations when complied with +// GCC 9.1. +static long local_gettid(void) { return syscall(__NR_gettid); } void gpr_log(const char* file, int line, gpr_log_severity severity, const char* format, ...) { @@ -70,7 +72,7 @@ void gpr_default_log(gpr_log_func_args* args) { gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME); struct tm tm; static __thread long tid = 0; - if (tid == 0) tid = gettid(); + if (tid == 0) tid = local_gettid(); timer = static_cast(now.tv_sec); final_slash = strrchr(args->file, '/'); From 2b9ab6d10cc279000c8f0b5df152ef16c5062f05 Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Fri, 23 Aug 2019 13:54:16 -0700 Subject: [PATCH 427/661] timer_test: add test case for grpc shutdown while timer is pending --- test/cpp/common/timer_test.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/cpp/common/timer_test.cc b/test/cpp/common/timer_test.cc index 0ce6633088f..9b23be2885a 100644 --- a/test/cpp/common/timer_test.cc +++ b/test/cpp/common/timer_test.cc @@ -155,6 +155,20 @@ TEST_F(TimerTest, CancelSomeTimers) { gpr_log(GPR_DEBUG, "wakeups: %" PRId64 "", wakeups); } +// Enable the following test after +// https://github.com/grpc/grpc/issues/20049 has been fixed. +#if 0 +TEST_F(TimerTest, TimerNotCanceled) { + grpc_core::ExecCtx exec_ctx; + grpc_timer timer; + grpc_timer_init(&timer, 10000, + GRPC_CLOSURE_CREATE( + [](void*, grpc_error*) { + }, + nullptr, grpc_schedule_on_exec_ctx)); +} +#endif + int main(int argc, char** argv) { grpc::testing::TestEnvironment env(argc, argv); ::testing::InitGoogleTest(&argc, argv); From f8286f3c90ecc76980095bf1198d25686e4f77ed Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Fri, 23 Aug 2019 14:01:31 -0700 Subject: [PATCH 428/661] Update triage rotation --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/cleanup_request.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/pull_request_template.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index f3ed8399dc2..e44c8966012 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Report a bug about: Create a report to help us improve labels: kind/bug, priority/P2 -assignees: AspirinSJL +assignees: mhaidrygoog --- diff --git a/.github/ISSUE_TEMPLATE/cleanup_request.md b/.github/ISSUE_TEMPLATE/cleanup_request.md index 65e56772541..4fe128984b9 100644 --- a/.github/ISSUE_TEMPLATE/cleanup_request.md +++ b/.github/ISSUE_TEMPLATE/cleanup_request.md @@ -2,7 +2,7 @@ name: Request a cleanup about: Suggest a cleanup in our repository labels: kind/internal cleanup -assignees: AspirinSJL +assignees: mhaidrygoog --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 2be15ac785c..499de024dd4 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,7 +2,7 @@ name: Request a feature about: Suggest an idea for this project labels: kind/enhancement -assignees: AspirinSJL +assignees: mhaidrygoog --- diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index fba14a5db00..ac8c41a9f26 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,4 +8,4 @@ If you know who should review your pull request, please remove the mentioning be --> -@AspirinSJL \ No newline at end of file +@mhaidrygoog \ No newline at end of file From 32f1119d2b1b346ae7727a0f564f6b9a422008ec Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 23 Aug 2019 14:51:05 -0700 Subject: [PATCH 429/661] Strict C++ --- .../client_channel/lb_policy/xds/xds_load_balancer_api.h | 3 ++- src/core/ext/filters/client_channel/resolving_lb_policy.cc | 2 ++ src/core/lib/channel/channelz.h | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h index cea5b50b9ba..759c04cd71f 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h @@ -37,7 +37,8 @@ struct XdsLocalityInfo { // This comparator only compares the locality names. struct Less { - bool operator()(const XdsLocalityInfo& lhs, const XdsLocalityInfo& rhs) { + bool operator()(const XdsLocalityInfo& lhs, + const XdsLocalityInfo& rhs) const { return XdsLocalityName::Less()(lhs.locality_name, rhs.locality_name); } }; diff --git a/src/core/ext/filters/client_channel/resolving_lb_policy.cc b/src/core/ext/filters/client_channel/resolving_lb_policy.cc index 4b61df09959..b3b455b0ce8 100644 --- a/src/core/ext/filters/client_channel/resolving_lb_policy.cc +++ b/src/core/ext/filters/client_channel/resolving_lb_policy.cc @@ -160,6 +160,8 @@ class ResolvingLoadBalancingPolicy::ResolvingControlHelper } } + void AddTraceEvent(TraceSeverity severity, const char* message) override {} + void set_child(LoadBalancingPolicy* child) { child_ = child; } private: diff --git a/src/core/lib/channel/channelz.h b/src/core/lib/channel/channelz.h index 2561bff807e..b023a5280e0 100644 --- a/src/core/lib/channel/channelz.h +++ b/src/core/lib/channel/channelz.h @@ -81,7 +81,10 @@ class BaseNode : public RefCounted { kSocket, }; + protected: BaseNode(EntityType type, UniquePtr name); + + public: virtual ~BaseNode(); // All children must implement this function. From 088b67debaf85dadb774c1a4c4f02ca36e73a1bf Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Fri, 23 Aug 2019 15:06:39 -0700 Subject: [PATCH 430/661] Improve comment --- test/cpp/end2end/client_interceptors_end2end_test.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/cpp/end2end/client_interceptors_end2end_test.cc b/test/cpp/end2end/client_interceptors_end2end_test.cc index 583513edaa4..cf151d7626e 100644 --- a/test/cpp/end2end/client_interceptors_end2end_test.cc +++ b/test/cpp/end2end/client_interceptors_end2end_test.cc @@ -190,8 +190,10 @@ class HijackingInterceptorMakesAnotherCall : public experimental::Interceptor { EXPECT_EQ(resp_.message(), "Hello"); methods->Hijack(); }); - // There isn't going to be any other interesting operation in this batch, - // so it is fine to return + // This is a Unary RPC and we have got nothing interesting to do in the + // PRE_SEND_CLOSE interception hook point for this interceptor, so let's + // return here. (We do not want to call methods->Proceed(). When the new + // RPC returns, we will call methods->Hijack() instead.) return; } if (methods->QueryInterceptionHookPoint( From 5294f49d11d27773904728614a78ee27ee0f10d7 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Fri, 23 Aug 2019 15:33:52 -0700 Subject: [PATCH 431/661] Init needs to be called in case of bad creds --- src/cpp/client/create_channel.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc index ca7038b8893..c6041edcb36 100644 --- a/src/cpp/client/create_channel.cc +++ b/src/cpp/client/create_channel.cc @@ -38,7 +38,7 @@ std::shared_ptr CreateCustomChannelImpl( const std::shared_ptr& creds, const grpc::ChannelArguments& args) { grpc::GrpcLibraryCodegen - init_lib; // We need to call init in case of a bad creds. + init_lib; // We need to call init in case of bad creds. return creds ? creds->CreateChannelImpl(target, args) : grpc::CreateChannelInternal( "", @@ -69,6 +69,8 @@ std::shared_ptr CreateCustomChannelWithInterceptors( std::vector< std::unique_ptr> interceptor_creators) { + grpc::GrpcLibraryCodegen + init_lib; // We need to call init in case of bad creds. return creds ? creds->CreateChannelWithInterceptors( target, args, std::move(interceptor_creators)) : grpc::CreateChannelInternal( From 3728329033f51895ce2603bb65b49be19e3c3129 Mon Sep 17 00:00:00 2001 From: yang-g Date: Fri, 23 Aug 2019 16:15:17 -0700 Subject: [PATCH 432/661] return unavailable on transport closed --- .../ext/transport/chttp2/transport/chttp2_transport.cc | 7 +++++++ test/core/end2end/tests/max_connection_age.cc | 2 +- test/core/end2end/tests/shutdown_finishes_calls.cc | 4 +--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 73235756dfb..5f5c480f9dc 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -2465,6 +2465,13 @@ static void cancel_stream_cb(void* user_data, uint32_t key, void* stream) { } static void end_all_the_calls(grpc_chttp2_transport* t, grpc_error* error) { + intptr_t http2_error; + // If there is no explicit grpc or HTTP/2 error, set to UNAVAILABLE on server. + if (!t->is_client && !grpc_error_has_clear_grpc_status(error) && + !grpc_error_get_int(error, GRPC_ERROR_INT_HTTP2_ERROR, &http2_error)) { + error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS, + GRPC_STATUS_UNAVAILABLE); + } cancel_stream_cb_args args = {error, t}; grpc_chttp2_stream_map_for_each(&t->stream_map, cancel_stream_cb, &args); GRPC_ERROR_UNREF(error); diff --git a/test/core/end2end/tests/max_connection_age.cc b/test/core/end2end/tests/max_connection_age.cc index fcb0aaffc4a..50c790d8521 100644 --- a/test/core/end2end/tests/max_connection_age.cc +++ b/test/core/end2end/tests/max_connection_age.cc @@ -204,7 +204,7 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { /* The connection should be closed immediately after the max age grace period, the in-progress RPC should fail. */ - GPR_ASSERT(status == GRPC_STATUS_INTERNAL); + GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/shutdown_finishes_calls.cc b/test/core/end2end/tests/shutdown_finishes_calls.cc index 5dd5bb2ad6c..60b738ef9ef 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.cc +++ b/test/core/end2end/tests/shutdown_finishes_calls.cc @@ -166,9 +166,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( grpc_server_destroy(f.server); - // new code should give INTERNAL, some older code will give UNAVAILABLE - GPR_ASSERT(status == GRPC_STATUS_INTERNAL || - status == GRPC_STATUS_UNAVAILABLE); + GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); GPR_ASSERT(was_cancelled == 1); From 6e159d3ee38c089c6be7391d18af4c836a38139e Mon Sep 17 00:00:00 2001 From: Arjun Roy Date: Fri, 23 Aug 2019 15:04:13 -0700 Subject: [PATCH 433/661] Fix hpack parser fuzzer failure. Fix crash when nullptr is passed to ManagedMemorySlice::Equals(). --- src/core/lib/slice/slice_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/slice/slice_utils.h b/src/core/lib/slice/slice_utils.h index 161300abe1e..e80de6d2ece 100644 --- a/src/core/lib/slice/slice_utils.h +++ b/src/core/lib/slice/slice_utils.h @@ -108,7 +108,7 @@ struct ManagedMemorySlice : public grpc_slice { return !grpc_slice_differs_refcounted(other, *this); } bool Equals(const char* buf, const size_t len) const { - return data.refcounted.length == len && + return data.refcounted.length == len && buf != nullptr && memcmp(buf, data.refcounted.bytes, len) == 0; } }; From 6f2f9ae2c362eac6b76da442606b2486623b4d6b Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 23 Aug 2019 10:07:17 -0700 Subject: [PATCH 434/661] import ProtoRPC and GRPCCallOptions in ProtoService --- src/objective-c/ProtoRPC/ProtoService.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index 8543f5dee43..45376a94353 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -18,15 +18,12 @@ #import -@class GRPCProtoCall; +#import "ProtoRPC.h" +#import + @protocol GRXWriteable; @class GRXWriter; @class GRPCCallOptions; -@class GRPCProtoCall; -@class GRPCUnaryProtoCall; -@class GRPCStreamingProtoCall; -@protocol GRPCProtoResponseHandler; -@protocol GRXWriteable; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-completeness" From 25b56ee1dd75597b16ee4f323e4fad4f14f3e1a6 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 23 Aug 2019 16:25:13 -0700 Subject: [PATCH 435/661] Add LDXX to Rakefile --- Rakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Rakefile b/Rakefile index 8123dc541dc..f791d7e1c85 100755 --- a/Rakefile +++ b/Rakefile @@ -105,6 +105,7 @@ task 'dlls' do env_comp = "CC=#{opt[:cross]}-gcc " env_comp += "CXX=#{opt[:cross]}-g++ " env_comp += "LD=#{opt[:cross]}-gcc " + env_comp += "LDXX=#{opt[:cross]}-g++ " docker_for_windows "gem update --system --no-document && #{env} #{env_comp} make -j #{out} && #{opt[:cross]}-strip -x -S #{out} && cp #{out} #{opt[:out]}" end From e21ec5d4d5d7f549d65f32535229ed0eb58bd73c Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 23 Aug 2019 16:46:01 -0700 Subject: [PATCH 436/661] clang-format --- src/objective-c/ProtoRPC/ProtoService.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index 45376a94353..fd8a86bb2b2 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -18,8 +18,8 @@ #import -#import "ProtoRPC.h" #import +#import "ProtoRPC.h" @protocol GRXWriteable; @class GRXWriter; From 4dffd825242d28df4995073d1864ee036f44cbca Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Sat, 24 Aug 2019 11:57:57 -0700 Subject: [PATCH 437/661] Fix type unmatch --- src/cpp/client/secure_credentials.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index ebff8af3e5a..d870dca158a 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -407,7 +407,7 @@ int MetadataCredentialsPluginWrapper::GetMetadata( *num_creds_md = 0; *status = GRPC_STATUS_OK; *error_details = nullptr; - return true; + return 1; } if (w->plugin_->IsBlocking()) { // The internals of context may be destroyed if GetMetadata is cancelled. From 3869f43953b9995a46e5ad3210446a78e18eabbb Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 26 Aug 2019 08:56:17 +0200 Subject: [PATCH 438/661] only run libuv portability tests as build-only --- tools/run_tests/run_tests_matrix.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index 06a52b0f76e..80c0a7d6455 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -403,13 +403,17 @@ def _create_portability_test_jobs(extra_args=[], extra_args=extra_args, inner_jobs=inner_jobs) + # TODO(jtattermusch): a large portion of the libuv tests is failing, + # which can end up killing the kokoro job due to gigabytes of error logs + # generated. Remove the --build_only flag + # once https://github.com/grpc/grpc/issues/17556 is fixed. test_jobs += _generate_jobs( languages=['c'], configs=['dbg'], platforms=['linux'], iomgr_platforms=['uv'], labels=['portability', 'corelang'], - extra_args=extra_args, + extra_args=extra_args + ['--build_only'], inner_jobs=inner_jobs, timeout_seconds=_CPP_RUNTESTS_TIMEOUT) From 64b8ce5ef2e8987e6a4901bf8f152f3b62532a74 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 26 Aug 2019 10:46:47 -0400 Subject: [PATCH 439/661] enable grpc-dotnet client compression interop tests --- tools/run_tests/run_interop_tests.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index d35723c917e..0ec4478fcc8 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -207,14 +207,13 @@ class AspNetCoreLanguage: return {} def unimplemented_test_cases(self): - return _SKIP_COMPRESSION + \ - ['compute_engine_creds'] + \ + return ['compute_engine_creds'] + \ ['jwt_token_creds'] + \ _SKIP_GOOGLE_DEFAULT_CREDS + \ _SKIP_COMPUTE_ENGINE_CHANNEL_CREDS def unimplemented_test_cases_server(self): - return _SKIP_COMPRESSION + return _SKIP_SERVER_COMPRESSION def __str__(self): return 'aspnetcore' From b804ce974a75a2d32fe186f6abdc3493eb851ee4 Mon Sep 17 00:00:00 2001 From: Neeraj Kashyap Date: Mon, 26 Aug 2019 08:43:46 -0700 Subject: [PATCH 440/661] Implemented _abort method on ServicerContext This acquires a lock from the _condition member of the context's _rpc and then aborts the _rpc directly --- .../grpcio_testing/grpc_testing/_server/_servicer_context.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio_testing/grpc_testing/_server/_servicer_context.py b/src/python/grpcio_testing/grpc_testing/_server/_servicer_context.py index 63a1b1aec95..0f9c4ed4b00 100644 --- a/src/python/grpcio_testing/grpc_testing/_server/_servicer_context.py +++ b/src/python/grpcio_testing/grpc_testing/_server/_servicer_context.py @@ -74,7 +74,8 @@ class ServicerContext(grpc.ServicerContext): _common.fuss_with_metadata(trailing_metadata)) def abort(self, code, details): - raise NotImplementedError() + self._rpc._condition.acquire() + self._rpc._abort(code, details) def abort_with_status(self, status): raise NotImplementedError() From 57586a1ca7f17b1916aed3dea4ff8de872dbf853 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Fri, 3 May 2019 08:11:00 -0700 Subject: [PATCH 441/661] Rename gettid() functions. glibc 2.30 will declare its own gettid; see https://sourceware.org/git/?p=glibc.git;a=commit;h=1d0fc213824eaa2a8f8c4385daaa698ee8fb7c92. Rename the grpc versions to avoid naming conflicts. --- src/core/lib/gpr/log_linux.cc | 6 ++---- src/core/lib/gpr/log_posix.cc | 4 ++-- src/core/lib/iomgr/ev_epollex_linux.cc | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/core/lib/gpr/log_linux.cc b/src/core/lib/gpr/log_linux.cc index 81026e5689b..8b597b4cf2f 100644 --- a/src/core/lib/gpr/log_linux.cc +++ b/src/core/lib/gpr/log_linux.cc @@ -40,9 +40,7 @@ #include #include -// Not naming it as gettid() to avoid duplicate declarations when complied with -// GCC 9.1. -static long local_gettid(void) { return syscall(__NR_gettid); } +static long sys_gettid(void) { return syscall(__NR_gettid); } void gpr_log(const char* file, int line, gpr_log_severity severity, const char* format, ...) { @@ -72,7 +70,7 @@ void gpr_default_log(gpr_log_func_args* args) { gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME); struct tm tm; static __thread long tid = 0; - if (tid == 0) tid = local_gettid(); + if (tid == 0) tid = sys_gettid(); timer = static_cast(now.tv_sec); final_slash = strrchr(args->file, '/'); diff --git a/src/core/lib/gpr/log_posix.cc b/src/core/lib/gpr/log_posix.cc index b6edc14ab6b..2f7c6ce3760 100644 --- a/src/core/lib/gpr/log_posix.cc +++ b/src/core/lib/gpr/log_posix.cc @@ -31,7 +31,7 @@ #include #include -static intptr_t gettid(void) { return (intptr_t)pthread_self(); } +static intptr_t sys_gettid(void) { return (intptr_t)pthread_self(); } void gpr_log(const char* file, int line, gpr_log_severity severity, const char* format, ...) { @@ -86,7 +86,7 @@ void gpr_default_log(gpr_log_func_args* args) { char* prefix; gpr_asprintf(&prefix, "%s%s.%09d %7" PRIdPTR " %s:%d]", gpr_log_severity_string(args->severity), time_buffer, - (int)(now.tv_nsec), gettid(), display_file, args->line); + (int)(now.tv_nsec), sys_gettid(), display_file, args->line); fprintf(stderr, "%-70s %s\n", prefix, args->message); gpr_free(prefix); diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc index c2d80c08ddb..4a83cb6c215 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.cc +++ b/src/core/lib/iomgr/ev_epollex_linux.cc @@ -1077,7 +1077,7 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, } #ifndef NDEBUG -static long gettid(void) { return syscall(__NR_gettid); } +static long sys_gettid(void) { return syscall(__NR_gettid); } #endif /* pollset->mu lock must be held by the caller before calling this. @@ -1097,7 +1097,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset, #define WORKER_PTR (&worker) #endif #ifndef NDEBUG - WORKER_PTR->originator = gettid(); + WORKER_PTR->originator = sys_gettid(); #endif if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { gpr_log(GPR_INFO, From 1ab9225dcef223610cd4992482363bd927f41a5c Mon Sep 17 00:00:00 2001 From: Neeraj Kashyap Date: Mon, 26 Aug 2019 10:57:35 -0700 Subject: [PATCH 442/661] Release the lock on the RPC object condition --- .../grpcio_testing/grpc_testing/_server/_servicer_context.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/python/grpcio_testing/grpc_testing/_server/_servicer_context.py b/src/python/grpcio_testing/grpc_testing/_server/_servicer_context.py index 0f9c4ed4b00..b1277fa4a42 100644 --- a/src/python/grpcio_testing/grpc_testing/_server/_servicer_context.py +++ b/src/python/grpcio_testing/grpc_testing/_server/_servicer_context.py @@ -76,6 +76,7 @@ class ServicerContext(grpc.ServicerContext): def abort(self, code, details): self._rpc._condition.acquire() self._rpc._abort(code, details) + self._rpc._condition.release() def abort_with_status(self, status): raise NotImplementedError() From 5c173084f8af589a1bad3ba44cabedb1c781470b Mon Sep 17 00:00:00 2001 From: Neeraj Kashyap Date: Mon, 26 Aug 2019 11:07:58 -0700 Subject: [PATCH 443/661] condition acquire and release with context manager Was previously unfamiliar with the contex manager wrapper around threading primitives. --- .../grpcio_testing/grpc_testing/_server/_servicer_context.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/python/grpcio_testing/grpc_testing/_server/_servicer_context.py b/src/python/grpcio_testing/grpc_testing/_server/_servicer_context.py index b1277fa4a42..6fa8c6b3ba8 100644 --- a/src/python/grpcio_testing/grpc_testing/_server/_servicer_context.py +++ b/src/python/grpcio_testing/grpc_testing/_server/_servicer_context.py @@ -74,9 +74,8 @@ class ServicerContext(grpc.ServicerContext): _common.fuss_with_metadata(trailing_metadata)) def abort(self, code, details): - self._rpc._condition.acquire() - self._rpc._abort(code, details) - self._rpc._condition.release() + with self._rpc._condition: + self._rpc._abort(code, details) def abort_with_status(self, status): raise NotImplementedError() From d9c0d498f224366263b0fc7cff9752eec48172cd Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Mon, 26 Aug 2019 11:33:44 -0700 Subject: [PATCH 444/661] Stop the failing tests --- src/python/grpcio_tests/commands.py | 5 ++++- .../grpcio_tests/tests/unit/_local_credentials_test.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio_tests/commands.py b/src/python/grpcio_tests/commands.py index 61d8bdc1f7b..d30daacd5ac 100644 --- a/src/python/grpcio_tests/commands.py +++ b/src/python/grpcio_tests/commands.py @@ -160,7 +160,10 @@ class TestGevent(setuptools.Command): ) BANNED_WINDOWS_TESTS = ( # TODO(https://github.com/grpc/grpc/pull/15411) enable this test - 'unit._dns_resolver_test.DNSResolverTest.test_connect_loopback',) + 'unit._dns_resolver_test.DNSResolverTest.test_connect_loopback', + # TODO(https://github.com/grpc/grpc/issues/20078) enable this test + 'unit._local_credentials_test.LocalCredentialsTest', + ) description = 'run tests with gevent. Assumes grpc/gevent are installed' user_options = [] diff --git a/src/python/grpcio_tests/tests/unit/_local_credentials_test.py b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py index 80a21af1cef..14b68cb5907 100644 --- a/src/python/grpcio_tests/tests/unit/_local_credentials_test.py +++ b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py @@ -49,6 +49,8 @@ class LocalCredentialsTest(unittest.TestCase): b'abc', wait_for_ready=True)) server.stop(None) + @unittest.skipIf(os.name == 'nt', + 'Unix Domain Socket is not supported on Windows') def test_uds(self): server_addr = 'unix:/tmp/grpc_fullstack_test' channel_creds = grpc.local_channel_credentials( From 5b1899160a3af87a2f90b9732b9222b156fe3cb5 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Mon, 26 Aug 2019 11:51:28 -0700 Subject: [PATCH 445/661] Run auditwheel-show to python artifacts --- .../grpc_artifact_python_manylinux_x64/Dockerfile | 6 +++--- .../grpc_artifact_python_manylinux_x86/Dockerfile | 7 ++++--- tools/run_tests/artifacts/build_artifact_python.sh | 2 ++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile b/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile index 6c2b1cc4740..c36ad6bec58 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile @@ -32,7 +32,7 @@ RUN /opt/python/cp37-cp37m/bin/pip install cython #################################################### # Install auditwheel with fix for namespace packages RUN git clone https://github.com/pypa/auditwheel /usr/local/src/auditwheel -RUN cd /usr/local/src/auditwheel && git checkout bf071b38c9fe78b025ea05c78b1cb61d7cb09939 -RUN /opt/python/cp35-cp35m/bin/pip install /usr/local/src/auditwheel +RUN cd /usr/local/src/auditwheel && git checkout 2.1 +RUN /opt/python/cp36-cp36m/bin/pip install /usr/local/src/auditwheel RUN rm /usr/local/bin/auditwheel -RUN cd /usr/local/bin && ln -s /opt/python/cp35-cp35m/bin/auditwheel +RUN cd /usr/local/bin && ln -s /opt/python/cp36-cp36m/bin/auditwheel diff --git a/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile b/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile index 8f409dd2162..a33e0517ae2 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile @@ -32,7 +32,8 @@ RUN /opt/python/cp37-cp37m/bin/pip install cython #################################################### # Install auditwheel with fix for namespace packages RUN git clone https://github.com/pypa/auditwheel /usr/local/src/auditwheel -RUN cd /usr/local/src/auditwheel && git checkout bf071b38c9fe78b025ea05c78b1cb61d7cb09939 -RUN /opt/python/cp35-cp35m/bin/pip install /usr/local/src/auditwheel +RUN cd /usr/local/src/auditwheel && git checkout 2.1 +RUN /opt/python/cp36-cp36m/bin/pip install /usr/local/src/auditwheel RUN rm /usr/local/bin/auditwheel -RUN cd /usr/local/bin && ln -s /opt/python/cp35-cp35m/bin/auditwheel +RUN cd /usr/local/bin && ln -s /opt/python/cp36-cp36m/bin/auditwheel + diff --git a/tools/run_tests/artifacts/build_artifact_python.sh b/tools/run_tests/artifacts/build_artifact_python.sh index 55fd4ead04d..7393b88a768 100755 --- a/tools/run_tests/artifacts/build_artifact_python.sh +++ b/tools/run_tests/artifacts/build_artifact_python.sh @@ -79,10 +79,12 @@ ${SETARCH_CMD} "${PYTHON}" tools/distrib/python/grpcio_tools/setup.py bdist_whee if [ "$GRPC_BUILD_MANYLINUX_WHEEL" != "" ] then for wheel in dist/*.whl; do + "${AUDITWHEEL}" show "$wheel" | tee /dev/stderr | grep \"manylinux1 "${AUDITWHEEL}" repair "$wheel" -w "$ARTIFACT_DIR" rm "$wheel" done for wheel in tools/distrib/python/grpcio_tools/dist/*.whl; do + "${AUDITWHEEL}" show "$wheel" | tee /dev/stderr | grep \"manylinux1 "${AUDITWHEEL}" repair "$wheel" -w "$ARTIFACT_DIR" rm "$wheel" done From 750a8ab6ca22e85df38d3d54845ac489c94ac0df Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Mon, 26 Aug 2019 12:05:21 -0700 Subject: [PATCH 446/661] Fix import --- src/python/grpcio_tests/tests/unit/_local_credentials_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/python/grpcio_tests/tests/unit/_local_credentials_test.py b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py index 14b68cb5907..8690505b861 100644 --- a/src/python/grpcio_tests/tests/unit/_local_credentials_test.py +++ b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py @@ -14,6 +14,7 @@ """Test of RPCs made using local credentials.""" import unittest +import os from concurrent.futures import ThreadPoolExecutor import grpc From 80163ef83b800d9aad1740b1762514a7aca5dddc Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sat, 24 Aug 2019 10:39:38 -0700 Subject: [PATCH 447/661] Update BUILD file accordingly --- src/objective-c/BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index e71dd3eed81..5f53486d17e 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -232,6 +232,7 @@ grpc_objc_library( ], hdrs = [ "ProtoRPC/ProtoMethod.h", + "ProtoRPC/ProtoRPC.h", "ProtoRPC/ProtoRPCLegacy.h", "ProtoRPC/ProtoService.h", ], From 8f403431a153b75665f8d737489862e9e1460aff Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Mon, 26 Aug 2019 13:57:20 -0700 Subject: [PATCH 448/661] Try to disable it again --- src/python/grpcio_tests/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/grpcio_tests/commands.py b/src/python/grpcio_tests/commands.py index d30daacd5ac..2ea6de28bb7 100644 --- a/src/python/grpcio_tests/commands.py +++ b/src/python/grpcio_tests/commands.py @@ -162,7 +162,7 @@ class TestGevent(setuptools.Command): # TODO(https://github.com/grpc/grpc/pull/15411) enable this test 'unit._dns_resolver_test.DNSResolverTest.test_connect_loopback', # TODO(https://github.com/grpc/grpc/issues/20078) enable this test - 'unit._local_credentials_test.LocalCredentialsTest', + 'unit._local_credentials_test.LocalCredentialsTest.test_local_tcp', ) description = 'run tests with gevent. Assumes grpc/gevent are installed' user_options = [] From 2707fd0bd406488665776dfd89987d95e26e2d51 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 23 Aug 2019 15:47:40 -0700 Subject: [PATCH 449/661] Added GRPC_USE_CPP_STD_LIB flag --- BUILD | 5 +++++ bazel/grpc_build_system.bzl | 3 +++ include/grpc/impl/codegen/port_platform.h | 9 +++++++++ .../lb_policy/xds/xds_client_stats.cc | 8 ++++++++ .../lb_policy/xds/xds_load_balancer_api.cc | 8 ++++++++ src/core/lib/gprpp/abstract.h | 10 ++++++++++ src/core/lib/gprpp/map.h | 16 ++++++++++++++++ src/core/lib/security/credentials/credentials.h | 10 ++++++++-- test/core/gprpp/map_test.cc | 9 +++++++++ .../linux/grpc_bazel_build_in_docker.sh | 1 + 10 files changed, 77 insertions(+), 2 deletions(-) diff --git a/BUILD b/BUILD index c510757c35d..6855ad9602e 100644 --- a/BUILD +++ b/BUILD @@ -73,6 +73,11 @@ config_setting( values = {"cpu": "darwin"}, ) +config_setting( + name = "grpc_use_cpp_std_lib", + values = {"define": "GRPC_USE_CPP_STD_LIB=1"}, +) + # This should be updated along with build.yaml g_stands_for = "ganges" diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index f816fe14ff4..23f90d0dc80 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -98,6 +98,9 @@ def grpc_cc_library( "//:grpc_allow_exceptions": ["GRPC_ALLOW_EXCEPTIONS=1"], "//:grpc_disallow_exceptions": ["GRPC_ALLOW_EXCEPTIONS=0"], "//conditions:default": [], + }) + select({ + "//:grpc_use_cpp_std_lib": ["GRPC_USE_CPP_STD_LIB=1"], + "//conditions:default": [], }), hdrs = hdrs + public_hdrs, deps = deps + _get_external_deps(external_deps), diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index dd49a66fe25..bab57657a00 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -27,6 +27,15 @@ * - some syscalls to be made directly */ +/* + * Defines GRPC_USE_CPP_STD_LIB to use standard C++ library instead of + * in-house library if possible. (e.g. std::map) + */ +#ifndef GRPC_USE_CPP_STD_LIB +/* Default value will be 1 once all tests become green. */ +#define GRPC_USE_CPP_STD_LIB 0 +#endif + /* Get windows.h included everywhere (we need it) */ #if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32) #ifndef WIN32_LEAN_AND_MEAN diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc index 85f7d669ec0..a866d50b3a6 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc @@ -143,7 +143,15 @@ XdsClientStats::Snapshot XdsClientStats::GetSnapshotAndReset() { } { MutexLock lock(&dropped_requests_mu_); +#if GRPC_USE_CPP_STD_LIB + // This is a workaround for the case where some compilers cannot build + // move-assignment of map with non-copyable but movable key. + // https://stackoverflow.com/questions/36475497 + std::swap(snapshot.dropped_requests, dropped_requests_); + dropped_requests_.clear(); +#else snapshot.dropped_requests = std::move(dropped_requests_); +#endif } return snapshot; } diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc index ac87053d47f..16d5f9a1391 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc @@ -315,7 +315,15 @@ grpc_slice XdsLrsRequestCreateAndEncode(const char* server_name) { namespace { void LocalityStatsPopulate(envoy_api_v2_endpoint_UpstreamLocalityStats* output, +#if GRPC_USE_CPP_STD_LIB + // TODO(veblush): Clean up this + // This is to address the difference between + // std::map and Map. #else block will be gone + // once using stdlib is enabled by default. + Pair, +#else Pair, +#endif XdsClientStats::LocalityStats::Snapshot>& input, upb_arena* arena) { // Set sub_zone. diff --git a/src/core/lib/gprpp/abstract.h b/src/core/lib/gprpp/abstract.h index 5b7018e07e0..ea68e3ab041 100644 --- a/src/core/lib/gprpp/abstract.h +++ b/src/core/lib/gprpp/abstract.h @@ -19,6 +19,14 @@ #ifndef GRPC_CORE_LIB_GPRPP_ABSTRACT_H #define GRPC_CORE_LIB_GPRPP_ABSTRACT_H +#if GRPC_USE_CPP_STD_LIB + +#define GRPC_ABSTRACT_BASE_CLASS + +#define GRPC_ABSTRACT = 0 + +#else + // This is needed to support abstract base classes in the c core. Since gRPC // doesn't have a c++ runtime, it will hit a linker error on delete unless // we define a virtual operator delete. See this blog for more info: @@ -34,4 +42,6 @@ GPR_ASSERT(false); \ } +#endif // GRPC_USE_CPP_STD_LIB + #endif /* GRPC_CORE_LIB_GPRPP_ABSTRACT_H */ diff --git a/src/core/lib/gprpp/map.h b/src/core/lib/gprpp/map.h index 705b605e5b9..134625775cf 100644 --- a/src/core/lib/gprpp/map.h +++ b/src/core/lib/gprpp/map.h @@ -27,12 +27,17 @@ #include #include +#if GRPC_USE_CPP_STD_LIB +#include +#endif + #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/pair.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" namespace grpc_core { + struct StringLess { bool operator()(const char* a, const char* b) const { return strcmp(a, b) < 0; @@ -50,6 +55,13 @@ struct RefCountedPtrLess { } }; +#if GRPC_USE_CPP_STD_LIB + +template > +using Map = std::map; + +#else // GRPC_USE_CPP_STD_LIB + namespace testing { class MapTest; } @@ -537,5 +549,9 @@ int Map::CompareKeys(const key_type& lhs, } return left_comparison ? -1 : 1; } + +#endif // GRPC_USE_CPP_STD_LIB + } // namespace grpc_core + #endif /* GRPC_CORE_LIB_GPRPP_MAP_H */ diff --git a/src/core/lib/security/credentials/credentials.h b/src/core/lib/security/credentials/credentials.h index f3fbe881598..b43405b0861 100644 --- a/src/core/lib/security/credentials/credentials.h +++ b/src/core/lib/security/credentials/credentials.h @@ -110,11 +110,17 @@ struct grpc_channel_credentials create_security_connector( grpc_core::RefCountedPtr call_creds, const char* target, const grpc_channel_args* args, - grpc_channel_args** new_args) { + grpc_channel_args** new_args) +#if GRPC_USE_CPP_STD_LIB + = 0; +#else + { // Tell clang-tidy that call_creds cannot be passed as const-ref. call_creds.reset(); - GRPC_ABSTRACT; + gpr_log(GPR_ERROR, "Function marked GRPC_ABSTRACT was not implemented"); + GPR_ASSERT(false); } +#endif // Creates a version of the channel credentials without any attached call // credentials. This can be used in order to open a channel to a non-trusted diff --git a/test/core/gprpp/map_test.cc b/test/core/gprpp/map_test.cc index b0be7960b57..7dc1ba636f3 100644 --- a/test/core/gprpp/map_test.cc +++ b/test/core/gprpp/map_test.cc @@ -29,6 +29,13 @@ namespace grpc_core { namespace testing { + +#if GRPC_USE_CPP_STD_LIB + +TEST(MapTest, Nop) {} + +#else + class Payload { public: Payload() : data_(-1) {} @@ -495,6 +502,8 @@ TEST_F(MapTest, CopyAssignment) { EXPECT_EQ(test_map2.end(), test_map2.find("xxx")); } +#endif + } // namespace testing } // namespace grpc_core diff --git a/tools/internal_ci/linux/grpc_bazel_build_in_docker.sh b/tools/internal_ci/linux/grpc_bazel_build_in_docker.sh index 24598f43f02..8487ec49bbd 100755 --- a/tools/internal_ci/linux/grpc_bazel_build_in_docker.sh +++ b/tools/internal_ci/linux/grpc_bazel_build_in_docker.sh @@ -25,3 +25,4 @@ git clone /var/local/jenkins/grpc /var/local/git/grpc ${name}') cd /var/local/git/grpc bazel build --spawn_strategy=standalone --genrule_strategy=standalone :all test/... examples/... +bazel build --spawn_strategy=standalone --genrule_strategy=standalone --define=GRPC_USE_CPP_STD_LIB=1 :grpc From 630e6ab2212a99c26f4cda89f1459a0205f70763 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Mon, 26 Aug 2019 15:55:42 -0700 Subject: [PATCH 450/661] Use the correct machanism to ignore test in Windows --- src/python/grpcio_tests/commands.py | 4 +--- src/python/grpcio_tests/tests/unit/_local_credentials_test.py | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python/grpcio_tests/commands.py b/src/python/grpcio_tests/commands.py index 2ea6de28bb7..3758d995a97 100644 --- a/src/python/grpcio_tests/commands.py +++ b/src/python/grpcio_tests/commands.py @@ -161,8 +161,6 @@ class TestGevent(setuptools.Command): BANNED_WINDOWS_TESTS = ( # TODO(https://github.com/grpc/grpc/pull/15411) enable this test 'unit._dns_resolver_test.DNSResolverTest.test_connect_loopback', - # TODO(https://github.com/grpc/grpc/issues/20078) enable this test - 'unit._local_credentials_test.LocalCredentialsTest.test_local_tcp', ) description = 'run tests with gevent. Assumes grpc/gevent are installed' user_options = [] @@ -189,7 +187,7 @@ class TestGevent(setuptools.Command): loader = tests.Loader() loader.loadTestsFromNames(['tests']) runner = tests.Runner() - if sys.platform == 'win32': + if os.name == 'nt': runner.skip_tests(self.BANNED_TESTS + self.BANNED_WINDOWS_TESTS) else: runner.skip_tests(self.BANNED_TESTS) diff --git a/src/python/grpcio_tests/tests/unit/_local_credentials_test.py b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py index 8690505b861..7f3e8cc41c9 100644 --- a/src/python/grpcio_tests/tests/unit/_local_credentials_test.py +++ b/src/python/grpcio_tests/tests/unit/_local_credentials_test.py @@ -33,6 +33,8 @@ class LocalCredentialsTest(unittest.TestCase): server.add_generic_rpc_handlers((_GenericHandler(),)) return server + @unittest.skipIf(os.name == 'nt', + 'TODO(https://github.com/grpc/grpc/issues/20078)') def test_local_tcp(self): server_addr = 'localhost:{}' channel_creds = grpc.local_channel_credentials( From a2990a053cdeb1737062b11188a1357a18441f62 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Mon, 26 Aug 2019 15:57:02 -0700 Subject: [PATCH 451/661] Revert changes in src/python/grpcio_tests/commands.py --- src/python/grpcio_tests/commands.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/python/grpcio_tests/commands.py b/src/python/grpcio_tests/commands.py index 3758d995a97..61d8bdc1f7b 100644 --- a/src/python/grpcio_tests/commands.py +++ b/src/python/grpcio_tests/commands.py @@ -160,8 +160,7 @@ class TestGevent(setuptools.Command): ) BANNED_WINDOWS_TESTS = ( # TODO(https://github.com/grpc/grpc/pull/15411) enable this test - 'unit._dns_resolver_test.DNSResolverTest.test_connect_loopback', - ) + 'unit._dns_resolver_test.DNSResolverTest.test_connect_loopback',) description = 'run tests with gevent. Assumes grpc/gevent are installed' user_options = [] @@ -187,7 +186,7 @@ class TestGevent(setuptools.Command): loader = tests.Loader() loader.loadTestsFromNames(['tests']) runner = tests.Runner() - if os.name == 'nt': + if sys.platform == 'win32': runner.skip_tests(self.BANNED_TESTS + self.BANNED_WINDOWS_TESTS) else: runner.skip_tests(self.BANNED_TESTS) From 15b279ab69dc4447ed960673987e4b031441117c Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Mon, 26 Aug 2019 15:09:20 -0700 Subject: [PATCH 452/661] Add auditwheel to linux docker --- .../grpc_artifact_linux_x64/Dockerfile | 12 ++++++++++-- .../grpc_artifact_linux_x86/Dockerfile | 16 ++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/tools/dockerfile/grpc_artifact_linux_x64/Dockerfile b/tools/dockerfile/grpc_artifact_linux_x64/Dockerfile index a0fef12d6e1..b3c16951229 100644 --- a/tools/dockerfile/grpc_artifact_linux_x64/Dockerfile +++ b/tools/dockerfile/grpc_artifact_linux_x64/Dockerfile @@ -57,10 +57,10 @@ RUN \curl -sSL https://get.rvm.io | bash -s stable # Install Ruby 2.1 RUN /bin/bash -l -c "rvm install ruby-2.1" RUN /bin/bash -l -c "rvm use --default ruby-2.1" -RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" +RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc" RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.1' >> ~/.bashrc" -RUN /bin/bash -l -c "gem install bundler -v 1.17.3 --no-ri --no-rdoc" +RUN /bin/bash -l -c "gem install bundler -v 1.17.3 --no-document" ################## @@ -79,6 +79,14 @@ RUN echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list RUN apt-get update && apt-get install -t jessie-backports -y cmake && apt-get clean + +################## +# Python AuditWheel dependencies (needed to check manylinux1 compatibility) + +RUN apt-get install -y python3 python3-pip +RUN pip3 install auditwheel==1.10.0 + + RUN mkdir /var/local/jenkins # Define the default command. diff --git a/tools/dockerfile/grpc_artifact_linux_x86/Dockerfile b/tools/dockerfile/grpc_artifact_linux_x86/Dockerfile index 8709fe0426c..c9054653067 100644 --- a/tools/dockerfile/grpc_artifact_linux_x86/Dockerfile +++ b/tools/dockerfile/grpc_artifact_linux_x86/Dockerfile @@ -14,7 +14,7 @@ # Docker file for building gRPC artifacts. -FROM 32bit/debian:jessie +FROM i386/debian:jessie RUN sed -i '/deb http:\/\/http.debian.net\/debian jessie-updates main/d' /etc/apt/sources.list # Install Git and basic packages. @@ -49,7 +49,6 @@ RUN apt-get update && apt-get install -y \ ################## # Ruby dependencies -# Install rvm # Install rvm RUN apt-get update && apt-get install -y gnupg2 RUN gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB @@ -58,10 +57,11 @@ RUN \curl -sSL https://get.rvm.io | bash -s stable # Install Ruby 2.1 RUN /bin/bash -l -c "rvm install ruby-2.1" RUN /bin/bash -l -c "rvm use --default ruby-2.1" -RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" +RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc" RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.1' >> ~/.bashrc" -RUN /bin/bash -l -c "gem install bundler -v 1.17.3 --no-ri --no-rdoc" +RUN /bin/bash -l -c "gem install bundler -v 1.17.3 --no-document" + ################## # C# dependencies (needed to build grpc_csharp_ext) @@ -72,6 +72,14 @@ RUN echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list RUN apt-get update && apt-get install -t jessie-backports -y cmake && apt-get clean + +################## +# Python AuditWheel dependencies (needed to check manylinux1 compatibility) + +RUN apt-get install -y python3 python3-pip +RUN pip3 install auditwheel==1.10.0 + + RUN mkdir /var/local/jenkins # Define the default command. From 6d03b59d7e263859cf4ed9c7f1d70c2083da2fb6 Mon Sep 17 00:00:00 2001 From: Zhehao /Tony/ Lu Date: Mon, 26 Aug 2019 16:57:28 -0700 Subject: [PATCH 453/661] Added readme for objc examples (Bazel build) --- examples/objective-c/README.md | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 examples/objective-c/README.md diff --git a/examples/objective-c/README.md b/examples/objective-c/README.md new file mode 100644 index 00000000000..d89ac6f1092 --- /dev/null +++ b/examples/objective-c/README.md @@ -0,0 +1,60 @@ +# gRPC in 3 minutes (Objective-C with Bazel) + +## Background +There are currently two ways to build projects with the gRPC Objective-C library: +* Cocoapods & Xcode +* Bazel + +The [helloworld](helloworld) sample is the entry point for the Cocoapods way of building projects. More is documented on grpc.io, including [installation](https://grpc.io/docs/quickstart/objective-c/) and some [tutorials](https://grpc.io/docs/tutorials/basic/objective-c/). They will not be reiterated here and they are not mandatory for the Bazel way. + +A good place to get started with Bazel is their official [website](https://bazel.build). And the documentation of using Bazel with gRPC Objective-C library is [here](https://github.com/grpc/proposal/blob/master/L56-objc-bazel-support.md). + +## Installation +To run the examples in Bazel, you should have [Bazel](https://docs.bazel.build/versions/master/install-os-x.html) installed. + +## Hello Objective-C gRPC! +Here's how to build and run the Objective-C implementation of the [Hello World](helloworld) example. + +The code for the Hello World example and others live in the `examples` directory. Clone this repository to your local machine by running the following commands: +```shell +$ git clone --recursive https://github.com/grpc/grpc +``` + +Bazel support for gRPC Objective-C is not yet released, so we need to work on the master branch. + +Next, change your directory to `examples/objective-c` +```shell +$ cd examples/objective-c +``` + +### Try it! +To run the Hello World sample properly, we need a local server. Let's compile and run the corresponding C++ server: +```shell +$ pushd ../cpp/helloworld +$ make +$ ./greeter_server & +$ popd +``` +Or do it the Bazel way (you might need to open another shell tab for this): +```shell +$ bazel run //examples:greeter_server +``` + +Now compile the sample: +```shell +$ bazel build :HelloWorld +``` +To run the sample, you need to know the available simulator runtimes in your machine. You could either list the available runtimes yourself: +```shell +$ xcrun simctl list +``` +Or just try running the app and it will let you know what is available: +```shell +$ bazel run :HelloWorld +``` +Note that running this command will build the project even if you forget to build it beforehand. + +Finally, launch the app with one of the available runtimes: +```shell +$ bazel run :HelloWorld --ios_simulator_version='' --ios_sumlator_device='' +``` \ No newline at end of file From 92c5f26ca83c09b5cfb8901b7dcc61ce8ba45fe6 Mon Sep 17 00:00:00 2001 From: Zhehao /Tony/ Lu Date: Mon, 26 Aug 2019 17:03:47 -0700 Subject: [PATCH 454/661] Added a note at the top --- examples/objective-c/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/objective-c/README.md b/examples/objective-c/README.md index d89ac6f1092..777141d7e02 100644 --- a/examples/objective-c/README.md +++ b/examples/objective-c/README.md @@ -1,5 +1,7 @@ # gRPC in 3 minutes (Objective-C with Bazel) +To save you from reading, if you use Cocoapods and Xcode, the right reference for you is in the [Hello World](helloworld) example directory. + ## Background There are currently two ways to build projects with the gRPC Objective-C library: * Cocoapods & Xcode From caf64469f0fbfd34c5d4a8ff81eebaa6cce69236 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Tue, 27 Aug 2019 10:08:29 +0800 Subject: [PATCH 455/661] Update: rename the folder --- examples/python/{easy_start_demo => data_transmission}/README.md | 0 examples/python/{easy_start_demo => data_transmission}/client.py | 0 examples/python/{easy_start_demo => data_transmission}/demo.proto | 0 .../demo_grpc_pbs/demo_pb2.py | 0 .../demo_grpc_pbs/demo_pb2_grpc.py | 0 examples/python/{easy_start_demo => data_transmission}/server.py | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename examples/python/{easy_start_demo => data_transmission}/README.md (100%) rename examples/python/{easy_start_demo => data_transmission}/client.py (100%) rename examples/python/{easy_start_demo => data_transmission}/demo.proto (100%) rename examples/python/{easy_start_demo => data_transmission}/demo_grpc_pbs/demo_pb2.py (100%) rename examples/python/{easy_start_demo => data_transmission}/demo_grpc_pbs/demo_pb2_grpc.py (100%) rename examples/python/{easy_start_demo => data_transmission}/server.py (100%) diff --git a/examples/python/easy_start_demo/README.md b/examples/python/data_transmission/README.md similarity index 100% rename from examples/python/easy_start_demo/README.md rename to examples/python/data_transmission/README.md diff --git a/examples/python/easy_start_demo/client.py b/examples/python/data_transmission/client.py similarity index 100% rename from examples/python/easy_start_demo/client.py rename to examples/python/data_transmission/client.py diff --git a/examples/python/easy_start_demo/demo.proto b/examples/python/data_transmission/demo.proto similarity index 100% rename from examples/python/easy_start_demo/demo.proto rename to examples/python/data_transmission/demo.proto diff --git a/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2.py b/examples/python/data_transmission/demo_grpc_pbs/demo_pb2.py similarity index 100% rename from examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2.py rename to examples/python/data_transmission/demo_grpc_pbs/demo_pb2.py diff --git a/examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2_grpc.py b/examples/python/data_transmission/demo_grpc_pbs/demo_pb2_grpc.py similarity index 100% rename from examples/python/easy_start_demo/demo_grpc_pbs/demo_pb2_grpc.py rename to examples/python/data_transmission/demo_grpc_pbs/demo_pb2_grpc.py diff --git a/examples/python/easy_start_demo/server.py b/examples/python/data_transmission/server.py similarity index 100% rename from examples/python/easy_start_demo/server.py rename to examples/python/data_transmission/server.py From 151f5960546e5d25a295dd36f8bc99a1b61dd9ee Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Tue, 27 Aug 2019 10:17:08 +0800 Subject: [PATCH 456/661] Fix: Cancel the modification of the package search path and Remove useless notes --- examples/python/data_transmission/client.py | 15 ++------------- .../{demo_grpc_pbs => }/demo_pb2.py | 0 .../{demo_grpc_pbs => }/demo_pb2_grpc.py | 0 examples/python/data_transmission/server.py | 18 ++++-------------- 4 files changed, 6 insertions(+), 27 deletions(-) rename examples/python/data_transmission/{demo_grpc_pbs => }/demo_pb2.py (100%) rename examples/python/data_transmission/{demo_grpc_pbs => }/demo_pb2_grpc.py (100%) diff --git a/examples/python/data_transmission/client.py b/examples/python/data_transmission/client.py index b5b994820a3..21c61d6cc6e 100644 --- a/examples/python/data_transmission/client.py +++ b/examples/python/data_transmission/client.py @@ -1,19 +1,8 @@ -""" -Author: Zhongying Wang -Email: kerbalwzy@gmail.com -DateTime: 2019-08-13T23:30:00Z -PythonVersion: Python3.6.3 -""" -import os -import sys import time import grpc -# add the `demo_grpc_dps` dir into python package search paths -BaseDir = os.path.dirname(os.path.abspath(__file__)) -sys.path.insert(0, os.path.join(BaseDir, "demo_grpc_pbs")) - -from demo_grpc_pbs import demo_pb2, demo_pb2_grpc +import demo_pb2_grpc +import demo_pb2 SERVER_ADDRESS = "localhost:23334" CLIENT_ID = 1 diff --git a/examples/python/data_transmission/demo_grpc_pbs/demo_pb2.py b/examples/python/data_transmission/demo_pb2.py similarity index 100% rename from examples/python/data_transmission/demo_grpc_pbs/demo_pb2.py rename to examples/python/data_transmission/demo_pb2.py diff --git a/examples/python/data_transmission/demo_grpc_pbs/demo_pb2_grpc.py b/examples/python/data_transmission/demo_pb2_grpc.py similarity index 100% rename from examples/python/data_transmission/demo_grpc_pbs/demo_pb2_grpc.py rename to examples/python/data_transmission/demo_pb2_grpc.py diff --git a/examples/python/data_transmission/server.py b/examples/python/data_transmission/server.py index 60fb84768b7..1baba78c0f6 100644 --- a/examples/python/data_transmission/server.py +++ b/examples/python/data_transmission/server.py @@ -1,22 +1,11 @@ -""" -Author: Zhongying Wang -Email: kerbalwzy@gmail.com -DateTime: 2019-08-13T23:30:00Z -PythonVersion: Python3.6.3 -""" -import os -import sys import time import grpc from threading import Thread from concurrent import futures -# add the `demo_grpc_dps` dir into python package search paths -BaseDir = os.path.dirname(os.path.abspath(__file__)) -sys.path.insert(0, os.path.join(BaseDir, "demo_grpc_pbs")) - -from demo_grpc_pbs import demo_pb2, demo_pb2_grpc +import demo_pb2_grpc +import demo_pb2 SERVER_ADDRESS = 'localhost:23334' SERVER_ID = 1 @@ -51,7 +40,8 @@ class DemoServer(demo_pb2_grpc.GRPCDemoServicer): # create a generator def response_messages(): for i in range(5): - response = demo_pb2.Response(server_id=SERVER_ID, response_data=("send by Python server, message=%d" % i)) + response = demo_pb2.Response(server_id=SERVER_ID, + response_data=("send by Python server, message=%d" % i)) yield response return response_messages() From 55f1899d78774c073805a4140e81e98ee1e95e10 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Tue, 27 Aug 2019 10:36:35 +0800 Subject: [PATCH 457/661] Update:the max_workers argument use default, use 'server.wait_for_termination()' to keep process alive --- examples/python/data_transmission/server.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/python/data_transmission/server.py b/examples/python/data_transmission/server.py index 1baba78c0f6..e6e51e1b733 100644 --- a/examples/python/data_transmission/server.py +++ b/examples/python/data_transmission/server.py @@ -1,4 +1,3 @@ -import time import grpc from threading import Thread @@ -68,17 +67,21 @@ class DemoServer(demo_pb2_grpc.GRPCDemoServicer): def main(): - server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) + server = grpc.server(futures.ThreadPoolExecutor()) demo_pb2_grpc.add_GRPCDemoServicer_to_server(DemoServer(), server) server.add_insecure_port(SERVER_ADDRESS) print("------------------start Python GRPC server") server.start() - - # In python3, `server` have no attribute `wait_for_termination` - while 1: - time.sleep(10) + server.wait_for_termination() + + # If raise Error: + # AttributeError: '_Server' object has no attribute 'wait_for_termination' + # You can use the following code instead: + # import time + # while 1: + # time.sleep(10) if __name__ == '__main__': From d5810a155b5a58688067c0f9aaf6bb32d0fab4a7 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Tue, 27 Aug 2019 11:14:36 +0800 Subject: [PATCH 458/661] Fix: rebuild README files --- .../python/data_transmission/README.cn.md | 36 +++++++++++++++++++ .../python/data_transmission/README.en.md | 36 +++++++++++++++++++ examples/python/data_transmission/README.md | 28 --------------- 3 files changed, 72 insertions(+), 28 deletions(-) create mode 100644 examples/python/data_transmission/README.cn.md create mode 100644 examples/python/data_transmission/README.en.md delete mode 100644 examples/python/data_transmission/README.md diff --git a/examples/python/data_transmission/README.cn.md b/examples/python/data_transmission/README.cn.md new file mode 100644 index 00000000000..500e9bf95de --- /dev/null +++ b/examples/python/data_transmission/README.cn.md @@ -0,0 +1,36 @@ +## Data transmission demo for using gRPC in Python + +在Python中使用gRPC时, 进行数据传输的四种方式。 + +- #### 简单模式 + + 没啥好说的,跟调普通方法没差 + + `client.py - line:13 - simple_method` + + `server.py - line:17 - SimpleMethod` + +- #### 客户端流模式 + + 在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应. + + `clien.py - line:24 - client_streaming_method ` + + `server.py - line:25 - ClientStreamingMethod` + +- #### 服务端流模式 + + 在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应 + + `clien.py - line:42 - server_streaming_method` + + `server.py - line:35 - ServerStreamingMethod` + +- #### 双向流模式 + + 在一次调用中, 客户端和服务器都可以向对方多次收发数据 + + `client.py - line:55 - bidirectional_streaming_method` + + `server.py - line:51 - BidirectionalStreamingMethod` + diff --git a/examples/python/data_transmission/README.en.md b/examples/python/data_transmission/README.en.md new file mode 100644 index 00000000000..7fc527cf51a --- /dev/null +++ b/examples/python/data_transmission/README.en.md @@ -0,0 +1,36 @@ +## Data transmission demo for using gRPC in Python + +Four ways of data transmission when gRPC is used in Python. + +- #### unary-unary + + There's nothing to say. It's no different from the usual way. + + `client.py - line:13 - simple_method` + + `server.py - line:17 - SimpleMethod` +- #### stream-unary + + In a single call, the client can transfer data to the server an arbitrary number of times, but the server can only return a response once. + + `clien.py - line:24 - client_streaming_method` + + `server.py - line:25 - ClientStreamingMethod` + +- #### unary-stream + + In a single call, the client can only transmit data to the server at one time, but the server can return the response many times. + + `clien.py - line:42 - server_streaming_method` + + `server.py - line:35 - ServerStreamingMethod` + +- #### stream-stream + + In a single call, both client and server can send and receive data + to each other multiple times. + + `client.py - line:55 - bidirectional_streaming_method` + + `server.py - line:51 - BidirectionalStreamingMethod` + diff --git a/examples/python/data_transmission/README.md b/examples/python/data_transmission/README.md deleted file mode 100644 index 919b9c5cc61..00000000000 --- a/examples/python/data_transmission/README.md +++ /dev/null @@ -1,28 +0,0 @@ -## Demo for using gRPC in Python - -在Python中使用gRPC时, 进行数据传输的四种方式。(Four ways of data transmission when gRPC is used in Python.) - -- #### 简单模式 (unary-unary) -```text -没啥好说的,跟调普通方法没差 -There's nothing to say. It's no different from the usual way. -``` -- #### 客户端流模式 (stream-unary) -```text -在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应. -In a single call, the client can transfer data to the server several times, -but the server can only return a response once. -``` -- #### 服务端流模式 (unary-stream) -```text -在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应 -In a single call, the client can only transmit data to the server at one time, -but the server can return the response many times. -``` -- #### 双向流模式 (stream-stream) -```text -在一次调用中, 客户端和服务器都可以向对方多次收发数据 -In a single call, both client and server can send and receive data -to each other multiple times. -``` - From cc4b946e3c37c7c7bb672ba92b43ef8708a65013 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 27 Aug 2019 08:35:09 -0700 Subject: [PATCH 459/661] Replace 32bit/debian:jessie with i386/debian:jessie --- .../tools/dockerfile/test/cxx_jessie_x86/Dockerfile.template | 2 +- tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile | 2 +- tools/dockerfile/distribtest/node_jessie_x86/Dockerfile | 2 +- tools/dockerfile/distribtest/python_dev_jessie_x86/Dockerfile | 2 +- tools/dockerfile/distribtest/python_jessie_x86/Dockerfile | 2 +- tools/dockerfile/distribtest/ruby_jessie_x86/Dockerfile | 2 +- tools/dockerfile/test/cxx_jessie_x86/Dockerfile | 2 +- .../helper_scripts/prepare_build_linux_perf_multilang_rc | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/tools/dockerfile/test/cxx_jessie_x86/Dockerfile.template b/templates/tools/dockerfile/test/cxx_jessie_x86/Dockerfile.template index 36f243c3405..8d9012d6acf 100644 --- a/templates/tools/dockerfile/test/cxx_jessie_x86/Dockerfile.template +++ b/templates/tools/dockerfile/test/cxx_jessie_x86/Dockerfile.template @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM 32bit/debian:jessie + FROM i386/debian:jessie RUN sed -i '/deb http:\/\/http.debian.net\/debian jessie-updates main/d' /etc/apt/sources.list <%include file="../../apt_get_basic.include"/> diff --git a/tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile b/tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile index aec936a5b8c..96b318d8ae0 100644 --- a/tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile +++ b/tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM 32bit/debian:jessie +FROM i386/debian:jessie RUN apt-get update && apt-get install -y apt-transport-https && apt-get clean diff --git a/tools/dockerfile/distribtest/node_jessie_x86/Dockerfile b/tools/dockerfile/distribtest/node_jessie_x86/Dockerfile index 1db31a5d9c6..aa9695e3173 100644 --- a/tools/dockerfile/distribtest/node_jessie_x86/Dockerfile +++ b/tools/dockerfile/distribtest/node_jessie_x86/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM 32bit/debian:jessie +FROM i386/debian:jessie RUN apt-get update && apt-get install -y curl diff --git a/tools/dockerfile/distribtest/python_dev_jessie_x86/Dockerfile b/tools/dockerfile/distribtest/python_dev_jessie_x86/Dockerfile index 5e0b8efe756..b1d1a31061a 100644 --- a/tools/dockerfile/distribtest/python_dev_jessie_x86/Dockerfile +++ b/tools/dockerfile/distribtest/python_dev_jessie_x86/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM 32bit/debian:jessie +FROM i386/debian:jessie RUN apt-get update && apt-get install -y python python-pip diff --git a/tools/dockerfile/distribtest/python_jessie_x86/Dockerfile b/tools/dockerfile/distribtest/python_jessie_x86/Dockerfile index 140c6cb7afa..d5b63421c59 100644 --- a/tools/dockerfile/distribtest/python_jessie_x86/Dockerfile +++ b/tools/dockerfile/distribtest/python_jessie_x86/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM 32bit/debian:jessie +FROM i386/debian:jessie RUN apt-get update && apt-get install -y python python-pip diff --git a/tools/dockerfile/distribtest/ruby_jessie_x86/Dockerfile b/tools/dockerfile/distribtest/ruby_jessie_x86/Dockerfile index b011f837dd5..04cfa51069c 100644 --- a/tools/dockerfile/distribtest/ruby_jessie_x86/Dockerfile +++ b/tools/dockerfile/distribtest/ruby_jessie_x86/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM 32bit/debian:jessie +FROM i386/debian:jessie RUN apt-get update && apt-get install -y ruby-full diff --git a/tools/dockerfile/test/cxx_jessie_x86/Dockerfile b/tools/dockerfile/test/cxx_jessie_x86/Dockerfile index 59b86d7247c..18611e60d23 100644 --- a/tools/dockerfile/test/cxx_jessie_x86/Dockerfile +++ b/tools/dockerfile/test/cxx_jessie_x86/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM 32bit/debian:jessie +FROM i386/debian:jessie RUN sed -i '/deb http:\/\/http.debian.net\/debian jessie-updates main/d' /etc/apt/sources.list # Install Git and basic packages. diff --git a/tools/internal_ci/helper_scripts/prepare_build_linux_perf_multilang_rc b/tools/internal_ci/helper_scripts/prepare_build_linux_perf_multilang_rc index f1031aedf39..bb1287fee51 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_linux_perf_multilang_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_linux_perf_multilang_rc @@ -30,7 +30,7 @@ sudo pip install tabulate export PATH="$HOME/.rbenv/bin:$PATH" eval "$(rbenv init -)" gem list bundler -gem install bundler --no-ri --no-rdoc +gem install bundler --no-document # Allow SSH to Kokoro performance workers without explicit key verification gsutil cp gs://grpc-testing-secrets/grpc_kokoro_performance_ssh_keys/id_rsa ~/.ssh From 7c4b45de43cb894c55c5dfbaf293c17def4f513b Mon Sep 17 00:00:00 2001 From: Zhehao /Tony/ Lu Date: Tue, 27 Aug 2019 10:48:47 -0700 Subject: [PATCH 460/661] Little changes --- examples/objective-c/README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/examples/objective-c/README.md b/examples/objective-c/README.md index 777141d7e02..36e6f8b1a01 100644 --- a/examples/objective-c/README.md +++ b/examples/objective-c/README.md @@ -9,7 +9,7 @@ There are currently two ways to build projects with the gRPC Objective-C library The [helloworld](helloworld) sample is the entry point for the Cocoapods way of building projects. More is documented on grpc.io, including [installation](https://grpc.io/docs/quickstart/objective-c/) and some [tutorials](https://grpc.io/docs/tutorials/basic/objective-c/). They will not be reiterated here and they are not mandatory for the Bazel way. -A good place to get started with Bazel is their official [website](https://bazel.build). And the documentation of using Bazel with gRPC Objective-C library is [here](https://github.com/grpc/proposal/blob/master/L56-objc-bazel-support.md). +A good place to get started with Bazel is their official [website](https://bazel.build). The documentation of using gRPC Objective-C library with Bazel is [here](https://github.com/grpc/proposal/blob/master/L56-objc-bazel-support.md). ## Installation To run the examples in Bazel, you should have [Bazel](https://docs.bazel.build/versions/master/install-os-x.html) installed. @@ -22,8 +22,6 @@ The code for the Hello World example and others live in the `examples` directory $ git clone --recursive https://github.com/grpc/grpc ``` -Bazel support for gRPC Objective-C is not yet released, so we need to work on the master branch. - Next, change your directory to `examples/objective-c` ```shell $ cd examples/objective-c @@ -46,17 +44,17 @@ Now compile the sample: ```shell $ bazel build :HelloWorld ``` -To run the sample, you need to know the available simulator runtimes in your machine. You could either list the available runtimes yourself: +To run the sample, you need to know the available simulator runtimes in your machine. You could either list the available runtimes yourself by running: ```shell $ xcrun simctl list ``` -Or just try running the app and it will let you know what is available: +Or just try running the app and it will let you know what is available in the error messages: ```shell $ bazel run :HelloWorld ``` -Note that running this command will build the project even if you forget to build it beforehand. +Note that running this command will build the project even if it is not built beforehand. Finally, launch the app with one of the available runtimes: ```shell $ bazel run :HelloWorld --ios_simulator_version='' --ios_sumlator_device='' -``` \ No newline at end of file +``` From 18be57b4dfb3b2b6341f2d0903b5fce12282c1fa Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 27 Aug 2019 11:21:06 -0700 Subject: [PATCH 461/661] LB policy API changes suggested by Sanjay. --- .../filters/client_channel/client_channel.cc | 10 ++-- .../ext/filters/client_channel/lb_policy.cc | 2 +- .../ext/filters/client_channel/lb_policy.h | 55 ++++++++++--------- .../client_channel/lb_policy/grpclb/grpclb.cc | 5 +- .../client_channel/lb_policy/xds/xds.cc | 9 ++- .../client_channel/resolving_lb_policy.cc | 4 +- test/core/util/test_lb_policies.cc | 2 +- 7 files changed, 43 insertions(+), 44 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 63bd737e931..f88c1228de0 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -1345,11 +1345,11 @@ class ChannelData::ClientChannelControlHelper // No-op -- we should never get this from ResolvingLoadBalancingPolicy. void RequestReresolution() override {} - void AddTraceEvent(TraceSeverity severity, const char* message) override { + void AddTraceEvent(TraceSeverity severity, StringView message) override { if (chand_->channelz_node_ != nullptr) { chand_->channelz_node_->AddTraceEvent( ConvertSeverityEnum(severity), - grpc_slice_from_copied_string(message)); + grpc_slice_from_copied_buffer(message.data(), message.size())); } } @@ -3730,8 +3730,8 @@ const char* PickResultTypeName( return "COMPLETE"; case LoadBalancingPolicy::PickResult::PICK_QUEUE: return "QUEUE"; - case LoadBalancingPolicy::PickResult::PICK_TRANSIENT_FAILURE: - return "TRANSIENT_FAILURE"; + case LoadBalancingPolicy::PickResult::PICK_FAILED: + return "FAILED"; } GPR_UNREACHABLE_CODE(return "UNKNOWN"); } @@ -3792,7 +3792,7 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) { result.subchannel.get(), grpc_error_string(result.error)); } switch (result.type) { - case LoadBalancingPolicy::PickResult::PICK_TRANSIENT_FAILURE: { + case LoadBalancingPolicy::PickResult::PICK_FAILED: { // If we're shutting down, fail all RPCs. grpc_error* disconnect_error = chand->disconnect_error(); if (disconnect_error != GRPC_ERROR_NONE) { diff --git a/src/core/ext/filters/client_channel/lb_policy.cc b/src/core/ext/filters/client_channel/lb_policy.cc index 3207f888044..41a7d2d07be 100644 --- a/src/core/ext/filters/client_channel/lb_policy.cc +++ b/src/core/ext/filters/client_channel/lb_policy.cc @@ -129,7 +129,7 @@ void LoadBalancingPolicy::QueuePicker::CallExitIdle(void* arg, LoadBalancingPolicy::PickResult LoadBalancingPolicy::TransientFailurePicker::Pick(PickArgs args) { PickResult result; - result.type = PickResult::PICK_TRANSIENT_FAILURE; + result.type = PickResult::PICK_FAILED; result.error = GRPC_ERROR_REF(error_); return result; } diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h index ea4962cdb77..6e7447dd172 100644 --- a/src/core/ext/filters/client_channel/lb_policy.h +++ b/src/core/ext/filters/client_channel/lb_policy.h @@ -42,15 +42,15 @@ extern DebugOnlyTraceFlag grpc_trace_lb_policy_refcount; /// /// Channel: An abstraction that manages connections to backend servers /// on behalf of a client application. The application creates a channel -/// for a given server name and then sends RPCs on it, and the channel -/// figures out which backend server to send each RPC to. A channel +/// for a given server name and then sends calls (RPCs) on it, and the +/// channel figures out which backend server to send each call to. A channel /// contains a resolver, a load balancing policy (or a tree of LB policies), /// and a set of one or more subchannels. /// /// Subchannel: A subchannel represents a connection to one backend server. /// The LB policy decides which subchannels to create, manages the /// connectivity state of those subchannels, and decides which subchannel -/// to send any given RPC to. +/// to send any given call to. /// /// Resolver: A plugin that takes a gRPC server URI and resolves it to a /// list of one or more addresses and a service config, as described @@ -59,12 +59,12 @@ extern DebugOnlyTraceFlag grpc_trace_lb_policy_refcount; /// /// Load Balancing (LB) Policy: A plugin that takes a list of addresses /// from the resolver, maintains and manages a subchannel for each -/// backend address, and decides which subchannel to send each RPC on. +/// backend address, and decides which subchannel to send each call on. /// An LB policy has two parts: /// - A LoadBalancingPolicy, which deals with the control plane work of /// managing subchannels. /// - A SubchannelPicker, which handles the data plane work of -/// determining which subchannel a given RPC should be sent on. +/// determining which subchannel a given call should be sent on. /// LoadBalacingPolicy API. /// @@ -78,6 +78,7 @@ extern DebugOnlyTraceFlag grpc_trace_lb_policy_refcount; class LoadBalancingPolicy : public InternallyRefCounted { public: /// Interface for accessing per-call state. + /// Implemented by the client channel and used by the SubchannelPicker. class CallState { public: CallState() = default; @@ -93,6 +94,7 @@ class LoadBalancingPolicy : public InternallyRefCounted { }; /// Interface for accessing metadata. + /// Implemented by the client channel and used by the SubchannelPicker. class MetadataInterface { public: // Implementations whose iterators fit in intptr_t may internally @@ -123,7 +125,7 @@ class LoadBalancingPolicy : public InternallyRefCounted { GRPC_ABSTRACT_BASE_CLASS }; - /// Arguments used when picking a subchannel for an RPC. + /// Arguments used when picking a subchannel for a call. struct PickArgs { /// Initial metadata associated with the picking call. /// The LB policy may use the existing metadata to influence its routing @@ -135,24 +137,23 @@ class LoadBalancingPolicy : public InternallyRefCounted { CallState* call_state; }; - /// The result of picking a subchannel for an RPC. + /// The result of picking a subchannel for a call. struct PickResult { enum ResultType { - /// Pick complete. If connected_subchannel is non-null, client channel - /// can immediately proceed with the call on connected_subchannel; - /// otherwise, call should be dropped. + /// Pick complete. If \a subchannel is non-null, the client channel + /// will immediately proceed with the call on that subchannel; + /// otherwise, it will drop the call. PICK_COMPLETE, /// Pick cannot be completed until something changes on the control - /// plane. Client channel will queue the pick and try again the + /// plane. The client channel will queue the pick and try again the /// next time the picker is updated. PICK_QUEUE, - /// LB policy is in transient failure. If the pick is wait_for_ready, - /// client channel will wait for the next picker and try again; - /// otherwise, the call will be failed immediately (although it may - /// be retried if the client channel is configured to do so). - /// The Pick() method will set its error parameter if this value is - /// returned. - PICK_TRANSIENT_FAILURE, + /// Pick failed. If the call is wait_for_ready, the client channel + /// will wait for the next picker and try again; otherwise, it + /// will immediately fail the call with the status indicated via + /// \a error (although the call may be retried if the client channel + /// is configured to do so). + PICK_FAILED, }; ResultType type; @@ -160,14 +161,14 @@ class LoadBalancingPolicy : public InternallyRefCounted { /// subchannel, or nullptr if the LB policy decides to drop the call. RefCountedPtr subchannel; - /// Used only if type is PICK_TRANSIENT_FAILURE. - /// Error to be set when returning a transient failure. + /// Used only if type is PICK_FAILED. + /// Error to be set when returning a failure. // TODO(roth): Replace this with something similar to grpc::Status, // so that we don't expose grpc_error to this API. grpc_error* error = GRPC_ERROR_NONE; /// Used only if type is PICK_COMPLETE. - /// Callback set by lb policy to be notified of trailing metadata. + /// Callback set by LB policy to be notified of trailing metadata. /// The user_data argument will be set to the /// recv_trailing_metadata_ready_user_data field. /// recv_trailing_metadata will be set to the metadata, which may be @@ -184,11 +185,12 @@ class LoadBalancingPolicy : public InternallyRefCounted { }; /// A subchannel picker is the object used to pick the subchannel to - /// use for a given RPC. + /// use for a given call. This is implemented by the LB policy and + /// used by the client channel to perform picks. /// /// Pickers are intended to encapsulate all of the state and logic /// needed on the data plane (i.e., to actually process picks for - /// individual RPCs sent on the channel) while excluding all of the + /// individual calls sent on the channel) while excluding all of the /// state and logic needed on the control plane (i.e., resolver /// updates, connectivity state notifications, etc); the latter should /// live in the LB policy object itself. @@ -206,8 +208,8 @@ class LoadBalancingPolicy : public InternallyRefCounted { GRPC_ABSTRACT_BASE_CLASS }; - /// A proxy object used by the LB policy to communicate with the client - /// channel. + /// A proxy object implemented by the client channel and used by the + /// LB policy to communicate with the channel. // TODO(juanlishen): Consider adding a mid-layer subclass that helps handle // things like swapping in pending policy when it's ready. Currently, we are // duplicating the logic in many subclasses. @@ -235,10 +237,9 @@ class LoadBalancingPolicy : public InternallyRefCounted { virtual void RequestReresolution() GRPC_ABSTRACT; /// Adds a trace message associated with the channel. - /// Does NOT take ownership of \a message. enum TraceSeverity { TRACE_INFO, TRACE_WARNING, TRACE_ERROR }; virtual void AddTraceEvent(TraceSeverity severity, - const char* message) GRPC_ABSTRACT; + StringView message) GRPC_ABSTRACT; GRPC_ABSTRACT_BASE_CLASS }; diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index 6a565e057b9..c63717bdb92 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -298,7 +298,7 @@ class GrpcLb : public LoadBalancingPolicy { void UpdateState(grpc_connectivity_state state, UniquePtr picker) override; void RequestReresolution() override; - void AddTraceEvent(TraceSeverity severity, const char* message) override; + void AddTraceEvent(TraceSeverity severity, StringView message) override; void set_child(LoadBalancingPolicy* child) { child_ = child; } @@ -756,8 +756,7 @@ void GrpcLb::Helper::RequestReresolution() { } } -void GrpcLb::Helper::AddTraceEvent(TraceSeverity severity, - const char* message) { +void GrpcLb::Helper::AddTraceEvent(TraceSeverity severity, StringView message) { if (parent_->shutting_down_ || (!CalledByPendingChild() && !CalledByCurrentChild())) { return; diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 75fa544c80a..f40e58e47c5 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -436,7 +436,7 @@ class XdsLb : public LoadBalancingPolicy { void UpdateState(grpc_connectivity_state state, UniquePtr picker) override; void RequestReresolution() override; - void AddTraceEvent(TraceSeverity severity, const char* message) override; + void AddTraceEvent(TraceSeverity severity, StringView message) override; void set_child(LoadBalancingPolicy* child) { child_ = child; } @@ -487,8 +487,7 @@ class XdsLb : public LoadBalancingPolicy { void UpdateState(grpc_connectivity_state state, UniquePtr picker) override; void RequestReresolution() override; - void AddTraceEvent(TraceSeverity severity, - const char* message) override; + void AddTraceEvent(TraceSeverity severity, StringView message) override; void set_child(LoadBalancingPolicy* child) { child_ = child; } private: @@ -774,7 +773,7 @@ void XdsLb::FallbackHelper::RequestReresolution() { } void XdsLb::FallbackHelper::AddTraceEvent(TraceSeverity severity, - const char* message) { + StringView message) { if (parent_->shutting_down_ || (!CalledByPendingFallback() && !CalledByCurrentFallback())) { return; @@ -2510,7 +2509,7 @@ void XdsLb::LocalityMap::LocalityEntry::Helper::RequestReresolution() { } void XdsLb::LocalityMap::LocalityEntry::Helper::AddTraceEvent( - TraceSeverity severity, const char* message) { + TraceSeverity severity, StringView message) { if (entry_->parent_->shutting_down_ || (!CalledByPendingChild() && !CalledByCurrentChild())) { return; diff --git a/src/core/ext/filters/client_channel/resolving_lb_policy.cc b/src/core/ext/filters/client_channel/resolving_lb_policy.cc index b3b455b0ce8..c85e948a55b 100644 --- a/src/core/ext/filters/client_channel/resolving_lb_policy.cc +++ b/src/core/ext/filters/client_channel/resolving_lb_policy.cc @@ -160,7 +160,7 @@ class ResolvingLoadBalancingPolicy::ResolvingControlHelper } } - void AddTraceEvent(TraceSeverity severity, const char* message) override {} + void AddTraceEvent(TraceSeverity severity, StringView message) override {} void set_child(LoadBalancingPolicy* child) { child_ = child; } @@ -435,7 +435,7 @@ void ResolvingLoadBalancingPolicy::ConcatenateAndAddChannelTraceLocked( size_t len = 0; UniquePtr message(gpr_strvec_flatten(&v, &len)); channel_control_helper()->AddTraceEvent(ChannelControlHelper::TRACE_INFO, - message.get()); + StringView(message.get())); gpr_strvec_destroy(&v); } } diff --git a/test/core/util/test_lb_policies.cc b/test/core/util/test_lb_policies.cc index 77e186c6d49..0539a498965 100644 --- a/test/core/util/test_lb_policies.cc +++ b/test/core/util/test_lb_policies.cc @@ -166,7 +166,7 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy parent_->channel_control_helper()->RequestReresolution(); } - void AddTraceEvent(TraceSeverity severity, const char* message) override { + void AddTraceEvent(TraceSeverity severity, StringView message) override { parent_->channel_control_helper()->AddTraceEvent(severity, message); } From 905f52852e6bfeaa09969bc89c9495da01cd31f7 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 27 Aug 2019 12:03:10 -0400 Subject: [PATCH 462/661] make python dockerfiles buildable again --- .../dockerfile/debian_testing_repo.include | 3 -- .../grpc_interop_python/Dockerfile.template | 2 +- .../tools/dockerfile/python_stretch.include | 4 ++- .../Dockerfile.template | 16 ++++++++-- .../Dockerfile.template | 2 +- .../Dockerfile.template | 13 +++++---- .../test/sanity/Dockerfile.template | 2 +- .../grpc_interop_python/Dockerfile | 9 +++--- .../test/python_stretch_2.7_x64/Dockerfile | 7 ++--- .../test/python_stretch_3.5_x64/Dockerfile | 7 ++--- .../test/python_stretch_3.6_x64/Dockerfile | 22 ++++++++++---- .../test/python_stretch_3.7_x64/Dockerfile | 9 +++--- .../test/python_stretch_3.8_x64/Dockerfile | 20 +++++++------ .../python_stretch_3.8_x64/get_cpython.sh | 29 ------------------- tools/dockerfile/test/sanity/Dockerfile | 9 +++--- 15 files changed, 73 insertions(+), 81 deletions(-) delete mode 100644 templates/tools/dockerfile/debian_testing_repo.include delete mode 100644 tools/dockerfile/test/python_stretch_3.8_x64/get_cpython.sh diff --git a/templates/tools/dockerfile/debian_testing_repo.include b/templates/tools/dockerfile/debian_testing_repo.include deleted file mode 100644 index 1a5248e2264..00000000000 --- a/templates/tools/dockerfile/debian_testing_repo.include +++ /dev/null @@ -1,3 +0,0 @@ -# Add Debian 'testing' repository -RUN echo 'deb http://ftp.de.debian.org/debian testing main' >> /etc/apt/sources.list -RUN echo 'APT::Default-Release "stable";' | tee -a /etc/apt/apt.conf.d/00local diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile.template index f584a2378eb..ac939620d07 100644 --- a/templates/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile.template +++ b/templates/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile.template @@ -16,5 +16,5 @@ <%include file="../../python_stretch.include"/> - RUN apt-get update && apt-get -t testing install -y python3.7 python3-all-dev + RUN apt-get update && apt-get -t stable install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 diff --git a/templates/tools/dockerfile/python_stretch.include b/templates/tools/dockerfile/python_stretch.include index 45bafe51842..43ba98ae64c 100644 --- a/templates/tools/dockerfile/python_stretch.include +++ b/templates/tools/dockerfile/python_stretch.include @@ -3,7 +3,9 @@ FROM debian:stretch <%include file="./apt_get_basic.include"/> <%include file="./gcp_api_libraries.include"/> <%include file="./apt_get_python_27.include"/> -<%include file="./debian_testing_repo.include"/> +# Add Debian 'buster' repository, we will need it for installing newer versions of python +RUN echo 'deb http://ftp.de.debian.org/debian buster main' >> /etc/apt/sources.list +RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local <%include file="./run_tests_addons.include"/> # Define the default command. CMD ["bash"] diff --git a/templates/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile.template index a5dcf196f2b..2c2cb6de08b 100644 --- a/templates/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile.template @@ -16,5 +16,17 @@ <%include file="../../python_stretch.include"/> - RUN apt-get update && apt-get -t testing install -y python3.6 python3-all-dev - RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6 + RUN apt-get install -y jq zlib1g-dev libssl-dev + + RUN apt-get install -y jq build-essential libffi-dev + + RUN cd /tmp && ${'\\'} + wget -q https://github.com/python/cpython/archive/v3.6.9.tar.gz && ${'\\'} + tar xzvf v3.6.9.tar.gz && ${'\\'} + cd cpython-3.6.9 && ${'\\'} + ./configure && ${'\\'} + make install + + RUN python3.6 -m ensurepip && ${'\\'} + python3.6 -m pip install coverage + diff --git a/templates/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile.template index c3602f6c512..c4270bdfc89 100644 --- a/templates/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile.template @@ -16,7 +16,7 @@ <%include file="../../python_stretch.include"/> - RUN apt-get update && apt-get -t testing install -y python3.7 python3-all-dev + RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 # for Python test coverage reporting diff --git a/templates/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile.template index 8f2585a4d59..841a7f51b51 100644 --- a/templates/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile.template @@ -18,11 +18,14 @@ <%include file="../../python_stretch.include"/> RUN apt-get install -y jq zlib1g-dev libssl-dev - COPY get_cpython.sh /tmp - RUN apt-get install -y jq build-essential libffi-dev && ${'\\'} - chmod +x /tmp/get_cpython.sh && ${'\\'} - /tmp/get_cpython.sh && ${'\\'} - rm /tmp/get_cpython.sh + RUN apt-get install -y jq build-essential libffi-dev + + RUN cd /tmp && ${'\\'} + wget -q https://github.com/python/cpython/archive/v3.8.0b3.tar.gz && ${'\\'} + tar xzvf v3.8.0b3.tar.gz && ${'\\'} + cd cpython-3.8.0b3 && ${'\\'} + ./configure && ${'\\'} + make install RUN python3.8 -m ensurepip && ${'\\'} python3.8 -m pip install coverage diff --git a/templates/tools/dockerfile/test/sanity/Dockerfile.template b/templates/tools/dockerfile/test/sanity/Dockerfile.template index 2e4bdf537b7..84a4049be0e 100644 --- a/templates/tools/dockerfile/test/sanity/Dockerfile.template +++ b/templates/tools/dockerfile/test/sanity/Dockerfile.template @@ -18,7 +18,7 @@ <%include file="../../cxx_deps.include"/> #======================== # Sanity test dependencies - RUN apt-get update && apt-get -t testing install -y python3.7 python3-all-dev + RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 # Make Python 3.7 the default Python 3 version RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 diff --git a/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile index acad500f90c..b11a1a1aa31 100644 --- a/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile @@ -57,10 +57,9 @@ RUN pip install --upgrade google-api-python-client oauth2client RUN apt-get update && apt-get install -y python2.7 python-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python2.7 -# Add Debian 'testing' repository -RUN echo 'deb http://ftp.de.debian.org/debian testing main' >> /etc/apt/sources.list -RUN echo 'APT::Default-Release "stable";' | tee -a /etc/apt/apt.conf.d/00local - +# Add Debian 'buster' repository, we will need it for installing newer versions of python +RUN echo 'deb http://ftp.de.debian.org/debian buster main' >> /etc/apt/sources.list +RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins @@ -68,5 +67,5 @@ RUN mkdir /var/local/jenkins CMD ["bash"] -RUN apt-get update && apt-get -t testing install -y python3.7 python3-all-dev +RUN apt-get update && apt-get -t stable install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 diff --git a/tools/dockerfile/test/python_stretch_2.7_x64/Dockerfile b/tools/dockerfile/test/python_stretch_2.7_x64/Dockerfile index a7a8174db48..92b18e740da 100644 --- a/tools/dockerfile/test/python_stretch_2.7_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_2.7_x64/Dockerfile @@ -57,10 +57,9 @@ RUN pip install --upgrade google-api-python-client oauth2client RUN apt-get update && apt-get install -y python2.7 python-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python2.7 -# Add Debian 'testing' repository -RUN echo 'deb http://ftp.de.debian.org/debian testing main' >> /etc/apt/sources.list -RUN echo 'APT::Default-Release "stable";' | tee -a /etc/apt/apt.conf.d/00local - +# Add Debian 'buster' repository, we will need it for installing newer versions of python +RUN echo 'deb http://ftp.de.debian.org/debian buster main' >> /etc/apt/sources.list +RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/python_stretch_3.5_x64/Dockerfile b/tools/dockerfile/test/python_stretch_3.5_x64/Dockerfile index 0e97e77e2fd..7a256edffb2 100644 --- a/tools/dockerfile/test/python_stretch_3.5_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_3.5_x64/Dockerfile @@ -57,10 +57,9 @@ RUN pip install --upgrade google-api-python-client oauth2client RUN apt-get update && apt-get install -y python2.7 python-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python2.7 -# Add Debian 'testing' repository -RUN echo 'deb http://ftp.de.debian.org/debian testing main' >> /etc/apt/sources.list -RUN echo 'APT::Default-Release "stable";' | tee -a /etc/apt/apt.conf.d/00local - +# Add Debian 'buster' repository, we will need it for installing newer versions of python +RUN echo 'deb http://ftp.de.debian.org/debian buster main' >> /etc/apt/sources.list +RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile b/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile index 9b16b2d3a1d..f18af660488 100644 --- a/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile @@ -57,10 +57,9 @@ RUN pip install --upgrade google-api-python-client oauth2client RUN apt-get update && apt-get install -y python2.7 python-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python2.7 -# Add Debian 'testing' repository -RUN echo 'deb http://ftp.de.debian.org/debian testing main' >> /etc/apt/sources.list -RUN echo 'APT::Default-Release "stable";' | tee -a /etc/apt/apt.conf.d/00local - +# Add Debian 'buster' repository, we will need it for installing newer versions of python +RUN echo 'deb http://ftp.de.debian.org/debian buster main' >> /etc/apt/sources.list +RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins @@ -68,5 +67,16 @@ RUN mkdir /var/local/jenkins CMD ["bash"] -RUN apt-get update && apt-get -t testing install -y python3.6 python3-all-dev -RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6 +RUN apt-get install -y jq zlib1g-dev libssl-dev + +RUN apt-get install -y jq build-essential libffi-dev + +RUN cd /tmp && \ + wget -q https://github.com/python/cpython/archive/v3.6.9.tar.gz && \ + tar xzvf v3.6.9.tar.gz && \ + cd cpython-3.6.9 && \ + ./configure && \ + make install + +RUN python3.6 -m ensurepip && \ + python3.6 -m pip install coverage diff --git a/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile b/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile index 45291ffdcfc..46b6526dc69 100644 --- a/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile @@ -57,10 +57,9 @@ RUN pip install --upgrade google-api-python-client oauth2client RUN apt-get update && apt-get install -y python2.7 python-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python2.7 -# Add Debian 'testing' repository -RUN echo 'deb http://ftp.de.debian.org/debian testing main' >> /etc/apt/sources.list -RUN echo 'APT::Default-Release "stable";' | tee -a /etc/apt/apt.conf.d/00local - +# Add Debian 'buster' repository, we will need it for installing newer versions of python +RUN echo 'deb http://ftp.de.debian.org/debian buster main' >> /etc/apt/sources.list +RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins @@ -68,7 +67,7 @@ RUN mkdir /var/local/jenkins CMD ["bash"] -RUN apt-get update && apt-get -t testing install -y python3.7 python3-all-dev +RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 # for Python test coverage reporting diff --git a/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile b/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile index d5ecbc7110a..495d86fd099 100644 --- a/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile @@ -57,10 +57,9 @@ RUN pip install --upgrade google-api-python-client oauth2client RUN apt-get update && apt-get install -y python2.7 python-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python2.7 -# Add Debian 'testing' repository -RUN echo 'deb http://ftp.de.debian.org/debian testing main' >> /etc/apt/sources.list -RUN echo 'APT::Default-Release "stable";' | tee -a /etc/apt/apt.conf.d/00local - +# Add Debian 'buster' repository, we will need it for installing newer versions of python +RUN echo 'deb http://ftp.de.debian.org/debian buster main' >> /etc/apt/sources.list +RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins @@ -69,11 +68,14 @@ CMD ["bash"] RUN apt-get install -y jq zlib1g-dev libssl-dev -COPY get_cpython.sh /tmp -RUN apt-get install -y jq build-essential libffi-dev && \ - chmod +x /tmp/get_cpython.sh && \ - /tmp/get_cpython.sh && \ - rm /tmp/get_cpython.sh +RUN apt-get install -y jq build-essential libffi-dev + +RUN cd /tmp && \ + wget -q https://github.com/python/cpython/archive/v3.8.0b3.tar.gz && \ + tar xzvf v3.8.0b3.tar.gz && \ + cd cpython-3.8.0b3 && \ + ./configure && \ + make install RUN python3.8 -m ensurepip && \ python3.8 -m pip install coverage diff --git a/tools/dockerfile/test/python_stretch_3.8_x64/get_cpython.sh b/tools/dockerfile/test/python_stretch_3.8_x64/get_cpython.sh deleted file mode 100644 index e051e974b38..00000000000 --- a/tools/dockerfile/test/python_stretch_3.8_x64/get_cpython.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# Copyright 2019 The gRPC Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -VERSION_REGEX="v3.8.*" -REPO="python/cpython" - -LATEST=$(curl -s https://api.github.com/repos/$REPO/tags | \ - jq -r '.[] | select(.name|test("'$VERSION_REGEX'")) | .name' \ - | sort | tail -n1) - -wget https://github.com/$REPO/archive/$LATEST.tar.gz -tar xzvf *.tar.gz -( cd cpython* - ./configure - make install -) diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile index ca786e264ed..675378b305b 100644 --- a/tools/dockerfile/test/sanity/Dockerfile +++ b/tools/dockerfile/test/sanity/Dockerfile @@ -57,10 +57,9 @@ RUN pip install --upgrade google-api-python-client oauth2client RUN apt-get update && apt-get install -y python2.7 python-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python2.7 -# Add Debian 'testing' repository -RUN echo 'deb http://ftp.de.debian.org/debian testing main' >> /etc/apt/sources.list -RUN echo 'APT::Default-Release "stable";' | tee -a /etc/apt/apt.conf.d/00local - +# Add Debian 'buster' repository, we will need it for installing newer versions of python +RUN echo 'deb http://ftp.de.debian.org/debian buster main' >> /etc/apt/sources.list +RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins @@ -73,7 +72,7 @@ RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev c #======================== # Sanity test dependencies -RUN apt-get update && apt-get -t testing install -y python3.7 python3-all-dev +RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 # Make Python 3.7 the default Python 3 version RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 From 732e2a1e90c30eec5611441b122ab4d17eb1f7fb Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Tue, 27 Aug 2019 15:53:47 -0700 Subject: [PATCH 463/661] Tune load reporter test --- test/cpp/server/load_reporter/load_reporter_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cpp/server/load_reporter/load_reporter_test.cc b/test/cpp/server/load_reporter/load_reporter_test.cc index 9d2ebfb0b4f..1866286069e 100644 --- a/test/cpp/server/load_reporter/load_reporter_test.cc +++ b/test/cpp/server/load_reporter/load_reporter_test.cc @@ -172,9 +172,9 @@ class LbFeedbackTest : public LoadReporterTest { // TODO(juanlishen): The error is big because we use sleep(). It should be // much smaller when we use fake clock. ASSERT_THAT(static_cast(lb_feedback.calls_per_second()), - DoubleNear(expected_qps, expected_qps * 0.05)); + DoubleNear(expected_qps, expected_qps * 0.3)); ASSERT_THAT(static_cast(lb_feedback.errors_per_second()), - DoubleNear(expected_eps, expected_eps * 0.05)); + DoubleNear(expected_eps, expected_eps * 0.3)); gpr_log(GPR_INFO, "Verified LB feedback matches the samples of index [%lu, %lu).", start, start + count); From 2767accc1bd0daab44c4199422742e1cd8f56d8f Mon Sep 17 00:00:00 2001 From: Arjun Roy Date: Fri, 23 Aug 2019 14:49:26 -0700 Subject: [PATCH 464/661] Fixed init-order-fiasco for static slice table. Fixes init-order bug affecting https://github.com/grpc/grpc/issues/19819 which was first exposed by this commit: https://github.com/grpc/grpc/commit/857375a1420df184963ed83f638dd21ea359aa37 --- .../filters/client_channel/client_channel.cc | 4 +- .../transport/chttp2/transport/hpack_table.cc | 2 +- .../transport/chttp2/transport/hpack_table.h | 4 +- src/core/lib/slice/slice_intern.cc | 20 +- src/core/lib/slice/slice_internal.h | 2 +- src/core/lib/slice/slice_utils.h | 8 +- src/core/lib/surface/init.cc | 3 + src/core/lib/transport/metadata.cc | 8 +- src/core/lib/transport/static_metadata.cc | 1648 +++++++---------- src/core/lib/transport/static_metadata.h | 454 ++--- test/core/slice/slice_test.cc | 10 +- test/core/transport/metadata_test.cc | 2 +- test/core/transport/status_metadata_test.cc | 5 +- tools/codegen/core/gen_static_metadata.py | 214 ++- 14 files changed, 1152 insertions(+), 1232 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 429828b0241..60b99c39a7a 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -3163,8 +3163,8 @@ void CallData::AddRetriableSendInitialMetadataOp( SubchannelCallRetryState* retry_state, SubchannelCallBatchData* batch_data) { // Maps the number of retries to the corresponding metadata value slice. - static const grpc_slice* retry_count_strings[] = { - &GRPC_MDSTR_1, &GRPC_MDSTR_2, &GRPC_MDSTR_3, &GRPC_MDSTR_4}; + const grpc_slice* retry_count_strings[] = {&GRPC_MDSTR_1, &GRPC_MDSTR_2, + &GRPC_MDSTR_3, &GRPC_MDSTR_4}; // We need to make a copy of the metadata batch for each attempt, since // the filters in the subchannel stack may modify this batch, and we don't // want those modifications to be passed forward to subsequent attempts. diff --git a/src/core/ext/transport/chttp2/transport/hpack_table.cc b/src/core/ext/transport/chttp2/transport/hpack_table.cc index f86332c6bc3..68d3ec49fda 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_table.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_table.cc @@ -189,7 +189,7 @@ grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find( /* See if the string is in the static table */ for (i = 0; i < GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) { - grpc_mdelem ent = grpc_static_mdelem_manifested[i]; + grpc_mdelem ent = grpc_static_mdelem_manifested()[i]; if (!grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDKEY(ent))) continue; r.index = i + 1u; r.has_value = grpc_slice_eq(GRPC_MDVALUE(md), GRPC_MDVALUE(ent)); diff --git a/src/core/ext/transport/chttp2/transport/hpack_table.h b/src/core/ext/transport/chttp2/transport/hpack_table.h index 699b7eccaf2..a1aa77f5446 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_table.h +++ b/src/core/ext/transport/chttp2/transport/hpack_table.h @@ -104,7 +104,7 @@ inline grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl, reading the core static metadata table here; at that point we'd need our own singleton static metadata in the correct order. */ return index <= GRPC_CHTTP2_LAST_STATIC_ENTRY - ? grpc_static_mdelem_manifested[index - 1] + ? grpc_static_mdelem_manifested()[index - 1] : grpc_chttp2_hptbl_lookup_dynamic_index(tbl, index); } /* add a table entry to the index */ @@ -120,7 +120,7 @@ size_t grpc_chttp2_get_size_in_hpack_table(grpc_mdelem elem, inline uintptr_t grpc_chttp2_get_static_hpack_table_index(grpc_mdelem md) { uintptr_t index = reinterpret_cast(GRPC_MDELEM_DATA(md)) - - grpc_static_mdelem_table; + grpc_static_mdelem_table(); if (index < GRPC_CHTTP2_LAST_STATIC_ENTRY) { return index + 1; // Hpack static metadata element indices start at 1 } diff --git a/src/core/lib/slice/slice_intern.cc b/src/core/lib/slice/slice_intern.cc index 13fe1ab40e9..d813e5195ad 100644 --- a/src/core/lib/slice/slice_intern.cc +++ b/src/core/lib/slice/slice_intern.cc @@ -138,11 +138,12 @@ grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice, for (uint32_t i = 0; i <= max_static_metadata_hash_probe; i++) { static_metadata_hash_ent ent = static_metadata_hash[(hash + i) % GPR_ARRAY_SIZE(static_metadata_hash)]; + const grpc_core::StaticMetadataSlice* static_slice_table = + grpc_static_slice_table(); if (ent.hash == hash && ent.idx < GRPC_STATIC_MDSTR_COUNT && - grpc_slice_eq_static_interned(slice, - grpc_static_slice_table[ent.idx])) { + grpc_slice_eq_static_interned(slice, static_slice_table[ent.idx])) { *returned_slice_is_different = true; - return grpc_static_slice_table[ent.idx]; + return static_slice_table[ent.idx]; } } @@ -168,10 +169,11 @@ static const grpc_core::StaticMetadataSlice* MatchStaticSlice( for (uint32_t i = 0; i <= max_static_metadata_hash_probe; i++) { static_metadata_hash_ent ent = static_metadata_hash[(hash + i) % GPR_ARRAY_SIZE(static_metadata_hash)]; + const grpc_core::StaticMetadataSlice* static_slice_table = + grpc_static_slice_table(); if (ent.hash == hash && ent.idx < GRPC_STATIC_MDSTR_COUNT && - grpc_static_slice_table[ent.idx].Equals( - std::forward(args)...)) { - return &grpc_static_slice_table[ent.idx]; + static_slice_table[ent.idx].Equals(std::forward(args)...)) { + return &static_slice_table[ent.idx]; } } return nullptr; @@ -318,9 +320,11 @@ void grpc_slice_intern_init(void) { static_metadata_hash[i].idx = GRPC_STATIC_MDSTR_COUNT; } max_static_metadata_hash_probe = 0; + const grpc_core::StaticMetadataSlice* static_slice_table = + grpc_static_slice_table(); for (size_t i = 0; i < GRPC_STATIC_MDSTR_COUNT; i++) { grpc_static_metadata_hash_values[i] = - grpc_slice_default_hash_internal(grpc_static_slice_table[i]); + grpc_slice_default_hash_internal(static_slice_table[i]); for (size_t j = 0; j < GPR_ARRAY_SIZE(static_metadata_hash); j++) { size_t slot = (grpc_static_metadata_hash_values[i] + j) % GPR_ARRAY_SIZE(static_metadata_hash); @@ -336,7 +340,7 @@ void grpc_slice_intern_init(void) { } // Handle KV hash for all static mdelems. for (size_t i = 0; i < GRPC_STATIC_MDELEM_COUNT; ++i) { - grpc_static_mdelem_table[i].HashInit(); + grpc_static_mdelem_table()[i].HashInit(); } } diff --git a/src/core/lib/slice/slice_internal.h b/src/core/lib/slice/slice_internal.h index e61f57c01ab..49ad15d5a56 100644 --- a/src/core/lib/slice/slice_internal.h +++ b/src/core/lib/slice/slice_internal.h @@ -182,7 +182,7 @@ struct StaticSliceRefcount { index(index) {} grpc_slice_refcount base; - uint32_t index; + const uint32_t index; }; extern grpc_slice_refcount kNoopRefcount; diff --git a/src/core/lib/slice/slice_utils.h b/src/core/lib/slice/slice_utils.h index e80de6d2ece..a4e19a9a61b 100644 --- a/src/core/lib/slice/slice_utils.h +++ b/src/core/lib/slice/slice_utils.h @@ -153,10 +153,14 @@ struct ExternallyManagedSlice : public UnmanagedMemorySlice { }; struct StaticMetadataSlice : public ManagedMemorySlice { - StaticMetadataSlice(grpc_slice_refcount* ref, size_t length, uint8_t* bytes) { + StaticMetadataSlice(grpc_slice_refcount* ref, size_t length, + const uint8_t* bytes) { refcount = ref; data.refcounted.length = length; - data.refcounted.bytes = bytes; + // NB: grpc_slice may or may not point to a static slice, but we are + // definitely pointing to static data here. Since we are not changing + // the underlying C-type, we need a const_cast here. + data.refcounted.bytes = const_cast(bytes); } }; diff --git a/src/core/lib/surface/init.cc b/src/core/lib/surface/init.cc index 2a6d307ddab..c02b4021763 100644 --- a/src/core/lib/surface/init.cc +++ b/src/core/lib/surface/init.cc @@ -134,6 +134,7 @@ void grpc_init(void) { grpc_core::Fork::GlobalInit(); grpc_fork_handlers_auto_register(); grpc_stats_init(); + grpc_init_static_metadata_ctx(); grpc_slice_intern_init(); grpc_mdctx_global_init(); grpc_channel_init_init(); @@ -191,6 +192,8 @@ void grpc_shutdown_internal_locked(void) { grpc_core::ApplicationCallbackExecCtx::GlobalShutdown(); g_shutting_down = false; gpr_cv_broadcast(g_shutting_down_cv); + // Absolute last action will be to delete static metadata context. + grpc_destroy_static_metadata_ctx(); } void grpc_shutdown_internal(void* ignored) { diff --git a/src/core/lib/transport/metadata.cc b/src/core/lib/transport/metadata.cc index 4242923283e..76017207d47 100644 --- a/src/core/lib/transport/metadata.cc +++ b/src/core/lib/transport/metadata.cc @@ -269,9 +269,9 @@ void grpc_mdctx_global_shutdown() { #ifndef NDEBUG static int is_mdelem_static(grpc_mdelem e) { return reinterpret_cast(GRPC_MDELEM_DATA(e)) >= - &grpc_static_mdelem_table[0] && + &grpc_static_mdelem_table()[0] && reinterpret_cast(GRPC_MDELEM_DATA(e)) < - &grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; + &grpc_static_mdelem_table()[GRPC_STATIC_MDELEM_COUNT]; } #endif @@ -569,7 +569,7 @@ void* grpc_mdelem_get_user_data(grpc_mdelem md, void (*destroy_func)(void*)) { grpc_static_mdelem_user_data [reinterpret_cast( GRPC_MDELEM_DATA(md)) - - grpc_static_mdelem_table]); + grpc_static_mdelem_table()]); case GRPC_MDELEM_STORAGE_ALLOCATED: { auto* am = reinterpret_cast(GRPC_MDELEM_DATA(md)); return get_user_data(am->user_data(), destroy_func); @@ -611,7 +611,7 @@ void* grpc_mdelem_set_user_data(grpc_mdelem md, void (*destroy_func)(void*), grpc_static_mdelem_user_data [reinterpret_cast( GRPC_MDELEM_DATA(md)) - - grpc_static_mdelem_table]); + grpc_static_mdelem_table()]); case GRPC_MDELEM_STORAGE_ALLOCATED: { auto* am = reinterpret_cast(GRPC_MDELEM_DATA(md)); return set_user_data(am->user_data(), destroy_func, data); diff --git a/src/core/lib/transport/static_metadata.cc b/src/core/lib/transport/static_metadata.cc index e2e618726f1..e43c17f1ca5 100644 --- a/src/core/lib/transport/static_metadata.cc +++ b/src/core/lib/transport/static_metadata.cc @@ -30,7 +30,7 @@ #include "src/core/lib/slice/slice_internal.h" -static uint8_t g_bytes[] = { +static constexpr uint8_t g_bytes[] = { 58, 112, 97, 116, 104, 58, 109, 101, 116, 104, 111, 100, 58, 115, 116, 97, 116, 117, 115, 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 58, 115, 99, 104, 101, 109, 101, 116, 101, 103, 114, 112, 99, 45, 109, 101, @@ -125,774 +125,1055 @@ static uint8_t g_bytes[] = { 112}; grpc_slice_refcount grpc_core::StaticSliceRefcount::kStaticSubRefcount; -grpc_core::StaticSliceRefcount - grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = { - grpc_core::StaticSliceRefcount(0), - grpc_core::StaticSliceRefcount(1), - grpc_core::StaticSliceRefcount(2), - grpc_core::StaticSliceRefcount(3), - grpc_core::StaticSliceRefcount(4), - grpc_core::StaticSliceRefcount(5), - grpc_core::StaticSliceRefcount(6), - grpc_core::StaticSliceRefcount(7), - grpc_core::StaticSliceRefcount(8), - grpc_core::StaticSliceRefcount(9), - grpc_core::StaticSliceRefcount(10), - grpc_core::StaticSliceRefcount(11), - grpc_core::StaticSliceRefcount(12), - grpc_core::StaticSliceRefcount(13), - grpc_core::StaticSliceRefcount(14), - grpc_core::StaticSliceRefcount(15), - grpc_core::StaticSliceRefcount(16), - grpc_core::StaticSliceRefcount(17), - grpc_core::StaticSliceRefcount(18), - grpc_core::StaticSliceRefcount(19), - grpc_core::StaticSliceRefcount(20), - grpc_core::StaticSliceRefcount(21), - grpc_core::StaticSliceRefcount(22), - grpc_core::StaticSliceRefcount(23), - grpc_core::StaticSliceRefcount(24), - grpc_core::StaticSliceRefcount(25), - grpc_core::StaticSliceRefcount(26), - grpc_core::StaticSliceRefcount(27), - grpc_core::StaticSliceRefcount(28), - grpc_core::StaticSliceRefcount(29), - grpc_core::StaticSliceRefcount(30), - grpc_core::StaticSliceRefcount(31), - grpc_core::StaticSliceRefcount(32), - grpc_core::StaticSliceRefcount(33), - grpc_core::StaticSliceRefcount(34), - grpc_core::StaticSliceRefcount(35), - grpc_core::StaticSliceRefcount(36), - grpc_core::StaticSliceRefcount(37), - grpc_core::StaticSliceRefcount(38), - grpc_core::StaticSliceRefcount(39), - grpc_core::StaticSliceRefcount(40), - grpc_core::StaticSliceRefcount(41), - grpc_core::StaticSliceRefcount(42), - grpc_core::StaticSliceRefcount(43), - grpc_core::StaticSliceRefcount(44), - grpc_core::StaticSliceRefcount(45), - grpc_core::StaticSliceRefcount(46), - grpc_core::StaticSliceRefcount(47), - grpc_core::StaticSliceRefcount(48), - grpc_core::StaticSliceRefcount(49), - grpc_core::StaticSliceRefcount(50), - grpc_core::StaticSliceRefcount(51), - grpc_core::StaticSliceRefcount(52), - grpc_core::StaticSliceRefcount(53), - grpc_core::StaticSliceRefcount(54), - grpc_core::StaticSliceRefcount(55), - grpc_core::StaticSliceRefcount(56), - grpc_core::StaticSliceRefcount(57), - grpc_core::StaticSliceRefcount(58), - grpc_core::StaticSliceRefcount(59), - grpc_core::StaticSliceRefcount(60), - grpc_core::StaticSliceRefcount(61), - grpc_core::StaticSliceRefcount(62), - grpc_core::StaticSliceRefcount(63), - grpc_core::StaticSliceRefcount(64), - grpc_core::StaticSliceRefcount(65), - grpc_core::StaticSliceRefcount(66), - grpc_core::StaticSliceRefcount(67), - grpc_core::StaticSliceRefcount(68), - grpc_core::StaticSliceRefcount(69), - grpc_core::StaticSliceRefcount(70), - grpc_core::StaticSliceRefcount(71), - grpc_core::StaticSliceRefcount(72), - grpc_core::StaticSliceRefcount(73), - grpc_core::StaticSliceRefcount(74), - grpc_core::StaticSliceRefcount(75), - grpc_core::StaticSliceRefcount(76), - grpc_core::StaticSliceRefcount(77), - grpc_core::StaticSliceRefcount(78), - grpc_core::StaticSliceRefcount(79), - grpc_core::StaticSliceRefcount(80), - grpc_core::StaticSliceRefcount(81), - grpc_core::StaticSliceRefcount(82), - grpc_core::StaticSliceRefcount(83), - grpc_core::StaticSliceRefcount(84), - grpc_core::StaticSliceRefcount(85), - grpc_core::StaticSliceRefcount(86), - grpc_core::StaticSliceRefcount(87), - grpc_core::StaticSliceRefcount(88), - grpc_core::StaticSliceRefcount(89), - grpc_core::StaticSliceRefcount(90), - grpc_core::StaticSliceRefcount(91), - grpc_core::StaticSliceRefcount(92), - grpc_core::StaticSliceRefcount(93), - grpc_core::StaticSliceRefcount(94), - grpc_core::StaticSliceRefcount(95), - grpc_core::StaticSliceRefcount(96), - grpc_core::StaticSliceRefcount(97), - grpc_core::StaticSliceRefcount(98), - grpc_core::StaticSliceRefcount(99), - grpc_core::StaticSliceRefcount(100), - grpc_core::StaticSliceRefcount(101), - grpc_core::StaticSliceRefcount(102), - grpc_core::StaticSliceRefcount(103), - grpc_core::StaticSliceRefcount(104), - grpc_core::StaticSliceRefcount(105), - grpc_core::StaticSliceRefcount(106), - grpc_core::StaticSliceRefcount(107), -}; -const grpc_core::StaticMetadataSlice - grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0].base, - 5, g_bytes + 0), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, - 7, g_bytes + 5), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, - 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[3].base, - 10, g_bytes + 19), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, - 7, g_bytes + 29), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[5].base, - 2, g_bytes + 36), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[6].base, - 12, g_bytes + 38), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7].base, - 11, g_bytes + 50), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[8].base, - 16, g_bytes + 61), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, - 13, g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, - 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[11].base, - 21, g_bytes + 110), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[12].base, - 13, g_bytes + 131), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[13].base, - 14, g_bytes + 144), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14].base, - 12, g_bytes + 158), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15].base, - 16, g_bytes + 170), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, - 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[17].base, - 30, g_bytes + 201), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[18].base, - 37, g_bytes + 231), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[19].base, - 10, g_bytes + 268), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[20].base, - 4, g_bytes + 278), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[21].base, - 26, g_bytes + 282), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[22].base, - 22, g_bytes + 308), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[23].base, - 12, g_bytes + 330), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[24].base, - 1, g_bytes + 342), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[25].base, - 1, g_bytes + 343), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[26].base, - 1, g_bytes + 344), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[27].base, - 1, g_bytes + 345), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[29].base, - 19, g_bytes + 346), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[30].base, - 12, g_bytes + 365), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[31].base, - 30, g_bytes + 377), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[32].base, - 31, g_bytes + 407), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[33].base, - 36, g_bytes + 438), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[34].base, - 65, g_bytes + 474), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[35].base, - 54, g_bytes + 539), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36].base, - 28, g_bytes + 593), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37].base, - 80, g_bytes + 621), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, - 7, g_bytes + 701), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, - 4, g_bytes + 708), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40].base, - 11, g_bytes + 712), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41].base, - 3, g_bytes + 723), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42].base, - 4, g_bytes + 726), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43].base, - 1, g_bytes + 730), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44].base, - 11, g_bytes + 731), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45].base, - 4, g_bytes + 742), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46].base, - 5, g_bytes + 746), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47].base, - 3, g_bytes + 751), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48].base, - 3, g_bytes + 754), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49].base, - 3, g_bytes + 757), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50].base, - 3, g_bytes + 760), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51].base, - 3, g_bytes + 763), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52].base, - 3, g_bytes + 766), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53].base, - 3, g_bytes + 769), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54].base, - 14, g_bytes + 772), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55].base, - 13, g_bytes + 786), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56].base, - 15, g_bytes + 799), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57].base, - 13, g_bytes + 814), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58].base, - 6, g_bytes + 827), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59].base, - 27, g_bytes + 833), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60].base, - 3, g_bytes + 860), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61].base, - 5, g_bytes + 863), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62].base, - 13, g_bytes + 868), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63].base, - 13, g_bytes + 881), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64].base, - 19, g_bytes + 894), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65].base, - 16, g_bytes + 913), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66].base, - 14, g_bytes + 929), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67].base, - 16, g_bytes + 943), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68].base, - 13, g_bytes + 959), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69].base, - 6, g_bytes + 972), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70].base, - 4, g_bytes + 978), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71].base, - 4, g_bytes + 982), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72].base, - 6, g_bytes + 986), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73].base, - 7, g_bytes + 992), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74].base, - 4, g_bytes + 999), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75].base, - 8, g_bytes + 1003), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76].base, - 17, g_bytes + 1011), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77].base, - 13, g_bytes + 1028), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78].base, - 8, g_bytes + 1041), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79].base, - 19, g_bytes + 1049), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80].base, - 13, g_bytes + 1068), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81].base, - 4, g_bytes + 1081), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82].base, - 8, g_bytes + 1085), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83].base, - 12, g_bytes + 1093), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84].base, - 18, g_bytes + 1105), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85].base, - 19, g_bytes + 1123), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86].base, - 5, g_bytes + 1142), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87].base, - 7, g_bytes + 1147), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88].base, - 7, g_bytes + 1154), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89].base, - 11, g_bytes + 1161), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90].base, - 6, g_bytes + 1172), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91].base, - 10, g_bytes + 1178), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92].base, - 25, g_bytes + 1188), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93].base, - 17, g_bytes + 1213), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94].base, - 4, g_bytes + 1230), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95].base, - 3, g_bytes + 1234), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, - 16, g_bytes + 1237), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, - 1, g_bytes + 1253), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, - 8, g_bytes + 1254), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99].base, - 8, g_bytes + 1262), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[100].base, 16, g_bytes + 1270), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[101].base, 4, g_bytes + 1286), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[102].base, 3, g_bytes + 1290), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[103].base, 11, g_bytes + 1293), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[104].base, 16, g_bytes + 1304), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[105].base, 13, g_bytes + 1320), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[106].base, 12, g_bytes + 1333), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[107].base, 21, g_bytes + 1345), -}; +namespace grpc_core { +struct StaticMetadataCtx { +#ifndef NDEBUG + const uint64_t init_canary = kGrpcStaticMetadataInitCanary; +#endif + StaticSliceRefcount refcounts[GRPC_STATIC_MDSTR_COUNT] = { + + StaticSliceRefcount(0), StaticSliceRefcount(1), + StaticSliceRefcount(2), StaticSliceRefcount(3), + StaticSliceRefcount(4), StaticSliceRefcount(5), + StaticSliceRefcount(6), StaticSliceRefcount(7), + StaticSliceRefcount(8), StaticSliceRefcount(9), + StaticSliceRefcount(10), StaticSliceRefcount(11), + StaticSliceRefcount(12), StaticSliceRefcount(13), + StaticSliceRefcount(14), StaticSliceRefcount(15), + StaticSliceRefcount(16), StaticSliceRefcount(17), + StaticSliceRefcount(18), StaticSliceRefcount(19), + StaticSliceRefcount(20), StaticSliceRefcount(21), + StaticSliceRefcount(22), StaticSliceRefcount(23), + StaticSliceRefcount(24), StaticSliceRefcount(25), + StaticSliceRefcount(26), StaticSliceRefcount(27), + StaticSliceRefcount(28), StaticSliceRefcount(29), + StaticSliceRefcount(30), StaticSliceRefcount(31), + StaticSliceRefcount(32), StaticSliceRefcount(33), + StaticSliceRefcount(34), StaticSliceRefcount(35), + StaticSliceRefcount(36), StaticSliceRefcount(37), + StaticSliceRefcount(38), StaticSliceRefcount(39), + StaticSliceRefcount(40), StaticSliceRefcount(41), + StaticSliceRefcount(42), StaticSliceRefcount(43), + StaticSliceRefcount(44), StaticSliceRefcount(45), + StaticSliceRefcount(46), StaticSliceRefcount(47), + StaticSliceRefcount(48), StaticSliceRefcount(49), + StaticSliceRefcount(50), StaticSliceRefcount(51), + StaticSliceRefcount(52), StaticSliceRefcount(53), + StaticSliceRefcount(54), StaticSliceRefcount(55), + StaticSliceRefcount(56), StaticSliceRefcount(57), + StaticSliceRefcount(58), StaticSliceRefcount(59), + StaticSliceRefcount(60), StaticSliceRefcount(61), + StaticSliceRefcount(62), StaticSliceRefcount(63), + StaticSliceRefcount(64), StaticSliceRefcount(65), + StaticSliceRefcount(66), StaticSliceRefcount(67), + StaticSliceRefcount(68), StaticSliceRefcount(69), + StaticSliceRefcount(70), StaticSliceRefcount(71), + StaticSliceRefcount(72), StaticSliceRefcount(73), + StaticSliceRefcount(74), StaticSliceRefcount(75), + StaticSliceRefcount(76), StaticSliceRefcount(77), + StaticSliceRefcount(78), StaticSliceRefcount(79), + StaticSliceRefcount(80), StaticSliceRefcount(81), + StaticSliceRefcount(82), StaticSliceRefcount(83), + StaticSliceRefcount(84), StaticSliceRefcount(85), + StaticSliceRefcount(86), StaticSliceRefcount(87), + StaticSliceRefcount(88), StaticSliceRefcount(89), + StaticSliceRefcount(90), StaticSliceRefcount(91), + StaticSliceRefcount(92), StaticSliceRefcount(93), + StaticSliceRefcount(94), StaticSliceRefcount(95), + StaticSliceRefcount(96), StaticSliceRefcount(97), + StaticSliceRefcount(98), StaticSliceRefcount(99), + StaticSliceRefcount(100), StaticSliceRefcount(101), + StaticSliceRefcount(102), StaticSliceRefcount(103), + StaticSliceRefcount(104), StaticSliceRefcount(105), + StaticSliceRefcount(106), StaticSliceRefcount(107), + }; + + const StaticMetadataSlice slices[GRPC_STATIC_MDSTR_COUNT] = { -/* Warning: the core static metadata currently operates under the soft -constraint that the first GRPC_CHTTP2_LAST_STATIC_ENTRY (61) entries must -contain metadata specified by the http2 hpack standard. The CHTTP2 transport -reads the core metadata with this assumption in mind. If the order of the core -static metadata is to be changed, then the CHTTP2 transport must be changed as -well to stop relying on the core metadata. */ + grpc_core::StaticMetadataSlice(&refcounts[0].base, 5, g_bytes + 0), + grpc_core::StaticMetadataSlice(&refcounts[1].base, 7, g_bytes + 5), + grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&refcounts[3].base, 10, g_bytes + 19), + grpc_core::StaticMetadataSlice(&refcounts[4].base, 7, g_bytes + 29), + grpc_core::StaticMetadataSlice(&refcounts[5].base, 2, g_bytes + 36), + grpc_core::StaticMetadataSlice(&refcounts[6].base, 12, g_bytes + 38), + grpc_core::StaticMetadataSlice(&refcounts[7].base, 11, g_bytes + 50), + grpc_core::StaticMetadataSlice(&refcounts[8].base, 16, g_bytes + 61), + grpc_core::StaticMetadataSlice(&refcounts[9].base, 13, g_bytes + 77), + grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), + grpc_core::StaticMetadataSlice(&refcounts[11].base, 21, g_bytes + 110), + grpc_core::StaticMetadataSlice(&refcounts[12].base, 13, g_bytes + 131), + grpc_core::StaticMetadataSlice(&refcounts[13].base, 14, g_bytes + 144), + grpc_core::StaticMetadataSlice(&refcounts[14].base, 12, g_bytes + 158), + grpc_core::StaticMetadataSlice(&refcounts[15].base, 16, g_bytes + 170), + grpc_core::StaticMetadataSlice(&refcounts[16].base, 15, g_bytes + 186), + grpc_core::StaticMetadataSlice(&refcounts[17].base, 30, g_bytes + 201), + grpc_core::StaticMetadataSlice(&refcounts[18].base, 37, g_bytes + 231), + grpc_core::StaticMetadataSlice(&refcounts[19].base, 10, g_bytes + 268), + grpc_core::StaticMetadataSlice(&refcounts[20].base, 4, g_bytes + 278), + grpc_core::StaticMetadataSlice(&refcounts[21].base, 26, g_bytes + 282), + grpc_core::StaticMetadataSlice(&refcounts[22].base, 22, g_bytes + 308), + grpc_core::StaticMetadataSlice(&refcounts[23].base, 12, g_bytes + 330), + grpc_core::StaticMetadataSlice(&refcounts[24].base, 1, g_bytes + 342), + grpc_core::StaticMetadataSlice(&refcounts[25].base, 1, g_bytes + 343), + grpc_core::StaticMetadataSlice(&refcounts[26].base, 1, g_bytes + 344), + grpc_core::StaticMetadataSlice(&refcounts[27].base, 1, g_bytes + 345), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 19, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[30].base, 12, g_bytes + 365), + grpc_core::StaticMetadataSlice(&refcounts[31].base, 30, g_bytes + 377), + grpc_core::StaticMetadataSlice(&refcounts[32].base, 31, g_bytes + 407), + grpc_core::StaticMetadataSlice(&refcounts[33].base, 36, g_bytes + 438), + grpc_core::StaticMetadataSlice(&refcounts[34].base, 65, g_bytes + 474), + grpc_core::StaticMetadataSlice(&refcounts[35].base, 54, g_bytes + 539), + grpc_core::StaticMetadataSlice(&refcounts[36].base, 28, g_bytes + 593), + grpc_core::StaticMetadataSlice(&refcounts[37].base, 80, g_bytes + 621), + grpc_core::StaticMetadataSlice(&refcounts[38].base, 7, g_bytes + 701), + grpc_core::StaticMetadataSlice(&refcounts[39].base, 4, g_bytes + 708), + grpc_core::StaticMetadataSlice(&refcounts[40].base, 11, g_bytes + 712), + grpc_core::StaticMetadataSlice(&refcounts[41].base, 3, g_bytes + 723), + grpc_core::StaticMetadataSlice(&refcounts[42].base, 4, g_bytes + 726), + grpc_core::StaticMetadataSlice(&refcounts[43].base, 1, g_bytes + 730), + grpc_core::StaticMetadataSlice(&refcounts[44].base, 11, g_bytes + 731), + grpc_core::StaticMetadataSlice(&refcounts[45].base, 4, g_bytes + 742), + grpc_core::StaticMetadataSlice(&refcounts[46].base, 5, g_bytes + 746), + grpc_core::StaticMetadataSlice(&refcounts[47].base, 3, g_bytes + 751), + grpc_core::StaticMetadataSlice(&refcounts[48].base, 3, g_bytes + 754), + grpc_core::StaticMetadataSlice(&refcounts[49].base, 3, g_bytes + 757), + grpc_core::StaticMetadataSlice(&refcounts[50].base, 3, g_bytes + 760), + grpc_core::StaticMetadataSlice(&refcounts[51].base, 3, g_bytes + 763), + grpc_core::StaticMetadataSlice(&refcounts[52].base, 3, g_bytes + 766), + grpc_core::StaticMetadataSlice(&refcounts[53].base, 3, g_bytes + 769), + grpc_core::StaticMetadataSlice(&refcounts[54].base, 14, g_bytes + 772), + grpc_core::StaticMetadataSlice(&refcounts[55].base, 13, g_bytes + 786), + grpc_core::StaticMetadataSlice(&refcounts[56].base, 15, g_bytes + 799), + grpc_core::StaticMetadataSlice(&refcounts[57].base, 13, g_bytes + 814), + grpc_core::StaticMetadataSlice(&refcounts[58].base, 6, g_bytes + 827), + grpc_core::StaticMetadataSlice(&refcounts[59].base, 27, g_bytes + 833), + grpc_core::StaticMetadataSlice(&refcounts[60].base, 3, g_bytes + 860), + grpc_core::StaticMetadataSlice(&refcounts[61].base, 5, g_bytes + 863), + grpc_core::StaticMetadataSlice(&refcounts[62].base, 13, g_bytes + 868), + grpc_core::StaticMetadataSlice(&refcounts[63].base, 13, g_bytes + 881), + grpc_core::StaticMetadataSlice(&refcounts[64].base, 19, g_bytes + 894), + grpc_core::StaticMetadataSlice(&refcounts[65].base, 16, g_bytes + 913), + grpc_core::StaticMetadataSlice(&refcounts[66].base, 14, g_bytes + 929), + grpc_core::StaticMetadataSlice(&refcounts[67].base, 16, g_bytes + 943), + grpc_core::StaticMetadataSlice(&refcounts[68].base, 13, g_bytes + 959), + grpc_core::StaticMetadataSlice(&refcounts[69].base, 6, g_bytes + 972), + grpc_core::StaticMetadataSlice(&refcounts[70].base, 4, g_bytes + 978), + grpc_core::StaticMetadataSlice(&refcounts[71].base, 4, g_bytes + 982), + grpc_core::StaticMetadataSlice(&refcounts[72].base, 6, g_bytes + 986), + grpc_core::StaticMetadataSlice(&refcounts[73].base, 7, g_bytes + 992), + grpc_core::StaticMetadataSlice(&refcounts[74].base, 4, g_bytes + 999), + grpc_core::StaticMetadataSlice(&refcounts[75].base, 8, g_bytes + 1003), + grpc_core::StaticMetadataSlice(&refcounts[76].base, 17, g_bytes + 1011), + grpc_core::StaticMetadataSlice(&refcounts[77].base, 13, g_bytes + 1028), + grpc_core::StaticMetadataSlice(&refcounts[78].base, 8, g_bytes + 1041), + grpc_core::StaticMetadataSlice(&refcounts[79].base, 19, g_bytes + 1049), + grpc_core::StaticMetadataSlice(&refcounts[80].base, 13, g_bytes + 1068), + grpc_core::StaticMetadataSlice(&refcounts[81].base, 4, g_bytes + 1081), + grpc_core::StaticMetadataSlice(&refcounts[82].base, 8, g_bytes + 1085), + grpc_core::StaticMetadataSlice(&refcounts[83].base, 12, g_bytes + 1093), + grpc_core::StaticMetadataSlice(&refcounts[84].base, 18, g_bytes + 1105), + grpc_core::StaticMetadataSlice(&refcounts[85].base, 19, g_bytes + 1123), + grpc_core::StaticMetadataSlice(&refcounts[86].base, 5, g_bytes + 1142), + grpc_core::StaticMetadataSlice(&refcounts[87].base, 7, g_bytes + 1147), + grpc_core::StaticMetadataSlice(&refcounts[88].base, 7, g_bytes + 1154), + grpc_core::StaticMetadataSlice(&refcounts[89].base, 11, g_bytes + 1161), + grpc_core::StaticMetadataSlice(&refcounts[90].base, 6, g_bytes + 1172), + grpc_core::StaticMetadataSlice(&refcounts[91].base, 10, g_bytes + 1178), + grpc_core::StaticMetadataSlice(&refcounts[92].base, 25, g_bytes + 1188), + grpc_core::StaticMetadataSlice(&refcounts[93].base, 17, g_bytes + 1213), + grpc_core::StaticMetadataSlice(&refcounts[94].base, 4, g_bytes + 1230), + grpc_core::StaticMetadataSlice(&refcounts[95].base, 3, g_bytes + 1234), + grpc_core::StaticMetadataSlice(&refcounts[96].base, 16, g_bytes + 1237), + grpc_core::StaticMetadataSlice(&refcounts[97].base, 1, g_bytes + 1253), + grpc_core::StaticMetadataSlice(&refcounts[98].base, 8, g_bytes + 1254), + grpc_core::StaticMetadataSlice(&refcounts[99].base, 8, g_bytes + 1262), + grpc_core::StaticMetadataSlice(&refcounts[100].base, 16, g_bytes + 1270), + grpc_core::StaticMetadataSlice(&refcounts[101].base, 4, g_bytes + 1286), + grpc_core::StaticMetadataSlice(&refcounts[102].base, 3, g_bytes + 1290), + grpc_core::StaticMetadataSlice(&refcounts[103].base, 11, g_bytes + 1293), + grpc_core::StaticMetadataSlice(&refcounts[104].base, 16, g_bytes + 1304), + grpc_core::StaticMetadataSlice(&refcounts[105].base, 13, g_bytes + 1320), + grpc_core::StaticMetadataSlice(&refcounts[106].base, 12, g_bytes + 1333), + grpc_core::StaticMetadataSlice(&refcounts[107].base, 21, g_bytes + 1345), + }; + StaticMetadata static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[3].base, 10, g_bytes + 19), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 0), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[1].base, 7, g_bytes + 5), + grpc_core::StaticMetadataSlice(&refcounts[41].base, 3, g_bytes + 723), + 1), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[1].base, 7, g_bytes + 5), + grpc_core::StaticMetadataSlice(&refcounts[42].base, 4, g_bytes + 726), + 2), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[0].base, 5, g_bytes + 0), + grpc_core::StaticMetadataSlice(&refcounts[43].base, 1, g_bytes + 730), + 3), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[0].base, 5, g_bytes + 0), + grpc_core::StaticMetadataSlice(&refcounts[44].base, 11, + g_bytes + 731), + 4), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[4].base, 7, g_bytes + 29), + grpc_core::StaticMetadataSlice(&refcounts[45].base, 4, g_bytes + 742), + 5), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[4].base, 7, g_bytes + 29), + grpc_core::StaticMetadataSlice(&refcounts[46].base, 5, g_bytes + 746), + 6), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&refcounts[47].base, 3, g_bytes + 751), + 7), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&refcounts[48].base, 3, g_bytes + 754), + 8), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&refcounts[49].base, 3, g_bytes + 757), + 9), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&refcounts[50].base, 3, g_bytes + 760), + 10), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&refcounts[51].base, 3, g_bytes + 763), + 11), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&refcounts[52].base, 3, g_bytes + 766), + 12), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), + grpc_core::StaticMetadataSlice(&refcounts[53].base, 3, g_bytes + 769), + 13), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[54].base, 14, + g_bytes + 772), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 14), + StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[16].base, 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&refcounts[55].base, 13, + g_bytes + 786), + 15), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[56].base, 15, + g_bytes + 799), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 16), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[57].base, 13, + g_bytes + 814), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 17), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[58].base, 6, g_bytes + 827), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 18), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[59].base, 27, + g_bytes + 833), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 19), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[60].base, 3, g_bytes + 860), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 20), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[61].base, 5, g_bytes + 863), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 21), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[62].base, 13, + g_bytes + 868), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 22), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[63].base, 13, + g_bytes + 881), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 23), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[64].base, 19, + g_bytes + 894), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 24), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[15].base, 16, + g_bytes + 170), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 25), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[65].base, 16, + g_bytes + 913), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 26), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[66].base, 14, + g_bytes + 929), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 27), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[67].base, 16, + g_bytes + 943), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 28), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[68].base, 13, + g_bytes + 959), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 29), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[14].base, 12, + g_bytes + 158), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 30), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[69].base, 6, g_bytes + 972), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 31), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[70].base, 4, g_bytes + 978), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 32), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[71].base, 4, g_bytes + 982), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 33), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[72].base, 6, g_bytes + 986), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 34), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[73].base, 7, g_bytes + 992), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 35), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[74].base, 4, g_bytes + 999), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 36), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[20].base, 4, g_bytes + 278), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 37), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[75].base, 8, + g_bytes + 1003), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 38), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[76].base, 17, + g_bytes + 1011), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 39), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[77].base, 13, + g_bytes + 1028), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 40), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[78].base, 8, + g_bytes + 1041), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 41), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[79].base, 19, + g_bytes + 1049), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 42), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[80].base, 13, + g_bytes + 1068), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 43), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[81].base, 4, + g_bytes + 1081), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 44), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[82].base, 8, + g_bytes + 1085), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 45), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[83].base, 12, + g_bytes + 1093), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 46), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[84].base, 18, + g_bytes + 1105), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 47), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[85].base, 19, + g_bytes + 1123), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 48), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[86].base, 5, + g_bytes + 1142), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 49), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[87].base, 7, + g_bytes + 1147), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 50), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[88].base, 7, + g_bytes + 1154), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 51), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[89].base, 11, + g_bytes + 1161), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 52), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[90].base, 6, + g_bytes + 1172), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 53), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[91].base, 10, + g_bytes + 1178), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 54), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[92].base, 25, + g_bytes + 1188), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 55), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[93].base, 17, + g_bytes + 1213), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 56), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[19].base, 10, + g_bytes + 268), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 57), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[94].base, 4, + g_bytes + 1230), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 58), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[95].base, 3, + g_bytes + 1234), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 59), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[96].base, 16, + g_bytes + 1237), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 60), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[7].base, 11, g_bytes + 50), + grpc_core::StaticMetadataSlice(&refcounts[97].base, 1, + g_bytes + 1253), + 61), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[7].base, 11, g_bytes + 50), + grpc_core::StaticMetadataSlice(&refcounts[24].base, 1, g_bytes + 342), + 62), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[7].base, 11, g_bytes + 50), + grpc_core::StaticMetadataSlice(&refcounts[25].base, 1, g_bytes + 343), + 63), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[9].base, 13, g_bytes + 77), + grpc_core::StaticMetadataSlice(&refcounts[98].base, 8, + g_bytes + 1254), + 64), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[9].base, 13, g_bytes + 77), + grpc_core::StaticMetadataSlice(&refcounts[39].base, 4, g_bytes + 708), + 65), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[9].base, 13, g_bytes + 77), + grpc_core::StaticMetadataSlice(&refcounts[38].base, 7, g_bytes + 701), + 66), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[5].base, 2, g_bytes + 36), + grpc_core::StaticMetadataSlice(&refcounts[99].base, 8, + g_bytes + 1262), + 67), + StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[14].base, 12, + g_bytes + 158), + grpc_core::StaticMetadataSlice(&refcounts[100].base, 16, + g_bytes + 1270), + 68), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[4].base, 7, g_bytes + 29), + grpc_core::StaticMetadataSlice(&refcounts[101].base, 4, + g_bytes + 1286), + 69), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[1].base, 7, g_bytes + 5), + grpc_core::StaticMetadataSlice(&refcounts[102].base, 3, + g_bytes + 1290), + 70), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[16].base, 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 71), + StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[15].base, 16, + g_bytes + 170), + grpc_core::StaticMetadataSlice(&refcounts[98].base, 8, + g_bytes + 1254), + 72), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[15].base, 16, + g_bytes + 170), + grpc_core::StaticMetadataSlice(&refcounts[39].base, 4, g_bytes + 708), + 73), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[103].base, 11, + g_bytes + 1293), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + 74), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), + grpc_core::StaticMetadataSlice(&refcounts[98].base, 8, + g_bytes + 1254), + 75), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), + grpc_core::StaticMetadataSlice(&refcounts[38].base, 7, g_bytes + 701), + 76), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), + grpc_core::StaticMetadataSlice(&refcounts[104].base, 16, + g_bytes + 1304), + 77), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), + grpc_core::StaticMetadataSlice(&refcounts[39].base, 4, g_bytes + 708), + 78), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), + grpc_core::StaticMetadataSlice(&refcounts[105].base, 13, + g_bytes + 1320), + 79), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), + grpc_core::StaticMetadataSlice(&refcounts[106].base, 12, + g_bytes + 1333), + 80), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), + grpc_core::StaticMetadataSlice(&refcounts[107].base, 21, + g_bytes + 1345), + 81), + StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[16].base, 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&refcounts[98].base, 8, + g_bytes + 1254), + 82), + StaticMetadata( + grpc_core::StaticMetadataSlice(&refcounts[16].base, 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&refcounts[39].base, 4, g_bytes + 708), + 83), + StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[16].base, 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&refcounts[105].base, 13, + g_bytes + 1320), + 84), + }; -grpc_mdelem grpc_static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT] = { - // clang-format off + /* Warning: the core static metadata currently operates under the soft + constraint that the first GRPC_CHTTP2_LAST_STATIC_ENTRY (61) entries must + contain metadata specified by the http2 hpack standard. The CHTTP2 transport + reads the core metadata with this assumption in mind. If the order of the core + static metadata is to be changed, then the CHTTP2 transport must be changed as + well to stop relying on the core metadata. */ + + grpc_mdelem static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT] = { + // clang-format off /* GRPC_MDELEM_AUTHORITY_EMPTY: ":authority": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[0].data(), + &static_mdelem_table[0].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_METHOD_GET: ":method": "GET" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[1].data(), + &static_mdelem_table[1].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_METHOD_POST: ":method": "POST" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[2].data(), + &static_mdelem_table[2].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_PATH_SLASH: ":path": "/" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[3].data(), + &static_mdelem_table[3].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML: ":path": "/index.html" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[4].data(), + &static_mdelem_table[4].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_SCHEME_HTTP: ":scheme": "http" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[5].data(), + &static_mdelem_table[5].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_SCHEME_HTTPS: ":scheme": "https" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[6].data(), + &static_mdelem_table[6].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_STATUS_200: ":status": "200" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[7].data(), + &static_mdelem_table[7].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_STATUS_204: ":status": "204" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[8].data(), + &static_mdelem_table[8].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_STATUS_206: ":status": "206" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[9].data(), + &static_mdelem_table[9].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_STATUS_304: ":status": "304" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[10].data(), + &static_mdelem_table[10].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_STATUS_400: ":status": "400" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[11].data(), + &static_mdelem_table[11].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_STATUS_404: ":status": "404" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[12].data(), + &static_mdelem_table[12].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_STATUS_500: ":status": "500" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[13].data(), + &static_mdelem_table[13].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_CHARSET_EMPTY: "accept-charset": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[14].data(), + &static_mdelem_table[14].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE: "accept-encoding": "gzip, deflate" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[15].data(), + &static_mdelem_table[15].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY: "accept-language": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[16].data(), + &static_mdelem_table[16].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_RANGES_EMPTY: "accept-ranges": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[17].data(), + &static_mdelem_table[17].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_EMPTY: "accept": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[18].data(), + &static_mdelem_table[18].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY: "access-control-allow-origin": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[19].data(), + &static_mdelem_table[19].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_AGE_EMPTY: "age": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[20].data(), + &static_mdelem_table[20].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ALLOW_EMPTY: "allow": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[21].data(), + &static_mdelem_table[21].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_AUTHORIZATION_EMPTY: "authorization": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[22].data(), + &static_mdelem_table[22].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_CACHE_CONTROL_EMPTY: "cache-control": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[23].data(), + &static_mdelem_table[23].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY: "content-disposition": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[24].data(), + &static_mdelem_table[24].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_CONTENT_ENCODING_EMPTY: "content-encoding": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[25].data(), + &static_mdelem_table[25].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY: "content-language": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[26].data(), + &static_mdelem_table[26].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_CONTENT_LENGTH_EMPTY: "content-length": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[27].data(), + &static_mdelem_table[27].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_CONTENT_LOCATION_EMPTY: "content-location": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[28].data(), + &static_mdelem_table[28].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_CONTENT_RANGE_EMPTY: "content-range": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[29].data(), + &static_mdelem_table[29].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_CONTENT_TYPE_EMPTY: "content-type": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[30].data(), + &static_mdelem_table[30].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_COOKIE_EMPTY: "cookie": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[31].data(), + &static_mdelem_table[31].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_DATE_EMPTY: "date": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[32].data(), + &static_mdelem_table[32].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ETAG_EMPTY: "etag": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[33].data(), + &static_mdelem_table[33].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_EXPECT_EMPTY: "expect": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[34].data(), + &static_mdelem_table[34].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_EXPIRES_EMPTY: "expires": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[35].data(), + &static_mdelem_table[35].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_FROM_EMPTY: "from": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[36].data(), + &static_mdelem_table[36].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_HOST_EMPTY: "host": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[37].data(), + &static_mdelem_table[37].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_IF_MATCH_EMPTY: "if-match": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[38].data(), + &static_mdelem_table[38].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY: "if-modified-since": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[39].data(), + &static_mdelem_table[39].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_IF_NONE_MATCH_EMPTY: "if-none-match": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[40].data(), + &static_mdelem_table[40].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_IF_RANGE_EMPTY: "if-range": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[41].data(), + &static_mdelem_table[41].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY: "if-unmodified-since": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[42].data(), + &static_mdelem_table[42].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_LAST_MODIFIED_EMPTY: "last-modified": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[43].data(), + &static_mdelem_table[43].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_LINK_EMPTY: "link": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[44].data(), + &static_mdelem_table[44].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_LOCATION_EMPTY: "location": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[45].data(), + &static_mdelem_table[45].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_MAX_FORWARDS_EMPTY: "max-forwards": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[46].data(), + &static_mdelem_table[46].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY: "proxy-authenticate": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[47].data(), + &static_mdelem_table[47].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY: "proxy-authorization": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[48].data(), + &static_mdelem_table[48].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_RANGE_EMPTY: "range": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[49].data(), + &static_mdelem_table[49].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_REFERER_EMPTY: "referer": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[50].data(), + &static_mdelem_table[50].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_REFRESH_EMPTY: "refresh": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[51].data(), + &static_mdelem_table[51].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_RETRY_AFTER_EMPTY: "retry-after": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[52].data(), + &static_mdelem_table[52].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_SERVER_EMPTY: "server": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[53].data(), + &static_mdelem_table[53].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_SET_COOKIE_EMPTY: "set-cookie": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[54].data(), + &static_mdelem_table[54].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY: "strict-transport-security": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[55].data(), + &static_mdelem_table[55].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_TRANSFER_ENCODING_EMPTY: "transfer-encoding": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[56].data(), + &static_mdelem_table[56].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_USER_AGENT_EMPTY: "user-agent": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[57].data(), + &static_mdelem_table[57].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_VARY_EMPTY: "vary": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[58].data(), + &static_mdelem_table[58].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_VIA_EMPTY: "via": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[59].data(), + &static_mdelem_table[59].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY: "www-authenticate": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[60].data(), + &static_mdelem_table[60].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_STATUS_0: "grpc-status": "0" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[61].data(), + &static_mdelem_table[61].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_STATUS_1: "grpc-status": "1" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[62].data(), + &static_mdelem_table[62].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_STATUS_2: "grpc-status": "2" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[63].data(), + &static_mdelem_table[63].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ENCODING_IDENTITY: "grpc-encoding": "identity" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[64].data(), + &static_mdelem_table[64].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ENCODING_GZIP: "grpc-encoding": "gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[65].data(), + &static_mdelem_table[65].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ENCODING_DEFLATE: "grpc-encoding": "deflate" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[66].data(), + &static_mdelem_table[66].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_TE_TRAILERS: "te": "trailers" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[67].data(), + &static_mdelem_table[67].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC: "content-type": "application/grpc" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[68].data(), + &static_mdelem_table[68].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_SCHEME_GRPC: ":scheme": "grpc" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[69].data(), + &static_mdelem_table[69].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_METHOD_PUT: ":method": "PUT" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[70].data(), + &static_mdelem_table[70].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_ENCODING_EMPTY: "accept-encoding": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[71].data(), + &static_mdelem_table[71].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_CONTENT_ENCODING_IDENTITY: "content-encoding": "identity" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[72].data(), + &static_mdelem_table[72].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_CONTENT_ENCODING_GZIP: "content-encoding": "gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[73].data(), + &static_mdelem_table[73].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_LB_COST_BIN_EMPTY: "lb-cost-bin": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[74].data(), + &static_mdelem_table[74].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY: "grpc-accept-encoding": "identity" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[75].data(), + &static_mdelem_table[75].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE: "grpc-accept-encoding": "deflate" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[76].data(), + &static_mdelem_table[76].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE: "grpc-accept-encoding": "identity,deflate" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[77].data(), + &static_mdelem_table[77].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP: "grpc-accept-encoding": "gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[78].data(), + &static_mdelem_table[78].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP: "grpc-accept-encoding": "identity,gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[79].data(), + &static_mdelem_table[79].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP: "grpc-accept-encoding": "deflate,gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[80].data(), + &static_mdelem_table[80].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP: "grpc-accept-encoding": "identity,deflate,gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[81].data(), + &static_mdelem_table[81].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY: "accept-encoding": "identity" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[82].data(), + &static_mdelem_table[82].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_ENCODING_GZIP: "accept-encoding": "gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[83].data(), + &static_mdelem_table[83].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP: "accept-encoding": "identity,gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[84].data(), + &static_mdelem_table[84].data(), GRPC_MDELEM_STORAGE_STATIC) - // clang-format on + // clang-format on + }; }; +} // namespace grpc_core + +namespace grpc_core { +static StaticMetadataCtx* g_static_metadata_slice_ctx = nullptr; +const StaticMetadataSlice* g_static_metadata_slice_table = nullptr; +StaticSliceRefcount* g_static_metadata_slice_refcounts = nullptr; +StaticMetadata* g_static_mdelem_table = nullptr; +grpc_mdelem* g_static_mdelem_manifested = nullptr; +#ifndef NDEBUG +uint64_t StaticMetadataInitCanary() { + return g_static_metadata_slice_ctx->init_canary; +} +#endif +} // namespace grpc_core + +void grpc_init_static_metadata_ctx(void) { + grpc_core::g_static_metadata_slice_ctx = + grpc_core::New(); + grpc_core::g_static_metadata_slice_table = + grpc_core::g_static_metadata_slice_ctx->slices; + grpc_core::g_static_metadata_slice_refcounts = + grpc_core::g_static_metadata_slice_ctx->refcounts; + grpc_core::g_static_mdelem_table = + grpc_core::g_static_metadata_slice_ctx->static_mdelem_table; + grpc_core::g_static_mdelem_manifested = + grpc_core::g_static_metadata_slice_ctx->static_mdelem_manifested; +} + +void grpc_destroy_static_metadata_ctx(void) { + grpc_core::Delete( + grpc_core::g_static_metadata_slice_ctx); + grpc_core::g_static_metadata_slice_ctx = nullptr; + grpc_core::g_static_metadata_slice_table = nullptr; + grpc_core::g_static_metadata_slice_refcounts = nullptr; + grpc_core::g_static_mdelem_table = nullptr; + grpc_core::g_static_mdelem_manifested = nullptr; +} + uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -946,523 +1227,12 @@ grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b) { uint32_t h = elems_phash(k); return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k && elem_idxs[h] != 255 - ? GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[elem_idxs[h]].data(), - GRPC_MDELEM_STORAGE_STATIC) + ? GRPC_MAKE_MDELEM( + &grpc_static_mdelem_table()[elem_idxs[h]].data(), + GRPC_MDELEM_STORAGE_STATIC) : GRPC_MDNULL; } -grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[3].base, - 10, g_bytes + 19), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 0), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, - 7, g_bytes + 5), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41].base, - 3, g_bytes + 723), - 1), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, - 7, g_bytes + 5), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42].base, - 4, g_bytes + 726), - 2), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0].base, - 5, g_bytes + 0), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43].base, - 1, g_bytes + 730), - 3), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0].base, - 5, g_bytes + 0), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44].base, - 11, g_bytes + 731), - 4), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, - 7, g_bytes + 29), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45].base, - 4, g_bytes + 742), - 5), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, - 7, g_bytes + 29), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46].base, - 5, g_bytes + 746), - 6), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, - 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47].base, - 3, g_bytes + 751), - 7), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, - 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48].base, - 3, g_bytes + 754), - 8), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, - 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49].base, - 3, g_bytes + 757), - 9), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, - 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50].base, - 3, g_bytes + 760), - 10), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, - 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51].base, - 3, g_bytes + 763), - 11), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, - 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52].base, - 3, g_bytes + 766), - 12), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2].base, - 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53].base, - 3, g_bytes + 769), - 13), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54].base, - 14, g_bytes + 772), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 14), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, - 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55].base, - 13, g_bytes + 786), - 15), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56].base, - 15, g_bytes + 799), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 16), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57].base, - 13, g_bytes + 814), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 17), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58].base, - 6, g_bytes + 827), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 18), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59].base, - 27, g_bytes + 833), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 19), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60].base, - 3, g_bytes + 860), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 20), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61].base, - 5, g_bytes + 863), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 21), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62].base, - 13, g_bytes + 868), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 22), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63].base, - 13, g_bytes + 881), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 23), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64].base, - 19, g_bytes + 894), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 24), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15].base, - 16, g_bytes + 170), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 25), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65].base, - 16, g_bytes + 913), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 26), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66].base, - 14, g_bytes + 929), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 27), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67].base, - 16, g_bytes + 943), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 28), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68].base, - 13, g_bytes + 959), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 29), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14].base, - 12, g_bytes + 158), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 30), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69].base, - 6, g_bytes + 972), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 31), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70].base, - 4, g_bytes + 978), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 32), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71].base, - 4, g_bytes + 982), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 33), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72].base, - 6, g_bytes + 986), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 34), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73].base, - 7, g_bytes + 992), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 35), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74].base, - 4, g_bytes + 999), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 36), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[20].base, - 4, g_bytes + 278), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 37), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75].base, - 8, g_bytes + 1003), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 38), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76].base, - 17, g_bytes + 1011), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 39), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77].base, - 13, g_bytes + 1028), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 40), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78].base, - 8, g_bytes + 1041), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 41), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79].base, - 19, g_bytes + 1049), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 42), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80].base, - 13, g_bytes + 1068), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 43), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81].base, - 4, g_bytes + 1081), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 44), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82].base, - 8, g_bytes + 1085), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 45), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83].base, - 12, g_bytes + 1093), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 46), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84].base, - 18, g_bytes + 1105), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 47), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85].base, - 19, g_bytes + 1123), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 48), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86].base, - 5, g_bytes + 1142), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 49), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87].base, - 7, g_bytes + 1147), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 50), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88].base, - 7, g_bytes + 1154), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 51), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89].base, - 11, g_bytes + 1161), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 52), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90].base, - 6, g_bytes + 1172), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 53), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91].base, - 10, g_bytes + 1178), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 54), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92].base, - 25, g_bytes + 1188), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 55), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93].base, - 17, g_bytes + 1213), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 56), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[19].base, - 10, g_bytes + 268), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 57), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94].base, - 4, g_bytes + 1230), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 58), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95].base, - 3, g_bytes + 1234), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 59), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96].base, - 16, g_bytes + 1237), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 60), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7].base, - 11, g_bytes + 50), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97].base, - 1, g_bytes + 1253), - 61), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7].base, - 11, g_bytes + 50), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[24].base, - 1, g_bytes + 342), - 62), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7].base, - 11, g_bytes + 50), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[25].base, - 1, g_bytes + 343), - 63), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, - 13, g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, - 8, g_bytes + 1254), - 64), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, - 13, g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, - 4, g_bytes + 708), - 65), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9].base, - 13, g_bytes + 77), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, - 7, g_bytes + 701), - 66), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[5].base, - 2, g_bytes + 36), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99].base, - 8, g_bytes + 1262), - 67), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14].base, - 12, g_bytes + 158), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[100].base, 16, g_bytes + 1270), - 68), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4].base, - 7, g_bytes + 29), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[101].base, 4, g_bytes + 1286), - 69), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1].base, - 7, g_bytes + 5), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[102].base, 3, g_bytes + 1290), - 70), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, - 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 71), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15].base, - 16, g_bytes + 170), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, - 8, g_bytes + 1254), - 72), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15].base, - 16, g_bytes + 170), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, - 4, g_bytes + 708), - 73), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[103].base, 11, g_bytes + 1293), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28].base, - 0, g_bytes + 346), - 74), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, - 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, - 8, g_bytes + 1254), - 75), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, - 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38].base, - 7, g_bytes + 701), - 76), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, - 20, g_bytes + 90), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[104].base, 16, g_bytes + 1304), - 77), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, - 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, - 4, g_bytes + 708), - 78), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, - 20, g_bytes + 90), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[105].base, 13, g_bytes + 1320), - 79), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, - 20, g_bytes + 90), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[106].base, 12, g_bytes + 1333), - 80), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10].base, - 20, g_bytes + 90), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[107].base, 21, g_bytes + 1345), - 81), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, - 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98].base, - 8, g_bytes + 1254), - 82), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, - 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39].base, - 4, g_bytes + 708), - 83), - grpc_core::StaticMetadata( - grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16].base, - 15, g_bytes + 186), - grpc_core::StaticMetadataSlice( - &grpc_static_metadata_refcounts[105].base, 13, g_bytes + 1320), - 84), -}; const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 75, 76, 77, 78, 79, 80, 81}; diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index 7ea000e1066..c465a2f37b7 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -37,240 +37,262 @@ static_assert( std::is_trivially_destructible::value, "grpc_core::StaticMetadataSlice must be trivially destructible."); #define GRPC_STATIC_MDSTR_COUNT 108 -extern const grpc_core::StaticMetadataSlice - grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; + +void grpc_init_static_metadata_ctx(void); +void grpc_destroy_static_metadata_ctx(void); +namespace grpc_core { +#ifndef NDEBUG +constexpr uint64_t kGrpcStaticMetadataInitCanary = 0xCAFEF00DC0FFEE11L; +uint64_t StaticMetadataInitCanary(); +#endif +extern const StaticMetadataSlice* g_static_metadata_slice_table; +} +inline const grpc_core::StaticMetadataSlice* grpc_static_slice_table() { + GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() == + grpc_core::kGrpcStaticMetadataInitCanary); + GPR_DEBUG_ASSERT(grpc_core::g_static_metadata_slice_table != nullptr); + return grpc_core::g_static_metadata_slice_table; +} + /* ":path" */ -#define GRPC_MDSTR_PATH (grpc_static_slice_table[0]) +#define GRPC_MDSTR_PATH (grpc_static_slice_table()[0]) /* ":method" */ -#define GRPC_MDSTR_METHOD (grpc_static_slice_table[1]) +#define GRPC_MDSTR_METHOD (grpc_static_slice_table()[1]) /* ":status" */ -#define GRPC_MDSTR_STATUS (grpc_static_slice_table[2]) +#define GRPC_MDSTR_STATUS (grpc_static_slice_table()[2]) /* ":authority" */ -#define GRPC_MDSTR_AUTHORITY (grpc_static_slice_table[3]) +#define GRPC_MDSTR_AUTHORITY (grpc_static_slice_table()[3]) /* ":scheme" */ -#define GRPC_MDSTR_SCHEME (grpc_static_slice_table[4]) +#define GRPC_MDSTR_SCHEME (grpc_static_slice_table()[4]) /* "te" */ -#define GRPC_MDSTR_TE (grpc_static_slice_table[5]) +#define GRPC_MDSTR_TE (grpc_static_slice_table()[5]) /* "grpc-message" */ -#define GRPC_MDSTR_GRPC_MESSAGE (grpc_static_slice_table[6]) +#define GRPC_MDSTR_GRPC_MESSAGE (grpc_static_slice_table()[6]) /* "grpc-status" */ -#define GRPC_MDSTR_GRPC_STATUS (grpc_static_slice_table[7]) +#define GRPC_MDSTR_GRPC_STATUS (grpc_static_slice_table()[7]) /* "grpc-payload-bin" */ -#define GRPC_MDSTR_GRPC_PAYLOAD_BIN (grpc_static_slice_table[8]) +#define GRPC_MDSTR_GRPC_PAYLOAD_BIN (grpc_static_slice_table()[8]) /* "grpc-encoding" */ -#define GRPC_MDSTR_GRPC_ENCODING (grpc_static_slice_table[9]) +#define GRPC_MDSTR_GRPC_ENCODING (grpc_static_slice_table()[9]) /* "grpc-accept-encoding" */ -#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (grpc_static_slice_table[10]) +#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (grpc_static_slice_table()[10]) /* "grpc-server-stats-bin" */ -#define GRPC_MDSTR_GRPC_SERVER_STATS_BIN (grpc_static_slice_table[11]) +#define GRPC_MDSTR_GRPC_SERVER_STATS_BIN (grpc_static_slice_table()[11]) /* "grpc-tags-bin" */ -#define GRPC_MDSTR_GRPC_TAGS_BIN (grpc_static_slice_table[12]) +#define GRPC_MDSTR_GRPC_TAGS_BIN (grpc_static_slice_table()[12]) /* "grpc-trace-bin" */ -#define GRPC_MDSTR_GRPC_TRACE_BIN (grpc_static_slice_table[13]) +#define GRPC_MDSTR_GRPC_TRACE_BIN (grpc_static_slice_table()[13]) /* "content-type" */ -#define GRPC_MDSTR_CONTENT_TYPE (grpc_static_slice_table[14]) +#define GRPC_MDSTR_CONTENT_TYPE (grpc_static_slice_table()[14]) /* "content-encoding" */ -#define GRPC_MDSTR_CONTENT_ENCODING (grpc_static_slice_table[15]) +#define GRPC_MDSTR_CONTENT_ENCODING (grpc_static_slice_table()[15]) /* "accept-encoding" */ -#define GRPC_MDSTR_ACCEPT_ENCODING (grpc_static_slice_table[16]) +#define GRPC_MDSTR_ACCEPT_ENCODING (grpc_static_slice_table()[16]) /* "grpc-internal-encoding-request" */ -#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST (grpc_static_slice_table[17]) +#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST \ + (grpc_static_slice_table()[17]) /* "grpc-internal-stream-encoding-request" */ #define GRPC_MDSTR_GRPC_INTERNAL_STREAM_ENCODING_REQUEST \ - (grpc_static_slice_table[18]) + (grpc_static_slice_table()[18]) /* "user-agent" */ -#define GRPC_MDSTR_USER_AGENT (grpc_static_slice_table[19]) +#define GRPC_MDSTR_USER_AGENT (grpc_static_slice_table()[19]) /* "host" */ -#define GRPC_MDSTR_HOST (grpc_static_slice_table[20]) +#define GRPC_MDSTR_HOST (grpc_static_slice_table()[20]) /* "grpc-previous-rpc-attempts" */ -#define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS (grpc_static_slice_table[21]) +#define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS (grpc_static_slice_table()[21]) /* "grpc-retry-pushback-ms" */ -#define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS (grpc_static_slice_table[22]) +#define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS (grpc_static_slice_table()[22]) /* "grpc-timeout" */ -#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table[23]) +#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table()[23]) /* "1" */ -#define GRPC_MDSTR_1 (grpc_static_slice_table[24]) +#define GRPC_MDSTR_1 (grpc_static_slice_table()[24]) /* "2" */ -#define GRPC_MDSTR_2 (grpc_static_slice_table[25]) +#define GRPC_MDSTR_2 (grpc_static_slice_table()[25]) /* "3" */ -#define GRPC_MDSTR_3 (grpc_static_slice_table[26]) +#define GRPC_MDSTR_3 (grpc_static_slice_table()[26]) /* "4" */ -#define GRPC_MDSTR_4 (grpc_static_slice_table[27]) +#define GRPC_MDSTR_4 (grpc_static_slice_table()[27]) /* "" */ -#define GRPC_MDSTR_EMPTY (grpc_static_slice_table[28]) +#define GRPC_MDSTR_EMPTY (grpc_static_slice_table()[28]) /* "grpc.wait_for_ready" */ -#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table[29]) +#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table()[29]) /* "grpc.timeout" */ -#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table[30]) +#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table()[30]) /* "grpc.max_request_message_bytes" */ #define GRPC_MDSTR_GRPC_DOT_MAX_REQUEST_MESSAGE_BYTES \ - (grpc_static_slice_table[31]) + (grpc_static_slice_table()[31]) /* "grpc.max_response_message_bytes" */ #define GRPC_MDSTR_GRPC_DOT_MAX_RESPONSE_MESSAGE_BYTES \ - (grpc_static_slice_table[32]) + (grpc_static_slice_table()[32]) /* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \ - (grpc_static_slice_table[33]) + (grpc_static_slice_table()[33]) /* "/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats" */ #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS \ - (grpc_static_slice_table[34]) + (grpc_static_slice_table()[34]) /* "/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints" */ #define GRPC_MDSTR_SLASH_ENVOY_DOT_API_DOT_V2_DOT_ENDPOINTDISCOVERYSERVICE_SLASH_STREAMENDPOINTS \ - (grpc_static_slice_table[35]) + (grpc_static_slice_table()[35]) /* "/grpc.health.v1.Health/Watch" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH \ - (grpc_static_slice_table[36]) + (grpc_static_slice_table()[36]) /* "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources" */ #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \ - (grpc_static_slice_table[37]) + (grpc_static_slice_table()[37]) /* "deflate" */ -#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[38]) +#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table()[38]) /* "gzip" */ -#define GRPC_MDSTR_GZIP (grpc_static_slice_table[39]) +#define GRPC_MDSTR_GZIP (grpc_static_slice_table()[39]) /* "stream/gzip" */ -#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[40]) +#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table()[40]) /* "GET" */ -#define GRPC_MDSTR_GET (grpc_static_slice_table[41]) +#define GRPC_MDSTR_GET (grpc_static_slice_table()[41]) /* "POST" */ -#define GRPC_MDSTR_POST (grpc_static_slice_table[42]) +#define GRPC_MDSTR_POST (grpc_static_slice_table()[42]) /* "/" */ -#define GRPC_MDSTR_SLASH (grpc_static_slice_table[43]) +#define GRPC_MDSTR_SLASH (grpc_static_slice_table()[43]) /* "/index.html" */ -#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[44]) +#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table()[44]) /* "http" */ -#define GRPC_MDSTR_HTTP (grpc_static_slice_table[45]) +#define GRPC_MDSTR_HTTP (grpc_static_slice_table()[45]) /* "https" */ -#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[46]) +#define GRPC_MDSTR_HTTPS (grpc_static_slice_table()[46]) /* "200" */ -#define GRPC_MDSTR_200 (grpc_static_slice_table[47]) +#define GRPC_MDSTR_200 (grpc_static_slice_table()[47]) /* "204" */ -#define GRPC_MDSTR_204 (grpc_static_slice_table[48]) +#define GRPC_MDSTR_204 (grpc_static_slice_table()[48]) /* "206" */ -#define GRPC_MDSTR_206 (grpc_static_slice_table[49]) +#define GRPC_MDSTR_206 (grpc_static_slice_table()[49]) /* "304" */ -#define GRPC_MDSTR_304 (grpc_static_slice_table[50]) +#define GRPC_MDSTR_304 (grpc_static_slice_table()[50]) /* "400" */ -#define GRPC_MDSTR_400 (grpc_static_slice_table[51]) +#define GRPC_MDSTR_400 (grpc_static_slice_table()[51]) /* "404" */ -#define GRPC_MDSTR_404 (grpc_static_slice_table[52]) +#define GRPC_MDSTR_404 (grpc_static_slice_table()[52]) /* "500" */ -#define GRPC_MDSTR_500 (grpc_static_slice_table[53]) +#define GRPC_MDSTR_500 (grpc_static_slice_table()[53]) /* "accept-charset" */ -#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[54]) +#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table()[54]) /* "gzip, deflate" */ -#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[55]) +#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table()[55]) /* "accept-language" */ -#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[56]) +#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table()[56]) /* "accept-ranges" */ -#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[57]) +#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table()[57]) /* "accept" */ -#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[58]) +#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table()[58]) /* "access-control-allow-origin" */ -#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[59]) +#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table()[59]) /* "age" */ -#define GRPC_MDSTR_AGE (grpc_static_slice_table[60]) +#define GRPC_MDSTR_AGE (grpc_static_slice_table()[60]) /* "allow" */ -#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[61]) +#define GRPC_MDSTR_ALLOW (grpc_static_slice_table()[61]) /* "authorization" */ -#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[62]) +#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table()[62]) /* "cache-control" */ -#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[63]) +#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table()[63]) /* "content-disposition" */ -#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[64]) +#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table()[64]) /* "content-language" */ -#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[65]) +#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table()[65]) /* "content-length" */ -#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[66]) +#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table()[66]) /* "content-location" */ -#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[67]) +#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table()[67]) /* "content-range" */ -#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[68]) +#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table()[68]) /* "cookie" */ -#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[69]) +#define GRPC_MDSTR_COOKIE (grpc_static_slice_table()[69]) /* "date" */ -#define GRPC_MDSTR_DATE (grpc_static_slice_table[70]) +#define GRPC_MDSTR_DATE (grpc_static_slice_table()[70]) /* "etag" */ -#define GRPC_MDSTR_ETAG (grpc_static_slice_table[71]) +#define GRPC_MDSTR_ETAG (grpc_static_slice_table()[71]) /* "expect" */ -#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[72]) +#define GRPC_MDSTR_EXPECT (grpc_static_slice_table()[72]) /* "expires" */ -#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[73]) +#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table()[73]) /* "from" */ -#define GRPC_MDSTR_FROM (grpc_static_slice_table[74]) +#define GRPC_MDSTR_FROM (grpc_static_slice_table()[74]) /* "if-match" */ -#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[75]) +#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table()[75]) /* "if-modified-since" */ -#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[76]) +#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table()[76]) /* "if-none-match" */ -#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[77]) +#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table()[77]) /* "if-range" */ -#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[78]) +#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table()[78]) /* "if-unmodified-since" */ -#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[79]) +#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table()[79]) /* "last-modified" */ -#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[80]) +#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table()[80]) /* "link" */ -#define GRPC_MDSTR_LINK (grpc_static_slice_table[81]) +#define GRPC_MDSTR_LINK (grpc_static_slice_table()[81]) /* "location" */ -#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[82]) +#define GRPC_MDSTR_LOCATION (grpc_static_slice_table()[82]) /* "max-forwards" */ -#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[83]) +#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table()[83]) /* "proxy-authenticate" */ -#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[84]) +#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table()[84]) /* "proxy-authorization" */ -#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[85]) +#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table()[85]) /* "range" */ -#define GRPC_MDSTR_RANGE (grpc_static_slice_table[86]) +#define GRPC_MDSTR_RANGE (grpc_static_slice_table()[86]) /* "referer" */ -#define GRPC_MDSTR_REFERER (grpc_static_slice_table[87]) +#define GRPC_MDSTR_REFERER (grpc_static_slice_table()[87]) /* "refresh" */ -#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[88]) +#define GRPC_MDSTR_REFRESH (grpc_static_slice_table()[88]) /* "retry-after" */ -#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[89]) +#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table()[89]) /* "server" */ -#define GRPC_MDSTR_SERVER (grpc_static_slice_table[90]) +#define GRPC_MDSTR_SERVER (grpc_static_slice_table()[90]) /* "set-cookie" */ -#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[91]) +#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table()[91]) /* "strict-transport-security" */ -#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[92]) +#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table()[92]) /* "transfer-encoding" */ -#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[93]) +#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table()[93]) /* "vary" */ -#define GRPC_MDSTR_VARY (grpc_static_slice_table[94]) +#define GRPC_MDSTR_VARY (grpc_static_slice_table()[94]) /* "via" */ -#define GRPC_MDSTR_VIA (grpc_static_slice_table[95]) +#define GRPC_MDSTR_VIA (grpc_static_slice_table()[95]) /* "www-authenticate" */ -#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[96]) +#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table()[96]) /* "0" */ -#define GRPC_MDSTR_0 (grpc_static_slice_table[97]) +#define GRPC_MDSTR_0 (grpc_static_slice_table()[97]) /* "identity" */ -#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[98]) +#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table()[98]) /* "trailers" */ -#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[99]) +#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table()[99]) /* "application/grpc" */ -#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[100]) +#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table()[100]) /* "grpc" */ -#define GRPC_MDSTR_GRPC (grpc_static_slice_table[101]) +#define GRPC_MDSTR_GRPC (grpc_static_slice_table()[101]) /* "PUT" */ -#define GRPC_MDSTR_PUT (grpc_static_slice_table[102]) +#define GRPC_MDSTR_PUT (grpc_static_slice_table()[102]) /* "lb-cost-bin" */ -#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[103]) +#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table()[103]) /* "identity,deflate" */ -#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[104]) +#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table()[104]) /* "identity,gzip" */ -#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[105]) +#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table()[105]) /* "deflate,gzip" */ -#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[106]) +#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table()[106]) /* "identity,deflate,gzip" */ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (grpc_static_slice_table[107]) + (grpc_static_slice_table()[107]) namespace grpc_core { struct StaticSliceRefcount; +extern StaticSliceRefcount* g_static_metadata_slice_refcounts; +} // namespace grpc_core +inline grpc_core::StaticSliceRefcount* grpc_static_metadata_refcounts() { + GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() == + grpc_core::kGrpcStaticMetadataInitCanary); + GPR_DEBUG_ASSERT(grpc_core::g_static_metadata_slice_refcounts != nullptr); + return grpc_core::g_static_metadata_slice_refcounts; } -extern grpc_core::StaticSliceRefcount - grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT]; + #define GRPC_IS_STATIC_METADATA_STRING(slice) \ ((slice).refcount != NULL && \ (slice).refcount->GetType() == grpc_slice_refcount::Type::STATIC) @@ -280,196 +302,216 @@ extern grpc_core::StaticSliceRefcount ->index) #define GRPC_STATIC_MDELEM_COUNT 85 -extern grpc_core::StaticMetadata - grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; + +namespace grpc_core { +extern StaticMetadata* g_static_mdelem_table; +extern grpc_mdelem* g_static_mdelem_manifested; +} // namespace grpc_core +inline grpc_core::StaticMetadata* grpc_static_mdelem_table() { + GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() == + grpc_core::kGrpcStaticMetadataInitCanary); + GPR_DEBUG_ASSERT(grpc_core::g_static_mdelem_table != nullptr); + return grpc_core::g_static_mdelem_table; +} +inline grpc_mdelem* grpc_static_mdelem_manifested() { + GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() == + grpc_core::kGrpcStaticMetadataInitCanary); + GPR_DEBUG_ASSERT(grpc_core::g_static_mdelem_manifested != nullptr); + return grpc_core::g_static_mdelem_manifested; +} + extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT]; -extern grpc_mdelem grpc_static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT]; /* ":authority": "" */ -#define GRPC_MDELEM_AUTHORITY_EMPTY (grpc_static_mdelem_manifested[0]) +#define GRPC_MDELEM_AUTHORITY_EMPTY (grpc_static_mdelem_manifested()[0]) /* ":method": "GET" */ -#define GRPC_MDELEM_METHOD_GET (grpc_static_mdelem_manifested[1]) +#define GRPC_MDELEM_METHOD_GET (grpc_static_mdelem_manifested()[1]) /* ":method": "POST" */ -#define GRPC_MDELEM_METHOD_POST (grpc_static_mdelem_manifested[2]) +#define GRPC_MDELEM_METHOD_POST (grpc_static_mdelem_manifested()[2]) /* ":path": "/" */ -#define GRPC_MDELEM_PATH_SLASH (grpc_static_mdelem_manifested[3]) +#define GRPC_MDELEM_PATH_SLASH (grpc_static_mdelem_manifested()[3]) /* ":path": "/index.html" */ -#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML (grpc_static_mdelem_manifested[4]) +#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML \ + (grpc_static_mdelem_manifested()[4]) /* ":scheme": "http" */ -#define GRPC_MDELEM_SCHEME_HTTP (grpc_static_mdelem_manifested[5]) +#define GRPC_MDELEM_SCHEME_HTTP (grpc_static_mdelem_manifested()[5]) /* ":scheme": "https" */ -#define GRPC_MDELEM_SCHEME_HTTPS (grpc_static_mdelem_manifested[6]) +#define GRPC_MDELEM_SCHEME_HTTPS (grpc_static_mdelem_manifested()[6]) /* ":status": "200" */ -#define GRPC_MDELEM_STATUS_200 (grpc_static_mdelem_manifested[7]) +#define GRPC_MDELEM_STATUS_200 (grpc_static_mdelem_manifested()[7]) /* ":status": "204" */ -#define GRPC_MDELEM_STATUS_204 (grpc_static_mdelem_manifested[8]) +#define GRPC_MDELEM_STATUS_204 (grpc_static_mdelem_manifested()[8]) /* ":status": "206" */ -#define GRPC_MDELEM_STATUS_206 (grpc_static_mdelem_manifested[9]) +#define GRPC_MDELEM_STATUS_206 (grpc_static_mdelem_manifested()[9]) /* ":status": "304" */ -#define GRPC_MDELEM_STATUS_304 (grpc_static_mdelem_manifested[10]) +#define GRPC_MDELEM_STATUS_304 (grpc_static_mdelem_manifested()[10]) /* ":status": "400" */ -#define GRPC_MDELEM_STATUS_400 (grpc_static_mdelem_manifested[11]) +#define GRPC_MDELEM_STATUS_400 (grpc_static_mdelem_manifested()[11]) /* ":status": "404" */ -#define GRPC_MDELEM_STATUS_404 (grpc_static_mdelem_manifested[12]) +#define GRPC_MDELEM_STATUS_404 (grpc_static_mdelem_manifested()[12]) /* ":status": "500" */ -#define GRPC_MDELEM_STATUS_500 (grpc_static_mdelem_manifested[13]) +#define GRPC_MDELEM_STATUS_500 (grpc_static_mdelem_manifested()[13]) /* "accept-charset": "" */ -#define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY (grpc_static_mdelem_manifested[14]) +#define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY (grpc_static_mdelem_manifested()[14]) /* "accept-encoding": "gzip, deflate" */ #define GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE \ - (grpc_static_mdelem_manifested[15]) + (grpc_static_mdelem_manifested()[15]) /* "accept-language": "" */ -#define GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested[16]) +#define GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested()[16]) /* "accept-ranges": "" */ -#define GRPC_MDELEM_ACCEPT_RANGES_EMPTY (grpc_static_mdelem_manifested[17]) +#define GRPC_MDELEM_ACCEPT_RANGES_EMPTY (grpc_static_mdelem_manifested()[17]) /* "accept": "" */ -#define GRPC_MDELEM_ACCEPT_EMPTY (grpc_static_mdelem_manifested[18]) +#define GRPC_MDELEM_ACCEPT_EMPTY (grpc_static_mdelem_manifested()[18]) /* "access-control-allow-origin": "" */ #define GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY \ - (grpc_static_mdelem_manifested[19]) + (grpc_static_mdelem_manifested()[19]) /* "age": "" */ -#define GRPC_MDELEM_AGE_EMPTY (grpc_static_mdelem_manifested[20]) +#define GRPC_MDELEM_AGE_EMPTY (grpc_static_mdelem_manifested()[20]) /* "allow": "" */ -#define GRPC_MDELEM_ALLOW_EMPTY (grpc_static_mdelem_manifested[21]) +#define GRPC_MDELEM_ALLOW_EMPTY (grpc_static_mdelem_manifested()[21]) /* "authorization": "" */ -#define GRPC_MDELEM_AUTHORIZATION_EMPTY (grpc_static_mdelem_manifested[22]) +#define GRPC_MDELEM_AUTHORIZATION_EMPTY (grpc_static_mdelem_manifested()[22]) /* "cache-control": "" */ -#define GRPC_MDELEM_CACHE_CONTROL_EMPTY (grpc_static_mdelem_manifested[23]) +#define GRPC_MDELEM_CACHE_CONTROL_EMPTY (grpc_static_mdelem_manifested()[23]) /* "content-disposition": "" */ #define GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY \ - (grpc_static_mdelem_manifested[24]) + (grpc_static_mdelem_manifested()[24]) /* "content-encoding": "" */ -#define GRPC_MDELEM_CONTENT_ENCODING_EMPTY (grpc_static_mdelem_manifested[25]) +#define GRPC_MDELEM_CONTENT_ENCODING_EMPTY (grpc_static_mdelem_manifested()[25]) /* "content-language": "" */ -#define GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested[26]) +#define GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested()[26]) /* "content-length": "" */ -#define GRPC_MDELEM_CONTENT_LENGTH_EMPTY (grpc_static_mdelem_manifested[27]) +#define GRPC_MDELEM_CONTENT_LENGTH_EMPTY (grpc_static_mdelem_manifested()[27]) /* "content-location": "" */ -#define GRPC_MDELEM_CONTENT_LOCATION_EMPTY (grpc_static_mdelem_manifested[28]) +#define GRPC_MDELEM_CONTENT_LOCATION_EMPTY (grpc_static_mdelem_manifested()[28]) /* "content-range": "" */ -#define GRPC_MDELEM_CONTENT_RANGE_EMPTY (grpc_static_mdelem_manifested[29]) +#define GRPC_MDELEM_CONTENT_RANGE_EMPTY (grpc_static_mdelem_manifested()[29]) /* "content-type": "" */ -#define GRPC_MDELEM_CONTENT_TYPE_EMPTY (grpc_static_mdelem_manifested[30]) +#define GRPC_MDELEM_CONTENT_TYPE_EMPTY (grpc_static_mdelem_manifested()[30]) /* "cookie": "" */ -#define GRPC_MDELEM_COOKIE_EMPTY (grpc_static_mdelem_manifested[31]) +#define GRPC_MDELEM_COOKIE_EMPTY (grpc_static_mdelem_manifested()[31]) /* "date": "" */ -#define GRPC_MDELEM_DATE_EMPTY (grpc_static_mdelem_manifested[32]) +#define GRPC_MDELEM_DATE_EMPTY (grpc_static_mdelem_manifested()[32]) /* "etag": "" */ -#define GRPC_MDELEM_ETAG_EMPTY (grpc_static_mdelem_manifested[33]) +#define GRPC_MDELEM_ETAG_EMPTY (grpc_static_mdelem_manifested()[33]) /* "expect": "" */ -#define GRPC_MDELEM_EXPECT_EMPTY (grpc_static_mdelem_manifested[34]) +#define GRPC_MDELEM_EXPECT_EMPTY (grpc_static_mdelem_manifested()[34]) /* "expires": "" */ -#define GRPC_MDELEM_EXPIRES_EMPTY (grpc_static_mdelem_manifested[35]) +#define GRPC_MDELEM_EXPIRES_EMPTY (grpc_static_mdelem_manifested()[35]) /* "from": "" */ -#define GRPC_MDELEM_FROM_EMPTY (grpc_static_mdelem_manifested[36]) +#define GRPC_MDELEM_FROM_EMPTY (grpc_static_mdelem_manifested()[36]) /* "host": "" */ -#define GRPC_MDELEM_HOST_EMPTY (grpc_static_mdelem_manifested[37]) +#define GRPC_MDELEM_HOST_EMPTY (grpc_static_mdelem_manifested()[37]) /* "if-match": "" */ -#define GRPC_MDELEM_IF_MATCH_EMPTY (grpc_static_mdelem_manifested[38]) +#define GRPC_MDELEM_IF_MATCH_EMPTY (grpc_static_mdelem_manifested()[38]) /* "if-modified-since": "" */ -#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY (grpc_static_mdelem_manifested[39]) +#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY \ + (grpc_static_mdelem_manifested()[39]) /* "if-none-match": "" */ -#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY (grpc_static_mdelem_manifested[40]) +#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY (grpc_static_mdelem_manifested()[40]) /* "if-range": "" */ -#define GRPC_MDELEM_IF_RANGE_EMPTY (grpc_static_mdelem_manifested[41]) +#define GRPC_MDELEM_IF_RANGE_EMPTY (grpc_static_mdelem_manifested()[41]) /* "if-unmodified-since": "" */ #define GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY \ - (grpc_static_mdelem_manifested[42]) + (grpc_static_mdelem_manifested()[42]) /* "last-modified": "" */ -#define GRPC_MDELEM_LAST_MODIFIED_EMPTY (grpc_static_mdelem_manifested[43]) +#define GRPC_MDELEM_LAST_MODIFIED_EMPTY (grpc_static_mdelem_manifested()[43]) /* "link": "" */ -#define GRPC_MDELEM_LINK_EMPTY (grpc_static_mdelem_manifested[44]) +#define GRPC_MDELEM_LINK_EMPTY (grpc_static_mdelem_manifested()[44]) /* "location": "" */ -#define GRPC_MDELEM_LOCATION_EMPTY (grpc_static_mdelem_manifested[45]) +#define GRPC_MDELEM_LOCATION_EMPTY (grpc_static_mdelem_manifested()[45]) /* "max-forwards": "" */ -#define GRPC_MDELEM_MAX_FORWARDS_EMPTY (grpc_static_mdelem_manifested[46]) +#define GRPC_MDELEM_MAX_FORWARDS_EMPTY (grpc_static_mdelem_manifested()[46]) /* "proxy-authenticate": "" */ -#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY (grpc_static_mdelem_manifested[47]) +#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY \ + (grpc_static_mdelem_manifested()[47]) /* "proxy-authorization": "" */ #define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY \ - (grpc_static_mdelem_manifested[48]) + (grpc_static_mdelem_manifested()[48]) /* "range": "" */ -#define GRPC_MDELEM_RANGE_EMPTY (grpc_static_mdelem_manifested[49]) +#define GRPC_MDELEM_RANGE_EMPTY (grpc_static_mdelem_manifested()[49]) /* "referer": "" */ -#define GRPC_MDELEM_REFERER_EMPTY (grpc_static_mdelem_manifested[50]) +#define GRPC_MDELEM_REFERER_EMPTY (grpc_static_mdelem_manifested()[50]) /* "refresh": "" */ -#define GRPC_MDELEM_REFRESH_EMPTY (grpc_static_mdelem_manifested[51]) +#define GRPC_MDELEM_REFRESH_EMPTY (grpc_static_mdelem_manifested()[51]) /* "retry-after": "" */ -#define GRPC_MDELEM_RETRY_AFTER_EMPTY (grpc_static_mdelem_manifested[52]) +#define GRPC_MDELEM_RETRY_AFTER_EMPTY (grpc_static_mdelem_manifested()[52]) /* "server": "" */ -#define GRPC_MDELEM_SERVER_EMPTY (grpc_static_mdelem_manifested[53]) +#define GRPC_MDELEM_SERVER_EMPTY (grpc_static_mdelem_manifested()[53]) /* "set-cookie": "" */ -#define GRPC_MDELEM_SET_COOKIE_EMPTY (grpc_static_mdelem_manifested[54]) +#define GRPC_MDELEM_SET_COOKIE_EMPTY (grpc_static_mdelem_manifested()[54]) /* "strict-transport-security": "" */ #define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \ - (grpc_static_mdelem_manifested[55]) + (grpc_static_mdelem_manifested()[55]) /* "transfer-encoding": "" */ -#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY (grpc_static_mdelem_manifested[56]) +#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY \ + (grpc_static_mdelem_manifested()[56]) /* "user-agent": "" */ -#define GRPC_MDELEM_USER_AGENT_EMPTY (grpc_static_mdelem_manifested[57]) +#define GRPC_MDELEM_USER_AGENT_EMPTY (grpc_static_mdelem_manifested()[57]) /* "vary": "" */ -#define GRPC_MDELEM_VARY_EMPTY (grpc_static_mdelem_manifested[58]) +#define GRPC_MDELEM_VARY_EMPTY (grpc_static_mdelem_manifested()[58]) /* "via": "" */ -#define GRPC_MDELEM_VIA_EMPTY (grpc_static_mdelem_manifested[59]) +#define GRPC_MDELEM_VIA_EMPTY (grpc_static_mdelem_manifested()[59]) /* "www-authenticate": "" */ -#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (grpc_static_mdelem_manifested[60]) +#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (grpc_static_mdelem_manifested()[60]) /* "grpc-status": "0" */ -#define GRPC_MDELEM_GRPC_STATUS_0 (grpc_static_mdelem_manifested[61]) +#define GRPC_MDELEM_GRPC_STATUS_0 (grpc_static_mdelem_manifested()[61]) /* "grpc-status": "1" */ -#define GRPC_MDELEM_GRPC_STATUS_1 (grpc_static_mdelem_manifested[62]) +#define GRPC_MDELEM_GRPC_STATUS_1 (grpc_static_mdelem_manifested()[62]) /* "grpc-status": "2" */ -#define GRPC_MDELEM_GRPC_STATUS_2 (grpc_static_mdelem_manifested[63]) +#define GRPC_MDELEM_GRPC_STATUS_2 (grpc_static_mdelem_manifested()[63]) /* "grpc-encoding": "identity" */ -#define GRPC_MDELEM_GRPC_ENCODING_IDENTITY (grpc_static_mdelem_manifested[64]) +#define GRPC_MDELEM_GRPC_ENCODING_IDENTITY (grpc_static_mdelem_manifested()[64]) /* "grpc-encoding": "gzip" */ -#define GRPC_MDELEM_GRPC_ENCODING_GZIP (grpc_static_mdelem_manifested[65]) +#define GRPC_MDELEM_GRPC_ENCODING_GZIP (grpc_static_mdelem_manifested()[65]) /* "grpc-encoding": "deflate" */ -#define GRPC_MDELEM_GRPC_ENCODING_DEFLATE (grpc_static_mdelem_manifested[66]) +#define GRPC_MDELEM_GRPC_ENCODING_DEFLATE (grpc_static_mdelem_manifested()[66]) /* "te": "trailers" */ -#define GRPC_MDELEM_TE_TRAILERS (grpc_static_mdelem_manifested[67]) +#define GRPC_MDELEM_TE_TRAILERS (grpc_static_mdelem_manifested()[67]) /* "content-type": "application/grpc" */ #define GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC \ - (grpc_static_mdelem_manifested[68]) + (grpc_static_mdelem_manifested()[68]) /* ":scheme": "grpc" */ -#define GRPC_MDELEM_SCHEME_GRPC (grpc_static_mdelem_manifested[69]) +#define GRPC_MDELEM_SCHEME_GRPC (grpc_static_mdelem_manifested()[69]) /* ":method": "PUT" */ -#define GRPC_MDELEM_METHOD_PUT (grpc_static_mdelem_manifested[70]) +#define GRPC_MDELEM_METHOD_PUT (grpc_static_mdelem_manifested()[70]) /* "accept-encoding": "" */ -#define GRPC_MDELEM_ACCEPT_ENCODING_EMPTY (grpc_static_mdelem_manifested[71]) +#define GRPC_MDELEM_ACCEPT_ENCODING_EMPTY (grpc_static_mdelem_manifested()[71]) /* "content-encoding": "identity" */ #define GRPC_MDELEM_CONTENT_ENCODING_IDENTITY \ - (grpc_static_mdelem_manifested[72]) + (grpc_static_mdelem_manifested()[72]) /* "content-encoding": "gzip" */ -#define GRPC_MDELEM_CONTENT_ENCODING_GZIP (grpc_static_mdelem_manifested[73]) +#define GRPC_MDELEM_CONTENT_ENCODING_GZIP (grpc_static_mdelem_manifested()[73]) /* "lb-cost-bin": "" */ -#define GRPC_MDELEM_LB_COST_BIN_EMPTY (grpc_static_mdelem_manifested[74]) +#define GRPC_MDELEM_LB_COST_BIN_EMPTY (grpc_static_mdelem_manifested()[74]) /* "grpc-accept-encoding": "identity" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \ - (grpc_static_mdelem_manifested[75]) + (grpc_static_mdelem_manifested()[75]) /* "grpc-accept-encoding": "deflate" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \ - (grpc_static_mdelem_manifested[76]) + (grpc_static_mdelem_manifested()[76]) /* "grpc-accept-encoding": "identity,deflate" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE \ - (grpc_static_mdelem_manifested[77]) + (grpc_static_mdelem_manifested()[77]) /* "grpc-accept-encoding": "gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \ - (grpc_static_mdelem_manifested[78]) + (grpc_static_mdelem_manifested()[78]) /* "grpc-accept-encoding": "identity,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \ - (grpc_static_mdelem_manifested[79]) + (grpc_static_mdelem_manifested()[79]) /* "grpc-accept-encoding": "deflate,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP \ - (grpc_static_mdelem_manifested[80]) + (grpc_static_mdelem_manifested()[80]) /* "grpc-accept-encoding": "identity,deflate,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (grpc_static_mdelem_manifested[81]) + (grpc_static_mdelem_manifested()[81]) /* "accept-encoding": "identity" */ -#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY (grpc_static_mdelem_manifested[82]) +#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY \ + (grpc_static_mdelem_manifested()[82]) /* "accept-encoding": "gzip" */ -#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP (grpc_static_mdelem_manifested[83]) +#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP (grpc_static_mdelem_manifested()[83]) /* "accept-encoding": "identity,gzip" */ #define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \ - (grpc_static_mdelem_manifested[84]) + (grpc_static_mdelem_manifested()[84]) grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b); typedef enum { @@ -539,15 +581,15 @@ typedef union { : GRPC_BATCH_CALLOUTS_COUNT) extern const uint8_t grpc_static_accept_encoding_metadata[8]; -#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) \ - (GRPC_MAKE_MDELEM( \ - &grpc_static_mdelem_table[grpc_static_accept_encoding_metadata[(algs)]] \ - .data(), \ - GRPC_MDELEM_STORAGE_STATIC)) +#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) \ + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table() \ + [grpc_static_accept_encoding_metadata[(algs)]] \ + .data(), \ + GRPC_MDELEM_STORAGE_STATIC)) extern const uint8_t grpc_static_accept_stream_encoding_metadata[4]; #define GRPC_MDELEM_ACCEPT_STREAM_ENCODING_FOR_ALGORITHMS(algs) \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table \ + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table() \ [grpc_static_accept_stream_encoding_metadata[(algs)]] \ .data(), \ GRPC_MDELEM_STORAGE_STATIC)) diff --git a/test/core/slice/slice_test.cc b/test/core/slice/slice_test.cc index 4f824cbd5ad..fedda5f493f 100644 --- a/test/core/slice/slice_test.cc +++ b/test/core/slice/slice_test.cc @@ -265,8 +265,8 @@ static void test_static_slice_interning(void) { for (size_t i = 0; i < GRPC_STATIC_MDSTR_COUNT; i++) { GPR_ASSERT(grpc_slice_is_equivalent( - grpc_static_slice_table[i], - grpc_slice_intern(grpc_static_slice_table[i]))); + grpc_static_slice_table()[i], + grpc_slice_intern(grpc_static_slice_table()[i]))); } } @@ -276,9 +276,9 @@ static void test_static_slice_copy_interning(void) { grpc_init(); for (size_t i = 0; i < GRPC_STATIC_MDSTR_COUNT; i++) { - grpc_slice copy = grpc_slice_dup(grpc_static_slice_table[i]); - GPR_ASSERT(grpc_static_slice_table[i].refcount != copy.refcount); - GPR_ASSERT(grpc_static_slice_table[i].refcount == + grpc_slice copy = grpc_slice_dup(grpc_static_slice_table()[i]); + GPR_ASSERT(grpc_static_slice_table()[i].refcount != copy.refcount); + GPR_ASSERT(grpc_static_slice_table()[i].refcount == grpc_slice_intern(copy).refcount); grpc_slice_unref(copy); } diff --git a/test/core/transport/metadata_test.cc b/test/core/transport/metadata_test.cc index e6b73de2de5..0786d78d7f9 100644 --- a/test/core/transport/metadata_test.cc +++ b/test/core/transport/metadata_test.cc @@ -373,7 +373,7 @@ static void test_copied_static_metadata(bool dup_key, bool dup_value) { grpc_core::ExecCtx exec_ctx; for (size_t i = 0; i < GRPC_STATIC_MDELEM_COUNT; i++) { - grpc_mdelem p = GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[i], + grpc_mdelem p = GRPC_MAKE_MDELEM(&grpc_static_mdelem_table()[i], GRPC_MDELEM_STORAGE_STATIC); grpc_mdelem q = grpc_mdelem_from_slices(maybe_dup(GRPC_MDKEY(p), dup_key), diff --git a/test/core/transport/status_metadata_test.cc b/test/core/transport/status_metadata_test.cc index a96f11c1ea3..d5723a4313f 100644 --- a/test/core/transport/status_metadata_test.cc +++ b/test/core/transport/status_metadata_test.cc @@ -57,5 +57,8 @@ TEST(GetStatusCodeFromMetadata, Unparseable) { int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); + grpc_init(); + int ret = RUN_ALL_TESTS(); + grpc_shutdown(); + return ret; } diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index fc1bfe99934..d79759f541c 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -393,12 +393,24 @@ for i, elem in enumerate(all_strs): str_ofs += len(elem) +def slice_def_for_ctx(i): + return ( + 'grpc_core::StaticMetadataSlice(&refcounts[%d].base, %d, g_bytes+%d)' + ) % (i, len(all_strs[i]), id2strofs[i]) + + def slice_def(i): return ( - 'grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[%d].base, %d, g_bytes+%d)' + 'grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts()[%d].base, %d, g_bytes+%d)' ) % (i, len(all_strs[i]), id2strofs[i]) +def str_idx(s): + for i, s2 in enumerate(all_strs): + if s == s2: + return i + + # validate configuration for elem in METADATA_BATCH_CALLOUTS: assert elem in all_strs @@ -408,55 +420,70 @@ static_slice_dest_assert = ( '"grpc_core::StaticMetadataSlice must be trivially destructible.");') print >> H, static_slice_dest_assert print >> H, '#define GRPC_STATIC_MDSTR_COUNT %d' % len(all_strs) -print >> H, ('extern const grpc_core::StaticMetadataSlice ' - 'grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];') +print >> H, ''' +void grpc_init_static_metadata_ctx(void); +void grpc_destroy_static_metadata_ctx(void); +namespace grpc_core { +#ifndef NDEBUG +constexpr uint64_t kGrpcStaticMetadataInitCanary = 0xCAFEF00DC0FFEE11L; +uint64_t StaticMetadataInitCanary(); +#endif +extern const StaticMetadataSlice* g_static_metadata_slice_table; +} +inline const grpc_core::StaticMetadataSlice* grpc_static_slice_table() { + GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() + == grpc_core::kGrpcStaticMetadataInitCanary); + GPR_DEBUG_ASSERT(grpc_core::g_static_metadata_slice_table != nullptr); + return grpc_core::g_static_metadata_slice_table; +} +''' for i, elem in enumerate(all_strs): print >> H, '/* "%s" */' % elem - print >> H, '#define %s (grpc_static_slice_table[%d])' % ( + print >> H, '#define %s (grpc_static_slice_table()[%d])' % ( mangle(elem).upper(), i) print >> H -print >> C, 'static uint8_t g_bytes[] = {%s};' % (','.join( +print >> C, 'static constexpr uint8_t g_bytes[] = {%s};' % (','.join( '%d' % ord(c) for c in ''.join(all_strs))) print >> C -print >> H, ('namespace grpc_core { struct StaticSliceRefcount; }') -print >> H, ('extern grpc_core::StaticSliceRefcount ' - 'grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT];') +print >> H, ''' +namespace grpc_core { +struct StaticSliceRefcount; +extern StaticSliceRefcount* g_static_metadata_slice_refcounts; +} +inline grpc_core::StaticSliceRefcount* grpc_static_metadata_refcounts() { + GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() + == grpc_core::kGrpcStaticMetadataInitCanary); + GPR_DEBUG_ASSERT(grpc_core::g_static_metadata_slice_refcounts != nullptr); + return grpc_core::g_static_metadata_slice_refcounts; +} +''' print >> C, 'grpc_slice_refcount grpc_core::StaticSliceRefcount::kStaticSubRefcount;' -print >> C, ('grpc_core::StaticSliceRefcount ' - 'grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = {') -for i, elem in enumerate(all_strs): - print >> C, ' grpc_core::StaticSliceRefcount(%d), ' % i -print >> C, '};' -print >> C -print >> H, '#define GRPC_IS_STATIC_METADATA_STRING(slice) \\' -print >> H, (' ((slice).refcount != NULL && (slice).refcount->GetType() == ' - 'grpc_slice_refcount::Type::STATIC)') -print >> H -print >> C, ( - 'const grpc_core::StaticMetadataSlice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]' - ' = {') +print >> C, ''' +namespace grpc_core { +struct StaticMetadataCtx { +#ifndef NDEBUG + const uint64_t init_canary = kGrpcStaticMetadataInitCanary; +#endif + StaticSliceRefcount + refcounts[GRPC_STATIC_MDSTR_COUNT] = { +''' for i, elem in enumerate(all_strs): - print >> C, slice_def(i) + ',' -print >> C, '};' + print >> C, ' StaticSliceRefcount(%d), ' % i +print >> C, '};' # static slice refcounts print >> C -print >> H, '#define GRPC_STATIC_METADATA_INDEX(static_slice) \\' -print >> H, '(reinterpret_cast((static_slice).refcount)->index)' -print >> H - -print >> D, '# hpack fuzzing dictionary' +print >> C, ''' + const StaticMetadataSlice + slices[GRPC_STATIC_MDSTR_COUNT] = { +''' for i, elem in enumerate(all_strs): - print >> D, '%s' % (esc_dict([len(elem)] + [ord(c) for c in elem])) -for i, elem in enumerate(all_elems): - print >> D, '%s' % (esc_dict([0, len(elem[0])] + [ord(c) for c in elem[0]] + - [len(elem[1])] + [ord(c) for c in elem[1]])) - -print >> H, '#define GRPC_STATIC_MDELEM_COUNT %d' % len(all_elems) -print >> H, ('extern grpc_core::StaticMetadata ' - 'grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];') -print >> H, ('extern uintptr_t ' - 'grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];') -print >> H, ('extern grpc_mdelem ' - 'grpc_static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT];') + print >> C, slice_def_for_ctx(i) + ',' +print >> C, '};' # static slices +print >> C, 'StaticMetadata static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {' +for idx, (a, b) in enumerate(all_elems): + print >> C, 'StaticMetadata(%s,%s, %d),' % (slice_def_for_ctx(str_idx(a)), + slice_def_for_ctx(str_idx(b)), + idx) +print >> C, '};' # static_mdelem_table print >> C, (''' /* Warning: the core static metadata currently operates under the soft constraint that the first GRPC_CHTTP2_LAST_STATIC_ENTRY (61) entries must contain @@ -466,7 +493,7 @@ metadata is to be changed, then the CHTTP2 transport must be changed as well to stop relying on the core metadata. */ ''') print >> C, ('grpc_mdelem ' - 'grpc_static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT] = {') + 'static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT] = {') print >> C, '// clang-format off' static_mds = [] for i, elem in enumerate(all_elems): @@ -474,18 +501,97 @@ for i, elem in enumerate(all_elems): md_human_readable = '"%s": "%s"' % elem md_spec = ' /* %s: \n %s */\n' % (md_name, md_human_readable) md_spec += ' GRPC_MAKE_MDELEM(\n' - md_spec += ((' &grpc_static_mdelem_table[%d].data(),\n' % i) + + md_spec += ((' &static_mdelem_table[%d].data(),\n' % i) + ' GRPC_MDELEM_STORAGE_STATIC)') static_mds.append(md_spec) print >> C, ',\n'.join(static_mds) print >> C, '// clang-format on' -print >> C, ('};') +print >> C, ('};') # static_mdelem_manifested +print >> C, '};' # struct StaticMetadataCtx +print >> C, '}' # namespace grpc_core +print >> C, ''' +namespace grpc_core { +static StaticMetadataCtx* g_static_metadata_slice_ctx = nullptr; +const StaticMetadataSlice* g_static_metadata_slice_table = nullptr; +StaticSliceRefcount* g_static_metadata_slice_refcounts = nullptr; +StaticMetadata* g_static_mdelem_table = nullptr; +grpc_mdelem* g_static_mdelem_manifested = nullptr; +#ifndef NDEBUG +uint64_t StaticMetadataInitCanary() { + return g_static_metadata_slice_ctx->init_canary; +} +#endif +} + +void grpc_init_static_metadata_ctx(void) { + grpc_core::g_static_metadata_slice_ctx + = grpc_core::New(); + grpc_core::g_static_metadata_slice_table + = grpc_core::g_static_metadata_slice_ctx->slices; + grpc_core::g_static_metadata_slice_refcounts + = grpc_core::g_static_metadata_slice_ctx->refcounts; + grpc_core::g_static_mdelem_table + = grpc_core::g_static_metadata_slice_ctx->static_mdelem_table; + grpc_core::g_static_mdelem_manifested = + grpc_core::g_static_metadata_slice_ctx->static_mdelem_manifested; +} + +void grpc_destroy_static_metadata_ctx(void) { + grpc_core::Delete( + grpc_core::g_static_metadata_slice_ctx); + grpc_core::g_static_metadata_slice_ctx = nullptr; + grpc_core::g_static_metadata_slice_table = nullptr; + grpc_core::g_static_metadata_slice_refcounts = nullptr; + grpc_core::g_static_mdelem_table = nullptr; + grpc_core::g_static_mdelem_manifested = nullptr; +} + +''' + +print >> C +print >> H, '#define GRPC_IS_STATIC_METADATA_STRING(slice) \\' +print >> H, (' ((slice).refcount != NULL && (slice).refcount->GetType() == ' + 'grpc_slice_refcount::Type::STATIC)') +print >> H +print >> C +print >> H, '#define GRPC_STATIC_METADATA_INDEX(static_slice) \\' +print >> H, '(reinterpret_cast((static_slice).refcount)->index)' +print >> H + +print >> D, '# hpack fuzzing dictionary' +for i, elem in enumerate(all_strs): + print >> D, '%s' % (esc_dict([len(elem)] + [ord(c) for c in elem])) +for i, elem in enumerate(all_elems): + print >> D, '%s' % (esc_dict([0, len(elem[0])] + [ord(c) for c in elem[0]] + + [len(elem[1])] + [ord(c) for c in elem[1]])) + +print >> H, '#define GRPC_STATIC_MDELEM_COUNT %d' % len(all_elems) +print >> H, ''' +namespace grpc_core { +extern StaticMetadata* g_static_mdelem_table; +extern grpc_mdelem* g_static_mdelem_manifested; +} +inline grpc_core::StaticMetadata* grpc_static_mdelem_table() { + GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() + == grpc_core::kGrpcStaticMetadataInitCanary); + GPR_DEBUG_ASSERT(grpc_core::g_static_mdelem_table != nullptr); + return grpc_core::g_static_mdelem_table; +} +inline grpc_mdelem* grpc_static_mdelem_manifested() { + GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() + == grpc_core::kGrpcStaticMetadataInitCanary); + GPR_DEBUG_ASSERT(grpc_core::g_static_mdelem_manifested != nullptr); + return grpc_core::g_static_mdelem_manifested; +} +''' +print >> H, ('extern uintptr_t ' + 'grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];') for i, elem in enumerate(all_elems): md_name = mangle(elem).upper() print >> H, '/* "%s": "%s" */' % elem - print >> H, ('#define %s (grpc_static_mdelem_manifested[%d])' % (md_name, - i)) + print >> H, ('#define %s (grpc_static_mdelem_manifested()[%d])' % (md_name, + i)) print >> H print >> C, ('uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] ' @@ -496,12 +602,6 @@ print >> C, '};' print >> C -def str_idx(s): - for i, s2 in enumerate(all_strs): - if s == s2: - return i - - def md_idx(m): for i, m2 in enumerate(all_elems): if m == m2: @@ -575,16 +675,10 @@ print >> C, 'grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intpt print >> C, ' if (a == -1 || b == -1) return GRPC_MDNULL;' print >> C, ' uint32_t k = static_cast(a * %d + b);' % len(all_strs) print >> C, ' uint32_t h = elems_phash(k);' -print >> C, ' return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k && elem_idxs[h] != 255 ? GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[elem_idxs[h]].data(), GRPC_MDELEM_STORAGE_STATIC) : GRPC_MDNULL;' +print >> C, ' return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k && elem_idxs[h] != 255 ? GRPC_MAKE_MDELEM(&grpc_static_mdelem_table()[elem_idxs[h]].data(), GRPC_MDELEM_STORAGE_STATIC) : GRPC_MDNULL;' print >> C, '}' print >> C -print >> C, 'grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {' -for idx, (a, b) in enumerate(all_elems): - print >> C, 'grpc_core::StaticMetadata(%s,%s, %d),' % ( - slice_def(str_idx(a)), slice_def(str_idx(b)), idx) -print >> C, '};' - print >> H, 'typedef enum {' for elem in METADATA_BATCH_CALLOUTS: print >> H, ' %s,' % mangle(elem, 'batch').upper() @@ -629,7 +723,7 @@ print >> C, '0,%s' % ','.join('%d' % md_idx(elem) for elem in compression_elems) print >> C, '};' print >> C -print >> H, '#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[grpc_static_accept_encoding_metadata[(algs)]].data(), GRPC_MDELEM_STORAGE_STATIC))' +print >> H, '#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table()[grpc_static_accept_encoding_metadata[(algs)]].data(), GRPC_MDELEM_STORAGE_STATIC))' print >> H print >> H, 'extern const uint8_t grpc_static_accept_stream_encoding_metadata[%d];' % ( @@ -640,7 +734,7 @@ print >> C, '0,%s' % ','.join( '%d' % md_idx(elem) for elem in stream_compression_elems) print >> C, '};' -print >> H, '#define GRPC_MDELEM_ACCEPT_STREAM_ENCODING_FOR_ALGORITHMS(algs) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[grpc_static_accept_stream_encoding_metadata[(algs)]].data(), GRPC_MDELEM_STORAGE_STATIC))' +print >> H, '#define GRPC_MDELEM_ACCEPT_STREAM_ENCODING_FOR_ALGORITHMS(algs) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table()[grpc_static_accept_stream_encoding_metadata[(algs)]].data(), GRPC_MDELEM_STORAGE_STATIC))' print >> H, '#endif /* GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H */' From 426450cd82b9cc0edc7983049791904e327d49e8 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Fri, 2 Aug 2019 11:04:28 -0700 Subject: [PATCH 465/661] Implement dual testing --- BUILD | 2 +- bazel/grpc_python_deps.bzl | 9 ++ bazel/python_rules.bzl | 26 ++++++ .../grpcio_tests/tests/unit/BUILD.bazel | 4 +- third_party/py/BUILD.tpl | 49 +++++----- third_party/py/python_configure.bzl | 92 +++++++++++-------- third_party/py/remote.BUILD.tpl | 10 -- third_party/py/variety.tpl | 26 ++++++ tools/bazel.rc | 4 - 9 files changed, 142 insertions(+), 80 deletions(-) delete mode 100644 third_party/py/remote.BUILD.tpl create mode 100644 third_party/py/variety.tpl diff --git a/BUILD b/BUILD index f2a6f67f69f..74e1849629d 100644 --- a/BUILD +++ b/BUILD @@ -65,7 +65,7 @@ config_setting( config_setting( name = "python3", - values = {"python_path": "python3"}, + flag_values = {"@bazel_tools//tools/python:python_version": "PY3"}, ) config_setting( diff --git a/bazel/grpc_python_deps.bzl b/bazel/grpc_python_deps.bzl index 4e7cc1537fa..2a439bdf226 100644 --- a/bazel/grpc_python_deps.bzl +++ b/bazel/grpc_python_deps.bzl @@ -47,6 +47,15 @@ def grpc_python_deps(): remote = "https://github.com/bazelbuild/rules_python.git", ) + + if "rules_python" not in native.existing_rules(): + http_archive( + name = "rules_python", + url = "https://github.com/bazelbuild/rules_python/archive/9d68f24659e8ce8b736590ba1e4418af06ec2552.zip", + sha256 = "f7402f11691d657161f871e11968a984e5b48b023321935f5a55d7e56cf4758a", + strip_prefix = "rules_python-9d68f24659e8ce8b736590ba1e4418af06ec2552", + ) + python_configure(name = "local_config_python") native.bind( diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl index 12f51f8b172..e7e9e597b05 100644 --- a/bazel/python_rules.bzl +++ b/bazel/python_rules.bzl @@ -178,3 +178,29 @@ def py_grpc_library( deps = [Label("//src/python/grpcio/grpc:grpcio")] + deps, **kwargs ) + + +def py2and3_test(name, + py_test = native.py_test, + **kwargs): + if "python_version" in kwargs: + fail("Cannot specify 'python_version' in py2and3_test.") + + names = [name + suffix for suffix in (".python2", ".python3")] + python_versions = ["PY2", "PY3"] + for case_name, python_version in zip(names, python_versions): + py_test( + name = case_name, + python_version = python_version, + **kwargs + ) + + suite_kwargs = {} + if "visibility" in kwargs: + suite_kwargs["visibility"] = kwargs["visibility"] + + native.test_suite( + name = name, + tests = names, + **suite_kwargs + ) diff --git a/src/python/grpcio_tests/tests/unit/BUILD.bazel b/src/python/grpcio_tests/tests/unit/BUILD.bazel index 49203b7fa16..587d8cb246f 100644 --- a/src/python/grpcio_tests/tests/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/BUILD.bazel @@ -1,3 +1,5 @@ +load("//bazel:python_rules.bzl", "py2and3_test") + package(default_visibility = ["//visibility:public"]) GRPCIO_TESTS_UNIT = [ @@ -80,7 +82,7 @@ py_library( ) [ - py_test( + py2and3_test( name=test_file_name[:-3], size="small", srcs=[test_file_name], diff --git a/third_party/py/BUILD.tpl b/third_party/py/BUILD.tpl index 2283c573bc3..8f010f85a03 100644 --- a/third_party/py/BUILD.tpl +++ b/third_party/py/BUILD.tpl @@ -2,35 +2,36 @@ package(default_visibility=["//visibility:public"]) -# To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib -# See https://docs.python.org/3/extending/windows.html -cc_import( - name="python_lib", - interface_library=select({ - ":windows": ":python_import_lib", - # A placeholder for Unix platforms which makes --no_build happy. - "//conditions:default": "not-existing.lib", - }), - system_provided=1, -) - -cc_library( - name="python_headers", - hdrs=[":python_include"], - deps=select({ - ":windows": [":python_lib"], - "//conditions:default": [], - }), - includes=["python_include"], -) - config_setting( name="windows", values={"cpu": "x64_windows"}, visibility=["//visibility:public"], ) -%{PYTHON_INCLUDE_GENRULE} -%{PYTHON_IMPORT_LIB_GENRULE} +config_setting( + name="python2", + flag_values = {"@rules_python//python:python_version": "PY2"} +) + +config_setting( + name="python3", + flag_values = {"@rules_python//python:python_version": "PY3"} +) +cc_library( + name = "python_lib", + deps = select({ + ":python2": ["//_python2:_python2_lib"], + ":python3": ["//_python3:_python3_lib"], + "//conditions:default": ["not-existing.lib"], + }) +) +cc_library( + name = "python_headers", + deps = select({ + ":python2": ["//_python2:_python2_headers"], + ":python3": ["//_python3:_python3_headers"], + "//conditions:default": ["not-existing.headers"], + }) +) diff --git a/third_party/py/python_configure.bzl b/third_party/py/python_configure.bzl index e6fa5ed10e9..a2f0c7918d2 100644 --- a/third_party/py/python_configure.bzl +++ b/third_party/py/python_configure.bzl @@ -3,14 +3,15 @@ `python_configure` depends on the following environment variables: - * `PYTHON_BIN_PATH`: location of python binary. - * `PYTHON_LIB_PATH`: Location of python libraries. + * `PYTHON2_BIN_PATH`: location of python binary. + * `PYTHON2_LIB_PATH`: Location of python libraries. """ _BAZEL_SH = "BAZEL_SH" -_PYTHON_BIN_PATH = "PYTHON_BIN_PATH" -_PYTHON_LIB_PATH = "PYTHON_LIB_PATH" -_PYTHON_CONFIG_REPO = "PYTHON_CONFIG_REPO" +_PYTHON2_BIN_PATH = "PYTHON2_BIN_PATH" +_PYTHON2_LIB_PATH = "PYTHON2_LIB_PATH" +_PYTHON3_BIN_PATH = "PYTHON3_BIN_PATH" +_PYTHON3_LIB_PATH = "PYTHON3_LIB_PATH" def _tpl(repository_ctx, tpl, substitutions={}, out=None): @@ -136,9 +137,9 @@ def _symlink_genrule_for_dir(repository_ctx, "\n".join(outs)) -def _get_python_bin(repository_ctx): +def _get_python_bin(repository_ctx, bin_path_key, default_bin_path): """Gets the python bin path.""" - python_bin = repository_ctx.os.environ.get(_PYTHON_BIN_PATH, 'python') + python_bin = repository_ctx.os.environ.get(bin_path_key, default_bin_path) if not repository_ctx.path(python_bin).exists: # It's a command, use 'which' to find its path. python_bin_path = repository_ctx.which(python_bin) @@ -150,7 +151,7 @@ def _get_python_bin(repository_ctx): _fail("Cannot find python in PATH, please make sure " + "python is installed and add its directory in PATH, or --define " + "%s='/something/else'.\nPATH=%s" % - (_PYTHON_BIN_PATH, repository_ctx.os.environ.get("PATH", ""))) + (bin_path_key, repository_ctx.os.environ.get("PATH", ""))) def _get_bash_bin(repository_ctx): @@ -170,9 +171,9 @@ def _get_bash_bin(repository_ctx): (_BAZEL_SH, repository_ctx.os.environ.get("PATH", ""))) -def _get_python_lib(repository_ctx, python_bin): +def _get_python_lib(repository_ctx, python_bin, lib_path_key): """Gets the python lib path.""" - python_lib = repository_ctx.os.environ.get(_PYTHON_LIB_PATH) + python_lib = repository_ctx.os.environ.get(lib_path_key) if python_lib != None: return python_lib print_lib = ( @@ -202,13 +203,13 @@ def _check_python_lib(repository_ctx, python_lib): _fail("Invalid python library path: %s" % python_lib) -def _check_python_bin(repository_ctx, python_bin): +def _check_python_bin(repository_ctx, python_bin, bin_path_key): """Checks the python bin path.""" cmd = '[[ -x "%s" ]] && [[ ! -d "%s" ]]' % (python_bin, python_bin) result = repository_ctx.execute([_get_bash_bin(repository_ctx), "-c", cmd]) if result.return_code == 1: _fail("--define %s='%s' is not executable. Is it the python binary?" % - (_PYTHON_BIN_PATH, python_bin)) + (bin_path_key, python_bin)) def _get_python_include(repository_ctx, python_bin): @@ -222,11 +223,11 @@ def _get_python_include(repository_ctx, python_bin): error_msg="Problem getting python include path.", error_details=( "Is the Python binary path set up right? " + "(See ./configure or " - + _PYTHON_BIN_PATH + ".) " + "Is distutils installed?")) + + _PYTHON2_BIN_PATH + ".) " + "Is distutils installed?")) return result.stdout.splitlines()[0] -def _get_python_import_lib_name(repository_ctx, python_bin): +def _get_python_import_lib_name(repository_ctx, python_bin, bin_path_key): """Get Python import library name (pythonXY.lib) on Windows.""" result = _execute( repository_ctx, [ @@ -236,66 +237,77 @@ def _get_python_import_lib_name(repository_ctx, python_bin): ], error_msg="Problem getting python import library.", error_details=("Is the Python binary path set up right? " + - "(See ./configure or " + _PYTHON_BIN_PATH + ".) ")) + "(See ./configure or " + bin_path_key + ".) ")) return result.stdout.splitlines()[0] -def _create_local_python_repository(repository_ctx): +# TODO(rbellevi): Rename. +def _create_local_python_repository(repository_ctx, + variety_name, + bin_path_key, + default_bin_path, + lib_path_key): """Creates the repository containing files set up to build with Python.""" - python_bin = _get_python_bin(repository_ctx) - _check_python_bin(repository_ctx, python_bin) - python_lib = _get_python_lib(repository_ctx, python_bin) + python_bin = _get_python_bin(repository_ctx, bin_path_key, default_bin_path) + _check_python_bin(repository_ctx, python_bin, bin_path_key) + python_lib = _get_python_lib(repository_ctx, python_bin, lib_path_key) _check_python_lib(repository_ctx, python_lib) python_include = _get_python_include(repository_ctx, python_bin) python_include_rule = _symlink_genrule_for_dir( - repository_ctx, python_include, 'python_include', 'python_include') + repository_ctx, python_include, '{}_include'.format(variety_name), + '{}_include'.format(variety_name)) python_import_lib_genrule = "" # To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib # See https://docs.python.org/3/extending/windows.html if _is_windows(repository_ctx): python_include = _normalize_path(python_include) - python_import_lib_name = _get_python_import_lib_name( + python_import_lib_name = _get_python_import_lib_name, bin_path_key( repository_ctx, python_bin) python_import_lib_src = python_include.rsplit( '/', 1)[0] + "/libs/" + python_import_lib_name python_import_lib_genrule = _symlink_genrule_for_dir( - repository_ctx, None, '', 'python_import_lib', + repository_ctx, None, '', '{}_import_lib'.format(variety_name), [python_import_lib_src], [python_import_lib_name]) _tpl( - repository_ctx, "BUILD", { + repository_ctx, "variety", { "%{PYTHON_INCLUDE_GENRULE}": python_include_rule, "%{PYTHON_IMPORT_LIB_GENRULE}": python_import_lib_genrule, - }) - - -def _create_remote_python_repository(repository_ctx, remote_config_repo): - """Creates pointers to a remotely configured repo set up to build with Python. - """ - _tpl(repository_ctx, "remote.BUILD", { - "%{REMOTE_PYTHON_REPO}": remote_config_repo, - }, "BUILD") + "%{VARIETY_NAME}": variety_name, + }, + out="{}/BUILD".format(variety_name)) +# TODO(rbellevi): Remove def _python_autoconf_impl(repository_ctx): """Implementation of the python_autoconf repository rule.""" - if _PYTHON_CONFIG_REPO in repository_ctx.os.environ: - _create_remote_python_repository( - repository_ctx, repository_ctx.os.environ[_PYTHON_CONFIG_REPO]) - else: - _create_local_python_repository(repository_ctx) + _create_local_python_repository(repository_ctx, + "_python2", + _PYTHON2_BIN_PATH, + "python", + _PYTHON2_LIB_PATH) + _create_local_python_repository(repository_ctx, + "_python3", + _PYTHON3_BIN_PATH, + "python3", + _PYTHON3_LIB_PATH) + _tpl(repository_ctx, "BUILD") python_configure = repository_rule( implementation=_python_autoconf_impl, environ=[ _BAZEL_SH, - _PYTHON_BIN_PATH, - _PYTHON_LIB_PATH, - _PYTHON_CONFIG_REPO, + _PYTHON2_BIN_PATH, + _PYTHON2_LIB_PATH, + _PYTHON3_BIN_PATH, + _PYTHON3_LIB_PATH, ], ) """Detects and configures the local Python. +It is expected that the system have both a working Python 2 and python 3 +installation + Add the following to your WORKSPACE FILE: ```python diff --git a/third_party/py/remote.BUILD.tpl b/third_party/py/remote.BUILD.tpl deleted file mode 100644 index 1bfe1f0bf65..00000000000 --- a/third_party/py/remote.BUILD.tpl +++ /dev/null @@ -1,10 +0,0 @@ -# Adapted with modifications from tensorflow/third_party/py/ - -package(default_visibility=["//visibility:public"]) - -alias( - name="python_headers", - actual="%{REMOTE_PYTHON_REPO}:python_headers", -) - - diff --git a/third_party/py/variety.tpl b/third_party/py/variety.tpl new file mode 100644 index 00000000000..0c466d6d8f0 --- /dev/null +++ b/third_party/py/variety.tpl @@ -0,0 +1,26 @@ +package(default_visibility=["//visibility:public"]) + +# To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib +# See https://docs.python.org/3/extending/windows.html +cc_import( + name="%{VARIETY_NAME}_lib", + interface_library=select({ + "//:windows": ":%{VARIETY_NAME}_import_lib", + # A placeholder for Unix platforms which makes --no_build happy. + "//conditions:default": "not-existing.lib", + }), + system_provided=1, +) + +cc_library( + name="%{VARIETY_NAME}_headers", + hdrs=[":%{VARIETY_NAME}_include"], + deps=select({ + "//:windows": [":%{VARIETY_NAME}_lib"], + "//conditions:default": [], + }), + includes=["%{VARIETY_NAME}_include"], +) + +%{PYTHON_INCLUDE_GENRULE} +%{PYTHON_IMPORT_LIB_GENRULE} diff --git a/tools/bazel.rc b/tools/bazel.rc index b24f603ddda..fcbe9337b9f 100644 --- a/tools/bazel.rc +++ b/tools/bazel.rc @@ -82,7 +82,3 @@ build:basicprof --copt=-DNDEBUG build:basicprof --copt=-O2 build:basicprof --copt=-DGRPC_BASIC_PROFILER build:basicprof --copt=-DGRPC_TIMERS_RDTSC - -build:python3 --python_path=python3 -build:python3 --python_version=PY3 -build:python3 --action_env=PYTHON_BIN_PATH=python3 From b7667478cf18cfbfb907f71b31aa12e8c7f97371 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 25 Jun 2019 10:13:21 -0400 Subject: [PATCH 466/661] bump bazel version to 0.27 --- bazel/grpc_deps.bzl | 8 ++++---- templates/tools/dockerfile/bazel.include | 2 +- tools/bazel | 2 +- tools/dockerfile/test/bazel/Dockerfile | 2 +- tools/dockerfile/test/sanity/Dockerfile | 2 +- tools/remote_build/kokoro.bazelrc | 7 +++---- tools/remote_build/manual.bazelrc | 7 +++---- tools/remote_build/rbe_common.bazelrc | 2 +- 8 files changed, 15 insertions(+), 17 deletions(-) diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 06323ff3f24..57021924725 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -176,11 +176,11 @@ def grpc_deps(): if "bazel_toolchains" not in native.existing_rules(): http_archive( name = "bazel_toolchains", - sha256 = "d968b414b32aa99c86977e1171645d31da2b52ac88060de3ac1e49932d5dcbf1", - strip_prefix = "bazel-toolchains-4bd5df80d77aa7f4fb943dfdfad5c9056a62fb47", + sha256 = "872955b658113924eb1a3594b04d43238da47f4f90c17b76e8785709490dc041", + strip_prefix = "bazel-toolchains-1083686fde6032378d52b4c98044922cebde364e", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/4bd5df80d77aa7f4fb943dfdfad5c9056a62fb47.tar.gz", - "https://github.com/bazelbuild/bazel-toolchains/archive/4bd5df80d77aa7f4fb943dfdfad5c9056a62fb47.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/1083686fde6032378d52b4c98044922cebde364e.tar.gz", + "https://github.com/bazelbuild/bazel-toolchains/archive/1083686fde6032378d52b4c98044922cebde364e.tar.gz", ], ) diff --git a/templates/tools/dockerfile/bazel.include b/templates/tools/dockerfile/bazel.include index adde6ed4787..12a22785623 100644 --- a/templates/tools/dockerfile/bazel.include +++ b/templates/tools/dockerfile/bazel.include @@ -2,7 +2,7 @@ # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.26.0 +ENV BAZEL_VERSION 0.28.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/bazel b/tools/bazel index 4f08d18c656..4d1d57f60d9 100755 --- a/tools/bazel +++ b/tools/bazel @@ -32,7 +32,7 @@ then exec -a "$0" "${BAZEL_REAL}" "$@" fi -VERSION=0.26.0 +VERSION=0.28.1 echo "INFO: Running bazel wrapper (see //tools/bazel for details), bazel version $VERSION will be used instead of system-wide bazel installation." diff --git a/tools/dockerfile/test/bazel/Dockerfile b/tools/dockerfile/test/bazel/Dockerfile index 7e7903359e7..7141fb9c5f1 100644 --- a/tools/dockerfile/test/bazel/Dockerfile +++ b/tools/dockerfile/test/bazel/Dockerfile @@ -52,7 +52,7 @@ RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 t # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.26.0 +ENV BAZEL_VERSION 0.28.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile index ca786e264ed..e9c1b4bee12 100644 --- a/tools/dockerfile/test/sanity/Dockerfile +++ b/tools/dockerfile/test/sanity/Dockerfile @@ -98,7 +98,7 @@ ENV CLANG_TIDY=clang-tidy # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.26.0 +ENV BAZEL_VERSION 0.28.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/remote_build/kokoro.bazelrc b/tools/remote_build/kokoro.bazelrc index 064e94b2e15..5c1b061bce3 100644 --- a/tools/remote_build/kokoro.bazelrc +++ b/tools/remote_build/kokoro.bazelrc @@ -16,13 +16,12 @@ import %workspace%/tools/remote_build/rbe_common.bazelrc -build --remote_cache=remotebuildexecution.googleapis.com -build --remote_executor=remotebuildexecution.googleapis.com -build --tls_enabled=true +build --remote_cache=grpcs://remotebuildexecution.googleapis.com +build --remote_executor=grpcs://remotebuildexecution.googleapis.com build --auth_enabled=true -build --bes_backend=buildeventservice.googleapis.com +build --bes_backend=grpcs://buildeventservice.googleapis.com build --bes_timeout=600s build --project_id=grpc-testing diff --git a/tools/remote_build/manual.bazelrc b/tools/remote_build/manual.bazelrc index fcd41f57521..c3c6af42877 100644 --- a/tools/remote_build/manual.bazelrc +++ b/tools/remote_build/manual.bazelrc @@ -17,9 +17,8 @@ import %workspace%/tools/remote_build/rbe_common.bazelrc -build --remote_cache=remotebuildexecution.googleapis.com -build --remote_executor=remotebuildexecution.googleapis.com -build --tls_enabled=true +build --remote_cache=grpcs://remotebuildexecution.googleapis.com +build --remote_executor=grpcs://remotebuildexecution.googleapis.com # Enable authentication. This will pick up application default credentials by # default. You can use --auth_credentials=some_file.json to use a service @@ -30,7 +29,7 @@ build --auth_enabled=true # Set flags for uploading to BES in order to view results in the Bazel Build # Results UI. -build --bes_backend="buildeventservice.googleapis.com" +build --bes_backend=grpcs://buildeventservice.googleapis.com build --bes_timeout=60s build --bes_results_url="https://source.cloud.google.com/results/invocations/" build --project_id=grpc-testing diff --git a/tools/remote_build/rbe_common.bazelrc b/tools/remote_build/rbe_common.bazelrc index 6baaf24732c..6236003fe17 100644 --- a/tools/remote_build/rbe_common.bazelrc +++ b/tools/remote_build/rbe_common.bazelrc @@ -87,4 +87,4 @@ build:ubsan --test_timeout=3600 # how to update the bazel toolchain for ubsan: # - check for the latest released version in https://github.com/bazelbuild/bazel-toolchains/tree/master/configs/experimental/ubuntu16_04_clang # - you might need to update the bazel_toolchains dependency in grpc_deps.bzl -build:ubsan --crosstool_top=@bazel_toolchains//configs/experimental/ubuntu16_04_clang/1.2/bazel_0.23.0/ubsan:toolchain +build:ubsan --crosstool_top=@bazel_toolchains//configs/experimental/ubuntu16_04_clang/1.2/bazel_0.28.0/ubsan:toolchain From 27990a5541db08d8cf63c433119b9744d8007b80 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 27 Aug 2019 17:47:52 -0700 Subject: [PATCH 467/661] Explicitly add python versions to examples. --- examples/python/auth/BUILD.bazel | 3 +++ examples/python/cancellation/BUILD.bazel | 3 +++ examples/python/compression/BUILD.bazel | 3 +++ examples/python/debug/BUILD.bazel | 3 +++ examples/python/errors/BUILD.bazel | 1 + examples/python/multiprocessing/BUILD | 3 +++ examples/python/wait_for_ready/BUILD.bazel | 1 + 7 files changed, 17 insertions(+) diff --git a/examples/python/auth/BUILD.bazel b/examples/python/auth/BUILD.bazel index cc454fdfdfe..72620ee46c5 100644 --- a/examples/python/auth/BUILD.bazel +++ b/examples/python/auth/BUILD.bazel @@ -39,6 +39,7 @@ py_binary( "//examples:helloworld_py_pb2", "//examples:helloworld_py_pb2_grpc", ], + python_version = "PY3", ) py_binary( @@ -51,6 +52,7 @@ py_binary( "//examples:helloworld_py_pb2", "//examples:helloworld_py_pb2_grpc", ], + python_version = "PY3", ) py_test( @@ -63,4 +65,5 @@ py_test( ":customized_auth_server", ":_credentials", ], + python_version = "PY3", ) diff --git a/examples/python/cancellation/BUILD.bazel b/examples/python/cancellation/BUILD.bazel index 17b1b20168e..b4451f60711 100644 --- a/examples/python/cancellation/BUILD.bazel +++ b/examples/python/cancellation/BUILD.bazel @@ -45,6 +45,7 @@ py_binary( "//external:six" ], srcs_version = "PY2AND3", + python_version = "PY3", ) py_library( @@ -68,6 +69,7 @@ py_binary( "//:python3": [], }), srcs_version = "PY2AND3", + python_version = "PY3", ) py_test( @@ -78,4 +80,5 @@ py_test( ":server" ], size = "small", + python_version = "PY3", ) diff --git a/examples/python/compression/BUILD.bazel b/examples/python/compression/BUILD.bazel index 9d5f6bb83ed..4141eda2ffd 100644 --- a/examples/python/compression/BUILD.bazel +++ b/examples/python/compression/BUILD.bazel @@ -21,6 +21,7 @@ py_binary( "//examples:helloworld_py_pb2_grpc", ], srcs_version = "PY2AND3", + python_version = "PY3", ) py_binary( @@ -32,6 +33,7 @@ py_binary( "//examples:helloworld_py_pb2_grpc", ], srcs_version = "PY2AND3", + python_version = "PY3", ) py_test( @@ -43,4 +45,5 @@ py_test( ":server", ], size = "small", + python_version = "PY3", ) diff --git a/examples/python/debug/BUILD.bazel b/examples/python/debug/BUILD.bazel index 657ae860ae3..332991332f8 100644 --- a/examples/python/debug/BUILD.bazel +++ b/examples/python/debug/BUILD.bazel @@ -35,6 +35,7 @@ py_binary( "//examples:helloworld_py_pb2", "//examples:helloworld_py_pb2_grpc", ], + python_version = "PY3", ) py_binary( @@ -45,6 +46,7 @@ py_binary( "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_channelz/grpc_channelz/v1:grpc_channelz", ], + python_version = "PY3", ) py_test( @@ -59,4 +61,5 @@ py_test( ":send_message", ":get_stats", ], + python_version = "PY3", ) diff --git a/examples/python/errors/BUILD.bazel b/examples/python/errors/BUILD.bazel index 4b779ddfcf1..367bd81925f 100644 --- a/examples/python/errors/BUILD.bazel +++ b/examples/python/errors/BUILD.bazel @@ -55,4 +55,5 @@ py_test( "../../../src/python/grpcio_status", "../../../src/python/grpcio_tests", ], + python_version = "PY3", ) diff --git a/examples/python/multiprocessing/BUILD b/examples/python/multiprocessing/BUILD index 490aea0c1e6..2503970bc80 100644 --- a/examples/python/multiprocessing/BUILD +++ b/examples/python/multiprocessing/BUILD @@ -42,6 +42,7 @@ py_binary( ":prime_proto_pb2_grpc", ], srcs_version = "PY3", + python_version = "PY3", ) py_binary( @@ -57,6 +58,7 @@ py_binary( "//:python3": [], }), srcs_version = "PY3", + python_version = "PY3", ) py_test( @@ -67,4 +69,5 @@ py_test( ":server" ], size = "small", + python_version = "PY3", ) diff --git a/examples/python/wait_for_ready/BUILD.bazel b/examples/python/wait_for_ready/BUILD.bazel index f074ae7bb7f..9cbddd1a6e3 100644 --- a/examples/python/wait_for_ready/BUILD.bazel +++ b/examples/python/wait_for_ready/BUILD.bazel @@ -30,4 +30,5 @@ py_test( srcs = ["test/_wait_for_ready_example_test.py"], deps = [":wait_for_ready_example",], size = "small", + python_version = "PY3", ) From 1b69538d58f037732a4a359b878b8ae8e8d296f1 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 27 Aug 2019 17:51:45 -0700 Subject: [PATCH 468/661] Switch all tests to py2and3_test --- src/python/grpcio_tests/tests/channelz/BUILD.bazel | 4 +++- src/python/grpcio_tests/tests/health_check/BUILD.bazel | 3 ++- src/python/grpcio_tests/tests/interop/BUILD.bazel | 5 +++-- src/python/grpcio_tests/tests/reflection/BUILD.bazel | 3 ++- src/python/grpcio_tests/tests/status/BUILD.bazel | 3 ++- src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel | 3 ++- .../grpcio_tests/tests/unit/framework/foundation/BUILD.bazel | 3 ++- 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/python/grpcio_tests/tests/channelz/BUILD.bazel b/src/python/grpcio_tests/tests/channelz/BUILD.bazel index 63513616e77..f4d246847f7 100644 --- a/src/python/grpcio_tests/tests/channelz/BUILD.bazel +++ b/src/python/grpcio_tests/tests/channelz/BUILD.bazel @@ -1,6 +1,8 @@ package(default_visibility = ["//visibility:public"]) -py_test( +load("//bazel:python_rules.bzl", "py2and3_test") + +py2and3_test( name = "channelz_servicer_test", srcs = ["_channelz_servicer_test.py"], main = "_channelz_servicer_test.py", diff --git a/src/python/grpcio_tests/tests/health_check/BUILD.bazel b/src/python/grpcio_tests/tests/health_check/BUILD.bazel index 49f076be9a1..797b6a48e91 100644 --- a/src/python/grpcio_tests/tests/health_check/BUILD.bazel +++ b/src/python/grpcio_tests/tests/health_check/BUILD.bazel @@ -1,6 +1,7 @@ package(default_visibility = ["//visibility:public"]) +load("//bazel:python_rules.bzl", "py2and3_test") -py_test( +py2and3_test( name = "health_servicer_test", srcs = ["_health_servicer_test.py"], main = "_health_servicer_test.py", diff --git a/src/python/grpcio_tests/tests/interop/BUILD.bazel b/src/python/grpcio_tests/tests/interop/BUILD.bazel index 8ac3f7d52d5..4685852162b 100644 --- a/src/python/grpcio_tests/tests/interop/BUILD.bazel +++ b/src/python/grpcio_tests/tests/interop/BUILD.bazel @@ -1,4 +1,5 @@ load("@grpc_python_dependencies//:requirements.bzl", "requirement") +load("//bazel:python_rules.bzl", "py2and3_test") package(default_visibility = ["//visibility:public"]) @@ -80,7 +81,7 @@ py_library( ], ) -py_test( +py2and3_test( name = "_insecure_intraop_test", size = "small", srcs = ["_insecure_intraop_test.py"], @@ -99,7 +100,7 @@ py_test( ], ) -py_test( +py2and3_test( name = "_secure_intraop_test", size = "small", srcs = ["_secure_intraop_test.py"], diff --git a/src/python/grpcio_tests/tests/reflection/BUILD.bazel b/src/python/grpcio_tests/tests/reflection/BUILD.bazel index e9b56191df8..65a08c2a435 100644 --- a/src/python/grpcio_tests/tests/reflection/BUILD.bazel +++ b/src/python/grpcio_tests/tests/reflection/BUILD.bazel @@ -1,8 +1,9 @@ load("@grpc_python_dependencies//:requirements.bzl", "requirement") +load("//bazel:python_rules.bzl", "py2and3_test") package(default_visibility = ["//visibility:public"]) -py_test( +py2and3_test( name="_reflection_servicer_test", size="small", timeout="moderate", diff --git a/src/python/grpcio_tests/tests/status/BUILD.bazel b/src/python/grpcio_tests/tests/status/BUILD.bazel index b163fe3975e..0868de01acf 100644 --- a/src/python/grpcio_tests/tests/status/BUILD.bazel +++ b/src/python/grpcio_tests/tests/status/BUILD.bazel @@ -1,8 +1,9 @@ load("@grpc_python_dependencies//:requirements.bzl", "requirement") +load("//bazel:python_rules.bzl", "py2and3_test") package(default_visibility = ["//visibility:public"]) -py_test( +py2and3_test( name = "grpc_status_test", srcs = ["_grpc_status_test.py"], main = "_grpc_status_test.py", diff --git a/src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel b/src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel index 458a6b1fb8a..867649a6a50 100644 --- a/src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel @@ -1,4 +1,5 @@ load("@grpc_python_dependencies//:requirements.bzl", "requirement") +load("//bazel:python_rules.bzl", "py2and3_test") package(default_visibility = ["//visibility:public"]) @@ -23,7 +24,7 @@ py_library( ) [ - py_test( + py2and3_test( name=test_file_name[:-3], size="small", srcs=[test_file_name], diff --git a/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel b/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel index d69186e1fde..a93249301c4 100644 --- a/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel @@ -1,11 +1,12 @@ package(default_visibility = ["//visibility:public"]) +load("//bazel:python_rules.bzl", "py2and3_test") py_library( name = "stream_testing", srcs = ["stream_testing.py"], ) -py_test( +py2and3_test( name = "logging_pool_test", srcs = ["_logging_pool_test.py"], main = "_logging_pool_test.py", From 6dfa96524df73c5dd00ad2bf1aef1279aeb8944d Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 27 Aug 2019 17:59:39 -0700 Subject: [PATCH 469/661] Fix failing CPP test --- bazel/grpc_build_system.bzl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 23f90d0dc80..54398b66d82 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -262,13 +262,22 @@ def grpc_sh_binary(name, srcs, data = []): data = data, ) -def grpc_py_binary(name, srcs, data = [], deps = [], external_deps = [], testonly = False): +def grpc_py_binary(name, + srcs, + data = [], + deps = [], + external_deps = [], + testonly = False, + python_version = "PY2", + **kwargs): native.py_binary( name = name, srcs = srcs, testonly = testonly, data = data, deps = deps + _get_external_deps(external_deps), + python_version = python_version, + **kwargs, ) def grpc_package(name, visibility = "private", features = []): From 544ead769ddb7f2a579719953e310d088c92a376 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 27 Aug 2019 18:02:02 -0700 Subject: [PATCH 470/661] Remove explicit Python 3 testing --- tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh index f725eb7a3d7..4a48760aab1 100755 --- a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh +++ b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh @@ -26,9 +26,6 @@ ${name}') cd /var/local/git/grpc/test bazel test --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //src/python/... bazel test --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //examples/python/... -bazel clean --expunge -bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //src/python/... -bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //examples/python/... # TODO(https://github.com/grpc/grpc/issues/19854): Move this to a new Kokoro # job. From 3207e623282b07c70ad07d1c9b3fbc46d2d4c394 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 27 Aug 2019 18:07:13 -0700 Subject: [PATCH 471/661] Finish todo --- third_party/py/python_configure.bzl | 1 - 1 file changed, 1 deletion(-) diff --git a/third_party/py/python_configure.bzl b/third_party/py/python_configure.bzl index a2f0c7918d2..123f0b11865 100644 --- a/third_party/py/python_configure.bzl +++ b/third_party/py/python_configure.bzl @@ -277,7 +277,6 @@ def _create_local_python_repository(repository_ctx, out="{}/BUILD".format(variety_name)) -# TODO(rbellevi): Remove def _python_autoconf_impl(repository_ctx): """Implementation of the python_autoconf repository rule.""" _create_local_python_repository(repository_ctx, From abc384164ae9414dbd35507b0d06c62b83c798b1 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 28 Aug 2019 05:52:38 -0400 Subject: [PATCH 472/661] fix kwargs syntax error --- bazel/grpc_build_system.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 54398b66d82..c123a2e627d 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -277,7 +277,7 @@ def grpc_py_binary(name, data = data, deps = deps + _get_external_deps(external_deps), python_version = python_version, - **kwargs, + **kwargs ) def grpc_package(name, visibility = "private", features = []): From 1ee329187f9fdc6614a1ce1150f53dfc1bca79be Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 28 Aug 2019 08:34:39 -0400 Subject: [PATCH 473/661] enable compute_enging_creds and jwt_token_creds interop tests for managed dotnet client --- tools/run_tests/run_interop_tests.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index d35723c917e..066097dca59 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -208,8 +208,6 @@ class AspNetCoreLanguage: def unimplemented_test_cases(self): return _SKIP_COMPRESSION + \ - ['compute_engine_creds'] + \ - ['jwt_token_creds'] + \ _SKIP_GOOGLE_DEFAULT_CREDS + \ _SKIP_COMPUTE_ENGINE_CHANNEL_CREDS From c8430023a5c137289905e66191897ed88d7ea3e0 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 28 Aug 2019 09:05:59 -0700 Subject: [PATCH 474/661] Apply health check service name changes to existing subchannels. --- .../filters/client_channel/client_channel.cc | 90 ++++++++++++++++--- test/cpp/end2end/client_lb_end2end_test.cc | 43 ++++++++- 2 files changed, 119 insertions(+), 14 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index db5ddcb46b9..00d21987777 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -273,6 +273,12 @@ class ChannelData { bool received_first_resolver_result_ = false; // The number of SubchannelWrapper instances referencing a given Subchannel. Map subchannel_refcount_map_; + // The set of SubchannelWrappers that currently exist. + // No need to hold a ref, since the map is updated in the control-plane + // combiner when the SubchannelWrappers are created and destroyed. + // TODO(roth): We really want to use a set here, not a map. Since we don't + // currently have a set implementation, we use a map and ignore the value. + Map subchannel_wrappers_; // Pending ConnectedSubchannel updates for each SubchannelWrapper. // Updates are queued here in the control plane combiner and then applied // in the data plane combiner when the picker is updated. @@ -799,14 +805,14 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "SubchannelWrapper"); auto* subchannel_node = subchannel_->channelz_node(); if (subchannel_node != nullptr) { - intptr_t subchannel_uuid = subchannel_node->uuid(); auto it = chand_->subchannel_refcount_map_.find(subchannel_); if (it == chand_->subchannel_refcount_map_.end()) { - chand_->channelz_node_->AddChildSubchannel(subchannel_uuid); + chand_->channelz_node_->AddChildSubchannel(subchannel_node->uuid()); it = chand_->subchannel_refcount_map_.emplace(subchannel_, 0).first; } ++it->second; } + chand_->subchannel_wrappers_[this] = true; } ~SubchannelWrapper() { @@ -815,14 +821,14 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { "chand=%p: destroying subchannel wrapper %p for subchannel %p", chand_, this, subchannel_); } + chand_->subchannel_wrappers_.erase(this); auto* subchannel_node = subchannel_->channelz_node(); if (subchannel_node != nullptr) { - intptr_t subchannel_uuid = subchannel_node->uuid(); auto it = chand_->subchannel_refcount_map_.find(subchannel_); GPR_ASSERT(it != chand_->subchannel_refcount_map_.end()); --it->second; if (it->second == 0) { - chand_->channelz_node_->RemoveChildSubchannel(subchannel_uuid); + chand_->channelz_node_->RemoveChildSubchannel(subchannel_node->uuid()); chand_->subchannel_refcount_map_.erase(it); } } @@ -844,8 +850,9 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { UniquePtr watcher) override { auto& watcher_wrapper = watcher_map_[watcher.get()]; GPR_ASSERT(watcher_wrapper == nullptr); - watcher_wrapper = New( - std::move(watcher), Ref(DEBUG_LOCATION, "WatcherWrapper")); + watcher_wrapper = New(std::move(watcher), + Ref(DEBUG_LOCATION, "WatcherWrapper"), + initial_state); subchannel_->WatchConnectivityState( initial_state, UniquePtr(gpr_strdup(health_check_service_name_.get())), @@ -870,6 +877,40 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { return subchannel_->channel_args(); } + void UpdateHealthCheckServiceName(UniquePtr health_check_service_name) { + if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) { + gpr_log(GPR_INFO, + "chand=%p: subchannel wrapper %p: updating health check service " + "name from \"%s\" to \"%s\"", + chand_, this, health_check_service_name_.get(), + health_check_service_name.get()); + } + for (auto& p : watcher_map_) { + WatcherWrapper*& watcher_wrapper = p.second; + // Cancel the current watcher and create a new one using the new + // health check service name. + // TODO(roth): If there is not already an existing health watch + // call for the new name, then the watcher will initially report + // state CONNECTING. If the LB policy is currently reporting + // state READY, this may cause it to switch to CONNECTING before + // switching back to READY. This could cause a small delay for + // RPCs being started on the channel. If/when this becomes a + // problem, we may be able to handle it by waiting for the new + // watcher to report READY before we use it to replace the old one. + WatcherWrapper* replacement = watcher_wrapper->MakeReplacement(); + subchannel_->CancelConnectivityStateWatch( + health_check_service_name_.get(), watcher_wrapper); + watcher_wrapper = replacement; + subchannel_->WatchConnectivityState( + replacement->last_seen_state(), + UniquePtr(gpr_strdup(health_check_service_name.get())), + OrphanablePtr( + replacement)); + } + // Save the new health check service name. + health_check_service_name_ = std::move(health_check_service_name); + } + // Caller must be holding the control-plane combiner. ConnectedSubchannel* connected_subchannel() const { return connected_subchannel_.get(); @@ -904,8 +945,11 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { WatcherWrapper( UniquePtr watcher, - RefCountedPtr parent) - : watcher_(std::move(watcher)), parent_(std::move(parent)) {} + RefCountedPtr parent, + grpc_connectivity_state initial_state) + : watcher_(std::move(watcher)), + parent_(std::move(parent)), + last_seen_state_(initial_state) {} ~WatcherWrapper() { parent_.reset(DEBUG_LOCATION, "WatcherWrapper"); } @@ -928,9 +972,21 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { } grpc_pollset_set* interested_parties() override { - return watcher_->interested_parties(); + SubchannelInterface::ConnectivityStateWatcherInterface* watcher = + watcher_.get(); + if (watcher_ == nullptr) watcher = replacement_->watcher_.get(); + return watcher->interested_parties(); } + WatcherWrapper* MakeReplacement() { + auto* replacement = + New(std::move(watcher_), parent_, last_seen_state_); + replacement_ = replacement; + return replacement; + } + + grpc_connectivity_state last_seen_state() const { return last_seen_state_; } + private: class Updater { public: @@ -954,12 +1010,17 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { gpr_log(GPR_INFO, "chand=%p: processing connectivity change in combiner " "for subchannel wrapper %p subchannel %p " - "(connected_subchannel=%p state=%s)", + "(connected_subchannel=%p state=%s): watcher=%p", self->parent_->parent_->chand_, self->parent_->parent_.get(), self->parent_->parent_->subchannel_, self->connected_subchannel_.get(), - grpc_connectivity_state_name(self->state_)); + grpc_connectivity_state_name(self->state_), + self->parent_->watcher_.get()); } + // Ignore update if the parent WatcherWrapper has been replaced + // since this callback was scheduled. + if (self->parent_->watcher_ == nullptr) return; + self->parent_->last_seen_state_ = self->state_; self->parent_->parent_->MaybeUpdateConnectedSubchannel( std::move(self->connected_subchannel_)); self->parent_->watcher_->OnConnectivityStateChange(self->state_); @@ -974,6 +1035,8 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { UniquePtr watcher_; RefCountedPtr parent_; + grpc_connectivity_state last_seen_state_; + WatcherWrapper* replacement_ = nullptr; }; void MaybeUpdateConnectedSubchannel( @@ -1655,6 +1718,11 @@ bool ChannelData::ProcessResolverResultLocked( } else { chand->health_check_service_name_.reset(); } + // Update health check service name used by existing subchannel wrappers. + for (const auto& p : chand->subchannel_wrappers_) { + p.first->UpdateHealthCheckServiceName( + UniquePtr(gpr_strdup(chand->health_check_service_name_.get()))); + } // Save service config. chand->saved_service_config_ = std::move(service_config); } diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index ceab7506729..a0af46570d4 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -42,6 +42,7 @@ #include "src/core/ext/filters/client_channel/parse_address.h" #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" #include "src/core/ext/filters/client_channel/server_address.h" +#include "src/core/ext/filters/client_channel/service_config.h" #include "src/core/lib/backoff/backoff.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gprpp/debug_location.h" @@ -144,9 +145,11 @@ class FakeResolverResponseGeneratorWrapper { response_generator_ = std::move(other.response_generator_); } - void SetNextResolution(const std::vector& ports) { + void SetNextResolution(const std::vector& ports, + const char* service_config_json = nullptr) { grpc_core::ExecCtx exec_ctx; - response_generator_->SetResponse(BuildFakeResults(ports)); + response_generator_->SetResponse( + BuildFakeResults(ports, service_config_json)); } void SetNextResolutionUponError(const std::vector& ports) { @@ -165,7 +168,8 @@ class FakeResolverResponseGeneratorWrapper { private: static grpc_core::Resolver::Result BuildFakeResults( - const std::vector& ports) { + const std::vector& ports, + const char* service_config_json = nullptr) { grpc_core::Resolver::Result result; for (const int& port : ports) { char* lb_uri_str; @@ -179,6 +183,11 @@ class FakeResolverResponseGeneratorWrapper { grpc_uri_destroy(lb_uri); gpr_free(lb_uri_str); } + if (service_config_json != nullptr) { + result.service_config = grpc_core::ServiceConfig::Create( + service_config_json, &result.service_config_error); + GPR_ASSERT(result.service_config != nullptr); + } return result; } @@ -1465,6 +1474,34 @@ TEST_F(ClientLbEnd2endTest, RoundRobinWithHealthCheckingServiceNamePerChannel) { EnableDefaultHealthCheckService(false); } +TEST_F(ClientLbEnd2endTest, + RoundRobinWithHealthCheckingServiceNameChangesAfterSubchannelsCreated) { + EnableDefaultHealthCheckService(true); + // Start server. + const int kNumServers = 1; + StartServers(kNumServers); + // Create a channel with health-checking enabled. + const char* kServiceConfigJson = + "{\"healthCheckConfig\": " + "{\"serviceName\": \"health_check_service_name\"}}"; + auto response_generator = BuildResolverResponseGenerator(); + auto channel = BuildChannel("round_robin", response_generator); + auto stub = BuildStub(channel); + std::vector ports = GetServersPorts(); + response_generator.SetNextResolution(ports, kServiceConfigJson); + servers_[0]->SetServingStatus("health_check_service_name", true); + EXPECT_TRUE(WaitForChannelReady(channel.get(), 1 /* timeout_seconds */)); + // Send an update on the channel to change it to use a health checking + // service name that is not being reported as healthy. + const char* kServiceConfigJson2 = + "{\"healthCheckConfig\": " + "{\"serviceName\": \"health_check_service_name2\"}}"; + response_generator.SetNextResolution(ports, kServiceConfigJson2); + EXPECT_TRUE(WaitForChannelNotReady(channel.get())); + // Clean up. + EnableDefaultHealthCheckService(false); +} + TEST_F(ClientLbEnd2endTest, ChannelIdleness) { // Start server. const int kNumServers = 1; From 6dfe27ab0823a1dcac2953afdbf404095d7a3320 Mon Sep 17 00:00:00 2001 From: Hope Casey-Allen Date: Tue, 27 Aug 2019 15:09:17 -0700 Subject: [PATCH 475/661] Fix race in bm_chttp2_transport --- test/cpp/microbenchmarks/BUILD | 8 ++++ .../microbenchmarks/bm_chttp2_transport.cc | 40 +++++++++++++++++-- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD index b8e9b14d4b4..fdae8246c31 100644 --- a/test/cpp/microbenchmarks/BUILD +++ b/test/cpp/microbenchmarks/BUILD @@ -27,6 +27,14 @@ grpc_cc_test( deps = ["//test/core/util:grpc_test_util"], ) +grpc_cc_binary( + name = "bm_chttp2_transport", + testonly = 1, + srcs = ["bm_chttp2_transport.cc"], + tags = ["no_windows"], + deps = [":helpers"], +) + grpc_cc_library( name = "helpers", testonly = 1, diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index da3357304ba..dc3d76ee38e 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -239,7 +239,7 @@ class Stream { grpc_transport_destroy_stream(stream->f_->transport(), static_cast(stream->stream_), stream->destroy_closure_); - gpr_event_set(&stream->done_, (void*)1); + gpr_event_set(&stream->done_, (void*)(1)); } Fixture* f_; @@ -254,6 +254,7 @@ class Stream { //////////////////////////////////////////////////////////////////////////////// // Benchmarks // +std::vector> done_events; static void BM_StreamCreateDestroy(benchmark::State& state) { TrackCounters track_counters; @@ -380,15 +381,24 @@ static void BM_TransportEmptyOp(benchmark::State& state) { reset_op(); op.cancel_stream = true; op_payload.cancel_stream.cancel_error = GRPC_ERROR_CANCELLED; + gpr_event* stream_cancel_done = new gpr_event; + gpr_event_init(stream_cancel_done); + std::unique_ptr stream_cancel_closure = + MakeClosure([&](grpc_error* error) { + GPR_ASSERT(error == GRPC_ERROR_NONE); + gpr_event_set(stream_cancel_done, (void*)(1)); + }); + op.on_complete = stream_cancel_closure.get(); s->Op(&op); + f.FlushExecCtx(); + gpr_event_wait(stream_cancel_done, gpr_inf_future(GPR_CLOCK_REALTIME)); + done_events.emplace_back(stream_cancel_done); s->DestroyThen(MakeOnceClosure([s](grpc_error* error) { delete s; })); f.FlushExecCtx(); track_counters.Finish(state); } BENCHMARK(BM_TransportEmptyOp); -std::vector> done_events; - static void BM_TransportStreamSend(benchmark::State& state) { TrackCounters track_counters; grpc_core::ExecCtx exec_ctx; @@ -424,7 +434,7 @@ static void BM_TransportStreamSend(benchmark::State& state) { std::unique_ptr c = MakeClosure([&](grpc_error* error) { if (!state.KeepRunning()) { - gpr_event_set(bm_done, (void*)1); + gpr_event_set(bm_done, (void*)(1)); return; } grpc_slice_buffer send_buffer; @@ -455,7 +465,18 @@ static void BM_TransportStreamSend(benchmark::State& state) { reset_op(); op.cancel_stream = true; op.payload->cancel_stream.cancel_error = GRPC_ERROR_CANCELLED; + gpr_event* stream_cancel_done = new gpr_event; + gpr_event_init(stream_cancel_done); + std::unique_ptr stream_cancel_closure = + MakeClosure([&](grpc_error* error) { + GPR_ASSERT(error == GRPC_ERROR_NONE); + gpr_event_set(stream_cancel_done, (void*)(1)); + }); + op.on_complete = stream_cancel_closure.get(); s->Op(&op); + f.FlushExecCtx(); + gpr_event_wait(stream_cancel_done, gpr_inf_future(GPR_CLOCK_REALTIME)); + done_events.emplace_back(stream_cancel_done); s->DestroyThen(MakeOnceClosure([s](grpc_error* error) { delete s; })); f.FlushExecCtx(); track_counters.Finish(state); @@ -629,7 +650,18 @@ static void BM_TransportStreamRecv(benchmark::State& state) { reset_op(); op.cancel_stream = true; op.payload->cancel_stream.cancel_error = GRPC_ERROR_CANCELLED; + gpr_event* stream_cancel_done = new gpr_event; + gpr_event_init(stream_cancel_done); + std::unique_ptr stream_cancel_closure = + MakeClosure([&](grpc_error* error) { + GPR_ASSERT(error == GRPC_ERROR_NONE); + gpr_event_set(stream_cancel_done, (void*)(1)); + }); + op.on_complete = stream_cancel_closure.get(); s->Op(&op); + f.FlushExecCtx(); + gpr_event_wait(stream_cancel_done, gpr_inf_future(GPR_CLOCK_REALTIME)); + done_events.emplace_back(stream_cancel_done); s->DestroyThen(MakeOnceClosure([s](grpc_error* error) { delete s; })); grpc_metadata_batch_destroy(&b); grpc_metadata_batch_destroy(&b_recv); From a451a3a94b09a78d4511dd13500bd9da96696d50 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 28 Aug 2019 10:18:14 -0700 Subject: [PATCH 476/661] Rename function --- third_party/py/python_configure.bzl | 31 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/third_party/py/python_configure.bzl b/third_party/py/python_configure.bzl index 123f0b11865..70380e9dde9 100644 --- a/third_party/py/python_configure.bzl +++ b/third_party/py/python_configure.bzl @@ -241,12 +241,11 @@ def _get_python_import_lib_name(repository_ctx, python_bin, bin_path_key): return result.stdout.splitlines()[0] -# TODO(rbellevi): Rename. -def _create_local_python_repository(repository_ctx, - variety_name, - bin_path_key, - default_bin_path, - lib_path_key): +def _create_single_version_package(repository_ctx, + variety_name, + bin_path_key, + default_bin_path, + lib_path_key): """Creates the repository containing files set up to build with Python.""" python_bin = _get_python_bin(repository_ctx, bin_path_key, default_bin_path) _check_python_bin(repository_ctx, python_bin, bin_path_key) @@ -279,16 +278,16 @@ def _create_local_python_repository(repository_ctx, def _python_autoconf_impl(repository_ctx): """Implementation of the python_autoconf repository rule.""" - _create_local_python_repository(repository_ctx, - "_python2", - _PYTHON2_BIN_PATH, - "python", - _PYTHON2_LIB_PATH) - _create_local_python_repository(repository_ctx, - "_python3", - _PYTHON3_BIN_PATH, - "python3", - _PYTHON3_LIB_PATH) + _create_single_version_package(repository_ctx, + "_python2", + _PYTHON2_BIN_PATH, + "python", + _PYTHON2_LIB_PATH) + _create_single_version_package(repository_ctx, + "_python3", + _PYTHON3_BIN_PATH, + "python3", + _PYTHON3_LIB_PATH) _tpl(repository_ctx, "BUILD") From 4edd3ad2a48eb1d0db1e035a55bfbedb5f996117 Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 28 Aug 2019 10:30:33 -0700 Subject: [PATCH 477/661] Update reflection doc --- doc/server_reflection_tutorial.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/doc/server_reflection_tutorial.md b/doc/server_reflection_tutorial.md index acbb4a6ab2d..ccad06057d6 100644 --- a/doc/server_reflection_tutorial.md +++ b/doc/server_reflection_tutorial.md @@ -178,15 +178,12 @@ descriptor database. desc_pool->FindMethodByName("helloworld.Greeter.SayHello"); ``` - * Get message type descriptors. + * Get message type descriptors and create messages dynamically. ```c++ const google::protobuf::Descriptor* request_desc = desc_pool->FindMessageTypeByName("helloworld.HelloRequest"); + google::protobuf::DynamicMessageFactory dmf; + google::protobuf::Message* request = dmf.GetPrototype(request_desc)->New(); ``` - * Feed [google::protobuf::DynamicMessageFactory](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.dynamic_message#DynamicMessageFactory). - - ```c++ - google::protobuf::DynamicMessageFactory(&desc_pool); - ``` From d3cd387e03e3cbf99f71c144e371aeade4ad7357 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 28 Aug 2019 10:43:01 -0700 Subject: [PATCH 478/661] Bump rules_apple --- bazel/grpc_deps.bzl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 57021924725..6bbb960b6c3 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -221,10 +221,11 @@ def grpc_deps(): ) if "build_bazel_rules_apple" not in native.existing_rules(): - git_repository( + http_archive( name = "build_bazel_rules_apple", - remote = "https://github.com/bazelbuild/rules_apple.git", - tag = "0.17.2", + url = "https://github.com/bazelbuild/rules_apple/archive/b869b0d3868d78a1d4ffd866ccb304fb68aa12c3.tar.gz", + strip_prefix = "rules_apple-b869b0d3868d78a1d4ffd866ccb304fb68aa12c3", + sha256 = "bdc8e66e70b8a75da23b79f1f8c6207356df07d041d96d2189add7ee0780cf4e", ) grpc_python_deps() From d1f4456dc656264c3413dd9596b910cad3539e33 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 28 Aug 2019 11:37:59 -0700 Subject: [PATCH 479/661] Revert "Merge pull request #19704 from muxi/isolate-call-implementation-2" This reverts commit ac5f8062dd4e9d903a42f41219b5323eec0908be, reversing changes made to 8ae549431ce2f3c009b3a297570f40339f05f699. --- bazel/grpc_build_system.bzl | 11 +- gRPC-ProtoRPC.podspec | 30 +- gRPC-RxLibrary.podspec | 17 - gRPC.podspec | 116 +-- src/compiler/objective_c_generator.cc | 97 +- src/compiler/objective_c_generator.h | 14 +- src/compiler/objective_c_plugin.cc | 60 +- src/objective-c/BUILD | 244 ++--- .../GRPCClient/GRPCCall+ChannelArg.h | 2 +- .../GRPCClient/GRPCCall+ChannelArg.m | 4 +- .../GRPCClient/GRPCCall+ChannelCredentials.h | 2 +- .../GRPCClient/GRPCCall+ChannelCredentials.m | 2 +- src/objective-c/GRPCClient/GRPCCall+Cronet.h | 13 +- src/objective-c/GRPCClient/GRPCCall+Cronet.m | 4 +- src/objective-c/GRPCClient/GRPCCall+GID.h | 2 +- src/objective-c/GRPCClient/GRPCCall+OAuth2.h | 4 +- src/objective-c/GRPCClient/GRPCCall+Tests.h | 2 +- src/objective-c/GRPCClient/GRPCCall+Tests.m | 2 +- src/objective-c/GRPCClient/GRPCCall.h | 240 ++++- src/objective-c/GRPCClient/GRPCCall.m | 867 +++++++++++++++--- src/objective-c/GRPCClient/GRPCCallLegacy.h | 136 --- src/objective-c/GRPCClient/GRPCCallLegacy.m | 677 -------------- src/objective-c/GRPCClient/GRPCCallOptions.h | 82 +- src/objective-c/GRPCClient/GRPCCallOptions.m | 27 +- src/objective-c/GRPCClient/GRPCDispatchable.h | 30 - src/objective-c/GRPCClient/GRPCInterceptor.h | 32 +- src/objective-c/GRPCClient/GRPCInterceptor.m | 265 ++---- src/objective-c/GRPCClient/GRPCTransport.h | 82 -- src/objective-c/GRPCClient/GRPCTransport.m | 142 --- src/objective-c/GRPCClient/GRPCTypes.h | 187 ---- .../internal_testing/GRPCCall+InternalTests.m | 2 +- .../private/{GRPCCore => }/ChannelArgsUtil.h | 0 .../private/{GRPCCore => }/ChannelArgsUtil.m | 0 .../private/{GRPCCore => }/GRPCCall+V2API.h | 6 + .../private/{GRPCCore => }/GRPCCallInternal.h | 14 +- .../private/{GRPCCore => }/GRPCCallInternal.m | 140 ++- .../private/{GRPCCore => }/GRPCChannel.h | 0 .../private/{GRPCCore => }/GRPCChannel.m | 72 +- .../{GRPCCore => }/GRPCChannelFactory.h | 0 .../{GRPCCore => }/GRPCChannelPool+Test.h | 0 .../private/{GRPCCore => }/GRPCChannelPool.h | 2 + .../private/{GRPCCore => }/GRPCChannelPool.m | 5 +- .../{GRPCCore => }/GRPCCompletionQueue.h | 0 .../{GRPCCore => }/GRPCCompletionQueue.m | 0 .../GRPCCoreCronet/GRPCCoreCronetFactory.h | 32 - .../GRPCCoreCronet/GRPCCoreCronetFactory.m | 54 -- .../private/GRPCCore/GRPCCoreFactory.h | 45 - .../private/GRPCCore/GRPCCoreFactory.m | 90 -- .../GRPCCronetChannelFactory.h | 2 +- .../GRPCCronetChannelFactory.m | 24 +- .../private/{GRPCCore => }/GRPCHost.h | 0 .../private/{GRPCCore => }/GRPCHost.m | 35 +- .../GRPCInsecureChannelFactory.h | 0 .../GRPCInsecureChannelFactory.m | 0 .../private/{GRPCCore => }/GRPCOpBatchLog.h | 0 .../private/{GRPCCore => }/GRPCOpBatchLog.m | 0 .../GRPCReachabilityFlagNames.xmacro.h | 0 .../{GRPCCore => }/GRPCRequestHeaders.h | 2 +- .../{GRPCCore => }/GRPCRequestHeaders.m | 0 .../{GRPCCore => }/GRPCSecureChannelFactory.h | 0 .../{GRPCCore => }/GRPCSecureChannelFactory.m | 0 .../private/GRPCTransport+Private.h | 65 -- .../private/GRPCTransport+Private.m | 131 --- .../private/{GRPCCore => }/GRPCWrappedCall.h | 0 .../private/{GRPCCore => }/GRPCWrappedCall.m | 0 .../private/{GRPCCore => }/NSData+GRPC.h | 0 .../private/{GRPCCore => }/NSData+GRPC.m | 0 .../{GRPCCore => }/NSDictionary+GRPC.h | 0 .../{GRPCCore => }/NSDictionary+GRPC.m | 0 .../private/{GRPCCore => }/NSError+GRPC.h | 0 .../private/{GRPCCore => }/NSError+GRPC.m | 3 +- .../GRPCClient/{ => private}/version.h | 0 src/objective-c/ProtoRPC/ProtoRPC.h | 38 +- src/objective-c/ProtoRPC/ProtoRPC.m | 91 ++ src/objective-c/ProtoRPC/ProtoRPCLegacy.h | 67 -- src/objective-c/ProtoRPC/ProtoRPCLegacy.m | 121 --- src/objective-c/ProtoRPC/ProtoService.h | 29 +- src/objective-c/ProtoRPC/ProtoService.m | 42 +- src/objective-c/ProtoRPC/ProtoServiceLegacy.h | 23 - src/objective-c/ProtoRPC/ProtoServiceLegacy.m | 71 -- .../tvOS-sample/tvOS-sample/ViewController.m | 2 - .../WatchKit-Extension/InterfaceController.m | 2 - src/objective-c/tests/BUILD | 8 + src/objective-c/tests/ConfigureCronet.h | 4 + src/objective-c/tests/ConfigureCronet.m | 4 + .../InteropTestsRemoteWithCronet.m | 12 +- .../tests/InteropTests/InteropTests.h | 13 +- .../tests/InteropTests/InteropTests.m | 268 +++--- .../InteropTests/InteropTestsLocalCleartext.m | 5 +- .../tests/InteropTests/InteropTestsLocalSSL.m | 5 +- .../InteropTestsMultipleChannels.m | 3 +- .../tests/InteropTests/InteropTestsRemote.m | 6 + src/objective-c/tests/Podfile | 24 +- .../tests/Tests.xcodeproj/project.pbxproj | 29 +- .../xcschemes/InteropTests.xcscheme | 8 +- .../tests/UnitTests/ChannelPoolTest.m | 6 +- .../tests/UnitTests/ChannelTests.m | 10 +- .../tests/UnitTests/NSErrorUnitTests.m | 2 +- templates/gRPC-ProtoRPC.podspec.template | 30 +- templates/gRPC-RxLibrary.podspec.template | 17 - templates/gRPC.podspec.template | 116 +-- .../{ => private}/version.h.template | 0 102 files changed, 1922 insertions(+), 3251 deletions(-) delete mode 100644 src/objective-c/GRPCClient/GRPCCallLegacy.h delete mode 100644 src/objective-c/GRPCClient/GRPCCallLegacy.m delete mode 100644 src/objective-c/GRPCClient/GRPCDispatchable.h delete mode 100644 src/objective-c/GRPCClient/GRPCTransport.h delete mode 100644 src/objective-c/GRPCClient/GRPCTransport.m delete mode 100644 src/objective-c/GRPCClient/GRPCTypes.h rename src/objective-c/GRPCClient/private/{GRPCCore => }/ChannelArgsUtil.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/ChannelArgsUtil.m (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCCall+V2API.h (79%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCCallInternal.h (70%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCCallInternal.m (69%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCChannel.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCChannel.m (78%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCChannelFactory.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCChannelPool+Test.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCChannelPool.h (98%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCChannelPool.m (98%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCCompletionQueue.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCCompletionQueue.m (100%) delete mode 100644 src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h delete mode 100644 src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m delete mode 100644 src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h delete mode 100644 src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m rename src/objective-c/GRPCClient/private/{GRPCCore/GRPCCoreCronet => }/GRPCCronetChannelFactory.h (96%) rename src/objective-c/GRPCClient/private/{GRPCCore/GRPCCoreCronet => }/GRPCCronetChannelFactory.m (76%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCHost.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCHost.m (82%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCInsecureChannelFactory.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCInsecureChannelFactory.m (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCOpBatchLog.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCOpBatchLog.m (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCReachabilityFlagNames.xmacro.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCRequestHeaders.h (95%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCRequestHeaders.m (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCSecureChannelFactory.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCSecureChannelFactory.m (100%) delete mode 100644 src/objective-c/GRPCClient/private/GRPCTransport+Private.h delete mode 100644 src/objective-c/GRPCClient/private/GRPCTransport+Private.m rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCWrappedCall.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/GRPCWrappedCall.m (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/NSData+GRPC.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/NSData+GRPC.m (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/NSDictionary+GRPC.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/NSDictionary+GRPC.m (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/NSError+GRPC.h (100%) rename src/objective-c/GRPCClient/private/{GRPCCore => }/NSError+GRPC.m (96%) rename src/objective-c/GRPCClient/{ => private}/version.h (100%) delete mode 100644 src/objective-c/ProtoRPC/ProtoRPCLegacy.h delete mode 100644 src/objective-c/ProtoRPC/ProtoRPCLegacy.m delete mode 100644 src/objective-c/ProtoRPC/ProtoServiceLegacy.h delete mode 100644 src/objective-c/ProtoRPC/ProtoServiceLegacy.m rename templates/src/objective-c/GRPCClient/{ => private}/version.h.template (100%) diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 23f90d0dc80..f386b87b583 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -24,6 +24,7 @@ # load("//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test") @@ -238,13 +239,19 @@ def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], da ) def grpc_generate_one_off_targets(): + apple_resource_bundle( + # The choice of name is signicant here, since it determines the bundle name. + name = "gRPCCertificates", + resources = ["etc/roots.pem"], + ) + # In open-source, grpc_objc* libraries depend directly on //:grpc native.alias( name = "grpc_objc", actual = "//:grpc", ) -def grpc_generate_objc_one_off_targets(): +def grpc_objc_use_cronet_config(): pass def grpc_sh_test(name, srcs, args = [], data = []): @@ -289,7 +296,7 @@ def grpc_package(name, visibility = "private", features = []): def grpc_objc_library( name, - srcs = [], + srcs, hdrs = [], textual_hdrs = [], data = [], diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 4c5ebb36562..57dac5a10e5 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -42,40 +42,22 @@ Pod::Spec.new do |s| s.module_name = name s.header_dir = name - s.default_subspec = 'Main', 'Legacy', 'Legacy-Header' + src_dir = 'src/objective-c/ProtoRPC' - s.subspec 'Legacy-Header' do |ss| - ss.header_mappings_dir = "src/objective-c/ProtoRPC" - ss.public_header_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.h" - ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.h" - end + s.default_subspec = 'Main' s.subspec 'Main' do |ss| - ss.header_mappings_dir = "src/objective-c/ProtoRPC" - ss.dependency "#{s.name}/Legacy-Header", version - ss.dependency 'gRPC/Interface', version - ss.dependency 'Protobuf', '~> 3.0' - - ss.source_files = "src/objective-c/ProtoRPC/ProtoMethod.{h,m}", - "src/objective-c/ProtoRPC/ProtoRPC.{h,m}", - "src/objective-c/ProtoRPC/ProtoService.{h,m}" - end - - s.subspec 'Legacy' do |ss| - ss.header_mappings_dir = "src/objective-c/ProtoRPC" - ss.dependency "#{s.name}/Main", version - ss.dependency "#{s.name}/Legacy-Header", version - ss.dependency 'gRPC/GRPCCore', version + ss.header_mappings_dir = "#{src_dir}" + ss.dependency 'gRPC', version ss.dependency 'gRPC-RxLibrary', version ss.dependency 'Protobuf', '~> 3.0' - ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.m", - "src/objective-c/ProtoRPC/ProtoServiceLegacy.m" + ss.source_files = "#{src_dir}/*.{h,m}" end # CFStream is now default. Leaving this subspec only for compatibility purpose. s.subspec 'CFStream' do |ss| - ss.dependency "#{s.name}/Legacy", version + ss.dependency "#{s.name}/Main", version end s.pod_target_xcconfig = { diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 2e412cf67d6..9666c3c1b98 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -42,23 +42,6 @@ Pod::Spec.new do |s| s.module_name = name s.header_dir = name - s.default_subspec = 'Interface', 'Implementation' - - src_dir = 'src/objective-c/RxLibrary' - s.subspec 'Interface' do |ss| - ss.header_mappings_dir = "#{src_dir}" - ss.source_files = "#{src_dir}/*.h" - ss.public_header_files = "#{src_dir}/*.h" - end - - s.subspec 'Implementation' do |ss| - ss.header_mappings_dir = "#{src_dir}" - ss.source_files = "#{src_dir}/*.m", "#{src_dir}/**/*.{h,m}" - ss.private_header_files = "#{src_dir}/**/*.h" - - ss.dependency "#{s.name}/Interface" - end - src_dir = 'src/objective-c/RxLibrary' s.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" s.private_header_files = "#{src_dir}/private/*.h" diff --git a/gRPC.podspec b/gRPC.podspec index e18adcd276e..09baf1e3b4b 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -41,7 +41,13 @@ Pod::Spec.new do |s| s.module_name = name s.header_dir = name - s.default_subspec = 'Interface', 'GRPCCore', 'Interface-Legacy' + src_dir = 'src/objective-c/GRPCClient' + + s.dependency 'gRPC-RxLibrary', version + s.default_subspec = 'Main' + + # Certificates, to be able to establish TLS connections: + s.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } s.pod_target_xcconfig = { # This is needed by all pods that depend on gRPC-RxLibrary: @@ -49,103 +55,29 @@ Pod::Spec.new do |s| 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } - s.subspec 'Interface-Legacy' do |ss| - ss.header_mappings_dir = 'src/objective-c/GRPCClient' - - ss.public_header_files = "GRPCClient/GRPCCall+ChannelArg.h", - "GRPCClient/GRPCCall+ChannelCredentials.h", - "GRPCClient/GRPCCall+Cronet.h", - "GRPCClient/GRPCCall+OAuth2.h", - "GRPCClient/GRPCCall+Tests.h", - "src/objective-c/GRPCClient/GRPCCallLegacy.h", - "src/objective-c/GRPCClient/GRPCTypes.h" - - ss.source_files = "GRPCClient/GRPCCall+ChannelArg.h", - "GRPCClient/GRPCCall+ChannelCredentials.h", - "GRPCClient/GRPCCall+Cronet.h", - "GRPCClient/GRPCCall+OAuth2.h", - "GRPCClient/GRPCCall+Tests.h", - "src/objective-c/GRPCClient/GRPCCallLegacy.h", - "src/objective-c/GRPCClient/GRPCTypes.h" - ss.dependency "gRPC-RxLibrary/Interface", version - end + s.subspec 'Main' do |ss| + ss.header_mappings_dir = "#{src_dir}" - s.subspec 'Interface' do |ss| - ss.header_mappings_dir = 'src/objective-c/GRPCClient' - - ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall.h', - 'src/objective-c/GRPCClient/GRPCCall+Interceptor.h', - 'src/objective-c/GRPCClient/GRPCCallOptions.h', - 'src/objective-c/GRPCClient/GRPCInterceptor.h', - 'src/objective-c/GRPCClient/GRPCTransport.h', - 'src/objective-c/GRPCClient/GRPCDispatchable.h', - 'src/objective-c/GRPCClient/version.h' - - ss.source_files = 'src/objective-c/GRPCClient/GRPCCall.h', - 'src/objective-c/GRPCClient/GRPCCall.m', - 'src/objective-c/GRPCClient/GRPCCall+Interceptor.h', - 'src/objective-c/GRPCClient/GRPCCall+Interceptor.m', - 'src/objective-c/GRPCClient/GRPCCallOptions.h', - 'src/objective-c/GRPCClient/GRPCCallOptions.m', - 'src/objective-c/GRPCClient/GRPCDispatchable.h', - 'src/objective-c/GRPCClient/GRPCInterceptor.h', - 'src/objective-c/GRPCClient/GRPCInterceptor.m', - 'src/objective-c/GRPCClient/GRPCTransport.h', - 'src/objective-c/GRPCClient/GRPCTransport.m', - 'src/objective-c/GRPCClient/internal/*.h', - 'src/objective-c/GRPCClient/private/GRPCTransport+Private.h', - 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m', - 'src/objective-c/GRPCClient/version.h' - - ss.dependency "#{s.name}/Interface-Legacy", version - end + ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" + ss.exclude_files = "#{src_dir}/GRPCCall+GID.{h,m}" + ss.private_header_files = "#{src_dir}/private/*.h", "#{src_dir}/internal/*.h" - s.subspec 'GRPCCore' do |ss| - ss.header_mappings_dir = 'src/objective-c/GRPCClient' - - ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', - 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', - 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', - 'src/objective-c/GRPCClient/GRPCCall+Tests.h', - 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', - 'src/objective-c/GRPCClient/internal_testing/*.h' - ss.private_header_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.h' - ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.{h,m}', - 'src/objective-c/GRPCClient/private/GRPCCore/*.{h,m}', - 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', - 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.m', - 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', - 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m', - 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', - 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', - 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', - 'src/objective-c/GRPCClient/GRPCCall+OAuth2.m', - 'src/objective-c/GRPCClient/GRPCCall+Tests.h', - 'src/objective-c/GRPCClient/GRPCCall+Tests.m', - 'src/objective-c/GRPCClient/GRPCCallLegacy.m' - - # Certificates, to be able to establish TLS connections: - ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } - - ss.dependency "#{s.name}/Interface-Legacy", version - ss.dependency "#{s.name}/Interface", version ss.dependency 'gRPC-Core', version - ss.dependency 'gRPC-RxLibrary', version - end - - s.subspec 'GRPCCoreCronet' do |ss| - ss.header_mappings_dir = 'src/objective-c/GRPCClient' - - ss.source_files = 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', - 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', - 'src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/*.{h,m}' - ss.dependency "#{s.name}/GRPCCore", version - ss.dependency 'gRPC-Core/Cronet-Implementation', version - ss.dependency 'CronetFramework' end # CFStream is now default. Leaving this subspec only for compatibility purpose. s.subspec 'CFStream' do |ss| - ss.dependency "#{s.name}/GRPCCore", version + ss.dependency "#{s.name}/Main", version + end + + s.subspec 'GID' do |ss| + ss.ios.deployment_target = '7.0' + + ss.header_mappings_dir = "#{src_dir}" + + ss.source_files = "#{src_dir}/GRPCCall+GID.{h,m}" + + ss.dependency "#{s.name}/Main", version + ss.dependency 'Google/SignIn' end end diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index ed262308aba..24845ecdb06 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -238,21 +238,19 @@ void PrintV2Implementation(Printer* printer, const MethodDescriptor* method, } void PrintMethodImplementations(Printer* printer, - const MethodDescriptor* method, - const Parameters& generator_params) { + const MethodDescriptor* method) { map< ::grpc::string, ::grpc::string> vars = GetMethodVars(method); PrintProtoRpcDeclarationAsPragma(printer, method, vars); - if (!generator_params.no_v1_compatibility) { - // TODO(jcanizales): Print documentation from the method. - PrintSimpleSignature(printer, method, vars); - PrintSimpleImplementation(printer, method, vars); + // TODO(jcanizales): Print documentation from the method. + printer->Print("// Deprecated methods.\n"); + PrintSimpleSignature(printer, method, vars); + PrintSimpleImplementation(printer, method, vars); - printer->Print("// Returns a not-yet-started RPC object.\n"); - PrintAdvancedSignature(printer, method, vars); - PrintAdvancedImplementation(printer, method, vars); - } + printer->Print("// Returns a not-yet-started RPC object.\n"); + PrintAdvancedSignature(printer, method, vars); + PrintAdvancedImplementation(printer, method, vars); PrintV2Signature(printer, method, vars); PrintV2Implementation(printer, method, vars); @@ -278,12 +276,9 @@ void PrintMethodImplementations(Printer* printer, return output; } -::grpc::string GetProtocol(const ServiceDescriptor* service, - const Parameters& generator_params) { +::grpc::string GetProtocol(const ServiceDescriptor* service) { ::grpc::string output; - if (generator_params.no_v1_compatibility) return output; - // Scope the output stream so it closes and finalizes output to the string. grpc::protobuf::io::StringOutputStream output_stream(&output); Printer printer(&output_stream, '$'); @@ -326,8 +321,7 @@ void PrintMethodImplementations(Printer* printer, return output; } -::grpc::string GetInterface(const ServiceDescriptor* service, - const Parameters& generator_params) { +::grpc::string GetInterface(const ServiceDescriptor* service) { ::grpc::string output; // Scope the output stream so it closes and finalizes output to the string. @@ -344,11 +338,7 @@ void PrintMethodImplementations(Printer* printer, " */\n"); printer.Print(vars, "@interface $service_class$ :" - " GRPCProtoService<$service_class$2"); - if (!generator_params.no_v1_compatibility) { - printer.Print(vars, ", $service_class$"); - } - printer.Print(">\n"); + " GRPCProtoService<$service_class$, $service_class$2>\n"); printer.Print( "- (instancetype)initWithHost:(NSString *)host " "callOptions:(GRPCCallOptions " @@ -357,20 +347,17 @@ void PrintMethodImplementations(Printer* printer, printer.Print( "+ (instancetype)serviceWithHost:(NSString *)host " "callOptions:(GRPCCallOptions *_Nullable)callOptions;\n"); - if (!generator_params.no_v1_compatibility) { - printer.Print( - "// The following methods belong to a set of old APIs that have been " - "deprecated.\n"); - printer.Print("- (instancetype)initWithHost:(NSString *)host;\n"); - printer.Print("+ (instancetype)serviceWithHost:(NSString *)host;\n"); - } + printer.Print( + "// The following methods belong to a set of old APIs that have been " + "deprecated.\n"); + printer.Print("- (instancetype)initWithHost:(NSString *)host;\n"); + printer.Print("+ (instancetype)serviceWithHost:(NSString *)host;\n"); printer.Print("@end\n"); return output; } -::grpc::string GetSource(const ServiceDescriptor* service, - const Parameters& generator_params) { +::grpc::string GetSource(const ServiceDescriptor* service) { ::grpc::string output; { // Scope the output stream so it closes and finalizes output to the string. @@ -394,28 +381,22 @@ void PrintMethodImplementations(Printer* printer, " packageName:@\"$package$\"\n" " serviceName:@\"$service_name$\"\n" " callOptions:callOptions];\n" - "}\n\n"); - if (!generator_params.no_v1_compatibility) { - printer.Print(vars, - "- (instancetype)initWithHost:(NSString *)host {\n" - " return [super initWithHost:host\n" - " packageName:@\"$package$\"\n" - " serviceName:@\"$service_name$\"];\n" - "}\n\n"); - } - printer.Print("#pragma clang diagnostic pop\n\n"); - - if (!generator_params.no_v1_compatibility) { - printer.Print( - "// Override superclass initializer to disallow different" - " package and service names.\n" - "- (instancetype)initWithHost:(NSString *)host\n" - " packageName:(NSString *)packageName\n" - " serviceName:(NSString *)serviceName {\n" - " return [self initWithHost:host];\n" - "}\n\n"); - } + "}\n\n" + "- (instancetype)initWithHost:(NSString *)host {\n" + " return [super initWithHost:host\n" + " packageName:@\"$package$\"\n" + " serviceName:@\"$service_name$\"];\n" + "}\n\n" + "#pragma clang diagnostic pop\n\n"); + printer.Print( + "// Override superclass initializer to disallow different" + " package and service names.\n" + "- (instancetype)initWithHost:(NSString *)host\n" + " packageName:(NSString *)packageName\n" + " serviceName:(NSString *)serviceName {\n" + " return [self initWithHost:host];\n" + "}\n\n" "- (instancetype)initWithHost:(NSString *)host\n" " packageName:(NSString *)packageName\n" " serviceName:(NSString *)serviceName\n" @@ -423,14 +404,11 @@ void PrintMethodImplementations(Printer* printer, " return [self initWithHost:host callOptions:callOptions];\n" "}\n\n"); - printer.Print("#pragma mark - Class Methods\n\n"); - if (!generator_params.no_v1_compatibility) { - printer.Print( - "+ (instancetype)serviceWithHost:(NSString *)host {\n" - " return [[self alloc] initWithHost:host];\n" - "}\n\n"); - } printer.Print( + "#pragma mark - Class Methods\n\n" + "+ (instancetype)serviceWithHost:(NSString *)host {\n" + " return [[self alloc] initWithHost:host];\n" + "}\n\n" "+ (instancetype)serviceWithHost:(NSString *)host " "callOptions:(GRPCCallOptions *_Nullable)callOptions {\n" " return [[self alloc] initWithHost:host callOptions:callOptions];\n" @@ -439,8 +417,7 @@ void PrintMethodImplementations(Printer* printer, printer.Print("#pragma mark - Method Implementations\n\n"); for (int i = 0; i < service->method_count(); i++) { - PrintMethodImplementations(&printer, service->method(i), - generator_params); + PrintMethodImplementations(&printer, service->method(i)); } printer.Print("@end\n"); diff --git a/src/compiler/objective_c_generator.h b/src/compiler/objective_c_generator.h index 518962fceee..c171e5bf772 100644 --- a/src/compiler/objective_c_generator.h +++ b/src/compiler/objective_c_generator.h @@ -23,11 +23,6 @@ namespace grpc_objective_c_generator { -struct Parameters { - // Do not generate V1 interface and implementation - bool no_v1_compatibility; -}; - using ::grpc::protobuf::FileDescriptor; using ::grpc::protobuf::FileDescriptor; using ::grpc::protobuf::ServiceDescriptor; @@ -39,8 +34,7 @@ string GetAllMessageClasses(const FileDescriptor* file); // Returns the content to be included defining the @protocol segment at the // insertion point of the generated implementation file. This interface is // legacy and for backwards compatibility. -string GetProtocol(const ServiceDescriptor* service, - const Parameters& generator_params); +string GetProtocol(const ServiceDescriptor* service); // Returns the content to be included defining the @protocol segment at the // insertion point of the generated implementation file. @@ -48,13 +42,11 @@ string GetV2Protocol(const ServiceDescriptor* service); // Returns the content to be included defining the @interface segment at the // insertion point of the generated implementation file. -string GetInterface(const ServiceDescriptor* service, - const Parameters& generator_params); +string GetInterface(const ServiceDescriptor* service); // Returns the content to be included in the "global_scope" insertion point of // the generated implementation file. -string GetSource(const ServiceDescriptor* service, - const Parameters& generator_params); +string GetSource(const ServiceDescriptor* service); } // namespace grpc_objective_c_generator diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index a08064a08bd..f398033f6db 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -111,22 +111,6 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string file_name = google::protobuf::compiler::objectivec::FilePath(file); - grpc_objective_c_generator::Parameters generator_params; - generator_params.no_v1_compatibility = false; - - if (!parameter.empty()) { - std::vector parameters_list = - grpc_generator::tokenize(parameter, ","); - for (auto parameter_string = parameters_list.begin(); - parameter_string != parameters_list.end(); parameter_string++) { - std::vector param = - grpc_generator::tokenize(*parameter_string, "="); - if (param[0] == "no_v1_compatibility") { - generator_params.no_v1_compatibility = true; - } - } - } - { // Generate .pbrpc.h @@ -137,25 +121,18 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { imports = FrameworkImport(file_name + ".pbobjc.h", framework); } - ::grpc::string system_imports = - SystemImport("ProtoRPC/ProtoService.h") + - (generator_params.no_v1_compatibility - ? SystemImport("ProtoRPC/ProtoRPC.h") - : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); - if (!generator_params.no_v1_compatibility) { - system_imports += SystemImport("RxLibrary/GRXWriteable.h") + - SystemImport("RxLibrary/GRXWriter.h"); - } + ::grpc::string system_imports = SystemImport("ProtoRPC/ProtoService.h") + + SystemImport("ProtoRPC/ProtoRPC.h") + + SystemImport("RxLibrary/GRXWriteable.h") + + SystemImport("RxLibrary/GRXWriter.h"); ::grpc::string forward_declarations = + "@class GRPCProtoCall;\n" "@class GRPCUnaryProtoCall;\n" "@class GRPCStreamingProtoCall;\n" "@class GRPCCallOptions;\n" - "@protocol GRPCProtoResponseHandler;\n"; - if (!generator_params.no_v1_compatibility) { - forward_declarations += "@class GRPCProtoCall;\n"; - } - forward_declarations += "\n"; + "@protocol GRPCProtoResponseHandler;\n" + "\n"; ::grpc::string class_declarations = grpc_objective_c_generator::GetAllMessageClasses(file); @@ -175,15 +152,13 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string protocols; for (int i = 0; i < file->service_count(); i++) { const grpc::protobuf::ServiceDescriptor* service = file->service(i); - protocols += - grpc_objective_c_generator::GetProtocol(service, generator_params); + protocols += grpc_objective_c_generator::GetProtocol(service); } ::grpc::string interfaces; for (int i = 0; i < file->service_count(); i++) { const grpc::protobuf::ServiceDescriptor* service = file->service(i); - interfaces += - grpc_objective_c_generator::GetInterface(service, generator_params); + interfaces += grpc_objective_c_generator::GetInterface(service); } Write(context, file_name + ".pbrpc.h", @@ -203,16 +178,14 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string imports; if (framework.empty()) { imports = LocalImport(file_name + ".pbrpc.h") + - LocalImport(file_name + ".pbobjc.h"); + LocalImport(file_name + ".pbobjc.h") + + SystemImport("ProtoRPC/ProtoRPC.h") + + SystemImport("RxLibrary/GRXWriter+Immediate.h"); } else { imports = FrameworkImport(file_name + ".pbrpc.h", framework) + - FrameworkImport(file_name + ".pbobjc.h", framework); - } - imports += (generator_params.no_v1_compatibility - ? SystemImport("ProtoRPC/ProtoRPC.h") - : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); - if (!generator_params.no_v1_compatibility) { - imports += SystemImport("RxLibrary/GRXWriter+Immediate.h"); + FrameworkImport(file_name + ".pbobjc.h", framework) + + SystemImport("ProtoRPC/ProtoRPC.h") + + SystemImport("RxLibrary/GRXWriter+Immediate.h"); } ::grpc::string class_imports; @@ -223,8 +196,7 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string definitions; for (int i = 0; i < file->service_count(); i++) { const grpc::protobuf::ServiceDescriptor* service = file->service(i); - definitions += - grpc_objective_c_generator::GetSource(service, generator_params); + definitions += grpc_objective_c_generator::GetSource(service); } Write(context, file_name + ".pbrpc.m", diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index 5f53486d17e..3a71086f0f6 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -18,30 +18,24 @@ licenses(["notice"]) # Apache v2 package(default_visibility = ["//visibility:public"]) -load("//bazel:grpc_build_system.bzl", "grpc_objc_library", "grpc_generate_objc_one_off_targets") +load("//bazel:grpc_build_system.bzl", "grpc_objc_library", "grpc_objc_use_cronet_config") exports_files(["LICENSE"]) -grpc_generate_objc_one_off_targets() - -grpc_objc_library( - name = "rx_library_headers", - hdrs = glob([ - "RxLibrary/*.h", - ]), - includes = ["."], -) +grpc_objc_use_cronet_config() grpc_objc_library( name = "rx_library", srcs = glob([ "RxLibrary/*.m", + "RxLibrary/transformations/*.m", + ]), + hdrs = glob([ + "RxLibrary/*.h", + "RxLibrary/transformations/*.h", ]), includes = ["."], - deps = [ - ":rx_library_headers", - ":rx_library_private", - ], + deps = [":rx_library_private"], ) grpc_objc_library( @@ -56,196 +50,84 @@ grpc_objc_library( ) grpc_objc_library( - name = "grpc_objc_interface_legacy", - hdrs = [ - "GRPCClient/GRPCCall+ChannelArg.h", - "GRPCClient/GRPCCall+ChannelCredentials.h", - "GRPCClient/GRPCCall+Cronet.h", - "GRPCClient/GRPCCall+OAuth2.h", - "GRPCClient/GRPCCall+Tests.h", - "GRPCClient/GRPCCallLegacy.h", - "GRPCClient/GRPCTypes.h", - ], - deps = [ - "rx_library_headers", - ], -) - -grpc_objc_library( - name = "grpc_objc_interface", - hdrs = [ - "GRPCClient/GRPCCall.h", - "GRPCClient/GRPCCall+Interceptor.h", - "GRPCClient/GRPCCallOptions.h", - "GRPCClient/GRPCInterceptor.h", - "GRPCClient/GRPCTransport.h", - "GRPCClient/GRPCDispatchable.h", - "GRPCClient/internal/GRPCCallOptions+Internal.h", - "GRPCClient/version.h", - ], - srcs = [ - "GRPCClient/GRPCCall.m", - "GRPCClient/GRPCCall+Interceptor.m", - "GRPCClient/GRPCCallOptions.m", - "GRPCClient/GRPCInterceptor.m", - "GRPCClient/GRPCTransport.m", - "GRPCClient/private/GRPCTransport+Private.m", - ], - includes = ["."], - textual_hdrs = [ - "GRPCClient/private/GRPCTransport+Private.h", - ], - deps = [ - ":grpc_objc_interface_legacy", - ], -) - -grpc_objc_library( - name = "grpc_objc_client_core", - hdrs = [ - "GRPCClient/GRPCCall+ChannelCredentials.h", - "GRPCClient/GRPCCall+Cronet.h", - "GRPCClient/GRPCCall+OAuth2.h", - "GRPCClient/GRPCCall+Tests.h", - "GRPCClient/GRPCCall+ChannelArg.h", - ], - textual_hdrs = glob(["GRPCClient/private/GRPCCore/*.h"]), - srcs = [ - "GRPCClient/GRPCCall+ChannelArg.m", - "GRPCClient/GRPCCall+ChannelCredentials.m", - "GRPCClient/GRPCCall+Cronet.m", - "GRPCClient/GRPCCall+OAuth2.m", - "GRPCClient/GRPCCall+Tests.m", - "GRPCClient/GRPCCallLegacy.m", - ] + glob(["GRPCClient/private/GRPCCore/*.m"]), - data = [":gRPCCertificates"], + name = "grpc_objc_client", + srcs = glob( + [ + "GRPCClient/*.m", + "GRPCClient/private/*.m", + ], + exclude = ["GRPCClient/GRPCCall+GID.m"], + ), + hdrs = glob( + [ + "GRPCClient/*.h", + "GRPCClient/internal/*.h", + ], + exclude = ["GRPCClient/GRPCCall+GID.h"], + ), + data = ["//:gRPCCertificates"], includes = ["."], + textual_hdrs = glob([ + "GRPCClient/private/*.h", + ]), deps = [ - ":grpc_objc_interface", - ":grpc_objc_interface_legacy", ":rx_library", "//:grpc_objc", ], ) -alias( - name = "grpc_objc_client", - actual = "grpc_objc_client_core", -) - -grpc_objc_library( - name = "proto_objc_rpc_legacy_header", - hdrs = [ - "ProtoRPC/ProtoRPCLegacy.h", - ], - includes = ["."], -) - -grpc_objc_library( - name = "proto_objc_rpc_v2", - srcs = [ - "ProtoRPC/ProtoMethod.m", - "ProtoRPC/ProtoRPC.m", - "ProtoRPC/ProtoService.m", - ], - hdrs = [ - "ProtoRPC/ProtoMethod.h", - "ProtoRPC/ProtoRPC.h", - "ProtoRPC/ProtoService.h", - ], - includes = ["."], - defines = ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0"], - deps = [ - ":grpc_objc_interface", - ":proto_objc_rpc_legacy_header", - "@com_google_protobuf//:protobuf_objc", - ], -) - grpc_objc_library( name = "proto_objc_rpc", - srcs = [ - "ProtoRPC/ProtoRPCLegacy.m", - "ProtoRPC/ProtoServiceLegacy.m", - ], - hdrs = [ - "ProtoRPC/ProtoMethod.h", - "ProtoRPC/ProtoRPCLegacy.h", - "ProtoRPC/ProtoService.h", - ], + srcs = glob( + ["ProtoRPC/*.m"], + ), + hdrs = glob( + ["ProtoRPC/*.h"], + ), + # Different from Cocoapods, do not import as if @com_google_protobuf//:protobuf_objc is a framework, + # use the real paths of @com_google_protobuf//:protobuf_objc instead + defines = ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0"], deps = [ + ":grpc_objc_client", ":rx_library", - ":proto_objc_rpc_v2", - ":proto_objc_rpc_legacy_header", - ":grpc_objc_client_core", "@com_google_protobuf//:protobuf_objc", ], ) -load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") - -apple_resource_bundle( - # The choice of name is signicant here, since it determines the bundle name. - name = "gRPCCertificates", - resources = ["//:etc/roots.pem"], -) - -# Internal target combining grpc_objc_client_core and proto_objc_rpc for testing grpc_objc_library( - name = "grpc_objc_client_core_internal_testing", - hdrs = [ - "GRPCClient/GRPCCall+ChannelCredentials.h", - "GRPCClient/GRPCCall+Cronet.h", - "GRPCClient/GRPCCall+OAuth2.h", - "GRPCClient/GRPCCall+Tests.h", - "GRPCClient/GRPCCall+ChannelArg.h", - "GRPCClient/internal_testing/GRPCCall+InternalTests.h", - ], - textual_hdrs = glob(["GRPCClient/private/GRPCCore/*.h"]), - srcs = [ - "GRPCClient/GRPCCall+ChannelArg.m", - "GRPCClient/GRPCCall+ChannelCredentials.m", - "GRPCClient/GRPCCall+Cronet.m", - "GRPCClient/GRPCCall+OAuth2.m", - "GRPCClient/GRPCCall+Tests.m", - "GRPCClient/GRPCCallLegacy.m", - "GRPCClient/internal_testing/GRPCCall+InternalTests.m", - ] + glob(["GRPCClient/private/GRPCCore/*.m"]), - data = [":gRPCCertificates"], + name = "grpc_objc_client_internal_testing", + srcs = glob( + [ + "GRPCClient/*.m", + "GRPCClient/private/*.m", + "GRPCClient/internal_testing/*.m", + "ProtoRPC/*.m", + ], + exclude = ["GRPCClient/GRPCCall+GID.m"], + ), + hdrs = glob( + [ + "GRPCClient/*.h", + "GRPCClient/internal/*.h", + "GRPCClient/internal_testing/*.h", + "ProtoRPC/*.h", + ], + exclude = ["GRPCClient/GRPCCall+GID.h"], + ), includes = ["."], + data = ["//:gRPCCertificates"], defines = [ "GRPC_TEST_OBJC=1", + "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0", ], + textual_hdrs = glob( + [ + "GRPCClient/private/*.h", + ], + ), deps = [ - ":grpc_objc_interface", - ":grpc_objc_interface_legacy", ":rx_library", "//:grpc_objc", - ], -) - -grpc_objc_library( - name = "proto_objc_rpc_internal_testing", - srcs = [ - "ProtoRPC/ProtoRPCLegacy.m", - "ProtoRPC/ProtoServiceLegacy.m", - ], - hdrs = [ - "ProtoRPC/ProtoMethod.h", - "ProtoRPC/ProtoRPC.h", - "ProtoRPC/ProtoRPCLegacy.h", - "ProtoRPC/ProtoService.h", - ], - deps = [ - ":rx_library", - ":proto_objc_rpc_v2", - ":proto_objc_rpc_legacy_header", - ":grpc_objc_client_core_internal_testing", "@com_google_protobuf//:protobuf_objc", ], ) - -alias( - name = "grpc_objc_client_internal_testing", - actual = "proto_objc_rpc_internal_testing", -) diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h index ff5a153a0f6..2ddd53a5c66 100644 --- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h +++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h @@ -15,7 +15,7 @@ * limitations under the License. * */ -#import "GRPCCallLegacy.h" +#import "GRPCCall.h" #include diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m index aae1b740c71..ae60d6208e1 100644 --- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m +++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m @@ -18,8 +18,8 @@ #import "GRPCCall+ChannelArg.h" -#import "private/GRPCCore/GRPCChannelPool.h" -#import "private/GRPCCore/GRPCHost.h" +#import "private/GRPCChannelPool.h" +#import "private/GRPCHost.h" #import diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h index c3d194bff94..7d6f79b7655 100644 --- a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h +++ b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h @@ -16,7 +16,7 @@ * */ -#import "GRPCCallLegacy.h" +#import "GRPCCall.h" // Deprecated interface. Please use GRPCCallOptions instead. @interface GRPCCall (ChannelCredentials) diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m index aa97ca82bf8..2689ec2effb 100644 --- a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m +++ b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m @@ -18,7 +18,7 @@ #import "GRPCCall+ChannelCredentials.h" -#import "private/GRPCCore/GRPCHost.h" +#import "private/GRPCHost.h" @implementation GRPCCall (ChannelCredentials) diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.h b/src/objective-c/GRPCClient/GRPCCall+Cronet.h index d107ada3672..3059c6f1860 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.h +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.h @@ -15,16 +15,12 @@ * limitations under the License. * */ +#ifdef GRPC_COMPILE_WITH_CRONET +#import -#import "GRPCCallLegacy.h" -#import "GRPCTypes.h" +#import "GRPCCall.h" -typedef struct stream_engine stream_engine; - -// Transport id for Cronet transport -extern const GRPCTransportId gGRPCCoreCronetId; - -// Deprecated class. Please use the gGRPCCoreCronetId with GRPCCallOptions.transport instead. +// Deprecated interface. Please use GRPCCallOptions instead. @interface GRPCCall (Cronet) + (void)useCronetWithEngine:(stream_engine*)engine; @@ -32,3 +28,4 @@ extern const GRPCTransportId gGRPCCoreCronetId; + (BOOL)isUsingCronet; @end +#endif diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.m b/src/objective-c/GRPCClient/GRPCCall+Cronet.m index a732208e1f6..ba8d2c23db8 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.m +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.m @@ -18,8 +18,7 @@ #import "GRPCCall+Cronet.h" -const GRPCTransportId gGRPCCoreCronetId = "io.grpc.transport.core.cronet"; - +#ifdef GRPC_COMPILE_WITH_CRONET static BOOL useCronet = NO; static stream_engine *globalCronetEngine; @@ -39,3 +38,4 @@ static stream_engine *globalCronetEngine; } @end +#endif diff --git a/src/objective-c/GRPCClient/GRPCCall+GID.h b/src/objective-c/GRPCClient/GRPCCall+GID.h index 80e34ea98da..8293e92ebe9 100644 --- a/src/objective-c/GRPCClient/GRPCCall+GID.h +++ b/src/objective-c/GRPCClient/GRPCCall+GID.h @@ -17,7 +17,7 @@ */ #import "GRPCCall+OAuth2.h" -#import "GRPCCallLegacy.h" +#import "GRPCCall.h" #import diff --git a/src/objective-c/GRPCClient/GRPCCall+OAuth2.h b/src/objective-c/GRPCClient/GRPCCall+OAuth2.h index cf60c794f27..60cdc50bfda 100644 --- a/src/objective-c/GRPCClient/GRPCCall+OAuth2.h +++ b/src/objective-c/GRPCClient/GRPCCall+OAuth2.h @@ -16,9 +16,9 @@ * */ -#import "GRPCCallLegacy.h" +#import "GRPCCall.h" -@protocol GRPCAuthorizationProtocol; +#import "GRPCCallOptions.h" // Deprecated interface. Please use GRPCCallOptions instead. @interface GRPCCall (OAuth2) diff --git a/src/objective-c/GRPCClient/GRPCCall+Tests.h b/src/objective-c/GRPCClient/GRPCCall+Tests.h index af81eec6b82..edaa5ed582c 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Tests.h +++ b/src/objective-c/GRPCClient/GRPCCall+Tests.h @@ -16,7 +16,7 @@ * */ -#import "GRPCCallLegacy.h" +#import "GRPCCall.h" // Deprecated interface. Please use GRPCCallOptions instead. @interface GRPCCall (Tests) diff --git a/src/objective-c/GRPCClient/GRPCCall+Tests.m b/src/objective-c/GRPCClient/GRPCCall+Tests.m index 3a1dff38868..20f5cba4178 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Tests.m +++ b/src/objective-c/GRPCClient/GRPCCall+Tests.m @@ -18,7 +18,7 @@ #import "GRPCCall+Tests.h" -#import "private/GRPCCore/GRPCHost.h" +#import "private/GRPCHost.h" #import "GRPCCallOptions.h" diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 1c7a10048cf..d02ec601727 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -33,19 +33,134 @@ */ #import +#import -#import "GRPCCallOptions.h" -#import "GRPCDispatchable.h" -#import "GRPCTypes.h" +#include -// The legacy header is included for backwards compatibility. Some V1 API users are still using -// GRPCCall by importing GRPCCall.h header so we need this import. -#import "GRPCCallLegacy.h" +#include "GRPCCallOptions.h" NS_ASSUME_NONNULL_BEGIN +#pragma mark gRPC errors + +/** Domain of NSError objects produced by gRPC. */ +extern NSString *const kGRPCErrorDomain; + +/** + * gRPC error codes. + * Note that a few of these are never produced by the gRPC libraries, but are of general utility for + * server applications to produce. + */ +typedef NS_ENUM(NSUInteger, GRPCErrorCode) { + /** The operation was cancelled (typically by the caller). */ + GRPCErrorCodeCancelled = 1, + + /** + * Unknown error. Errors raised by APIs that do not return enough error information may be + * converted to this error. + */ + GRPCErrorCodeUnknown = 2, + + /** + * The client specified an invalid argument. Note that this differs from FAILED_PRECONDITION. + * INVALID_ARGUMENT indicates arguments that are problematic regardless of the state of the + * server (e.g., a malformed file name). + */ + GRPCErrorCodeInvalidArgument = 3, + + /** + * Deadline expired before operation could complete. For operations that change the state of the + * server, this error may be returned even if the operation has completed successfully. For + * example, a successful response from the server could have been delayed long enough for the + * deadline to expire. + */ + GRPCErrorCodeDeadlineExceeded = 4, + + /** Some requested entity (e.g., file or directory) was not found. */ + GRPCErrorCodeNotFound = 5, + + /** Some entity that we attempted to create (e.g., file or directory) already exists. */ + GRPCErrorCodeAlreadyExists = 6, + + /** + * The caller does not have permission to execute the specified operation. PERMISSION_DENIED isn't + * used for rejections caused by exhausting some resource (RESOURCE_EXHAUSTED is used instead for + * those errors). PERMISSION_DENIED doesn't indicate a failure to identify the caller + * (UNAUTHENTICATED is used instead for those errors). + */ + GRPCErrorCodePermissionDenied = 7, + + /** + * The request does not have valid authentication credentials for the operation (e.g. the caller's + * identity can't be verified). + */ + GRPCErrorCodeUnauthenticated = 16, + + /** Some resource has been exhausted, perhaps a per-user quota. */ + GRPCErrorCodeResourceExhausted = 8, + + /** + * The RPC was rejected because the server is not in a state required for the procedure's + * execution. For example, a directory to be deleted may be non-empty, etc. + * The client should not retry until the server state has been explicitly fixed (e.g. by + * performing another RPC). The details depend on the service being called, and should be found in + * the NSError's userInfo. + */ + GRPCErrorCodeFailedPrecondition = 9, + + /** + * The RPC was aborted, typically due to a concurrency issue like sequencer check failures, + * transaction aborts, etc. The client should retry at a higher-level (e.g., restarting a read- + * modify-write sequence). + */ + GRPCErrorCodeAborted = 10, + + /** + * The RPC was attempted past the valid range. E.g., enumerating past the end of a list. + * Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed if the system state + * changes. For example, an RPC to get elements of a list will generate INVALID_ARGUMENT if asked + * to return the element at a negative index, but it will generate OUT_OF_RANGE if asked to return + * the element at an index past the current size of the list. + */ + GRPCErrorCodeOutOfRange = 11, + + /** The procedure is not implemented or not supported/enabled in this server. */ + GRPCErrorCodeUnimplemented = 12, + + /** + * Internal error. Means some invariant expected by the server application or the gRPC library has + * been broken. + */ + GRPCErrorCodeInternal = 13, + + /** + * The server is currently unavailable. This is most likely a transient condition and may be + * corrected by retrying with a backoff. Note that it is not always safe to retry + * non-idempotent operations. + */ + GRPCErrorCodeUnavailable = 14, + + /** Unrecoverable data loss or corruption. */ + GRPCErrorCodeDataLoss = 15, +}; + +/** + * Keys used in |NSError|'s |userInfo| dictionary to store the response headers and trailers sent by + * the server. + */ +extern NSString *const kGRPCHeadersKey; +extern NSString *const kGRPCTrailersKey; + /** An object can implement this protocol to receive responses from server from a call. */ -@protocol GRPCResponseHandler +@protocol GRPCResponseHandler + +@required + +/** + * All the responses must be issued to a user-provided dispatch queue. This property specifies the + * dispatch queue to be used for issuing the notifications. + */ +@property(atomic, readonly) dispatch_queue_t dispatchQueue; @optional @@ -187,3 +302,114 @@ NS_ASSUME_NONNULL_BEGIN @end NS_ASSUME_NONNULL_END + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnullability-completeness" + +/** + * This interface is deprecated. Please use \a GRPCcall2. + * + * Represents a single gRPC remote call. + */ +@interface GRPCCall : GRXWriter + +- (instancetype)init NS_UNAVAILABLE; + +/** + * The container of the request headers of an RPC conforms to this protocol, which is a subset of + * NSMutableDictionary's interface. It will become a NSMutableDictionary later on. + * The keys of this container are the header names, which per the HTTP standard are case- + * insensitive. They are stored in lowercase (which is how HTTP/2 mandates them on the wire), and + * can only consist of ASCII characters. + * A header value is a NSString object (with only ASCII characters), unless the header name has the + * suffix "-bin", in which case the value has to be a NSData object. + */ +/** + * These HTTP headers will be passed to the server as part of this call. Each HTTP header is a + * name-value pair with string names and either string or binary values. + * + * The passed dictionary has to use NSString keys, corresponding to the header names. The value + * associated to each can be a NSString object or a NSData object. E.g.: + * + * call.requestHeaders = @{@"authorization": @"Bearer ..."}; + * + * call.requestHeaders[@"my-header-bin"] = someData; + * + * After the call is started, trying to modify this property is an error. + * + * The property is initialized to an empty NSMutableDictionary. + */ +@property(atomic, readonly) NSMutableDictionary *requestHeaders; + +/** + * This dictionary is populated with the HTTP headers received from the server. This happens before + * any response message is received from the server. It has the same structure as the request + * headers dictionary: Keys are NSString header names; names ending with the suffix "-bin" have a + * NSData value; the others have a NSString value. + * + * The value of this property is nil until all response headers are received, and will change before + * any of -writeValue: or -writesFinishedWithError: are sent to the writeable. + */ +@property(atomic, readonly) NSDictionary *responseHeaders; + +/** + * Same as responseHeaders, but populated with the HTTP trailers received from the server before the + * call finishes. + * + * The value of this property is nil until all response trailers are received, and will change + * before -writesFinishedWithError: is sent to the writeable. + */ +@property(atomic, readonly) NSDictionary *responseTrailers; + +/** + * The request writer has to write NSData objects into the provided Writeable. The server will + * receive each of those separately and in order as distinct messages. + * A gRPC call might not complete until the request writer finishes. On the other hand, the request + * finishing doesn't necessarily make the call to finish, as the server might continue sending + * messages to the response side of the call indefinitely (depending on the semantics of the + * specific remote method called). + * To finish a call right away, invoke cancel. + * host parameter should not contain the scheme (http:// or https://), only the name or IP addr + * and the port number, for example @"localhost:5050". + */ +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + requestsWriter:(GRXWriter *)requestWriter; + +/** + * Finishes the request side of this call, notifies the server that the RPC should be cancelled, and + * finishes the response side of the call with an error of code CANCELED. + */ +- (void)cancel; + +/** + * The following methods are deprecated. + */ ++ (void)setCallSafety:(GRPCCallSafety)callSafety host:(NSString *)host path:(NSString *)path; +@property(atomic, copy, readwrite) NSString *serverName; +@property NSTimeInterval timeout; +- (void)setResponseDispatchQueue:(dispatch_queue_t)queue; + +@end + +#pragma mark Backwards compatibiity + +/** This protocol is kept for backwards compatibility with existing code. */ +DEPRECATED_MSG_ATTRIBUTE("Use NSDictionary or NSMutableDictionary instead.") +@protocol GRPCRequestHeaders +@property(nonatomic, readonly) NSUInteger count; + +- (id)objectForKeyedSubscript:(id)key; +- (void)setObject:(id)obj forKeyedSubscript:(id)key; + +- (void)removeAllObjects; +- (void)removeObjectForKey:(id)key; +@end + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" +/** This is only needed for backwards-compatibility. */ +@interface NSMutableDictionary (GRPCRequestHeaders) +@end +#pragma clang diagnostic pop +#pragma clang diagnostic pop diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 73ee530ef2c..cd293cc8e59 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -17,86 +17,56 @@ */ #import "GRPCCall.h" - #import "GRPCCall+Interceptor.h" +#import "GRPCCall+OAuth2.h" #import "GRPCCallOptions.h" #import "GRPCInterceptor.h" -#import "private/GRPCTransport+Private.h" +#import +#import +#import +#import +#include +#include + +#import "private/GRPCCall+V2API.h" +#import "private/GRPCCallInternal.h" +#import "private/GRPCChannelPool.h" +#import "private/GRPCCompletionQueue.h" +#import "private/GRPCHost.h" +#import "private/GRPCRequestHeaders.h" +#import "private/GRPCWrappedCall.h" +#import "private/NSData+GRPC.h" +#import "private/NSDictionary+GRPC.h" +#import "private/NSError+GRPC.h" + +// At most 6 ops can be in an op batch for a client: SEND_INITIAL_METADATA, +// SEND_MESSAGE, SEND_CLOSE_FROM_CLIENT, RECV_INITIAL_METADATA, RECV_MESSAGE, +// and RECV_STATUS_ON_CLIENT. +NSInteger kMaxClientBatch = 6; NSString *const kGRPCHeadersKey = @"io.grpc.HeadersKey"; NSString *const kGRPCTrailersKey = @"io.grpc.TrailersKey"; +static NSMutableDictionary *callFlags; -NSString *const kGRPCErrorDomain = @"io.grpc"; - -/** - * The response dispatcher creates its own serial dispatch queue and target the queue to the - * dispatch queue of a user provided response handler. It removes the requirement of having to use - * serial dispatch queue in the user provided response handler. - */ -@interface GRPCResponseDispatcher : NSObject - -- (nullable instancetype)initWithResponseHandler:(id)responseHandler; - -@end +static NSString *const kAuthorizationHeader = @"authorization"; +static NSString *const kBearerPrefix = @"Bearer "; -@implementation GRPCResponseDispatcher { - id _responseHandler; - dispatch_queue_t _dispatchQueue; -} +const char *kCFStreamVarName = "grpc_cfstream"; -- (instancetype)initWithResponseHandler:(id)responseHandler { - if ((self = [super init])) { - _responseHandler = responseHandler; -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 - if (@available(iOS 8.0, macOS 10.10, *)) { - _dispatchQueue = dispatch_queue_create( - NULL, - dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); - } else { -#else - { -#endif - _dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); - } - dispatch_set_target_queue(_dispatchQueue, _responseHandler.dispatchQueue); - } +@interface GRPCCall () +// Make them read-write. +@property(atomic, strong) NSDictionary *responseHeaders; +@property(atomic, strong) NSDictionary *responseTrailers; - return self; -} - -- (dispatch_queue_t)dispatchQueue { - return _dispatchQueue; -} - -- (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata { - if ([_responseHandler respondsToSelector:@selector(didReceiveInitialMetadata:)]) { - [_responseHandler didReceiveInitialMetadata:initialMetadata]; - } -} - -- (void)didReceiveData:(id)data { - // For backwards compatibility with didReceiveRawMessage, if the user provided a response handler - // that handles didReceiveRawMesssage, we issue to that method instead - if ([_responseHandler respondsToSelector:@selector(didReceiveRawMessage:)]) { - [_responseHandler didReceiveRawMessage:data]; - } else if ([_responseHandler respondsToSelector:@selector(didReceiveData:)]) { - [_responseHandler didReceiveData:data]; - } -} - -- (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata - error:(nullable NSError *)error { - if ([_responseHandler respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { - [_responseHandler didCloseWithTrailingMetadata:trailingMetadata error:error]; - } -} +- (void)receiveNextMessages:(NSUInteger)numberOfMessages; -- (void)didWriteData { - if ([_responseHandler respondsToSelector:@selector(didWriteData)]) { - [_responseHandler didWriteData]; - } -} +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + callSafety:(GRPCCallSafety)safety + requestsWriter:(GRXWriter *)requestsWriter + callOptions:(GRPCCallOptions *)callOptions + writeDone:(void (^)(void))writeDone; @end @@ -170,39 +140,54 @@ NSString *const kGRPCErrorDomain = @"io.grpc"; } _responseHandler = responseHandler; - GRPCResponseDispatcher *dispatcher = - [[GRPCResponseDispatcher alloc] initWithResponseHandler:_responseHandler]; - NSMutableArray> *interceptorFactories; - if (_actualCallOptions.interceptorFactories != nil) { - interceptorFactories = - [NSMutableArray arrayWithArray:_actualCallOptions.interceptorFactories]; - } else { - interceptorFactories = [NSMutableArray array]; - } + // Initialize the interceptor chain + + // First initialize the internal call + GRPCCall2Internal *internalCall = [[GRPCCall2Internal alloc] init]; + id nextInterceptor = internalCall; + GRPCInterceptorManager *nextManager = nil; + + // Then initialize the global interceptor, if applicable id globalInterceptorFactory = [GRPCCall2 globalInterceptorFactory]; - if (globalInterceptorFactory != nil) { - [interceptorFactories addObject:globalInterceptorFactory]; + if (globalInterceptorFactory) { + GRPCInterceptorManager *manager = + [[GRPCInterceptorManager alloc] initWithNextInterceptor:nextInterceptor]; + GRPCInterceptor *interceptor = + [globalInterceptorFactory createInterceptorWithManager:manager]; + if (interceptor != nil) { + [internalCall setResponseHandler:interceptor]; + nextInterceptor = interceptor; + nextManager = manager; + } } - // continuously create interceptor until one is successfully created - while (_firstInterceptor == nil) { - if (interceptorFactories.count == 0) { - _firstInterceptor = [[GRPCTransportManager alloc] initWithTransportId:_callOptions.transport - previousInterceptor:dispatcher]; - break; + + // Finally initialize the interceptors in the chain + NSArray *interceptorFactories = _actualCallOptions.interceptorFactories; + for (int i = (int)interceptorFactories.count - 1; i >= 0; i--) { + GRPCInterceptorManager *manager = + [[GRPCInterceptorManager alloc] initWithNextInterceptor:nextInterceptor]; + GRPCInterceptor *interceptor = [interceptorFactories[i] createInterceptorWithManager:manager]; + NSAssert(interceptor != nil, @"Failed to create interceptor from factory: %@", + interceptorFactories[i]); + if (interceptor == nil) { + NSLog(@"Failed to create interceptor from factory: %@", interceptorFactories[i]); + continue; + } + if (nextManager == nil) { + [internalCall setResponseHandler:interceptor]; } else { - _firstInterceptor = - [[GRPCInterceptorManager alloc] initWithFactories:interceptorFactories - previousInterceptor:dispatcher - transportId:_callOptions.transport]; - if (_firstInterceptor == nil) { - [interceptorFactories removeObjectAtIndex:0]; - } + [nextManager setPreviousInterceptor:interceptor]; } + nextInterceptor = interceptor; + nextManager = manager; } - NSAssert(_firstInterceptor != nil, @"Failed to create interceptor or transport."); - if (_firstInterceptor == nil) { - NSLog(@"Failed to create interceptor or transport."); + if (nextManager == nil) { + [internalCall setResponseHandler:_responseHandler]; + } else { + [nextManager setPreviousInterceptor:_responseHandler]; } + + _firstInterceptor = nextInterceptor; } return self; @@ -215,42 +200,696 @@ NSString *const kGRPCErrorDomain = @"io.grpc"; } - (void)start { - id copiedFirstInterceptor = _firstInterceptor; - GRPCRequestOptions *requestOptions = _requestOptions; - GRPCCallOptions *callOptions = _actualCallOptions; - dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ - [copiedFirstInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; - }); + id copiedFirstInterceptor; + @synchronized(self) { + copiedFirstInterceptor = _firstInterceptor; + } + GRPCRequestOptions *requestOptions = [_requestOptions copy]; + GRPCCallOptions *callOptions = [_actualCallOptions copy]; + if ([copiedFirstInterceptor respondsToSelector:@selector(startWithRequestOptions:callOptions:)]) { + dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ + [copiedFirstInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; + }); + } } - (void)cancel { - id copiedFirstInterceptor = _firstInterceptor; - if (copiedFirstInterceptor != nil) { - dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ + id copiedFirstInterceptor; + @synchronized(self) { + copiedFirstInterceptor = _firstInterceptor; + } + if ([copiedFirstInterceptor respondsToSelector:@selector(cancel)]) { + dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ [copiedFirstInterceptor cancel]; }); } } - (void)writeData:(id)data { - id copiedFirstInterceptor = _firstInterceptor; - dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ - [copiedFirstInterceptor writeData:data]; - }); + id copiedFirstInterceptor; + @synchronized(self) { + copiedFirstInterceptor = _firstInterceptor; + } + if ([copiedFirstInterceptor respondsToSelector:@selector(writeData:)]) { + dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ + [copiedFirstInterceptor writeData:data]; + }); + } } - (void)finish { - id copiedFirstInterceptor = _firstInterceptor; - dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ - [copiedFirstInterceptor finish]; + id copiedFirstInterceptor; + @synchronized(self) { + copiedFirstInterceptor = _firstInterceptor; + } + if ([copiedFirstInterceptor respondsToSelector:@selector(finish)]) { + dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ + [copiedFirstInterceptor finish]; + }); + } +} + +- (void)receiveNextMessages:(NSUInteger)numberOfMessages { + id copiedFirstInterceptor; + @synchronized(self) { + copiedFirstInterceptor = _firstInterceptor; + } + if ([copiedFirstInterceptor respondsToSelector:@selector(receiveNextMessages:)]) { + dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ + [copiedFirstInterceptor receiveNextMessages:numberOfMessages]; + }); + } +} + +@end + +// The following methods of a C gRPC call object aren't reentrant, and thus +// calls to them must be serialized: +// - start_batch +// - destroy +// +// start_batch with a SEND_MESSAGE argument can only be called after the +// OP_COMPLETE event for any previous write is received. This is achieved by +// pausing the requests writer immediately every time it writes a value, and +// resuming it again when OP_COMPLETE is received. +// +// Similarly, start_batch with a RECV_MESSAGE argument can only be called after +// the OP_COMPLETE event for any previous read is received.This is easier to +// enforce, as we're writing the received messages into the writeable: +// start_batch is enqueued once upon receiving the OP_COMPLETE event for the +// RECV_METADATA batch, and then once after receiving each OP_COMPLETE event for +// each RECV_MESSAGE batch. +@implementation GRPCCall { + dispatch_queue_t _callQueue; + + NSString *_host; + NSString *_path; + GRPCCallSafety _callSafety; + GRPCCallOptions *_callOptions; + GRPCWrappedCall *_wrappedCall; + + // The C gRPC library has less guarantees on the ordering of events than we + // do. Particularly, in the face of errors, there's no ordering guarantee at + // all. This wrapper over our actual writeable ensures thread-safety and + // correct ordering. + GRXConcurrentWriteable *_responseWriteable; + + // The network thread wants the requestWriter to resume (when the server is ready for more input), + // or to stop (on errors), concurrently with user threads that want to start it, pause it or stop + // it. Because a writer isn't thread-safe, we'll synchronize those operations on it. + // We don't use a dispatch queue for that purpose, because the writer can call writeValue: or + // writesFinishedWithError: on this GRPCCall as part of those operations. We want to be able to + // pause the writer immediately on writeValue:, so we need our locking to be recursive. + GRXWriter *_requestWriter; + + // To create a retain cycle when a call is started, up until it finishes. See + // |startWithWriteable:| and |finishWithError:|. This saves users from having to retain a + // reference to the call object if all they're interested in is the handler being executed when + // the response arrives. + GRPCCall *_retainSelf; + + GRPCRequestHeaders *_requestHeaders; + + // In the case that the call is a unary call (i.e. the writer to GRPCCall is of type + // GRXImmediateSingleWriter), GRPCCall will delay sending ops (not send them to C core + // immediately) and buffer them into a batch _unaryOpBatch. The batch is sent to C core when + // the SendClose op is added. + BOOL _unaryCall; + NSMutableArray *_unaryOpBatch; + + // The dispatch queue to be used for enqueuing responses to user. Defaulted to the main dispatch + // queue + dispatch_queue_t _responseQueue; + + // The OAuth2 token fetched from a token provider. + NSString *_fetchedOauth2AccessToken; + + // The callback to be called when a write message op is done. + void (^_writeDone)(void); + + // Indicate a read request to core is pending. + BOOL _pendingCoreRead; + + // Indicate pending read message request from user. + NSUInteger _pendingReceiveNextMessages; +} + +@synthesize state = _state; + ++ (void)initialize { + // Guarantees the code in {} block is invoked only once. See ref at: + // https://developer.apple.com/documentation/objectivec/nsobject/1418639-initialize?language=objc + if (self == [GRPCCall self]) { + grpc_init(); + callFlags = [NSMutableDictionary dictionary]; + } +} + ++ (void)setCallSafety:(GRPCCallSafety)callSafety host:(NSString *)host path:(NSString *)path { + if (host.length == 0 || path.length == 0) { + return; + } + NSString *hostAndPath = [NSString stringWithFormat:@"%@/%@", host, path]; + @synchronized(callFlags) { + switch (callSafety) { + case GRPCCallSafetyDefault: + callFlags[hostAndPath] = @0; + break; + case GRPCCallSafetyIdempotentRequest: + callFlags[hostAndPath] = @GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; + break; + case GRPCCallSafetyCacheableRequest: + callFlags[hostAndPath] = @GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; + break; + default: + break; + } + } +} + ++ (uint32_t)callFlagsForHost:(NSString *)host path:(NSString *)path { + NSString *hostAndPath = [NSString stringWithFormat:@"%@/%@", host, path]; + @synchronized(callFlags) { + return [callFlags[hostAndPath] intValue]; + } +} + +// Designated initializer +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + requestsWriter:(GRXWriter *)requestWriter { + return [self initWithHost:host + path:path + callSafety:GRPCCallSafetyDefault + requestsWriter:requestWriter + callOptions:nil]; +} + +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + callSafety:(GRPCCallSafety)safety + requestsWriter:(GRXWriter *)requestsWriter + callOptions:(GRPCCallOptions *)callOptions { + return [self initWithHost:host + path:path + callSafety:safety + requestsWriter:requestsWriter + callOptions:callOptions + writeDone:nil]; +} + +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + callSafety:(GRPCCallSafety)safety + requestsWriter:(GRXWriter *)requestsWriter + callOptions:(GRPCCallOptions *)callOptions + writeDone:(void (^)(void))writeDone { + // Purposely using pointer rather than length (host.length == 0) for backwards compatibility. + NSAssert(host != nil && path != nil, @"Neither host nor path can be nil."); + NSAssert(safety <= GRPCCallSafetyCacheableRequest, @"Invalid call safety value."); + NSAssert(requestsWriter.state == GRXWriterStateNotStarted, + @"The requests writer can't be already started."); + if (!host || !path) { + return nil; + } + if (safety > GRPCCallSafetyCacheableRequest) { + return nil; + } + if (requestsWriter.state != GRXWriterStateNotStarted) { + return nil; + } + + if ((self = [super init])) { + _host = [host copy]; + _path = [path copy]; + _callSafety = safety; + _callOptions = [callOptions copy]; + + // Serial queue to invoke the non-reentrant methods of the grpc_call object. + _callQueue = dispatch_queue_create("io.grpc.call", DISPATCH_QUEUE_SERIAL); + + _requestWriter = requestsWriter; + _requestHeaders = [[GRPCRequestHeaders alloc] initWithCall:self]; + _writeDone = writeDone; + + if ([requestsWriter isKindOfClass:[GRXImmediateSingleWriter class]]) { + _unaryCall = YES; + _unaryOpBatch = [NSMutableArray arrayWithCapacity:kMaxClientBatch]; + } + + _responseQueue = dispatch_get_main_queue(); + + // do not start a read until initial metadata is received + _pendingReceiveNextMessages = 0; + _pendingCoreRead = YES; + } + return self; +} + +- (void)setResponseDispatchQueue:(dispatch_queue_t)queue { + @synchronized(self) { + if (_state != GRXWriterStateNotStarted) { + return; + } + _responseQueue = queue; + } +} + +#pragma mark Finish + +// This function should support being called within a @synchronized(self) block in another function +// Should not manipulate _requestWriter for deadlock prevention. +- (void)finishWithError:(NSError *)errorOrNil { + @synchronized(self) { + if (_state == GRXWriterStateFinished) { + return; + } + _state = GRXWriterStateFinished; + + if (errorOrNil) { + [_responseWriteable cancelWithError:errorOrNil]; + } else { + [_responseWriteable enqueueSuccessfulCompletion]; + } + + // If the call isn't retained anywhere else, it can be deallocated now. + _retainSelf = nil; + } +} + +- (void)cancel { + @synchronized(self) { + if (_state == GRXWriterStateFinished) { + return; + } + [self finishWithError:[NSError + errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeCancelled + userInfo:@{NSLocalizedDescriptionKey : @"Canceled by app"}]]; + [_wrappedCall cancel]; + } + _requestWriter.state = GRXWriterStateFinished; +} + +- (void)dealloc { + __block GRPCWrappedCall *wrappedCall = _wrappedCall; + dispatch_async(_callQueue, ^{ + wrappedCall = nil; + }); +} + +#pragma mark Read messages + +// Only called from the call queue. +// The handler will be called from the network queue. +- (void)startReadWithHandler:(void (^)(grpc_byte_buffer *))handler { + // TODO(jcanizales): Add error handlers for async failures + [_wrappedCall startBatchWithOperations:@[ [[GRPCOpRecvMessage alloc] initWithHandler:handler] ]]; +} + +// Called initially from the network queue once response headers are received, +// then "recursively" from the responseWriteable queue after each response from the +// server has been written. +// If the call is currently paused, this is a noop. Restarting the call will invoke this +// method. +// TODO(jcanizales): Rename to readResponseIfNotPaused. +- (void)maybeStartNextRead { + @synchronized(self) { + if (_state != GRXWriterStateStarted) { + return; + } + if (_callOptions.flowControlEnabled && (_pendingCoreRead || _pendingReceiveNextMessages == 0)) { + return; + } + _pendingCoreRead = YES; + _pendingReceiveNextMessages--; + } + + dispatch_async(_callQueue, ^{ + __weak GRPCCall *weakSelf = self; + [self startReadWithHandler:^(grpc_byte_buffer *message) { + if (message == NULL) { + // No more messages from the server + return; + } + __strong GRPCCall *strongSelf = weakSelf; + if (strongSelf == nil) { + grpc_byte_buffer_destroy(message); + return; + } + NSData *data = [NSData grpc_dataWithByteBuffer:message]; + grpc_byte_buffer_destroy(message); + if (!data) { + // The app doesn't have enough memory to hold the server response. We + // don't want to throw, because the app shouldn't crash for a behavior + // that's on the hands of any server to have. Instead we finish and ask + // the server to cancel. + @synchronized(strongSelf) { + strongSelf->_pendingCoreRead = NO; + [strongSelf + finishWithError:[NSError errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeResourceExhausted + userInfo:@{ + NSLocalizedDescriptionKey : + @"Client does not have enough memory to " + @"hold the server response." + }]]; + [strongSelf->_wrappedCall cancel]; + } + strongSelf->_requestWriter.state = GRXWriterStateFinished; + } else { + @synchronized(strongSelf) { + [strongSelf->_responseWriteable enqueueValue:data + completionHandler:^{ + __strong GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + @synchronized(strongSelf) { + strongSelf->_pendingCoreRead = NO; + [strongSelf maybeStartNextRead]; + } + } + }]; + } + } + }]; + }); +} + +#pragma mark Send headers + +- (void)sendHeaders { + // TODO (mxyan): Remove after deprecated methods are removed + uint32_t callSafetyFlags = 0; + switch (_callSafety) { + case GRPCCallSafetyDefault: + callSafetyFlags = 0; + break; + case GRPCCallSafetyIdempotentRequest: + callSafetyFlags = GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; + break; + case GRPCCallSafetyCacheableRequest: + callSafetyFlags = GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; + break; + } + + NSMutableDictionary *headers = [_requestHeaders mutableCopy]; + NSString *fetchedOauth2AccessToken; + @synchronized(self) { + fetchedOauth2AccessToken = _fetchedOauth2AccessToken; + } + if (fetchedOauth2AccessToken != nil) { + headers[@"authorization"] = [kBearerPrefix stringByAppendingString:fetchedOauth2AccessToken]; + } else if (_callOptions.oauth2AccessToken != nil) { + headers[@"authorization"] = + [kBearerPrefix stringByAppendingString:_callOptions.oauth2AccessToken]; + } + + // TODO(jcanizales): Add error handlers for async failures + GRPCOpSendMetadata *op = [[GRPCOpSendMetadata alloc] + initWithMetadata:headers + flags:callSafetyFlags + handler:nil]; // No clean-up needed after SEND_INITIAL_METADATA + dispatch_async(_callQueue, ^{ + if (!self->_unaryCall) { + [self->_wrappedCall startBatchWithOperations:@[ op ]]; + } else { + [self->_unaryOpBatch addObject:op]; + } }); } - (void)receiveNextMessages:(NSUInteger)numberOfMessages { - id copiedFirstInterceptor = _firstInterceptor; - dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ - [copiedFirstInterceptor receiveNextMessages:numberOfMessages]; + if (numberOfMessages == 0) { + return; + } + @synchronized(self) { + _pendingReceiveNextMessages += numberOfMessages; + + if (_state != GRXWriterStateStarted || !_callOptions.flowControlEnabled) { + return; + } + [self maybeStartNextRead]; + } +} + +#pragma mark GRXWriteable implementation + +// Only called from the call queue. The error handler will be called from the +// network queue if the write didn't succeed. +// If the call is a unary call, parameter \a errorHandler will be ignored and +// the error handler of GRPCOpSendClose will be executed in case of error. +- (void)writeMessage:(NSData *)message withErrorHandler:(void (^)(void))errorHandler { + __weak GRPCCall *weakSelf = self; + void (^resumingHandler)(void) = ^{ + // Resume the request writer. + GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + strongSelf->_requestWriter.state = GRXWriterStateStarted; + if (strongSelf->_writeDone) { + strongSelf->_writeDone(); + } + } + }; + GRPCOpSendMessage *op = + [[GRPCOpSendMessage alloc] initWithMessage:message handler:resumingHandler]; + if (!_unaryCall) { + [_wrappedCall startBatchWithOperations:@[ op ] errorHandler:errorHandler]; + } else { + // Ignored errorHandler since it is the same as the one for GRPCOpSendClose. + // TODO (mxyan): unify the error handlers of all Ops into a single closure. + [_unaryOpBatch addObject:op]; + } +} + +- (void)writeValue:(id)value { + NSAssert([value isKindOfClass:[NSData class]], @"value must be of type NSData"); + + @synchronized(self) { + if (_state == GRXWriterStateFinished) { + return; + } + } + + // Pause the input and only resume it when the C layer notifies us that writes + // can proceed. + _requestWriter.state = GRXWriterStatePaused; + + dispatch_async(_callQueue, ^{ + // Write error is not processed here. It is handled by op batch of GRPC_OP_RECV_STATUS_ON_CLIENT + [self writeMessage:value withErrorHandler:nil]; + }); +} + +// Only called from the call queue. The error handler will be called from the +// network queue if the requests stream couldn't be closed successfully. +- (void)finishRequestWithErrorHandler:(void (^)(void))errorHandler { + if (!_unaryCall) { + [_wrappedCall startBatchWithOperations:@[ [[GRPCOpSendClose alloc] init] ] + errorHandler:errorHandler]; + } else { + [_unaryOpBatch addObject:[[GRPCOpSendClose alloc] init]]; + [_wrappedCall startBatchWithOperations:_unaryOpBatch errorHandler:errorHandler]; + } +} + +- (void)writesFinishedWithError:(NSError *)errorOrNil { + if (errorOrNil) { + [self cancel]; + } else { + dispatch_async(_callQueue, ^{ + // EOS error is not processed here. It is handled by op batch of GRPC_OP_RECV_STATUS_ON_CLIENT + [self finishRequestWithErrorHandler:nil]; + }); + } +} + +#pragma mark Invoke + +// Both handlers will eventually be called, from the network queue. Writes can start immediately +// after this. +// The first one (headersHandler), when the response headers are received. +// The second one (completionHandler), whenever the RPC finishes for any reason. +- (void)invokeCallWithHeadersHandler:(void (^)(NSDictionary *))headersHandler + completionHandler:(void (^)(NSError *, NSDictionary *))completionHandler { + dispatch_async(_callQueue, ^{ + // TODO(jcanizales): Add error handlers for async failures + [self->_wrappedCall + startBatchWithOperations:@[ [[GRPCOpRecvMetadata alloc] initWithHandler:headersHandler] ]]; + [self->_wrappedCall + startBatchWithOperations:@[ [[GRPCOpRecvStatus alloc] initWithHandler:completionHandler] ]]; }); } +- (void)invokeCall { + __weak GRPCCall *weakSelf = self; + [self invokeCallWithHeadersHandler:^(NSDictionary *headers) { + // Response headers received. + __strong GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + @synchronized(strongSelf) { + // it is ok to set nil because headers are only received once + strongSelf.responseHeaders = nil; + // copy the header so that the GRPCOpRecvMetadata object may be dealloc'ed + NSDictionary *copiedHeaders = + [[NSDictionary alloc] initWithDictionary:headers copyItems:YES]; + strongSelf.responseHeaders = copiedHeaders; + strongSelf->_pendingCoreRead = NO; + [strongSelf maybeStartNextRead]; + } + } + } + completionHandler:^(NSError *error, NSDictionary *trailers) { + __strong GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + strongSelf.responseTrailers = trailers; + + if (error) { + NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; + if (error.userInfo) { + [userInfo addEntriesFromDictionary:error.userInfo]; + } + userInfo[kGRPCTrailersKey] = strongSelf.responseTrailers; + // Since gRPC core does not guarantee the headers block being called before this block, + // responseHeaders might be nil. + userInfo[kGRPCHeadersKey] = strongSelf.responseHeaders; + error = [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo]; + } + [strongSelf finishWithError:error]; + strongSelf->_requestWriter.state = GRXWriterStateFinished; + } + }]; +} + +#pragma mark GRXWriter implementation + +// Lock acquired inside startWithWriteable: +- (void)startCallWithWriteable:(id)writeable { + @synchronized(self) { + if (_state == GRXWriterStateFinished) { + return; + } + + _responseWriteable = + [[GRXConcurrentWriteable alloc] initWithWriteable:writeable dispatchQueue:_responseQueue]; + + GRPCPooledChannel *channel = + [[GRPCChannelPool sharedInstance] channelWithHost:_host callOptions:_callOptions]; + _wrappedCall = [channel wrappedCallWithPath:_path + completionQueue:[GRPCCompletionQueue completionQueue] + callOptions:_callOptions]; + + if (_wrappedCall == nil) { + [self finishWithError:[NSError errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeUnavailable + userInfo:@{ + NSLocalizedDescriptionKey : + @"Failed to create call or channel." + }]]; + return; + } + + [self sendHeaders]; + [self invokeCall]; + } + + // Now that the RPC has been initiated, request writes can start. + [_requestWriter startWithWriteable:self]; +} + +- (void)startWithWriteable:(id)writeable { + id tokenProvider = nil; + @synchronized(self) { + _state = GRXWriterStateStarted; + + // Create a retain cycle so that this instance lives until the RPC finishes (or is cancelled). + // This makes RPCs in which the call isn't externally retained possible (as long as it is + // started before being autoreleased). Care is taken not to retain self strongly in any of the + // blocks used in this implementation, so that the life of the instance is determined by this + // retain cycle. + _retainSelf = self; + + if (_callOptions == nil) { + GRPCMutableCallOptions *callOptions = [[GRPCHost callOptionsForHost:_host] mutableCopy]; + if (_serverName.length != 0) { + callOptions.serverAuthority = _serverName; + } + if (_timeout > 0) { + callOptions.timeout = _timeout; + } + uint32_t callFlags = [GRPCCall callFlagsForHost:_host path:_path]; + if (callFlags != 0) { + if (callFlags == GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) { + _callSafety = GRPCCallSafetyIdempotentRequest; + } else if (callFlags == GRPC_INITIAL_METADATA_CACHEABLE_REQUEST) { + _callSafety = GRPCCallSafetyCacheableRequest; + } + } + + id tokenProvider = self.tokenProvider; + if (tokenProvider != nil) { + callOptions.authTokenProvider = tokenProvider; + } + _callOptions = callOptions; + } + + NSAssert(_callOptions.authTokenProvider == nil || _callOptions.oauth2AccessToken == nil, + @"authTokenProvider and oauth2AccessToken cannot be set at the same time"); + + tokenProvider = _callOptions.authTokenProvider; + } + + if (tokenProvider != nil) { + __weak typeof(self) weakSelf = self; + [tokenProvider getTokenWithHandler:^(NSString *token) { + __strong typeof(self) strongSelf = weakSelf; + if (strongSelf) { + BOOL startCall = NO; + @synchronized(strongSelf) { + if (strongSelf->_state != GRXWriterStateFinished) { + startCall = YES; + if (token) { + strongSelf->_fetchedOauth2AccessToken = [token copy]; + } + } + } + if (startCall) { + [strongSelf startCallWithWriteable:writeable]; + } + } + }]; + } else { + [self startCallWithWriteable:writeable]; + } +} + +- (void)setState:(GRXWriterState)newState { + @synchronized(self) { + // Manual transitions are only allowed from the started or paused states. + if (_state == GRXWriterStateNotStarted || _state == GRXWriterStateFinished) { + return; + } + + switch (newState) { + case GRXWriterStateFinished: + _state = newState; + // Per GRXWriter's contract, setting the state to Finished manually + // means one doesn't wish the writeable to be messaged anymore. + [_responseWriteable cancelSilently]; + _responseWriteable = nil; + return; + case GRXWriterStatePaused: + _state = newState; + return; + case GRXWriterStateStarted: + if (_state == GRXWriterStatePaused) { + _state = newState; + [self maybeStartNextRead]; + } + return; + case GRXWriterStateNotStarted: + return; + } + } +} + @end diff --git a/src/objective-c/GRPCClient/GRPCCallLegacy.h b/src/objective-c/GRPCClient/GRPCCallLegacy.h deleted file mode 100644 index 51dd7da3440..00000000000 --- a/src/objective-c/GRPCClient/GRPCCallLegacy.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/** - * This is the legacy interface of this gRPC library. This API is deprecated and users should use - * the API in GRPCCall.h. This API exists solely for the purpose of backwards compatibility. - */ - -#import -#import "GRPCTypes.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnullability-completeness" - -/** - * This interface is deprecated. Please use \a GRPCCall2. - * - * Represents a single gRPC remote call. - */ -@interface GRPCCall : GRXWriter - -- (instancetype)init NS_UNAVAILABLE; - -/** - * The container of the request headers of an RPC conforms to this protocol, which is a subset of - * NSMutableDictionary's interface. It will become a NSMutableDictionary later on. - * The keys of this container are the header names, which per the HTTP standard are case- - * insensitive. They are stored in lowercase (which is how HTTP/2 mandates them on the wire), and - * can only consist of ASCII characters. - * A header value is a NSString object (with only ASCII characters), unless the header name has the - * suffix "-bin", in which case the value has to be a NSData object. - */ -/** - * These HTTP headers will be passed to the server as part of this call. Each HTTP header is a - * name-value pair with string names and either string or binary values. - * - * The passed dictionary has to use NSString keys, corresponding to the header names. The value - * associated to each can be a NSString object or a NSData object. E.g.: - * - * call.requestHeaders = @{@"authorization": @"Bearer ..."}; - * - * call.requestHeaders[@"my-header-bin"] = someData; - * - * After the call is started, trying to modify this property is an error. - * - * The property is initialized to an empty NSMutableDictionary. - */ -@property(atomic, readonly) NSMutableDictionary *requestHeaders; - -/** - * This dictionary is populated with the HTTP headers received from the server. This happens before - * any response message is received from the server. It has the same structure as the request - * headers dictionary: Keys are NSString header names; names ending with the suffix "-bin" have a - * NSData value; the others have a NSString value. - * - * The value of this property is nil until all response headers are received, and will change before - * any of -writeValue: or -writesFinishedWithError: are sent to the writeable. - */ -@property(atomic, readonly) NSDictionary *responseHeaders; - -/** - * Same as responseHeaders, but populated with the HTTP trailers received from the server before the - * call finishes. - * - * The value of this property is nil until all response trailers are received, and will change - * before -writesFinishedWithError: is sent to the writeable. - */ -@property(atomic, readonly) NSDictionary *responseTrailers; - -/** - * The request writer has to write NSData objects into the provided Writeable. The server will - * receive each of those separately and in order as distinct messages. - * A gRPC call might not complete until the request writer finishes. On the other hand, the request - * finishing doesn't necessarily make the call to finish, as the server might continue sending - * messages to the response side of the call indefinitely (depending on the semantics of the - * specific remote method called). - * To finish a call right away, invoke cancel. - * host parameter should not contain the scheme (http:// or https://), only the name or IP addr - * and the port number, for example @"localhost:5050". - */ -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - requestsWriter:(GRXWriter *)requestWriter; - -/** - * Finishes the request side of this call, notifies the server that the RPC should be cancelled, and - * finishes the response side of the call with an error of code CANCELED. - */ -- (void)cancel; - -/** - * The following methods are deprecated. - */ -+ (void)setCallSafety:(GRPCCallSafety)callSafety host:(NSString *)host path:(NSString *)path; -@property(atomic, copy, readwrite) NSString *serverName; -@property NSTimeInterval timeout; -- (void)setResponseDispatchQueue:(dispatch_queue_t)queue; - -@end - -#pragma mark Backwards compatibiity - -/** This protocol is kept for backwards compatibility with existing code. */ -DEPRECATED_MSG_ATTRIBUTE("Use NSDictionary or NSMutableDictionary instead.") -@protocol GRPCRequestHeaders -@property(nonatomic, readonly) NSUInteger count; - -- (id)objectForKeyedSubscript:(id)key; -- (void)setObject:(id)obj forKeyedSubscript:(id)key; - -- (void)removeAllObjects; -- (void)removeObjectForKey:(id)key; -@end - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" -/** This is only needed for backwards-compatibility. */ -@interface NSMutableDictionary (GRPCRequestHeaders) -@end -#pragma clang diagnostic pop -#pragma clang diagnostic pop diff --git a/src/objective-c/GRPCClient/GRPCCallLegacy.m b/src/objective-c/GRPCClient/GRPCCallLegacy.m deleted file mode 100644 index d06048c3a89..00000000000 --- a/src/objective-c/GRPCClient/GRPCCallLegacy.m +++ /dev/null @@ -1,677 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "GRPCCallLegacy.h" - -#import "GRPCCall+OAuth2.h" -#import "GRPCCallOptions.h" -#import "GRPCTypes.h" - -#import "private/GRPCCore/GRPCChannelPool.h" -#import "private/GRPCCore/GRPCCompletionQueue.h" -#import "private/GRPCCore/GRPCHost.h" -#import "private/GRPCCore/GRPCWrappedCall.h" -#import "private/GRPCCore/NSData+GRPC.h" - -#import -#import -#import -#import - -#include - -const char *kCFStreamVarName = "grpc_cfstream"; -static NSMutableDictionary *callFlags; - -// At most 6 ops can be in an op batch for a client: SEND_INITIAL_METADATA, -// SEND_MESSAGE, SEND_CLOSE_FROM_CLIENT, RECV_INITIAL_METADATA, RECV_MESSAGE, -// and RECV_STATUS_ON_CLIENT. -NSInteger kMaxClientBatch = 6; - -static NSString *const kAuthorizationHeader = @"authorization"; -static NSString *const kBearerPrefix = @"Bearer "; - -@interface GRPCCall () -// Make them read-write. -@property(atomic, strong) NSDictionary *responseHeaders; -@property(atomic, strong) NSDictionary *responseTrailers; - -- (void)receiveNextMessages:(NSUInteger)numberOfMessages; - -@end - -// The following methods of a C gRPC call object aren't reentrant, and thus -// calls to them must be serialized: -// - start_batch -// - destroy -// -// start_batch with a SEND_MESSAGE argument can only be called after the -// OP_COMPLETE event for any previous write is received. This is achieved by -// pausing the requests writer immediately every time it writes a value, and -// resuming it again when OP_COMPLETE is received. -// -// Similarly, start_batch with a RECV_MESSAGE argument can only be called after -// the OP_COMPLETE event for any previous read is received.This is easier to -// enforce, as we're writing the received messages into the writeable: -// start_batch is enqueued once upon receiving the OP_COMPLETE event for the -// RECV_METADATA batch, and then once after receiving each OP_COMPLETE event for -// each RECV_MESSAGE batch. -@implementation GRPCCall { - dispatch_queue_t _callQueue; - - NSString *_host; - NSString *_path; - GRPCCallSafety _callSafety; - GRPCCallOptions *_callOptions; - GRPCWrappedCall *_wrappedCall; - - // The C gRPC library has less guarantees on the ordering of events than we - // do. Particularly, in the face of errors, there's no ordering guarantee at - // all. This wrapper over our actual writeable ensures thread-safety and - // correct ordering. - GRXConcurrentWriteable *_responseWriteable; - - // The network thread wants the requestWriter to resume (when the server is ready for more input), - // or to stop (on errors), concurrently with user threads that want to start it, pause it or stop - // it. Because a writer isn't thread-safe, we'll synchronize those operations on it. - // We don't use a dispatch queue for that purpose, because the writer can call writeValue: or - // writesFinishedWithError: on this GRPCCall as part of those operations. We want to be able to - // pause the writer immediately on writeValue:, so we need our locking to be recursive. - GRXWriter *_requestWriter; - - // To create a retain cycle when a call is started, up until it finishes. See - // |startWithWriteable:| and |finishWithError:|. This saves users from having to retain a - // reference to the call object if all they're interested in is the handler being executed when - // the response arrives. - GRPCCall *_retainSelf; - - GRPCRequestHeaders *_requestHeaders; - - // In the case that the call is a unary call (i.e. the writer to GRPCCall is of type - // GRXImmediateSingleWriter), GRPCCall will delay sending ops (not send them to C core - // immediately) and buffer them into a batch _unaryOpBatch. The batch is sent to C core when - // the SendClose op is added. - BOOL _unaryCall; - NSMutableArray *_unaryOpBatch; - - // The dispatch queue to be used for enqueuing responses to user. Defaulted to the main dispatch - // queue - dispatch_queue_t _responseQueue; - - // The OAuth2 token fetched from a token provider. - NSString *_fetchedOauth2AccessToken; - - // The callback to be called when a write message op is done. - void (^_writeDone)(void); - - // Indicate a read request to core is pending. - BOOL _pendingCoreRead; - - // Indicate pending read message request from user. - NSUInteger _pendingReceiveNextMessages; -} - -@synthesize state = _state; - -+ (void)initialize { - // Guarantees the code in {} block is invoked only once. See ref at: - // https://developer.apple.com/documentation/objectivec/nsobject/1418639-initialize?language=objc - if (self == [GRPCCall self]) { - grpc_init(); - callFlags = [NSMutableDictionary dictionary]; - } -} - -+ (void)setCallSafety:(GRPCCallSafety)callSafety host:(NSString *)host path:(NSString *)path { - if (host.length == 0 || path.length == 0) { - return; - } - NSString *hostAndPath = [NSString stringWithFormat:@"%@/%@", host, path]; - @synchronized(callFlags) { - switch (callSafety) { - case GRPCCallSafetyDefault: - callFlags[hostAndPath] = @0; - break; - case GRPCCallSafetyIdempotentRequest: - callFlags[hostAndPath] = @GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; - break; - case GRPCCallSafetyCacheableRequest: - callFlags[hostAndPath] = @GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; - break; - default: - break; - } - } -} - -+ (uint32_t)callFlagsForHost:(NSString *)host path:(NSString *)path { - NSString *hostAndPath = [NSString stringWithFormat:@"%@/%@", host, path]; - @synchronized(callFlags) { - return [callFlags[hostAndPath] intValue]; - } -} - -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - requestsWriter:(GRXWriter *)requestWriter { - return [self initWithHost:host - path:path - callSafety:GRPCCallSafetyDefault - requestsWriter:requestWriter - callOptions:nil - writeDone:nil]; -} - -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - callSafety:(GRPCCallSafety)safety - requestsWriter:(GRXWriter *)requestsWriter - callOptions:(GRPCCallOptions *)callOptions - writeDone:(void (^)(void))writeDone { - // Purposely using pointer rather than length (host.length == 0) for backwards compatibility. - NSAssert(host != nil && path != nil, @"Neither host nor path can be nil."); - NSAssert(safety <= GRPCCallSafetyCacheableRequest, @"Invalid call safety value."); - NSAssert(requestsWriter.state == GRXWriterStateNotStarted, - @"The requests writer can't be already started."); - if (!host || !path) { - return nil; - } - if (safety > GRPCCallSafetyCacheableRequest) { - return nil; - } - if (requestsWriter.state != GRXWriterStateNotStarted) { - return nil; - } - - if ((self = [super init])) { - _host = [host copy]; - _path = [path copy]; - _callSafety = safety; - _callOptions = [callOptions copy]; - - // Serial queue to invoke the non-reentrant methods of the grpc_call object. - _callQueue = dispatch_queue_create("io.grpc.call", DISPATCH_QUEUE_SERIAL); - - _requestWriter = requestsWriter; - _requestHeaders = [[GRPCRequestHeaders alloc] initWithCall:self]; - _writeDone = writeDone; - - if ([requestsWriter isKindOfClass:[GRXImmediateSingleWriter class]]) { - _unaryCall = YES; - _unaryOpBatch = [NSMutableArray arrayWithCapacity:kMaxClientBatch]; - } - - _responseQueue = dispatch_get_main_queue(); - - // do not start a read until initial metadata is received - _pendingReceiveNextMessages = 0; - _pendingCoreRead = YES; - } - return self; -} - -- (void)setResponseDispatchQueue:(dispatch_queue_t)queue { - @synchronized(self) { - if (_state != GRXWriterStateNotStarted) { - return; - } - _responseQueue = queue; - } -} - -#pragma mark Finish - -// This function should support being called within a @synchronized(self) block in another function -// Should not manipulate _requestWriter for deadlock prevention. -- (void)finishWithError:(NSError *)errorOrNil { - @synchronized(self) { - if (_state == GRXWriterStateFinished) { - return; - } - _state = GRXWriterStateFinished; - - if (errorOrNil) { - [_responseWriteable cancelWithError:errorOrNil]; - } else { - [_responseWriteable enqueueSuccessfulCompletion]; - } - - // If the call isn't retained anywhere else, it can be deallocated now. - _retainSelf = nil; - } -} - -- (void)cancel { - @synchronized(self) { - if (_state == GRXWriterStateFinished) { - return; - } - [self finishWithError:[NSError - errorWithDomain:kGRPCErrorDomain - code:GRPCErrorCodeCancelled - userInfo:@{NSLocalizedDescriptionKey : @"Canceled by app"}]]; - [_wrappedCall cancel]; - } - _requestWriter.state = GRXWriterStateFinished; -} - -- (void)dealloc { - __block GRPCWrappedCall *wrappedCall = _wrappedCall; - dispatch_async(_callQueue, ^{ - wrappedCall = nil; - }); -} - -#pragma mark Read messages - -// Only called from the call queue. -// The handler will be called from the network queue. -- (void)startReadWithHandler:(void (^)(grpc_byte_buffer *))handler { - // TODO(jcanizales): Add error handlers for async failures - [_wrappedCall startBatchWithOperations:@[ [[GRPCOpRecvMessage alloc] initWithHandler:handler] ]]; -} - -// Called initially from the network queue once response headers are received, -// then "recursively" from the responseWriteable queue after each response from the -// server has been written. -// If the call is currently paused, this is a noop. Restarting the call will invoke this -// method. -// TODO(jcanizales): Rename to readResponseIfNotPaused. -- (void)maybeStartNextRead { - @synchronized(self) { - if (_state != GRXWriterStateStarted) { - return; - } - if (_callOptions.flowControlEnabled && (_pendingCoreRead || _pendingReceiveNextMessages == 0)) { - return; - } - _pendingCoreRead = YES; - _pendingReceiveNextMessages--; - } - - dispatch_async(_callQueue, ^{ - __weak GRPCCall *weakSelf = self; - [self startReadWithHandler:^(grpc_byte_buffer *message) { - if (message == NULL) { - // No more messages from the server - return; - } - __strong GRPCCall *strongSelf = weakSelf; - if (strongSelf == nil) { - grpc_byte_buffer_destroy(message); - return; - } - NSData *data = [NSData grpc_dataWithByteBuffer:message]; - grpc_byte_buffer_destroy(message); - if (!data) { - // The app doesn't have enough memory to hold the server response. We - // don't want to throw, because the app shouldn't crash for a behavior - // that's on the hands of any server to have. Instead we finish and ask - // the server to cancel. - @synchronized(strongSelf) { - strongSelf->_pendingCoreRead = NO; - [strongSelf - finishWithError:[NSError errorWithDomain:kGRPCErrorDomain - code:GRPCErrorCodeResourceExhausted - userInfo:@{ - NSLocalizedDescriptionKey : - @"Client does not have enough memory to " - @"hold the server response." - }]]; - [strongSelf->_wrappedCall cancel]; - } - strongSelf->_requestWriter.state = GRXWriterStateFinished; - } else { - @synchronized(strongSelf) { - [strongSelf->_responseWriteable enqueueValue:data - completionHandler:^{ - __strong GRPCCall *strongSelf = weakSelf; - if (strongSelf) { - @synchronized(strongSelf) { - strongSelf->_pendingCoreRead = NO; - [strongSelf maybeStartNextRead]; - } - } - }]; - } - } - }]; - }); -} - -#pragma mark Send headers - -- (void)sendHeaders { - // TODO (mxyan): Remove after deprecated methods are removed - uint32_t callSafetyFlags = 0; - switch (_callSafety) { - case GRPCCallSafetyDefault: - callSafetyFlags = 0; - break; - case GRPCCallSafetyIdempotentRequest: - callSafetyFlags = GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; - break; - case GRPCCallSafetyCacheableRequest: - callSafetyFlags = GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; - break; - } - - NSMutableDictionary *headers = [_requestHeaders mutableCopy]; - NSString *fetchedOauth2AccessToken; - @synchronized(self) { - fetchedOauth2AccessToken = _fetchedOauth2AccessToken; - } - if (fetchedOauth2AccessToken != nil) { - headers[@"authorization"] = [kBearerPrefix stringByAppendingString:fetchedOauth2AccessToken]; - } else if (_callOptions.oauth2AccessToken != nil) { - headers[@"authorization"] = - [kBearerPrefix stringByAppendingString:_callOptions.oauth2AccessToken]; - } - - // TODO(jcanizales): Add error handlers for async failures - GRPCOpSendMetadata *op = [[GRPCOpSendMetadata alloc] - initWithMetadata:headers - flags:callSafetyFlags - handler:nil]; // No clean-up needed after SEND_INITIAL_METADATA - dispatch_async(_callQueue, ^{ - if (!self->_unaryCall) { - [self->_wrappedCall startBatchWithOperations:@[ op ]]; - } else { - [self->_unaryOpBatch addObject:op]; - } - }); -} - -- (void)receiveNextMessages:(NSUInteger)numberOfMessages { - if (numberOfMessages == 0) { - return; - } - @synchronized(self) { - _pendingReceiveNextMessages += numberOfMessages; - - if (_state != GRXWriterStateStarted || !_callOptions.flowControlEnabled) { - return; - } - [self maybeStartNextRead]; - } -} - -#pragma mark GRXWriteable implementation - -// Only called from the call queue. The error handler will be called from the -// network queue if the write didn't succeed. -// If the call is a unary call, parameter \a errorHandler will be ignored and -// the error handler of GRPCOpSendClose will be executed in case of error. -- (void)writeMessage:(NSData *)message withErrorHandler:(void (^)(void))errorHandler { - __weak GRPCCall *weakSelf = self; - void (^resumingHandler)(void) = ^{ - // Resume the request writer. - GRPCCall *strongSelf = weakSelf; - if (strongSelf) { - strongSelf->_requestWriter.state = GRXWriterStateStarted; - if (strongSelf->_writeDone) { - strongSelf->_writeDone(); - } - } - }; - GRPCOpSendMessage *op = - [[GRPCOpSendMessage alloc] initWithMessage:message handler:resumingHandler]; - if (!_unaryCall) { - [_wrappedCall startBatchWithOperations:@[ op ] errorHandler:errorHandler]; - } else { - // Ignored errorHandler since it is the same as the one for GRPCOpSendClose. - // TODO (mxyan): unify the error handlers of all Ops into a single closure. - [_unaryOpBatch addObject:op]; - } -} - -- (void)writeValue:(id)value { - NSAssert([value isKindOfClass:[NSData class]], @"value must be of type NSData"); - - @synchronized(self) { - if (_state == GRXWriterStateFinished) { - return; - } - } - - // Pause the input and only resume it when the C layer notifies us that writes - // can proceed. - _requestWriter.state = GRXWriterStatePaused; - - dispatch_async(_callQueue, ^{ - // Write error is not processed here. It is handled by op batch of GRPC_OP_RECV_STATUS_ON_CLIENT - [self writeMessage:value withErrorHandler:nil]; - }); -} - -// Only called from the call queue. The error handler will be called from the -// network queue if the requests stream couldn't be closed successfully. -- (void)finishRequestWithErrorHandler:(void (^)(void))errorHandler { - if (!_unaryCall) { - [_wrappedCall startBatchWithOperations:@[ [[GRPCOpSendClose alloc] init] ] - errorHandler:errorHandler]; - } else { - [_unaryOpBatch addObject:[[GRPCOpSendClose alloc] init]]; - [_wrappedCall startBatchWithOperations:_unaryOpBatch errorHandler:errorHandler]; - } -} - -- (void)writesFinishedWithError:(NSError *)errorOrNil { - if (errorOrNil) { - [self cancel]; - } else { - dispatch_async(_callQueue, ^{ - // EOS error is not processed here. It is handled by op batch of GRPC_OP_RECV_STATUS_ON_CLIENT - [self finishRequestWithErrorHandler:nil]; - }); - } -} - -#pragma mark Invoke - -// Both handlers will eventually be called, from the network queue. Writes can start immediately -// after this. -// The first one (headersHandler), when the response headers are received. -// The second one (completionHandler), whenever the RPC finishes for any reason. -- (void)invokeCallWithHeadersHandler:(void (^)(NSDictionary *))headersHandler - completionHandler:(void (^)(NSError *, NSDictionary *))completionHandler { - dispatch_async(_callQueue, ^{ - // TODO(jcanizales): Add error handlers for async failures - [self->_wrappedCall - startBatchWithOperations:@[ [[GRPCOpRecvMetadata alloc] initWithHandler:headersHandler] ]]; - [self->_wrappedCall - startBatchWithOperations:@[ [[GRPCOpRecvStatus alloc] initWithHandler:completionHandler] ]]; - }); -} - -- (void)invokeCall { - __weak GRPCCall *weakSelf = self; - [self invokeCallWithHeadersHandler:^(NSDictionary *headers) { - // Response headers received. - __strong GRPCCall *strongSelf = weakSelf; - if (strongSelf) { - @synchronized(strongSelf) { - // it is ok to set nil because headers are only received once - strongSelf.responseHeaders = nil; - // copy the header so that the GRPCOpRecvMetadata object may be dealloc'ed - NSDictionary *copiedHeaders = - [[NSDictionary alloc] initWithDictionary:headers copyItems:YES]; - strongSelf.responseHeaders = copiedHeaders; - strongSelf->_pendingCoreRead = NO; - [strongSelf maybeStartNextRead]; - } - } - } - completionHandler:^(NSError *error, NSDictionary *trailers) { - __strong GRPCCall *strongSelf = weakSelf; - if (strongSelf) { - strongSelf.responseTrailers = trailers; - - if (error) { - NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; - if (error.userInfo) { - [userInfo addEntriesFromDictionary:error.userInfo]; - } - userInfo[kGRPCTrailersKey] = strongSelf.responseTrailers; - // Since gRPC core does not guarantee the headers block being called before this block, - // responseHeaders might be nil. - userInfo[kGRPCHeadersKey] = strongSelf.responseHeaders; - error = [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo]; - } - [strongSelf finishWithError:error]; - strongSelf->_requestWriter.state = GRXWriterStateFinished; - } - }]; -} - -#pragma mark GRXWriter implementation - -// Lock acquired inside startWithWriteable: -- (void)startCallWithWriteable:(id)writeable { - @synchronized(self) { - if (_state == GRXWriterStateFinished) { - return; - } - - _responseWriteable = - [[GRXConcurrentWriteable alloc] initWithWriteable:writeable dispatchQueue:_responseQueue]; - - GRPCPooledChannel *channel = - [[GRPCChannelPool sharedInstance] channelWithHost:_host callOptions:_callOptions]; - _wrappedCall = [channel wrappedCallWithPath:_path - completionQueue:[GRPCCompletionQueue completionQueue] - callOptions:_callOptions]; - - if (_wrappedCall == nil) { - [self finishWithError:[NSError errorWithDomain:kGRPCErrorDomain - code:GRPCErrorCodeUnavailable - userInfo:@{ - NSLocalizedDescriptionKey : - @"Failed to create call or channel." - }]]; - return; - } - - [self sendHeaders]; - [self invokeCall]; - } - - // Now that the RPC has been initiated, request writes can start. - [_requestWriter startWithWriteable:self]; -} - -- (void)startWithWriteable:(id)writeable { - id tokenProvider = nil; - @synchronized(self) { - _state = GRXWriterStateStarted; - - // Create a retain cycle so that this instance lives until the RPC finishes (or is cancelled). - // This makes RPCs in which the call isn't externally retained possible (as long as it is - // started before being autoreleased). Care is taken not to retain self strongly in any of the - // blocks used in this implementation, so that the life of the instance is determined by this - // retain cycle. - _retainSelf = self; - - // If _callOptions is nil, people must be using the deprecated v1 interface. In this case, - // generate the call options from the corresponding GRPCHost configs and apply other options - // that are not covered by GRPCHost. - if (_callOptions == nil) { - GRPCMutableCallOptions *callOptions = [[GRPCHost callOptionsForHost:_host] mutableCopy]; - if (_serverName.length != 0) { - callOptions.serverAuthority = _serverName; - } - if (_timeout > 0) { - callOptions.timeout = _timeout; - } - uint32_t callFlags = [GRPCCall callFlagsForHost:_host path:_path]; - if (callFlags != 0) { - if (callFlags == GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) { - _callSafety = GRPCCallSafetyIdempotentRequest; - } else if (callFlags == GRPC_INITIAL_METADATA_CACHEABLE_REQUEST) { - _callSafety = GRPCCallSafetyCacheableRequest; - } - } - - id tokenProvider = self.tokenProvider; - if (tokenProvider != nil) { - callOptions.authTokenProvider = tokenProvider; - } - _callOptions = callOptions; - } - - NSAssert(_callOptions.authTokenProvider == nil || _callOptions.oauth2AccessToken == nil, - @"authTokenProvider and oauth2AccessToken cannot be set at the same time"); - - tokenProvider = _callOptions.authTokenProvider; - } - - if (tokenProvider != nil) { - __weak typeof(self) weakSelf = self; - [tokenProvider getTokenWithHandler:^(NSString *token) { - __strong typeof(self) strongSelf = weakSelf; - if (strongSelf) { - BOOL startCall = NO; - @synchronized(strongSelf) { - if (strongSelf->_state != GRXWriterStateFinished) { - startCall = YES; - if (token) { - strongSelf->_fetchedOauth2AccessToken = [token copy]; - } - } - } - if (startCall) { - [strongSelf startCallWithWriteable:writeable]; - } - } - }]; - } else { - [self startCallWithWriteable:writeable]; - } -} - -- (void)setState:(GRXWriterState)newState { - @synchronized(self) { - // Manual transitions are only allowed from the started or paused states. - if (_state == GRXWriterStateNotStarted || _state == GRXWriterStateFinished) { - return; - } - - switch (newState) { - case GRXWriterStateFinished: - _state = newState; - // Per GRXWriter's contract, setting the state to Finished manually - // means one doesn't wish the writeable to be messaged anymore. - [_responseWriteable cancelSilently]; - _responseWriteable = nil; - return; - case GRXWriterStatePaused: - _state = newState; - return; - case GRXWriterStateStarted: - if (_state == GRXWriterStatePaused) { - _state = newState; - [self maybeStartNextRead]; - } - return; - case GRXWriterStateNotStarted: - return; - } - } -} - -@end diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.h b/src/objective-c/GRPCClient/GRPCCallOptions.h index e4261b5b5f9..98511e3f5cb 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.h +++ b/src/objective-c/GRPCClient/GRPCCallOptions.h @@ -18,11 +18,57 @@ #import -#import "GRPCTypes.h" - NS_ASSUME_NONNULL_BEGIN -@protocol GRPCInterceptorFactory; +/** + * Safety remark of a gRPC method as defined in RFC 2616 Section 9.1 + */ +typedef NS_ENUM(NSUInteger, GRPCCallSafety) { + /** Signal that there is no guarantees on how the call affects the server state. */ + GRPCCallSafetyDefault = 0, + /** Signal that the call is idempotent. gRPC is free to use PUT verb. */ + GRPCCallSafetyIdempotentRequest = 1, + /** + * Signal that the call is cacheable and will not affect server state. gRPC is free to use GET + * verb. + */ + GRPCCallSafetyCacheableRequest = 2, +}; + +// Compression algorithm to be used by a gRPC call +typedef NS_ENUM(NSUInteger, GRPCCompressionAlgorithm) { + GRPCCompressNone = 0, + GRPCCompressDeflate, + GRPCCompressGzip, + GRPCStreamCompressGzip, +}; + +// GRPCCompressAlgorithm is deprecated; use GRPCCompressionAlgorithm +typedef GRPCCompressionAlgorithm GRPCCompressAlgorithm; + +/** The transport to be used by a gRPC call */ +typedef NS_ENUM(NSUInteger, GRPCTransportType) { + GRPCTransportTypeDefault = 0, + /** gRPC internal HTTP/2 stack with BoringSSL */ + GRPCTransportTypeChttp2BoringSSL = 0, + /** Cronet stack */ + GRPCTransportTypeCronet, + /** Insecure channel. FOR TEST ONLY! */ + GRPCTransportTypeInsecure, +}; + +/** + * Implement this protocol to provide a token to gRPC when a call is initiated. + */ +@protocol GRPCAuthorizationProtocol + +/** + * This method is called when gRPC is about to start the call. When OAuth token is acquired, + * \a handler is expected to be called with \a token being the new token to be used for this call. + */ +- (void)getTokenWithHandler:(void (^)(NSString *_Nullable token))handler; + +@end @interface GRPCCallOptions : NSObject @@ -58,7 +104,7 @@ NS_ASSUME_NONNULL_BEGIN * this array. This parameter should not be modified by any interceptor and will * not take effect if done so. */ -@property(copy, readonly) NSArray> *interceptorFactories; +@property(copy, readonly) NSArray *interceptorFactories; // OAuth2 parameters. Users of gRPC may specify one of the following two parameters. @@ -146,23 +192,10 @@ NS_ASSUME_NONNULL_BEGIN @property(copy, readonly, nullable) NSString *PEMCertificateChain; /** - * Deprecated: this option is deprecated. Please use the property \a transport - * instead. - * * Select the transport type to be used for this call. */ @property(readonly) GRPCTransportType transportType; -/** - * The transport to be used for this call. Users may choose a native transport - * identifier defined in \a GRPCTransport or provided by a non-native transport - * implementation. If the option is left to be NULL, gRPC will use its default - * transport. - * - * This is currently an experimental option. - */ -@property(readonly) GRPCTransportId transport; - /** * Override the hostname during the TLS hostname validation process. */ @@ -234,7 +267,7 @@ NS_ASSUME_NONNULL_BEGIN * this array. This parameter should not be modified by any interceptor and will * not take effect if done so. */ -@property(copy, readwrite) NSArray> *interceptorFactories; +@property(copy, readwrite) NSArray *interceptorFactories; // OAuth2 parameters. Users of gRPC may specify one of the following two parameters. @@ -324,23 +357,10 @@ NS_ASSUME_NONNULL_BEGIN @property(copy, readwrite, nullable) NSString *PEMCertificateChain; /** - * Deprecated: this option is deprecated. Please use the property \a transport - * instead. - * * Select the transport type to be used for this call. */ @property(readwrite) GRPCTransportType transportType; -/** - * The transport to be used for this call. Users may choose a native transport - * identifier defined in \a GRPCTransport or provided by a non-native ttransport - * implementation. If the option is left to be NULL, gRPC will use its default - * transport. - * - * An interceptor must not change the value of this option. - */ -@property(readwrite) GRPCTransportId transport; - /** * Override the hostname during the TLS hostname validation process. */ diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.m b/src/objective-c/GRPCClient/GRPCCallOptions.m index 7f88098eb6f..392e42a9d47 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.m +++ b/src/objective-c/GRPCClient/GRPCCallOptions.m @@ -17,14 +17,13 @@ */ #import "GRPCCallOptions.h" -#import "GRPCTransport.h" #import "internal/GRPCCallOptions+Internal.h" // The default values for the call options. static NSString *const kDefaultServerAuthority = nil; static const NSTimeInterval kDefaultTimeout = 0; static const BOOL kDefaultFlowControlEnabled = NO; -static NSArray> *const kDefaultInterceptorFactories = nil; +static NSArray *const kDefaultInterceptorFactories = nil; static NSDictionary *const kDefaultInitialMetadata = nil; static NSString *const kDefaultUserAgentPrefix = nil; static const NSUInteger kDefaultResponseSizeLimit = 0; @@ -42,7 +41,6 @@ static NSString *const kDefaultPEMCertificateChain = nil; static NSString *const kDefaultOauth2AccessToken = nil; static const id kDefaultAuthTokenProvider = nil; static const GRPCTransportType kDefaultTransportType = GRPCTransportTypeChttp2BoringSSL; -static const GRPCTransportId kDefaultTransport = NULL; static NSString *const kDefaultHostNameOverride = nil; static const id kDefaultLogContext = nil; static NSString *const kDefaultChannelPoolDomain = nil; @@ -64,7 +62,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { NSString *_serverAuthority; NSTimeInterval _timeout; BOOL _flowControlEnabled; - NSArray> *_interceptorFactories; + NSArray *_interceptorFactories; NSString *_oauth2AccessToken; id _authTokenProvider; NSDictionary *_initialMetadata; @@ -82,7 +80,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { NSString *_PEMPrivateKey; NSString *_PEMCertificateChain; GRPCTransportType _transportType; - GRPCTransportId _transport; NSString *_hostNameOverride; id _logContext; NSString *_channelPoolDomain; @@ -110,7 +107,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { @synthesize PEMPrivateKey = _PEMPrivateKey; @synthesize PEMCertificateChain = _PEMCertificateChain; @synthesize transportType = _transportType; -@synthesize transport = _transport; @synthesize hostNameOverride = _hostNameOverride; @synthesize logContext = _logContext; @synthesize channelPoolDomain = _channelPoolDomain; @@ -138,7 +134,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:kDefaultPEMPrivateKey PEMCertificateChain:kDefaultPEMCertificateChain transportType:kDefaultTransportType - transport:kDefaultTransport hostNameOverride:kDefaultHostNameOverride logContext:kDefaultLogContext channelPoolDomain:kDefaultChannelPoolDomain @@ -148,7 +143,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { - (instancetype)initWithServerAuthority:(NSString *)serverAuthority timeout:(NSTimeInterval)timeout flowControlEnabled:(BOOL)flowControlEnabled - interceptorFactories:(NSArray> *)interceptorFactories + interceptorFactories:(NSArray *)interceptorFactories oauth2AccessToken:(NSString *)oauth2AccessToken authTokenProvider:(id)authTokenProvider initialMetadata:(NSDictionary *)initialMetadata @@ -166,7 +161,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:(NSString *)PEMPrivateKey PEMCertificateChain:(NSString *)PEMCertificateChain transportType:(GRPCTransportType)transportType - transport:(GRPCTransportId)transport hostNameOverride:(NSString *)hostNameOverride logContext:(id)logContext channelPoolDomain:(NSString *)channelPoolDomain @@ -199,7 +193,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { _PEMPrivateKey = [PEMPrivateKey copy]; _PEMCertificateChain = [PEMCertificateChain copy]; _transportType = transportType; - _transport = transport; _hostNameOverride = [hostNameOverride copy]; _logContext = logContext; _channelPoolDomain = [channelPoolDomain copy]; @@ -231,7 +224,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:_PEMPrivateKey PEMCertificateChain:_PEMCertificateChain transportType:_transportType - transport:_transport hostNameOverride:_hostNameOverride logContext:_logContext channelPoolDomain:_channelPoolDomain @@ -264,7 +256,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:[_PEMPrivateKey copy] PEMCertificateChain:[_PEMCertificateChain copy] transportType:_transportType - transport:_transport hostNameOverride:[_hostNameOverride copy] logContext:_logContext channelPoolDomain:[_channelPoolDomain copy] @@ -289,7 +280,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { if (!areObjectsEqual(callOptions.PEMCertificateChain, _PEMCertificateChain)) return NO; if (!areObjectsEqual(callOptions.hostNameOverride, _hostNameOverride)) return NO; if (!(callOptions.transportType == _transportType)) return NO; - if (!(TransportIdIsEqual(callOptions.transport, _transport))) return NO; if (!areObjectsEqual(callOptions.logContext, _logContext)) return NO; if (!areObjectsEqual(callOptions.channelPoolDomain, _channelPoolDomain)) return NO; if (!(callOptions.channelID == _channelID)) return NO; @@ -314,7 +304,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { result ^= _PEMCertificateChain.hash; result ^= _hostNameOverride.hash; result ^= _transportType; - result ^= TransportIdHash(_transport); result ^= _logContext.hash; result ^= _channelPoolDomain.hash; result ^= _channelID; @@ -347,7 +336,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { @dynamic PEMPrivateKey; @dynamic PEMCertificateChain; @dynamic transportType; -@dynamic transport; @dynamic hostNameOverride; @dynamic logContext; @dynamic channelPoolDomain; @@ -375,7 +363,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:kDefaultPEMPrivateKey PEMCertificateChain:kDefaultPEMCertificateChain transportType:kDefaultTransportType - transport:kDefaultTransport hostNameOverride:kDefaultHostNameOverride logContext:kDefaultLogContext channelPoolDomain:kDefaultChannelPoolDomain @@ -405,7 +392,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:_PEMPrivateKey PEMCertificateChain:_PEMCertificateChain transportType:_transportType - transport:_transport hostNameOverride:_hostNameOverride logContext:_logContext channelPoolDomain:_channelPoolDomain @@ -436,7 +422,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:_PEMPrivateKey PEMCertificateChain:_PEMCertificateChain transportType:_transportType - transport:_transport hostNameOverride:_hostNameOverride logContext:_logContext channelPoolDomain:_channelPoolDomain @@ -460,7 +445,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { _flowControlEnabled = flowControlEnabled; } -- (void)setInterceptorFactories:(NSArray> *)interceptorFactories { +- (void)setInterceptorFactories:(NSArray *)interceptorFactories { _interceptorFactories = interceptorFactories; } @@ -553,10 +538,6 @@ static BOOL areObjectsEqual(id obj1, id obj2) { _transportType = transportType; } -- (void)setTransport:(GRPCTransportId)transport { - _transport = transport; -} - - (void)setHostNameOverride:(NSString *)hostNameOverride { _hostNameOverride = [hostNameOverride copy]; } diff --git a/src/objective-c/GRPCClient/GRPCDispatchable.h b/src/objective-c/GRPCClient/GRPCDispatchable.h deleted file mode 100644 index 650103603d4..00000000000 --- a/src/objective-c/GRPCClient/GRPCDispatchable.h +++ /dev/null @@ -1,30 +0,0 @@ - -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/** - * An object that processes its methods with a dispatch queue. - */ -@protocol GRPCDispatchable - -/** - * The dispatch queue where the object's methods should be run on. - */ -@property(atomic, readonly) dispatch_queue_t dispatchQueue; - -@end diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.h b/src/objective-c/GRPCClient/GRPCInterceptor.h index 509749769b3..3b62c1b3ec0 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.h +++ b/src/objective-c/GRPCClient/GRPCInterceptor.h @@ -106,20 +106,22 @@ */ #import "GRPCCall.h" -#import "GRPCDispatchable.h" NS_ASSUME_NONNULL_BEGIN @class GRPCInterceptorManager; @class GRPCInterceptor; -@class GRPCRequestOptions; -@class GRPCCallOptions; -@protocol GRPCResponseHandler; /** * The GRPCInterceptorInterface defines the request events that can occur to an interceptr. */ -@protocol GRPCInterceptorInterface +@protocol GRPCInterceptorInterface + +/** + * The queue on which all methods of this interceptor should be dispatched on. The queue must be a + * serial queue. + */ +@property(readonly) dispatch_queue_t requestDispatchQueue; /** * To start the call. This method will only be called once for each instance. @@ -169,20 +171,19 @@ NS_ASSUME_NONNULL_BEGIN * invoke shutDown method of its corresponding manager so that references to other interceptors can * be released. */ -@interface GRPCInterceptorManager : NSObject +@interface GRPCInterceptorManager : NSObject - (instancetype)init NS_UNAVAILABLE; + (instancetype) new NS_UNAVAILABLE; -- (nullable instancetype)initWithFactories:(nullable NSArray> *)factories - previousInterceptor:(nullable id)previousInterceptor - transportId:(GRPCTransportId)transportId; +- (nullable instancetype)initWithNextInterceptor:(id)nextInterceptor + NS_DESIGNATED_INITIALIZER; -/** - * Notify the manager that the interceptor has shut down and the manager should release references - * to other interceptors and stop forwarding requests/responses. - */ +/** Set the previous interceptor in the chain. Can only be set once. */ +- (void)setPreviousInterceptor:(id)previousInterceptor; + +/** Indicate shutdown of the interceptor; release the reference to other interceptors */ - (void)shutDown; // Methods to forward GRPCInterceptorInterface calls to the next interceptor @@ -234,6 +235,7 @@ NS_ASSUME_NONNULL_BEGIN @interface GRPCInterceptor : NSObject - (instancetype)init NS_UNAVAILABLE; + + (instancetype) new NS_UNAVAILABLE; /** @@ -241,7 +243,9 @@ NS_ASSUME_NONNULL_BEGIN * that this interceptor's methods are dispatched onto. */ - (nullable instancetype)initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - dispatchQueue:(dispatch_queue_t)dispatchQueue; + requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue + responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue + NS_DESIGNATED_INITIALIZER; // Default implementation of GRPCInterceptorInterface diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.m b/src/objective-c/GRPCClient/GRPCInterceptor.m index a7ffe05bddc..a385ecd7813 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.m +++ b/src/objective-c/GRPCClient/GRPCInterceptor.m @@ -19,253 +19,117 @@ #import #import "GRPCInterceptor.h" -#import "private/GRPCTransport+Private.h" - -@interface GRPCInterceptorManager () - -@end @implementation GRPCInterceptorManager { id _nextInterceptor; id _previousInterceptor; - GRPCInterceptor *_thisInterceptor; - dispatch_queue_t _dispatchQueue; - NSArray> *_factories; - GRPCTransportId _transportId; - BOOL _shutDown; } -- (instancetype)initWithFactories:(NSArray> *)factories - previousInterceptor:(id)previousInterceptor - transportId:(nonnull GRPCTransportId)transportId { +- (instancetype)initWithNextInterceptor:(id)nextInterceptor { if ((self = [super init])) { - if (factories.count == 0) { - [NSException raise:NSInternalInconsistencyException - format:@"Interceptor manager must have factories"]; - } - _thisInterceptor = [factories[0] createInterceptorWithManager:self]; - if (_thisInterceptor == nil) { - return nil; - } - _previousInterceptor = previousInterceptor; - _factories = factories; - // Generate interceptor -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 - if (@available(iOS 8.0, macOS 10.10, *)) { - _dispatchQueue = dispatch_queue_create( - NULL, - dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); - } else { -#else - { -#endif - _dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); - } - dispatch_set_target_queue(_dispatchQueue, _thisInterceptor.dispatchQueue); - _transportId = transportId; + _nextInterceptor = nextInterceptor; } + return self; } -- (void)shutDown { - dispatch_async(_dispatchQueue, ^{ - self->_nextInterceptor = nil; - self->_previousInterceptor = nil; - self->_thisInterceptor = nil; - self->_shutDown = YES; - }); +- (void)setPreviousInterceptor:(id)previousInterceptor { + _previousInterceptor = previousInterceptor; } -- (void)createNextInterceptor { - NSAssert(_nextInterceptor == nil, @"Starting the next interceptor more than once"); - NSAssert(_factories.count > 0, @"Interceptor manager of transport cannot start next interceptor"); - if (_nextInterceptor != nil) { - NSLog(@"Starting the next interceptor more than once"); - return; - } - NSMutableArray> *interceptorFactories = [NSMutableArray - arrayWithArray:[_factories subarrayWithRange:NSMakeRange(1, _factories.count - 1)]]; - while (_nextInterceptor == nil) { - if (interceptorFactories.count == 0) { - _nextInterceptor = - [[GRPCTransportManager alloc] initWithTransportId:_transportId previousInterceptor:self]; - break; - } else { - _nextInterceptor = [[GRPCInterceptorManager alloc] initWithFactories:interceptorFactories - previousInterceptor:self - transportId:_transportId]; - if (_nextInterceptor == nil) { - [interceptorFactories removeObjectAtIndex:0]; - } - } - } - NSAssert(_nextInterceptor != nil, @"Failed to create interceptor or transport."); - if (_nextInterceptor == nil) { - NSLog(@"Failed to create interceptor or transport."); - } +- (void)shutDown { + _nextInterceptor = nil; + _previousInterceptor = nil; } - (void)startNextInterceptorWithRequest:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { - if (_nextInterceptor == nil && !_shutDown) { - [self createNextInterceptor]; - } - if (_nextInterceptor == nil) { - return; + if (_nextInterceptor != nil) { + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ + [copiedNextInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; + }); } - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ - [copiedNextInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; - }); } - (void)writeNextInterceptorWithData:(id)data { - if (_nextInterceptor == nil && !_shutDown) { - [self createNextInterceptor]; - } - if (_nextInterceptor == nil) { - return; + if (_nextInterceptor != nil) { + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ + [copiedNextInterceptor writeData:data]; + }); } - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ - [copiedNextInterceptor writeData:data]; - }); } - (void)finishNextInterceptor { - if (_nextInterceptor == nil && !_shutDown) { - [self createNextInterceptor]; - } - if (_nextInterceptor == nil) { - return; + if (_nextInterceptor != nil) { + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ + [copiedNextInterceptor finish]; + }); } - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ - [copiedNextInterceptor finish]; - }); } - (void)cancelNextInterceptor { - if (_nextInterceptor == nil && !_shutDown) { - [self createNextInterceptor]; - } - if (_nextInterceptor == nil) { - return; + if (_nextInterceptor != nil) { + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ + [copiedNextInterceptor cancel]; + }); } - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ - [copiedNextInterceptor cancel]; - }); } /** Notify the next interceptor in the chain to receive more messages */ - (void)receiveNextInterceptorMessages:(NSUInteger)numberOfMessages { - if (_nextInterceptor == nil && !_shutDown) { - [self createNextInterceptor]; - } - if (_nextInterceptor == nil) { - return; + if (_nextInterceptor != nil) { + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ + [copiedNextInterceptor receiveNextMessages:numberOfMessages]; + }); } - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ - [copiedNextInterceptor receiveNextMessages:numberOfMessages]; - }); } // Methods to forward GRPCResponseHandler callbacks to the previous object /** Forward initial metadata to the previous interceptor in the chain */ -- (void)forwardPreviousInterceptorWithInitialMetadata:(NSDictionary *)initialMetadata { - if (_previousInterceptor == nil) { - return; +- (void)forwardPreviousInterceptorWithInitialMetadata:(nullable NSDictionary *)initialMetadata { + if ([_previousInterceptor respondsToSelector:@selector(didReceiveInitialMetadata:)]) { + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didReceiveInitialMetadata:initialMetadata]; + }); } - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didReceiveInitialMetadata:initialMetadata]; - }); } /** Forward a received message to the previous interceptor in the chain */ - (void)forwardPreviousInterceptorWithData:(id)data { - if (_previousInterceptor == nil) { - return; + if ([_previousInterceptor respondsToSelector:@selector(didReceiveData:)]) { + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didReceiveData:data]; + }); } - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didReceiveData:data]; - }); } /** Forward call close and trailing metadata to the previous interceptor in the chain */ -- (void)forwardPreviousInterceptorCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata - error:(NSError *)error { - if (_previousInterceptor == nil) { - return; +- (void)forwardPreviousInterceptorCloseWithTrailingMetadata: + (nullable NSDictionary *)trailingMetadata + error:(nullable NSError *)error { + if ([_previousInterceptor respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; + }); } - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; - }); } /** Forward write completion to the previous interceptor in the chain */ - (void)forwardPreviousInterceptorDidWriteData { - if (_previousInterceptor == nil) { - return; - } - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didWriteData]; - }); -} - -- (dispatch_queue_t)dispatchQueue { - return _dispatchQueue; -} - -- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions - callOptions:(GRPCCallOptions *)callOptions { - [_thisInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; -} - -- (void)writeData:(id)data { - [_thisInterceptor writeData:data]; -} - -- (void)finish { - [_thisInterceptor finish]; -} - -- (void)cancel { - [_thisInterceptor cancel]; -} - -- (void)receiveNextMessages:(NSUInteger)numberOfMessages { - [_thisInterceptor receiveNextMessages:numberOfMessages]; -} - -- (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata { - if ([_thisInterceptor respondsToSelector:@selector(didReceiveInitialMetadata:)]) { - [_thisInterceptor didReceiveInitialMetadata:initialMetadata]; - } -} - -- (void)didReceiveData:(id)data { - if ([_thisInterceptor respondsToSelector:@selector(didReceiveData:)]) { - [_thisInterceptor didReceiveData:data]; - } -} - -- (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata - error:(nullable NSError *)error { - if ([_thisInterceptor respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { - [_thisInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; - } -} - -- (void)didWriteData { - if ([_thisInterceptor respondsToSelector:@selector(didWriteData)]) { - [_thisInterceptor didWriteData]; + if ([_previousInterceptor respondsToSelector:@selector(didWriteData)]) { + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didWriteData]; + }); } } @@ -273,21 +137,28 @@ @implementation GRPCInterceptor { GRPCInterceptorManager *_manager; - dispatch_queue_t _dispatchQueue; + dispatch_queue_t _requestDispatchQueue; + dispatch_queue_t _responseDispatchQueue; } - (instancetype)initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - dispatchQueue:(dispatch_queue_t)dispatchQueue { + requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue + responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue { if ((self = [super init])) { _manager = interceptorManager; - _dispatchQueue = dispatchQueue; + _requestDispatchQueue = requestDispatchQueue; + _responseDispatchQueue = responseDispatchQueue; } return self; } +- (dispatch_queue_t)requestDispatchQueue { + return _requestDispatchQueue; +} + - (dispatch_queue_t)dispatchQueue { - return _dispatchQueue; + return _responseDispatchQueue; } - (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions diff --git a/src/objective-c/GRPCClient/GRPCTransport.h b/src/objective-c/GRPCClient/GRPCTransport.h deleted file mode 100644 index d5637922152..00000000000 --- a/src/objective-c/GRPCClient/GRPCTransport.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// The interface for a transport implementation - -#import "GRPCInterceptor.h" - -NS_ASSUME_NONNULL_BEGIN - -#pragma mark Transport ID - -/** - * The default transport implementations available in gRPC. These implementations will be provided - * by gRPC by default unless explicitly excluded. - */ -extern const struct GRPCDefaultTransportImplList { - const GRPCTransportId core_secure; - const GRPCTransportId core_insecure; -} GRPCDefaultTransportImplList; - -/** Returns whether two transport id's are identical. */ -BOOL TransportIdIsEqual(GRPCTransportId lhs, GRPCTransportId rhs); - -/** Returns the hash value of a transport id. */ -NSUInteger TransportIdHash(GRPCTransportId); - -#pragma mark Transport and factory - -@protocol GRPCInterceptorInterface; -@protocol GRPCResponseHandler; -@class GRPCTransportManager; -@class GRPCRequestOptions; -@class GRPCCallOptions; -@class GRPCTransport; - -/** The factory method to create a transport. */ -@protocol GRPCTransportFactory - -- (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager; - -@end - -/** The registry of transport implementations. */ -@interface GRPCTransportRegistry : NSObject - -+ (instancetype)sharedInstance; - -/** - * Register a transport implementation with the registry. All transport implementations to be used - * in a process must register with the registry on process start-up in its +load: class method. - * Parameter \a transportId is the identifier of the implementation, and \a factory is the factory - * object to create the corresponding transport instance. - */ -- (void)registerTransportWithId:(GRPCTransportId)transportId - factory:(id)factory; - -@end - -/** - * Base class for transport implementations. All transport implementation should inherit from this - * class. - */ -@interface GRPCTransport : NSObject - -@end - -NS_ASSUME_NONNULL_END diff --git a/src/objective-c/GRPCClient/GRPCTransport.m b/src/objective-c/GRPCClient/GRPCTransport.m deleted file mode 100644 index 439acfb9cc2..00000000000 --- a/src/objective-c/GRPCClient/GRPCTransport.m +++ /dev/null @@ -1,142 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "GRPCTransport.h" - -static const GRPCTransportId gGRPCCoreSecureId = "io.grpc.transport.core.secure"; -static const GRPCTransportId gGRPCCoreInsecureId = "io.grpc.transport.core.insecure"; - -const struct GRPCDefaultTransportImplList GRPCDefaultTransportImplList = { - .core_secure = gGRPCCoreSecureId, .core_insecure = gGRPCCoreInsecureId}; - -static const GRPCTransportId gDefaultTransportId = gGRPCCoreSecureId; - -static GRPCTransportRegistry *gTransportRegistry = nil; -static dispatch_once_t initTransportRegistry; - -BOOL TransportIdIsEqual(GRPCTransportId lhs, GRPCTransportId rhs) { - // Directly comparing pointers works because we require users to use the id provided by each - // implementation, not coming up with their own string. - return lhs == rhs; -} - -NSUInteger TransportIdHash(GRPCTransportId transportId) { - if (transportId == NULL) { - transportId = gDefaultTransportId; - } - return [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding].hash; -} - -@implementation GRPCTransportRegistry { - NSMutableDictionary> *_registry; - id _defaultFactory; -} - -+ (instancetype)sharedInstance { - dispatch_once(&initTransportRegistry, ^{ - gTransportRegistry = [[GRPCTransportRegistry alloc] init]; - NSAssert(gTransportRegistry != nil, @"Unable to initialize transport registry."); - if (gTransportRegistry == nil) { - NSLog(@"Unable to initialize transport registry."); - [NSException raise:NSGenericException format:@"Unable to initialize transport registry."]; - } - }); - return gTransportRegistry; -} - -- (instancetype)init { - if ((self = [super init])) { - _registry = [NSMutableDictionary dictionary]; - } - return self; -} - -- (void)registerTransportWithId:(GRPCTransportId)transportId - factory:(id)factory { - NSString *nsTransportId = [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding]; - NSAssert(_registry[nsTransportId] == nil, @"The transport %@ has already been registered.", - nsTransportId); - if (_registry[nsTransportId] != nil) { - NSLog(@"The transport %@ has already been registered.", nsTransportId); - return; - } - _registry[nsTransportId] = factory; - - // if the default transport is registered, mark it. - if (0 == strcmp(transportId, gDefaultTransportId)) { - _defaultFactory = factory; - } -} - -- (id)getTransportFactoryWithId:(GRPCTransportId)transportId { - if (transportId == NULL) { - if (_defaultFactory == nil) { - [NSException raise:NSInvalidArgumentException - format:@"Unable to get default transport factory"]; - return nil; - } - return _defaultFactory; - } - NSString *nsTransportId = [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding]; - id transportFactory = _registry[nsTransportId]; - if (transportFactory == nil) { - // User named a transport id that was not registered with the registry. - [NSException raise:NSInvalidArgumentException - format:@"Unable to get transport factory with id %s", transportId]; - return nil; - } - return transportFactory; -} - -@end - -@implementation GRPCTransport - -- (dispatch_queue_t)dispatchQueue { - [NSException raise:NSGenericException - format:@"Implementations should override the dispatch queue"]; - return nil; -} - -- (void)startWithRequestOptions:(nonnull GRPCRequestOptions *)requestOptions - callOptions:(nonnull GRPCCallOptions *)callOptions { - [NSException raise:NSGenericException - format:@"Implementations should override the methods of GRPCTransport"]; -} - -- (void)writeData:(nonnull id)data { - [NSException raise:NSGenericException - format:@"Implementations should override the methods of GRPCTransport"]; -} - -- (void)cancel { - [NSException raise:NSGenericException - format:@"Implementations should override the methods of GRPCTransport"]; -} - -- (void)finish { - [NSException raise:NSGenericException - format:@"Implementations should override the methods of GRPCTransport"]; -} - -- (void)receiveNextMessages:(NSUInteger)numberOfMessages { - [NSException raise:NSGenericException - format:@"Implementations should override the methods of GRPCTransport"]; -} - -@end diff --git a/src/objective-c/GRPCClient/GRPCTypes.h b/src/objective-c/GRPCClient/GRPCTypes.h deleted file mode 100644 index c804bca4eaa..00000000000 --- a/src/objective-c/GRPCClient/GRPCTypes.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/** - * gRPC error codes. - * Note that a few of these are never produced by the gRPC libraries, but are of - * general utility for server applications to produce. - */ -typedef NS_ENUM(NSUInteger, GRPCErrorCode) { - /** The operation was cancelled (typically by the caller). */ - GRPCErrorCodeCancelled = 1, - - /** - * Unknown error. Errors raised by APIs that do not return enough error - * information may be converted to this error. - */ - GRPCErrorCodeUnknown = 2, - - /** - * The client specified an invalid argument. Note that this differs from - * FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are - * problematic regardless of the state of the server (e.g., a malformed file - * name). - */ - GRPCErrorCodeInvalidArgument = 3, - - /** - * Deadline expired before operation could complete. For operations that - * change the state of the server, this error may be returned even if the - * operation has completed successfully. For example, a successful response - * from the server could have been delayed long enough for the deadline to - * expire. - */ - GRPCErrorCodeDeadlineExceeded = 4, - - /** Some requested entity (e.g., file or directory) was not found. */ - GRPCErrorCodeNotFound = 5, - - /** Some entity that we attempted to create (e.g., file or directory) already - exists. */ - GRPCErrorCodeAlreadyExists = 6, - - /** - * The caller does not have permission to execute the specified operation. - * PERMISSION_DENIED isn't used for rejections caused by exhausting some - * resource (RESOURCE_EXHAUSTED is used instead for those errors). - * PERMISSION_DENIED doesn't indicate a failure to identify the caller - * (UNAUTHENTICATED is used instead for those errors). - */ - GRPCErrorCodePermissionDenied = 7, - - /** - * The request does not have valid authentication credentials for the - * operation (e.g. the caller's identity can't be verified). - */ - GRPCErrorCodeUnauthenticated = 16, - - /** Some resource has been exhausted, perhaps a per-user quota. */ - GRPCErrorCodeResourceExhausted = 8, - - /** - * The RPC was rejected because the server is not in a state required for the - * procedure's execution. For example, a directory to be deleted may be - * non-empty, etc. The client should not retry until the server state has been - * explicitly fixed (e.g. by performing another RPC). The details depend on - * the service being called, and should be found in the NSError's userInfo. - */ - GRPCErrorCodeFailedPrecondition = 9, - - /** - * The RPC was aborted, typically due to a concurrency issue like sequencer - * check failures, transaction aborts, etc. The client should retry at a - * higher-level (e.g., restarting a read- modify-write sequence). - */ - GRPCErrorCodeAborted = 10, - - /** - * The RPC was attempted past the valid range. E.g., enumerating past the end - * of a list. Unlike INVALID_ARGUMENT, this error indicates a problem that may - * be fixed if the system state changes. For example, an RPC to get elements - * of a list will generate INVALID_ARGUMENT if asked to return the element at - * a negative index, but it will generate OUT_OF_RANGE if asked to return the - * element at an index past the current size of the list. - */ - GRPCErrorCodeOutOfRange = 11, - - /** The procedure is not implemented or not supported/enabled in this server. - */ - GRPCErrorCodeUnimplemented = 12, - - /** - * Internal error. Means some invariant expected by the server application or - * the gRPC library has been broken. - */ - GRPCErrorCodeInternal = 13, - - /** - * The server is currently unavailable. This is most likely a transient - * condition and may be corrected by retrying with a backoff. Note that it is - * not always safe to retry non-idempotent operations. - */ - GRPCErrorCodeUnavailable = 14, - - /** Unrecoverable data loss or corruption. */ - GRPCErrorCodeDataLoss = 15, -}; - -/** - * Safety remark of a gRPC method as defined in RFC 2616 Section 9.1 - */ -typedef NS_ENUM(NSUInteger, GRPCCallSafety) { - /** - * Signal that there is no guarantees on how the call affects the server - * state. - */ - GRPCCallSafetyDefault = 0, - /** Signal that the call is idempotent. gRPC is free to use PUT verb. */ - GRPCCallSafetyIdempotentRequest = 1, - /** - * Signal that the call is cacheable and will not affect server state. gRPC is - * free to use GET verb. - */ - GRPCCallSafetyCacheableRequest = 2, -}; - -// Compression algorithm to be used by a gRPC call -typedef NS_ENUM(NSUInteger, GRPCCompressionAlgorithm) { - GRPCCompressNone = 0, - GRPCCompressDeflate, - GRPCCompressGzip, - GRPCStreamCompressGzip, -}; - -// GRPCCompressAlgorithm is deprecated; use GRPCCompressionAlgorithm -typedef GRPCCompressionAlgorithm GRPCCompressAlgorithm; - -/** The transport to be used by a gRPC call */ -typedef NS_ENUM(NSUInteger, GRPCTransportType) { - GRPCTransportTypeDefault = 0, - /** gRPC internal HTTP/2 stack with BoringSSL */ - GRPCTransportTypeChttp2BoringSSL = 0, - /** Cronet stack */ - GRPCTransportTypeCronet, - /** Insecure channel. FOR TEST ONLY! */ - GRPCTransportTypeInsecure, -}; - -/** Domain of NSError objects produced by gRPC. */ -extern NSString* _Nonnull const kGRPCErrorDomain; - -/** - * Keys used in |NSError|'s |userInfo| dictionary to store the response headers - * and trailers sent by the server. - */ -extern NSString* _Nonnull const kGRPCHeadersKey; -extern NSString* _Nonnull const kGRPCTrailersKey; - -/** The id of a transport implementation. */ -typedef char* _Nonnull GRPCTransportId; - -/** - * Implement this protocol to provide a token to gRPC when a call is initiated. - */ -@protocol GRPCAuthorizationProtocol - -/** - * This method is called when gRPC is about to start the call. When OAuth token is acquired, - * \a handler is expected to be called with \a token being the new token to be used for this call. - */ -- (void)getTokenWithHandler:(void (^_Nonnull)(NSString* _Nullable token))handler; - -@end diff --git a/src/objective-c/GRPCClient/internal_testing/GRPCCall+InternalTests.m b/src/objective-c/GRPCClient/internal_testing/GRPCCall+InternalTests.m index 8f98daa6348..1bb352f0be2 100644 --- a/src/objective-c/GRPCClient/internal_testing/GRPCCall+InternalTests.m +++ b/src/objective-c/GRPCClient/internal_testing/GRPCCall+InternalTests.m @@ -20,7 +20,7 @@ #import "GRPCCall+InternalTests.h" -#import "../private/GRPCCore/GRPCOpBatchLog.h" +#import "../private/GRPCOpBatchLog.h" @implementation GRPCCall (InternalTests) diff --git a/src/objective-c/GRPCClient/private/GRPCCore/ChannelArgsUtil.h b/src/objective-c/GRPCClient/private/ChannelArgsUtil.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/ChannelArgsUtil.h rename to src/objective-c/GRPCClient/private/ChannelArgsUtil.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/ChannelArgsUtil.m b/src/objective-c/GRPCClient/private/ChannelArgsUtil.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/ChannelArgsUtil.m rename to src/objective-c/GRPCClient/private/ChannelArgsUtil.m diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCall+V2API.h b/src/objective-c/GRPCClient/private/GRPCCall+V2API.h similarity index 79% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCCall+V2API.h rename to src/objective-c/GRPCClient/private/GRPCCall+V2API.h index f6db3023cac..22bf16962c6 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCall+V2API.h +++ b/src/objective-c/GRPCClient/private/GRPCCall+V2API.h @@ -18,6 +18,12 @@ @interface GRPCCall (V2API) +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + callSafety:(GRPCCallSafety)safety + requestsWriter:(GRXWriter *)requestsWriter + callOptions:(GRPCCallOptions *)callOptions; + - (instancetype)initWithHost:(NSString *)host path:(NSString *)path callSafety:(GRPCCallSafety)safety diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.h b/src/objective-c/GRPCClient/private/GRPCCallInternal.h similarity index 70% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.h rename to src/objective-c/GRPCClient/private/GRPCCallInternal.h index 641b1fb2e8a..ac2d1cba2ec 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.h +++ b/src/objective-c/GRPCClient/private/GRPCCallInternal.h @@ -16,22 +16,20 @@ * */ -#import +#import NS_ASSUME_NONNULL_BEGIN -@protocol GRPCResponseHandler; -@class GRPCCallOptions; -@protocol GRPCChannelFactory; +@interface GRPCCall2Internal : NSObject -@interface GRPCCall2Internal : GRPCTransport +- (instancetype)init; -- (instancetype)initWithTransportManager:(GRPCTransportManager *)transportManager; +- (void)setResponseHandler:(id)responseHandler; - (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions - callOptions:(GRPCCallOptions *)callOptions; + callOptions:(nullable GRPCCallOptions *)callOptions; -- (void)writeData:(id)data; +- (void)writeData:(NSData *)data; - (void)finish; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m b/src/objective-c/GRPCClient/private/GRPCCallInternal.m similarity index 69% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m rename to src/objective-c/GRPCClient/private/GRPCCallInternal.m index ea01fcaf594..32e38158fad 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m +++ b/src/objective-c/GRPCClient/private/GRPCCallInternal.m @@ -19,10 +19,8 @@ #import "GRPCCallInternal.h" #import -#import #import -#import "../GRPCTransport+Private.h" #import "GRPCCall+V2API.h" @implementation GRPCCall2Internal { @@ -30,8 +28,8 @@ GRPCRequestOptions *_requestOptions; /** Options for the call. */ GRPCCallOptions *_callOptions; - /** The interceptor manager to process responses. */ - GRPCTransportManager *_transportManager; + /** The handler of responses. */ + id _handler; /** * Make use of legacy GRPCCall to make calls. Nullified when call is finished. @@ -53,28 +51,40 @@ NSUInteger _pendingReceiveNextMessages; } -- (instancetype)initWithTransportManager:(GRPCTransportManager *)transportManager { - dispatch_queue_t dispatchQueue; +- (instancetype)init { + if ((self = [super init])) { // Set queue QoS only when iOS version is 8.0 or above and Xcode version is 9.0 or above #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 - if (@available(iOS 8.0, macOS 10.10, *)) { - dispatchQueue = dispatch_queue_create( - NULL, dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); - } else { + if (@available(iOS 8.0, macOS 10.10, *)) { + _dispatchQueue = dispatch_queue_create( + NULL, + dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); + } else { #else - { + { #endif - dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); - } - if ((self = [super init])) { + _dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); + } _pipe = [GRXBufferedPipe pipe]; - _transportManager = transportManager; - _dispatchQueue = dispatchQueue; } return self; } -- (dispatch_queue_t)dispatchQueue { +- (void)setResponseHandler:(id)responseHandler { + @synchronized(self) { + NSAssert(!_started, @"Call already started."); + if (_started) { + return; + } + _handler = responseHandler; + _initialMetadataPublished = NO; + _started = NO; + _canceled = NO; + _finished = NO; + } +} + +- (dispatch_queue_t)requestDispatchQueue { return _dispatchQueue; } @@ -92,15 +102,26 @@ return; } - GRPCCall *copiedCall = nil; @synchronized(self) { + NSAssert(_handler != nil, @"Response handler required."); + if (_handler == nil) { + NSLog(@"Invalid response handler."); + return; + } _requestOptions = requestOptions; if (callOptions == nil) { _callOptions = [[GRPCCallOptions alloc] init]; } else { _callOptions = [callOptions copy]; } + } + [self start]; +} + +- (void)start { + GRPCCall *copiedCall = nil; + @synchronized(self) { NSAssert(!_started, @"Call already started."); NSAssert(!_canceled, @"Call already canceled."); if (_started) { @@ -119,7 +140,7 @@ callOptions:_callOptions writeDone:^{ @synchronized(self) { - if (self->_transportManager) { + if (self->_handler) { [self issueDidWriteData]; } } @@ -137,7 +158,7 @@ void (^valueHandler)(id value) = ^(id value) { @synchronized(self) { - if (self->_transportManager) { + if (self->_handler) { if (!self->_initialMetadataPublished) { self->_initialMetadataPublished = YES; [self issueInitialMetadata:self->_call.responseHeaders]; @@ -150,7 +171,7 @@ }; void (^completionHandler)(NSError *errorOrNil) = ^(NSError *errorOrNil) { @synchronized(self) { - if (self->_transportManager) { + if (self->_handler) { if (!self->_initialMetadataPublished) { self->_initialMetadataPublished = YES; [self issueInitialMetadata:self->_call.responseHeaders]; @@ -186,19 +207,20 @@ _call = nil; _pipe = nil; - if (_transportManager != nil) { - [_transportManager - forwardPreviousInterceptorCloseWithTrailingMetadata:nil - error: - [NSError - errorWithDomain:kGRPCErrorDomain - code: - GRPCErrorCodeCancelled - userInfo:@{ - NSLocalizedDescriptionKey : - @"Canceled by app" - }]]; - [_transportManager shutDown]; + if ([_handler respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { + id copiedHandler = _handler; + _handler = nil; + dispatch_async(copiedHandler.dispatchQueue, ^{ + [copiedHandler didCloseWithTrailingMetadata:nil + error:[NSError errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeCancelled + userInfo:@{ + NSLocalizedDescriptionKey : + @"Canceled by app" + }]]; + }); + } else { + _handler = nil; } } [copiedCall cancel]; @@ -249,25 +271,59 @@ } - (void)issueInitialMetadata:(NSDictionary *)initialMetadata { - if (initialMetadata != nil) { - [_transportManager forwardPreviousInterceptorWithInitialMetadata:initialMetadata]; + @synchronized(self) { + if (initialMetadata != nil && + [_handler respondsToSelector:@selector(didReceiveInitialMetadata:)]) { + id copiedHandler = _handler; + dispatch_async(_handler.dispatchQueue, ^{ + [copiedHandler didReceiveInitialMetadata:initialMetadata]; + }); + } } } - (void)issueMessage:(id)message { - if (message != nil) { - [_transportManager forwardPreviousInterceptorWithData:message]; + @synchronized(self) { + if (message != nil) { + if ([_handler respondsToSelector:@selector(didReceiveData:)]) { + id copiedHandler = _handler; + dispatch_async(_handler.dispatchQueue, ^{ + [copiedHandler didReceiveData:message]; + }); + } else if ([_handler respondsToSelector:@selector(didReceiveRawMessage:)]) { + id copiedHandler = _handler; + dispatch_async(_handler.dispatchQueue, ^{ + [copiedHandler didReceiveRawMessage:message]; + }); + } + } } } - (void)issueClosedWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { - [_transportManager forwardPreviousInterceptorCloseWithTrailingMetadata:trailingMetadata - error:error]; - [_transportManager shutDown]; + @synchronized(self) { + if ([_handler respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { + id copiedHandler = _handler; + // Clean up _handler so that no more responses are reported to the handler. + _handler = nil; + dispatch_async(copiedHandler.dispatchQueue, ^{ + [copiedHandler didCloseWithTrailingMetadata:trailingMetadata error:error]; + }); + } else { + _handler = nil; + } + } } - (void)issueDidWriteData { - [_transportManager forwardPreviousInterceptorDidWriteData]; + @synchronized(self) { + if (_callOptions.flowControlEnabled && [_handler respondsToSelector:@selector(didWriteData)]) { + id copiedHandler = _handler; + dispatch_async(copiedHandler.dispatchQueue, ^{ + [copiedHandler didWriteData]; + }); + } + } } - (void)receiveNextMessages:(NSUInteger)numberOfMessages { diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCChannel.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.h rename to src/objective-c/GRPCClient/private/GRPCChannel.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m similarity index 78% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m rename to src/objective-c/GRPCClient/private/GRPCChannel.m index cd2b4313acd..1a79fb04a0d 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -20,19 +20,18 @@ #include -#import "../../internal/GRPCCallOptions+Internal.h" -#import "../GRPCTransport+Private.h" +#import "../internal/GRPCCallOptions+Internal.h" #import "ChannelArgsUtil.h" #import "GRPCChannelFactory.h" #import "GRPCChannelPool.h" #import "GRPCCompletionQueue.h" -#import "GRPCCoreFactory.h" +#import "GRPCCronetChannelFactory.h" #import "GRPCInsecureChannelFactory.h" #import "GRPCSecureChannelFactory.h" +#import "version.h" #import #import -#import @implementation GRPCChannelConfiguration @@ -51,48 +50,32 @@ } - (id)channelFactory { - if (_callOptions.transport != NULL) { - id transportFactory = - [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:_callOptions.transport]; - if (! - [transportFactory respondsToSelector:@selector(createCoreChannelFactoryWithCallOptions:)]) { - // impossible because we are using GRPCCore now - [NSException raise:NSInternalInconsistencyException - format:@"Transport factory type is wrong"]; - } - id coreTransportFactory = - (id)transportFactory; - return [coreTransportFactory createCoreChannelFactoryWithCallOptions:_callOptions]; - } else { - // To maintain backwards compatibility with tranportType - GRPCTransportType type = _callOptions.transportType; - switch (type) { - case GRPCTransportTypeChttp2BoringSSL: - // TODO (mxyan): Remove when the API is deprecated - { - NSError *error; - id factory = [GRPCSecureChannelFactory - factoryWithPEMRootCertificates:_callOptions.PEMRootCertificates - privateKey:_callOptions.PEMPrivateKey - certChain:_callOptions.PEMCertificateChain - error:&error]; - NSAssert(factory != nil, @"Failed to create secure channel factory"); - if (factory == nil) { - NSLog(@"Error creating secure channel factory: %@", error); - } - return factory; + GRPCTransportType type = _callOptions.transportType; + switch (type) { + case GRPCTransportTypeChttp2BoringSSL: + // TODO (mxyan): Remove when the API is deprecated +#ifdef GRPC_COMPILE_WITH_CRONET + if (![GRPCCall isUsingCronet]) { +#else + { +#endif + NSError *error; + id factory = [GRPCSecureChannelFactory + factoryWithPEMRootCertificates:_callOptions.PEMRootCertificates + privateKey:_callOptions.PEMPrivateKey + certChain:_callOptions.PEMCertificateChain + error:&error]; + NSAssert(factory != nil, @"Failed to create secure channel factory"); + if (factory == nil) { + NSLog(@"Error creating secure channel factory: %@", error); } - case GRPCTransportTypeCronet: { - id transportFactory = (id)[ - [GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:gGRPCCoreCronetId]; - return [transportFactory createCoreChannelFactoryWithCallOptions:_callOptions]; + return factory; } - case GRPCTransportTypeInsecure: - return [GRPCInsecureChannelFactory sharedInstance]; - default: - NSLog(@"Unrecognized transport type"); - return nil; - } + // fallthrough + case GRPCTransportTypeCronet: + return [GRPCCronetChannelFactory sharedInstance]; + case GRPCTransportTypeInsecure: + return [GRPCInsecureChannelFactory sharedInstance]; } } @@ -215,7 +198,6 @@ } else { channelArgs = channelConfiguration.channelArgs; } - id factory = channelConfiguration.channelFactory; _unmanagedChannel = [factory createChannelWithHost:host channelArgs:channelArgs]; NSAssert(_unmanagedChannel != NULL, @"Failed to create channel"); diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCChannelFactory.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelFactory.h rename to src/objective-c/GRPCClient/private/GRPCChannelFactory.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool+Test.h b/src/objective-c/GRPCClient/private/GRPCChannelPool+Test.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool+Test.h rename to src/objective-c/GRPCClient/private/GRPCChannelPool+Test.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.h b/src/objective-c/GRPCClient/private/GRPCChannelPool.h similarity index 98% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.h rename to src/objective-c/GRPCClient/private/GRPCChannelPool.h index b83a28a2368..e00ee69e63a 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.h +++ b/src/objective-c/GRPCClient/private/GRPCChannelPool.h @@ -18,6 +18,8 @@ #import +#import "GRPCChannelFactory.h" + NS_ASSUME_NONNULL_BEGIN @protocol GRPCChannel; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m b/src/objective-c/GRPCClient/private/GRPCChannelPool.m similarity index 98% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m rename to src/objective-c/GRPCClient/private/GRPCChannelPool.m index 92f52e67b75..d545793fcce 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m +++ b/src/objective-c/GRPCClient/private/GRPCChannelPool.m @@ -18,16 +18,19 @@ #import -#import "../../internal/GRPCCallOptions+Internal.h" +#import "../internal/GRPCCallOptions+Internal.h" #import "GRPCChannel.h" #import "GRPCChannelFactory.h" #import "GRPCChannelPool+Test.h" #import "GRPCChannelPool.h" #import "GRPCCompletionQueue.h" +#import "GRPCCronetChannelFactory.h" #import "GRPCInsecureChannelFactory.h" #import "GRPCSecureChannelFactory.h" #import "GRPCWrappedCall.h" +#import "version.h" +#import #include extern const char *kCFStreamVarName; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.h b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.h rename to src/objective-c/GRPCClient/private/GRPCCompletionQueue.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.m b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.m rename to src/objective-c/GRPCClient/private/GRPCCompletionQueue.m diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h deleted file mode 100644 index 83d279d2c72..00000000000 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "../GRPCCoreFactory.h" - -/** - * The factory for gRPC Core + Cronet transport implementation. The - * implementation is not part of the default transports of gRPC and is for - * testing purpose only on Github. - * - * To use this transport, a user must include the GRPCCoreCronet module as a - * dependency of the project and use gGRPCCoreCronetId in call options to - * specify that this is the transport to be used for a call. - */ -@interface GRPCCoreCronetFactory : NSObject - -@end diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m deleted file mode 100644 index 5772694fc54..00000000000 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "GRPCCoreCronetFactory.h" - -#import -#import - -#import "../GRPCCallInternal.h" -#import "../GRPCCoreFactory.h" -#import "GRPCCronetChannelFactory.h" - -static GRPCCoreCronetFactory *gGRPCCoreCronetFactory = nil; -static dispatch_once_t gInitGRPCCoreCronetFactory; - -@implementation GRPCCoreCronetFactory - -+ (instancetype)sharedInstance { - dispatch_once(&gInitGRPCCoreCronetFactory, ^{ - gGRPCCoreCronetFactory = [[GRPCCoreCronetFactory alloc] init]; - }); - return gGRPCCoreCronetFactory; -} - -+ (void)load { - [[GRPCTransportRegistry sharedInstance] - registerTransportWithId:gGRPCCoreCronetId - factory:[GRPCCoreCronetFactory sharedInstance]]; -} - -- (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager { - return [[GRPCCall2Internal alloc] initWithTransportManager:transportManager]; -} - -- (id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions { - return [GRPCCronetChannelFactory sharedInstance]; -} - -@end diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h deleted file mode 100644 index 3cd312d4ad0..00000000000 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol GRPCChannelFactory; -@protocol GRPCCallOptions; - -/** The interface for transport implementations that are based on Core. */ -@protocol GRPCCoreTransportFactory - -/** Get the channel factory for GRPCChannel from call options. */ -- (nullable id)createCoreChannelFactoryWithCallOptions: - (GRPCCallOptions *)callOptions; - -@end - -/** The factory for gRPC Core + CFStream + TLS secure channel transport implementation. */ -@interface GRPCCoreSecureFactory : NSObject - -@end - -/** The factory for gRPC Core + CFStream + insecure channel transport implementation. */ -@interface GRPCCoreInsecureFactory : NSObject - -@end - -NS_ASSUME_NONNULL_END diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m deleted file mode 100644 index 19d7231a203..00000000000 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m +++ /dev/null @@ -1,90 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "GRPCCoreFactory.h" - -#import - -#import "GRPCCallInternal.h" -#import "GRPCInsecureChannelFactory.h" -#import "GRPCSecureChannelFactory.h" - -static GRPCCoreSecureFactory *gGRPCCoreSecureFactory = nil; -static GRPCCoreInsecureFactory *gGRPCCoreInsecureFactory = nil; -static dispatch_once_t gInitGRPCCoreSecureFactory; -static dispatch_once_t gInitGRPCCoreInsecureFactory; - -@implementation GRPCCoreSecureFactory - -+ (instancetype)sharedInstance { - dispatch_once(&gInitGRPCCoreSecureFactory, ^{ - gGRPCCoreSecureFactory = [[GRPCCoreSecureFactory alloc] init]; - }); - return gGRPCCoreSecureFactory; -} - -+ (void)load { - [[GRPCTransportRegistry sharedInstance] - registerTransportWithId:GRPCDefaultTransportImplList.core_secure - factory:[self sharedInstance]]; -} - -- (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager { - return [[GRPCCall2Internal alloc] initWithTransportManager:transportManager]; -} - -- (id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions { - NSError *error; - id factory = - [GRPCSecureChannelFactory factoryWithPEMRootCertificates:callOptions.PEMRootCertificates - privateKey:callOptions.PEMPrivateKey - certChain:callOptions.PEMCertificateChain - error:&error]; - if (error != nil) { - NSLog(@"Unable to create secure channel factory"); - return nil; - } - return factory; -} - -@end - -@implementation GRPCCoreInsecureFactory - -+ (instancetype)sharedInstance { - dispatch_once(&gInitGRPCCoreInsecureFactory, ^{ - gGRPCCoreInsecureFactory = [[GRPCCoreInsecureFactory alloc] init]; - }); - return gGRPCCoreInsecureFactory; -} - -+ (void)load { - [[GRPCTransportRegistry sharedInstance] - registerTransportWithId:GRPCDefaultTransportImplList.core_insecure - factory:[self sharedInstance]]; -} - -- (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager { - return [[GRPCCall2Internal alloc] initWithTransportManager:transportManager]; -} - -- (id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions { - return [GRPCInsecureChannelFactory sharedInstance]; -} - -@end diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.h similarity index 96% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.h rename to src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.h index 138ddf1f730..738dfdb7370 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.h +++ b/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.h @@ -15,7 +15,7 @@ * limitations under the License. * */ -#import "../GRPCChannelFactory.h" +#import "GRPCChannelFactory.h" @class GRPCChannel; typedef struct stream_engine stream_engine; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m b/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m similarity index 76% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m rename to src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m index da3f3afd855..5bcb021dc4b 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m +++ b/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m @@ -18,8 +18,10 @@ #import "GRPCCronetChannelFactory.h" -#import "../ChannelArgsUtil.h" -#import "../GRPCChannel.h" +#import "ChannelArgsUtil.h" +#import "GRPCChannel.h" + +#ifdef GRPC_COMPILE_WITH_CRONET #import #include @@ -57,3 +59,21 @@ } @end + +#else + +@implementation GRPCCronetChannelFactory + ++ (instancetype)sharedInstance { + NSAssert(NO, @"Must enable macro GRPC_COMPILE_WITH_CRONET to build Cronet channel."); + return nil; +} + +- (grpc_channel *)createChannelWithHost:(NSString *)host channelArgs:(NSDictionary *)args { + NSAssert(NO, @"Must enable macro GRPC_COMPILE_WITH_CRONET to build Cronet channel."); + return NULL; +} + +@end + +#endif diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.h b/src/objective-c/GRPCClient/private/GRPCHost.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.h rename to src/objective-c/GRPCClient/private/GRPCHost.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m similarity index 82% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m rename to src/objective-c/GRPCClient/private/GRPCHost.m index 1f6a25ff78f..63ffc927411 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCHost.m @@ -21,16 +21,17 @@ #import #import #import -#import #include #include -#import "../../internal/GRPCCallOptions+Internal.h" +#import "../internal/GRPCCallOptions+Internal.h" #import "GRPCChannelFactory.h" #import "GRPCCompletionQueue.h" +#import "GRPCCronetChannelFactory.h" #import "GRPCSecureChannelFactory.h" #import "NSDictionary+GRPC.h" +#import "version.h" NS_ASSUME_NONNULL_BEGIN @@ -112,12 +113,20 @@ static NSMutableDictionary *gHostCache; options.PEMPrivateKey = _PEMPrivateKey; options.PEMCertificateChain = _PEMCertificateChain; options.hostNameOverride = _hostNameOverride; - if (_transportType == GRPCTransportTypeInsecure) { - options.transport = GRPCDefaultTransportImplList.core_insecure; - } else if ([GRPCCall isUsingCronet]) { - options.transport = gGRPCCoreCronetId; - } else { - options.transport = GRPCDefaultTransportImplList.core_secure; +#ifdef GRPC_COMPILE_WITH_CRONET + // By old API logic, insecure channel precedes Cronet channel; Cronet channel preceeds default + // channel. + if ([GRPCCall isUsingCronet]) { + if (_transportType == GRPCTransportTypeInsecure) { + options.transportType = GRPCTransportTypeInsecure; + } else { + NSAssert(_transportType == GRPCTransportTypeDefault, @"Invalid transport type"); + options.transportType = GRPCTransportTypeCronet; + } + } else +#endif + { + options.transportType = _transportType; } options.logContext = _logContext; @@ -126,14 +135,16 @@ static NSMutableDictionary *gHostCache; + (GRPCCallOptions *)callOptionsForHost:(NSString *)host { // TODO (mxyan): Remove when old API is deprecated + NSURL *hostURL = [NSURL URLWithString:[@"https://" stringByAppendingString:host]]; + if (hostURL.host && hostURL.port == nil) { + host = [hostURL.host stringByAppendingString:@":443"]; + } + GRPCCallOptions *callOptions = nil; @synchronized(gHostCache) { - GRPCHost *hostConfig = [GRPCHost hostWithAddress:host]; - callOptions = [hostConfig callOptions]; + callOptions = [gHostCache[host] callOptions]; } - NSAssert(callOptions != nil, @"Unable to create call options object"); if (callOptions == nil) { - NSLog(@"Unable to create call options object"); callOptions = [[GRPCCallOptions alloc] init]; } return callOptions; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCInsecureChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCInsecureChannelFactory.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCInsecureChannelFactory.h rename to src/objective-c/GRPCClient/private/GRPCInsecureChannelFactory.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCInsecureChannelFactory.m b/src/objective-c/GRPCClient/private/GRPCInsecureChannelFactory.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCInsecureChannelFactory.m rename to src/objective-c/GRPCClient/private/GRPCInsecureChannelFactory.m diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCOpBatchLog.h b/src/objective-c/GRPCClient/private/GRPCOpBatchLog.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCOpBatchLog.h rename to src/objective-c/GRPCClient/private/GRPCOpBatchLog.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCOpBatchLog.m b/src/objective-c/GRPCClient/private/GRPCOpBatchLog.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCOpBatchLog.m rename to src/objective-c/GRPCClient/private/GRPCOpBatchLog.m diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCReachabilityFlagNames.xmacro.h b/src/objective-c/GRPCClient/private/GRPCReachabilityFlagNames.xmacro.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCReachabilityFlagNames.xmacro.h rename to src/objective-c/GRPCClient/private/GRPCReachabilityFlagNames.xmacro.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.h b/src/objective-c/GRPCClient/private/GRPCRequestHeaders.h similarity index 95% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.h rename to src/objective-c/GRPCClient/private/GRPCRequestHeaders.h index 0fced0c385a..545ff1cea82 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.h +++ b/src/objective-c/GRPCClient/private/GRPCRequestHeaders.h @@ -18,7 +18,7 @@ #import -#import +#import "../GRPCCall.h" @interface GRPCRequestHeaders : NSMutableDictionary diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.m b/src/objective-c/GRPCClient/private/GRPCRequestHeaders.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.m rename to src/objective-c/GRPCClient/private/GRPCRequestHeaders.m diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCSecureChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCSecureChannelFactory.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCSecureChannelFactory.h rename to src/objective-c/GRPCClient/private/GRPCSecureChannelFactory.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCSecureChannelFactory.m b/src/objective-c/GRPCClient/private/GRPCSecureChannelFactory.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCSecureChannelFactory.m rename to src/objective-c/GRPCClient/private/GRPCSecureChannelFactory.m diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h deleted file mode 100644 index 2dc7357c363..00000000000 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Private interfaces of the transport registry. - */ -@interface GRPCTransportRegistry (Private) - -/** - * Get a transport implementation's factory by its transport id. If the transport id was not - * registered with the registry, the default transport factory (core + secure) is returned. If the - * default transport does not exist, an exception is thrown. - */ -- (id)getTransportFactoryWithId:(GRPCTransportId)transportId; - -@end - -@interface GRPCTransportManager : NSObject - -- (instancetype)initWithTransportId:(GRPCTransportId)transportId - previousInterceptor:(id)previousInterceptor; - -/** - * Notify the manager that the transport has shut down and the manager should release references to - * its response handler and stop forwarding requests/responses. - */ -- (void)shutDown; - -/** Forward initial metadata to the previous interceptor in the interceptor chain */ -- (void)forwardPreviousInterceptorWithInitialMetadata:(nullable NSDictionary *)initialMetadata; - -/** Forward a received message to the previous interceptor in the interceptor chain */ -- (void)forwardPreviousInterceptorWithData:(nullable id)data; - -/** Forward call close and trailing metadata to the previous interceptor in the interceptor chain */ -- (void)forwardPreviousInterceptorCloseWithTrailingMetadata: - (nullable NSDictionary *)trailingMetadata - error:(nullable NSError *)error; - -/** Forward write completion to the previous interceptor in the interceptor chain */ -- (void)forwardPreviousInterceptorDidWriteData; - -@end - -NS_ASSUME_NONNULL_END diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m deleted file mode 100644 index 9072f7afbe2..00000000000 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m +++ /dev/null @@ -1,131 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "GRPCTransport+Private.h" - -#import - -@implementation GRPCTransportManager { - GRPCTransportId _transportId; - GRPCTransport *_transport; - id _previousInterceptor; - dispatch_queue_t _dispatchQueue; -} - -- (instancetype)initWithTransportId:(GRPCTransportId)transportId - previousInterceptor:(id)previousInterceptor { - if ((self = [super init])) { - id factory = - [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:transportId]; - - _transport = [factory createTransportWithManager:self]; - NSAssert(_transport != nil, @"Failed to create transport with id: %s", transportId); - if (_transport == nil) { - NSLog(@"Failed to create transport with id: %s", transportId); - return nil; - } - _previousInterceptor = previousInterceptor; - _dispatchQueue = _transport.dispatchQueue; - _transportId = transportId; - } - return self; -} - -- (void)shutDown { - dispatch_async(_dispatchQueue, ^{ - self->_transport = nil; - self->_previousInterceptor = nil; - }); -} - -- (dispatch_queue_t)dispatchQueue { - return _dispatchQueue; -} - -- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions - callOptions:(GRPCCallOptions *)callOptions { - if (_transportId != callOptions.transport) { - [NSException raise:NSInvalidArgumentException - format:@"Interceptors cannot change the call option 'transport'"]; - return; - } - [_transport startWithRequestOptions:requestOptions callOptions:callOptions]; -} - -- (void)writeData:(id)data { - [_transport writeData:data]; -} - -- (void)finish { - [_transport finish]; -} - -- (void)cancel { - [_transport cancel]; -} - -- (void)receiveNextMessages:(NSUInteger)numberOfMessages { - [_transport receiveNextMessages:numberOfMessages]; -} - -/** Forward initial metadata to the previous interceptor in the chain */ -- (void)forwardPreviousInterceptorWithInitialMetadata:(NSDictionary *)initialMetadata { - if (initialMetadata == nil || _previousInterceptor == nil) { - return; - } - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didReceiveInitialMetadata:initialMetadata]; - }); -} - -/** Forward a received message to the previous interceptor in the chain */ -- (void)forwardPreviousInterceptorWithData:(id)data { - if (data == nil || _previousInterceptor == nil) { - return; - } - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didReceiveData:data]; - }); -} - -/** Forward call close and trailing metadata to the previous interceptor in the chain */ -- (void)forwardPreviousInterceptorCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata - error:(NSError *)error { - if (_previousInterceptor == nil) { - return; - } - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; - }); -} - -/** Forward write completion to the previous interceptor in the chain */ -- (void)forwardPreviousInterceptorDidWriteData { - if (_previousInterceptor == nil) { - return; - } - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didWriteData]; - }); -} - -@end diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCWrappedCall.h b/src/objective-c/GRPCClient/private/GRPCWrappedCall.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCWrappedCall.h rename to src/objective-c/GRPCClient/private/GRPCWrappedCall.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/GRPCWrappedCall.m rename to src/objective-c/GRPCClient/private/GRPCWrappedCall.m diff --git a/src/objective-c/GRPCClient/private/GRPCCore/NSData+GRPC.h b/src/objective-c/GRPCClient/private/NSData+GRPC.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/NSData+GRPC.h rename to src/objective-c/GRPCClient/private/NSData+GRPC.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/NSData+GRPC.m b/src/objective-c/GRPCClient/private/NSData+GRPC.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/NSData+GRPC.m rename to src/objective-c/GRPCClient/private/NSData+GRPC.m diff --git a/src/objective-c/GRPCClient/private/GRPCCore/NSDictionary+GRPC.h b/src/objective-c/GRPCClient/private/NSDictionary+GRPC.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/NSDictionary+GRPC.h rename to src/objective-c/GRPCClient/private/NSDictionary+GRPC.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/NSDictionary+GRPC.m b/src/objective-c/GRPCClient/private/NSDictionary+GRPC.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/NSDictionary+GRPC.m rename to src/objective-c/GRPCClient/private/NSDictionary+GRPC.m diff --git a/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.h b/src/objective-c/GRPCClient/private/NSError+GRPC.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.h rename to src/objective-c/GRPCClient/private/NSError+GRPC.h diff --git a/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m b/src/objective-c/GRPCClient/private/NSError+GRPC.m similarity index 96% rename from src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m rename to src/objective-c/GRPCClient/private/NSError+GRPC.m index 5b5fc6263c5..3eefed88d63 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m +++ b/src/objective-c/GRPCClient/private/NSError+GRPC.m @@ -18,9 +18,10 @@ #import "NSError+GRPC.h" -#import #include +NSString *const kGRPCErrorDomain = @"io.grpc"; + @implementation NSError (GRPC) + (instancetype)grpc_errorFromStatusCode:(grpc_status_code)statusCode details:(const char *)details diff --git a/src/objective-c/GRPCClient/version.h b/src/objective-c/GRPCClient/private/version.h similarity index 100% rename from src/objective-c/GRPCClient/version.h rename to src/objective-c/GRPCClient/private/version.h diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h index c91adc7b7cd..12db46adeda 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.h +++ b/src/objective-c/ProtoRPC/ProtoRPC.h @@ -17,16 +17,12 @@ */ #import - -// import legacy header for compatibility with users using the ProtoRPC interface -#import "ProtoRPCLegacy.h" +#import #import "ProtoMethod.h" NS_ASSUME_NONNULL_BEGIN -@class GRPCRequestOptions; -@class GRPCCallOptions; @class GPBMessage; /** An object can implement this protocol to receive responses from server from a call. */ @@ -164,3 +160,35 @@ NS_ASSUME_NONNULL_BEGIN @end NS_ASSUME_NONNULL_END + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnullability-completeness" + +__attribute__((deprecated("Please use GRPCProtoCall."))) @interface ProtoRPC + : GRPCCall + + /** + * host parameter should not contain the scheme (http:// or https://), only the name or IP + * addr and the port number, for example @"localhost:5050". + */ + - + (instancetype)initWithHost : (NSString *)host method + : (GRPCProtoMethod *)method requestsWriter : (GRXWriter *)requestsWriter responseClass + : (Class)responseClass responsesWriteable + : (id)responsesWriteable NS_DESIGNATED_INITIALIZER; + +- (void)start; +@end + +/** + * This subclass is empty now. Eventually we'll remove ProtoRPC class + * to avoid potential naming conflict + */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + @interface GRPCProtoCall : ProtoRPC +#pragma clang diagnostic pop + + @end + +#pragma clang diagnostic pop diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m index dbfa3c0f23d..4700fdd1124 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.m +++ b/src/objective-c/ProtoRPC/ProtoRPC.m @@ -27,6 +27,24 @@ #import #import +/** + * Generate an NSError object that represents a failure in parsing a proto class. + */ +static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError) { + NSDictionary *info = @{ + NSLocalizedDescriptionKey : @"Unable to parse response from the server", + NSLocalizedRecoverySuggestionErrorKey : + @"If this RPC is idempotent, retry " + @"with exponential backoff. Otherwise, query the server status before " + @"retrying.", + NSUnderlyingErrorKey : parsingError, + @"Expected class" : expectedClass, + @"Received value" : proto, + }; + // TODO(jcanizales): Use kGRPCErrorDomain and GRPCErrorCodeInternal when they're public. + return [NSError errorWithDomain:@"io.grpc" code:13 userInfo:info]; +} + @implementation GRPCUnaryProtoCall { GRPCStreamingProtoCall *_call; GPBMessage *_message; @@ -273,3 +291,76 @@ } @end + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" +@implementation ProtoRPC { +#pragma clang diagnostic pop + id _responseWriteable; +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wobjc-designated-initializers" +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + requestsWriter:(GRXWriter *)requestsWriter { + [NSException raise:NSInvalidArgumentException + format:@"Please use ProtoRPC's designated initializer instead."]; + return nil; +} +#pragma clang diagnostic pop + +// Designated initializer +- (instancetype)initWithHost:(NSString *)host + method:(GRPCProtoMethod *)method + requestsWriter:(GRXWriter *)requestsWriter + responseClass:(Class)responseClass + responsesWriteable:(id)responsesWriteable { + // Because we can't tell the type system to constrain the class, we need to check at runtime: + if (![responseClass respondsToSelector:@selector(parseFromData:error:)]) { + [NSException raise:NSInvalidArgumentException + format:@"A protobuf class to parse the responses must be provided."]; + } + // A writer that serializes the proto messages to send. + GRXWriter *bytesWriter = [requestsWriter map:^id(GPBMessage *proto) { + if (![proto isKindOfClass:[GPBMessage class]]) { + [NSException raise:NSInvalidArgumentException + format:@"Request must be a proto message: %@", proto]; + } + return [proto data]; + }]; + if ((self = [super initWithHost:host path:method.HTTPPath requestsWriter:bytesWriter])) { + __weak ProtoRPC *weakSelf = self; + + // A writeable that parses the proto messages received. + _responseWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { + // TODO(jcanizales): This is done in the main thread, and needs to happen in another thread. + NSError *error = nil; + id parsed = [responseClass parseFromData:value error:&error]; + if (parsed) { + [responsesWriteable writeValue:parsed]; + } else { + [weakSelf finishWithError:ErrorForBadProto(value, responseClass, error)]; + } + } + completionHandler:^(NSError *errorOrNil) { + [responsesWriteable writesFinishedWithError:errorOrNil]; + }]; + } + return self; +} + +- (void)start { + [self startWithWriteable:_responseWriteable]; +} + +- (void)startWithWriteable:(id)writeable { + [super startWithWriteable:writeable]; + // Break retain cycles. + _responseWriteable = nil; +} +@end + +@implementation GRPCProtoCall + +@end diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h deleted file mode 100644 index b8d4003f695..00000000000 --- a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import - -// Import category headers for Swift build -#import -#import -#import -#import -#import -#import - -@class GRPCProtoMethod; -@class GRXWriter; -@protocol GRXWriteable; - -__attribute__((deprecated("Please use GRPCProtoCall."))) @interface ProtoRPC - : GRPCCall - - /** - * host parameter should not contain the scheme (http:// or https://), only the name or IP - * addr and the port number, for example @"localhost:5050". - */ - - - (instancetype)initWithHost : (NSString *)host method - : (GRPCProtoMethod *)method requestsWriter : (GRXWriter *)requestsWriter responseClass - : (Class)responseClass responsesWriteable - : (id)responsesWriteable NS_DESIGNATED_INITIALIZER; - -- (void)start; - -@end - -/** - * This subclass is empty now. Eventually we'll remove ProtoRPC class - * to avoid potential naming conflict - */ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - @interface GRPCProtoCall - : ProtoRPC -#pragma clang diagnostic pop - - @end - - /** - * Generate an NSError object that represents a failure in parsing a proto class. For gRPC - * internal use only. - */ - NSError * - ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError); diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m deleted file mode 100644 index 4ba93674063..00000000000 --- a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m +++ /dev/null @@ -1,121 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "ProtoRPCLegacy.h" - -#import "ProtoMethod.h" - -#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS -#import -#else -#import -#endif -#import -#import -#import - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -@implementation ProtoRPC { -#pragma clang diagnostic pop - id _responseWriteable; -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-designated-initializers" -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - requestsWriter:(GRXWriter *)requestsWriter { - [NSException raise:NSInvalidArgumentException - format:@"Please use ProtoRPC's designated initializer instead."]; - return nil; -} -#pragma clang diagnostic pop - -// Designated initializer -- (instancetype)initWithHost:(NSString *)host - method:(GRPCProtoMethod *)method - requestsWriter:(GRXWriter *)requestsWriter - responseClass:(Class)responseClass - responsesWriteable:(id)responsesWriteable { - // Because we can't tell the type system to constrain the class, we need to check at runtime: - if (![responseClass respondsToSelector:@selector(parseFromData:error:)]) { - [NSException raise:NSInvalidArgumentException - format:@"A protobuf class to parse the responses must be provided."]; - } - // A writer that serializes the proto messages to send. - GRXWriter *bytesWriter = [requestsWriter map:^id(GPBMessage *proto) { - if (![proto isKindOfClass:[GPBMessage class]]) { - [NSException raise:NSInvalidArgumentException - format:@"Request must be a proto message: %@", proto]; - } - return [proto data]; - }]; - if ((self = [super initWithHost:host path:method.HTTPPath requestsWriter:bytesWriter])) { - __weak ProtoRPC *weakSelf = self; - - // A writeable that parses the proto messages received. - _responseWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { - // TODO(jcanizales): This is done in the main thread, and needs to happen in another thread. - NSError *error = nil; - id parsed = [responseClass parseFromData:value error:&error]; - if (parsed) { - [responsesWriteable writeValue:parsed]; - } else { - [weakSelf finishWithError:ErrorForBadProto(value, responseClass, error)]; - } - } - completionHandler:^(NSError *errorOrNil) { - [responsesWriteable writesFinishedWithError:errorOrNil]; - }]; - } - return self; -} - -- (void)start { - [self startWithWriteable:_responseWriteable]; -} - -- (void)startWithWriteable:(id)writeable { - [super startWithWriteable:writeable]; - // Break retain cycles. - _responseWriteable = nil; -} -@end - -@implementation GRPCProtoCall - -@end - -/** - * Generate an NSError object that represents a failure in parsing a proto class. - */ -NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError) { - NSDictionary *info = @{ - NSLocalizedDescriptionKey : @"Unable to parse response from the server", - NSLocalizedRecoverySuggestionErrorKey : - @"If this RPC is idempotent, retry " - @"with exponential backoff. Otherwise, query the server status before " - @"retrying.", - NSUnderlyingErrorKey : parsingError, - @"Expected class" : expectedClass, - @"Received value" : proto, - }; - // TODO(jcanizales): Use kGRPCErrorDomain and GRPCErrorCodeInternal when they're public. - return [NSError errorWithDomain:@"io.grpc" code:13 userInfo:info]; -} diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index fd8a86bb2b2..900ec8d0e1e 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -18,12 +18,14 @@ #import -#import -#import "ProtoRPC.h" - +@class GRPCProtoCall; @protocol GRXWriteable; @class GRXWriter; @class GRPCCallOptions; +@class GRPCProtoCall; +@class GRPCUnaryProtoCall; +@class GRPCStreamingProtoCall; +@protocol GRPCProtoResponseHandler; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-completeness" @@ -36,6 +38,15 @@ __attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoServ : (nonnull NSString *)packageName serviceName : (nonnull NSString *)serviceName callOptions : (nullable GRPCCallOptions *)callOptions NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithHost:(NSString *)host + packageName:(NSString *)packageName + serviceName:(NSString *)serviceName; + +- (GRPCProtoCall *)RPCToMethod:(NSString *)method + requestsWriter:(GRXWriter *)requestsWriter + responseClass:(Class)responseClass + responsesWriteable:(id)responsesWriteable; + - (nullable GRPCUnaryProtoCall *)RPCToMethod:(nonnull NSString *)method message:(nonnull id)message responseHandler:(nonnull id)handler @@ -47,18 +58,6 @@ __attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoServ callOptions:(nullable GRPCCallOptions *)callOptions responseClass:(nonnull Class)responseClass; -@end - - @interface ProtoService(Legacy) - - - (instancetype)initWithHost : (NSString *)host packageName - : (NSString *)packageName serviceName : (NSString *)serviceName; - -- (GRPCProtoCall *)RPCToMethod:(NSString *)method - requestsWriter:(GRXWriter *)requestsWriter - responseClass:(Class)responseClass - responsesWriteable:(id)responsesWriteable; - @end #pragma clang diagnostic pop diff --git a/src/objective-c/ProtoRPC/ProtoService.m b/src/objective-c/ProtoRPC/ProtoService.m index e84cab8903f..80a1f2f226c 100644 --- a/src/objective-c/ProtoRPC/ProtoService.m +++ b/src/objective-c/ProtoRPC/ProtoService.m @@ -29,21 +29,15 @@ #pragma clang diagnostic ignored "-Wdeprecated-implementations" @implementation ProtoService { #pragma clang diagnostic pop - - GRPCCallOptions *_callOptions; NSString *_host; NSString *_packageName; NSString *_serviceName; + GRPCCallOptions *_callOptions; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnonnull" -// Do not call the default init method - (instancetype)init { - [NSException raise:NSGenericException format:@"Do not call init method of ProtoService"]; - return [self initWithHost:nil packageName:nil serviceName:nil callOptions:nil]; + return [self initWithHost:nil packageName:nil serviceName:nil]; } -#pragma clang diagnostic pop // Designated initializer - (instancetype)initWithHost:(NSString *)host @@ -64,6 +58,38 @@ return self; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wobjc-designated-initializers" +// Do not call designated initializer here due to nullability incompatibility. This method is from +// old API and does not assert on nullability of the parameters. + +- (instancetype)initWithHost:(NSString *)host + packageName:(NSString *)packageName + serviceName:(NSString *)serviceName { + if ((self = [super init])) { + _host = [host copy]; + _packageName = [packageName copy]; + _serviceName = [serviceName copy]; + _callOptions = nil; + } + return self; +} + +#pragma clang diagnostic pop + +- (GRPCProtoCall *)RPCToMethod:(NSString *)method + requestsWriter:(GRXWriter *)requestsWriter + responseClass:(Class)responseClass + responsesWriteable:(id)responsesWriteable { + GRPCProtoMethod *methodName = + [[GRPCProtoMethod alloc] initWithPackage:_packageName service:_serviceName method:method]; + return [[GRPCProtoCall alloc] initWithHost:_host + method:methodName + requestsWriter:requestsWriter + responseClass:responseClass + responsesWriteable:responsesWriteable]; +} + - (GRPCUnaryProtoCall *)RPCToMethod:(NSString *)method message:(id)message responseHandler:(id)handler diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.h b/src/objective-c/ProtoRPC/ProtoServiceLegacy.h deleted file mode 100644 index 7b0b7a4de7e..00000000000 --- a/src/objective-c/ProtoRPC/ProtoServiceLegacy.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "ProtoService.h" - -@class GRPCProtoCall; -@class GRXWriter; -@protocol GRXWriteable; diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m deleted file mode 100644 index 6aa64955381..00000000000 --- a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m +++ /dev/null @@ -1,71 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import - -#import "ProtoMethod.h" -#import "ProtoRPCLegacy.h" -#import "ProtoService.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -@implementation ProtoService (Legacy) -#pragma clang diagnostic pop - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-designated-initializers" -// Do not call designated initializer here due to nullability incompatibility. This method is from -// old API and does not assert on nullability of the parameters. - -- (instancetype)initWithHost:(NSString *)host - packageName:(NSString *)packageName - serviceName:(NSString *)serviceName { - if ((self = [super init])) { - Ivar hostIvar = class_getInstanceVariable([ProtoService class], "_host"); - Ivar packageNameIvar = class_getInstanceVariable([ProtoService class], "_packageName"); - Ivar serviceNameIvar = class_getInstanceVariable([ProtoService class], "_serviceName"); - - object_setIvar(self, hostIvar, [host copy]); - object_setIvar(self, packageNameIvar, [packageName copy]); - object_setIvar(self, serviceNameIvar, [serviceName copy]); - } - return self; -} -#pragma clang diagnostic pop - -- (GRPCProtoCall *)RPCToMethod:(NSString *)method - requestsWriter:(GRXWriter *)requestsWriter - responseClass:(Class)responseClass - responsesWriteable:(id)responsesWriteable { - Ivar hostIvar = class_getInstanceVariable([ProtoService class], "_host"); - Ivar packageNameIvar = class_getInstanceVariable([ProtoService class], "_packageName"); - Ivar serviceNameIvar = class_getInstanceVariable([ProtoService class], "_serviceName"); - NSString *host = object_getIvar(self, hostIvar); - NSString *packageName = object_getIvar(self, packageNameIvar); - NSString *serviceName = object_getIvar(self, serviceNameIvar); - - GRPCProtoMethod *methodName = - [[GRPCProtoMethod alloc] initWithPackage:packageName service:serviceName method:method]; - return [[GRPCProtoCall alloc] initWithHost:host - method:methodName - requestsWriter:requestsWriter - responseClass:responseClass - responsesWriteable:responsesWriteable]; -} - -@end diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m index 9c466260121..c94ee8c2569 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m @@ -25,8 +25,6 @@ #import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" #endif -#import -#import @interface ViewController () diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m index ce204a9c146..3e97767cf0c 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m @@ -24,8 +24,6 @@ #import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" #endif -#import -#import @interface InterfaceController () diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index 65a32d742a9..fed92596b17 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -95,12 +95,19 @@ tvos_application( deps = ["host-lib"], ) +grpc_objc_testing_library( + name = "CronetConfig", + srcs = ["ConfigureCronet.m"], + hdrs = ["ConfigureCronet.h"], +) + grpc_objc_testing_library( name = "InteropTests-lib", hdrs = ["InteropTests/InteropTests.h"], srcs = ["InteropTests/InteropTests.m"], deps = [ ":InteropTestsBlockCallbacks-lib", + ":CronetConfig", ], ) @@ -193,6 +200,7 @@ ios_unit_test( ":InteropTestsRemote-lib", ":InteropTestsLocalSSL-lib", ":InteropTestsLocalCleartext-lib", + # ":InteropTestsMulitpleChannels-lib", # needs Cronet ], test_host = ":ios-host", ) diff --git a/src/objective-c/tests/ConfigureCronet.h b/src/objective-c/tests/ConfigureCronet.h index ba0efc4df66..cc5c038f3c6 100644 --- a/src/objective-c/tests/ConfigureCronet.h +++ b/src/objective-c/tests/ConfigureCronet.h @@ -16,6 +16,8 @@ * */ +#ifdef GRPC_COMPILE_WITH_CRONET + #ifdef __cplusplus extern "C" { #endif @@ -28,3 +30,5 @@ void configureCronet(void); #ifdef __cplusplus } #endif + +#endif diff --git a/src/objective-c/tests/ConfigureCronet.m b/src/objective-c/tests/ConfigureCronet.m index 6fc7e0ee9f5..ab137e28cad 100644 --- a/src/objective-c/tests/ConfigureCronet.m +++ b/src/objective-c/tests/ConfigureCronet.m @@ -16,6 +16,8 @@ * */ +#ifdef GRPC_COMPILE_WITH_CRONET + #import "ConfigureCronet.h" #import @@ -33,3 +35,5 @@ void configureCronet(void) { [Cronet startNetLogToFile:@"cronet_netlog.json" logBytes:YES]; }); } + +#endif diff --git a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m index aa1af301b96..a2a79c46316 100644 --- a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m +++ b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m @@ -22,7 +22,6 @@ #import #import -#import "../ConfigureCronet.h" #import "InteropTests.h" // The server address is derived from preprocessor macro, which is @@ -41,19 +40,12 @@ static int32_t kRemoteInteropServerOverhead = 12; @implementation InteropTestsRemoteWithCronet -+ (void)setUp { - configureCronet(); - [GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]]; - - [super setUp]; -} - + (NSString *)host { return kRemoteSSLHost; } -+ (GRPCTransportId)transport { - return gGRPCCoreCronetId; ++ (BOOL)useCronet { + return YES; } - (int32_t)encodingOverhead { diff --git a/src/objective-c/tests/InteropTests/InteropTests.h b/src/objective-c/tests/InteropTests/InteropTests.h index a4adecd5415..28fcbff9695 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.h +++ b/src/objective-c/tests/InteropTests/InteropTests.h @@ -48,19 +48,11 @@ - (int32_t)encodingOverhead; /** - * DEPRECATED: \a transportType is a deprecated option. Please use \a transport instead. - * * The type of transport to be used. The base implementation returns default. Subclasses should * override to appropriate settings. */ + (GRPCTransportType)transportType; -/* - * The transport to be used. The base implementation returns NULL. Subclasses should override to - * appropriate settings. - */ -+ (GRPCTransportId)transport; - /** * The root certificates to be used. The base implementation returns nil. Subclasses should override * to appropriate settings. @@ -73,4 +65,9 @@ */ + (NSString *)hostNameOverride; +/** + * Whether to use Cronet for all the v1 API tests in the test suite. + */ ++ (BOOL)useCronet; + @end diff --git a/src/objective-c/tests/InteropTests/InteropTests.m b/src/objective-c/tests/InteropTests/InteropTests.m index 21198f7bad9..a8f7db7ee93 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.m +++ b/src/objective-c/tests/InteropTests/InteropTests.m @@ -20,6 +20,9 @@ #include +#ifdef GRPC_COMPILE_WITH_CRONET +#import +#endif #import #import #import @@ -35,6 +38,7 @@ #import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" #import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" +#import "../ConfigureCronet.h" #import "InteropTestsBlockCallbacks.h" #define TEST_TIMEOUT 32 @@ -87,8 +91,9 @@ BOOL isRemoteInteropTest(NSString *host) { - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { dispatch_queue_t queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); - return - [[GRPCInterceptor alloc] initWithInterceptorManager:interceptorManager dispatchQueue:queue]; + return [[GRPCInterceptor alloc] initWithInterceptorManager:interceptorManager + requestDispatchQueue:queue + responseDispatchQueue:queue]; } @end @@ -96,19 +101,21 @@ BOOL isRemoteInteropTest(NSString *host) { @interface HookInterceptorFactory : NSObject - (instancetype) - initWithDispatchQueue:(dispatch_queue_t)dispatchQueue - startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, - GRPCInterceptorManager *manager))startHook - writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook - finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook -receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, - GRPCInterceptorManager *manager))receiveNextMessagesHook - responseHeaderHook:(void (^)(NSDictionary *initialMetadata, - GRPCInterceptorManager *manager))responseHeaderHook - responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook - responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, - GRPCInterceptorManager *manager))responseCloseHook - didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook; +initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue + responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue + startHook:(void (^)(GRPCRequestOptions *requestOptions, + GRPCCallOptions *callOptions, + GRPCInterceptorManager *manager))startHook + writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook + finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook + receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, + GRPCInterceptorManager *manager))receiveNextMessagesHook + responseHeaderHook:(void (^)(NSDictionary *initialMetadata, + GRPCInterceptorManager *manager))responseHeaderHook + responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook + responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, + GRPCInterceptorManager *manager))responseCloseHook + didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook; - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager; @@ -118,7 +125,8 @@ receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, - (instancetype) initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - dispatchQueue:(dispatch_queue_t)dispatchQueue + requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue + responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook @@ -147,25 +155,29 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager void (^_responseCloseHook)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager); void (^_didWriteDataHook)(GRPCInterceptorManager *manager); - dispatch_queue_t _dispatchQueue; + dispatch_queue_t _requestDispatchQueue; + dispatch_queue_t _responseDispatchQueue; } - (instancetype) - initWithDispatchQueue:(dispatch_queue_t)dispatchQueue - startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, - GRPCInterceptorManager *manager))startHook - writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook - finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook -receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, - GRPCInterceptorManager *manager))receiveNextMessagesHook - responseHeaderHook:(void (^)(NSDictionary *initialMetadata, - GRPCInterceptorManager *manager))responseHeaderHook - responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook - responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, - GRPCInterceptorManager *manager))responseCloseHook - didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { +initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue + responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue + startHook:(void (^)(GRPCRequestOptions *requestOptions, + GRPCCallOptions *callOptions, + GRPCInterceptorManager *manager))startHook + writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook + finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook + receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, + GRPCInterceptorManager *manager))receiveNextMessagesHook + responseHeaderHook:(void (^)(NSDictionary *initialMetadata, + GRPCInterceptorManager *manager))responseHeaderHook + responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook + responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, + GRPCInterceptorManager *manager))responseCloseHook + didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { if ((self = [super init])) { - _dispatchQueue = dispatchQueue; + _requestDispatchQueue = requestDispatchQueue; + _responseDispatchQueue = responseDispatchQueue; _startHook = startHook; _writeDataHook = writeDataHook; _finishHook = finishHook; @@ -180,7 +192,8 @@ receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { return [[HookInterceptor alloc] initWithInterceptorManager:interceptorManager - dispatchQueue:_dispatchQueue + requestDispatchQueue:_requestDispatchQueue + responseDispatchQueue:_responseDispatchQueue startHook:_startHook writeDataHook:_writeDataHook finishHook:_finishHook @@ -205,16 +218,22 @@ receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, GRPCInterceptorManager *manager); void (^_didWriteDataHook)(GRPCInterceptorManager *manager); GRPCInterceptorManager *_manager; - dispatch_queue_t _dispatchQueue; + dispatch_queue_t _requestDispatchQueue; + dispatch_queue_t _responseDispatchQueue; +} + +- (dispatch_queue_t)requestDispatchQueue { + return _requestDispatchQueue; } - (dispatch_queue_t)dispatchQueue { - return _dispatchQueue; + return _responseDispatchQueue; } - (instancetype) initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - dispatchQueue:(dispatch_queue_t)dispatchQueue + requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue + responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook @@ -228,7 +247,9 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager))responseCloseHook didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { - if ((self = [super initWithInterceptorManager:interceptorManager dispatchQueue:dispatchQueue])) { + if ((self = [super initWithInterceptorManager:interceptorManager + requestDispatchQueue:requestDispatchQueue + responseDispatchQueue:responseDispatchQueue])) { _startHook = startHook; _writeDataHook = writeDataHook; _finishHook = finishHook; @@ -237,7 +258,8 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager _responseDataHook = responseDataHook; _responseCloseHook = responseCloseHook; _didWriteDataHook = didWriteDataHook; - _dispatchQueue = dispatchQueue; + _requestDispatchQueue = requestDispatchQueue; + _responseDispatchQueue = responseDispatchQueue; _manager = interceptorManager; } return self; @@ -298,7 +320,8 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager @property BOOL enabled; -- (instancetype)initWithDispatchQueue:(dispatch_queue_t)dispatchQueue; +- (instancetype)initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue + responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue; - (void)setStartHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook @@ -317,23 +340,26 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager @implementation GlobalInterceptorFactory -- (instancetype)initWithDispatchQueue:(dispatch_queue_t)dispatchQueue { +- (instancetype)initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue + responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue { _enabled = NO; - return [super initWithDispatchQueue:dispatchQueue - startHook:nil - writeDataHook:nil - finishHook:nil - receiveNextMessagesHook:nil - responseHeaderHook:nil - responseDataHook:nil - responseCloseHook:nil - didWriteDataHook:nil]; + return [super initWithRequestDispatchQueue:requestDispatchQueue + responseDispatchQueue:responseDispatchQueue + startHook:nil + writeDataHook:nil + finishHook:nil + receiveNextMessagesHook:nil + responseHeaderHook:nil + responseDataHook:nil + responseCloseHook:nil + didWriteDataHook:nil]; } - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { if (_enabled) { return [[HookInterceptor alloc] initWithInterceptorManager:interceptorManager - dispatchQueue:_dispatchQueue + requestDispatchQueue:_requestDispatchQueue + responseDispatchQueue:_responseDispatchQueue startHook:_startHook writeDataHook:_writeDataHook finishHook:_finishHook @@ -399,15 +425,10 @@ static dispatch_once_t initGlobalInterceptorFactory; return 0; } -// For backwards compatibility + (GRPCTransportType)transportType { return GRPCTransportTypeChttp2BoringSSL; } -+ (GRPCTransportId)transport { - return NULL; -} - + (NSString *)PEMRootCertificates { return nil; } @@ -416,11 +437,26 @@ static dispatch_once_t initGlobalInterceptorFactory; return nil; } ++ (BOOL)useCronet { + return NO; +} + + (void)setUp { +#ifdef GRPC_COMPILE_WITH_CRONET + configureCronet(); + if ([self useCronet]) { + [GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]]; + } +#endif +#ifdef GRPC_CFSTREAM + setenv(kCFStreamVarName, "1", 1); +#endif + dispatch_once(&initGlobalInterceptorFactory, ^{ dispatch_queue_t globalInterceptorQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); globalInterceptorFactory = - [[GlobalInterceptorFactory alloc] initWithDispatchQueue:globalInterceptorQueue]; + [[GlobalInterceptorFactory alloc] initWithRequestDispatchQueue:globalInterceptorQueue + responseDispatchQueue:globalInterceptorQueue]; [GRPCCall2 registerGlobalInterceptor:globalInterceptorFactory]; }); } @@ -466,9 +502,7 @@ static dispatch_once_t initGlobalInterceptorFactory; GPBEmpty *request = [GPBEmpty message]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility options.transportType = [[self class] transportType]; - options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -497,9 +531,7 @@ static dispatch_once_t initGlobalInterceptorFactory; GPBEmpty *request = [GPBEmpty message]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility options.transportType = [[self class] transportType]; - options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -576,9 +608,7 @@ static dispatch_once_t initGlobalInterceptorFactory; request.payload.body = [NSMutableData dataWithLength:271828]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility options.transportType = [[self class] transportType]; - options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -626,9 +656,7 @@ static dispatch_once_t initGlobalInterceptorFactory; request.responseStatus.code = GRPC_STATUS_CANCELLED; } GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility options.transportType = [[self class] transportType]; - options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -930,9 +958,7 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility options.transportType = [[self class] transportType]; - options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -984,9 +1010,7 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility options.transportType = [[self class] transportType]; - options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.flowControlEnabled = YES; @@ -1143,9 +1167,7 @@ static dispatch_once_t initGlobalInterceptorFactory; __block BOOL receivedResponse = NO; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility options.transportType = self.class.transportType; - options.transport = [[self class] transport]; options.PEMRootCertificates = self.class.PEMRootCertificates; options.hostNameOverride = [[self class] hostNameOverride]; @@ -1178,9 +1200,7 @@ static dispatch_once_t initGlobalInterceptorFactory; [self expectationWithDescription:@"Call completed."]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility options.transportType = self.class.transportType; - options.transport = [[self class] transport]; options.PEMRootCertificates = self.class.PEMRootCertificates; options.hostNameOverride = [[self class] hostNameOverride]; @@ -1266,47 +1286,48 @@ static dispatch_once_t initGlobalInterceptorFactory; [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil]; } -- (void)testKeepaliveWithV2API { +#ifndef GRPC_COMPILE_WITH_CRONET +- (void)testKeepalive { XCTAssertNotNil([[self class] host]); - if ([[self class] transport] == gGRPCCoreCronetId) { - // Cronet does not support keepalive - return; - } __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Keepalive"]; - NSNumber *kRequestSize = @27182; - NSNumber *kResponseSize = @31415; + [GRPCCall setKeepaliveWithInterval:1500 timeout:0 forHost:[[self class] host]]; - id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:kRequestSize - requestedResponseSize:kResponseSize]; - GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - options.transportType = [[self class] transportType]; - options.transport = [[self class] transport]; - options.PEMRootCertificates = [[self class] PEMRootCertificates]; - options.hostNameOverride = [[self class] hostNameOverride]; - options.keepaliveInterval = 1.5; - options.keepaliveTimeout = 0; + NSArray *requests = @[ @27182, @8 ]; + NSArray *responses = @[ @31415, @9 ]; - __block GRPCStreamingProtoCall *call = [_service - fullDuplexCallWithResponseHandler: - [[InteropTestsBlockCallbacks alloc] - initWithInitialMetadataCallback:nil - messageCallback:nil - closeCallback:^(NSDictionary *trailingMetadata, NSError *error) { - XCTAssertNotNil(error); - XCTAssertEqual( - error.code, GRPC_STATUS_UNAVAILABLE, - @"Received status %ld instead of UNAVAILABLE (14).", - error.code); - [expectation fulfill]; - }] - callOptions:options]; - [call writeMessage:request]; - [call start]; + GRXBufferedPipe *requestsBuffer = [[GRXBufferedPipe alloc] init]; + + __block int index = 0; + + id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] + requestedResponseSize:responses[index]]; + [requestsBuffer writeValue:request]; + + [_service + fullDuplexCallWithRequestsWriter:requestsBuffer + eventHandler:^(BOOL done, RMTStreamingOutputCallResponse *response, + NSError *error) { + if (index == 0) { + XCTAssertNil(error, @"Finished with unexpected error: %@", error); + XCTAssertTrue(response, @"Event handler called without an event."); + XCTAssertFalse(done); + index++; + } else { + // Keepalive should kick after 1s elapsed and fails the call. + XCTAssertNotNil(error); + XCTAssertEqual(error.code, GRPC_STATUS_UNAVAILABLE); + XCTAssertEqualObjects( + error.localizedDescription, @"keepalive watchdog timeout", + @"Unexpected failure that is not keepalive watchdog timeout."); + XCTAssertTrue(done); + [expectation fulfill]; + } + }]; [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil]; - [call finish]; } +#endif - (void)testDefaultInterceptor { XCTAssertNotNil([[self class] host]); @@ -1321,9 +1342,7 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility options.transportType = [[self class] transportType]; - options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.interceptorFactories = @[ [[DefaultInterceptorFactory alloc] init] ]; @@ -1378,7 +1397,8 @@ static dispatch_once_t initGlobalInterceptorFactory; __block NSUInteger responseCloseCount = 0; __block NSUInteger didWriteDataCount = 0; id factory = [[HookInterceptorFactory alloc] - initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager) { startCount++; @@ -1426,9 +1446,7 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility options.transportType = [[self class] transportType]; - options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.flowControlEnabled = YES; @@ -1506,7 +1524,8 @@ static dispatch_once_t initGlobalInterceptorFactory; __block NSUInteger responseDataCount = 0; __block NSUInteger responseCloseCount = 0; id factory = [[HookInterceptorFactory alloc] - initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager) { startCount++; @@ -1533,7 +1552,6 @@ static dispatch_once_t initGlobalInterceptorFactory; // finish must happen after the hijacking, so directly reply with a close [manager forwardPreviousInterceptorCloseWithTrailingMetadata:@{@"grpc-status" : @"0"} error:nil]; - [manager shutDown]; } receiveNextMessagesHook:nil responseHeaderHook:^(NSDictionary *initialMetadata, GRPCInterceptorManager *manager) { @@ -1560,9 +1578,7 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility options.transportType = [[self class] transportType]; - options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.interceptorFactories = @[ [[DefaultInterceptorFactory alloc] init], factory ]; @@ -1671,9 +1687,7 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility options.transportType = [[self class] transportType]; - options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.flowControlEnabled = YES; @@ -1728,15 +1742,16 @@ static dispatch_once_t initGlobalInterceptorFactory; - (void)testConflictingGlobalInterceptors { id factory = [[HookInterceptorFactory alloc] - initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) - startHook:nil - writeDataHook:nil - finishHook:nil - receiveNextMessagesHook:nil - responseHeaderHook:nil - responseDataHook:nil - responseCloseHook:nil - didWriteDataHook:nil]; + initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + startHook:nil + writeDataHook:nil + finishHook:nil + receiveNextMessagesHook:nil + responseHeaderHook:nil + responseDataHook:nil + responseCloseHook:nil + didWriteDataHook:nil]; @try { [GRPCCall2 registerGlobalInterceptor:factory]; XCTFail(@"Did not receive an exception when registering global interceptor the second time"); @@ -1760,7 +1775,8 @@ static dispatch_once_t initGlobalInterceptorFactory; __block NSUInteger didWriteDataCount = 0; id factory = [[HookInterceptorFactory alloc] - initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager) { startCount++; @@ -1856,9 +1872,7 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // For backwards compatibility options.transportType = [[self class] transportType]; - options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.flowControlEnabled = YES; diff --git a/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m b/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m index 2e638099e1e..a9c69183332 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m +++ b/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m @@ -17,7 +17,6 @@ */ #import -#import #import #import "InteropTests.h" @@ -61,8 +60,8 @@ static int32_t kLocalInteropServerOverhead = 10; [GRPCCall useInsecureConnectionsForHost:kLocalCleartextHost]; } -+ (GRPCTransportId)transport { - return GRPCDefaultTransportImplList.core_insecure; ++ (GRPCTransportType)transportType { + return GRPCTransportTypeInsecure; } @end diff --git a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m index 30d8f4c34af..e8222f602f4 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m +++ b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m @@ -17,7 +17,6 @@ */ #import -#import #import #import "InteropTests.h" @@ -57,8 +56,8 @@ static int32_t kLocalInteropServerOverhead = 10; return kLocalInteropServerOverhead; // bytes } -+ (GRPCTransportId)transport { - return GRPCDefaultTransportImplList.core_secure; ++ (GRPCTransportType)transportType { + return GRPCTransportTypeChttp2BoringSSL; } - (void)setUp { diff --git a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m index dc48391cbcc..98893a466bd 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m +++ b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m @@ -18,8 +18,9 @@ #import +#ifdef GRPC_COMPILE_WITH_CRONET #import -#import +#endif #import #import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" diff --git a/src/objective-c/tests/InteropTests/InteropTestsRemote.m b/src/objective-c/tests/InteropTests/InteropTestsRemote.m index 2dd8f0aed89..c1cd9b81efc 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsRemote.m +++ b/src/objective-c/tests/InteropTests/InteropTestsRemote.m @@ -53,8 +53,14 @@ static int32_t kRemoteInteropServerOverhead = 12; return kRemoteInteropServerOverhead; // bytes } +#ifdef GRPC_COMPILE_WITH_CRONET ++ (GRPCTransportType)transportType { + return GRPCTransportTypeCronet; +} +#else + (GRPCTransportType)transportType { return GRPCTransportTypeChttp2BoringSSL; } +#endif @end diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index c83e8861e93..c2297aa00fd 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -30,23 +30,23 @@ target 'MacTests' do grpc_deps end +target 'UnitTests' do + platform :ios, '8.0' + grpc_deps +end + %w( - UnitTests InteropTests + CronetTests ).each do |target_name| target target_name do platform :ios, '8.0' grpc_deps - end -end -target 'CronetTests' do - platform :ios, '8.0' - grpc_deps - - pod 'gRPC/GRPCCoreCronet', :path => GRPC_LOCAL_SRC - pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c" - pod 'gRPC-Core/Tests', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true + pod 'gRPC-Core/Cronet-Implementation', :path => GRPC_LOCAL_SRC + pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c" + pod 'gRPC-Core/Tests', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true + end end # gRPC-Core.podspec needs to be modified to be successfully used for local development. A Podfile's @@ -103,7 +103,7 @@ post_install do |installer| # the test target 'InteropTestsRemoteWithCronet' # Activate GRPCCall+InternalTests functions for the dedicated build configuration 'Test', which will # be used by all test targets using it. - if /gRPC(-macOS|-iOS|-tvOS|\.|-[0-9a-f])/.match(target.name) + if /gRPC-(mac|i|tv)OS/.match(target.name) target.build_configurations.each do |config| if config.name == 'Cronet' config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_COMPILE_WITH_CRONET=1 GRPC_TEST_OBJC=1' @@ -114,7 +114,7 @@ post_install do |installer| end # Enable NSAssert on gRPC - if /(gRPC|ProtoRPC|RxLibrary)/.match(target.name) + if /(gRPC|ProtoRPC|RxLibrary)-(mac|i|tv)OS/.match(target.name) target.build_configurations.each do |config| if config.name != 'Release' config.build_settings['ENABLE_NS_ASSERTIONS'] = 'YES' diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 6cb9f5560b9..a88838fdc8b 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -8,14 +8,15 @@ /* Begin PBXBuildFile section */ 5E0282E9215AA697007AC99D /* NSErrorUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0282E8215AA697007AC99D /* NSErrorUnitTests.m */; }; - 5E08D07023021E3B006D76EA /* InteropTestsMultipleChannels.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487722778226006656AD /* InteropTestsMultipleChannels.m */; }; 5E3F14842278B461007C6D90 /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; 5E3F14852278BF5D007C6D90 /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; 5E3F14862278BFFF007C6D90 /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; 5E3F148D22792856007C6D90 /* ConfigureCronet.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F1487227918AA007C6D90 /* ConfigureCronet.m */; }; + 5E3F148E22792AF5007C6D90 /* ConfigureCronet.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F1487227918AA007C6D90 /* ConfigureCronet.m */; }; 5E7F486422775B37006656AD /* InteropTestsRemoteWithCronet.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE84BF31D4717E40050C6CC /* InteropTestsRemoteWithCronet.m */; }; 5E7F486522775B41006656AD /* CronetUnitTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5EAD6D261E27047400002378 /* CronetUnitTests.mm */; }; 5E7F486E22778086006656AD /* CoreCronetEnd2EndTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F486D22778086006656AD /* CoreCronetEnd2EndTests.mm */; }; + 5E7F487922778226006656AD /* InteropTestsMultipleChannels.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487722778226006656AD /* InteropTestsMultipleChannels.m */; }; 5E7F487D22778256006656AD /* ChannelPoolTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487B22778256006656AD /* ChannelPoolTest.m */; }; 5E7F487E22778256006656AD /* ChannelTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487C22778256006656AD /* ChannelTests.m */; }; 5E7F4880227782C1006656AD /* APIv2Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487F227782C1006656AD /* APIv2Tests.m */; }; @@ -33,7 +34,6 @@ 5EA4770322736178000F72FC /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; }; 5EA477042273617B000F72FC /* InteropTestsLocalCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */; }; 5EA4770522736AC4000F72FC /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; - 5ECFED8623030DCC00626501 /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; 65EB19E418B39A8374D407BB /* libPods-CronetTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B1511C20E16A8422B58D61A /* libPods-CronetTests.a */; }; 903163C7FE885838580AEC7A /* libPods-InteropTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D457AD9797664CFA191C3280 /* libPods-InteropTests.a */; }; 953CD2942A3A6D6CE695BE87 /* libPods-MacTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 276873A05AC5479B60DF6079 /* libPods-MacTests.a */; }; @@ -515,6 +515,7 @@ 5EA476F12272816A000F72FC /* Frameworks */, 5EA476F22272816A000F72FC /* Resources */, D11CB94CF56A1E53760D29D8 /* [CP] Copy Pods Resources */, + 0FEFD5FC6B323AC95549AE4A /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -629,7 +630,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 5ECFED8623030DCC00626501 /* TestCertificates.bundle in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -678,6 +678,24 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + 0FEFD5FC6B323AC95549AE4A /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh", + "${PODS_ROOT}/CronetFramework/Cronet.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 292EA42A76AC7933A37235FD /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -703,7 +721,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC.default-GRPCCoreCronet/gRPCCertificates.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( @@ -880,7 +898,6 @@ files = ( 5E3F14852278BF5D007C6D90 /* InteropTestsBlockCallbacks.m in Sources */, 5E3F148D22792856007C6D90 /* ConfigureCronet.m in Sources */, - 5E08D07023021E3B006D76EA /* InteropTestsMultipleChannels.m in Sources */, 5E7F486E22778086006656AD /* CoreCronetEnd2EndTests.mm in Sources */, 5E7F488522778A88006656AD /* InteropTests.m in Sources */, 5E7F486422775B37006656AD /* InteropTestsRemoteWithCronet.m in Sources */, @@ -893,7 +910,9 @@ buildActionMask = 2147483647; files = ( 5E3F14842278B461007C6D90 /* InteropTestsBlockCallbacks.m in Sources */, + 5E3F148E22792AF5007C6D90 /* ConfigureCronet.m in Sources */, 5E7F488922778B04006656AD /* InteropTestsRemote.m in Sources */, + 5E7F487922778226006656AD /* InteropTestsMultipleChannels.m in Sources */, 5EA477042273617B000F72FC /* InteropTestsLocalCleartext.m in Sources */, 5EA4770322736178000F72FC /* InteropTestsLocalSSL.m in Sources */, 5E7F488422778A88006656AD /* InteropTests.m in Sources */, diff --git a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTests.xcscheme b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTests.xcscheme index cbde360a338..adb3c366af2 100644 --- a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTests.xcscheme +++ b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTests.xcscheme @@ -23,7 +23,7 @@ @@ -48,7 +48,7 @@ + buildConfiguration = "Cronet"> -#import "../../GRPCClient/private/GRPCCore/GRPCChannel.h" -#import "../../GRPCClient/private/GRPCCore/GRPCChannelPool+Test.h" -#import "../../GRPCClient/private/GRPCCore/GRPCCompletionQueue.h" +#import "../../GRPCClient/private/GRPCChannel.h" +#import "../../GRPCClient/private/GRPCChannelPool+Test.h" +#import "../../GRPCClient/private/GRPCCompletionQueue.h" #define TEST_TIMEOUT 32 diff --git a/src/objective-c/tests/UnitTests/ChannelTests.m b/src/objective-c/tests/UnitTests/ChannelTests.m index 1ed0f16ecaf..df78e8b1162 100644 --- a/src/objective-c/tests/UnitTests/ChannelTests.m +++ b/src/objective-c/tests/UnitTests/ChannelTests.m @@ -19,11 +19,11 @@ #import #import "../../GRPCClient/GRPCCallOptions.h" -#import "../../GRPCClient/private/GRPCCore/GRPCChannel.h" -#import "../../GRPCClient/private/GRPCCore/GRPCChannelPool+Test.h" -#import "../../GRPCClient/private/GRPCCore/GRPCChannelPool.h" -#import "../../GRPCClient/private/GRPCCore/GRPCCompletionQueue.h" -#import "../../GRPCClient/private/GRPCCore/GRPCWrappedCall.h" +#import "../../GRPCClient/private/GRPCChannel.h" +#import "../../GRPCClient/private/GRPCChannelPool+Test.h" +#import "../../GRPCClient/private/GRPCChannelPool.h" +#import "../../GRPCClient/private/GRPCCompletionQueue.h" +#import "../../GRPCClient/private/GRPCWrappedCall.h" static NSString *kDummyHost = @"dummy.host"; static NSString *kDummyPath = @"/dummy/path"; diff --git a/src/objective-c/tests/UnitTests/NSErrorUnitTests.m b/src/objective-c/tests/UnitTests/NSErrorUnitTests.m index 74e5794c480..8a4f03a4460 100644 --- a/src/objective-c/tests/UnitTests/NSErrorUnitTests.m +++ b/src/objective-c/tests/UnitTests/NSErrorUnitTests.m @@ -20,7 +20,7 @@ #import -#import "../../GRPCClient/private/GRPCCore/NSError+GRPC.h" +#import "../../GRPCClient/private/NSError+GRPC.h" @interface NSErrorUnitTests : XCTestCase diff --git a/templates/gRPC-ProtoRPC.podspec.template b/templates/gRPC-ProtoRPC.podspec.template index e94f149ee4a..457d2988036 100644 --- a/templates/gRPC-ProtoRPC.podspec.template +++ b/templates/gRPC-ProtoRPC.podspec.template @@ -44,40 +44,22 @@ s.module_name = name s.header_dir = name - s.default_subspec = 'Main', 'Legacy', 'Legacy-Header' + src_dir = 'src/objective-c/ProtoRPC' - s.subspec 'Legacy-Header' do |ss| - ss.header_mappings_dir = "src/objective-c/ProtoRPC" - ss.public_header_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.h" - ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.h" - end + s.default_subspec = 'Main' s.subspec 'Main' do |ss| - ss.header_mappings_dir = "src/objective-c/ProtoRPC" - ss.dependency "#{s.name}/Legacy-Header", version - ss.dependency 'gRPC/Interface', version - ss.dependency 'Protobuf', '~> 3.0' - - ss.source_files = "src/objective-c/ProtoRPC/ProtoMethod.{h,m}", - "src/objective-c/ProtoRPC/ProtoRPC.{h,m}", - "src/objective-c/ProtoRPC/ProtoService.{h,m}" - end - - s.subspec 'Legacy' do |ss| - ss.header_mappings_dir = "src/objective-c/ProtoRPC" - ss.dependency "#{s.name}/Main", version - ss.dependency "#{s.name}/Legacy-Header", version - ss.dependency 'gRPC/GRPCCore', version + ss.header_mappings_dir = "#{src_dir}" + ss.dependency 'gRPC', version ss.dependency 'gRPC-RxLibrary', version ss.dependency 'Protobuf', '~> 3.0' - ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.m", - "src/objective-c/ProtoRPC/ProtoServiceLegacy.m" + ss.source_files = "#{src_dir}/*.{h,m}" end # CFStream is now default. Leaving this subspec only for compatibility purpose. s.subspec 'CFStream' do |ss| - ss.dependency "#{s.name}/Legacy", version + ss.dependency "#{s.name}/Main", version end s.pod_target_xcconfig = { diff --git a/templates/gRPC-RxLibrary.podspec.template b/templates/gRPC-RxLibrary.podspec.template index 772265dadda..9389c5ecd8d 100644 --- a/templates/gRPC-RxLibrary.podspec.template +++ b/templates/gRPC-RxLibrary.podspec.template @@ -44,23 +44,6 @@ s.module_name = name s.header_dir = name - s.default_subspec = 'Interface', 'Implementation' - - src_dir = 'src/objective-c/RxLibrary' - s.subspec 'Interface' do |ss| - ss.header_mappings_dir = "#{src_dir}" - ss.source_files = "#{src_dir}/*.h" - ss.public_header_files = "#{src_dir}/*.h" - end - - s.subspec 'Implementation' do |ss| - ss.header_mappings_dir = "#{src_dir}" - ss.source_files = "#{src_dir}/*.m", "#{src_dir}/**/*.{h,m}" - ss.private_header_files = "#{src_dir}/**/*.h" - - ss.dependency "#{s.name}/Interface" - end - src_dir = 'src/objective-c/RxLibrary' s.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" s.private_header_files = "#{src_dir}/private/*.h" diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index e705edc1748..8cb380ede03 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -43,7 +43,13 @@ s.module_name = name s.header_dir = name - s.default_subspec = 'Interface', 'GRPCCore', 'Interface-Legacy' + src_dir = 'src/objective-c/GRPCClient' + + s.dependency 'gRPC-RxLibrary', version + s.default_subspec = 'Main' + + # Certificates, to be able to establish TLS connections: + s.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } s.pod_target_xcconfig = { # This is needed by all pods that depend on gRPC-RxLibrary: @@ -51,103 +57,29 @@ 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } - s.subspec 'Interface-Legacy' do |ss| - ss.header_mappings_dir = 'src/objective-c/GRPCClient' - - ss.public_header_files = "GRPCClient/GRPCCall+ChannelArg.h", - "GRPCClient/GRPCCall+ChannelCredentials.h", - "GRPCClient/GRPCCall+Cronet.h", - "GRPCClient/GRPCCall+OAuth2.h", - "GRPCClient/GRPCCall+Tests.h", - "src/objective-c/GRPCClient/GRPCCallLegacy.h", - "src/objective-c/GRPCClient/GRPCTypes.h" - - ss.source_files = "GRPCClient/GRPCCall+ChannelArg.h", - "GRPCClient/GRPCCall+ChannelCredentials.h", - "GRPCClient/GRPCCall+Cronet.h", - "GRPCClient/GRPCCall+OAuth2.h", - "GRPCClient/GRPCCall+Tests.h", - "src/objective-c/GRPCClient/GRPCCallLegacy.h", - "src/objective-c/GRPCClient/GRPCTypes.h" - ss.dependency "gRPC-RxLibrary/Interface", version - end + s.subspec 'Main' do |ss| + ss.header_mappings_dir = "#{src_dir}" - s.subspec 'Interface' do |ss| - ss.header_mappings_dir = 'src/objective-c/GRPCClient' - - ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall.h', - 'src/objective-c/GRPCClient/GRPCCall+Interceptor.h', - 'src/objective-c/GRPCClient/GRPCCallOptions.h', - 'src/objective-c/GRPCClient/GRPCInterceptor.h', - 'src/objective-c/GRPCClient/GRPCTransport.h', - 'src/objective-c/GRPCClient/GRPCDispatchable.h', - 'src/objective-c/GRPCClient/version.h' - - ss.source_files = 'src/objective-c/GRPCClient/GRPCCall.h', - 'src/objective-c/GRPCClient/GRPCCall.m', - 'src/objective-c/GRPCClient/GRPCCall+Interceptor.h', - 'src/objective-c/GRPCClient/GRPCCall+Interceptor.m', - 'src/objective-c/GRPCClient/GRPCCallOptions.h', - 'src/objective-c/GRPCClient/GRPCCallOptions.m', - 'src/objective-c/GRPCClient/GRPCDispatchable.h', - 'src/objective-c/GRPCClient/GRPCInterceptor.h', - 'src/objective-c/GRPCClient/GRPCInterceptor.m', - 'src/objective-c/GRPCClient/GRPCTransport.h', - 'src/objective-c/GRPCClient/GRPCTransport.m', - 'src/objective-c/GRPCClient/internal/*.h', - 'src/objective-c/GRPCClient/private/GRPCTransport+Private.h', - 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m', - 'src/objective-c/GRPCClient/version.h' - - ss.dependency "#{s.name}/Interface-Legacy", version - end + ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" + ss.exclude_files = "#{src_dir}/GRPCCall+GID.{h,m}" + ss.private_header_files = "#{src_dir}/private/*.h", "#{src_dir}/internal/*.h" - s.subspec 'GRPCCore' do |ss| - ss.header_mappings_dir = 'src/objective-c/GRPCClient' - - ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', - 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', - 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', - 'src/objective-c/GRPCClient/GRPCCall+Tests.h', - 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', - 'src/objective-c/GRPCClient/internal_testing/*.h' - ss.private_header_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.h' - ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.{h,m}', - 'src/objective-c/GRPCClient/private/GRPCCore/*.{h,m}', - 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', - 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.m', - 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', - 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m', - 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', - 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', - 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', - 'src/objective-c/GRPCClient/GRPCCall+OAuth2.m', - 'src/objective-c/GRPCClient/GRPCCall+Tests.h', - 'src/objective-c/GRPCClient/GRPCCall+Tests.m', - 'src/objective-c/GRPCClient/GRPCCallLegacy.m' - - # Certificates, to be able to establish TLS connections: - ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } - - ss.dependency "#{s.name}/Interface-Legacy", version - ss.dependency "#{s.name}/Interface", version ss.dependency 'gRPC-Core', version - ss.dependency 'gRPC-RxLibrary', version - end - - s.subspec 'GRPCCoreCronet' do |ss| - ss.header_mappings_dir = 'src/objective-c/GRPCClient' - - ss.source_files = 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', - 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', - 'src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/*.{h,m}' - ss.dependency "#{s.name}/GRPCCore", version - ss.dependency 'gRPC-Core/Cronet-Implementation', version - ss.dependency 'CronetFramework' end # CFStream is now default. Leaving this subspec only for compatibility purpose. s.subspec 'CFStream' do |ss| - ss.dependency "#{s.name}/GRPCCore", version + ss.dependency "#{s.name}/Main", version + end + + s.subspec 'GID' do |ss| + ss.ios.deployment_target = '7.0' + + ss.header_mappings_dir = "#{src_dir}" + + ss.source_files = "#{src_dir}/GRPCCall+GID.{h,m}" + + ss.dependency "#{s.name}/Main", version + ss.dependency 'Google/SignIn' end end diff --git a/templates/src/objective-c/GRPCClient/version.h.template b/templates/src/objective-c/GRPCClient/private/version.h.template similarity index 100% rename from templates/src/objective-c/GRPCClient/version.h.template rename to templates/src/objective-c/GRPCClient/private/version.h.template From a1ca6a099d90aa0ff8002b75eeee00119d69f4f0 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Wed, 28 Aug 2019 10:07:18 -0700 Subject: [PATCH 480/661] Refactor response building in xds test --- test/cpp/end2end/xds_end2end_test.cc | 390 ++++++++++++++------------- 1 file changed, 203 insertions(+), 187 deletions(-) diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 480680c9a32..1c073de1b12 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -96,7 +96,6 @@ constexpr char kEdsTypeUrl[] = "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment"; constexpr char kDefaultLocalityRegion[] = "xds_default_locality_region"; constexpr char kDefaultLocalityZone[] = "xds_default_locality_zone"; -constexpr char kDefaultLocalitySubzone[] = "xds_default_locality_subzone"; constexpr char kLbDropType[] = "lb"; constexpr char kThrottleDropType[] = "throttle"; constexpr int kDefaultLocalityWeight = 3; @@ -260,6 +259,31 @@ class ClientStats { class EdsServiceImpl : public EdsService { public: + struct ResponseArgs { + struct Locality { + Locality(const grpc::string& sub_zone, std::vector ports, + int lb_weight = kDefaultLocalityWeight, int priority = 0) + : sub_zone(std::move(sub_zone)), + ports(std::move(ports)), + lb_weight(lb_weight), + priority(priority) {} + + const grpc::string sub_zone; + std::vector ports; + int lb_weight; + int priority; + }; + + ResponseArgs() = default; + explicit ResponseArgs(std::vector locality_list) + : locality_list(std::move(locality_list)) {} + + std::vector locality_list; + std::map drop_categories; + FractionalPercent::DenominatorType drop_denominator = + FractionalPercent::MILLION; + }; + using Stream = ServerReaderWriter; using ResponseDelayPair = std::pair; @@ -317,47 +341,35 @@ class EdsServiceImpl : public EdsService { gpr_log(GPR_INFO, "LB[%p]: shut down", this); } - // TODO(juanlishen): Put the args into a struct. - static DiscoveryResponse BuildResponse( - const std::vector>& backend_ports, - const std::vector& lb_weights = {}, - size_t first_locality_name_index = 0, - const std::map& drop_categories = {}, - const FractionalPercent::DenominatorType denominator = - FractionalPercent::MILLION) { + static DiscoveryResponse BuildResponse(const ResponseArgs& args) { ClusterLoadAssignment assignment; assignment.set_cluster_name("service name"); - for (size_t i = 0; i < backend_ports.size(); ++i) { + for (const auto& locality : args.locality_list) { auto* endpoints = assignment.add_endpoints(); - const int lb_weight = - lb_weights.empty() ? kDefaultLocalityWeight : lb_weights[i]; - endpoints->mutable_load_balancing_weight()->set_value(lb_weight); - endpoints->set_priority(0); + endpoints->mutable_load_balancing_weight()->set_value(locality.lb_weight); + endpoints->set_priority(locality.priority); endpoints->mutable_locality()->set_region(kDefaultLocalityRegion); endpoints->mutable_locality()->set_zone(kDefaultLocalityZone); - std::ostringstream sub_zone; - sub_zone << kDefaultLocalitySubzone << '_' - << first_locality_name_index + i; - endpoints->mutable_locality()->set_sub_zone(sub_zone.str()); - for (const int& backend_port : backend_ports[i]) { + endpoints->mutable_locality()->set_sub_zone(locality.sub_zone); + for (const int& port : locality.ports) { auto* lb_endpoints = endpoints->add_lb_endpoints(); auto* endpoint = lb_endpoints->mutable_endpoint(); auto* address = endpoint->mutable_address(); auto* socket_address = address->mutable_socket_address(); socket_address->set_address("127.0.0.1"); - socket_address->set_port_value(backend_port); + socket_address->set_port_value(port); } } - if (!drop_categories.empty()) { + if (!args.drop_categories.empty()) { auto* policy = assignment.mutable_policy(); - for (const auto& p : drop_categories) { + for (const auto& p : args.drop_categories) { const grpc::string& name = p.first; const uint32_t parts_per_million = p.second; auto* drop_overload = policy->add_drop_overloads(); drop_overload->set_category(name); auto* drop_percentage = drop_overload->mutable_drop_percentage(); drop_percentage->set_numerator(parts_per_million); - drop_percentage->set_denominator(denominator); + drop_percentage->set_denominator(args.drop_denominator); } } DiscoveryResponse response; @@ -729,24 +741,6 @@ class XdsEnd2endTest : public ::testing::Test { return backend_ports; } - const std::vector> GetBackendPortsInGroups( - size_t start_index = 0, size_t stop_index = 0, - size_t num_group = 1) const { - if (stop_index == 0) stop_index = backends_.size(); - size_t group_size = (stop_index - start_index) / num_group; - std::vector> backend_ports; - for (size_t i = 0; i < num_group; ++i) { - backend_ports.emplace_back(); - size_t group_start = group_size * i + start_index; - size_t group_stop = - i == num_group - 1 ? stop_index : group_start + group_size; - for (size_t j = group_start; j < group_stop; ++j) { - backend_ports[i].push_back(backends_[j]->port()); - } - } - return backend_ports; - } - void ScheduleResponseForBalancer(size_t i, const DiscoveryResponse& response, int delay_ms) { balancers_[i]->eds_service()->add_response(response, delay_ms); @@ -938,8 +932,10 @@ TEST_F(SingleBalancerTest, Vanilla) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); const size_t kNumRpcsPerAddress = 100; - ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponse(GetBackendPortsInGroups()), 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts()}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); // Make sure that trying to connect works without a call. channel_->GetState(true /* try_to_connect */); // We need to wait for all backends to come online. @@ -962,17 +958,18 @@ TEST_F(SingleBalancerTest, SameBackendListedMultipleTimes) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); // Same backend listed twice. - std::vector ports; - ports.push_back(backends_[0]->port()); - ports.push_back(backends_[0]->port()); + std::vector ports(2, backends_[0]->port()); + EdsServiceImpl::ResponseArgs args({ + {"locality0", ports}, + }); const size_t kNumRpcsPerAddress = 10; - ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse({ports}), 0); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); // We need to wait for the backend to come online. WaitForBackend(0); // Send kNumRpcsPerAddress RPCs per server. CheckRpcSendOk(kNumRpcsPerAddress * ports.size()); // Backend should have gotten 20 requests. - EXPECT_EQ(kNumRpcsPerAddress * 2, + EXPECT_EQ(kNumRpcsPerAddress * ports.size(), backends_[0]->backend_service()->request_count()); // And they should have come from a single client port, because of // subchannel sharing. @@ -985,8 +982,10 @@ TEST_F(SingleBalancerTest, SecureNaming) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannel({balancers_[0]->port()}); const size_t kNumRpcsPerAddress = 100; - ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponse(GetBackendPortsInGroups()), 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts()}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); // Make sure that trying to connect works without a call. channel_->GetState(true /* try_to_connect */); // We need to wait for all backends to come online. @@ -1031,11 +1030,17 @@ TEST_F(SingleBalancerTest, InitiallyEmptyServerlist) { const int kServerlistDelayMs = 500 * grpc_test_slowdown_factor(); const int kCallDeadlineMs = kServerlistDelayMs * 2; // First response is an empty serverlist, sent right away. - ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse({{}}), 0); - // Send non-empty serverlist only after kServerlistDelayMs - ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponse(GetBackendPortsInGroups()), - kServerlistDelayMs); + EdsServiceImpl::ResponseArgs::Locality empty_locality("locality0", {}); + EdsServiceImpl::ResponseArgs args({ + empty_locality, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); + // Send non-empty serverlist only after kServerlistDelayMs. + args = EdsServiceImpl::ResponseArgs({ + {"locality0", GetBackendPorts()}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), + kServerlistDelayMs); const auto t0 = system_clock::now(); // Client will block: LB will initially send empty serverlist. CheckRpcSendOk(1, kCallDeadlineMs, true /* wait_for_ready */); @@ -1061,7 +1066,10 @@ TEST_F(SingleBalancerTest, AllServersUnreachableFailFast) { for (size_t i = 0; i < kNumUnreachableServers; ++i) { ports.push_back(grpc_pick_unused_port_or_die()); } - ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse({ports}), 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", ports}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); const Status status = SendRpc(); // The error shouldn't be DEADLINE_EXCEEDED. EXPECT_EQ(StatusCode::UNAVAILABLE, status.error_code()); @@ -1082,11 +1090,11 @@ TEST_F(SingleBalancerTest, LocalityMapWeightedRoundRobin) { const double kLocalityWeightRate1 = static_cast(kLocalityWeight1) / kTotalLocalityWeight; // EDS response contains 2 localities, each of which contains 1 backend. - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(0, 2, 2), - {kLocalityWeight0, kLocalityWeight1}), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts(0, 1), kLocalityWeight0}, + {"locality1", GetBackendPorts(1, 2), kLocalityWeight1}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); // Wait for both backends to be ready. WaitForAllBackends(1, 0, 2); // Send kNumRpcs RPCs. @@ -1118,14 +1126,19 @@ TEST_F(SingleBalancerTest, LocalityMapStressTest) { const size_t kNumLocalities = 100; // The first EDS response contains kNumLocalities localities, each of which // contains backend 0. - const std::vector> locality_list_0(kNumLocalities, - {backends_[0]->port()}); + EdsServiceImpl::ResponseArgs args; + for (size_t i = 0; i < kNumLocalities; ++i) { + grpc::string name = "locality" + std::to_string(i); + EdsServiceImpl::ResponseArgs::Locality locality(name, + {backends_[0]->port()}); + args.locality_list.emplace_back(std::move(locality)); + } + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); // The second EDS response contains 1 locality, which contains backend 1. - const std::vector> locality_list_1 = - GetBackendPortsInGroups(1, 2); - ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(locality_list_0), - 0); - ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(locality_list_1), + args = EdsServiceImpl::ResponseArgs({ + {"locality0", GetBackendPorts(1, 2)}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 60 * 1000); // Wait until backend 0 is ready, before which kNumLocalities localities are // received and handled by the xds policy. @@ -1162,20 +1175,18 @@ TEST_F(SingleBalancerTest, LocalityMapUpdate) { for (int weight : kLocalityWeights1) { locality_weight_rate_1.push_back(weight / kTotalLocalityWeight1); } - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(0 /*start_index*/, 3 /*stop_index*/, - 3 /*num_group*/), - kLocalityWeights0), - 0); - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(1 /*start_index*/, 4 /*stop_index*/, - 3 /*num_group*/), - kLocalityWeights1, 1 /*first_locality_name_index*/), - 5000); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts(0, 1), 2}, + {"locality1", GetBackendPorts(1, 2), 3}, + {"locality2", GetBackendPorts(2, 3), 4}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); + args = EdsServiceImpl::ResponseArgs({ + {"locality1", GetBackendPorts(1, 2), 3}, + {"locality2", GetBackendPorts(2, 3), 2}, + {"locality3", GetBackendPorts(3, 4), 6}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 5000); // Wait for the first 3 backends to be ready. WaitForAllBackends(1, 0, 3); gpr_log(GPR_INFO, "========= BEFORE FIRST BATCH =========="); @@ -1244,13 +1255,12 @@ TEST_F(SingleBalancerTest, Drop) { const double KDropRateForLbAndThrottle = kDropRateForLb + (1 - kDropRateForLb) * kDropRateForThrottle; // The EDS response contains two drop categories. - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(), {}, 0, - {{kLbDropType, kDropPerMillionForLb}, - {kThrottleDropType, kDropPerMillionForThrottle}}), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts()}, + }); + args.drop_categories = {{kLbDropType, kDropPerMillionForLb}, + {kThrottleDropType, kDropPerMillionForThrottle}}; + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); WaitForAllBackends(); // Send kNumRpcs RPCs and count the drops. size_t num_drops = 0; @@ -1286,12 +1296,12 @@ TEST_F(SingleBalancerTest, DropPerHundred) { const uint32_t kDropPerHundredForLb = 10; const double kDropRateForLb = kDropPerHundredForLb / 100.0; // The EDS response contains one drop category. - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, 0, - {{kLbDropType, kDropPerHundredForLb}}, - FractionalPercent::HUNDRED), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts()}, + }); + args.drop_categories = {{kLbDropType, kDropPerHundredForLb}}; + args.drop_denominator = FractionalPercent::HUNDRED; + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); WaitForAllBackends(); // Send kNumRpcs RPCs and count the drops. size_t num_drops = 0; @@ -1326,12 +1336,12 @@ TEST_F(SingleBalancerTest, DropPerTenThousand) { const uint32_t kDropPerTenThousandForLb = 1000; const double kDropRateForLb = kDropPerTenThousandForLb / 10000.0; // The EDS response contains one drop category. - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, 0, - {{kLbDropType, kDropPerTenThousandForLb}}, - FractionalPercent::TEN_THOUSAND), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts()}, + }); + args.drop_categories = {{kLbDropType, kDropPerTenThousandForLb}}; + args.drop_denominator = FractionalPercent::TEN_THOUSAND; + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); WaitForAllBackends(); // Send kNumRpcs RPCs and count the drops. size_t num_drops = 0; @@ -1370,22 +1380,18 @@ TEST_F(SingleBalancerTest, DropUpdate) { const double KDropRateForLbAndThrottle = kDropRateForLb + (1 - kDropRateForLb) * kDropRateForThrottle; // The first EDS response contains one drop category. - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, 0, - {{kLbDropType, kDropPerMillionForLb}}), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts()}, + }); + args.drop_categories = {{kLbDropType, kDropPerMillionForLb}}; + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); // The second EDS response contains two drop categories. // TODO(juanlishen): Change the EDS response sending to deterministic style // (e.g., by using condition variable) so that we can shorten the test // duration. - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(), {}, 0, - {{kLbDropType, kDropPerMillionForLb}, - {kThrottleDropType, kDropPerMillionForThrottle}}), - 10000); + args.drop_categories = {{kLbDropType, kDropPerMillionForLb}, + {kThrottleDropType, kDropPerMillionForThrottle}}; + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 10000); WaitForAllBackends(); // Send kNumRpcs RPCs and count the drops. size_t num_drops = 0; @@ -1465,13 +1471,12 @@ TEST_F(SingleBalancerTest, DropAll) { const uint32_t kDropPerMillionForLb = 100000; const uint32_t kDropPerMillionForThrottle = 1000000; // The EDS response contains two drop categories. - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(), {}, 0, - {{kLbDropType, kDropPerMillionForLb}, - {kThrottleDropType, kDropPerMillionForThrottle}}), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts()}, + }); + args.drop_categories = {{kLbDropType, kDropPerMillionForLb}, + {kThrottleDropType, kDropPerMillionForThrottle}}; + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); // Send kNumRpcs RPCs and all of them are dropped. for (size_t i = 0; i < kNumRpcs; ++i) { EchoResponse response; @@ -1493,11 +1498,11 @@ TEST_F(SingleBalancerTest, Fallback) { kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); // Send non-empty serverlist only after kServerlistDelayMs. - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(kNumBackendsInResolution /* start_index */)), - kServerlistDelayMs); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts(kNumBackendsInResolution)}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), + kServerlistDelayMs); // Wait until all the fallback backends are reachable. WaitForAllBackends(1 /* num_requests_multiple_of */, 0 /* start_index */, kNumBackendsInResolution /* stop_index */); @@ -1542,12 +1547,12 @@ TEST_F(SingleBalancerTest, FallbackUpdate) { kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); // Send non-empty serverlist only after kServerlistDelayMs. - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups( - kNumBackendsInResolution + - kNumBackendsInResolutionUpdate /* start_index */)), - kServerlistDelayMs); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts(kNumBackendsInResolution + + kNumBackendsInResolutionUpdate)}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), + kServerlistDelayMs); // Wait until all the fallback backends are reachable. WaitForAllBackends(1 /* num_requests_multiple_of */, 0 /* start_index */, kNumBackendsInResolution /* stop_index */); @@ -1645,8 +1650,10 @@ TEST_F(SingleBalancerTest, FallbackIfResponseReceivedButChildNotReady) { SetNextResolutionForLbChannelAllBalancers(); // Send a serverlist that only contains an unreachable backend before fallback // timeout. - ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponse({{grpc_pick_unused_port_or_die()}}), 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", {grpc_pick_unused_port_or_die()}}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); // Because no child policy is ready before fallback timeout, we enter fallback // mode. WaitForBackend(0); @@ -1659,11 +1666,11 @@ TEST_F(SingleBalancerTest, FallbackModeIsExitedWhenBalancerSaysToDropAllCalls) { // Enter fallback mode because the LB channel fails to connect. WaitForBackend(0); // Return a new balancer that sends a response to drop all calls. - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse(GetBackendPortsInGroups(), {}, 0, - {{kLbDropType, 1000000}}), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts()}, + }); + args.drop_categories = {{kLbDropType, 1000000}}; + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); SetNextResolutionForLbChannelAllBalancers(); // Send RPCs until failure. gpr_timespec deadline = gpr_time_add( @@ -1683,8 +1690,10 @@ TEST_F(SingleBalancerTest, FallbackModeIsExitedAfterChildRready) { WaitForBackend(0); // Return a new balancer that sends a dead backend. ShutdownBackend(1); - ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponse({{backends_[1]->port()}}), 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", {backends_[1]->port()}}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); SetNextResolutionForLbChannelAllBalancers(); // The state (TRANSIENT_FAILURE) update from the child policy will be ignored // because we are still in fallback mode. @@ -1708,8 +1717,10 @@ TEST_F(SingleBalancerTest, FallbackModeIsExitedAfterChildRready) { TEST_F(SingleBalancerTest, BackendsRestart) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); - ScheduleResponseForBalancer( - 0, EdsServiceImpl::BuildResponse(GetBackendPortsInGroups()), 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts()}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); WaitForAllBackends(); // Stop backends. RPCs should fail. ShutdownAllBackends(); @@ -1728,12 +1739,14 @@ class UpdatesTest : public XdsEnd2endTest { TEST_F(UpdatesTest, UpdateBalancersButKeepUsingOriginalBalancer) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); - auto first_backend = GetBackendPortsInGroups(0, 1); - auto second_backend = GetBackendPortsInGroups(1, 2); - ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(first_backend), - 0); - ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(second_backend), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", {backends_[0]->port()}}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); + args = EdsServiceImpl::ResponseArgs({ + {"locality0", {backends_[1]->port()}}, + }); + ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(args), 0); // Wait until the first backend is ready. WaitForBackend(0); @@ -1781,12 +1794,14 @@ TEST_F(UpdatesTest, UpdateBalancersButKeepUsingOriginalBalancer) { TEST_F(UpdatesTest, UpdateBalancerName) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); - auto first_backend = GetBackendPortsInGroups(0, 1); - auto second_backend = GetBackendPortsInGroups(1, 2); - ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(first_backend), - 0); - ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(second_backend), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", {backends_[0]->port()}}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); + args = EdsServiceImpl::ResponseArgs({ + {"locality0", {backends_[1]->port()}}, + }); + ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(args), 0); // Wait until the first backend is ready. WaitForBackend(0); @@ -1852,12 +1867,14 @@ TEST_F(UpdatesTest, UpdateBalancerName) { TEST_F(UpdatesTest, UpdateBalancersRepeated) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); - auto first_backend = GetBackendPortsInGroups(0, 1); - auto second_backend = GetBackendPortsInGroups(1, 2); - ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(first_backend), - 0); - ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(second_backend), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", {backends_[0]->port()}}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); + args = EdsServiceImpl::ResponseArgs({ + {"locality0", {backends_[1]->port()}}, + }); + ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(args), 0); // Wait until the first backend is ready. WaitForBackend(0); @@ -1920,12 +1937,14 @@ TEST_F(UpdatesTest, UpdateBalancersRepeated) { TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannel({balancers_[0]->port()}); - auto first_backend = GetBackendPortsInGroups(0, 1); - auto second_backend = GetBackendPortsInGroups(1, 2); - ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(first_backend), - 0); - ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(second_backend), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", {backends_[0]->port()}}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); + args = EdsServiceImpl::ResponseArgs({ + {"locality0", {backends_[1]->port()}}, + }); + ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(args), 0); // Start servers and send 10 RPCs per server. gpr_log(GPR_INFO, "========= BEFORE FIRST BATCH =========="); @@ -2007,10 +2026,10 @@ TEST_F(SingleBalancerWithClientLoadReportingTest, Vanilla) { const size_t kNumRpcsPerAddress = 100; // TODO(juanlishen): Partition the backends after multiple localities is // tested. - ScheduleResponseForBalancer(0, - EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(0, backends_.size())), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts()}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); // Wait until all backends are ready. int num_ok = 0; int num_failure = 0; @@ -2046,11 +2065,10 @@ TEST_F(SingleBalancerWithClientLoadReportingTest, BalancerRestart) { const size_t kNumBackendsFirstPass = backends_.size() / 2; const size_t kNumBackendsSecondPass = backends_.size() - kNumBackendsFirstPass; - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(0, kNumBackendsFirstPass)), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts(0, kNumBackendsFirstPass)}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); // Wait until all backends returned by the balancer are ready. int num_ok = 0; int num_failure = 0; @@ -2077,11 +2095,10 @@ TEST_F(SingleBalancerWithClientLoadReportingTest, BalancerRestart) { } // Now restart the balancer, this time pointing to the new backends. balancers_[0]->Start(server_host_); - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(kNumBackendsFirstPass)), - 0); + args = EdsServiceImpl::ResponseArgs({ + {"locality0", GetBackendPorts(kNumBackendsFirstPass)}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); // Wait for queries to start going to one of the new backends. // This tells us that we're now using the new serverlist. std::tie(num_ok, num_failure, num_drops) = @@ -2116,13 +2133,12 @@ TEST_F(SingleBalancerWithClientLoadReportingAndDropTest, Vanilla) { const double KDropRateForLbAndThrottle = kDropRateForLb + (1 - kDropRateForLb) * kDropRateForThrottle; // The EDS response contains two drop categories. - ScheduleResponseForBalancer( - 0, - EdsServiceImpl::BuildResponse( - GetBackendPortsInGroups(), {}, 0, - {{kLbDropType, kDropPerMillionForLb}, - {kThrottleDropType, kDropPerMillionForThrottle}}), - 0); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts()}, + }); + args.drop_categories = {{kLbDropType, kDropPerMillionForLb}, + {kThrottleDropType, kDropPerMillionForThrottle}}; + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); int num_ok = 0; int num_failure = 0; int num_drops = 0; From 21c542447784e698ae388ce12087c27fea70535d Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 28 Aug 2019 12:48:06 -0700 Subject: [PATCH 481/661] Add API for accessing per-call backend metric data in LB policies. --- .gitmodules | 3 + BUILD | 30 + BUILD.gn | 8 + CMakeLists.txt | 105 ++- Makefile | 118 ++- build.yaml | 15 + config.m4 | 29 +- config.w32 | 32 +- gRPC-Core.podspec | 84 +- grpc.gemspec | 56 +- grpc.gyp | 84 +- package.xml | 56 +- .../filters/client_channel/backend_metric.cc | 78 ++ .../filters/client_channel/backend_metric.h | 36 + .../filters/client_channel/client_channel.cc | 19 + .../ext/filters/client_channel/lb_policy.h | 26 + .../envoy/api/v2/auth/cert.upb.c | 37 +- .../envoy/api/v2/auth/cert.upb.h | 83 +- .../ext/upb-generated/envoy/api/v2/cds.upb.c | 67 +- .../ext/upb-generated/envoy/api/v2/cds.upb.h | 81 +- .../envoy/api/v2/cluster/filter.upb.c | 34 + .../envoy/api/v2/cluster/filter.upb.h | 69 ++ .../api/v2/cluster/outlier_detection.upb.c | 32 +- .../api/v2/cluster/outlier_detection.upb.h | 87 ++- .../envoy/api/v2/core/base.upb.c | 32 + .../envoy/api/v2/core/base.upb.h | 98 +++ .../envoy/api/v2/core/config_source.upb.c | 15 +- .../envoy/api/v2/core/config_source.upb.h | 32 +- .../envoy/api/v2/core/http_uri.upb.c | 35 + .../envoy/api/v2/core/http_uri.upb.h | 80 ++ .../envoy/api/v2/core/protocol.upb.c | 12 +- .../envoy/api/v2/core/protocol.upb.h | 69 ++ .../udpa/data/orca/v1/orca_load_report.upb.c | 58 ++ .../udpa/data/orca/v1/orca_load_report.upb.h | 144 ++++ src/core/lib/gprpp/map.h | 11 +- src/core/lib/transport/static_metadata.cc | 734 +++++++++--------- src/core/lib/transport/static_metadata.h | 176 +++-- src/proto/grpc/lb/v2/BUILD | 7 + src/proto/grpc/lb/v2/eds_for_test.proto | 8 +- src/proto/grpc/lb/v2/lrs_for_test.proto | 9 +- .../lb/v2/orca_load_report_for_test.proto | 58 ++ src/python/grpcio/grpc_core_dependencies.py | 28 +- test/core/end2end/fuzzers/hpack.dictionary | 1 + test/core/util/test_lb_policies.cc | 2 +- test/core/util/test_lb_policies.h | 5 +- test/cpp/end2end/BUILD | 1 + test/cpp/end2end/client_lb_end2end_test.cc | 97 ++- third_party/envoy-api | 2 +- third_party/udpa | 1 + tools/codegen/core/gen_static_metadata.py | 2 + tools/codegen/core/gen_upb_api.sh | 6 +- tools/doxygen/Doxyfile.core.internal | 8 + tools/run_tests/sanity/check_submodules.sh | 3 +- 53 files changed, 2224 insertions(+), 779 deletions(-) create mode 100644 src/core/ext/filters/client_channel/backend_metric.cc create mode 100644 src/core/ext/filters/client_channel/backend_metric.h create mode 100644 src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c create mode 100644 src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h create mode 100644 src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c create mode 100644 src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h create mode 100644 src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c create mode 100644 src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h create mode 100644 src/proto/grpc/lb/v2/orca_load_report_for_test.proto create mode 160000 third_party/udpa diff --git a/.gitmodules b/.gitmodules index 6443f8362aa..2b085e15059 100644 --- a/.gitmodules +++ b/.gitmodules @@ -54,3 +54,6 @@ [submodule "third_party/upb"] path = third_party/upb url = https://github.com/protocolbuffers/upb.git +[submodule "third_party/udpa"] + path = third_party/udpa + url = https://github.com/cncf/udpa.git diff --git a/BUILD b/BUILD index f2a6f67f69f..9198dd61282 100644 --- a/BUILD +++ b/BUILD @@ -1009,6 +1009,7 @@ grpc_cc_library( name = "grpc_client_channel", srcs = [ "src/core/ext/filters/client_channel/backup_poller.cc", + "src/core/ext/filters/client_channel/backend_metric.cc", "src/core/ext/filters/client_channel/channel_connectivity.cc", "src/core/ext/filters/client_channel/client_channel.cc", "src/core/ext/filters/client_channel/client_channel_channelz.cc", @@ -1037,6 +1038,7 @@ grpc_cc_library( ], hdrs = [ "src/core/ext/filters/client_channel/backup_poller.h", + "src/core/ext/filters/client_channel/backend_metric.h", "src/core/ext/filters/client_channel/client_channel.h", "src/core/ext/filters/client_channel/client_channel_channelz.h", "src/core/ext/filters/client_channel/client_channel_factory.h", @@ -1066,6 +1068,7 @@ grpc_cc_library( ], language = "c++", deps = [ + "envoy_orca_upb", "gpr_base", "grpc_base", "grpc_client_authority_filter", @@ -2278,6 +2281,7 @@ grpc_cc_library( "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c", "src/core/ext/upb-generated/envoy/api/v2/cds.upb.c", "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c", "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c", "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c", "src/core/ext/upb-generated/envoy/api/v2/eds.upb.c", @@ -2290,6 +2294,7 @@ grpc_cc_library( "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h", "src/core/ext/upb-generated/envoy/api/v2/cds.upb.h", "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h", "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h", "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h", "src/core/ext/upb-generated/envoy/api/v2/eds.upb.h", @@ -2318,6 +2323,7 @@ grpc_cc_library( "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c", "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c", "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c", "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c", ], hdrs = [ @@ -2326,6 +2332,7 @@ grpc_cc_library( "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h", "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h", "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h", "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h", ], external_deps = [ @@ -2378,6 +2385,29 @@ grpc_cc_library( ], ) +# Once upb code-gen issue is resolved, replace envoy_orca_upb with this. +# grpc_upb_proto_library( +# name = "envoy_orca_upb", +# deps = ["@envoy_api//udpa/data/orca/v1:orca_load_report"] +# ) + +grpc_cc_library( + name = "envoy_orca_upb", + srcs = [ + "src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c", + ], + hdrs = [ + "src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h", + ], + external_deps = [ + "upb_lib", + ], + language = "c++", + deps = [ + ":proto_gen_validate_upb", + ], +) + # Once upb code-gen issue is resolved, replace grpc_health_upb with this. # grpc_upb_proto_library( # name = "grpc_health_upb", diff --git a/BUILD.gn b/BUILD.gn index eea022eac51..771e968f366 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -208,6 +208,8 @@ config("grpc_config") { "include/grpc/status.h", "include/grpc/support/workaround_list.h", "src/core/ext/filters/census/grpc_context.cc", + "src/core/ext/filters/client_channel/backend_metric.cc", + "src/core/ext/filters/client_channel/backend_metric.h", "src/core/ext/filters/client_channel/backup_poller.cc", "src/core/ext/filters/client_channel/backup_poller.h", "src/core/ext/filters/client_channel/channel_connectivity.cc", @@ -388,6 +390,8 @@ config("grpc_config") { "src/core/ext/upb-generated/envoy/api/v2/cds.upb.h", "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c", "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h", "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c", "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h", "src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c", @@ -400,6 +404,8 @@ config("grpc_config") { "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h", "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c", "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h", + "src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c", + "src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h", "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c", "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h", "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c", @@ -450,6 +456,8 @@ config("grpc_config") { "src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h", "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c", "src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h", + "src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c", + "src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h", "src/core/ext/upb-generated/validate/validate.upb.c", "src/core/ext/upb-generated/validate/validate.upb.h", "src/core/lib/avl/avl.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index f1552a56c1f..c5cdfff7f56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1266,6 +1266,7 @@ add_library(grpc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc src/core/ext/transport/chttp2/client/authority.cc src/core/ext/transport/chttp2/client/chttp2_connector.cc + src/core/ext/filters/client_channel/backend_metric.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -1294,6 +1295,19 @@ add_library(grpc src/core/ext/filters/client_channel/subchannel_pool_interface.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c + src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c + src/core/ext/upb-generated/gogoproto/gogo.upb.c + src/core/ext/upb-generated/validate/validate.upb.c + src/core/ext/upb-generated/google/api/annotations.upb.c + src/core/ext/upb-generated/google/api/http.upb.c + src/core/ext/upb-generated/google/protobuf/any.upb.c + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c + src/core/ext/upb-generated/google/protobuf/duration.upb.c + src/core/ext/upb-generated/google/protobuf/empty.upb.c + src/core/ext/upb-generated/google/protobuf/struct.upb.c + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c + src/core/ext/upb-generated/google/rpc/status.upb.c src/core/tsi/fake_transport_security.cc src/core/tsi/local_transport_security.cc src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc @@ -1313,16 +1327,6 @@ add_library(grpc src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c - src/core/ext/upb-generated/google/api/annotations.upb.c - src/core/ext/upb-generated/google/api/http.upb.c - src/core/ext/upb-generated/google/protobuf/any.upb.c - src/core/ext/upb-generated/google/protobuf/descriptor.upb.c - src/core/ext/upb-generated/google/protobuf/duration.upb.c - src/core/ext/upb-generated/google/protobuf/empty.upb.c - src/core/ext/upb-generated/google/protobuf/struct.upb.c - src/core/ext/upb-generated/google/protobuf/timestamp.upb.c - src/core/ext/upb-generated/google/protobuf/wrappers.upb.c - src/core/ext/upb-generated/google/rpc/status.upb.c src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc src/core/ext/filters/client_channel/lb_policy/xds/xds.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc @@ -1331,6 +1335,7 @@ add_library(grpc src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c src/core/ext/upb-generated/envoy/api/v2/cds.upb.c src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c + src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c src/core/ext/upb-generated/envoy/api/v2/eds.upb.c @@ -1343,11 +1348,10 @@ add_library(grpc src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c src/core/ext/upb-generated/envoy/type/percent.upb.c src/core/ext/upb-generated/envoy/type/range.upb.c - src/core/ext/upb-generated/gogoproto/gogo.upb.c - src/core/ext/upb-generated/validate/validate.upb.c src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc @@ -1667,6 +1671,7 @@ add_library(grpc_cronet src/core/ext/filters/http/http_filters_plugin.cc src/core/ext/filters/http/message_compress/message_compress_filter.cc src/core/ext/filters/http/server/http_server_filter.cc + src/core/ext/filters/client_channel/backend_metric.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -1701,6 +1706,19 @@ add_library(grpc_cronet third_party/upb/upb/port.c third_party/upb/upb/table.c third_party/upb/upb/upb.c + src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c + src/core/ext/upb-generated/gogoproto/gogo.upb.c + src/core/ext/upb-generated/validate/validate.upb.c + src/core/ext/upb-generated/google/api/annotations.upb.c + src/core/ext/upb-generated/google/api/http.upb.c + src/core/ext/upb-generated/google/protobuf/any.upb.c + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c + src/core/ext/upb-generated/google/protobuf/duration.upb.c + src/core/ext/upb-generated/google/protobuf/empty.upb.c + src/core/ext/upb-generated/google/protobuf/struct.upb.c + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c + src/core/ext/upb-generated/google/rpc/status.upb.c src/core/lib/http/httpcli_security_connector.cc src/core/lib/security/context/security_context.cc src/core/lib/security/credentials/alts/alts_credentials.cc @@ -2059,6 +2077,7 @@ add_library(grpc_test_util src/core/lib/transport/transport_op_string.cc src/core/lib/uri/uri_parser.cc src/core/lib/debug/trace.cc + src/core/ext/filters/client_channel/backend_metric.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -2093,6 +2112,19 @@ add_library(grpc_test_util third_party/upb/upb/port.c third_party/upb/upb/table.c third_party/upb/upb/upb.c + src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c + src/core/ext/upb-generated/gogoproto/gogo.upb.c + src/core/ext/upb-generated/validate/validate.upb.c + src/core/ext/upb-generated/google/api/annotations.upb.c + src/core/ext/upb-generated/google/api/http.upb.c + src/core/ext/upb-generated/google/protobuf/any.upb.c + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c + src/core/ext/upb-generated/google/protobuf/duration.upb.c + src/core/ext/upb-generated/google/protobuf/empty.upb.c + src/core/ext/upb-generated/google/protobuf/struct.upb.c + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c + src/core/ext/upb-generated/google/rpc/status.upb.c src/core/ext/transport/chttp2/transport/bin_decoder.cc src/core/ext/transport/chttp2/transport/bin_encoder.cc src/core/ext/transport/chttp2/transport/chttp2_plugin.cc @@ -2399,6 +2431,7 @@ add_library(grpc_test_util_unsecure src/core/lib/transport/transport_op_string.cc src/core/lib/uri/uri_parser.cc src/core/lib/debug/trace.cc + src/core/ext/filters/client_channel/backend_metric.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -2433,6 +2466,19 @@ add_library(grpc_test_util_unsecure third_party/upb/upb/port.c third_party/upb/upb/table.c third_party/upb/upb/upb.c + src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c + src/core/ext/upb-generated/gogoproto/gogo.upb.c + src/core/ext/upb-generated/validate/validate.upb.c + src/core/ext/upb-generated/google/api/annotations.upb.c + src/core/ext/upb-generated/google/api/http.upb.c + src/core/ext/upb-generated/google/protobuf/any.upb.c + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c + src/core/ext/upb-generated/google/protobuf/duration.upb.c + src/core/ext/upb-generated/google/protobuf/empty.upb.c + src/core/ext/upb-generated/google/protobuf/struct.upb.c + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c + src/core/ext/upb-generated/google/rpc/status.upb.c src/core/ext/transport/chttp2/transport/bin_decoder.cc src/core/ext/transport/chttp2/transport/bin_encoder.cc src/core/ext/transport/chttp2/transport/chttp2_plugin.cc @@ -2750,6 +2796,7 @@ add_library(grpc_unsecure src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc src/core/ext/transport/chttp2/client/authority.cc src/core/ext/transport/chttp2/client/chttp2_connector.cc + src/core/ext/filters/client_channel/backend_metric.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -2784,6 +2831,19 @@ add_library(grpc_unsecure third_party/upb/upb/port.c third_party/upb/upb/table.c third_party/upb/upb/upb.c + src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c + src/core/ext/upb-generated/gogoproto/gogo.upb.c + src/core/ext/upb-generated/validate/validate.upb.c + src/core/ext/upb-generated/google/api/annotations.upb.c + src/core/ext/upb-generated/google/api/http.upb.c + src/core/ext/upb-generated/google/protobuf/any.upb.c + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c + src/core/ext/upb-generated/google/protobuf/duration.upb.c + src/core/ext/upb-generated/google/protobuf/empty.upb.c + src/core/ext/upb-generated/google/protobuf/struct.upb.c + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c + src/core/ext/upb-generated/google/rpc/status.upb.c src/core/ext/transport/inproc/inproc_plugin.cc src/core/ext/transport/inproc/inproc_transport.cc src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc @@ -2807,16 +2867,6 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c - src/core/ext/upb-generated/google/api/annotations.upb.c - src/core/ext/upb-generated/google/api/http.upb.c - src/core/ext/upb-generated/google/protobuf/any.upb.c - src/core/ext/upb-generated/google/protobuf/descriptor.upb.c - src/core/ext/upb-generated/google/protobuf/duration.upb.c - src/core/ext/upb-generated/google/protobuf/empty.upb.c - src/core/ext/upb-generated/google/protobuf/struct.upb.c - src/core/ext/upb-generated/google/protobuf/timestamp.upb.c - src/core/ext/upb-generated/google/protobuf/wrappers.upb.c - src/core/ext/upb-generated/google/rpc/status.upb.c src/core/ext/filters/client_channel/lb_policy/xds/xds.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc @@ -2824,6 +2874,7 @@ add_library(grpc_unsecure src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c src/core/ext/upb-generated/envoy/api/v2/cds.upb.c src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c + src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c src/core/ext/upb-generated/envoy/api/v2/eds.upb.c @@ -2836,11 +2887,10 @@ add_library(grpc_unsecure src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c + src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c src/core/ext/upb-generated/envoy/type/percent.upb.c src/core/ext/upb-generated/envoy/type/range.upb.c - src/core/ext/upb-generated/gogoproto/gogo.upb.c - src/core/ext/upb-generated/validate/validate.upb.c src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc src/core/ext/filters/census/grpc_context.cc @@ -13128,11 +13178,18 @@ endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) add_executable(client_lb_end2end_test + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/orca_load_report_for_test.grpc.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/orca_load_report_for_test.grpc.pb.h test/cpp/end2end/client_lb_end2end_test.cc third_party/googletest/googletest/src/gtest-all.cc third_party/googletest/googlemock/src/gmock-all.cc ) +protobuf_generate_grpc_cpp( + src/proto/grpc/lb/v2/orca_load_report_for_test.proto +) target_include_directories(client_lb_end2end_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/Makefile b/Makefile index 5189f704297..4ebf5b36cf8 100644 --- a/Makefile +++ b/Makefile @@ -2745,6 +2745,22 @@ $(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.cc: src/proto/grpc/lb/v2/lrs $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< endif +ifeq ($(NO_PROTOC),true) +$(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.cc: protoc_dep_error +$(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.grpc.pb.cc: protoc_dep_error +else + +$(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.cc: src/proto/grpc/lb/v2/orca_load_report_for_test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[PROTOC] Generating protobuf CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $< + +$(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.grpc.pb.cc: src/proto/grpc/lb/v2/orca_load_report_for_test.proto $(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.cc $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< +endif + ifeq ($(NO_PROTOC),true) $(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.pb.cc: protoc_dep_error $(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc: protoc_dep_error @@ -3803,6 +3819,7 @@ LIBGRPC_SRC = \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ + src/core/ext/filters/client_channel/backend_metric.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -3831,6 +3848,19 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c \ + src/core/ext/upb-generated/gogoproto/gogo.upb.c \ + src/core/ext/upb-generated/validate/validate.upb.c \ + src/core/ext/upb-generated/google/api/annotations.upb.c \ + src/core/ext/upb-generated/google/api/http.upb.c \ + src/core/ext/upb-generated/google/protobuf/any.upb.c \ + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ + src/core/ext/upb-generated/google/protobuf/duration.upb.c \ + src/core/ext/upb-generated/google/protobuf/empty.upb.c \ + src/core/ext/upb-generated/google/protobuf/struct.upb.c \ + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ + src/core/ext/upb-generated/google/rpc/status.upb.c \ src/core/tsi/fake_transport_security.cc \ src/core/tsi/local_transport_security.cc \ src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc \ @@ -3850,16 +3880,6 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ - src/core/ext/upb-generated/google/api/annotations.upb.c \ - src/core/ext/upb-generated/google/api/http.upb.c \ - src/core/ext/upb-generated/google/protobuf/any.upb.c \ - src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ - src/core/ext/upb-generated/google/protobuf/duration.upb.c \ - src/core/ext/upb-generated/google/protobuf/empty.upb.c \ - src/core/ext/upb-generated/google/protobuf/struct.upb.c \ - src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ - src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ - src/core/ext/upb-generated/google/rpc/status.upb.c \ src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc \ @@ -3868,6 +3888,7 @@ LIBGRPC_SRC = \ src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c \ src/core/ext/upb-generated/envoy/api/v2/cds.upb.c \ src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c \ src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c \ src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c \ src/core/ext/upb-generated/envoy/api/v2/eds.upb.c \ @@ -3880,11 +3901,10 @@ LIBGRPC_SRC = \ src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c \ src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c \ src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c \ src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c \ src/core/ext/upb-generated/envoy/type/percent.upb.c \ src/core/ext/upb-generated/envoy/type/range.upb.c \ - src/core/ext/upb-generated/gogoproto/gogo.upb.c \ - src/core/ext/upb-generated/validate/validate.upb.c \ src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \ src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \ src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc \ @@ -4193,6 +4213,7 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/filters/http/http_filters_plugin.cc \ src/core/ext/filters/http/message_compress/message_compress_filter.cc \ src/core/ext/filters/http/server/http_server_filter.cc \ + src/core/ext/filters/client_channel/backend_metric.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -4227,6 +4248,19 @@ LIBGRPC_CRONET_SRC = \ third_party/upb/upb/port.c \ third_party/upb/upb/table.c \ third_party/upb/upb/upb.c \ + src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c \ + src/core/ext/upb-generated/gogoproto/gogo.upb.c \ + src/core/ext/upb-generated/validate/validate.upb.c \ + src/core/ext/upb-generated/google/api/annotations.upb.c \ + src/core/ext/upb-generated/google/api/http.upb.c \ + src/core/ext/upb-generated/google/protobuf/any.upb.c \ + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ + src/core/ext/upb-generated/google/protobuf/duration.upb.c \ + src/core/ext/upb-generated/google/protobuf/empty.upb.c \ + src/core/ext/upb-generated/google/protobuf/struct.upb.c \ + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ + src/core/ext/upb-generated/google/rpc/status.upb.c \ src/core/lib/http/httpcli_security_connector.cc \ src/core/lib/security/context/security_context.cc \ src/core/lib/security/credentials/alts/alts_credentials.cc \ @@ -4573,6 +4607,7 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/transport/transport_op_string.cc \ src/core/lib/uri/uri_parser.cc \ src/core/lib/debug/trace.cc \ + src/core/ext/filters/client_channel/backend_metric.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -4607,6 +4642,19 @@ LIBGRPC_TEST_UTIL_SRC = \ third_party/upb/upb/port.c \ third_party/upb/upb/table.c \ third_party/upb/upb/upb.c \ + src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c \ + src/core/ext/upb-generated/gogoproto/gogo.upb.c \ + src/core/ext/upb-generated/validate/validate.upb.c \ + src/core/ext/upb-generated/google/api/annotations.upb.c \ + src/core/ext/upb-generated/google/api/http.upb.c \ + src/core/ext/upb-generated/google/protobuf/any.upb.c \ + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ + src/core/ext/upb-generated/google/protobuf/duration.upb.c \ + src/core/ext/upb-generated/google/protobuf/empty.upb.c \ + src/core/ext/upb-generated/google/protobuf/struct.upb.c \ + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ + src/core/ext/upb-generated/google/rpc/status.upb.c \ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ src/core/ext/transport/chttp2/transport/chttp2_plugin.cc \ @@ -4895,6 +4943,7 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/lib/transport/transport_op_string.cc \ src/core/lib/uri/uri_parser.cc \ src/core/lib/debug/trace.cc \ + src/core/ext/filters/client_channel/backend_metric.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -4929,6 +4978,19 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ third_party/upb/upb/port.c \ third_party/upb/upb/table.c \ third_party/upb/upb/upb.c \ + src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c \ + src/core/ext/upb-generated/gogoproto/gogo.upb.c \ + src/core/ext/upb-generated/validate/validate.upb.c \ + src/core/ext/upb-generated/google/api/annotations.upb.c \ + src/core/ext/upb-generated/google/api/http.upb.c \ + src/core/ext/upb-generated/google/protobuf/any.upb.c \ + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ + src/core/ext/upb-generated/google/protobuf/duration.upb.c \ + src/core/ext/upb-generated/google/protobuf/empty.upb.c \ + src/core/ext/upb-generated/google/protobuf/struct.upb.c \ + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ + src/core/ext/upb-generated/google/rpc/status.upb.c \ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ src/core/ext/transport/chttp2/transport/chttp2_plugin.cc \ @@ -5215,6 +5277,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ + src/core/ext/filters/client_channel/backend_metric.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -5249,6 +5312,19 @@ LIBGRPC_UNSECURE_SRC = \ third_party/upb/upb/port.c \ third_party/upb/upb/table.c \ third_party/upb/upb/upb.c \ + src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c \ + src/core/ext/upb-generated/gogoproto/gogo.upb.c \ + src/core/ext/upb-generated/validate/validate.upb.c \ + src/core/ext/upb-generated/google/api/annotations.upb.c \ + src/core/ext/upb-generated/google/api/http.upb.c \ + src/core/ext/upb-generated/google/protobuf/any.upb.c \ + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ + src/core/ext/upb-generated/google/protobuf/duration.upb.c \ + src/core/ext/upb-generated/google/protobuf/empty.upb.c \ + src/core/ext/upb-generated/google/protobuf/struct.upb.c \ + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ + src/core/ext/upb-generated/google/rpc/status.upb.c \ src/core/ext/transport/inproc/inproc_plugin.cc \ src/core/ext/transport/inproc/inproc_transport.cc \ src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc \ @@ -5272,16 +5348,6 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ - src/core/ext/upb-generated/google/api/annotations.upb.c \ - src/core/ext/upb-generated/google/api/http.upb.c \ - src/core/ext/upb-generated/google/protobuf/any.upb.c \ - src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ - src/core/ext/upb-generated/google/protobuf/duration.upb.c \ - src/core/ext/upb-generated/google/protobuf/empty.upb.c \ - src/core/ext/upb-generated/google/protobuf/struct.upb.c \ - src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ - src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ - src/core/ext/upb-generated/google/rpc/status.upb.c \ src/core/ext/filters/client_channel/lb_policy/xds/xds.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc \ @@ -5289,6 +5355,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c \ src/core/ext/upb-generated/envoy/api/v2/cds.upb.c \ src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c \ src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c \ src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c \ src/core/ext/upb-generated/envoy/api/v2/eds.upb.c \ @@ -5301,11 +5368,10 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c \ src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c \ src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c \ src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c \ src/core/ext/upb-generated/envoy/type/percent.upb.c \ src/core/ext/upb-generated/envoy/type/range.upb.c \ - src/core/ext/upb-generated/gogoproto/gogo.upb.c \ - src/core/ext/upb-generated/validate/validate.upb.c \ src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \ src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \ src/core/ext/filters/census/grpc_context.cc \ @@ -15696,6 +15762,7 @@ endif CLIENT_LB_END2END_TEST_SRC = \ + $(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.grpc.pb.cc \ test/cpp/end2end/client_lb_end2end_test.cc \ CLIENT_LB_END2END_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CLIENT_LB_END2END_TEST_SRC)))) @@ -15727,6 +15794,8 @@ endif endif +$(OBJDIR)/$(CONFIG)/src/proto/grpc/lb/v2/orca_load_report_for_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(OBJDIR)/$(CONFIG)/test/cpp/end2end/client_lb_end2end_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a deps_client_lb_end2end_test: $(CLIENT_LB_END2END_TEST_OBJS:.o=.dep) @@ -15736,6 +15805,7 @@ ifneq ($(NO_DEPS),true) -include $(CLIENT_LB_END2END_TEST_OBJS:.o=.dep) endif endif +$(OBJDIR)/$(CONFIG)/test/cpp/end2end/client_lb_end2end_test.o: $(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.grpc.pb.cc CODEGEN_TEST_FULL_SRC = \ diff --git a/build.yaml b/build.yaml index cbdbf8a60bc..9c546246ab0 100644 --- a/build.yaml +++ b/build.yaml @@ -113,6 +113,7 @@ filegroups: - src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h - src/core/ext/upb-generated/envoy/api/v2/cds.upb.h - src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h + - src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h - src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h - src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h - src/core/ext/upb-generated/envoy/api/v2/eds.upb.h @@ -124,6 +125,7 @@ filegroups: - src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c - src/core/ext/upb-generated/envoy/api/v2/cds.upb.c - src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c + - src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c - src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c - src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c - src/core/ext/upb-generated/envoy/api/v2/eds.upb.c @@ -143,6 +145,7 @@ filegroups: - src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h - src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h - src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h + - src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h - src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h src: - src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c @@ -150,11 +153,19 @@ filegroups: - src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c - src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c - src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c + - src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c - src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c uses: - envoy_type_upb - google_api_upb - proto_gen_validate_upb +- name: envoy_orca_upb + headers: + - src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h + src: + - src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c + uses: + - proto_gen_validate_upb - name: envoy_type_upb headers: - src/core/ext/upb-generated/envoy/type/percent.upb.h @@ -945,6 +956,7 @@ filegroups: - grpc_base - name: grpc_client_channel headers: + - src/core/ext/filters/client_channel/backend_metric.h - src/core/ext/filters/client_channel/backup_poller.h - src/core/ext/filters/client_channel/client_channel.h - src/core/ext/filters/client_channel/client_channel_channelz.h @@ -973,6 +985,7 @@ filegroups: - src/core/ext/filters/client_channel/subchannel_interface.h - src/core/ext/filters/client_channel/subchannel_pool_interface.h src: + - src/core/ext/filters/client_channel/backend_metric.cc - src/core/ext/filters/client_channel/backup_poller.cc - src/core/ext/filters/client_channel/channel_connectivity.cc - src/core/ext/filters/client_channel/client_channel.cc @@ -1004,6 +1017,7 @@ filegroups: - grpc_base - grpc_deadline_filter - grpc_health_upb + - envoy_orca_upb - name: grpc_client_idle_filter src: - src/core/ext/filters/client_idle/client_idle_filter.cc @@ -4741,6 +4755,7 @@ targets: build: test language: c++ src: + - src/proto/grpc/lb/v2/orca_load_report_for_test.proto - test/cpp/end2end/client_lb_end2end_test.cc deps: - grpc++_test_util diff --git a/config.m4 b/config.m4 index 79f69aa36e4..effefa9b561 100644 --- a/config.m4 +++ b/config.m4 @@ -349,6 +349,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ + src/core/ext/filters/client_channel/backend_metric.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -377,6 +378,19 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ + src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c \ + src/core/ext/upb-generated/gogoproto/gogo.upb.c \ + src/core/ext/upb-generated/validate/validate.upb.c \ + src/core/ext/upb-generated/google/api/annotations.upb.c \ + src/core/ext/upb-generated/google/api/http.upb.c \ + src/core/ext/upb-generated/google/protobuf/any.upb.c \ + src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ + src/core/ext/upb-generated/google/protobuf/duration.upb.c \ + src/core/ext/upb-generated/google/protobuf/empty.upb.c \ + src/core/ext/upb-generated/google/protobuf/struct.upb.c \ + src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ + src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ + src/core/ext/upb-generated/google/rpc/status.upb.c \ src/core/tsi/fake_transport_security.cc \ src/core/tsi/local_transport_security.cc \ src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc \ @@ -396,16 +410,6 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \ src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \ src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ - src/core/ext/upb-generated/google/api/annotations.upb.c \ - src/core/ext/upb-generated/google/api/http.upb.c \ - src/core/ext/upb-generated/google/protobuf/any.upb.c \ - src/core/ext/upb-generated/google/protobuf/descriptor.upb.c \ - src/core/ext/upb-generated/google/protobuf/duration.upb.c \ - src/core/ext/upb-generated/google/protobuf/empty.upb.c \ - src/core/ext/upb-generated/google/protobuf/struct.upb.c \ - src/core/ext/upb-generated/google/protobuf/timestamp.upb.c \ - src/core/ext/upb-generated/google/protobuf/wrappers.upb.c \ - src/core/ext/upb-generated/google/rpc/status.upb.c \ src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds.cc \ src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc \ @@ -414,6 +418,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c \ src/core/ext/upb-generated/envoy/api/v2/cds.upb.c \ src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c \ src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c \ src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c \ src/core/ext/upb-generated/envoy/api/v2/eds.upb.c \ @@ -426,11 +431,10 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c \ src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c \ src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c \ + src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c \ src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c \ src/core/ext/upb-generated/envoy/type/percent.upb.c \ src/core/ext/upb-generated/envoy/type/range.upb.c \ - src/core/ext/upb-generated/gogoproto/gogo.upb.c \ - src/core/ext/upb-generated/validate/validate.upb.c \ src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \ src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \ src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc \ @@ -766,6 +770,7 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/gcp) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/health/v1) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/lb/v1) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/udpa/data/orca/v1) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/validate) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/avl) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/backoff) diff --git a/config.w32 b/config.w32 index 994363a0f1f..13b5f1350f0 100644 --- a/config.w32 +++ b/config.w32 @@ -323,6 +323,7 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create_posix.cc " + "src\\core\\ext\\transport\\chttp2\\client\\authority.cc " + "src\\core\\ext\\transport\\chttp2\\client\\chttp2_connector.cc " + + "src\\core\\ext\\filters\\client_channel\\backend_metric.cc " + "src\\core\\ext\\filters\\client_channel\\backup_poller.cc " + "src\\core\\ext\\filters\\client_channel\\channel_connectivity.cc " + "src\\core\\ext\\filters\\client_channel\\client_channel.cc " + @@ -351,6 +352,19 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\subchannel_pool_interface.cc " + "src\\core\\ext\\filters\\deadline\\deadline_filter.cc " + "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health\\v1\\health.upb.c " + + "src\\core\\ext\\upb-generated\\udpa\\data\\orca\\v1\\orca_load_report.upb.c " + + "src\\core\\ext\\upb-generated\\gogoproto\\gogo.upb.c " + + "src\\core\\ext\\upb-generated\\validate\\validate.upb.c " + + "src\\core\\ext\\upb-generated\\google\\api\\annotations.upb.c " + + "src\\core\\ext\\upb-generated\\google\\api\\http.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\any.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\descriptor.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\duration.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\empty.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\struct.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\timestamp.upb.c " + + "src\\core\\ext\\upb-generated\\google\\protobuf\\wrappers.upb.c " + + "src\\core\\ext\\upb-generated\\google\\rpc\\status.upb.c " + "src\\core\\tsi\\fake_transport_security.cc " + "src\\core\\tsi\\local_transport_security.cc " + "src\\core\\tsi\\ssl\\session_cache\\ssl_session_boringssl.cc " + @@ -370,16 +384,6 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\grpclb_client_stats.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\load_balancer_api.cc " + "src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb\\v1\\load_balancer.upb.c " + - "src\\core\\ext\\upb-generated\\google\\api\\annotations.upb.c " + - "src\\core\\ext\\upb-generated\\google\\api\\http.upb.c " + - "src\\core\\ext\\upb-generated\\google\\protobuf\\any.upb.c " + - "src\\core\\ext\\upb-generated\\google\\protobuf\\descriptor.upb.c " + - "src\\core\\ext\\upb-generated\\google\\protobuf\\duration.upb.c " + - "src\\core\\ext\\upb-generated\\google\\protobuf\\empty.upb.c " + - "src\\core\\ext\\upb-generated\\google\\protobuf\\struct.upb.c " + - "src\\core\\ext\\upb-generated\\google\\protobuf\\timestamp.upb.c " + - "src\\core\\ext\\upb-generated\\google\\protobuf\\wrappers.upb.c " + - "src\\core\\ext\\upb-generated\\google\\rpc\\status.upb.c " + "src\\core\\ext\\filters\\client_channel\\resolver\\fake\\fake_resolver.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds_channel_secure.cc " + @@ -388,6 +392,7 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\auth\\cert.upb.c " + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\cds.upb.c " + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\cluster\\circuit_breaker.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\cluster\\filter.upb.c " + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\cluster\\outlier_detection.upb.c " + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\discovery.upb.c " + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\eds.upb.c " + @@ -400,11 +405,10 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\core\\config_source.upb.c " + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\core\\grpc_service.upb.c " + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\core\\health_check.upb.c " + + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\core\\http_uri.upb.c " + "src\\core\\ext\\upb-generated\\envoy\\api\\v2\\core\\protocol.upb.c " + "src\\core\\ext\\upb-generated\\envoy\\type\\percent.upb.c " + "src\\core\\ext\\upb-generated\\envoy\\type\\range.upb.c " + - "src\\core\\ext\\upb-generated\\gogoproto\\gogo.upb.c " + - "src\\core\\ext\\upb-generated\\validate\\validate.upb.c " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\pick_first\\pick_first.cc " + "src\\core\\ext\\filters\\client_channel\\lb_policy\\round_robin\\round_robin.cc " + "src\\core\\ext\\filters\\client_channel\\resolver\\dns\\c_ares\\dns_resolver_ares.cc " + @@ -785,6 +789,10 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health\\v1"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb\\v1"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\udpa"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\udpa\\data"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\udpa\\data\\orca"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\udpa\\data\\orca\\v1"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\validate"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\avl"); diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index e6f926ca166..658a3ad6158 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -352,6 +352,7 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', + 'src/core/ext/filters/client_channel/backend_metric.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', 'src/core/ext/filters/client_channel/client_channel_channelz.h', @@ -381,6 +382,19 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel_pool_interface.h', 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', + 'src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.h', + 'src/core/ext/upb-generated/validate/validate.upb.h', + 'src/core/ext/upb-generated/google/api/annotations.upb.h', + 'src/core/ext/upb-generated/google/api/http.upb.h', + 'src/core/ext/upb-generated/google/protobuf/any.upb.h', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', + 'src/core/ext/upb-generated/google/rpc/status.upb.h', 'src/core/tsi/fake_transport_security.h', 'src/core/tsi/local_transport_security.h', 'src/core/tsi/ssl/session_cache/ssl_session.h', @@ -540,16 +554,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', - 'src/core/ext/upb-generated/google/api/annotations.upb.h', - 'src/core/ext/upb-generated/google/api/http.upb.h', - 'src/core/ext/upb-generated/google/protobuf/any.upb.h', - 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', - 'src/core/ext/upb-generated/google/rpc/status.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h', @@ -557,6 +561,7 @@ Pod::Spec.new do |s| 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.h', @@ -569,11 +574,10 @@ Pod::Spec.new do |s| 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h', 'src/core/ext/upb-generated/envoy/type/percent.upb.h', 'src/core/ext/upb-generated/envoy/type/range.upb.h', - 'src/core/ext/upb-generated/gogoproto/gogo.upb.h', - 'src/core/ext/upb-generated/validate/validate.upb.h', 'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h', @@ -847,6 +851,7 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', + 'src/core/ext/filters/client_channel/backend_metric.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -875,6 +880,19 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', + 'src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', + 'src/core/ext/upb-generated/validate/validate.upb.c', + 'src/core/ext/upb-generated/google/api/annotations.upb.c', + 'src/core/ext/upb-generated/google/api/http.upb.c', + 'src/core/ext/upb-generated/google/protobuf/any.upb.c', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', + 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/tsi/fake_transport_security.cc', 'src/core/tsi/local_transport_security.cc', 'src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc', @@ -894,16 +912,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', - 'src/core/ext/upb-generated/google/api/annotations.upb.c', - 'src/core/ext/upb-generated/google/api/http.upb.c', - 'src/core/ext/upb-generated/google/protobuf/any.upb.c', - 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', - 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc', @@ -912,6 +920,7 @@ Pod::Spec.new do |s| 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.c', @@ -924,11 +933,10 @@ Pod::Spec.new do |s| 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c', 'src/core/ext/upb-generated/envoy/type/percent.upb.c', 'src/core/ext/upb-generated/envoy/type/range.upb.c', - 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', - 'src/core/ext/upb-generated/validate/validate.upb.c', 'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc', @@ -1078,6 +1086,7 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', + 'src/core/ext/filters/client_channel/backend_metric.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', 'src/core/ext/filters/client_channel/client_channel_channelz.h', @@ -1107,6 +1116,19 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel_pool_interface.h', 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h', + 'src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.h', + 'src/core/ext/upb-generated/validate/validate.upb.h', + 'src/core/ext/upb-generated/google/api/annotations.upb.h', + 'src/core/ext/upb-generated/google/api/http.upb.h', + 'src/core/ext/upb-generated/google/protobuf/any.upb.h', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', + 'src/core/ext/upb-generated/google/rpc/status.upb.h', 'src/core/tsi/fake_transport_security.h', 'src/core/tsi/local_transport_security.h', 'src/core/tsi/ssl/session_cache/ssl_session.h', @@ -1266,16 +1288,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h', 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h', - 'src/core/ext/upb-generated/google/api/annotations.upb.h', - 'src/core/ext/upb-generated/google/api/http.upb.h', - 'src/core/ext/upb-generated/google/protobuf/any.upb.h', - 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.h', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.h', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.h', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h', - 'src/core/ext/upb-generated/google/rpc/status.upb.h', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h', @@ -1283,6 +1295,7 @@ Pod::Spec.new do |s| 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.h', @@ -1295,11 +1308,10 @@ Pod::Spec.new do |s| 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h', + 'src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h', 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h', 'src/core/ext/upb-generated/envoy/type/percent.upb.h', 'src/core/ext/upb-generated/envoy/type/range.upb.h', - 'src/core/ext/upb-generated/gogoproto/gogo.upb.h', - 'src/core/ext/upb-generated/validate/validate.upb.h', 'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h', diff --git a/grpc.gemspec b/grpc.gemspec index 5a29165c92d..1b705016cee 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -282,6 +282,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/tsi/transport_security_interface.h ) s.files += %w( src/core/ext/transport/chttp2/client/authority.h ) s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.h ) + s.files += %w( src/core/ext/filters/client_channel/backend_metric.h ) s.files += %w( src/core/ext/filters/client_channel/backup_poller.h ) s.files += %w( src/core/ext/filters/client_channel/client_channel.h ) s.files += %w( src/core/ext/filters/client_channel/client_channel_channelz.h ) @@ -311,6 +312,19 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/subchannel_pool_interface.h ) s.files += %w( src/core/ext/filters/deadline/deadline_filter.h ) s.files += %w( src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h ) + s.files += %w( src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h ) + s.files += %w( src/core/ext/upb-generated/gogoproto/gogo.upb.h ) + s.files += %w( src/core/ext/upb-generated/validate/validate.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/api/annotations.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/api/http.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/any.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/descriptor.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/duration.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/empty.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/struct.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/timestamp.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/wrappers.upb.h ) + s.files += %w( src/core/ext/upb-generated/google/rpc/status.upb.h ) s.files += %w( src/core/tsi/fake_transport_security.h ) s.files += %w( src/core/tsi/local_transport_security.h ) s.files += %w( src/core/tsi/ssl/session_cache/ssl_session.h ) @@ -470,16 +484,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h ) s.files += %w( src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/api/annotations.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/api/http.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/any.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/descriptor.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/duration.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/empty.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/struct.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/timestamp.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/wrappers.upb.h ) - s.files += %w( src/core/ext/upb-generated/google/rpc/status.upb.h ) s.files += %w( src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h ) @@ -487,6 +491,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cds.upb.h ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/eds.upb.h ) @@ -499,11 +504,10 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h ) s.files += %w( src/core/ext/upb-generated/envoy/type/percent.upb.h ) s.files += %w( src/core/ext/upb-generated/envoy/type/range.upb.h ) - s.files += %w( src/core/ext/upb-generated/gogoproto/gogo.upb.h ) - s.files += %w( src/core/ext/upb-generated/validate/validate.upb.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/subchannel_list.h ) s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h ) s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h ) @@ -777,6 +781,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc ) s.files += %w( src/core/ext/transport/chttp2/client/authority.cc ) s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.cc ) + s.files += %w( src/core/ext/filters/client_channel/backend_metric.cc ) s.files += %w( src/core/ext/filters/client_channel/backup_poller.cc ) s.files += %w( src/core/ext/filters/client_channel/channel_connectivity.cc ) s.files += %w( src/core/ext/filters/client_channel/client_channel.cc ) @@ -805,6 +810,19 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/subchannel_pool_interface.cc ) s.files += %w( src/core/ext/filters/deadline/deadline_filter.cc ) s.files += %w( src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c ) + s.files += %w( src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c ) + s.files += %w( src/core/ext/upb-generated/gogoproto/gogo.upb.c ) + s.files += %w( src/core/ext/upb-generated/validate/validate.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/api/annotations.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/api/http.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/any.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/descriptor.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/duration.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/empty.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/struct.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/timestamp.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/protobuf/wrappers.upb.c ) + s.files += %w( src/core/ext/upb-generated/google/rpc/status.upb.c ) s.files += %w( src/core/tsi/fake_transport_security.cc ) s.files += %w( src/core/tsi/local_transport_security.cc ) s.files += %w( src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc ) @@ -824,16 +842,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc ) s.files += %w( src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/api/annotations.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/api/http.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/any.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/descriptor.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/duration.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/empty.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/struct.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/timestamp.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/protobuf/wrappers.upb.c ) - s.files += %w( src/core/ext/upb-generated/google/rpc/status.upb.c ) s.files += %w( src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc ) @@ -842,6 +850,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cds.upb.c ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/eds.upb.c ) @@ -854,11 +863,10 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c ) + s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c ) s.files += %w( src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c ) s.files += %w( src/core/ext/upb-generated/envoy/type/percent.upb.c ) s.files += %w( src/core/ext/upb-generated/envoy/type/range.upb.c ) - s.files += %w( src/core/ext/upb-generated/gogoproto/gogo.upb.c ) - s.files += %w( src/core/ext/upb-generated/validate/validate.upb.c ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc ) s.files += %w( src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc ) diff --git a/grpc.gyp b/grpc.gyp index 3b86e613131..64481e22df3 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -553,6 +553,7 @@ 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', + 'src/core/ext/filters/client_channel/backend_metric.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -581,6 +582,19 @@ 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', + 'src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', + 'src/core/ext/upb-generated/validate/validate.upb.c', + 'src/core/ext/upb-generated/google/api/annotations.upb.c', + 'src/core/ext/upb-generated/google/api/http.upb.c', + 'src/core/ext/upb-generated/google/protobuf/any.upb.c', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', + 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/tsi/fake_transport_security.cc', 'src/core/tsi/local_transport_security.cc', 'src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc', @@ -600,16 +614,6 @@ 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', - 'src/core/ext/upb-generated/google/api/annotations.upb.c', - 'src/core/ext/upb-generated/google/api/http.upb.c', - 'src/core/ext/upb-generated/google/protobuf/any.upb.c', - 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', - 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc', @@ -618,6 +622,7 @@ 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.c', @@ -630,11 +635,10 @@ 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c', 'src/core/ext/upb-generated/envoy/type/percent.upb.c', 'src/core/ext/upb-generated/envoy/type/range.upb.c', - 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', - 'src/core/ext/upb-generated/validate/validate.upb.c', 'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc', @@ -857,6 +861,7 @@ 'src/core/lib/transport/transport_op_string.cc', 'src/core/lib/uri/uri_parser.cc', 'src/core/lib/debug/trace.cc', + 'src/core/ext/filters/client_channel/backend_metric.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -891,6 +896,19 @@ 'third_party/upb/upb/port.c', 'third_party/upb/upb/table.c', 'third_party/upb/upb/upb.c', + 'src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', + 'src/core/ext/upb-generated/validate/validate.upb.c', + 'src/core/ext/upb-generated/google/api/annotations.upb.c', + 'src/core/ext/upb-generated/google/api/http.upb.c', + 'src/core/ext/upb-generated/google/protobuf/any.upb.c', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', + 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/ext/transport/chttp2/transport/bin_decoder.cc', 'src/core/ext/transport/chttp2/transport/bin_encoder.cc', 'src/core/ext/transport/chttp2/transport/chttp2_plugin.cc', @@ -1112,6 +1130,7 @@ 'src/core/lib/transport/transport_op_string.cc', 'src/core/lib/uri/uri_parser.cc', 'src/core/lib/debug/trace.cc', + 'src/core/ext/filters/client_channel/backend_metric.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -1146,6 +1165,19 @@ 'third_party/upb/upb/port.c', 'third_party/upb/upb/table.c', 'third_party/upb/upb/upb.c', + 'src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', + 'src/core/ext/upb-generated/validate/validate.upb.c', + 'src/core/ext/upb-generated/google/api/annotations.upb.c', + 'src/core/ext/upb-generated/google/api/http.upb.c', + 'src/core/ext/upb-generated/google/protobuf/any.upb.c', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', + 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/ext/transport/chttp2/transport/bin_decoder.cc', 'src/core/ext/transport/chttp2/transport/bin_encoder.cc', 'src/core/ext/transport/chttp2/transport/chttp2_plugin.cc', @@ -1378,6 +1410,7 @@ 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', + 'src/core/ext/filters/client_channel/backend_metric.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -1412,6 +1445,19 @@ 'third_party/upb/upb/port.c', 'third_party/upb/upb/table.c', 'third_party/upb/upb/upb.c', + 'src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', + 'src/core/ext/upb-generated/validate/validate.upb.c', + 'src/core/ext/upb-generated/google/api/annotations.upb.c', + 'src/core/ext/upb-generated/google/api/http.upb.c', + 'src/core/ext/upb-generated/google/protobuf/any.upb.c', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', + 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/ext/transport/inproc/inproc_plugin.cc', 'src/core/ext/transport/inproc/inproc_transport.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc', @@ -1435,16 +1481,6 @@ 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', - 'src/core/ext/upb-generated/google/api/annotations.upb.c', - 'src/core/ext/upb-generated/google/api/http.upb.c', - 'src/core/ext/upb-generated/google/protobuf/any.upb.c', - 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', - 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc', @@ -1452,6 +1488,7 @@ 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.c', @@ -1464,11 +1501,10 @@ 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c', 'src/core/ext/upb-generated/envoy/type/percent.upb.c', 'src/core/ext/upb-generated/envoy/type/range.upb.c', - 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', - 'src/core/ext/upb-generated/validate/validate.upb.c', 'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'src/core/ext/filters/census/grpc_context.cc', diff --git a/package.xml b/package.xml index 196c6a6d7db..385a57c77ea 100644 --- a/package.xml +++ b/package.xml @@ -287,6 +287,7 @@ + @@ -316,6 +317,19 @@ + + + + + + + + + + + + + @@ -475,16 +489,6 @@ - - - - - - - - - - @@ -492,6 +496,7 @@ + @@ -504,11 +509,10 @@ + - - @@ -782,6 +786,7 @@ + @@ -810,6 +815,19 @@ + + + + + + + + + + + + + @@ -829,16 +847,6 @@ - - - - - - - - - - @@ -847,6 +855,7 @@ + @@ -859,11 +868,10 @@ + - - diff --git a/src/core/ext/filters/client_channel/backend_metric.cc b/src/core/ext/filters/client_channel/backend_metric.cc new file mode 100644 index 00000000000..0d6aa2f6e2c --- /dev/null +++ b/src/core/ext/filters/client_channel/backend_metric.cc @@ -0,0 +1,78 @@ +// +// Copyright 2019 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include + +#include "src/core/ext/filters/client_channel/backend_metric.h" + +#include "src/core/lib/gprpp/string_view.h" +#include "udpa/data/orca/v1/orca_load_report.upb.h" + +namespace grpc_core { + +namespace { + +template +Map ParseMap( + udpa_data_orca_v1_OrcaLoadReport* msg, + EntryType** (*entry_func)(udpa_data_orca_v1_OrcaLoadReport*, size_t*), + upb_strview (*key_func)(const EntryType*), + double (*value_func)(const EntryType*), Arena* arena) { + Map result; + size_t size; + const auto* const* entries = entry_func(msg, &size); + for (size_t i = 0; i < size; ++i) { + upb_strview key_view = key_func(entries[i]); + char* key = static_cast(arena->Alloc(key_view.size + 1)); + memcpy(key, key_view.data, key_view.size); + result[StringView(key, key_view.size)] = value_func(entries[i]); + } + return result; +} + +} // namespace + +const LoadBalancingPolicy::BackendMetricData* ParseBackendMetricData( + const grpc_slice& serialized_load_report, Arena* arena) { + upb::Arena upb_arena; + udpa_data_orca_v1_OrcaLoadReport* msg = + udpa_data_orca_v1_OrcaLoadReport_parse( + reinterpret_cast( + GRPC_SLICE_START_PTR(serialized_load_report)), + GRPC_SLICE_LENGTH(serialized_load_report), upb_arena.ptr()); + if (msg == nullptr) return nullptr; + LoadBalancingPolicy::BackendMetricData* backend_metric_data = + arena->New(); + backend_metric_data->cpu_utilization = + udpa_data_orca_v1_OrcaLoadReport_cpu_utilization(msg); + backend_metric_data->mem_utilization = + udpa_data_orca_v1_OrcaLoadReport_mem_utilization(msg); + backend_metric_data->requests_per_second = + udpa_data_orca_v1_OrcaLoadReport_rps(msg); + backend_metric_data->request_cost = + ParseMap( + msg, udpa_data_orca_v1_OrcaLoadReport_mutable_request_cost, + udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_key, + udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_value, arena); + backend_metric_data->utilization = + ParseMap( + msg, udpa_data_orca_v1_OrcaLoadReport_mutable_utilization, + udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_key, + udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_value, arena); + return backend_metric_data; +} + +} // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/backend_metric.h b/src/core/ext/filters/client_channel/backend_metric.h new file mode 100644 index 00000000000..d92b76c8d32 --- /dev/null +++ b/src/core/ext/filters/client_channel/backend_metric.h @@ -0,0 +1,36 @@ +// +// Copyright 2019 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_BACKEND_METRIC_H +#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_BACKEND_METRIC_H + +#include + +#include + +#include "src/core/ext/filters/client_channel/lb_policy.h" +#include "src/core/lib/gprpp/arena.h" + +namespace grpc_core { + +// Parses the serialized load report and allocates a BackendMetricData +// object on the arena. +const LoadBalancingPolicy::BackendMetricData* ParseBackendMetricData( + const grpc_slice& serialized_load_report, Arena* arena); + +} // namespace grpc_core + +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_BACKEND_METRIC_H */ diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index db5ddcb46b9..2482614e8c9 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -31,6 +31,7 @@ #include #include +#include "src/core/ext/filters/client_channel/backend_metric.h" #include "src/core/ext/filters/client_channel/backup_poller.h" #include "src/core/ext/filters/client_channel/global_subchannel_pool.h" #include "src/core/ext/filters/client_channel/http_connect_handshaker.h" @@ -374,6 +375,19 @@ class CallData { void* Alloc(size_t size) override { return calld_->arena_->Alloc(size); } + const LoadBalancingPolicy::BackendMetricData* GetBackendMetricData() + override { + if (calld_->backend_metric_data_ == nullptr) { + grpc_linked_mdelem* md = calld_->recv_trailing_metadata_->idx.named + .x_endpoint_load_metrics_bin; + if (md != nullptr) { + calld_->backend_metric_data_ = + ParseBackendMetricData(GRPC_MDVALUE(md->md), calld_->arena_); + } + } + return calld_->backend_metric_data_; + } + private: CallData* calld_; }; @@ -706,6 +720,7 @@ class CallData { bool service_config_applied_ = false; QueuedPickCanceller* pick_canceller_ = nullptr; LbCallState lb_call_state_; + const LoadBalancingPolicy::BackendMetricData* backend_metric_data_ = nullptr; RefCountedPtr connected_subchannel_; void (*lb_recv_trailing_metadata_ready_)( void* user_data, grpc_error* error, @@ -1927,6 +1942,10 @@ CallData::CallData(grpc_call_element* elem, const ChannelData& chand, CallData::~CallData() { grpc_slice_unref_internal(path_); GRPC_ERROR_UNREF(cancel_error_); + if (backend_metric_data_ != nullptr) { + backend_metric_data_ + ->LoadBalancingPolicy::BackendMetricData::~BackendMetricData(); + } // Make sure there are no remaining pending batches. for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) { GPR_ASSERT(pending_batches_[i].batch == nullptr); diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h index 7df581288cc..093d5fc30b8 100644 --- a/src/core/ext/filters/client_channel/lb_policy.h +++ b/src/core/ext/filters/client_channel/lb_policy.h @@ -25,6 +25,7 @@ #include "src/core/ext/filters/client_channel/service_config.h" #include "src/core/ext/filters/client_channel/subchannel_interface.h" #include "src/core/lib/gprpp/abstract.h" +#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/string_view.h" @@ -77,6 +78,26 @@ extern DebugOnlyTraceFlag grpc_trace_lb_policy_refcount; // interested_parties() hooks from the API. class LoadBalancingPolicy : public InternallyRefCounted { public: + // Represents backend metrics reported by the backend to the client. + struct BackendMetricData { + /// CPU utilization expressed as a fraction of available CPU resources. + double cpu_utilization; + /// Memory utilization expressed as a fraction of available memory + /// resources. + double mem_utilization; + /// Total requests per second being served by the backend. This + /// should include all services that a backend is responsible for. + uint64_t requests_per_second; + /// Application-specific requests cost metrics. Metric names are + /// determined by the application. Each value is an absolute cost + /// (e.g. 3487 bytes of storage) associated with the request. + Map request_cost; + /// Application-specific resource utilization metrics. Metric names + /// are determined by the application. Each value is expressed as a + /// fraction of total resources available. + Map utilization; + }; + /// Interface for accessing per-call state. /// Implemented by the client channel and used by the SubchannelPicker. class CallState { @@ -90,6 +111,10 @@ class LoadBalancingPolicy : public InternallyRefCounted { /// for allocations that need to be made on a per-call basis. virtual void* Alloc(size_t size) GRPC_ABSTRACT; + /// Returns the backend metric data returned by the server for the call, + /// or null if no backend metric data was returned. + virtual const BackendMetricData* GetBackendMetricData() GRPC_ABSTRACT; + GRPC_ABSTRACT_BASE_CLASS }; @@ -175,6 +200,7 @@ class LoadBalancingPolicy : public InternallyRefCounted { /// modified by the callback. The callback does not take ownership, /// however, so any data that needs to be used after returning must /// be copied. + /// call_state can be used to obtain backend metric data. // TODO(roth): Replace grpc_error with something better before we allow // people outside of gRPC team to use this API. void (*recv_trailing_metadata_ready)( diff --git a/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c b/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c index 844ad3d147f..f1deb309a60 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c @@ -11,6 +11,8 @@ #include "envoy/api/v2/auth/cert.upb.h" #include "envoy/api/v2/core/base.upb.h" #include "envoy/api/v2/core/config_source.upb.h" +#include "google/protobuf/any.upb.h" +#include "google/protobuf/struct.upb.h" #include "google/protobuf/wrappers.upb.h" #include "validate/validate.upb.h" #include "gogoproto/gogo.upb.h" @@ -30,22 +32,41 @@ const upb_msglayout envoy_api_v2_auth_TlsParameters_msginit = { UPB_SIZE(24, 32), 4, false, }; -static const upb_msglayout *const envoy_api_v2_auth_TlsCertificate_submsgs[5] = { +static const upb_msglayout *const envoy_api_v2_auth_PrivateKeyProvider_submsgs[2] = { + &google_protobuf_Any_msginit, + &google_protobuf_Struct_msginit, +}; + +static const upb_msglayout_field envoy_api_v2_auth_PrivateKeyProvider__fields[3] = { + {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, + {2, UPB_SIZE(8, 16), UPB_SIZE(-13, -25), 1, 11, 1}, + {3, UPB_SIZE(8, 16), UPB_SIZE(-13, -25), 0, 11, 1}, +}; + +const upb_msglayout envoy_api_v2_auth_PrivateKeyProvider_msginit = { + &envoy_api_v2_auth_PrivateKeyProvider_submsgs[0], + &envoy_api_v2_auth_PrivateKeyProvider__fields[0], + UPB_SIZE(16, 32), 3, false, +}; + +static const upb_msglayout *const envoy_api_v2_auth_TlsCertificate_submsgs[6] = { + &envoy_api_v2_auth_PrivateKeyProvider_msginit, &envoy_api_v2_core_DataSource_msginit, }; -static const upb_msglayout_field envoy_api_v2_auth_TlsCertificate__fields[5] = { - {1, UPB_SIZE(0, 0), 0, 0, 11, 1}, - {2, UPB_SIZE(4, 8), 0, 0, 11, 1}, - {3, UPB_SIZE(8, 16), 0, 0, 11, 1}, - {4, UPB_SIZE(12, 24), 0, 0, 11, 1}, - {5, UPB_SIZE(16, 32), 0, 0, 11, 3}, +static const upb_msglayout_field envoy_api_v2_auth_TlsCertificate__fields[6] = { + {1, UPB_SIZE(0, 0), 0, 1, 11, 1}, + {2, UPB_SIZE(4, 8), 0, 1, 11, 1}, + {3, UPB_SIZE(8, 16), 0, 1, 11, 1}, + {4, UPB_SIZE(12, 24), 0, 1, 11, 1}, + {5, UPB_SIZE(20, 40), 0, 1, 11, 3}, + {6, UPB_SIZE(16, 32), 0, 0, 11, 1}, }; const upb_msglayout envoy_api_v2_auth_TlsCertificate_msginit = { &envoy_api_v2_auth_TlsCertificate_submsgs[0], &envoy_api_v2_auth_TlsCertificate__fields[0], - UPB_SIZE(20, 40), 5, false, + UPB_SIZE(24, 48), 6, false, }; static const upb_msglayout *const envoy_api_v2_auth_TlsSessionTicketKeys_submsgs[1] = { diff --git a/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h b/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h index 89aeaee2fd7..252d9d76e9e 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h @@ -21,6 +21,7 @@ extern "C" { #endif struct envoy_api_v2_auth_TlsParameters; +struct envoy_api_v2_auth_PrivateKeyProvider; struct envoy_api_v2_auth_TlsCertificate; struct envoy_api_v2_auth_TlsSessionTicketKeys; struct envoy_api_v2_auth_CertificateValidationContext; @@ -31,6 +32,7 @@ struct envoy_api_v2_auth_DownstreamTlsContext; struct envoy_api_v2_auth_SdsSecretConfig; struct envoy_api_v2_auth_Secret; typedef struct envoy_api_v2_auth_TlsParameters envoy_api_v2_auth_TlsParameters; +typedef struct envoy_api_v2_auth_PrivateKeyProvider envoy_api_v2_auth_PrivateKeyProvider; typedef struct envoy_api_v2_auth_TlsCertificate envoy_api_v2_auth_TlsCertificate; typedef struct envoy_api_v2_auth_TlsSessionTicketKeys envoy_api_v2_auth_TlsSessionTicketKeys; typedef struct envoy_api_v2_auth_CertificateValidationContext envoy_api_v2_auth_CertificateValidationContext; @@ -41,6 +43,7 @@ typedef struct envoy_api_v2_auth_DownstreamTlsContext envoy_api_v2_auth_Downstre typedef struct envoy_api_v2_auth_SdsSecretConfig envoy_api_v2_auth_SdsSecretConfig; typedef struct envoy_api_v2_auth_Secret envoy_api_v2_auth_Secret; extern const upb_msglayout envoy_api_v2_auth_TlsParameters_msginit; +extern const upb_msglayout envoy_api_v2_auth_PrivateKeyProvider_msginit; extern const upb_msglayout envoy_api_v2_auth_TlsCertificate_msginit; extern const upb_msglayout envoy_api_v2_auth_TlsSessionTicketKeys_msginit; extern const upb_msglayout envoy_api_v2_auth_CertificateValidationContext_msginit; @@ -52,11 +55,15 @@ extern const upb_msglayout envoy_api_v2_auth_SdsSecretConfig_msginit; extern const upb_msglayout envoy_api_v2_auth_Secret_msginit; struct envoy_api_v2_core_ConfigSource; struct envoy_api_v2_core_DataSource; +struct google_protobuf_Any; struct google_protobuf_BoolValue; +struct google_protobuf_Struct; struct google_protobuf_UInt32Value; extern const upb_msglayout envoy_api_v2_core_ConfigSource_msginit; extern const upb_msglayout envoy_api_v2_core_DataSource_msginit; +extern const upb_msglayout google_protobuf_Any_msginit; extern const upb_msglayout google_protobuf_BoolValue_msginit; +extern const upb_msglayout google_protobuf_Struct_msginit; extern const upb_msglayout google_protobuf_UInt32Value_msginit; typedef enum { @@ -114,6 +121,61 @@ UPB_INLINE bool envoy_api_v2_auth_TlsParameters_add_ecdh_curves(envoy_api_v2_aut msg, UPB_SIZE(20, 24), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); } +/* envoy.api.v2.auth.PrivateKeyProvider */ + +UPB_INLINE envoy_api_v2_auth_PrivateKeyProvider *envoy_api_v2_auth_PrivateKeyProvider_new(upb_arena *arena) { + return (envoy_api_v2_auth_PrivateKeyProvider *)upb_msg_new(&envoy_api_v2_auth_PrivateKeyProvider_msginit, arena); +} +UPB_INLINE envoy_api_v2_auth_PrivateKeyProvider *envoy_api_v2_auth_PrivateKeyProvider_parse(const char *buf, size_t size, + upb_arena *arena) { + envoy_api_v2_auth_PrivateKeyProvider *ret = envoy_api_v2_auth_PrivateKeyProvider_new(arena); + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_PrivateKeyProvider_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *envoy_api_v2_auth_PrivateKeyProvider_serialize(const envoy_api_v2_auth_PrivateKeyProvider *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &envoy_api_v2_auth_PrivateKeyProvider_msginit, arena, len); +} + +typedef enum { + envoy_api_v2_auth_PrivateKeyProvider_config_type_config = 2, + envoy_api_v2_auth_PrivateKeyProvider_config_type_typed_config = 3, + envoy_api_v2_auth_PrivateKeyProvider_config_type_NOT_SET = 0 +} envoy_api_v2_auth_PrivateKeyProvider_config_type_oneofcases; +UPB_INLINE envoy_api_v2_auth_PrivateKeyProvider_config_type_oneofcases envoy_api_v2_auth_PrivateKeyProvider_config_type_case(const envoy_api_v2_auth_PrivateKeyProvider* msg) { return (envoy_api_v2_auth_PrivateKeyProvider_config_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); } + +UPB_INLINE upb_strview envoy_api_v2_auth_PrivateKeyProvider_provider_name(const envoy_api_v2_auth_PrivateKeyProvider *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } +UPB_INLINE bool envoy_api_v2_auth_PrivateKeyProvider_has_config(const envoy_api_v2_auth_PrivateKeyProvider *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); } +UPB_INLINE const struct google_protobuf_Struct* envoy_api_v2_auth_PrivateKeyProvider_config(const envoy_api_v2_auth_PrivateKeyProvider *msg) { return UPB_READ_ONEOF(msg, const struct google_protobuf_Struct*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 2, NULL); } +UPB_INLINE bool envoy_api_v2_auth_PrivateKeyProvider_has_typed_config(const envoy_api_v2_auth_PrivateKeyProvider *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 3); } +UPB_INLINE const struct google_protobuf_Any* envoy_api_v2_auth_PrivateKeyProvider_typed_config(const envoy_api_v2_auth_PrivateKeyProvider *msg) { return UPB_READ_ONEOF(msg, const struct google_protobuf_Any*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 3, NULL); } + +UPB_INLINE void envoy_api_v2_auth_PrivateKeyProvider_set_provider_name(envoy_api_v2_auth_PrivateKeyProvider *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void envoy_api_v2_auth_PrivateKeyProvider_set_config(envoy_api_v2_auth_PrivateKeyProvider *msg, struct google_protobuf_Struct* value) { + UPB_WRITE_ONEOF(msg, struct google_protobuf_Struct*, UPB_SIZE(8, 16), value, UPB_SIZE(12, 24), 2); +} +UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_auth_PrivateKeyProvider_mutable_config(envoy_api_v2_auth_PrivateKeyProvider *msg, upb_arena *arena) { + struct google_protobuf_Struct* sub = (struct google_protobuf_Struct*)envoy_api_v2_auth_PrivateKeyProvider_config(msg); + if (sub == NULL) { + sub = (struct google_protobuf_Struct*)upb_msg_new(&google_protobuf_Struct_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_auth_PrivateKeyProvider_set_config(msg, sub); + } + return sub; +} +UPB_INLINE void envoy_api_v2_auth_PrivateKeyProvider_set_typed_config(envoy_api_v2_auth_PrivateKeyProvider *msg, struct google_protobuf_Any* value) { + UPB_WRITE_ONEOF(msg, struct google_protobuf_Any*, UPB_SIZE(8, 16), value, UPB_SIZE(12, 24), 3); +} +UPB_INLINE struct google_protobuf_Any* envoy_api_v2_auth_PrivateKeyProvider_mutable_typed_config(envoy_api_v2_auth_PrivateKeyProvider *msg, upb_arena *arena) { + struct google_protobuf_Any* sub = (struct google_protobuf_Any*)envoy_api_v2_auth_PrivateKeyProvider_typed_config(msg); + if (sub == NULL) { + sub = (struct google_protobuf_Any*)upb_msg_new(&google_protobuf_Any_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_auth_PrivateKeyProvider_set_typed_config(msg, sub); + } + return sub; +} + /* envoy.api.v2.auth.TlsCertificate */ UPB_INLINE envoy_api_v2_auth_TlsCertificate *envoy_api_v2_auth_TlsCertificate_new(upb_arena *arena) { @@ -132,7 +194,8 @@ UPB_INLINE const struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsCerti UPB_INLINE const struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsCertificate_private_key(const envoy_api_v2_auth_TlsCertificate *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_DataSource*, UPB_SIZE(4, 8)); } UPB_INLINE const struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsCertificate_password(const envoy_api_v2_auth_TlsCertificate *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_DataSource*, UPB_SIZE(8, 16)); } UPB_INLINE const struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsCertificate_ocsp_staple(const envoy_api_v2_auth_TlsCertificate *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_DataSource*, UPB_SIZE(12, 24)); } -UPB_INLINE const struct envoy_api_v2_core_DataSource* const* envoy_api_v2_auth_TlsCertificate_signed_certificate_timestamp(const envoy_api_v2_auth_TlsCertificate *msg, size_t *len) { return (const struct envoy_api_v2_core_DataSource* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); } +UPB_INLINE const struct envoy_api_v2_core_DataSource* const* envoy_api_v2_auth_TlsCertificate_signed_certificate_timestamp(const envoy_api_v2_auth_TlsCertificate *msg, size_t *len) { return (const struct envoy_api_v2_core_DataSource* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); } +UPB_INLINE const envoy_api_v2_auth_PrivateKeyProvider* envoy_api_v2_auth_TlsCertificate_private_key_provider(const envoy_api_v2_auth_TlsCertificate *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_auth_PrivateKeyProvider*, UPB_SIZE(16, 32)); } UPB_INLINE void envoy_api_v2_auth_TlsCertificate_set_certificate_chain(envoy_api_v2_auth_TlsCertificate *msg, struct envoy_api_v2_core_DataSource* value) { UPB_FIELD_AT(msg, struct envoy_api_v2_core_DataSource*, UPB_SIZE(0, 0)) = value; @@ -183,18 +246,30 @@ UPB_INLINE struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsCertificate return sub; } UPB_INLINE struct envoy_api_v2_core_DataSource** envoy_api_v2_auth_TlsCertificate_mutable_signed_certificate_timestamp(envoy_api_v2_auth_TlsCertificate *msg, size_t *len) { - return (struct envoy_api_v2_core_DataSource**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len); + return (struct envoy_api_v2_core_DataSource**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len); } UPB_INLINE struct envoy_api_v2_core_DataSource** envoy_api_v2_auth_TlsCertificate_resize_signed_certificate_timestamp(envoy_api_v2_auth_TlsCertificate *msg, size_t len, upb_arena *arena) { - return (struct envoy_api_v2_core_DataSource**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (struct envoy_api_v2_core_DataSource**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsCertificate_add_signed_certificate_timestamp(envoy_api_v2_auth_TlsCertificate *msg, upb_arena *arena) { struct envoy_api_v2_core_DataSource* sub = (struct envoy_api_v2_core_DataSource*)upb_msg_new(&envoy_api_v2_core_DataSource_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } +UPB_INLINE void envoy_api_v2_auth_TlsCertificate_set_private_key_provider(envoy_api_v2_auth_TlsCertificate *msg, envoy_api_v2_auth_PrivateKeyProvider* value) { + UPB_FIELD_AT(msg, envoy_api_v2_auth_PrivateKeyProvider*, UPB_SIZE(16, 32)) = value; +} +UPB_INLINE struct envoy_api_v2_auth_PrivateKeyProvider* envoy_api_v2_auth_TlsCertificate_mutable_private_key_provider(envoy_api_v2_auth_TlsCertificate *msg, upb_arena *arena) { + struct envoy_api_v2_auth_PrivateKeyProvider* sub = (struct envoy_api_v2_auth_PrivateKeyProvider*)envoy_api_v2_auth_TlsCertificate_private_key_provider(msg); + if (sub == NULL) { + sub = (struct envoy_api_v2_auth_PrivateKeyProvider*)upb_msg_new(&envoy_api_v2_auth_PrivateKeyProvider_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_auth_TlsCertificate_set_private_key_provider(msg, sub); + } + return sub; +} /* envoy.api.v2.auth.TlsSessionTicketKeys */ diff --git a/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c b/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c index f5a7b9195e1..9a0b48a99cc 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c @@ -17,6 +17,7 @@ #include "envoy/api/v2/core/health_check.upb.h" #include "envoy/api/v2/core/protocol.upb.h" #include "envoy/api/v2/cluster/circuit_breaker.upb.h" +#include "envoy/api/v2/cluster/filter.upb.h" #include "envoy/api/v2/cluster/outlier_detection.upb.h" #include "envoy/api/v2/eds.upb.h" #include "envoy/type/percent.upb.h" @@ -30,7 +31,7 @@ #include "upb/port_def.inc" -static const upb_msglayout *const envoy_api_v2_Cluster_submsgs[28] = { +static const upb_msglayout *const envoy_api_v2_Cluster_submsgs[29] = { &envoy_api_v2_Cluster_CommonLbConfig_msginit, &envoy_api_v2_Cluster_CustomClusterType_msginit, &envoy_api_v2_Cluster_EdsClusterConfig_msginit, @@ -44,6 +45,7 @@ static const upb_msglayout *const envoy_api_v2_Cluster_submsgs[28] = { &envoy_api_v2_UpstreamConnectionOptions_msginit, &envoy_api_v2_auth_UpstreamTlsContext_msginit, &envoy_api_v2_cluster_CircuitBreakers_msginit, + &envoy_api_v2_cluster_Filter_msginit, &envoy_api_v2_cluster_OutlierDetection_msginit, &envoy_api_v2_core_Address_msginit, &envoy_api_v2_core_BindConfig_msginit, @@ -57,49 +59,51 @@ static const upb_msglayout *const envoy_api_v2_Cluster_submsgs[28] = { &google_protobuf_UInt32Value_msginit, }; -static const upb_msglayout_field envoy_api_v2_Cluster__fields[36] = { +static const upb_msglayout_field envoy_api_v2_Cluster__fields[38] = { {1, UPB_SIZE(28, 32), 0, 0, 9, 1}, - {2, UPB_SIZE(144, 256), UPB_SIZE(-153, -265), 0, 14, 1}, + {2, UPB_SIZE(144, 264), UPB_SIZE(-153, -273), 0, 14, 1}, {3, UPB_SIZE(44, 64), 0, 2, 11, 1}, - {4, UPB_SIZE(48, 72), 0, 22, 11, 1}, - {5, UPB_SIZE(52, 80), 0, 23, 11, 1}, + {4, UPB_SIZE(48, 72), 0, 23, 11, 1}, + {5, UPB_SIZE(52, 80), 0, 24, 11, 1}, {6, UPB_SIZE(0, 0), 0, 0, 14, 1}, - {7, UPB_SIZE(120, 216), 0, 14, 11, 3}, - {8, UPB_SIZE(124, 224), 0, 16, 11, 3}, - {9, UPB_SIZE(56, 88), 0, 23, 11, 1}, + {7, UPB_SIZE(120, 216), 0, 15, 11, 3}, + {8, UPB_SIZE(124, 224), 0, 17, 11, 3}, + {9, UPB_SIZE(56, 88), 0, 24, 11, 1}, {10, UPB_SIZE(60, 96), 0, 12, 11, 1}, {11, UPB_SIZE(64, 104), 0, 11, 11, 1}, - {13, UPB_SIZE(68, 112), 0, 17, 11, 1}, - {14, UPB_SIZE(72, 120), 0, 18, 11, 1}, - {16, UPB_SIZE(76, 128), 0, 22, 11, 1}, + {13, UPB_SIZE(68, 112), 0, 18, 11, 1}, + {14, UPB_SIZE(72, 120), 0, 19, 11, 1}, + {16, UPB_SIZE(76, 128), 0, 23, 11, 1}, {17, UPB_SIZE(8, 8), 0, 0, 14, 1}, - {18, UPB_SIZE(128, 232), 0, 14, 11, 3}, - {19, UPB_SIZE(80, 136), 0, 13, 11, 1}, - {20, UPB_SIZE(84, 144), 0, 22, 11, 1}, - {21, UPB_SIZE(88, 152), 0, 15, 11, 1}, + {18, UPB_SIZE(128, 232), 0, 15, 11, 3}, + {19, UPB_SIZE(80, 136), 0, 14, 11, 1}, + {20, UPB_SIZE(84, 144), 0, 23, 11, 1}, + {21, UPB_SIZE(88, 152), 0, 16, 11, 1}, {22, UPB_SIZE(92, 160), 0, 4, 11, 1}, - {23, UPB_SIZE(156, 272), UPB_SIZE(-161, -281), 7, 11, 1}, - {24, UPB_SIZE(96, 168), 0, 21, 11, 1}, - {25, UPB_SIZE(100, 176), 0, 20, 11, 1}, + {23, UPB_SIZE(156, 280), UPB_SIZE(-161, -289), 7, 11, 1}, + {24, UPB_SIZE(96, 168), 0, 22, 11, 1}, + {25, UPB_SIZE(100, 176), 0, 21, 11, 1}, {26, UPB_SIZE(16, 16), 0, 0, 14, 1}, {27, UPB_SIZE(104, 184), 0, 0, 11, 1}, {28, UPB_SIZE(36, 48), 0, 0, 9, 1}, - {29, UPB_SIZE(108, 192), 0, 19, 11, 1}, + {29, UPB_SIZE(108, 192), 0, 20, 11, 1}, {30, UPB_SIZE(112, 200), 0, 10, 11, 1}, {31, UPB_SIZE(24, 24), 0, 0, 8, 1}, {32, UPB_SIZE(25, 25), 0, 0, 8, 1}, {33, UPB_SIZE(116, 208), 0, 9, 11, 1}, - {34, UPB_SIZE(156, 272), UPB_SIZE(-161, -281), 6, 11, 1}, + {34, UPB_SIZE(156, 280), UPB_SIZE(-161, -289), 6, 11, 1}, {35, UPB_SIZE(132, 240), 0, 3, 11, 3}, {36, UPB_SIZE(136, 248), 0, 8, 11, 3}, - {37, UPB_SIZE(156, 272), UPB_SIZE(-161, -281), 5, 11, 1}, - {38, UPB_SIZE(144, 256), UPB_SIZE(-153, -265), 1, 11, 1}, + {37, UPB_SIZE(156, 280), UPB_SIZE(-161, -289), 5, 11, 1}, + {38, UPB_SIZE(144, 264), UPB_SIZE(-153, -273), 1, 11, 1}, + {39, UPB_SIZE(26, 26), 0, 0, 8, 1}, + {40, UPB_SIZE(140, 256), 0, 13, 11, 3}, }; const upb_msglayout envoy_api_v2_Cluster_msginit = { &envoy_api_v2_Cluster_submsgs[0], &envoy_api_v2_Cluster__fields[0], - UPB_SIZE(168, 288), 36, false, + UPB_SIZE(168, 304), 38, false, }; static const upb_msglayout *const envoy_api_v2_Cluster_CustomClusterType_submsgs[1] = { @@ -167,29 +171,31 @@ static const upb_msglayout *const envoy_api_v2_Cluster_LbSubsetConfig_submsgs[2] &google_protobuf_Struct_msginit, }; -static const upb_msglayout_field envoy_api_v2_Cluster_LbSubsetConfig__fields[6] = { +static const upb_msglayout_field envoy_api_v2_Cluster_LbSubsetConfig__fields[7] = { {1, UPB_SIZE(0, 0), 0, 0, 14, 1}, {2, UPB_SIZE(12, 16), 0, 1, 11, 1}, {3, UPB_SIZE(16, 24), 0, 0, 11, 3}, {4, UPB_SIZE(8, 8), 0, 0, 8, 1}, {5, UPB_SIZE(9, 9), 0, 0, 8, 1}, {6, UPB_SIZE(10, 10), 0, 0, 8, 1}, + {7, UPB_SIZE(11, 11), 0, 0, 8, 1}, }; const upb_msglayout envoy_api_v2_Cluster_LbSubsetConfig_msginit = { &envoy_api_v2_Cluster_LbSubsetConfig_submsgs[0], &envoy_api_v2_Cluster_LbSubsetConfig__fields[0], - UPB_SIZE(24, 32), 6, false, + UPB_SIZE(24, 32), 7, false, }; -static const upb_msglayout_field envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector__fields[1] = { - {1, UPB_SIZE(0, 0), 0, 0, 9, 3}, +static const upb_msglayout_field envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector__fields[2] = { + {1, UPB_SIZE(8, 8), 0, 0, 9, 3}, + {2, UPB_SIZE(0, 0), 0, 0, 14, 1}, }; const upb_msglayout envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit = { NULL, &envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector__fields[0], - UPB_SIZE(4, 8), 1, false, + UPB_SIZE(16, 16), 2, false, }; static const upb_msglayout *const envoy_api_v2_Cluster_LeastRequestLbConfig_submsgs[1] = { @@ -239,18 +245,19 @@ static const upb_msglayout *const envoy_api_v2_Cluster_CommonLbConfig_submsgs[4] &google_protobuf_Duration_msginit, }; -static const upb_msglayout_field envoy_api_v2_Cluster_CommonLbConfig__fields[5] = { +static const upb_msglayout_field envoy_api_v2_Cluster_CommonLbConfig__fields[6] = { {1, UPB_SIZE(4, 8), 0, 2, 11, 1}, {2, UPB_SIZE(12, 24), UPB_SIZE(-17, -33), 1, 11, 1}, {3, UPB_SIZE(12, 24), UPB_SIZE(-17, -33), 0, 11, 1}, {4, UPB_SIZE(8, 16), 0, 3, 11, 1}, {5, UPB_SIZE(0, 0), 0, 0, 8, 1}, + {6, UPB_SIZE(1, 1), 0, 0, 8, 1}, }; const upb_msglayout envoy_api_v2_Cluster_CommonLbConfig_msginit = { &envoy_api_v2_Cluster_CommonLbConfig_submsgs[0], &envoy_api_v2_Cluster_CommonLbConfig__fields[0], - UPB_SIZE(20, 40), 5, false, + UPB_SIZE(20, 40), 6, false, }; static const upb_msglayout *const envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_submsgs[2] = { diff --git a/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h b/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h index 2fecf727bcb..5bc331902ee 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h @@ -68,6 +68,7 @@ extern const upb_msglayout envoy_api_v2_UpstreamConnectionOptions_msginit; struct envoy_api_v2_ClusterLoadAssignment; struct envoy_api_v2_auth_UpstreamTlsContext; struct envoy_api_v2_cluster_CircuitBreakers; +struct envoy_api_v2_cluster_Filter; struct envoy_api_v2_cluster_OutlierDetection; struct envoy_api_v2_core_Address; struct envoy_api_v2_core_BindConfig; @@ -88,6 +89,7 @@ struct google_protobuf_UInt64Value; extern const upb_msglayout envoy_api_v2_ClusterLoadAssignment_msginit; extern const upb_msglayout envoy_api_v2_auth_UpstreamTlsContext_msginit; extern const upb_msglayout envoy_api_v2_cluster_CircuitBreakers_msginit; +extern const upb_msglayout envoy_api_v2_cluster_Filter_msginit; extern const upb_msglayout envoy_api_v2_cluster_OutlierDetection_msginit; extern const upb_msglayout envoy_api_v2_core_Address_msginit; extern const upb_msglayout envoy_api_v2_core_BindConfig_msginit; @@ -141,6 +143,13 @@ typedef enum { envoy_api_v2_Cluster_LbSubsetConfig_DEFAULT_SUBSET = 2 } envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetFallbackPolicy; +typedef enum { + envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_NOT_DEFINED = 0, + envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_NO_FALLBACK = 1, + envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_ANY_ENDPOINT = 2, + envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_DEFAULT_SUBSET = 3 +} envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy; + typedef enum { envoy_api_v2_Cluster_RingHashLbConfig_XX_HASH = 0, envoy_api_v2_Cluster_RingHashLbConfig_MURMUR_HASH_2 = 1 @@ -166,7 +175,7 @@ typedef enum { envoy_api_v2_Cluster_cluster_discovery_type_cluster_type = 38, envoy_api_v2_Cluster_cluster_discovery_type_NOT_SET = 0 } envoy_api_v2_Cluster_cluster_discovery_type_oneofcases; -UPB_INLINE envoy_api_v2_Cluster_cluster_discovery_type_oneofcases envoy_api_v2_Cluster_cluster_discovery_type_case(const envoy_api_v2_Cluster* msg) { return (envoy_api_v2_Cluster_cluster_discovery_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(152, 264)); } +UPB_INLINE envoy_api_v2_Cluster_cluster_discovery_type_oneofcases envoy_api_v2_Cluster_cluster_discovery_type_case(const envoy_api_v2_Cluster* msg) { return (envoy_api_v2_Cluster_cluster_discovery_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(152, 272)); } typedef enum { envoy_api_v2_Cluster_lb_config_ring_hash_lb_config = 23, @@ -174,11 +183,11 @@ typedef enum { envoy_api_v2_Cluster_lb_config_least_request_lb_config = 37, envoy_api_v2_Cluster_lb_config_NOT_SET = 0 } envoy_api_v2_Cluster_lb_config_oneofcases; -UPB_INLINE envoy_api_v2_Cluster_lb_config_oneofcases envoy_api_v2_Cluster_lb_config_case(const envoy_api_v2_Cluster* msg) { return (envoy_api_v2_Cluster_lb_config_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(160, 280)); } +UPB_INLINE envoy_api_v2_Cluster_lb_config_oneofcases envoy_api_v2_Cluster_lb_config_case(const envoy_api_v2_Cluster* msg) { return (envoy_api_v2_Cluster_lb_config_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(160, 288)); } UPB_INLINE upb_strview envoy_api_v2_Cluster_name(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)); } -UPB_INLINE bool envoy_api_v2_Cluster_has_type(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(152, 264), 2); } -UPB_INLINE int32_t envoy_api_v2_Cluster_type(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, int32_t, UPB_SIZE(144, 256), UPB_SIZE(152, 264), 2, envoy_api_v2_Cluster_STATIC); } +UPB_INLINE bool envoy_api_v2_Cluster_has_type(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(152, 272), 2); } +UPB_INLINE int32_t envoy_api_v2_Cluster_type(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, int32_t, UPB_SIZE(144, 264), UPB_SIZE(152, 272), 2, envoy_api_v2_Cluster_STATIC); } UPB_INLINE const envoy_api_v2_Cluster_EdsClusterConfig* envoy_api_v2_Cluster_eds_cluster_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_EdsClusterConfig*, UPB_SIZE(44, 64)); } UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_connect_timeout(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(48, 72)); } UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_per_connection_buffer_limit_bytes(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(52, 80)); } @@ -197,8 +206,8 @@ UPB_INLINE const struct envoy_api_v2_cluster_OutlierDetection* envoy_api_v2_Clus UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_cleanup_interval(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(84, 144)); } UPB_INLINE const struct envoy_api_v2_core_BindConfig* envoy_api_v2_Cluster_upstream_bind_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_BindConfig*, UPB_SIZE(88, 152)); } UPB_INLINE const envoy_api_v2_Cluster_LbSubsetConfig* envoy_api_v2_Cluster_lb_subset_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_LbSubsetConfig*, UPB_SIZE(92, 160)); } -UPB_INLINE bool envoy_api_v2_Cluster_has_ring_hash_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(160, 280), 23); } -UPB_INLINE const envoy_api_v2_Cluster_RingHashLbConfig* envoy_api_v2_Cluster_ring_hash_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_RingHashLbConfig*, UPB_SIZE(156, 272), UPB_SIZE(160, 280), 23, NULL); } +UPB_INLINE bool envoy_api_v2_Cluster_has_ring_hash_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(160, 288), 23); } +UPB_INLINE const envoy_api_v2_Cluster_RingHashLbConfig* envoy_api_v2_Cluster_ring_hash_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_RingHashLbConfig*, UPB_SIZE(156, 280), UPB_SIZE(160, 288), 23, NULL); } UPB_INLINE const struct envoy_api_v2_core_TransportSocket* envoy_api_v2_Cluster_transport_socket(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_TransportSocket*, UPB_SIZE(96, 168)); } UPB_INLINE const struct envoy_api_v2_core_Metadata* envoy_api_v2_Cluster_metadata(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Metadata*, UPB_SIZE(100, 176)); } UPB_INLINE int32_t envoy_api_v2_Cluster_protocol_selection(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)); } @@ -209,20 +218,22 @@ UPB_INLINE const envoy_api_v2_UpstreamConnectionOptions* envoy_api_v2_Cluster_up UPB_INLINE bool envoy_api_v2_Cluster_close_connections_on_host_health_failure(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)); } UPB_INLINE bool envoy_api_v2_Cluster_drain_connections_on_host_removal(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(25, 25)); } UPB_INLINE const struct envoy_api_v2_ClusterLoadAssignment* envoy_api_v2_Cluster_load_assignment(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_ClusterLoadAssignment*, UPB_SIZE(116, 208)); } -UPB_INLINE bool envoy_api_v2_Cluster_has_original_dst_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(160, 280), 34); } -UPB_INLINE const envoy_api_v2_Cluster_OriginalDstLbConfig* envoy_api_v2_Cluster_original_dst_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_OriginalDstLbConfig*, UPB_SIZE(156, 272), UPB_SIZE(160, 280), 34, NULL); } +UPB_INLINE bool envoy_api_v2_Cluster_has_original_dst_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(160, 288), 34); } +UPB_INLINE const envoy_api_v2_Cluster_OriginalDstLbConfig* envoy_api_v2_Cluster_original_dst_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_OriginalDstLbConfig*, UPB_SIZE(156, 280), UPB_SIZE(160, 288), 34, NULL); } UPB_INLINE const envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* const* envoy_api_v2_Cluster_extension_protocol_options(const envoy_api_v2_Cluster *msg, size_t *len) { return (const envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(132, 240), len); } UPB_INLINE const envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* const* envoy_api_v2_Cluster_typed_extension_protocol_options(const envoy_api_v2_Cluster *msg, size_t *len) { return (const envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(136, 248), len); } -UPB_INLINE bool envoy_api_v2_Cluster_has_least_request_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(160, 280), 37); } -UPB_INLINE const envoy_api_v2_Cluster_LeastRequestLbConfig* envoy_api_v2_Cluster_least_request_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_LeastRequestLbConfig*, UPB_SIZE(156, 272), UPB_SIZE(160, 280), 37, NULL); } -UPB_INLINE bool envoy_api_v2_Cluster_has_cluster_type(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(152, 264), 38); } -UPB_INLINE const envoy_api_v2_Cluster_CustomClusterType* envoy_api_v2_Cluster_cluster_type(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_CustomClusterType*, UPB_SIZE(144, 256), UPB_SIZE(152, 264), 38, NULL); } +UPB_INLINE bool envoy_api_v2_Cluster_has_least_request_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(160, 288), 37); } +UPB_INLINE const envoy_api_v2_Cluster_LeastRequestLbConfig* envoy_api_v2_Cluster_least_request_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_LeastRequestLbConfig*, UPB_SIZE(156, 280), UPB_SIZE(160, 288), 37, NULL); } +UPB_INLINE bool envoy_api_v2_Cluster_has_cluster_type(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(152, 272), 38); } +UPB_INLINE const envoy_api_v2_Cluster_CustomClusterType* envoy_api_v2_Cluster_cluster_type(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_CustomClusterType*, UPB_SIZE(144, 264), UPB_SIZE(152, 272), 38, NULL); } +UPB_INLINE bool envoy_api_v2_Cluster_respect_dns_ttl(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(26, 26)); } +UPB_INLINE const struct envoy_api_v2_cluster_Filter* const* envoy_api_v2_Cluster_filters(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_cluster_Filter* const*)_upb_array_accessor(msg, UPB_SIZE(140, 256), len); } UPB_INLINE void envoy_api_v2_Cluster_set_name(envoy_api_v2_Cluster *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)) = value; } UPB_INLINE void envoy_api_v2_Cluster_set_type(envoy_api_v2_Cluster *msg, int32_t value) { - UPB_WRITE_ONEOF(msg, int32_t, UPB_SIZE(144, 256), value, UPB_SIZE(152, 264), 2); + UPB_WRITE_ONEOF(msg, int32_t, UPB_SIZE(144, 264), value, UPB_SIZE(152, 272), 2); } UPB_INLINE void envoy_api_v2_Cluster_set_eds_cluster_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_EdsClusterConfig* value) { UPB_FIELD_AT(msg, envoy_api_v2_Cluster_EdsClusterConfig*, UPB_SIZE(44, 64)) = value; @@ -426,7 +437,7 @@ UPB_INLINE struct envoy_api_v2_Cluster_LbSubsetConfig* envoy_api_v2_Cluster_muta return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_ring_hash_lb_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_RingHashLbConfig* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_RingHashLbConfig*, UPB_SIZE(156, 272), value, UPB_SIZE(160, 280), 23); + UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_RingHashLbConfig*, UPB_SIZE(156, 280), value, UPB_SIZE(160, 288), 23); } UPB_INLINE struct envoy_api_v2_Cluster_RingHashLbConfig* envoy_api_v2_Cluster_mutable_ring_hash_lb_config(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_Cluster_RingHashLbConfig* sub = (struct envoy_api_v2_Cluster_RingHashLbConfig*)envoy_api_v2_Cluster_ring_hash_lb_config(msg); @@ -522,7 +533,7 @@ UPB_INLINE struct envoy_api_v2_ClusterLoadAssignment* envoy_api_v2_Cluster_mutab return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_original_dst_lb_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_OriginalDstLbConfig* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_OriginalDstLbConfig*, UPB_SIZE(156, 272), value, UPB_SIZE(160, 280), 34); + UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_OriginalDstLbConfig*, UPB_SIZE(156, 280), value, UPB_SIZE(160, 288), 34); } UPB_INLINE struct envoy_api_v2_Cluster_OriginalDstLbConfig* envoy_api_v2_Cluster_mutable_original_dst_lb_config(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_Cluster_OriginalDstLbConfig* sub = (struct envoy_api_v2_Cluster_OriginalDstLbConfig*)envoy_api_v2_Cluster_original_dst_lb_config(msg); @@ -560,7 +571,7 @@ UPB_INLINE struct envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* envoy return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_least_request_lb_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_LeastRequestLbConfig* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_LeastRequestLbConfig*, UPB_SIZE(156, 272), value, UPB_SIZE(160, 280), 37); + UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_LeastRequestLbConfig*, UPB_SIZE(156, 280), value, UPB_SIZE(160, 288), 37); } UPB_INLINE struct envoy_api_v2_Cluster_LeastRequestLbConfig* envoy_api_v2_Cluster_mutable_least_request_lb_config(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_Cluster_LeastRequestLbConfig* sub = (struct envoy_api_v2_Cluster_LeastRequestLbConfig*)envoy_api_v2_Cluster_least_request_lb_config(msg); @@ -572,7 +583,7 @@ UPB_INLINE struct envoy_api_v2_Cluster_LeastRequestLbConfig* envoy_api_v2_Cluste return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_cluster_type(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_CustomClusterType* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_CustomClusterType*, UPB_SIZE(144, 256), value, UPB_SIZE(152, 264), 38); + UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_CustomClusterType*, UPB_SIZE(144, 264), value, UPB_SIZE(152, 272), 38); } UPB_INLINE struct envoy_api_v2_Cluster_CustomClusterType* envoy_api_v2_Cluster_mutable_cluster_type(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_Cluster_CustomClusterType* sub = (struct envoy_api_v2_Cluster_CustomClusterType*)envoy_api_v2_Cluster_cluster_type(msg); @@ -583,6 +594,22 @@ UPB_INLINE struct envoy_api_v2_Cluster_CustomClusterType* envoy_api_v2_Cluster_m } return sub; } +UPB_INLINE void envoy_api_v2_Cluster_set_respect_dns_ttl(envoy_api_v2_Cluster *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(26, 26)) = value; +} +UPB_INLINE struct envoy_api_v2_cluster_Filter** envoy_api_v2_Cluster_mutable_filters(envoy_api_v2_Cluster *msg, size_t *len) { + return (struct envoy_api_v2_cluster_Filter**)_upb_array_mutable_accessor(msg, UPB_SIZE(140, 256), len); +} +UPB_INLINE struct envoy_api_v2_cluster_Filter** envoy_api_v2_Cluster_resize_filters(envoy_api_v2_Cluster *msg, size_t len, upb_arena *arena) { + return (struct envoy_api_v2_cluster_Filter**)_upb_array_resize_accessor(msg, UPB_SIZE(140, 256), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct envoy_api_v2_cluster_Filter* envoy_api_v2_Cluster_add_filters(envoy_api_v2_Cluster *msg, upb_arena *arena) { + struct envoy_api_v2_cluster_Filter* sub = (struct envoy_api_v2_cluster_Filter*)upb_msg_new(&envoy_api_v2_cluster_Filter_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(140, 256), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} /* envoy.api.v2.Cluster.CustomClusterType */ @@ -736,6 +763,7 @@ UPB_INLINE const envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector* const* en UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_locality_weight_aware(const envoy_api_v2_Cluster_LbSubsetConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)); } UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_scale_locality_weight(const envoy_api_v2_Cluster_LbSubsetConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(9, 9)); } UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_panic_mode_any(const envoy_api_v2_Cluster_LbSubsetConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(10, 10)); } +UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_list_as_any(const envoy_api_v2_Cluster_LbSubsetConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(11, 11)); } UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_set_fallback_policy(envoy_api_v2_Cluster_LbSubsetConfig *msg, int32_t value) { UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; @@ -774,6 +802,9 @@ UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_set_scale_locality_weight(en UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_set_panic_mode_any(envoy_api_v2_Cluster_LbSubsetConfig *msg, bool value) { UPB_FIELD_AT(msg, bool, UPB_SIZE(10, 10)) = value; } +UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_set_list_as_any(envoy_api_v2_Cluster_LbSubsetConfig *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(11, 11)) = value; +} /* envoy.api.v2.Cluster.LbSubsetConfig.LbSubsetSelector */ @@ -789,17 +820,21 @@ UPB_INLINE char *envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_serialize( return upb_encode(msg, &envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit, arena, len); } -UPB_INLINE upb_strview const* envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_keys(const envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } +UPB_INLINE upb_strview const* envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_keys(const envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(8, 8), len); } +UPB_INLINE int32_t envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_fallback_policy(const envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } UPB_INLINE upb_strview* envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_mutable_keys(envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, size_t *len) { - return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); + return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 8), len); } UPB_INLINE upb_strview* envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_resize_keys(envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, size_t len, upb_arena *arena) { - return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(8, 8), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); } UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_add_keys(envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, upb_strview val, upb_arena *arena) { return _upb_array_append_accessor( - msg, UPB_SIZE(0, 0), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); + msg, UPB_SIZE(8, 8), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); +} +UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_set_fallback_policy(envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, int32_t value) { + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; } /* envoy.api.v2.Cluster.LeastRequestLbConfig */ @@ -925,6 +960,7 @@ UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_has_locality_weighted_lb_con UPB_INLINE const envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig* envoy_api_v2_Cluster_CommonLbConfig_locality_weighted_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig*, UPB_SIZE(12, 24), UPB_SIZE(16, 32), 3, NULL); } UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_CommonLbConfig_update_merge_window(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(8, 16)); } UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_ignore_new_hosts_until_first_hc(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); } +UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_close_connections_on_host_set_change(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_healthy_panic_threshold(envoy_api_v2_Cluster_CommonLbConfig *msg, struct envoy_type_Percent* value) { UPB_FIELD_AT(msg, struct envoy_type_Percent*, UPB_SIZE(4, 8)) = value; @@ -977,6 +1013,9 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_CommonLbConfig_ UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_ignore_new_hosts_until_first_hc(envoy_api_v2_Cluster_CommonLbConfig *msg, bool value) { UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value; } +UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_close_connections_on_host_set_change(envoy_api_v2_Cluster_CommonLbConfig *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; +} /* envoy.api.v2.Cluster.CommonLbConfig.ZoneAwareLbConfig */ diff --git a/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c b/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c new file mode 100644 index 00000000000..7cd040e39cc --- /dev/null +++ b/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c @@ -0,0 +1,34 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * envoy/api/v2/cluster/filter.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#include +#include "upb/msg.h" +#include "envoy/api/v2/cluster/filter.upb.h" +#include "google/protobuf/any.upb.h" +#include "validate/validate.upb.h" +#include "gogoproto/gogo.upb.h" + +#include "upb/port_def.inc" + +static const upb_msglayout *const envoy_api_v2_cluster_Filter_submsgs[1] = { + &google_protobuf_Any_msginit, +}; + +static const upb_msglayout_field envoy_api_v2_cluster_Filter__fields[2] = { + {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, + {2, UPB_SIZE(8, 16), 0, 0, 11, 1}, +}; + +const upb_msglayout envoy_api_v2_cluster_Filter_msginit = { + &envoy_api_v2_cluster_Filter_submsgs[0], + &envoy_api_v2_cluster_Filter__fields[0], + UPB_SIZE(16, 32), 2, false, +}; + +#include "upb/port_undef.inc" + diff --git a/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h b/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h new file mode 100644 index 00000000000..bd8746cc428 --- /dev/null +++ b/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h @@ -0,0 +1,69 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * envoy/api/v2/cluster/filter.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#ifndef ENVOY_API_V2_CLUSTER_FILTER_PROTO_UPB_H_ +#define ENVOY_API_V2_CLUSTER_FILTER_PROTO_UPB_H_ + +#include "upb/generated_util.h" +#include "upb/msg.h" +#include "upb/decode.h" +#include "upb/encode.h" + +#include "upb/port_def.inc" + +#ifdef __cplusplus +extern "C" { +#endif + +struct envoy_api_v2_cluster_Filter; +typedef struct envoy_api_v2_cluster_Filter envoy_api_v2_cluster_Filter; +extern const upb_msglayout envoy_api_v2_cluster_Filter_msginit; +struct google_protobuf_Any; +extern const upb_msglayout google_protobuf_Any_msginit; + + +/* envoy.api.v2.cluster.Filter */ + +UPB_INLINE envoy_api_v2_cluster_Filter *envoy_api_v2_cluster_Filter_new(upb_arena *arena) { + return (envoy_api_v2_cluster_Filter *)upb_msg_new(&envoy_api_v2_cluster_Filter_msginit, arena); +} +UPB_INLINE envoy_api_v2_cluster_Filter *envoy_api_v2_cluster_Filter_parse(const char *buf, size_t size, + upb_arena *arena) { + envoy_api_v2_cluster_Filter *ret = envoy_api_v2_cluster_Filter_new(arena); + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_cluster_Filter_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *envoy_api_v2_cluster_Filter_serialize(const envoy_api_v2_cluster_Filter *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &envoy_api_v2_cluster_Filter_msginit, arena, len); +} + +UPB_INLINE upb_strview envoy_api_v2_cluster_Filter_name(const envoy_api_v2_cluster_Filter *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } +UPB_INLINE const struct google_protobuf_Any* envoy_api_v2_cluster_Filter_typed_config(const envoy_api_v2_cluster_Filter *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Any*, UPB_SIZE(8, 16)); } + +UPB_INLINE void envoy_api_v2_cluster_Filter_set_name(envoy_api_v2_cluster_Filter *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void envoy_api_v2_cluster_Filter_set_typed_config(envoy_api_v2_cluster_Filter *msg, struct google_protobuf_Any* value) { + UPB_FIELD_AT(msg, struct google_protobuf_Any*, UPB_SIZE(8, 16)) = value; +} +UPB_INLINE struct google_protobuf_Any* envoy_api_v2_cluster_Filter_mutable_typed_config(envoy_api_v2_cluster_Filter *msg, upb_arena *arena) { + struct google_protobuf_Any* sub = (struct google_protobuf_Any*)envoy_api_v2_cluster_Filter_typed_config(msg); + if (sub == NULL) { + sub = (struct google_protobuf_Any*)upb_msg_new(&google_protobuf_Any_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_cluster_Filter_set_typed_config(msg, sub); + } + return sub; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include "upb/port_undef.inc" + +#endif /* ENVOY_API_V2_CLUSTER_FILTER_PROTO_UPB_H_ */ diff --git a/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c b/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c index 7158a8b8809..cc3a226529f 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c @@ -16,29 +16,33 @@ #include "upb/port_def.inc" -static const upb_msglayout *const envoy_api_v2_cluster_OutlierDetection_submsgs[11] = { +static const upb_msglayout *const envoy_api_v2_cluster_OutlierDetection_submsgs[14] = { &google_protobuf_Duration_msginit, &google_protobuf_UInt32Value_msginit, }; -static const upb_msglayout_field envoy_api_v2_cluster_OutlierDetection__fields[11] = { - {1, UPB_SIZE(0, 0), 0, 1, 11, 1}, - {2, UPB_SIZE(4, 8), 0, 0, 11, 1}, - {3, UPB_SIZE(8, 16), 0, 0, 11, 1}, - {4, UPB_SIZE(12, 24), 0, 1, 11, 1}, - {5, UPB_SIZE(16, 32), 0, 1, 11, 1}, - {6, UPB_SIZE(20, 40), 0, 1, 11, 1}, - {7, UPB_SIZE(24, 48), 0, 1, 11, 1}, - {8, UPB_SIZE(28, 56), 0, 1, 11, 1}, - {9, UPB_SIZE(32, 64), 0, 1, 11, 1}, - {10, UPB_SIZE(36, 72), 0, 1, 11, 1}, - {11, UPB_SIZE(40, 80), 0, 1, 11, 1}, +static const upb_msglayout_field envoy_api_v2_cluster_OutlierDetection__fields[15] = { + {1, UPB_SIZE(4, 8), 0, 1, 11, 1}, + {2, UPB_SIZE(8, 16), 0, 0, 11, 1}, + {3, UPB_SIZE(12, 24), 0, 0, 11, 1}, + {4, UPB_SIZE(16, 32), 0, 1, 11, 1}, + {5, UPB_SIZE(20, 40), 0, 1, 11, 1}, + {6, UPB_SIZE(24, 48), 0, 1, 11, 1}, + {7, UPB_SIZE(28, 56), 0, 1, 11, 1}, + {8, UPB_SIZE(32, 64), 0, 1, 11, 1}, + {9, UPB_SIZE(36, 72), 0, 1, 11, 1}, + {10, UPB_SIZE(40, 80), 0, 1, 11, 1}, + {11, UPB_SIZE(44, 88), 0, 1, 11, 1}, + {12, UPB_SIZE(0, 0), 0, 0, 8, 1}, + {13, UPB_SIZE(48, 96), 0, 1, 11, 1}, + {14, UPB_SIZE(52, 104), 0, 1, 11, 1}, + {15, UPB_SIZE(56, 112), 0, 1, 11, 1}, }; const upb_msglayout envoy_api_v2_cluster_OutlierDetection_msginit = { &envoy_api_v2_cluster_OutlierDetection_submsgs[0], &envoy_api_v2_cluster_OutlierDetection__fields[0], - UPB_SIZE(44, 88), 11, false, + UPB_SIZE(60, 120), 15, false, }; #include "upb/port_undef.inc" diff --git a/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h b/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h index cb290de1c0e..ef5592b53fd 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h @@ -43,20 +43,24 @@ UPB_INLINE char *envoy_api_v2_cluster_OutlierDetection_serialize(const envoy_api return upb_encode(msg, &envoy_api_v2_cluster_OutlierDetection_msginit, arena, len); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_consecutive_5xx(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(0, 0)); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetection_interval(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(4, 8)); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetection_base_ejection_time(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(8, 16)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_max_ejection_percent(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(12, 24)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_5xx(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_success_rate(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(20, 40)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_success_rate_minimum_hosts(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_success_rate_request_volume(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_success_rate_stdev_factor(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_consecutive_gateway_failure(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(36, 72)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_gateway_failure(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(40, 80)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_consecutive_5xx(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(4, 8)); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetection_interval(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(8, 16)); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetection_base_ejection_time(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(12, 24)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_max_ejection_percent(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_5xx(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(20, 40)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_success_rate(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_success_rate_minimum_hosts(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_success_rate_request_volume(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_success_rate_stdev_factor(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(36, 72)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_consecutive_gateway_failure(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(40, 80)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_gateway_failure(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(44, 88)); } +UPB_INLINE bool envoy_api_v2_cluster_OutlierDetection_split_external_local_origin_errors(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_consecutive_local_origin_failure(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(48, 96)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_local_origin_failure(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(52, 104)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_local_origin_success_rate(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(56, 112)); } UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_consecutive_5xx(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(0, 0)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(4, 8)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_consecutive_5xx(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_consecutive_5xx(msg); @@ -68,7 +72,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec return sub; } UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_interval(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(4, 8)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(8, 16)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetection_mutable_interval(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_cluster_OutlierDetection_interval(msg); @@ -80,7 +84,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetectio return sub; } UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_base_ejection_time(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(8, 16)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(12, 24)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetection_mutable_base_ejection_time(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_cluster_OutlierDetection_base_ejection_time(msg); @@ -92,7 +96,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetectio return sub; } UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_max_ejection_percent(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(12, 24)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_max_ejection_percent(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_max_ejection_percent(msg); @@ -104,7 +108,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec return sub; } UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_enforcing_consecutive_5xx(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(20, 40)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_enforcing_consecutive_5xx(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_5xx(msg); @@ -116,7 +120,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec return sub; } UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_enforcing_success_rate(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(20, 40)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_enforcing_success_rate(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_enforcing_success_rate(msg); @@ -128,7 +132,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec return sub; } UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_success_rate_minimum_hosts(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_success_rate_minimum_hosts(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_success_rate_minimum_hosts(msg); @@ -140,7 +144,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec return sub; } UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_success_rate_request_volume(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_success_rate_request_volume(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_success_rate_request_volume(msg); @@ -152,7 +156,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec return sub; } UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_success_rate_stdev_factor(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(36, 72)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_success_rate_stdev_factor(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_success_rate_stdev_factor(msg); @@ -164,7 +168,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec return sub; } UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_consecutive_gateway_failure(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(36, 72)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(40, 80)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_consecutive_gateway_failure(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_consecutive_gateway_failure(msg); @@ -176,7 +180,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec return sub; } UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_enforcing_consecutive_gateway_failure(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(40, 80)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(44, 88)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_enforcing_consecutive_gateway_failure(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_gateway_failure(msg); @@ -187,6 +191,45 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec } return sub; } +UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_split_external_local_origin_errors(envoy_api_v2_cluster_OutlierDetection *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_consecutive_local_origin_failure(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) { + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(48, 96)) = value; +} +UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_consecutive_local_origin_failure(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { + struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_consecutive_local_origin_failure(msg); + if (sub == NULL) { + sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_cluster_OutlierDetection_set_consecutive_local_origin_failure(msg, sub); + } + return sub; +} +UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_enforcing_consecutive_local_origin_failure(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) { + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(52, 104)) = value; +} +UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_enforcing_consecutive_local_origin_failure(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { + struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_local_origin_failure(msg); + if (sub == NULL) { + sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_cluster_OutlierDetection_set_enforcing_consecutive_local_origin_failure(msg, sub); + } + return sub; +} +UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_enforcing_local_origin_success_rate(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) { + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(56, 112)) = value; +} +UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_enforcing_local_origin_success_rate(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) { + struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_enforcing_local_origin_success_rate(msg); + if (sub == NULL) { + sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_cluster_OutlierDetection_set_enforcing_local_origin_success_rate(msg, sub); + } + return sub; +} #ifdef __cplusplus } /* extern "C" */ diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c b/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c index 725b17d7e31..9ecfe106a87 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c @@ -9,6 +9,7 @@ #include #include "upb/msg.h" #include "envoy/api/v2/core/base.upb.h" +#include "envoy/api/v2/core/http_uri.upb.h" #include "google/protobuf/any.upb.h" #include "google/protobuf/struct.upb.h" #include "google/protobuf/wrappers.upb.h" @@ -142,6 +143,37 @@ const upb_msglayout envoy_api_v2_core_DataSource_msginit = { UPB_SIZE(16, 32), 3, false, }; +static const upb_msglayout *const envoy_api_v2_core_RemoteDataSource_submsgs[1] = { + &envoy_api_v2_core_HttpUri_msginit, +}; + +static const upb_msglayout_field envoy_api_v2_core_RemoteDataSource__fields[2] = { + {1, UPB_SIZE(8, 16), 0, 0, 11, 1}, + {2, UPB_SIZE(0, 0), 0, 0, 9, 1}, +}; + +const upb_msglayout envoy_api_v2_core_RemoteDataSource_msginit = { + &envoy_api_v2_core_RemoteDataSource_submsgs[0], + &envoy_api_v2_core_RemoteDataSource__fields[0], + UPB_SIZE(16, 32), 2, false, +}; + +static const upb_msglayout *const envoy_api_v2_core_AsyncDataSource_submsgs[2] = { + &envoy_api_v2_core_DataSource_msginit, + &envoy_api_v2_core_RemoteDataSource_msginit, +}; + +static const upb_msglayout_field envoy_api_v2_core_AsyncDataSource__fields[2] = { + {1, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 0, 11, 1}, + {2, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 1, 11, 1}, +}; + +const upb_msglayout envoy_api_v2_core_AsyncDataSource_msginit = { + &envoy_api_v2_core_AsyncDataSource_submsgs[0], + &envoy_api_v2_core_AsyncDataSource__fields[0], + UPB_SIZE(8, 16), 2, false, +}; + static const upb_msglayout *const envoy_api_v2_core_TransportSocket_submsgs[2] = { &google_protobuf_Any_msginit, &google_protobuf_Struct_msginit, diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h b/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h index 58e6e5e3f7b..d4c14b1511f 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h @@ -29,6 +29,8 @@ struct envoy_api_v2_core_HeaderValue; struct envoy_api_v2_core_HeaderValueOption; struct envoy_api_v2_core_HeaderMap; struct envoy_api_v2_core_DataSource; +struct envoy_api_v2_core_RemoteDataSource; +struct envoy_api_v2_core_AsyncDataSource; struct envoy_api_v2_core_TransportSocket; struct envoy_api_v2_core_SocketOption; struct envoy_api_v2_core_RuntimeFractionalPercent; @@ -42,6 +44,8 @@ typedef struct envoy_api_v2_core_HeaderValue envoy_api_v2_core_HeaderValue; typedef struct envoy_api_v2_core_HeaderValueOption envoy_api_v2_core_HeaderValueOption; typedef struct envoy_api_v2_core_HeaderMap envoy_api_v2_core_HeaderMap; typedef struct envoy_api_v2_core_DataSource envoy_api_v2_core_DataSource; +typedef struct envoy_api_v2_core_RemoteDataSource envoy_api_v2_core_RemoteDataSource; +typedef struct envoy_api_v2_core_AsyncDataSource envoy_api_v2_core_AsyncDataSource; typedef struct envoy_api_v2_core_TransportSocket envoy_api_v2_core_TransportSocket; typedef struct envoy_api_v2_core_SocketOption envoy_api_v2_core_SocketOption; typedef struct envoy_api_v2_core_RuntimeFractionalPercent envoy_api_v2_core_RuntimeFractionalPercent; @@ -55,14 +59,18 @@ extern const upb_msglayout envoy_api_v2_core_HeaderValue_msginit; extern const upb_msglayout envoy_api_v2_core_HeaderValueOption_msginit; extern const upb_msglayout envoy_api_v2_core_HeaderMap_msginit; extern const upb_msglayout envoy_api_v2_core_DataSource_msginit; +extern const upb_msglayout envoy_api_v2_core_RemoteDataSource_msginit; +extern const upb_msglayout envoy_api_v2_core_AsyncDataSource_msginit; extern const upb_msglayout envoy_api_v2_core_TransportSocket_msginit; extern const upb_msglayout envoy_api_v2_core_SocketOption_msginit; extern const upb_msglayout envoy_api_v2_core_RuntimeFractionalPercent_msginit; extern const upb_msglayout envoy_api_v2_core_ControlPlane_msginit; +struct envoy_api_v2_core_HttpUri; struct envoy_type_FractionalPercent; struct google_protobuf_Any; struct google_protobuf_BoolValue; struct google_protobuf_Struct; +extern const upb_msglayout envoy_api_v2_core_HttpUri_msginit; extern const upb_msglayout envoy_type_FractionalPercent_msginit; extern const upb_msglayout google_protobuf_Any_msginit; extern const upb_msglayout google_protobuf_BoolValue_msginit; @@ -92,6 +100,12 @@ typedef enum { envoy_api_v2_core_SocketOption_STATE_LISTENING = 2 } envoy_api_v2_core_SocketOption_SocketState; +typedef enum { + envoy_api_v2_core_UNSPECIFIED = 0, + envoy_api_v2_core_INBOUND = 1, + envoy_api_v2_core_OUTBOUND = 2 +} envoy_api_v2_core_TrafficDirection; + /* envoy.api.v2.core.Locality */ @@ -397,6 +411,90 @@ UPB_INLINE void envoy_api_v2_core_DataSource_set_inline_string(envoy_api_v2_core UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 3); } +/* envoy.api.v2.core.RemoteDataSource */ + +UPB_INLINE envoy_api_v2_core_RemoteDataSource *envoy_api_v2_core_RemoteDataSource_new(upb_arena *arena) { + return (envoy_api_v2_core_RemoteDataSource *)upb_msg_new(&envoy_api_v2_core_RemoteDataSource_msginit, arena); +} +UPB_INLINE envoy_api_v2_core_RemoteDataSource *envoy_api_v2_core_RemoteDataSource_parse(const char *buf, size_t size, + upb_arena *arena) { + envoy_api_v2_core_RemoteDataSource *ret = envoy_api_v2_core_RemoteDataSource_new(arena); + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_RemoteDataSource_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *envoy_api_v2_core_RemoteDataSource_serialize(const envoy_api_v2_core_RemoteDataSource *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &envoy_api_v2_core_RemoteDataSource_msginit, arena, len); +} + +UPB_INLINE const struct envoy_api_v2_core_HttpUri* envoy_api_v2_core_RemoteDataSource_http_uri(const envoy_api_v2_core_RemoteDataSource *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_HttpUri*, UPB_SIZE(8, 16)); } +UPB_INLINE upb_strview envoy_api_v2_core_RemoteDataSource_sha256(const envoy_api_v2_core_RemoteDataSource *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } + +UPB_INLINE void envoy_api_v2_core_RemoteDataSource_set_http_uri(envoy_api_v2_core_RemoteDataSource *msg, struct envoy_api_v2_core_HttpUri* value) { + UPB_FIELD_AT(msg, struct envoy_api_v2_core_HttpUri*, UPB_SIZE(8, 16)) = value; +} +UPB_INLINE struct envoy_api_v2_core_HttpUri* envoy_api_v2_core_RemoteDataSource_mutable_http_uri(envoy_api_v2_core_RemoteDataSource *msg, upb_arena *arena) { + struct envoy_api_v2_core_HttpUri* sub = (struct envoy_api_v2_core_HttpUri*)envoy_api_v2_core_RemoteDataSource_http_uri(msg); + if (sub == NULL) { + sub = (struct envoy_api_v2_core_HttpUri*)upb_msg_new(&envoy_api_v2_core_HttpUri_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_core_RemoteDataSource_set_http_uri(msg, sub); + } + return sub; +} +UPB_INLINE void envoy_api_v2_core_RemoteDataSource_set_sha256(envoy_api_v2_core_RemoteDataSource *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} + +/* envoy.api.v2.core.AsyncDataSource */ + +UPB_INLINE envoy_api_v2_core_AsyncDataSource *envoy_api_v2_core_AsyncDataSource_new(upb_arena *arena) { + return (envoy_api_v2_core_AsyncDataSource *)upb_msg_new(&envoy_api_v2_core_AsyncDataSource_msginit, arena); +} +UPB_INLINE envoy_api_v2_core_AsyncDataSource *envoy_api_v2_core_AsyncDataSource_parse(const char *buf, size_t size, + upb_arena *arena) { + envoy_api_v2_core_AsyncDataSource *ret = envoy_api_v2_core_AsyncDataSource_new(arena); + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_AsyncDataSource_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *envoy_api_v2_core_AsyncDataSource_serialize(const envoy_api_v2_core_AsyncDataSource *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &envoy_api_v2_core_AsyncDataSource_msginit, arena, len); +} + +typedef enum { + envoy_api_v2_core_AsyncDataSource_specifier_local = 1, + envoy_api_v2_core_AsyncDataSource_specifier_remote = 2, + envoy_api_v2_core_AsyncDataSource_specifier_NOT_SET = 0 +} envoy_api_v2_core_AsyncDataSource_specifier_oneofcases; +UPB_INLINE envoy_api_v2_core_AsyncDataSource_specifier_oneofcases envoy_api_v2_core_AsyncDataSource_specifier_case(const envoy_api_v2_core_AsyncDataSource* msg) { return (envoy_api_v2_core_AsyncDataSource_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); } + +UPB_INLINE bool envoy_api_v2_core_AsyncDataSource_has_local(const envoy_api_v2_core_AsyncDataSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); } +UPB_INLINE const envoy_api_v2_core_DataSource* envoy_api_v2_core_AsyncDataSource_local(const envoy_api_v2_core_AsyncDataSource *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_DataSource*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); } +UPB_INLINE bool envoy_api_v2_core_AsyncDataSource_has_remote(const envoy_api_v2_core_AsyncDataSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 2); } +UPB_INLINE const envoy_api_v2_core_RemoteDataSource* envoy_api_v2_core_AsyncDataSource_remote(const envoy_api_v2_core_AsyncDataSource *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_RemoteDataSource*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 2, NULL); } + +UPB_INLINE void envoy_api_v2_core_AsyncDataSource_set_local(envoy_api_v2_core_AsyncDataSource *msg, envoy_api_v2_core_DataSource* value) { + UPB_WRITE_ONEOF(msg, envoy_api_v2_core_DataSource*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 1); +} +UPB_INLINE struct envoy_api_v2_core_DataSource* envoy_api_v2_core_AsyncDataSource_mutable_local(envoy_api_v2_core_AsyncDataSource *msg, upb_arena *arena) { + struct envoy_api_v2_core_DataSource* sub = (struct envoy_api_v2_core_DataSource*)envoy_api_v2_core_AsyncDataSource_local(msg); + if (sub == NULL) { + sub = (struct envoy_api_v2_core_DataSource*)upb_msg_new(&envoy_api_v2_core_DataSource_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_core_AsyncDataSource_set_local(msg, sub); + } + return sub; +} +UPB_INLINE void envoy_api_v2_core_AsyncDataSource_set_remote(envoy_api_v2_core_AsyncDataSource *msg, envoy_api_v2_core_RemoteDataSource* value) { + UPB_WRITE_ONEOF(msg, envoy_api_v2_core_RemoteDataSource*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 2); +} +UPB_INLINE struct envoy_api_v2_core_RemoteDataSource* envoy_api_v2_core_AsyncDataSource_mutable_remote(envoy_api_v2_core_AsyncDataSource *msg, upb_arena *arena) { + struct envoy_api_v2_core_RemoteDataSource* sub = (struct envoy_api_v2_core_RemoteDataSource*)envoy_api_v2_core_AsyncDataSource_remote(msg); + if (sub == NULL) { + sub = (struct envoy_api_v2_core_RemoteDataSource*)upb_msg_new(&envoy_api_v2_core_RemoteDataSource_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_core_AsyncDataSource_set_remote(msg, sub); + } + return sub; +} + /* envoy.api.v2.core.TransportSocket */ UPB_INLINE envoy_api_v2_core_TransportSocket *envoy_api_v2_core_TransportSocket_new(upb_arena *arena) { diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c b/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c index 5fe2a189ce0..afe940435c6 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c @@ -23,19 +23,20 @@ static const upb_msglayout *const envoy_api_v2_core_ApiConfigSource_submsgs[4] = &google_protobuf_Duration_msginit, }; -static const upb_msglayout_field envoy_api_v2_core_ApiConfigSource__fields[6] = { +static const upb_msglayout_field envoy_api_v2_core_ApiConfigSource__fields[7] = { {1, UPB_SIZE(0, 0), 0, 0, 14, 1}, - {2, UPB_SIZE(20, 32), 0, 0, 9, 3}, - {3, UPB_SIZE(8, 8), 0, 2, 11, 1}, - {4, UPB_SIZE(24, 40), 0, 0, 11, 3}, - {5, UPB_SIZE(12, 16), 0, 2, 11, 1}, - {6, UPB_SIZE(16, 24), 0, 1, 11, 1}, + {2, UPB_SIZE(24, 40), 0, 0, 9, 3}, + {3, UPB_SIZE(12, 16), 0, 2, 11, 1}, + {4, UPB_SIZE(28, 48), 0, 0, 11, 3}, + {5, UPB_SIZE(16, 24), 0, 2, 11, 1}, + {6, UPB_SIZE(20, 32), 0, 1, 11, 1}, + {7, UPB_SIZE(8, 8), 0, 0, 8, 1}, }; const upb_msglayout envoy_api_v2_core_ApiConfigSource_msginit = { &envoy_api_v2_core_ApiConfigSource_submsgs[0], &envoy_api_v2_core_ApiConfigSource__fields[0], - UPB_SIZE(32, 48), 6, false, + UPB_SIZE(32, 56), 7, false, }; const upb_msglayout envoy_api_v2_core_AggregatedConfigSource_msginit = { diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h b/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h index 27f4779c17f..4c2e832e698 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h @@ -64,27 +64,28 @@ UPB_INLINE char *envoy_api_v2_core_ApiConfigSource_serialize(const envoy_api_v2_ } UPB_INLINE int32_t envoy_api_v2_core_ApiConfigSource_api_type(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } -UPB_INLINE upb_strview const* envoy_api_v2_core_ApiConfigSource_cluster_names(const envoy_api_v2_core_ApiConfigSource *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(20, 32), len); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_refresh_delay(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(8, 8)); } -UPB_INLINE const struct envoy_api_v2_core_GrpcService* const* envoy_api_v2_core_ApiConfigSource_grpc_services(const envoy_api_v2_core_ApiConfigSource *msg, size_t *len) { return (const struct envoy_api_v2_core_GrpcService* const*)_upb_array_accessor(msg, UPB_SIZE(24, 40), len); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_request_timeout(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(12, 16)); } -UPB_INLINE const envoy_api_v2_core_RateLimitSettings* envoy_api_v2_core_ApiConfigSource_rate_limit_settings(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_core_RateLimitSettings*, UPB_SIZE(16, 24)); } +UPB_INLINE upb_strview const* envoy_api_v2_core_ApiConfigSource_cluster_names(const envoy_api_v2_core_ApiConfigSource *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(24, 40), len); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_refresh_delay(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(12, 16)); } +UPB_INLINE const struct envoy_api_v2_core_GrpcService* const* envoy_api_v2_core_ApiConfigSource_grpc_services(const envoy_api_v2_core_ApiConfigSource *msg, size_t *len) { return (const struct envoy_api_v2_core_GrpcService* const*)_upb_array_accessor(msg, UPB_SIZE(28, 48), len); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_request_timeout(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(16, 24)); } +UPB_INLINE const envoy_api_v2_core_RateLimitSettings* envoy_api_v2_core_ApiConfigSource_rate_limit_settings(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_core_RateLimitSettings*, UPB_SIZE(20, 32)); } +UPB_INLINE bool envoy_api_v2_core_ApiConfigSource_set_node_on_first_message_only(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)); } UPB_INLINE void envoy_api_v2_core_ApiConfigSource_set_api_type(envoy_api_v2_core_ApiConfigSource *msg, int32_t value) { UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; } UPB_INLINE upb_strview* envoy_api_v2_core_ApiConfigSource_mutable_cluster_names(envoy_api_v2_core_ApiConfigSource *msg, size_t *len) { - return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 32), len); + return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 40), len); } UPB_INLINE upb_strview* envoy_api_v2_core_ApiConfigSource_resize_cluster_names(envoy_api_v2_core_ApiConfigSource *msg, size_t len, upb_arena *arena) { - return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 32), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 40), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); } UPB_INLINE bool envoy_api_v2_core_ApiConfigSource_add_cluster_names(envoy_api_v2_core_ApiConfigSource *msg, upb_strview val, upb_arena *arena) { return _upb_array_append_accessor( - msg, UPB_SIZE(20, 32), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); + msg, UPB_SIZE(24, 40), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); } UPB_INLINE void envoy_api_v2_core_ApiConfigSource_set_refresh_delay(envoy_api_v2_core_ApiConfigSource *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(8, 8)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(12, 16)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_mutable_refresh_delay(envoy_api_v2_core_ApiConfigSource *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_ApiConfigSource_refresh_delay(msg); @@ -96,20 +97,20 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_mu return sub; } UPB_INLINE struct envoy_api_v2_core_GrpcService** envoy_api_v2_core_ApiConfigSource_mutable_grpc_services(envoy_api_v2_core_ApiConfigSource *msg, size_t *len) { - return (struct envoy_api_v2_core_GrpcService**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 40), len); + return (struct envoy_api_v2_core_GrpcService**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 48), len); } UPB_INLINE struct envoy_api_v2_core_GrpcService** envoy_api_v2_core_ApiConfigSource_resize_grpc_services(envoy_api_v2_core_ApiConfigSource *msg, size_t len, upb_arena *arena) { - return (struct envoy_api_v2_core_GrpcService**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (struct envoy_api_v2_core_GrpcService**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_core_GrpcService* envoy_api_v2_core_ApiConfigSource_add_grpc_services(envoy_api_v2_core_ApiConfigSource *msg, upb_arena *arena) { struct envoy_api_v2_core_GrpcService* sub = (struct envoy_api_v2_core_GrpcService*)upb_msg_new(&envoy_api_v2_core_GrpcService_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(24, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(28, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } UPB_INLINE void envoy_api_v2_core_ApiConfigSource_set_request_timeout(envoy_api_v2_core_ApiConfigSource *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(12, 16)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(16, 24)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_mutable_request_timeout(envoy_api_v2_core_ApiConfigSource *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_ApiConfigSource_request_timeout(msg); @@ -121,7 +122,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_mu return sub; } UPB_INLINE void envoy_api_v2_core_ApiConfigSource_set_rate_limit_settings(envoy_api_v2_core_ApiConfigSource *msg, envoy_api_v2_core_RateLimitSettings* value) { - UPB_FIELD_AT(msg, envoy_api_v2_core_RateLimitSettings*, UPB_SIZE(16, 24)) = value; + UPB_FIELD_AT(msg, envoy_api_v2_core_RateLimitSettings*, UPB_SIZE(20, 32)) = value; } UPB_INLINE struct envoy_api_v2_core_RateLimitSettings* envoy_api_v2_core_ApiConfigSource_mutable_rate_limit_settings(envoy_api_v2_core_ApiConfigSource *msg, upb_arena *arena) { struct envoy_api_v2_core_RateLimitSettings* sub = (struct envoy_api_v2_core_RateLimitSettings*)envoy_api_v2_core_ApiConfigSource_rate_limit_settings(msg); @@ -132,6 +133,9 @@ UPB_INLINE struct envoy_api_v2_core_RateLimitSettings* envoy_api_v2_core_ApiConf } return sub; } +UPB_INLINE void envoy_api_v2_core_ApiConfigSource_set_set_node_on_first_message_only(envoy_api_v2_core_ApiConfigSource *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)) = value; +} /* envoy.api.v2.core.AggregatedConfigSource */ diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c b/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c new file mode 100644 index 00000000000..f7999c7cd0d --- /dev/null +++ b/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c @@ -0,0 +1,35 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * envoy/api/v2/core/http_uri.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#include +#include "upb/msg.h" +#include "envoy/api/v2/core/http_uri.upb.h" +#include "google/protobuf/duration.upb.h" +#include "gogoproto/gogo.upb.h" +#include "validate/validate.upb.h" + +#include "upb/port_def.inc" + +static const upb_msglayout *const envoy_api_v2_core_HttpUri_submsgs[1] = { + &google_protobuf_Duration_msginit, +}; + +static const upb_msglayout_field envoy_api_v2_core_HttpUri__fields[3] = { + {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, + {2, UPB_SIZE(12, 24), UPB_SIZE(-21, -41), 0, 9, 1}, + {3, UPB_SIZE(8, 16), 0, 0, 11, 1}, +}; + +const upb_msglayout envoy_api_v2_core_HttpUri_msginit = { + &envoy_api_v2_core_HttpUri_submsgs[0], + &envoy_api_v2_core_HttpUri__fields[0], + UPB_SIZE(24, 48), 3, false, +}; + +#include "upb/port_undef.inc" + diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h b/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h new file mode 100644 index 00000000000..f0dc22b7a20 --- /dev/null +++ b/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h @@ -0,0 +1,80 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * envoy/api/v2/core/http_uri.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#ifndef ENVOY_API_V2_CORE_HTTP_URI_PROTO_UPB_H_ +#define ENVOY_API_V2_CORE_HTTP_URI_PROTO_UPB_H_ + +#include "upb/generated_util.h" +#include "upb/msg.h" +#include "upb/decode.h" +#include "upb/encode.h" + +#include "upb/port_def.inc" + +#ifdef __cplusplus +extern "C" { +#endif + +struct envoy_api_v2_core_HttpUri; +typedef struct envoy_api_v2_core_HttpUri envoy_api_v2_core_HttpUri; +extern const upb_msglayout envoy_api_v2_core_HttpUri_msginit; +struct google_protobuf_Duration; +extern const upb_msglayout google_protobuf_Duration_msginit; + + +/* envoy.api.v2.core.HttpUri */ + +UPB_INLINE envoy_api_v2_core_HttpUri *envoy_api_v2_core_HttpUri_new(upb_arena *arena) { + return (envoy_api_v2_core_HttpUri *)upb_msg_new(&envoy_api_v2_core_HttpUri_msginit, arena); +} +UPB_INLINE envoy_api_v2_core_HttpUri *envoy_api_v2_core_HttpUri_parse(const char *buf, size_t size, + upb_arena *arena) { + envoy_api_v2_core_HttpUri *ret = envoy_api_v2_core_HttpUri_new(arena); + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HttpUri_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *envoy_api_v2_core_HttpUri_serialize(const envoy_api_v2_core_HttpUri *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &envoy_api_v2_core_HttpUri_msginit, arena, len); +} + +typedef enum { + envoy_api_v2_core_HttpUri_http_upstream_type_cluster = 2, + envoy_api_v2_core_HttpUri_http_upstream_type_NOT_SET = 0 +} envoy_api_v2_core_HttpUri_http_upstream_type_oneofcases; +UPB_INLINE envoy_api_v2_core_HttpUri_http_upstream_type_oneofcases envoy_api_v2_core_HttpUri_http_upstream_type_case(const envoy_api_v2_core_HttpUri* msg) { return (envoy_api_v2_core_HttpUri_http_upstream_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(20, 40)); } + +UPB_INLINE upb_strview envoy_api_v2_core_HttpUri_uri(const envoy_api_v2_core_HttpUri *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } +UPB_INLINE bool envoy_api_v2_core_HttpUri_has_cluster(const envoy_api_v2_core_HttpUri *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(20, 40), 2); } +UPB_INLINE upb_strview envoy_api_v2_core_HttpUri_cluster(const envoy_api_v2_core_HttpUri *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(12, 24), UPB_SIZE(20, 40), 2, upb_strview_make("", strlen(""))); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HttpUri_timeout(const envoy_api_v2_core_HttpUri *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(8, 16)); } + +UPB_INLINE void envoy_api_v2_core_HttpUri_set_uri(envoy_api_v2_core_HttpUri *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void envoy_api_v2_core_HttpUri_set_cluster(envoy_api_v2_core_HttpUri *msg, upb_strview value) { + UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(12, 24), value, UPB_SIZE(20, 40), 2); +} +UPB_INLINE void envoy_api_v2_core_HttpUri_set_timeout(envoy_api_v2_core_HttpUri *msg, struct google_protobuf_Duration* value) { + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(8, 16)) = value; +} +UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HttpUri_mutable_timeout(envoy_api_v2_core_HttpUri *msg, upb_arena *arena) { + struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HttpUri_timeout(msg); + if (sub == NULL) { + sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_core_HttpUri_set_timeout(msg, sub); + } + return sub; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include "upb/port_undef.inc" + +#endif /* ENVOY_API_V2_CORE_HTTP_URI_PROTO_UPB_H_ */ diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c b/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c index 896cfe25638..48878df6a69 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c @@ -52,23 +52,29 @@ const upb_msglayout envoy_api_v2_core_Http1ProtocolOptions_msginit = { UPB_SIZE(16, 32), 3, false, }; -static const upb_msglayout *const envoy_api_v2_core_Http2ProtocolOptions_submsgs[4] = { +static const upb_msglayout *const envoy_api_v2_core_Http2ProtocolOptions_submsgs[9] = { &google_protobuf_UInt32Value_msginit, }; -static const upb_msglayout_field envoy_api_v2_core_Http2ProtocolOptions__fields[6] = { +static const upb_msglayout_field envoy_api_v2_core_Http2ProtocolOptions__fields[12] = { {1, UPB_SIZE(4, 8), 0, 0, 11, 1}, {2, UPB_SIZE(8, 16), 0, 0, 11, 1}, {3, UPB_SIZE(12, 24), 0, 0, 11, 1}, {4, UPB_SIZE(16, 32), 0, 0, 11, 1}, {5, UPB_SIZE(0, 0), 0, 0, 8, 1}, {6, UPB_SIZE(1, 1), 0, 0, 8, 1}, + {7, UPB_SIZE(20, 40), 0, 0, 11, 1}, + {8, UPB_SIZE(24, 48), 0, 0, 11, 1}, + {9, UPB_SIZE(28, 56), 0, 0, 11, 1}, + {10, UPB_SIZE(32, 64), 0, 0, 11, 1}, + {11, UPB_SIZE(36, 72), 0, 0, 11, 1}, + {12, UPB_SIZE(2, 2), 0, 0, 8, 1}, }; const upb_msglayout envoy_api_v2_core_Http2ProtocolOptions_msginit = { &envoy_api_v2_core_Http2ProtocolOptions_submsgs[0], &envoy_api_v2_core_Http2ProtocolOptions__fields[0], - UPB_SIZE(20, 40), 6, false, + UPB_SIZE(40, 80), 12, false, }; static const upb_msglayout *const envoy_api_v2_core_GrpcProtocolOptions_submsgs[1] = { diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h b/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h index 039b221ef2a..a82cfc16f2f 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h @@ -145,6 +145,12 @@ UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2Prot UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_initial_connection_window_size(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)); } UPB_INLINE bool envoy_api_v2_core_Http2ProtocolOptions_allow_connect(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); } UPB_INLINE bool envoy_api_v2_core_Http2ProtocolOptions_allow_metadata(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_max_outbound_frames(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(20, 40)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_max_outbound_control_frames(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_max_consecutive_inbound_frames_with_empty_payload(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_max_inbound_priority_frames_per_stream(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_max_inbound_window_update_frames_per_data_frame_sent(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(36, 72)); } +UPB_INLINE bool envoy_api_v2_core_Http2ProtocolOptions_stream_error_on_invalid_http_messaging(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); } UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_hpack_table_size(envoy_api_v2_core_Http2ProtocolOptions *msg, struct google_protobuf_UInt32Value* value) { UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(4, 8)) = value; @@ -200,6 +206,69 @@ UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_allow_connect(envoy_a UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_allow_metadata(envoy_api_v2_core_Http2ProtocolOptions *msg, bool value) { UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; } +UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_max_outbound_frames(envoy_api_v2_core_Http2ProtocolOptions *msg, struct google_protobuf_UInt32Value* value) { + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(20, 40)) = value; +} +UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_mutable_max_outbound_frames(envoy_api_v2_core_Http2ProtocolOptions *msg, upb_arena *arena) { + struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_Http2ProtocolOptions_max_outbound_frames(msg); + if (sub == NULL) { + sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_core_Http2ProtocolOptions_set_max_outbound_frames(msg, sub); + } + return sub; +} +UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_max_outbound_control_frames(envoy_api_v2_core_Http2ProtocolOptions *msg, struct google_protobuf_UInt32Value* value) { + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)) = value; +} +UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_mutable_max_outbound_control_frames(envoy_api_v2_core_Http2ProtocolOptions *msg, upb_arena *arena) { + struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_Http2ProtocolOptions_max_outbound_control_frames(msg); + if (sub == NULL) { + sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_core_Http2ProtocolOptions_set_max_outbound_control_frames(msg, sub); + } + return sub; +} +UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_max_consecutive_inbound_frames_with_empty_payload(envoy_api_v2_core_Http2ProtocolOptions *msg, struct google_protobuf_UInt32Value* value) { + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)) = value; +} +UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_mutable_max_consecutive_inbound_frames_with_empty_payload(envoy_api_v2_core_Http2ProtocolOptions *msg, upb_arena *arena) { + struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_Http2ProtocolOptions_max_consecutive_inbound_frames_with_empty_payload(msg); + if (sub == NULL) { + sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_core_Http2ProtocolOptions_set_max_consecutive_inbound_frames_with_empty_payload(msg, sub); + } + return sub; +} +UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_max_inbound_priority_frames_per_stream(envoy_api_v2_core_Http2ProtocolOptions *msg, struct google_protobuf_UInt32Value* value) { + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)) = value; +} +UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_mutable_max_inbound_priority_frames_per_stream(envoy_api_v2_core_Http2ProtocolOptions *msg, upb_arena *arena) { + struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_Http2ProtocolOptions_max_inbound_priority_frames_per_stream(msg); + if (sub == NULL) { + sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_core_Http2ProtocolOptions_set_max_inbound_priority_frames_per_stream(msg, sub); + } + return sub; +} +UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_max_inbound_window_update_frames_per_data_frame_sent(envoy_api_v2_core_Http2ProtocolOptions *msg, struct google_protobuf_UInt32Value* value) { + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(36, 72)) = value; +} +UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_mutable_max_inbound_window_update_frames_per_data_frame_sent(envoy_api_v2_core_Http2ProtocolOptions *msg, upb_arena *arena) { + struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_Http2ProtocolOptions_max_inbound_window_update_frames_per_data_frame_sent(msg); + if (sub == NULL) { + sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_core_Http2ProtocolOptions_set_max_inbound_window_update_frames_per_data_frame_sent(msg, sub); + } + return sub; +} +UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_stream_error_on_invalid_http_messaging(envoy_api_v2_core_Http2ProtocolOptions *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value; +} /* envoy.api.v2.core.GrpcProtocolOptions */ diff --git a/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c b/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c new file mode 100644 index 00000000000..05a1c8098a6 --- /dev/null +++ b/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c @@ -0,0 +1,58 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * udpa/data/orca/v1/orca_load_report.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#include +#include "upb/msg.h" +#include "udpa/data/orca/v1/orca_load_report.upb.h" +#include "validate/validate.upb.h" + +#include "upb/port_def.inc" + +static const upb_msglayout *const udpa_data_orca_v1_OrcaLoadReport_submsgs[2] = { + &udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit, + &udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit, +}; + +static const upb_msglayout_field udpa_data_orca_v1_OrcaLoadReport__fields[5] = { + {1, UPB_SIZE(0, 0), 0, 0, 1, 1}, + {2, UPB_SIZE(8, 8), 0, 0, 1, 1}, + {3, UPB_SIZE(16, 16), 0, 0, 4, 1}, + {4, UPB_SIZE(24, 24), 0, 0, 11, 3}, + {5, UPB_SIZE(28, 32), 0, 1, 11, 3}, +}; + +const upb_msglayout udpa_data_orca_v1_OrcaLoadReport_msginit = { + &udpa_data_orca_v1_OrcaLoadReport_submsgs[0], + &udpa_data_orca_v1_OrcaLoadReport__fields[0], + UPB_SIZE(32, 40), 5, false, +}; + +static const upb_msglayout_field udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry__fields[2] = { + {1, UPB_SIZE(8, 8), 0, 0, 9, 1}, + {2, UPB_SIZE(0, 0), 0, 0, 1, 1}, +}; + +const upb_msglayout udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit = { + NULL, + &udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry__fields[0], + UPB_SIZE(16, 32), 2, false, +}; + +static const upb_msglayout_field udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry__fields[2] = { + {1, UPB_SIZE(8, 8), 0, 0, 9, 1}, + {2, UPB_SIZE(0, 0), 0, 0, 1, 1}, +}; + +const upb_msglayout udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit = { + NULL, + &udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry__fields[0], + UPB_SIZE(16, 32), 2, false, +}; + +#include "upb/port_undef.inc" + diff --git a/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h b/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h new file mode 100644 index 00000000000..279578b5ae4 --- /dev/null +++ b/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h @@ -0,0 +1,144 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * udpa/data/orca/v1/orca_load_report.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#ifndef UDPA_DATA_ORCA_V1_ORCA_LOAD_REPORT_PROTO_UPB_H_ +#define UDPA_DATA_ORCA_V1_ORCA_LOAD_REPORT_PROTO_UPB_H_ + +#include "upb/generated_util.h" +#include "upb/msg.h" +#include "upb/decode.h" +#include "upb/encode.h" + +#include "upb/port_def.inc" + +#ifdef __cplusplus +extern "C" { +#endif + +struct udpa_data_orca_v1_OrcaLoadReport; +struct udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry; +struct udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry; +typedef struct udpa_data_orca_v1_OrcaLoadReport udpa_data_orca_v1_OrcaLoadReport; +typedef struct udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry; +typedef struct udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry; +extern const upb_msglayout udpa_data_orca_v1_OrcaLoadReport_msginit; +extern const upb_msglayout udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit; +extern const upb_msglayout udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit; + + +/* udpa.data.orca.v1.OrcaLoadReport */ + +UPB_INLINE udpa_data_orca_v1_OrcaLoadReport *udpa_data_orca_v1_OrcaLoadReport_new(upb_arena *arena) { + return (udpa_data_orca_v1_OrcaLoadReport *)upb_msg_new(&udpa_data_orca_v1_OrcaLoadReport_msginit, arena); +} +UPB_INLINE udpa_data_orca_v1_OrcaLoadReport *udpa_data_orca_v1_OrcaLoadReport_parse(const char *buf, size_t size, + upb_arena *arena) { + udpa_data_orca_v1_OrcaLoadReport *ret = udpa_data_orca_v1_OrcaLoadReport_new(arena); + return (ret && upb_decode(buf, size, ret, &udpa_data_orca_v1_OrcaLoadReport_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *udpa_data_orca_v1_OrcaLoadReport_serialize(const udpa_data_orca_v1_OrcaLoadReport *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &udpa_data_orca_v1_OrcaLoadReport_msginit, arena, len); +} + +UPB_INLINE double udpa_data_orca_v1_OrcaLoadReport_cpu_utilization(const udpa_data_orca_v1_OrcaLoadReport *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)); } +UPB_INLINE double udpa_data_orca_v1_OrcaLoadReport_mem_utilization(const udpa_data_orca_v1_OrcaLoadReport *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(8, 8)); } +UPB_INLINE uint64_t udpa_data_orca_v1_OrcaLoadReport_rps(const udpa_data_orca_v1_OrcaLoadReport *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(16, 16)); } +UPB_INLINE const udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry* const* udpa_data_orca_v1_OrcaLoadReport_request_cost(const udpa_data_orca_v1_OrcaLoadReport *msg, size_t *len) { return (const udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry* const*)_upb_array_accessor(msg, UPB_SIZE(24, 24), len); } +UPB_INLINE const udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry* const* udpa_data_orca_v1_OrcaLoadReport_utilization(const udpa_data_orca_v1_OrcaLoadReport *msg, size_t *len) { return (const udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry* const*)_upb_array_accessor(msg, UPB_SIZE(28, 32), len); } + +UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_set_cpu_utilization(udpa_data_orca_v1_OrcaLoadReport *msg, double value) { + UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_set_mem_utilization(udpa_data_orca_v1_OrcaLoadReport *msg, double value) { + UPB_FIELD_AT(msg, double, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_set_rps(udpa_data_orca_v1_OrcaLoadReport *msg, uint64_t value) { + UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(16, 16)) = value; +} +UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry** udpa_data_orca_v1_OrcaLoadReport_mutable_request_cost(udpa_data_orca_v1_OrcaLoadReport *msg, size_t *len) { + return (udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 24), len); +} +UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry** udpa_data_orca_v1_OrcaLoadReport_resize_request_cost(udpa_data_orca_v1_OrcaLoadReport *msg, size_t len, upb_arena *arena) { + return (udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 24), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry* udpa_data_orca_v1_OrcaLoadReport_add_request_cost(udpa_data_orca_v1_OrcaLoadReport *msg, upb_arena *arena) { + struct udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry* sub = (struct udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry*)upb_msg_new(&udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(24, 24), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry** udpa_data_orca_v1_OrcaLoadReport_mutable_utilization(udpa_data_orca_v1_OrcaLoadReport *msg, size_t *len) { + return (udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 32), len); +} +UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry** udpa_data_orca_v1_OrcaLoadReport_resize_utilization(udpa_data_orca_v1_OrcaLoadReport *msg, size_t len, upb_arena *arena) { + return (udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry* udpa_data_orca_v1_OrcaLoadReport_add_utilization(udpa_data_orca_v1_OrcaLoadReport *msg, upb_arena *arena) { + struct udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry* sub = (struct udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry*)upb_msg_new(&udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(28, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* udpa.data.orca.v1.OrcaLoadReport.RequestCostEntry */ + +UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_new(upb_arena *arena) { + return (udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *)upb_msg_new(&udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit, arena); +} +UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_parse(const char *buf, size_t size, + upb_arena *arena) { + udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *ret = udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_new(arena); + return (ret && upb_decode(buf, size, ret, &udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_serialize(const udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit, arena, len); +} + +UPB_INLINE upb_strview udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_key(const udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); } +UPB_INLINE double udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_value(const udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)); } + +UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_set_key(udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_set_value(udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *msg, double value) { + UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)) = value; +} + +/* udpa.data.orca.v1.OrcaLoadReport.UtilizationEntry */ + +UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_new(upb_arena *arena) { + return (udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *)upb_msg_new(&udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit, arena); +} +UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_parse(const char *buf, size_t size, + upb_arena *arena) { + udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *ret = udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_new(arena); + return (ret && upb_decode(buf, size, ret, &udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_serialize(const udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit, arena, len); +} + +UPB_INLINE upb_strview udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_key(const udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); } +UPB_INLINE double udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_value(const udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)); } + +UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_set_key(udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_set_value(udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *msg, double value) { + UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)) = value; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include "upb/port_undef.inc" + +#endif /* UDPA_DATA_ORCA_V1_ORCA_LOAD_REPORT_PROTO_UPB_H_ */ diff --git a/src/core/lib/gprpp/map.h b/src/core/lib/gprpp/map.h index 134625775cf..6a41a97bec2 100644 --- a/src/core/lib/gprpp/map.h +++ b/src/core/lib/gprpp/map.h @@ -35,6 +35,7 @@ #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/pair.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" +#include "src/core/lib/gprpp/string_view.h" namespace grpc_core { @@ -42,8 +43,14 @@ struct StringLess { bool operator()(const char* a, const char* b) const { return strcmp(a, b) < 0; } - bool operator()(const UniquePtr& k1, const UniquePtr& k2) const { - return strcmp(k1.get(), k2.get()) < 0; + bool operator()(const UniquePtr& a, const UniquePtr& b) const { + return strcmp(a.get(), b.get()) < 0; + } + bool operator()(const StringView& a, const StringView& b) const { + const size_t min_size = std::min(a.size(), b.size()); + int c = strncmp(a.data(), b.data(), min_size); + if (c != 0) return c < 0; + return a.size() < b.size(); } }; diff --git a/src/core/lib/transport/static_metadata.cc b/src/core/lib/transport/static_metadata.cc index e43c17f1ca5..bd6ff09c80d 100644 --- a/src/core/lib/transport/static_metadata.cc +++ b/src/core/lib/transport/static_metadata.cc @@ -53,76 +53,77 @@ static constexpr uint8_t g_bytes[] = { 99, 45, 112, 114, 101, 118, 105, 111, 117, 115, 45, 114, 112, 99, 45, 97, 116, 116, 101, 109, 112, 116, 115, 103, 114, 112, 99, 45, 114, 101, 116, 114, 121, 45, 112, 117, 115, 104, 98, 97, 99, 107, 45, 109, 115, - 103, 114, 112, 99, 45, 116, 105, 109, 101, 111, 117, 116, 49, 50, 51, - 52, 103, 114, 112, 99, 46, 119, 97, 105, 116, 95, 102, 111, 114, 95, - 114, 101, 97, 100, 121, 103, 114, 112, 99, 46, 116, 105, 109, 101, 111, - 117, 116, 103, 114, 112, 99, 46, 109, 97, 120, 95, 114, 101, 113, 117, - 101, 115, 116, 95, 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, 116, - 101, 115, 103, 114, 112, 99, 46, 109, 97, 120, 95, 114, 101, 115, 112, - 111, 110, 115, 101, 95, 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, - 116, 101, 115, 47, 103, 114, 112, 99, 46, 108, 98, 46, 118, 49, 46, - 76, 111, 97, 100, 66, 97, 108, 97, 110, 99, 101, 114, 47, 66, 97, - 108, 97, 110, 99, 101, 76, 111, 97, 100, 47, 101, 110, 118, 111, 121, - 46, 115, 101, 114, 118, 105, 99, 101, 46, 108, 111, 97, 100, 95, 115, - 116, 97, 116, 115, 46, 118, 50, 46, 76, 111, 97, 100, 82, 101, 112, - 111, 114, 116, 105, 110, 103, 83, 101, 114, 118, 105, 99, 101, 47, 83, - 116, 114, 101, 97, 109, 76, 111, 97, 100, 83, 116, 97, 116, 115, 47, - 101, 110, 118, 111, 121, 46, 97, 112, 105, 46, 118, 50, 46, 69, 110, - 100, 112, 111, 105, 110, 116, 68, 105, 115, 99, 111, 118, 101, 114, 121, - 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, 114, 101, 97, 109, 69, - 110, 100, 112, 111, 105, 110, 116, 115, 47, 103, 114, 112, 99, 46, 104, - 101, 97, 108, 116, 104, 46, 118, 49, 46, 72, 101, 97, 108, 116, 104, - 47, 87, 97, 116, 99, 104, 47, 101, 110, 118, 111, 121, 46, 115, 101, - 114, 118, 105, 99, 101, 46, 100, 105, 115, 99, 111, 118, 101, 114, 121, - 46, 118, 50, 46, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 68, - 105, 115, 99, 111, 118, 101, 114, 121, 83, 101, 114, 118, 105, 99, 101, - 47, 83, 116, 114, 101, 97, 109, 65, 103, 103, 114, 101, 103, 97, 116, - 101, 100, 82, 101, 115, 111, 117, 114, 99, 101, 115, 100, 101, 102, 108, - 97, 116, 101, 103, 122, 105, 112, 115, 116, 114, 101, 97, 109, 47, 103, - 122, 105, 112, 71, 69, 84, 80, 79, 83, 84, 47, 47, 105, 110, 100, - 101, 120, 46, 104, 116, 109, 108, 104, 116, 116, 112, 104, 116, 116, 112, - 115, 50, 48, 48, 50, 48, 52, 50, 48, 54, 51, 48, 52, 52, 48, - 48, 52, 48, 52, 53, 48, 48, 97, 99, 99, 101, 112, 116, 45, 99, - 104, 97, 114, 115, 101, 116, 103, 122, 105, 112, 44, 32, 100, 101, 102, - 108, 97, 116, 101, 97, 99, 99, 101, 112, 116, 45, 108, 97, 110, 103, - 117, 97, 103, 101, 97, 99, 99, 101, 112, 116, 45, 114, 97, 110, 103, - 101, 115, 97, 99, 99, 101, 112, 116, 97, 99, 99, 101, 115, 115, 45, - 99, 111, 110, 116, 114, 111, 108, 45, 97, 108, 108, 111, 119, 45, 111, - 114, 105, 103, 105, 110, 97, 103, 101, 97, 108, 108, 111, 119, 97, 117, - 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 99, 97, 99, 104, - 101, 45, 99, 111, 110, 116, 114, 111, 108, 99, 111, 110, 116, 101, 110, - 116, 45, 100, 105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 99, 111, - 110, 116, 101, 110, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 99, - 111, 110, 116, 101, 110, 116, 45, 108, 101, 110, 103, 116, 104, 99, 111, - 110, 116, 101, 110, 116, 45, 108, 111, 99, 97, 116, 105, 111, 110, 99, - 111, 110, 116, 101, 110, 116, 45, 114, 97, 110, 103, 101, 99, 111, 111, - 107, 105, 101, 100, 97, 116, 101, 101, 116, 97, 103, 101, 120, 112, 101, - 99, 116, 101, 120, 112, 105, 114, 101, 115, 102, 114, 111, 109, 105, 102, - 45, 109, 97, 116, 99, 104, 105, 102, 45, 109, 111, 100, 105, 102, 105, - 101, 100, 45, 115, 105, 110, 99, 101, 105, 102, 45, 110, 111, 110, 101, - 45, 109, 97, 116, 99, 104, 105, 102, 45, 114, 97, 110, 103, 101, 105, - 102, 45, 117, 110, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, - 110, 99, 101, 108, 97, 115, 116, 45, 109, 111, 100, 105, 102, 105, 101, - 100, 108, 105, 110, 107, 108, 111, 99, 97, 116, 105, 111, 110, 109, 97, - 120, 45, 102, 111, 114, 119, 97, 114, 100, 115, 112, 114, 111, 120, 121, - 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 112, 114, - 111, 120, 121, 45, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, - 111, 110, 114, 97, 110, 103, 101, 114, 101, 102, 101, 114, 101, 114, 114, - 101, 102, 114, 101, 115, 104, 114, 101, 116, 114, 121, 45, 97, 102, 116, - 101, 114, 115, 101, 114, 118, 101, 114, 115, 101, 116, 45, 99, 111, 111, - 107, 105, 101, 115, 116, 114, 105, 99, 116, 45, 116, 114, 97, 110, 115, - 112, 111, 114, 116, 45, 115, 101, 99, 117, 114, 105, 116, 121, 116, 114, - 97, 110, 115, 102, 101, 114, 45, 101, 110, 99, 111, 100, 105, 110, 103, - 118, 97, 114, 121, 118, 105, 97, 119, 119, 119, 45, 97, 117, 116, 104, - 101, 110, 116, 105, 99, 97, 116, 101, 48, 105, 100, 101, 110, 116, 105, - 116, 121, 116, 114, 97, 105, 108, 101, 114, 115, 97, 112, 112, 108, 105, - 99, 97, 116, 105, 111, 110, 47, 103, 114, 112, 99, 103, 114, 112, 99, - 80, 85, 84, 108, 98, 45, 99, 111, 115, 116, 45, 98, 105, 110, 105, - 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, - 105, 100, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100, 101, - 102, 108, 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, 116, - 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, - 112}; + 120, 45, 101, 110, 100, 112, 111, 105, 110, 116, 45, 108, 111, 97, 100, + 45, 109, 101, 116, 114, 105, 99, 115, 45, 98, 105, 110, 103, 114, 112, + 99, 45, 116, 105, 109, 101, 111, 117, 116, 49, 50, 51, 52, 103, 114, + 112, 99, 46, 119, 97, 105, 116, 95, 102, 111, 114, 95, 114, 101, 97, + 100, 121, 103, 114, 112, 99, 46, 116, 105, 109, 101, 111, 117, 116, 103, + 114, 112, 99, 46, 109, 97, 120, 95, 114, 101, 113, 117, 101, 115, 116, + 95, 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 103, + 114, 112, 99, 46, 109, 97, 120, 95, 114, 101, 115, 112, 111, 110, 115, + 101, 95, 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, + 47, 103, 114, 112, 99, 46, 108, 98, 46, 118, 49, 46, 76, 111, 97, + 100, 66, 97, 108, 97, 110, 99, 101, 114, 47, 66, 97, 108, 97, 110, + 99, 101, 76, 111, 97, 100, 47, 101, 110, 118, 111, 121, 46, 115, 101, + 114, 118, 105, 99, 101, 46, 108, 111, 97, 100, 95, 115, 116, 97, 116, + 115, 46, 118, 50, 46, 76, 111, 97, 100, 82, 101, 112, 111, 114, 116, + 105, 110, 103, 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, 114, 101, + 97, 109, 76, 111, 97, 100, 83, 116, 97, 116, 115, 47, 101, 110, 118, + 111, 121, 46, 97, 112, 105, 46, 118, 50, 46, 69, 110, 100, 112, 111, + 105, 110, 116, 68, 105, 115, 99, 111, 118, 101, 114, 121, 83, 101, 114, + 118, 105, 99, 101, 47, 83, 116, 114, 101, 97, 109, 69, 110, 100, 112, + 111, 105, 110, 116, 115, 47, 103, 114, 112, 99, 46, 104, 101, 97, 108, + 116, 104, 46, 118, 49, 46, 72, 101, 97, 108, 116, 104, 47, 87, 97, + 116, 99, 104, 47, 101, 110, 118, 111, 121, 46, 115, 101, 114, 118, 105, + 99, 101, 46, 100, 105, 115, 99, 111, 118, 101, 114, 121, 46, 118, 50, + 46, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 68, 105, 115, 99, + 111, 118, 101, 114, 121, 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, + 114, 101, 97, 109, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 82, + 101, 115, 111, 117, 114, 99, 101, 115, 100, 101, 102, 108, 97, 116, 101, + 103, 122, 105, 112, 115, 116, 114, 101, 97, 109, 47, 103, 122, 105, 112, + 71, 69, 84, 80, 79, 83, 84, 47, 47, 105, 110, 100, 101, 120, 46, + 104, 116, 109, 108, 104, 116, 116, 112, 104, 116, 116, 112, 115, 50, 48, + 48, 50, 48, 52, 50, 48, 54, 51, 48, 52, 52, 48, 48, 52, 48, + 52, 53, 48, 48, 97, 99, 99, 101, 112, 116, 45, 99, 104, 97, 114, + 115, 101, 116, 103, 122, 105, 112, 44, 32, 100, 101, 102, 108, 97, 116, + 101, 97, 99, 99, 101, 112, 116, 45, 108, 97, 110, 103, 117, 97, 103, + 101, 97, 99, 99, 101, 112, 116, 45, 114, 97, 110, 103, 101, 115, 97, + 99, 99, 101, 112, 116, 97, 99, 99, 101, 115, 115, 45, 99, 111, 110, + 116, 114, 111, 108, 45, 97, 108, 108, 111, 119, 45, 111, 114, 105, 103, + 105, 110, 97, 103, 101, 97, 108, 108, 111, 119, 97, 117, 116, 104, 111, + 114, 105, 122, 97, 116, 105, 111, 110, 99, 97, 99, 104, 101, 45, 99, + 111, 110, 116, 114, 111, 108, 99, 111, 110, 116, 101, 110, 116, 45, 100, + 105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 99, 111, 110, 116, 101, + 110, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 99, 111, 110, 116, + 101, 110, 116, 45, 108, 101, 110, 103, 116, 104, 99, 111, 110, 116, 101, + 110, 116, 45, 108, 111, 99, 97, 116, 105, 111, 110, 99, 111, 110, 116, + 101, 110, 116, 45, 114, 97, 110, 103, 101, 99, 111, 111, 107, 105, 101, + 100, 97, 116, 101, 101, 116, 97, 103, 101, 120, 112, 101, 99, 116, 101, + 120, 112, 105, 114, 101, 115, 102, 114, 111, 109, 105, 102, 45, 109, 97, + 116, 99, 104, 105, 102, 45, 109, 111, 100, 105, 102, 105, 101, 100, 45, + 115, 105, 110, 99, 101, 105, 102, 45, 110, 111, 110, 101, 45, 109, 97, + 116, 99, 104, 105, 102, 45, 114, 97, 110, 103, 101, 105, 102, 45, 117, + 110, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, + 108, 97, 115, 116, 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 105, + 110, 107, 108, 111, 99, 97, 116, 105, 111, 110, 109, 97, 120, 45, 102, + 111, 114, 119, 97, 114, 100, 115, 112, 114, 111, 120, 121, 45, 97, 117, + 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 112, 114, 111, 120, 121, + 45, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 114, + 97, 110, 103, 101, 114, 101, 102, 101, 114, 101, 114, 114, 101, 102, 114, + 101, 115, 104, 114, 101, 116, 114, 121, 45, 97, 102, 116, 101, 114, 115, + 101, 114, 118, 101, 114, 115, 101, 116, 45, 99, 111, 111, 107, 105, 101, + 115, 116, 114, 105, 99, 116, 45, 116, 114, 97, 110, 115, 112, 111, 114, + 116, 45, 115, 101, 99, 117, 114, 105, 116, 121, 116, 114, 97, 110, 115, + 102, 101, 114, 45, 101, 110, 99, 111, 100, 105, 110, 103, 118, 97, 114, + 121, 118, 105, 97, 119, 119, 119, 45, 97, 117, 116, 104, 101, 110, 116, + 105, 99, 97, 116, 101, 48, 105, 100, 101, 110, 116, 105, 116, 121, 116, + 114, 97, 105, 108, 101, 114, 115, 97, 112, 112, 108, 105, 99, 97, 116, + 105, 111, 110, 47, 103, 114, 112, 99, 103, 114, 112, 99, 80, 85, 84, + 108, 98, 45, 99, 111, 115, 116, 45, 98, 105, 110, 105, 100, 101, 110, + 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, 100, 101, + 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100, 101, 102, 108, 97, + 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, 116, 105, 116, 121, + 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112}; grpc_slice_refcount grpc_core::StaticSliceRefcount::kStaticSubRefcount; @@ -187,6 +188,7 @@ struct StaticMetadataCtx { StaticSliceRefcount(102), StaticSliceRefcount(103), StaticSliceRefcount(104), StaticSliceRefcount(105), StaticSliceRefcount(106), StaticSliceRefcount(107), + StaticSliceRefcount(108), }; const StaticMetadataSlice slices[GRPC_STATIC_MDSTR_COUNT] = { @@ -214,488 +216,494 @@ struct StaticMetadataCtx { grpc_core::StaticMetadataSlice(&refcounts[20].base, 4, g_bytes + 278), grpc_core::StaticMetadataSlice(&refcounts[21].base, 26, g_bytes + 282), grpc_core::StaticMetadataSlice(&refcounts[22].base, 22, g_bytes + 308), - grpc_core::StaticMetadataSlice(&refcounts[23].base, 12, g_bytes + 330), - grpc_core::StaticMetadataSlice(&refcounts[24].base, 1, g_bytes + 342), - grpc_core::StaticMetadataSlice(&refcounts[25].base, 1, g_bytes + 343), - grpc_core::StaticMetadataSlice(&refcounts[26].base, 1, g_bytes + 344), - grpc_core::StaticMetadataSlice(&refcounts[27].base, 1, g_bytes + 345), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), - grpc_core::StaticMetadataSlice(&refcounts[29].base, 19, g_bytes + 346), - grpc_core::StaticMetadataSlice(&refcounts[30].base, 12, g_bytes + 365), - grpc_core::StaticMetadataSlice(&refcounts[31].base, 30, g_bytes + 377), - grpc_core::StaticMetadataSlice(&refcounts[32].base, 31, g_bytes + 407), - grpc_core::StaticMetadataSlice(&refcounts[33].base, 36, g_bytes + 438), - grpc_core::StaticMetadataSlice(&refcounts[34].base, 65, g_bytes + 474), - grpc_core::StaticMetadataSlice(&refcounts[35].base, 54, g_bytes + 539), - grpc_core::StaticMetadataSlice(&refcounts[36].base, 28, g_bytes + 593), - grpc_core::StaticMetadataSlice(&refcounts[37].base, 80, g_bytes + 621), - grpc_core::StaticMetadataSlice(&refcounts[38].base, 7, g_bytes + 701), - grpc_core::StaticMetadataSlice(&refcounts[39].base, 4, g_bytes + 708), - grpc_core::StaticMetadataSlice(&refcounts[40].base, 11, g_bytes + 712), - grpc_core::StaticMetadataSlice(&refcounts[41].base, 3, g_bytes + 723), - grpc_core::StaticMetadataSlice(&refcounts[42].base, 4, g_bytes + 726), - grpc_core::StaticMetadataSlice(&refcounts[43].base, 1, g_bytes + 730), - grpc_core::StaticMetadataSlice(&refcounts[44].base, 11, g_bytes + 731), - grpc_core::StaticMetadataSlice(&refcounts[45].base, 4, g_bytes + 742), - grpc_core::StaticMetadataSlice(&refcounts[46].base, 5, g_bytes + 746), - grpc_core::StaticMetadataSlice(&refcounts[47].base, 3, g_bytes + 751), - grpc_core::StaticMetadataSlice(&refcounts[48].base, 3, g_bytes + 754), - grpc_core::StaticMetadataSlice(&refcounts[49].base, 3, g_bytes + 757), - grpc_core::StaticMetadataSlice(&refcounts[50].base, 3, g_bytes + 760), - grpc_core::StaticMetadataSlice(&refcounts[51].base, 3, g_bytes + 763), - grpc_core::StaticMetadataSlice(&refcounts[52].base, 3, g_bytes + 766), - grpc_core::StaticMetadataSlice(&refcounts[53].base, 3, g_bytes + 769), - grpc_core::StaticMetadataSlice(&refcounts[54].base, 14, g_bytes + 772), - grpc_core::StaticMetadataSlice(&refcounts[55].base, 13, g_bytes + 786), - grpc_core::StaticMetadataSlice(&refcounts[56].base, 15, g_bytes + 799), - grpc_core::StaticMetadataSlice(&refcounts[57].base, 13, g_bytes + 814), - grpc_core::StaticMetadataSlice(&refcounts[58].base, 6, g_bytes + 827), - grpc_core::StaticMetadataSlice(&refcounts[59].base, 27, g_bytes + 833), - grpc_core::StaticMetadataSlice(&refcounts[60].base, 3, g_bytes + 860), - grpc_core::StaticMetadataSlice(&refcounts[61].base, 5, g_bytes + 863), - grpc_core::StaticMetadataSlice(&refcounts[62].base, 13, g_bytes + 868), - grpc_core::StaticMetadataSlice(&refcounts[63].base, 13, g_bytes + 881), - grpc_core::StaticMetadataSlice(&refcounts[64].base, 19, g_bytes + 894), - grpc_core::StaticMetadataSlice(&refcounts[65].base, 16, g_bytes + 913), - grpc_core::StaticMetadataSlice(&refcounts[66].base, 14, g_bytes + 929), - grpc_core::StaticMetadataSlice(&refcounts[67].base, 16, g_bytes + 943), - grpc_core::StaticMetadataSlice(&refcounts[68].base, 13, g_bytes + 959), - grpc_core::StaticMetadataSlice(&refcounts[69].base, 6, g_bytes + 972), - grpc_core::StaticMetadataSlice(&refcounts[70].base, 4, g_bytes + 978), - grpc_core::StaticMetadataSlice(&refcounts[71].base, 4, g_bytes + 982), - grpc_core::StaticMetadataSlice(&refcounts[72].base, 6, g_bytes + 986), - grpc_core::StaticMetadataSlice(&refcounts[73].base, 7, g_bytes + 992), - grpc_core::StaticMetadataSlice(&refcounts[74].base, 4, g_bytes + 999), - grpc_core::StaticMetadataSlice(&refcounts[75].base, 8, g_bytes + 1003), - grpc_core::StaticMetadataSlice(&refcounts[76].base, 17, g_bytes + 1011), - grpc_core::StaticMetadataSlice(&refcounts[77].base, 13, g_bytes + 1028), - grpc_core::StaticMetadataSlice(&refcounts[78].base, 8, g_bytes + 1041), - grpc_core::StaticMetadataSlice(&refcounts[79].base, 19, g_bytes + 1049), - grpc_core::StaticMetadataSlice(&refcounts[80].base, 13, g_bytes + 1068), - grpc_core::StaticMetadataSlice(&refcounts[81].base, 4, g_bytes + 1081), - grpc_core::StaticMetadataSlice(&refcounts[82].base, 8, g_bytes + 1085), - grpc_core::StaticMetadataSlice(&refcounts[83].base, 12, g_bytes + 1093), - grpc_core::StaticMetadataSlice(&refcounts[84].base, 18, g_bytes + 1105), - grpc_core::StaticMetadataSlice(&refcounts[85].base, 19, g_bytes + 1123), - grpc_core::StaticMetadataSlice(&refcounts[86].base, 5, g_bytes + 1142), - grpc_core::StaticMetadataSlice(&refcounts[87].base, 7, g_bytes + 1147), - grpc_core::StaticMetadataSlice(&refcounts[88].base, 7, g_bytes + 1154), - grpc_core::StaticMetadataSlice(&refcounts[89].base, 11, g_bytes + 1161), - grpc_core::StaticMetadataSlice(&refcounts[90].base, 6, g_bytes + 1172), - grpc_core::StaticMetadataSlice(&refcounts[91].base, 10, g_bytes + 1178), - grpc_core::StaticMetadataSlice(&refcounts[92].base, 25, g_bytes + 1188), - grpc_core::StaticMetadataSlice(&refcounts[93].base, 17, g_bytes + 1213), - grpc_core::StaticMetadataSlice(&refcounts[94].base, 4, g_bytes + 1230), - grpc_core::StaticMetadataSlice(&refcounts[95].base, 3, g_bytes + 1234), - grpc_core::StaticMetadataSlice(&refcounts[96].base, 16, g_bytes + 1237), - grpc_core::StaticMetadataSlice(&refcounts[97].base, 1, g_bytes + 1253), - grpc_core::StaticMetadataSlice(&refcounts[98].base, 8, g_bytes + 1254), - grpc_core::StaticMetadataSlice(&refcounts[99].base, 8, g_bytes + 1262), - grpc_core::StaticMetadataSlice(&refcounts[100].base, 16, g_bytes + 1270), - grpc_core::StaticMetadataSlice(&refcounts[101].base, 4, g_bytes + 1286), - grpc_core::StaticMetadataSlice(&refcounts[102].base, 3, g_bytes + 1290), - grpc_core::StaticMetadataSlice(&refcounts[103].base, 11, g_bytes + 1293), - grpc_core::StaticMetadataSlice(&refcounts[104].base, 16, g_bytes + 1304), - grpc_core::StaticMetadataSlice(&refcounts[105].base, 13, g_bytes + 1320), - grpc_core::StaticMetadataSlice(&refcounts[106].base, 12, g_bytes + 1333), - grpc_core::StaticMetadataSlice(&refcounts[107].base, 21, g_bytes + 1345), + grpc_core::StaticMetadataSlice(&refcounts[23].base, 27, g_bytes + 330), + grpc_core::StaticMetadataSlice(&refcounts[24].base, 12, g_bytes + 357), + grpc_core::StaticMetadataSlice(&refcounts[25].base, 1, g_bytes + 369), + grpc_core::StaticMetadataSlice(&refcounts[26].base, 1, g_bytes + 370), + grpc_core::StaticMetadataSlice(&refcounts[27].base, 1, g_bytes + 371), + grpc_core::StaticMetadataSlice(&refcounts[28].base, 1, g_bytes + 372), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), + grpc_core::StaticMetadataSlice(&refcounts[30].base, 19, g_bytes + 373), + grpc_core::StaticMetadataSlice(&refcounts[31].base, 12, g_bytes + 392), + grpc_core::StaticMetadataSlice(&refcounts[32].base, 30, g_bytes + 404), + grpc_core::StaticMetadataSlice(&refcounts[33].base, 31, g_bytes + 434), + grpc_core::StaticMetadataSlice(&refcounts[34].base, 36, g_bytes + 465), + grpc_core::StaticMetadataSlice(&refcounts[35].base, 65, g_bytes + 501), + grpc_core::StaticMetadataSlice(&refcounts[36].base, 54, g_bytes + 566), + grpc_core::StaticMetadataSlice(&refcounts[37].base, 28, g_bytes + 620), + grpc_core::StaticMetadataSlice(&refcounts[38].base, 80, g_bytes + 648), + grpc_core::StaticMetadataSlice(&refcounts[39].base, 7, g_bytes + 728), + grpc_core::StaticMetadataSlice(&refcounts[40].base, 4, g_bytes + 735), + grpc_core::StaticMetadataSlice(&refcounts[41].base, 11, g_bytes + 739), + grpc_core::StaticMetadataSlice(&refcounts[42].base, 3, g_bytes + 750), + grpc_core::StaticMetadataSlice(&refcounts[43].base, 4, g_bytes + 753), + grpc_core::StaticMetadataSlice(&refcounts[44].base, 1, g_bytes + 757), + grpc_core::StaticMetadataSlice(&refcounts[45].base, 11, g_bytes + 758), + grpc_core::StaticMetadataSlice(&refcounts[46].base, 4, g_bytes + 769), + grpc_core::StaticMetadataSlice(&refcounts[47].base, 5, g_bytes + 773), + grpc_core::StaticMetadataSlice(&refcounts[48].base, 3, g_bytes + 778), + grpc_core::StaticMetadataSlice(&refcounts[49].base, 3, g_bytes + 781), + grpc_core::StaticMetadataSlice(&refcounts[50].base, 3, g_bytes + 784), + grpc_core::StaticMetadataSlice(&refcounts[51].base, 3, g_bytes + 787), + grpc_core::StaticMetadataSlice(&refcounts[52].base, 3, g_bytes + 790), + grpc_core::StaticMetadataSlice(&refcounts[53].base, 3, g_bytes + 793), + grpc_core::StaticMetadataSlice(&refcounts[54].base, 3, g_bytes + 796), + grpc_core::StaticMetadataSlice(&refcounts[55].base, 14, g_bytes + 799), + grpc_core::StaticMetadataSlice(&refcounts[56].base, 13, g_bytes + 813), + grpc_core::StaticMetadataSlice(&refcounts[57].base, 15, g_bytes + 826), + grpc_core::StaticMetadataSlice(&refcounts[58].base, 13, g_bytes + 841), + grpc_core::StaticMetadataSlice(&refcounts[59].base, 6, g_bytes + 854), + grpc_core::StaticMetadataSlice(&refcounts[60].base, 27, g_bytes + 860), + grpc_core::StaticMetadataSlice(&refcounts[61].base, 3, g_bytes + 887), + grpc_core::StaticMetadataSlice(&refcounts[62].base, 5, g_bytes + 890), + grpc_core::StaticMetadataSlice(&refcounts[63].base, 13, g_bytes + 895), + grpc_core::StaticMetadataSlice(&refcounts[64].base, 13, g_bytes + 908), + grpc_core::StaticMetadataSlice(&refcounts[65].base, 19, g_bytes + 921), + grpc_core::StaticMetadataSlice(&refcounts[66].base, 16, g_bytes + 940), + grpc_core::StaticMetadataSlice(&refcounts[67].base, 14, g_bytes + 956), + grpc_core::StaticMetadataSlice(&refcounts[68].base, 16, g_bytes + 970), + grpc_core::StaticMetadataSlice(&refcounts[69].base, 13, g_bytes + 986), + grpc_core::StaticMetadataSlice(&refcounts[70].base, 6, g_bytes + 999), + grpc_core::StaticMetadataSlice(&refcounts[71].base, 4, g_bytes + 1005), + grpc_core::StaticMetadataSlice(&refcounts[72].base, 4, g_bytes + 1009), + grpc_core::StaticMetadataSlice(&refcounts[73].base, 6, g_bytes + 1013), + grpc_core::StaticMetadataSlice(&refcounts[74].base, 7, g_bytes + 1019), + grpc_core::StaticMetadataSlice(&refcounts[75].base, 4, g_bytes + 1026), + grpc_core::StaticMetadataSlice(&refcounts[76].base, 8, g_bytes + 1030), + grpc_core::StaticMetadataSlice(&refcounts[77].base, 17, g_bytes + 1038), + grpc_core::StaticMetadataSlice(&refcounts[78].base, 13, g_bytes + 1055), + grpc_core::StaticMetadataSlice(&refcounts[79].base, 8, g_bytes + 1068), + grpc_core::StaticMetadataSlice(&refcounts[80].base, 19, g_bytes + 1076), + grpc_core::StaticMetadataSlice(&refcounts[81].base, 13, g_bytes + 1095), + grpc_core::StaticMetadataSlice(&refcounts[82].base, 4, g_bytes + 1108), + grpc_core::StaticMetadataSlice(&refcounts[83].base, 8, g_bytes + 1112), + grpc_core::StaticMetadataSlice(&refcounts[84].base, 12, g_bytes + 1120), + grpc_core::StaticMetadataSlice(&refcounts[85].base, 18, g_bytes + 1132), + grpc_core::StaticMetadataSlice(&refcounts[86].base, 19, g_bytes + 1150), + grpc_core::StaticMetadataSlice(&refcounts[87].base, 5, g_bytes + 1169), + grpc_core::StaticMetadataSlice(&refcounts[88].base, 7, g_bytes + 1174), + grpc_core::StaticMetadataSlice(&refcounts[89].base, 7, g_bytes + 1181), + grpc_core::StaticMetadataSlice(&refcounts[90].base, 11, g_bytes + 1188), + grpc_core::StaticMetadataSlice(&refcounts[91].base, 6, g_bytes + 1199), + grpc_core::StaticMetadataSlice(&refcounts[92].base, 10, g_bytes + 1205), + grpc_core::StaticMetadataSlice(&refcounts[93].base, 25, g_bytes + 1215), + grpc_core::StaticMetadataSlice(&refcounts[94].base, 17, g_bytes + 1240), + grpc_core::StaticMetadataSlice(&refcounts[95].base, 4, g_bytes + 1257), + grpc_core::StaticMetadataSlice(&refcounts[96].base, 3, g_bytes + 1261), + grpc_core::StaticMetadataSlice(&refcounts[97].base, 16, g_bytes + 1264), + grpc_core::StaticMetadataSlice(&refcounts[98].base, 1, g_bytes + 1280), + grpc_core::StaticMetadataSlice(&refcounts[99].base, 8, g_bytes + 1281), + grpc_core::StaticMetadataSlice(&refcounts[100].base, 8, g_bytes + 1289), + grpc_core::StaticMetadataSlice(&refcounts[101].base, 16, g_bytes + 1297), + grpc_core::StaticMetadataSlice(&refcounts[102].base, 4, g_bytes + 1313), + grpc_core::StaticMetadataSlice(&refcounts[103].base, 3, g_bytes + 1317), + grpc_core::StaticMetadataSlice(&refcounts[104].base, 11, g_bytes + 1320), + grpc_core::StaticMetadataSlice(&refcounts[105].base, 16, g_bytes + 1331), + grpc_core::StaticMetadataSlice(&refcounts[106].base, 13, g_bytes + 1347), + grpc_core::StaticMetadataSlice(&refcounts[107].base, 12, g_bytes + 1360), + grpc_core::StaticMetadataSlice(&refcounts[108].base, 21, g_bytes + 1372), }; StaticMetadata static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[3].base, 10, g_bytes + 19), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 0), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[1].base, 7, g_bytes + 5), - grpc_core::StaticMetadataSlice(&refcounts[41].base, 3, g_bytes + 723), + grpc_core::StaticMetadataSlice(&refcounts[42].base, 3, g_bytes + 750), 1), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[1].base, 7, g_bytes + 5), - grpc_core::StaticMetadataSlice(&refcounts[42].base, 4, g_bytes + 726), + grpc_core::StaticMetadataSlice(&refcounts[43].base, 4, g_bytes + 753), 2), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[0].base, 5, g_bytes + 0), - grpc_core::StaticMetadataSlice(&refcounts[43].base, 1, g_bytes + 730), + grpc_core::StaticMetadataSlice(&refcounts[44].base, 1, g_bytes + 757), 3), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[0].base, 5, g_bytes + 0), - grpc_core::StaticMetadataSlice(&refcounts[44].base, 11, - g_bytes + 731), + grpc_core::StaticMetadataSlice(&refcounts[45].base, 11, + g_bytes + 758), 4), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[4].base, 7, g_bytes + 29), - grpc_core::StaticMetadataSlice(&refcounts[45].base, 4, g_bytes + 742), + grpc_core::StaticMetadataSlice(&refcounts[46].base, 4, g_bytes + 769), 5), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[4].base, 7, g_bytes + 29), - grpc_core::StaticMetadataSlice(&refcounts[46].base, 5, g_bytes + 746), + grpc_core::StaticMetadataSlice(&refcounts[47].base, 5, g_bytes + 773), 6), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&refcounts[47].base, 3, g_bytes + 751), + grpc_core::StaticMetadataSlice(&refcounts[48].base, 3, g_bytes + 778), 7), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&refcounts[48].base, 3, g_bytes + 754), + grpc_core::StaticMetadataSlice(&refcounts[49].base, 3, g_bytes + 781), 8), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&refcounts[49].base, 3, g_bytes + 757), + grpc_core::StaticMetadataSlice(&refcounts[50].base, 3, g_bytes + 784), 9), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&refcounts[50].base, 3, g_bytes + 760), + grpc_core::StaticMetadataSlice(&refcounts[51].base, 3, g_bytes + 787), 10), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&refcounts[51].base, 3, g_bytes + 763), + grpc_core::StaticMetadataSlice(&refcounts[52].base, 3, g_bytes + 790), 11), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&refcounts[52].base, 3, g_bytes + 766), + grpc_core::StaticMetadataSlice(&refcounts[53].base, 3, g_bytes + 793), 12), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12), - grpc_core::StaticMetadataSlice(&refcounts[53].base, 3, g_bytes + 769), + grpc_core::StaticMetadataSlice(&refcounts[54].base, 3, g_bytes + 796), 13), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[54].base, 14, - g_bytes + 772), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[55].base, 14, + g_bytes + 799), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 14), StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[16].base, 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&refcounts[55].base, 13, - g_bytes + 786), + grpc_core::StaticMetadataSlice(&refcounts[56].base, 13, + g_bytes + 813), 15), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[56].base, 15, - g_bytes + 799), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[57].base, 15, + g_bytes + 826), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 16), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[57].base, 13, - g_bytes + 814), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[58].base, 13, + g_bytes + 841), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 17), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[58].base, 6, g_bytes + 827), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[59].base, 6, g_bytes + 854), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 18), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[59].base, 27, - g_bytes + 833), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[60].base, 27, + g_bytes + 860), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 19), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[60].base, 3, g_bytes + 860), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[61].base, 3, g_bytes + 887), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 20), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[61].base, 5, g_bytes + 863), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[62].base, 5, g_bytes + 890), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 21), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[62].base, 13, - g_bytes + 868), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[63].base, 13, + g_bytes + 895), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 22), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[63].base, 13, - g_bytes + 881), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[64].base, 13, + g_bytes + 908), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 23), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[64].base, 19, - g_bytes + 894), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[65].base, 19, + g_bytes + 921), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 24), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[15].base, 16, g_bytes + 170), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 25), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[65].base, 16, - g_bytes + 913), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[66].base, 16, + g_bytes + 940), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 26), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[66].base, 14, - g_bytes + 929), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[67].base, 14, + g_bytes + 956), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 27), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[67].base, 16, - g_bytes + 943), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[68].base, 16, + g_bytes + 970), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 28), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[68].base, 13, - g_bytes + 959), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[69].base, 13, + g_bytes + 986), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 29), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[14].base, 12, g_bytes + 158), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 30), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[69].base, 6, g_bytes + 972), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[70].base, 6, g_bytes + 999), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 31), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[70].base, 4, g_bytes + 978), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[71].base, 4, + g_bytes + 1005), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 32), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[71].base, 4, g_bytes + 982), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[72].base, 4, + g_bytes + 1009), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 33), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[72].base, 6, g_bytes + 986), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[73].base, 6, + g_bytes + 1013), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 34), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[73].base, 7, g_bytes + 992), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[74].base, 7, + g_bytes + 1019), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 35), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[74].base, 4, g_bytes + 999), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[75].base, 4, + g_bytes + 1026), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 36), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[20].base, 4, g_bytes + 278), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 37), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[75].base, 8, - g_bytes + 1003), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[76].base, 8, + g_bytes + 1030), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 38), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[76].base, 17, - g_bytes + 1011), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[77].base, 17, + g_bytes + 1038), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 39), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[77].base, 13, - g_bytes + 1028), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[78].base, 13, + g_bytes + 1055), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 40), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[78].base, 8, - g_bytes + 1041), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[79].base, 8, + g_bytes + 1068), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 41), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[79].base, 19, - g_bytes + 1049), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[80].base, 19, + g_bytes + 1076), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 42), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[80].base, 13, - g_bytes + 1068), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[81].base, 13, + g_bytes + 1095), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 43), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[81].base, 4, - g_bytes + 1081), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[82].base, 4, + g_bytes + 1108), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 44), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[82].base, 8, - g_bytes + 1085), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[83].base, 8, + g_bytes + 1112), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 45), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[83].base, 12, - g_bytes + 1093), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[84].base, 12, + g_bytes + 1120), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 46), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[84].base, 18, - g_bytes + 1105), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[85].base, 18, + g_bytes + 1132), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 47), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[85].base, 19, - g_bytes + 1123), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[86].base, 19, + g_bytes + 1150), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 48), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[86].base, 5, - g_bytes + 1142), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[87].base, 5, + g_bytes + 1169), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 49), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[87].base, 7, - g_bytes + 1147), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[88].base, 7, + g_bytes + 1174), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 50), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[88].base, 7, - g_bytes + 1154), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[89].base, 7, + g_bytes + 1181), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 51), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[89].base, 11, - g_bytes + 1161), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[90].base, 11, + g_bytes + 1188), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 52), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[90].base, 6, - g_bytes + 1172), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[91].base, 6, + g_bytes + 1199), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 53), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[91].base, 10, - g_bytes + 1178), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[92].base, 10, + g_bytes + 1205), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 54), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[92].base, 25, - g_bytes + 1188), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[93].base, 25, + g_bytes + 1215), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 55), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[93].base, 17, - g_bytes + 1213), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[94].base, 17, + g_bytes + 1240), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 56), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[19].base, 10, g_bytes + 268), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 57), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[94].base, 4, - g_bytes + 1230), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[95].base, 4, + g_bytes + 1257), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 58), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[95].base, 3, - g_bytes + 1234), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[96].base, 3, + g_bytes + 1261), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 59), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[96].base, 16, - g_bytes + 1237), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[97].base, 16, + g_bytes + 1264), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 60), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[7].base, 11, g_bytes + 50), - grpc_core::StaticMetadataSlice(&refcounts[97].base, 1, - g_bytes + 1253), + grpc_core::StaticMetadataSlice(&refcounts[98].base, 1, + g_bytes + 1280), 61), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[7].base, 11, g_bytes + 50), - grpc_core::StaticMetadataSlice(&refcounts[24].base, 1, g_bytes + 342), + grpc_core::StaticMetadataSlice(&refcounts[25].base, 1, g_bytes + 369), 62), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[7].base, 11, g_bytes + 50), - grpc_core::StaticMetadataSlice(&refcounts[25].base, 1, g_bytes + 343), + grpc_core::StaticMetadataSlice(&refcounts[26].base, 1, g_bytes + 370), 63), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[9].base, 13, g_bytes + 77), - grpc_core::StaticMetadataSlice(&refcounts[98].base, 8, - g_bytes + 1254), + grpc_core::StaticMetadataSlice(&refcounts[99].base, 8, + g_bytes + 1281), 64), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[9].base, 13, g_bytes + 77), - grpc_core::StaticMetadataSlice(&refcounts[39].base, 4, g_bytes + 708), + grpc_core::StaticMetadataSlice(&refcounts[40].base, 4, g_bytes + 735), 65), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[9].base, 13, g_bytes + 77), - grpc_core::StaticMetadataSlice(&refcounts[38].base, 7, g_bytes + 701), + grpc_core::StaticMetadataSlice(&refcounts[39].base, 7, g_bytes + 728), 66), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[5].base, 2, g_bytes + 36), - grpc_core::StaticMetadataSlice(&refcounts[99].base, 8, - g_bytes + 1262), + grpc_core::StaticMetadataSlice(&refcounts[100].base, 8, + g_bytes + 1289), 67), StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[14].base, 12, g_bytes + 158), - grpc_core::StaticMetadataSlice(&refcounts[100].base, 16, - g_bytes + 1270), + grpc_core::StaticMetadataSlice(&refcounts[101].base, 16, + g_bytes + 1297), 68), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[4].base, 7, g_bytes + 29), - grpc_core::StaticMetadataSlice(&refcounts[101].base, 4, - g_bytes + 1286), + grpc_core::StaticMetadataSlice(&refcounts[102].base, 4, + g_bytes + 1313), 69), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[1].base, 7, g_bytes + 5), - grpc_core::StaticMetadataSlice(&refcounts[102].base, 3, - g_bytes + 1290), + grpc_core::StaticMetadataSlice(&refcounts[103].base, 3, + g_bytes + 1317), 70), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[16].base, 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 71), StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[15].base, 16, g_bytes + 170), - grpc_core::StaticMetadataSlice(&refcounts[98].base, 8, - g_bytes + 1254), + grpc_core::StaticMetadataSlice(&refcounts[99].base, 8, + g_bytes + 1281), 72), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[15].base, 16, g_bytes + 170), - grpc_core::StaticMetadataSlice(&refcounts[39].base, 4, g_bytes + 708), + grpc_core::StaticMetadataSlice(&refcounts[40].base, 4, g_bytes + 735), 73), StaticMetadata( - grpc_core::StaticMetadataSlice(&refcounts[103].base, 11, - g_bytes + 1293), - grpc_core::StaticMetadataSlice(&refcounts[28].base, 0, g_bytes + 346), + grpc_core::StaticMetadataSlice(&refcounts[104].base, 11, + g_bytes + 1320), + grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373), 74), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&refcounts[98].base, 8, - g_bytes + 1254), + grpc_core::StaticMetadataSlice(&refcounts[99].base, 8, + g_bytes + 1281), 75), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&refcounts[38].base, 7, g_bytes + 701), + grpc_core::StaticMetadataSlice(&refcounts[39].base, 7, g_bytes + 728), 76), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&refcounts[104].base, 16, - g_bytes + 1304), + grpc_core::StaticMetadataSlice(&refcounts[105].base, 16, + g_bytes + 1331), 77), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&refcounts[39].base, 4, g_bytes + 708), + grpc_core::StaticMetadataSlice(&refcounts[40].base, 4, g_bytes + 735), 78), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&refcounts[105].base, 13, - g_bytes + 1320), + grpc_core::StaticMetadataSlice(&refcounts[106].base, 13, + g_bytes + 1347), 79), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&refcounts[106].base, 12, - g_bytes + 1333), + grpc_core::StaticMetadataSlice(&refcounts[107].base, 12, + g_bytes + 1360), 80), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90), - grpc_core::StaticMetadataSlice(&refcounts[107].base, 21, - g_bytes + 1345), + grpc_core::StaticMetadataSlice(&refcounts[108].base, 21, + g_bytes + 1372), 81), StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[16].base, 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&refcounts[98].base, 8, - g_bytes + 1254), + grpc_core::StaticMetadataSlice(&refcounts[99].base, 8, + g_bytes + 1281), 82), StaticMetadata( grpc_core::StaticMetadataSlice(&refcounts[16].base, 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&refcounts[39].base, 4, g_bytes + 708), + grpc_core::StaticMetadataSlice(&refcounts[40].base, 4, g_bytes + 735), 83), StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[16].base, 15, g_bytes + 186), - grpc_core::StaticMetadataSlice(&refcounts[105].base, 13, - g_bytes + 1320), + grpc_core::StaticMetadataSlice(&refcounts[106].base, 13, + g_bytes + 1347), 84), }; @@ -1181,17 +1189,17 @@ uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8, 2, 4, 4}; static const int8_t elems_r[] = { - 15, 10, -8, 0, 2, -43, -80, -44, 0, 4, -8, 0, 0, 0, 6, -1, - -8, 0, 0, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -65, 0, -68, -69, -50, -72, -73, 0, 32, 31, - 30, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 17, - 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 4, 3, - 3, 7, 0, 0, 0, 0, 0, 0, -5, 0}; + 15, 10, -8, 0, 2, -43, -81, -44, 0, 4, -8, 0, 0, 0, 6, -1, + -8, 0, 0, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -67, 0, -38, -50, -56, -76, 0, 46, 28, + 27, 26, 25, 24, 23, 23, 22, 21, 20, 19, 24, 16, 15, 14, 13, 15, + 14, 14, 13, 12, 11, 10, 9, 8, 7, 6, 6, 5, 4, 3, 2, 3, + 2, 2, 6, 0, 0, 0, 0, 0, 0, -6, 0}; static uint32_t elems_phash(uint32_t i) { - i -= 43; - uint32_t x = i % 106; - uint32_t y = i / 106; + i -= 44; + uint32_t x = i % 107; + uint32_t y = i / 107; uint32_t h = x; if (y < GPR_ARRAY_SIZE(elems_r)) { uint32_t delta = (uint32_t)elems_r[y]; @@ -1201,29 +1209,31 @@ static uint32_t elems_phash(uint32_t i) { } static const uint16_t elem_keys[] = { - 263, 264, 265, 266, 267, 268, 269, 1118, 1119, 1756, 149, 150, - 477, 478, 1648, 43, 44, 1010, 1011, 1540, 1767, 780, 781, 639, - 853, 1659, 2080, 2188, 5860, 6076, 6184, 6400, 6508, 6616, 6724, 6832, - 1783, 6940, 7048, 7156, 7264, 7372, 7480, 7588, 7696, 7804, 7912, 8020, - 8128, 8236, 8344, 6292, 8452, 8560, 8668, 8776, 8884, 8992, 9100, 9208, - 9316, 9424, 9532, 9640, 9748, 9856, 9964, 1178, 533, 10072, 10180, 210, - 10288, 1184, 1185, 1186, 1187, 1070, 10396, 1826, 11152, 0, 0, 0, - 1718, 0, 1833, 0, 0, 352, 0, 1612, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0}; + 266, 267, 268, 269, 270, 271, 272, 1129, 1130, 1773, 151, + 152, 482, 483, 1664, 44, 45, 1020, 1021, 1555, 1784, 788, + 789, 645, 861, 1675, 2100, 2209, 6024, 6569, 6787, 6896, 7005, + 7114, 7223, 7332, 1800, 7441, 7550, 7659, 7768, 7877, 8095, 8204, + 8313, 8422, 6678, 6460, 7986, 8531, 8640, 6351, 8749, 8858, 8967, + 9076, 9185, 9294, 9403, 9512, 9621, 6242, 9730, 9839, 9948, 10057, + 10166, 1189, 538, 10275, 10384, 212, 10493, 1195, 1196, 1197, 1198, + 1080, 10602, 1843, 11365, 0, 0, 0, 1734, 0, 1850, 0, + 0, 0, 356, 1627, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0}; static const uint8_t elem_idxs[] = { - 7, 8, 9, 10, 11, 12, 13, 76, 78, 71, 1, 2, 5, 6, 25, 3, - 4, 66, 65, 30, 83, 62, 63, 67, 61, 73, 57, 37, 14, 16, 17, 19, - 20, 21, 22, 23, 15, 24, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, - 38, 39, 40, 18, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 75, 69, 56, 58, 70, 59, 77, 79, 80, 81, 64, 60, 82, - 74, 255, 255, 255, 72, 255, 84, 255, 255, 0, 255, 68}; + 7, 8, 9, 10, 11, 12, 13, 76, 78, 71, 1, 2, 5, 6, 25, 3, + 4, 66, 65, 30, 83, 62, 63, 67, 61, 73, 57, 37, 14, 19, 21, 22, + 23, 24, 26, 27, 15, 28, 29, 31, 32, 33, 35, 36, 38, 39, 20, 18, + 34, 40, 41, 17, 42, 43, 44, 45, 46, 47, 48, 49, 50, 16, 51, 52, + 53, 54, 55, 75, 69, 56, 58, 70, 59, 77, 79, 80, 81, 64, 60, 82, + 74, 255, 255, 255, 72, 255, 84, 255, 255, 255, 0, 68}; grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b) { if (a == -1 || b == -1) return GRPC_MDNULL; - uint32_t k = static_cast(a * 108 + b); + uint32_t k = static_cast(a * 109 + b); uint32_t h = elems_phash(k); return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k && elem_idxs[h] != 255 diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index c465a2f37b7..391c6a7c4ab 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -36,7 +36,7 @@ static_assert( std::is_trivially_destructible::value, "grpc_core::StaticMetadataSlice must be trivially destructible."); -#define GRPC_STATIC_MDSTR_COUNT 108 +#define GRPC_STATIC_MDSTR_COUNT 109 void grpc_init_static_metadata_ctx(void); void grpc_destroy_static_metadata_ctx(void); @@ -102,185 +102,187 @@ inline const grpc_core::StaticMetadataSlice* grpc_static_slice_table() { #define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS (grpc_static_slice_table()[21]) /* "grpc-retry-pushback-ms" */ #define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS (grpc_static_slice_table()[22]) +/* "x-endpoint-load-metrics-bin" */ +#define GRPC_MDSTR_X_ENDPOINT_LOAD_METRICS_BIN (grpc_static_slice_table()[23]) /* "grpc-timeout" */ -#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table()[23]) +#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table()[24]) /* "1" */ -#define GRPC_MDSTR_1 (grpc_static_slice_table()[24]) +#define GRPC_MDSTR_1 (grpc_static_slice_table()[25]) /* "2" */ -#define GRPC_MDSTR_2 (grpc_static_slice_table()[25]) +#define GRPC_MDSTR_2 (grpc_static_slice_table()[26]) /* "3" */ -#define GRPC_MDSTR_3 (grpc_static_slice_table()[26]) +#define GRPC_MDSTR_3 (grpc_static_slice_table()[27]) /* "4" */ -#define GRPC_MDSTR_4 (grpc_static_slice_table()[27]) +#define GRPC_MDSTR_4 (grpc_static_slice_table()[28]) /* "" */ -#define GRPC_MDSTR_EMPTY (grpc_static_slice_table()[28]) +#define GRPC_MDSTR_EMPTY (grpc_static_slice_table()[29]) /* "grpc.wait_for_ready" */ -#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table()[29]) +#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table()[30]) /* "grpc.timeout" */ -#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table()[30]) +#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table()[31]) /* "grpc.max_request_message_bytes" */ #define GRPC_MDSTR_GRPC_DOT_MAX_REQUEST_MESSAGE_BYTES \ - (grpc_static_slice_table()[31]) + (grpc_static_slice_table()[32]) /* "grpc.max_response_message_bytes" */ #define GRPC_MDSTR_GRPC_DOT_MAX_RESPONSE_MESSAGE_BYTES \ - (grpc_static_slice_table()[32]) + (grpc_static_slice_table()[33]) /* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \ - (grpc_static_slice_table()[33]) + (grpc_static_slice_table()[34]) /* "/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats" */ #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS \ - (grpc_static_slice_table()[34]) + (grpc_static_slice_table()[35]) /* "/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints" */ #define GRPC_MDSTR_SLASH_ENVOY_DOT_API_DOT_V2_DOT_ENDPOINTDISCOVERYSERVICE_SLASH_STREAMENDPOINTS \ - (grpc_static_slice_table()[35]) + (grpc_static_slice_table()[36]) /* "/grpc.health.v1.Health/Watch" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH \ - (grpc_static_slice_table()[36]) + (grpc_static_slice_table()[37]) /* "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources" */ #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \ - (grpc_static_slice_table()[37]) + (grpc_static_slice_table()[38]) /* "deflate" */ -#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table()[38]) +#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table()[39]) /* "gzip" */ -#define GRPC_MDSTR_GZIP (grpc_static_slice_table()[39]) +#define GRPC_MDSTR_GZIP (grpc_static_slice_table()[40]) /* "stream/gzip" */ -#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table()[40]) +#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table()[41]) /* "GET" */ -#define GRPC_MDSTR_GET (grpc_static_slice_table()[41]) +#define GRPC_MDSTR_GET (grpc_static_slice_table()[42]) /* "POST" */ -#define GRPC_MDSTR_POST (grpc_static_slice_table()[42]) +#define GRPC_MDSTR_POST (grpc_static_slice_table()[43]) /* "/" */ -#define GRPC_MDSTR_SLASH (grpc_static_slice_table()[43]) +#define GRPC_MDSTR_SLASH (grpc_static_slice_table()[44]) /* "/index.html" */ -#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table()[44]) +#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table()[45]) /* "http" */ -#define GRPC_MDSTR_HTTP (grpc_static_slice_table()[45]) +#define GRPC_MDSTR_HTTP (grpc_static_slice_table()[46]) /* "https" */ -#define GRPC_MDSTR_HTTPS (grpc_static_slice_table()[46]) +#define GRPC_MDSTR_HTTPS (grpc_static_slice_table()[47]) /* "200" */ -#define GRPC_MDSTR_200 (grpc_static_slice_table()[47]) +#define GRPC_MDSTR_200 (grpc_static_slice_table()[48]) /* "204" */ -#define GRPC_MDSTR_204 (grpc_static_slice_table()[48]) +#define GRPC_MDSTR_204 (grpc_static_slice_table()[49]) /* "206" */ -#define GRPC_MDSTR_206 (grpc_static_slice_table()[49]) +#define GRPC_MDSTR_206 (grpc_static_slice_table()[50]) /* "304" */ -#define GRPC_MDSTR_304 (grpc_static_slice_table()[50]) +#define GRPC_MDSTR_304 (grpc_static_slice_table()[51]) /* "400" */ -#define GRPC_MDSTR_400 (grpc_static_slice_table()[51]) +#define GRPC_MDSTR_400 (grpc_static_slice_table()[52]) /* "404" */ -#define GRPC_MDSTR_404 (grpc_static_slice_table()[52]) +#define GRPC_MDSTR_404 (grpc_static_slice_table()[53]) /* "500" */ -#define GRPC_MDSTR_500 (grpc_static_slice_table()[53]) +#define GRPC_MDSTR_500 (grpc_static_slice_table()[54]) /* "accept-charset" */ -#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table()[54]) +#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table()[55]) /* "gzip, deflate" */ -#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table()[55]) +#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table()[56]) /* "accept-language" */ -#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table()[56]) +#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table()[57]) /* "accept-ranges" */ -#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table()[57]) +#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table()[58]) /* "accept" */ -#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table()[58]) +#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table()[59]) /* "access-control-allow-origin" */ -#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table()[59]) +#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table()[60]) /* "age" */ -#define GRPC_MDSTR_AGE (grpc_static_slice_table()[60]) +#define GRPC_MDSTR_AGE (grpc_static_slice_table()[61]) /* "allow" */ -#define GRPC_MDSTR_ALLOW (grpc_static_slice_table()[61]) +#define GRPC_MDSTR_ALLOW (grpc_static_slice_table()[62]) /* "authorization" */ -#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table()[62]) +#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table()[63]) /* "cache-control" */ -#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table()[63]) +#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table()[64]) /* "content-disposition" */ -#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table()[64]) +#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table()[65]) /* "content-language" */ -#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table()[65]) +#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table()[66]) /* "content-length" */ -#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table()[66]) +#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table()[67]) /* "content-location" */ -#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table()[67]) +#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table()[68]) /* "content-range" */ -#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table()[68]) +#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table()[69]) /* "cookie" */ -#define GRPC_MDSTR_COOKIE (grpc_static_slice_table()[69]) +#define GRPC_MDSTR_COOKIE (grpc_static_slice_table()[70]) /* "date" */ -#define GRPC_MDSTR_DATE (grpc_static_slice_table()[70]) +#define GRPC_MDSTR_DATE (grpc_static_slice_table()[71]) /* "etag" */ -#define GRPC_MDSTR_ETAG (grpc_static_slice_table()[71]) +#define GRPC_MDSTR_ETAG (grpc_static_slice_table()[72]) /* "expect" */ -#define GRPC_MDSTR_EXPECT (grpc_static_slice_table()[72]) +#define GRPC_MDSTR_EXPECT (grpc_static_slice_table()[73]) /* "expires" */ -#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table()[73]) +#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table()[74]) /* "from" */ -#define GRPC_MDSTR_FROM (grpc_static_slice_table()[74]) +#define GRPC_MDSTR_FROM (grpc_static_slice_table()[75]) /* "if-match" */ -#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table()[75]) +#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table()[76]) /* "if-modified-since" */ -#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table()[76]) +#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table()[77]) /* "if-none-match" */ -#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table()[77]) +#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table()[78]) /* "if-range" */ -#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table()[78]) +#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table()[79]) /* "if-unmodified-since" */ -#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table()[79]) +#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table()[80]) /* "last-modified" */ -#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table()[80]) +#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table()[81]) /* "link" */ -#define GRPC_MDSTR_LINK (grpc_static_slice_table()[81]) +#define GRPC_MDSTR_LINK (grpc_static_slice_table()[82]) /* "location" */ -#define GRPC_MDSTR_LOCATION (grpc_static_slice_table()[82]) +#define GRPC_MDSTR_LOCATION (grpc_static_slice_table()[83]) /* "max-forwards" */ -#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table()[83]) +#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table()[84]) /* "proxy-authenticate" */ -#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table()[84]) +#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table()[85]) /* "proxy-authorization" */ -#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table()[85]) +#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table()[86]) /* "range" */ -#define GRPC_MDSTR_RANGE (grpc_static_slice_table()[86]) +#define GRPC_MDSTR_RANGE (grpc_static_slice_table()[87]) /* "referer" */ -#define GRPC_MDSTR_REFERER (grpc_static_slice_table()[87]) +#define GRPC_MDSTR_REFERER (grpc_static_slice_table()[88]) /* "refresh" */ -#define GRPC_MDSTR_REFRESH (grpc_static_slice_table()[88]) +#define GRPC_MDSTR_REFRESH (grpc_static_slice_table()[89]) /* "retry-after" */ -#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table()[89]) +#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table()[90]) /* "server" */ -#define GRPC_MDSTR_SERVER (grpc_static_slice_table()[90]) +#define GRPC_MDSTR_SERVER (grpc_static_slice_table()[91]) /* "set-cookie" */ -#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table()[91]) +#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table()[92]) /* "strict-transport-security" */ -#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table()[92]) +#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table()[93]) /* "transfer-encoding" */ -#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table()[93]) +#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table()[94]) /* "vary" */ -#define GRPC_MDSTR_VARY (grpc_static_slice_table()[94]) +#define GRPC_MDSTR_VARY (grpc_static_slice_table()[95]) /* "via" */ -#define GRPC_MDSTR_VIA (grpc_static_slice_table()[95]) +#define GRPC_MDSTR_VIA (grpc_static_slice_table()[96]) /* "www-authenticate" */ -#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table()[96]) +#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table()[97]) /* "0" */ -#define GRPC_MDSTR_0 (grpc_static_slice_table()[97]) +#define GRPC_MDSTR_0 (grpc_static_slice_table()[98]) /* "identity" */ -#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table()[98]) +#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table()[99]) /* "trailers" */ -#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table()[99]) +#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table()[100]) /* "application/grpc" */ -#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table()[100]) +#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table()[101]) /* "grpc" */ -#define GRPC_MDSTR_GRPC (grpc_static_slice_table()[101]) +#define GRPC_MDSTR_GRPC (grpc_static_slice_table()[102]) /* "PUT" */ -#define GRPC_MDSTR_PUT (grpc_static_slice_table()[102]) +#define GRPC_MDSTR_PUT (grpc_static_slice_table()[103]) /* "lb-cost-bin" */ -#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table()[103]) +#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table()[104]) /* "identity,deflate" */ -#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table()[104]) +#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table()[105]) /* "identity,gzip" */ -#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table()[105]) +#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table()[106]) /* "deflate,gzip" */ -#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table()[106]) +#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table()[107]) /* "identity,deflate,gzip" */ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (grpc_static_slice_table()[107]) + (grpc_static_slice_table()[108]) namespace grpc_core { struct StaticSliceRefcount; @@ -538,6 +540,7 @@ typedef enum { GRPC_BATCH_HOST, GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS, GRPC_BATCH_GRPC_RETRY_PUSHBACK_MS, + GRPC_BATCH_X_ENDPOINT_LOAD_METRICS_BIN, GRPC_BATCH_CALLOUTS_COUNT } grpc_metadata_batch_callouts_index; @@ -567,6 +570,7 @@ typedef union { struct grpc_linked_mdelem* host; struct grpc_linked_mdelem* grpc_previous_rpc_attempts; struct grpc_linked_mdelem* grpc_retry_pushback_ms; + struct grpc_linked_mdelem* x_endpoint_load_metrics_bin; } named; } grpc_metadata_batch_callouts; diff --git a/src/proto/grpc/lb/v2/BUILD b/src/proto/grpc/lb/v2/BUILD index e47f170e14b..25b3dd3644a 100644 --- a/src/proto/grpc/lb/v2/BUILD +++ b/src/proto/grpc/lb/v2/BUILD @@ -39,3 +39,10 @@ grpc_proto_library( well_known_protos = True, deps = ["eds_for_test_proto"], ) + +grpc_proto_library( + name = "orca_load_report_for_test_proto", + srcs = [ + "orca_load_report_for_test.proto", + ], +) diff --git a/src/proto/grpc/lb/v2/eds_for_test.proto b/src/proto/grpc/lb/v2/eds_for_test.proto index 3126095c92d..e5c4f606407 100644 --- a/src/proto/grpc/lb/v2/eds_for_test.proto +++ b/src/proto/grpc/lb/v2/eds_for_test.proto @@ -16,8 +16,12 @@ // the gRPC library; otherwise there can be duplicate definition problems if // users depend on both gRPC and Envoy. It can only be used by gRPC tests. // -// TODO(juanlishen): It's a workaround and should be removed once we have a -// clean solution to use protobuf and external proto files. +// TODO(juanlishen): This file is a hack to avoid a problem we're +// currently having where we can't depend on a proto file in an external +// repo due to bazel limitations. Once that's fixed, this should be +// removed. Until this, it should be used in the gRPC tests only, or else it +// will cause a conflict due to the same proto messages being defined in +// multiple files in the same binary. syntax = "proto3"; diff --git a/src/proto/grpc/lb/v2/lrs_for_test.proto b/src/proto/grpc/lb/v2/lrs_for_test.proto index 76c560a99cf..504b6e752ce 100644 --- a/src/proto/grpc/lb/v2/lrs_for_test.proto +++ b/src/proto/grpc/lb/v2/lrs_for_test.proto @@ -14,9 +14,12 @@ // This file contains the eds protocol and its dependency. // -// TODO(juanlishen): It's a workaround and should be removed once we have a -// clean solution to the circular dependency between the envoy data plane APIs -// and gRPC. We can't check in this file due to conflict with internal code. +// TODO(juanlishen): This file is a hack to avoid a problem we're +// currently having where we can't depend on a proto file in an external +// repo due to bazel limitations. Once that's fixed, this should be +// removed. Until this, it should be used in the gRPC tests only, or else it +// will cause a conflict due to the same proto messages being defined in +// multiple files in the same binary. syntax = "proto3"; diff --git a/src/proto/grpc/lb/v2/orca_load_report_for_test.proto b/src/proto/grpc/lb/v2/orca_load_report_for_test.proto new file mode 100644 index 00000000000..1feaedd6a40 --- /dev/null +++ b/src/proto/grpc/lb/v2/orca_load_report_for_test.proto @@ -0,0 +1,58 @@ +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file contains a copy of the ORCA load reporting protos, with the +// validation options stripped out to avoid the extra dependency on +// protoc-gen-validate. +// +// TODO(juanlishen): This file is a hack to avoid a problem we're +// currently having where we can't depend on a proto file in an external +// repo due to bazel limitations. Once that's fixed, this should be +// removed. Until this, it should be used in the gRPC tests only, or else it +// will cause a conflict due to the same proto messages being defined in +// multiple files in the same binary. + +syntax = "proto3"; + +package udpa.data.orca.v1; + +option java_outer_classname = "OrcaLoadReportProto"; +option java_multiple_files = true; +option java_package = "io.envoyproxy.udpa.data.orca.v1"; +option go_package = "v1"; + +// See section `ORCA load report format` of the design document in +// :ref:`https://github.com/envoyproxy/envoy/issues/6614`. + +message OrcaLoadReport { + // CPU utilization expressed as a fraction of available CPU resources. This + // should be derived from the latest sample or measurement. + double cpu_utilization = 1; + + // Memory utilization expressed as a fraction of available memory + // resources. This should be derived from the latest sample or measurement. + double mem_utilization = 2; + + // Total RPS being served by an endpoint. This should cover all services that an endpoint is + // responsible for. + uint64 rps = 3; + + // Application specific requests costs. Each value is an absolute cost (e.g. 3487 bytes of + // storage) associated with the request. + map request_cost = 4; + + // Resource utilization values. Each value is expressed as a fraction of total resources + // available, derived from the latest sample or measurement. + map utilization = 5; +} diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 607235556e3..6eb8bc8c9c1 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -322,6 +322,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', + 'src/core/ext/filters/client_channel/backend_metric.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -350,6 +351,19 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/subchannel_pool_interface.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c', + 'src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c', + 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', + 'src/core/ext/upb-generated/validate/validate.upb.c', + 'src/core/ext/upb-generated/google/api/annotations.upb.c', + 'src/core/ext/upb-generated/google/api/http.upb.c', + 'src/core/ext/upb-generated/google/protobuf/any.upb.c', + 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', + 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', + 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', + 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', + 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', + 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', + 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/tsi/fake_transport_security.cc', 'src/core/tsi/local_transport_security.cc', 'src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc', @@ -369,16 +383,6 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc', 'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc', 'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c', - 'src/core/ext/upb-generated/google/api/annotations.upb.c', - 'src/core/ext/upb-generated/google/api/http.upb.c', - 'src/core/ext/upb-generated/google/protobuf/any.upb.c', - 'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c', - 'src/core/ext/upb-generated/google/protobuf/duration.upb.c', - 'src/core/ext/upb-generated/google/protobuf/empty.upb.c', - 'src/core/ext/upb-generated/google/protobuf/struct.upb.c', - 'src/core/ext/upb-generated/google/protobuf/timestamp.upb.c', - 'src/core/ext/upb-generated/google/protobuf/wrappers.upb.c', - 'src/core/ext/upb-generated/google/rpc/status.upb.c', 'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds.cc', 'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc', @@ -387,6 +391,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/cds.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/eds.upb.c', @@ -399,11 +404,10 @@ CORE_SOURCE_FILES = [ 'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c', + 'src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c', 'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c', 'src/core/ext/upb-generated/envoy/type/percent.upb.c', 'src/core/ext/upb-generated/envoy/type/range.upb.c', - 'src/core/ext/upb-generated/gogoproto/gogo.upb.c', - 'src/core/ext/upb-generated/validate/validate.upb.c', 'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc', diff --git a/test/core/end2end/fuzzers/hpack.dictionary b/test/core/end2end/fuzzers/hpack.dictionary index 921018db7f8..bc621ca2a11 100644 --- a/test/core/end2end/fuzzers/hpack.dictionary +++ b/test/core/end2end/fuzzers/hpack.dictionary @@ -22,6 +22,7 @@ "\x04host" "\x1Agrpc-previous-rpc-attempts" "\x16grpc-retry-pushback-ms" +"\x1Bx-endpoint-load-metrics-bin" "\x0Cgrpc-timeout" "\x011" "\x012" diff --git a/test/core/util/test_lb_policies.cc b/test/core/util/test_lb_policies.cc index 6225740cde7..d4ce3a27e50 100644 --- a/test/core/util/test_lb_policies.cc +++ b/test/core/util/test_lb_policies.cc @@ -191,7 +191,7 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy gpr_log(GPR_INFO, "trailing metadata:"); InterceptRecvTrailingMetadataLoadBalancingPolicy::LogMetadata( recv_trailing_metadata); - self->cb_(self->user_data_); + self->cb_(self->user_data_, call_state->GetBackendMetricData()); self->~TrailingMetadataHandler(); } diff --git a/test/core/util/test_lb_policies.h b/test/core/util/test_lb_policies.h index 6d2693a0d59..3652515e57e 100644 --- a/test/core/util/test_lb_policies.h +++ b/test/core/util/test_lb_policies.h @@ -19,9 +19,12 @@ #ifndef GRPC_TEST_CORE_UTIL_TEST_LB_POLICIES_H #define GRPC_TEST_CORE_UTIL_TEST_LB_POLICIES_H +#include "src/core/ext/filters/client_channel/lb_policy.h" + namespace grpc_core { -typedef void (*InterceptRecvTrailingMetadataCallback)(void*); +typedef void (*InterceptRecvTrailingMetadataCallback)( + void*, const LoadBalancingPolicy::BackendMetricData*); // Registers an LB policy called "intercept_trailing_metadata_lb" that // invokes cb with argument user_data when trailing metadata is received diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index 5567170d371..1b487602a7a 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -433,6 +433,7 @@ grpc_cc_test( "//:gpr", "//:grpc", "//:grpc++", + "//src/proto/grpc/lb/v2:orca_load_report_for_test_proto", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index ceab7506729..69feb4a5d51 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -51,6 +51,7 @@ #include "src/cpp/client/secure_credentials.h" #include "src/cpp/server/secure_server_credentials.h" +#include "src/proto/grpc/lb/v2/orca_load_report_for_test.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -94,15 +95,21 @@ grpc_tcp_client_vtable delayed_connect = {tcp_client_connect_with_delay}; // every call to the Echo RPC. class MyTestServiceImpl : public TestServiceImpl { public: - MyTestServiceImpl() : request_count_(0) {} - Status Echo(ServerContext* context, const EchoRequest* request, EchoResponse* response) override { + const udpa::data::orca::v1::OrcaLoadReport* load_report = nullptr; { grpc::internal::MutexLock lock(&mu_); ++request_count_; + load_report = load_report_; } AddClient(context->peer()); + if (load_report != nullptr) { + // TODO(roth): Once we provide a more standard server-side API for + // populating this data, use that API here. + context->AddTrailingMetadata("x-endpoint-load-metrics-bin", + load_report->SerializeAsString()); + } return TestServiceImpl::Echo(context, request, response); } @@ -121,6 +128,11 @@ class MyTestServiceImpl : public TestServiceImpl { return clients_; } + void set_load_report(udpa::data::orca::v1::OrcaLoadReport* load_report) { + grpc::internal::MutexLock lock(&mu_); + load_report_ = load_report; + } + private: void AddClient(const grpc::string& client) { grpc::internal::MutexLock lock(&clients_mu_); @@ -128,7 +140,8 @@ class MyTestServiceImpl : public TestServiceImpl { } grpc::internal::Mutex mu_; - int request_count_; + int request_count_ = 0; + const udpa::data::orca::v1::OrcaLoadReport* load_report_ = nullptr; grpc::internal::Mutex clients_mu_; std::set clients_; }; @@ -1506,16 +1519,40 @@ class ClientLbInterceptTrailingMetadataTest : public ClientLbEnd2endTest { return trailers_intercepted_; } + const udpa::data::orca::v1::OrcaLoadReport* backend_load_report() { + grpc::internal::MutexLock lock(&mu_); + return load_report_.get(); + } + private: - static void ReportTrailerIntercepted(void* arg) { + static void ReportTrailerIntercepted( + void* arg, const grpc_core::LoadBalancingPolicy::BackendMetricData* + backend_metric_data) { ClientLbInterceptTrailingMetadataTest* self = static_cast(arg); grpc::internal::MutexLock lock(&self->mu_); self->trailers_intercepted_++; + if (backend_metric_data != nullptr) { + self->load_report_.reset(new udpa::data::orca::v1::OrcaLoadReport); + self->load_report_->set_cpu_utilization( + backend_metric_data->cpu_utilization); + self->load_report_->set_mem_utilization( + backend_metric_data->mem_utilization); + self->load_report_->set_rps(backend_metric_data->requests_per_second); + for (const auto& p : backend_metric_data->request_cost) { + grpc_core::UniquePtr name = p.first.dup(); + (*self->load_report_->mutable_request_cost())[name.get()] = p.second; + } + for (const auto& p : backend_metric_data->utilization) { + grpc_core::UniquePtr name = p.first.dup(); + (*self->load_report_->mutable_utilization())[name.get()] = p.second; + } + } } grpc::internal::Mutex mu_; int trailers_intercepted_ = 0; + std::unique_ptr load_report_; }; TEST_F(ClientLbInterceptTrailingMetadataTest, InterceptsRetriesDisabled) { @@ -1534,6 +1571,7 @@ TEST_F(ClientLbInterceptTrailingMetadataTest, InterceptsRetriesDisabled) { EXPECT_EQ("intercept_trailing_metadata_lb", channel->GetLoadBalancingPolicyName()); EXPECT_EQ(kNumRpcs, trailers_intercepted()); + EXPECT_EQ(nullptr, backend_load_report()); } TEST_F(ClientLbInterceptTrailingMetadataTest, InterceptsRetriesEnabled) { @@ -1568,6 +1606,57 @@ TEST_F(ClientLbInterceptTrailingMetadataTest, InterceptsRetriesEnabled) { EXPECT_EQ("intercept_trailing_metadata_lb", channel->GetLoadBalancingPolicyName()); EXPECT_EQ(kNumRpcs, trailers_intercepted()); + EXPECT_EQ(nullptr, backend_load_report()); +} + +TEST_F(ClientLbInterceptTrailingMetadataTest, BackendMetricData) { + const int kNumServers = 1; + const int kNumRpcs = 10; + StartServers(kNumServers); + udpa::data::orca::v1::OrcaLoadReport load_report; + load_report.set_cpu_utilization(0.5); + load_report.set_mem_utilization(0.75); + load_report.set_rps(25); + auto* request_cost = load_report.mutable_request_cost(); + (*request_cost)["foo"] = 0.8; + (*request_cost)["bar"] = 1.4; + auto* utilization = load_report.mutable_utilization(); + (*utilization)["baz"] = 1.1; + (*utilization)["quux"] = 0.9; + for (const auto& server : servers_) { + server->service_.set_load_report(&load_report); + } + auto response_generator = BuildResolverResponseGenerator(); + auto channel = + BuildChannel("intercept_trailing_metadata_lb", response_generator); + auto stub = BuildStub(channel); + response_generator.SetNextResolution(GetServersPorts()); + for (size_t i = 0; i < kNumRpcs; ++i) { + CheckRpcSendOk(stub, DEBUG_LOCATION); + auto* actual = backend_load_report(); + ASSERT_NE(actual, nullptr); + // TODO(roth): Change this to use EqualsProto() once that becomes + // available in OSS. + EXPECT_EQ(actual->cpu_utilization(), load_report.cpu_utilization()); + EXPECT_EQ(actual->mem_utilization(), load_report.mem_utilization()); + EXPECT_EQ(actual->rps(), load_report.rps()); + EXPECT_EQ(actual->request_cost().size(), load_report.request_cost().size()); + for (const auto& p : actual->request_cost()) { + auto it = load_report.request_cost().find(p.first); + ASSERT_NE(it, load_report.request_cost().end()); + EXPECT_EQ(it->second, p.second); + } + EXPECT_EQ(actual->utilization().size(), load_report.utilization().size()); + for (const auto& p : actual->utilization()) { + auto it = load_report.utilization().find(p.first); + ASSERT_NE(it, load_report.utilization().end()); + EXPECT_EQ(it->second, p.second); + } + } + // Check LB policy name for the channel. + EXPECT_EQ("intercept_trailing_metadata_lb", + channel->GetLoadBalancingPolicyName()); + EXPECT_EQ(kNumRpcs, trailers_intercepted()); } } // namespace diff --git a/third_party/envoy-api b/third_party/envoy-api index a83394157ad..c181f78882e 160000 --- a/third_party/envoy-api +++ b/third_party/envoy-api @@ -1 +1 @@ -Subproject commit a83394157ad97f4dadbc8ed81f56ad5b3a72e542 +Subproject commit c181f78882e54c0e5c63f332562ef6954ee7932f diff --git a/third_party/udpa b/third_party/udpa new file mode 160000 index 00000000000..94324803a49 --- /dev/null +++ b/third_party/udpa @@ -0,0 +1 @@ +Subproject commit 94324803a497c8f76dbc78df393ef629d3a9f3c3 diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index d79759f541c..4ac8f9dada7 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -56,6 +56,7 @@ CONFIG = [ '3', '4', '', + 'x-endpoint-load-metrics-bin', # channel arg keys 'grpc.wait_for_ready', 'grpc.timeout', @@ -177,6 +178,7 @@ METADATA_BATCH_CALLOUTS = [ 'host', 'grpc-previous-rpc-attempts', 'grpc-retry-pushback-ms', + 'x-endpoint-load-metrics-bin', ] COMPRESSION_ALGORITHMS = [ diff --git a/tools/codegen/core/gen_upb_api.sh b/tools/codegen/core/gen_upb_api.sh index 4a9239a2828..89e664e6134 100755 --- a/tools/codegen/core/gen_upb_api.sh +++ b/tools/codegen/core/gen_upb_api.sh @@ -41,12 +41,14 @@ proto_files=( \ "envoy/api/v2/auth/cert.proto" \ "envoy/api/v2/cds.proto" \ "envoy/api/v2/cluster/circuit_breaker.proto" \ + "envoy/api/v2/cluster/filter.proto" \ "envoy/api/v2/cluster/outlier_detection.proto" \ "envoy/api/v2/core/address.proto" \ "envoy/api/v2/core/base.proto" \ "envoy/api/v2/core/config_source.proto" \ "envoy/api/v2/core/grpc_service.proto" \ "envoy/api/v2/core/health_check.proto" \ + "envoy/api/v2/core/http_uri.proto" \ "envoy/api/v2/core/protocol.proto" \ "envoy/api/v2/discovery.proto" \ "envoy/api/v2/eds.proto" \ @@ -71,13 +73,15 @@ proto_files=( \ "src/proto/grpc/gcp/handshaker.proto" \ "src/proto/grpc/gcp/transport_security_common.proto" \ "src/proto/grpc/health/v1/health.proto" \ - "src/proto/grpc/health/v1/health.proto" \ "src/proto/grpc/lb/v1/load_balancer.proto" \ + "udpa/data/orca/v1/orca_load_report.proto" \ "validate/validate.proto") for i in "${proto_files[@]}" do + echo "Compiling: ${i}" $PROTOC \ + -I=$PWD/third_party/udpa \ -I=$PWD/third_party/envoy-api \ -I=$PWD/third_party/googleapis \ -I=$PWD/third_party/protobuf/src \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index e2900b2e701..ed6f88dde3c 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -875,6 +875,8 @@ src/core/README.md \ src/core/ext/README.md \ src/core/ext/filters/census/grpc_context.cc \ src/core/ext/filters/client_channel/README.md \ +src/core/ext/filters/client_channel/backend_metric.cc \ +src/core/ext/filters/client_channel/backend_metric.h \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/backup_poller.h \ src/core/ext/filters/client_channel/channel_connectivity.cc \ @@ -1065,6 +1067,8 @@ src/core/ext/upb-generated/envoy/api/v2/cds.upb.c \ src/core/ext/upb-generated/envoy/api/v2/cds.upb.h \ src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c \ src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h \ src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c \ src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h \ src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c \ @@ -1077,6 +1081,8 @@ src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c \ src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h \ src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c \ src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h \ +src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c \ +src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h \ src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c \ src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h \ src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c \ @@ -1127,6 +1133,8 @@ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h \ src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \ src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h \ +src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c \ +src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h \ src/core/ext/upb-generated/validate/validate.upb.c \ src/core/ext/upb-generated/validate/validate.upb.h \ src/core/lib/README.md \ diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index 39f3e26266c..8ad552cd399 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -32,7 +32,7 @@ cat << EOF | awk '{ print $1 }' | sort > "$want_submodules" b29b21a81b32ec273f118f589f46d56ad3332420 third_party/boringssl (remotes/origin/chromium-stable) afc30d43eef92979b05776ec0963c9cede5fb80f third_party/boringssl-with-bazel (fips-20180716-116-gafc30d43e) e982924acee7f7313b4baa4ee5ec000c5e373c30 third_party/cares/cares (cares-1_15_0) - a83394157ad97f4dadbc8ed81f56ad5b3a72e542 third_party/envoy-api (heads/master) + c181f78882e54c0e5c63f332562ef6954ee7932f third_party/envoy-api (heads/master) 28f50e0fed19872e0fd50dd23ce2ee8cd759338e third_party/gflags (v2.2.0-5-g30dbc81) 80ed4d0bbf65d57cc267dfc63bd2584557f11f9b third_party/googleapis (common-protos-1_3_1-915-g80ed4d0bb) c9ccac7cb7345901884aabf5d1a786cfa6e2f397 third_party/googletest (6e2f397) @@ -40,6 +40,7 @@ cat << EOF | awk '{ print $1 }' | sort > "$want_submodules" 9245d481eb3e890f708ff2d7dadf2a10c04748ba third_party/libcxxabi (heads/release_60) 09745575a923640154bcf307fba8aedff47f240a third_party/protobuf (v3.7.0-rc.2-247-g09745575) e143189bf6f37b3957fb31743df6a1bcf4a8c685 third_party/protoc-gen-validate (v0.0.10) + 94324803a497c8f76dbc78df393ef629d3a9f3c3 third_party/udpa (heads/master) 931bbecbd3230ae7f22efa5d203639facc47f719 third_party/upb (heads/master) cacf7f1d4e3d44d871b605da3b647f07d718623f third_party/zlib (v1.2.11) EOF From b46e3668d31a014c8ab72fbae63f52990051127a Mon Sep 17 00:00:00 2001 From: Arjun Roy Date: Tue, 20 Aug 2019 14:14:16 -0700 Subject: [PATCH 482/661] s/branch/tail_call/ for CH2 on_hdr(). on_hdr() checks if a void-return function pointer is null before jumping to it. If it is null, it returns an error; else it executes that function and returns success. This change converts the void-returning function to one that returns a grpc_error* and thus saves a branch in on_hdr() (since we're branching once by following the function pointer anyways, we're effectively coalescing these two branches). --- .../chttp2/transport/hpack_parser.cc | 49 +++++++++---------- .../transport/chttp2/transport/hpack_parser.h | 2 +- .../transport/chttp2/transport/hpack_table.cc | 21 ++++++-- .../transport/chttp2/transport/hpack_table.h | 15 ++++-- .../ext/transport/chttp2/transport/parsing.cc | 13 +++-- .../chttp2/hpack_parser_fuzzer_test.cc | 5 +- .../transport/chttp2/hpack_parser_test.cc | 3 +- test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 11 +++-- 8 files changed, 77 insertions(+), 42 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc index 7414fd7fff8..a5142ffd96f 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc @@ -655,12 +655,7 @@ static grpc_error* on_hdr(grpc_chttp2_hpack_parser* p, grpc_mdelem md) { grpc_error* err = grpc_chttp2_hptbl_add(&p->table, md); if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) return err; } - if (GPR_UNLIKELY(p->on_header == nullptr)) { - GRPC_MDELEM_UNREF(md); - return GRPC_ERROR_CREATE_FROM_STATIC_STRING("on_header callback not set"); - } - p->on_header(p->on_header_user_data, md); - return GRPC_ERROR_NONE; + return p->on_header(p->on_header_user_data, md); } static grpc_core::UnmanagedMemorySlice take_string_extern( @@ -765,23 +760,26 @@ static grpc_error* parse_stream_dep0(grpc_chttp2_hpack_parser* p, return parse_stream_dep1(p, cur + 1, end); } +static grpc_error* GPR_ATTRIBUTE_NOINLINE +on_invalid_hpack_idx(grpc_chttp2_hpack_parser* p) { + return grpc_error_set_int( + grpc_error_set_int( + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Invalid HPACK index received"), + GRPC_ERROR_INT_INDEX, static_cast(p->index)), + GRPC_ERROR_INT_SIZE, static_cast(p->table.num_ents)); +} + /* emit an indexed field; jumps to begin the next field on completion */ static grpc_error* finish_indexed_field(grpc_chttp2_hpack_parser* p, const uint8_t* cur, const uint8_t* end) { - grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index); - if (GRPC_MDISNULL(md)) { - return grpc_error_set_int( - grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING( - "Invalid HPACK index received"), - GRPC_ERROR_INT_INDEX, - static_cast(p->index)), - GRPC_ERROR_INT_SIZE, static_cast(p->table.num_ents)); + grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index); + if (GPR_UNLIKELY(GRPC_MDISNULL(md))) { + return on_invalid_hpack_idx(p); } - GRPC_MDELEM_REF(md); GRPC_STATS_INC_HPACK_RECV_INDEXED(); grpc_error* err = on_hdr(p, md); - if (err != GRPC_ERROR_NONE) return err; + if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) return err; return parse_begin(p, cur, end); } @@ -1557,13 +1555,8 @@ static void set_precomputed_md_idx(grpc_chttp2_hpack_parser* p, static grpc_error* is_binary_indexed_header(grpc_chttp2_hpack_parser* p, bool* is) { grpc_mdelem elem = grpc_chttp2_hptbl_lookup(&p->table, p->index); - if (GRPC_MDISNULL(elem)) { - return grpc_error_set_int( - grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING( - "Invalid HPACK index received"), - GRPC_ERROR_INT_INDEX, - static_cast(p->index)), - GRPC_ERROR_INT_SIZE, static_cast(p->table.num_ents)); + if (GPR_UNLIKELY(GRPC_MDISNULL(elem))) { + return on_invalid_hpack_idx(p); } /* We know that GRPC_MDKEY(elem) points to a reference counted slice since: * 1. elem was a result of grpc_chttp2_hptbl_lookup @@ -1599,10 +1592,16 @@ static grpc_error* parse_value_string_with_literal_key( return parse_value_string(p, cur, end, is_binary_literal_header(p)); } +/* "Uninitialized" header parser to save us a branch in on_hdr(). */ +static grpc_error* on_header_uninitialized(void* user_data, grpc_mdelem md) { + GRPC_MDELEM_UNREF(md); + return GRPC_ERROR_CREATE_FROM_STATIC_STRING("on_header callback not set"); +} + /* PUBLIC INTERFACE */ void grpc_chttp2_hpack_parser_init(grpc_chttp2_hpack_parser* p) { - p->on_header = nullptr; + p->on_header = on_header_uninitialized; p->on_header_user_data = nullptr; p->state = parse_begin; p->key.data.referenced = grpc_empty_slice(); @@ -1750,7 +1749,7 @@ grpc_error* grpc_chttp2_header_parser_parse(void* hpack_parser, grpc_chttp2_mark_stream_closed(t, s, true, false, GRPC_ERROR_NONE); } } - parser->on_header = nullptr; + parser->on_header = on_header_uninitialized; parser->on_header_user_data = nullptr; parser->is_boundary = 0xde; parser->is_eof = 0xde; diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.h b/src/core/ext/transport/chttp2/transport/hpack_parser.h index c5691244028..eb90568920c 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.h +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.h @@ -46,7 +46,7 @@ typedef struct { struct grpc_chttp2_hpack_parser { /* user specified callback for each header output */ - void (*on_header)(void* user_data, grpc_mdelem md); + grpc_error* (*on_header)(void* user_data, grpc_mdelem md); void* on_header_user_data; grpc_error* last_error; diff --git a/src/core/ext/transport/chttp2/transport/hpack_table.cc b/src/core/ext/transport/chttp2/transport/hpack_table.cc index 68d3ec49fda..be03110edcf 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_table.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_table.cc @@ -44,19 +44,34 @@ void grpc_chttp2_hptbl_destroy(grpc_chttp2_hptbl* tbl) { tbl->ents = nullptr; } -grpc_mdelem grpc_chttp2_hptbl_lookup_dynamic_index(const grpc_chttp2_hptbl* tbl, - uint32_t tbl_index) { +template +static grpc_mdelem lookup_dynamic_index(const grpc_chttp2_hptbl* tbl, + uint32_t tbl_index) { /* Not static - find the value in the list of valid entries */ tbl_index -= (GRPC_CHTTP2_LAST_STATIC_ENTRY + 1); if (tbl_index < tbl->num_ents) { uint32_t offset = (tbl->num_ents - 1u - tbl_index + tbl->first_ent) % tbl->cap_entries; - return tbl->ents[offset]; + grpc_mdelem md = tbl->ents[offset]; + if (take_ref) { + GRPC_MDELEM_REF(md); + } + return md; } /* Invalid entry: return error */ return GRPC_MDNULL; } +grpc_mdelem grpc_chttp2_hptbl_lookup_dynamic_index(const grpc_chttp2_hptbl* tbl, + uint32_t tbl_index) { + return lookup_dynamic_index(tbl, tbl_index); +} + +grpc_mdelem grpc_chttp2_hptbl_lookup_ref_dynamic_index( + const grpc_chttp2_hptbl* tbl, uint32_t tbl_index) { + return lookup_dynamic_index(tbl, tbl_index); +} + /* Evict one element from the table */ static void evict1(grpc_chttp2_hptbl* tbl) { grpc_mdelem first_ent = tbl->ents[tbl->first_ent]; diff --git a/src/core/ext/transport/chttp2/transport/hpack_table.h b/src/core/ext/transport/chttp2/transport/hpack_table.h index a1aa77f5446..5a6c739f07b 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_table.h +++ b/src/core/ext/transport/chttp2/transport/hpack_table.h @@ -95,6 +95,9 @@ grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl* tbl, /* lookup a table entry based on its hpack index */ grpc_mdelem grpc_chttp2_hptbl_lookup_dynamic_index(const grpc_chttp2_hptbl* tbl, uint32_t tbl_index); +grpc_mdelem grpc_chttp2_hptbl_lookup_ref_dynamic_index( + const grpc_chttp2_hptbl* tbl, uint32_t tbl_index); +template inline grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl, uint32_t index) { /* Static table comes first, just return an entry from it. @@ -103,9 +106,15 @@ inline grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl, must follow the hpack standard. If that changes, we *must* not rely on reading the core static metadata table here; at that point we'd need our own singleton static metadata in the correct order. */ - return index <= GRPC_CHTTP2_LAST_STATIC_ENTRY - ? grpc_static_mdelem_manifested()[index - 1] - : grpc_chttp2_hptbl_lookup_dynamic_index(tbl, index); + if (index <= GRPC_CHTTP2_LAST_STATIC_ENTRY) { + return grpc_static_mdelem_manifested()[index - 1]; + } else { + if (take_ref) { + return grpc_chttp2_hptbl_lookup_ref_dynamic_index(tbl, index); + } else { + return grpc_chttp2_hptbl_lookup_dynamic_index(tbl, index); + } + } } /* add a table entry to the index */ grpc_error* grpc_chttp2_hptbl_add(grpc_chttp2_hptbl* tbl, diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc index 2a2a8206cb6..a39f6e83db7 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.cc +++ b/src/core/ext/transport/chttp2/transport/parsing.cc @@ -318,7 +318,10 @@ static grpc_error* skip_parser(void* parser, grpc_chttp2_transport* t, return GRPC_ERROR_NONE; } -static void skip_header(void* tp, grpc_mdelem md) { GRPC_MDELEM_UNREF(md); } +static grpc_error* skip_header(void* tp, grpc_mdelem md) { + GRPC_MDELEM_UNREF(md); + return GRPC_ERROR_NONE; +} static grpc_error* init_skip_frame_parser(grpc_chttp2_transport* t, int is_header) { @@ -419,7 +422,7 @@ static bool is_nonzero_status(grpc_mdelem md) { !md_cmp(md, GRPC_MDELEM_GRPC_STATUS_0, GRPC_MDSTR_GRPC_STATUS); } -static void on_initial_header(void* tp, grpc_mdelem md) { +static grpc_error* on_initial_header(void* tp, grpc_mdelem md) { GPR_TIMER_SCOPE("on_initial_header", 0); grpc_chttp2_transport* t = static_cast(tp); @@ -465,7 +468,7 @@ static void on_initial_header(void* tp, grpc_mdelem md) { &s->metadata_buffer[0], grpc_core::ExecCtx::Get()->Now() + timeout); } GRPC_MDELEM_UNREF(md); - return; + return GRPC_ERROR_NONE; } const size_t new_size = s->metadata_buffer[0].size + GRPC_MDELEM_LENGTH(md); @@ -496,9 +499,10 @@ static void on_initial_header(void* tp, grpc_mdelem md) { GRPC_MDELEM_UNREF(md); } } + return GRPC_ERROR_NONE; } -static void on_trailing_header(void* tp, grpc_mdelem md) { +static grpc_error* on_trailing_header(void* tp, grpc_mdelem md) { GPR_TIMER_SCOPE("on_trailing_header", 0); grpc_chttp2_transport* t = static_cast(tp); @@ -547,6 +551,7 @@ static void on_trailing_header(void* tp, grpc_mdelem md) { GRPC_MDELEM_UNREF(md); } } + return GRPC_ERROR_NONE; } static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t, diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc index a8eec1eefd6..9c6ae5da7bb 100644 --- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc +++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc @@ -30,7 +30,10 @@ bool squelch = true; bool leak_check = true; -static void onhdr(void* ud, grpc_mdelem md) { GRPC_MDELEM_UNREF(md); } +static grpc_error* onhdr(void* ud, grpc_mdelem md) { + GRPC_MDELEM_UNREF(md); + return GRPC_ERROR_NONE; +} static void dont_log(gpr_log_func_args* args) {} extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { diff --git a/test/core/transport/chttp2/hpack_parser_test.cc b/test/core/transport/chttp2/hpack_parser_test.cc index 8be7dc17ed1..4782d484d1b 100644 --- a/test/core/transport/chttp2/hpack_parser_test.cc +++ b/test/core/transport/chttp2/hpack_parser_test.cc @@ -34,7 +34,7 @@ typedef struct { va_list args; } test_checker; -static void onhdr(void* ud, grpc_mdelem md) { +static grpc_error* onhdr(void* ud, grpc_mdelem md) { const char *ekey, *evalue; test_checker* chk = static_cast(ud); ekey = va_arg(chk->args, char*); @@ -44,6 +44,7 @@ static void onhdr(void* ud, grpc_mdelem md) { GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDKEY(md), ekey) == 0); GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDVALUE(md), evalue) == 0); GRPC_MDELEM_UNREF(md); + return GRPC_ERROR_NONE; } static void test_vector(grpc_chttp2_hpack_parser* parser, diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 4950e7f7768..86d5d2de14c 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -450,11 +450,12 @@ static void BM_HpackParserInitDestroy(benchmark::State& state) { } BENCHMARK(BM_HpackParserInitDestroy); -static void UnrefHeader(void* user_data, grpc_mdelem md) { +static grpc_error* UnrefHeader(void* user_data, grpc_mdelem md) { GRPC_MDELEM_UNREF(md); + return GRPC_ERROR_NONE; } -template +template static void BM_HpackParserParseHeader(benchmark::State& state) { TrackCounters track_counters; grpc_core::ExecCtx exec_ctx; @@ -781,7 +782,7 @@ class RepresentativeServerTrailingMetadata { static void free_timeout(void* p) { gpr_free(p); } // Benchmark the current on_initial_header implementation -static void OnInitialHeader(void* user_data, grpc_mdelem md) { +static grpc_error* OnInitialHeader(void* user_data, grpc_mdelem md) { // Setup for benchmark. This will bloat the absolute values of this benchmark grpc_chttp2_incoming_metadata_buffer buffer( static_cast(user_data)); @@ -827,10 +828,11 @@ static void OnInitialHeader(void* user_data, grpc_mdelem md) { GPR_ASSERT(0); } } + return GRPC_ERROR_NONE; } // Benchmark timeout handling -static void OnHeaderTimeout(void* user_data, grpc_mdelem md) { +static grpc_error* OnHeaderTimeout(void* user_data, grpc_mdelem md) { if (grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDSTR_GRPC_TIMEOUT)) { grpc_millis* cached_timeout = static_cast(grpc_mdelem_get_user_data(md, free_timeout)); @@ -858,6 +860,7 @@ static void OnHeaderTimeout(void* user_data, grpc_mdelem md) { } else { GPR_ASSERT(0); } + return GRPC_ERROR_NONE; } // Send the same deadline repeatedly From 96c11d153ff2247293bef1896aa5cc9496335950 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 28 Aug 2019 13:35:40 -0700 Subject: [PATCH 483/661] Revert "Revert #19704 and #20060" --- bazel/grpc_build_system.bzl | 11 +- gRPC-ProtoRPC.podspec | 30 +- gRPC-RxLibrary.podspec | 17 + gRPC.podspec | 116 ++- src/compiler/objective_c_generator.cc | 97 +- src/compiler/objective_c_generator.h | 14 +- src/compiler/objective_c_plugin.cc | 60 +- src/objective-c/BUILD | 244 +++-- .../GRPCClient/GRPCCall+ChannelArg.h | 2 +- .../GRPCClient/GRPCCall+ChannelArg.m | 4 +- .../GRPCClient/GRPCCall+ChannelCredentials.h | 2 +- .../GRPCClient/GRPCCall+ChannelCredentials.m | 2 +- src/objective-c/GRPCClient/GRPCCall+Cronet.h | 13 +- src/objective-c/GRPCClient/GRPCCall+Cronet.m | 4 +- src/objective-c/GRPCClient/GRPCCall+GID.h | 2 +- src/objective-c/GRPCClient/GRPCCall+OAuth2.h | 4 +- src/objective-c/GRPCClient/GRPCCall+Tests.h | 2 +- src/objective-c/GRPCClient/GRPCCall+Tests.m | 2 +- src/objective-c/GRPCClient/GRPCCall.h | 240 +---- src/objective-c/GRPCClient/GRPCCall.m | 867 +++--------------- src/objective-c/GRPCClient/GRPCCallLegacy.h | 136 +++ src/objective-c/GRPCClient/GRPCCallLegacy.m | 677 ++++++++++++++ src/objective-c/GRPCClient/GRPCCallOptions.h | 82 +- src/objective-c/GRPCClient/GRPCCallOptions.m | 27 +- src/objective-c/GRPCClient/GRPCDispatchable.h | 30 + src/objective-c/GRPCClient/GRPCInterceptor.h | 32 +- src/objective-c/GRPCClient/GRPCInterceptor.m | 265 ++++-- src/objective-c/GRPCClient/GRPCTransport.h | 82 ++ src/objective-c/GRPCClient/GRPCTransport.m | 142 +++ src/objective-c/GRPCClient/GRPCTypes.h | 187 ++++ .../internal_testing/GRPCCall+InternalTests.m | 2 +- .../private/{ => GRPCCore}/ChannelArgsUtil.h | 0 .../private/{ => GRPCCore}/ChannelArgsUtil.m | 0 .../private/{ => GRPCCore}/GRPCCall+V2API.h | 6 - .../private/{ => GRPCCore}/GRPCCallInternal.h | 14 +- .../private/{ => GRPCCore}/GRPCCallInternal.m | 140 +-- .../private/{ => GRPCCore}/GRPCChannel.h | 0 .../private/{ => GRPCCore}/GRPCChannel.m | 72 +- .../{ => GRPCCore}/GRPCChannelFactory.h | 0 .../{ => GRPCCore}/GRPCChannelPool+Test.h | 0 .../private/{ => GRPCCore}/GRPCChannelPool.h | 2 - .../private/{ => GRPCCore}/GRPCChannelPool.m | 5 +- .../{ => GRPCCore}/GRPCCompletionQueue.h | 0 .../{ => GRPCCore}/GRPCCompletionQueue.m | 0 .../GRPCCoreCronet/GRPCCoreCronetFactory.h | 32 + .../GRPCCoreCronet/GRPCCoreCronetFactory.m | 54 ++ .../GRPCCronetChannelFactory.h | 2 +- .../GRPCCronetChannelFactory.m | 24 +- .../private/GRPCCore/GRPCCoreFactory.h | 45 + .../private/GRPCCore/GRPCCoreFactory.m | 90 ++ .../private/{ => GRPCCore}/GRPCHost.h | 0 .../private/{ => GRPCCore}/GRPCHost.m | 35 +- .../GRPCInsecureChannelFactory.h | 0 .../GRPCInsecureChannelFactory.m | 0 .../private/{ => GRPCCore}/GRPCOpBatchLog.h | 0 .../private/{ => GRPCCore}/GRPCOpBatchLog.m | 0 .../GRPCReachabilityFlagNames.xmacro.h | 0 .../{ => GRPCCore}/GRPCRequestHeaders.h | 2 +- .../{ => GRPCCore}/GRPCRequestHeaders.m | 0 .../{ => GRPCCore}/GRPCSecureChannelFactory.h | 0 .../{ => GRPCCore}/GRPCSecureChannelFactory.m | 0 .../private/{ => GRPCCore}/GRPCWrappedCall.h | 0 .../private/{ => GRPCCore}/GRPCWrappedCall.m | 0 .../private/{ => GRPCCore}/NSData+GRPC.h | 0 .../private/{ => GRPCCore}/NSData+GRPC.m | 0 .../{ => GRPCCore}/NSDictionary+GRPC.h | 0 .../{ => GRPCCore}/NSDictionary+GRPC.m | 0 .../private/{ => GRPCCore}/NSError+GRPC.h | 0 .../private/{ => GRPCCore}/NSError+GRPC.m | 3 +- .../private/GRPCTransport+Private.h | 65 ++ .../private/GRPCTransport+Private.m | 131 +++ .../GRPCClient/{private => }/version.h | 0 src/objective-c/ProtoRPC/ProtoRPC.h | 38 +- src/objective-c/ProtoRPC/ProtoRPC.m | 91 -- src/objective-c/ProtoRPC/ProtoRPCLegacy.h | 67 ++ src/objective-c/ProtoRPC/ProtoRPCLegacy.m | 121 +++ src/objective-c/ProtoRPC/ProtoService.h | 29 +- src/objective-c/ProtoRPC/ProtoService.m | 42 +- src/objective-c/ProtoRPC/ProtoServiceLegacy.h | 23 + src/objective-c/ProtoRPC/ProtoServiceLegacy.m | 71 ++ .../tvOS-sample/tvOS-sample/ViewController.m | 2 + .../WatchKit-Extension/InterfaceController.m | 2 + src/objective-c/tests/BUILD | 8 - src/objective-c/tests/ConfigureCronet.h | 4 - src/objective-c/tests/ConfigureCronet.m | 4 - .../InteropTestsRemoteWithCronet.m | 12 +- .../tests/InteropTests/InteropTests.h | 13 +- .../tests/InteropTests/InteropTests.m | 268 +++--- .../InteropTests/InteropTestsLocalCleartext.m | 5 +- .../tests/InteropTests/InteropTestsLocalSSL.m | 5 +- .../InteropTestsMultipleChannels.m | 3 +- .../tests/InteropTests/InteropTestsRemote.m | 6 - src/objective-c/tests/Podfile | 24 +- .../tests/Tests.xcodeproj/project.pbxproj | 29 +- .../xcschemes/InteropTests.xcscheme | 8 +- .../tests/UnitTests/ChannelPoolTest.m | 6 +- .../tests/UnitTests/ChannelTests.m | 10 +- .../tests/UnitTests/NSErrorUnitTests.m | 2 +- templates/gRPC-ProtoRPC.podspec.template | 30 +- templates/gRPC-RxLibrary.podspec.template | 17 + templates/gRPC.podspec.template | 116 ++- .../{private => }/version.h.template | 0 102 files changed, 3251 insertions(+), 1922 deletions(-) create mode 100644 src/objective-c/GRPCClient/GRPCCallLegacy.h create mode 100644 src/objective-c/GRPCClient/GRPCCallLegacy.m create mode 100644 src/objective-c/GRPCClient/GRPCDispatchable.h create mode 100644 src/objective-c/GRPCClient/GRPCTransport.h create mode 100644 src/objective-c/GRPCClient/GRPCTransport.m create mode 100644 src/objective-c/GRPCClient/GRPCTypes.h rename src/objective-c/GRPCClient/private/{ => GRPCCore}/ChannelArgsUtil.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/ChannelArgsUtil.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCCall+V2API.h (79%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCCallInternal.h (70%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCCallInternal.m (69%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCChannel.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCChannel.m (78%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCChannelFactory.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCChannelPool+Test.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCChannelPool.h (98%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCChannelPool.m (98%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCCompletionQueue.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCCompletionQueue.m (100%) create mode 100644 src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h create mode 100644 src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m rename src/objective-c/GRPCClient/private/{ => GRPCCore/GRPCCoreCronet}/GRPCCronetChannelFactory.h (96%) rename src/objective-c/GRPCClient/private/{ => GRPCCore/GRPCCoreCronet}/GRPCCronetChannelFactory.m (76%) create mode 100644 src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h create mode 100644 src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCHost.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCHost.m (82%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCInsecureChannelFactory.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCInsecureChannelFactory.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCOpBatchLog.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCOpBatchLog.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCReachabilityFlagNames.xmacro.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCRequestHeaders.h (95%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCRequestHeaders.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCSecureChannelFactory.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCSecureChannelFactory.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCWrappedCall.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/GRPCWrappedCall.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/NSData+GRPC.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/NSData+GRPC.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/NSDictionary+GRPC.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/NSDictionary+GRPC.m (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/NSError+GRPC.h (100%) rename src/objective-c/GRPCClient/private/{ => GRPCCore}/NSError+GRPC.m (96%) create mode 100644 src/objective-c/GRPCClient/private/GRPCTransport+Private.h create mode 100644 src/objective-c/GRPCClient/private/GRPCTransport+Private.m rename src/objective-c/GRPCClient/{private => }/version.h (100%) create mode 100644 src/objective-c/ProtoRPC/ProtoRPCLegacy.h create mode 100644 src/objective-c/ProtoRPC/ProtoRPCLegacy.m create mode 100644 src/objective-c/ProtoRPC/ProtoServiceLegacy.h create mode 100644 src/objective-c/ProtoRPC/ProtoServiceLegacy.m rename templates/src/objective-c/GRPCClient/{private => }/version.h.template (100%) diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index f386b87b583..23f90d0dc80 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -24,7 +24,6 @@ # load("//bazel:cc_grpc_library.bzl", "cc_grpc_library") -load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test") @@ -239,19 +238,13 @@ def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], da ) def grpc_generate_one_off_targets(): - apple_resource_bundle( - # The choice of name is signicant here, since it determines the bundle name. - name = "gRPCCertificates", - resources = ["etc/roots.pem"], - ) - # In open-source, grpc_objc* libraries depend directly on //:grpc native.alias( name = "grpc_objc", actual = "//:grpc", ) -def grpc_objc_use_cronet_config(): +def grpc_generate_objc_one_off_targets(): pass def grpc_sh_test(name, srcs, args = [], data = []): @@ -296,7 +289,7 @@ def grpc_package(name, visibility = "private", features = []): def grpc_objc_library( name, - srcs, + srcs = [], hdrs = [], textual_hdrs = [], data = [], diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 57dac5a10e5..4c5ebb36562 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -42,22 +42,40 @@ Pod::Spec.new do |s| s.module_name = name s.header_dir = name - src_dir = 'src/objective-c/ProtoRPC' + s.default_subspec = 'Main', 'Legacy', 'Legacy-Header' - s.default_subspec = 'Main' + s.subspec 'Legacy-Header' do |ss| + ss.header_mappings_dir = "src/objective-c/ProtoRPC" + ss.public_header_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.h" + ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.h" + end s.subspec 'Main' do |ss| - ss.header_mappings_dir = "#{src_dir}" - ss.dependency 'gRPC', version + ss.header_mappings_dir = "src/objective-c/ProtoRPC" + ss.dependency "#{s.name}/Legacy-Header", version + ss.dependency 'gRPC/Interface', version + ss.dependency 'Protobuf', '~> 3.0' + + ss.source_files = "src/objective-c/ProtoRPC/ProtoMethod.{h,m}", + "src/objective-c/ProtoRPC/ProtoRPC.{h,m}", + "src/objective-c/ProtoRPC/ProtoService.{h,m}" + end + + s.subspec 'Legacy' do |ss| + ss.header_mappings_dir = "src/objective-c/ProtoRPC" + ss.dependency "#{s.name}/Main", version + ss.dependency "#{s.name}/Legacy-Header", version + ss.dependency 'gRPC/GRPCCore', version ss.dependency 'gRPC-RxLibrary', version ss.dependency 'Protobuf', '~> 3.0' - ss.source_files = "#{src_dir}/*.{h,m}" + ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.m", + "src/objective-c/ProtoRPC/ProtoServiceLegacy.m" end # CFStream is now default. Leaving this subspec only for compatibility purpose. s.subspec 'CFStream' do |ss| - ss.dependency "#{s.name}/Main", version + ss.dependency "#{s.name}/Legacy", version end s.pod_target_xcconfig = { diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 9666c3c1b98..2e412cf67d6 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -42,6 +42,23 @@ Pod::Spec.new do |s| s.module_name = name s.header_dir = name + s.default_subspec = 'Interface', 'Implementation' + + src_dir = 'src/objective-c/RxLibrary' + s.subspec 'Interface' do |ss| + ss.header_mappings_dir = "#{src_dir}" + ss.source_files = "#{src_dir}/*.h" + ss.public_header_files = "#{src_dir}/*.h" + end + + s.subspec 'Implementation' do |ss| + ss.header_mappings_dir = "#{src_dir}" + ss.source_files = "#{src_dir}/*.m", "#{src_dir}/**/*.{h,m}" + ss.private_header_files = "#{src_dir}/**/*.h" + + ss.dependency "#{s.name}/Interface" + end + src_dir = 'src/objective-c/RxLibrary' s.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" s.private_header_files = "#{src_dir}/private/*.h" diff --git a/gRPC.podspec b/gRPC.podspec index 09baf1e3b4b..e18adcd276e 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -41,13 +41,7 @@ Pod::Spec.new do |s| s.module_name = name s.header_dir = name - src_dir = 'src/objective-c/GRPCClient' - - s.dependency 'gRPC-RxLibrary', version - s.default_subspec = 'Main' - - # Certificates, to be able to establish TLS connections: - s.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } + s.default_subspec = 'Interface', 'GRPCCore', 'Interface-Legacy' s.pod_target_xcconfig = { # This is needed by all pods that depend on gRPC-RxLibrary: @@ -55,29 +49,103 @@ Pod::Spec.new do |s| 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } - s.subspec 'Main' do |ss| - ss.header_mappings_dir = "#{src_dir}" - - ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" - ss.exclude_files = "#{src_dir}/GRPCCall+GID.{h,m}" - ss.private_header_files = "#{src_dir}/private/*.h", "#{src_dir}/internal/*.h" - - ss.dependency 'gRPC-Core', version + s.subspec 'Interface-Legacy' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' + + ss.public_header_files = "GRPCClient/GRPCCall+ChannelArg.h", + "GRPCClient/GRPCCall+ChannelCredentials.h", + "GRPCClient/GRPCCall+Cronet.h", + "GRPCClient/GRPCCall+OAuth2.h", + "GRPCClient/GRPCCall+Tests.h", + "src/objective-c/GRPCClient/GRPCCallLegacy.h", + "src/objective-c/GRPCClient/GRPCTypes.h" + + ss.source_files = "GRPCClient/GRPCCall+ChannelArg.h", + "GRPCClient/GRPCCall+ChannelCredentials.h", + "GRPCClient/GRPCCall+Cronet.h", + "GRPCClient/GRPCCall+OAuth2.h", + "GRPCClient/GRPCCall+Tests.h", + "src/objective-c/GRPCClient/GRPCCallLegacy.h", + "src/objective-c/GRPCClient/GRPCTypes.h" + ss.dependency "gRPC-RxLibrary/Interface", version end - # CFStream is now default. Leaving this subspec only for compatibility purpose. - s.subspec 'CFStream' do |ss| - ss.dependency "#{s.name}/Main", version + s.subspec 'Interface' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' + + ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall.h', + 'src/objective-c/GRPCClient/GRPCCall+Interceptor.h', + 'src/objective-c/GRPCClient/GRPCCallOptions.h', + 'src/objective-c/GRPCClient/GRPCInterceptor.h', + 'src/objective-c/GRPCClient/GRPCTransport.h', + 'src/objective-c/GRPCClient/GRPCDispatchable.h', + 'src/objective-c/GRPCClient/version.h' + + ss.source_files = 'src/objective-c/GRPCClient/GRPCCall.h', + 'src/objective-c/GRPCClient/GRPCCall.m', + 'src/objective-c/GRPCClient/GRPCCall+Interceptor.h', + 'src/objective-c/GRPCClient/GRPCCall+Interceptor.m', + 'src/objective-c/GRPCClient/GRPCCallOptions.h', + 'src/objective-c/GRPCClient/GRPCCallOptions.m', + 'src/objective-c/GRPCClient/GRPCDispatchable.h', + 'src/objective-c/GRPCClient/GRPCInterceptor.h', + 'src/objective-c/GRPCClient/GRPCInterceptor.m', + 'src/objective-c/GRPCClient/GRPCTransport.h', + 'src/objective-c/GRPCClient/GRPCTransport.m', + 'src/objective-c/GRPCClient/internal/*.h', + 'src/objective-c/GRPCClient/private/GRPCTransport+Private.h', + 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m', + 'src/objective-c/GRPCClient/version.h' + + ss.dependency "#{s.name}/Interface-Legacy", version end - s.subspec 'GID' do |ss| - ss.ios.deployment_target = '7.0' + s.subspec 'GRPCCore' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' + + ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', + 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', + 'src/objective-c/GRPCClient/GRPCCall+Tests.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', + 'src/objective-c/GRPCClient/internal_testing/*.h' + ss.private_header_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.h' + ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.{h,m}', + 'src/objective-c/GRPCClient/private/GRPCCore/*.{h,m}', + 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.m', + 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', + 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', + 'src/objective-c/GRPCClient/GRPCCall+OAuth2.m', + 'src/objective-c/GRPCClient/GRPCCall+Tests.h', + 'src/objective-c/GRPCClient/GRPCCall+Tests.m', + 'src/objective-c/GRPCClient/GRPCCallLegacy.m' + + # Certificates, to be able to establish TLS connections: + ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } + + ss.dependency "#{s.name}/Interface-Legacy", version + ss.dependency "#{s.name}/Interface", version + ss.dependency 'gRPC-Core', version + ss.dependency 'gRPC-RxLibrary', version + end - ss.header_mappings_dir = "#{src_dir}" + s.subspec 'GRPCCoreCronet' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' - ss.source_files = "#{src_dir}/GRPCCall+GID.{h,m}" + ss.source_files = 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', + 'src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/*.{h,m}' + ss.dependency "#{s.name}/GRPCCore", version + ss.dependency 'gRPC-Core/Cronet-Implementation', version + ss.dependency 'CronetFramework' + end - ss.dependency "#{s.name}/Main", version - ss.dependency 'Google/SignIn' + # CFStream is now default. Leaving this subspec only for compatibility purpose. + s.subspec 'CFStream' do |ss| + ss.dependency "#{s.name}/GRPCCore", version end end diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 24845ecdb06..ed262308aba 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -238,19 +238,21 @@ void PrintV2Implementation(Printer* printer, const MethodDescriptor* method, } void PrintMethodImplementations(Printer* printer, - const MethodDescriptor* method) { + const MethodDescriptor* method, + const Parameters& generator_params) { map< ::grpc::string, ::grpc::string> vars = GetMethodVars(method); PrintProtoRpcDeclarationAsPragma(printer, method, vars); - // TODO(jcanizales): Print documentation from the method. - printer->Print("// Deprecated methods.\n"); - PrintSimpleSignature(printer, method, vars); - PrintSimpleImplementation(printer, method, vars); + if (!generator_params.no_v1_compatibility) { + // TODO(jcanizales): Print documentation from the method. + PrintSimpleSignature(printer, method, vars); + PrintSimpleImplementation(printer, method, vars); - printer->Print("// Returns a not-yet-started RPC object.\n"); - PrintAdvancedSignature(printer, method, vars); - PrintAdvancedImplementation(printer, method, vars); + printer->Print("// Returns a not-yet-started RPC object.\n"); + PrintAdvancedSignature(printer, method, vars); + PrintAdvancedImplementation(printer, method, vars); + } PrintV2Signature(printer, method, vars); PrintV2Implementation(printer, method, vars); @@ -276,9 +278,12 @@ void PrintMethodImplementations(Printer* printer, return output; } -::grpc::string GetProtocol(const ServiceDescriptor* service) { +::grpc::string GetProtocol(const ServiceDescriptor* service, + const Parameters& generator_params) { ::grpc::string output; + if (generator_params.no_v1_compatibility) return output; + // Scope the output stream so it closes and finalizes output to the string. grpc::protobuf::io::StringOutputStream output_stream(&output); Printer printer(&output_stream, '$'); @@ -321,7 +326,8 @@ void PrintMethodImplementations(Printer* printer, return output; } -::grpc::string GetInterface(const ServiceDescriptor* service) { +::grpc::string GetInterface(const ServiceDescriptor* service, + const Parameters& generator_params) { ::grpc::string output; // Scope the output stream so it closes and finalizes output to the string. @@ -338,7 +344,11 @@ void PrintMethodImplementations(Printer* printer, " */\n"); printer.Print(vars, "@interface $service_class$ :" - " GRPCProtoService<$service_class$, $service_class$2>\n"); + " GRPCProtoService<$service_class$2"); + if (!generator_params.no_v1_compatibility) { + printer.Print(vars, ", $service_class$"); + } + printer.Print(">\n"); printer.Print( "- (instancetype)initWithHost:(NSString *)host " "callOptions:(GRPCCallOptions " @@ -347,17 +357,20 @@ void PrintMethodImplementations(Printer* printer, printer.Print( "+ (instancetype)serviceWithHost:(NSString *)host " "callOptions:(GRPCCallOptions *_Nullable)callOptions;\n"); - printer.Print( - "// The following methods belong to a set of old APIs that have been " - "deprecated.\n"); - printer.Print("- (instancetype)initWithHost:(NSString *)host;\n"); - printer.Print("+ (instancetype)serviceWithHost:(NSString *)host;\n"); + if (!generator_params.no_v1_compatibility) { + printer.Print( + "// The following methods belong to a set of old APIs that have been " + "deprecated.\n"); + printer.Print("- (instancetype)initWithHost:(NSString *)host;\n"); + printer.Print("+ (instancetype)serviceWithHost:(NSString *)host;\n"); + } printer.Print("@end\n"); return output; } -::grpc::string GetSource(const ServiceDescriptor* service) { +::grpc::string GetSource(const ServiceDescriptor* service, + const Parameters& generator_params) { ::grpc::string output; { // Scope the output stream so it closes and finalizes output to the string. @@ -381,22 +394,28 @@ void PrintMethodImplementations(Printer* printer, " packageName:@\"$package$\"\n" " serviceName:@\"$service_name$\"\n" " callOptions:callOptions];\n" - "}\n\n" - "- (instancetype)initWithHost:(NSString *)host {\n" - " return [super initWithHost:host\n" - " packageName:@\"$package$\"\n" - " serviceName:@\"$service_name$\"];\n" - "}\n\n" - "#pragma clang diagnostic pop\n\n"); - + "}\n\n"); + if (!generator_params.no_v1_compatibility) { + printer.Print(vars, + "- (instancetype)initWithHost:(NSString *)host {\n" + " return [super initWithHost:host\n" + " packageName:@\"$package$\"\n" + " serviceName:@\"$service_name$\"];\n" + "}\n\n"); + } + printer.Print("#pragma clang diagnostic pop\n\n"); + + if (!generator_params.no_v1_compatibility) { + printer.Print( + "// Override superclass initializer to disallow different" + " package and service names.\n" + "- (instancetype)initWithHost:(NSString *)host\n" + " packageName:(NSString *)packageName\n" + " serviceName:(NSString *)serviceName {\n" + " return [self initWithHost:host];\n" + "}\n\n"); + } printer.Print( - "// Override superclass initializer to disallow different" - " package and service names.\n" - "- (instancetype)initWithHost:(NSString *)host\n" - " packageName:(NSString *)packageName\n" - " serviceName:(NSString *)serviceName {\n" - " return [self initWithHost:host];\n" - "}\n\n" "- (instancetype)initWithHost:(NSString *)host\n" " packageName:(NSString *)packageName\n" " serviceName:(NSString *)serviceName\n" @@ -404,11 +423,14 @@ void PrintMethodImplementations(Printer* printer, " return [self initWithHost:host callOptions:callOptions];\n" "}\n\n"); + printer.Print("#pragma mark - Class Methods\n\n"); + if (!generator_params.no_v1_compatibility) { + printer.Print( + "+ (instancetype)serviceWithHost:(NSString *)host {\n" + " return [[self alloc] initWithHost:host];\n" + "}\n\n"); + } printer.Print( - "#pragma mark - Class Methods\n\n" - "+ (instancetype)serviceWithHost:(NSString *)host {\n" - " return [[self alloc] initWithHost:host];\n" - "}\n\n" "+ (instancetype)serviceWithHost:(NSString *)host " "callOptions:(GRPCCallOptions *_Nullable)callOptions {\n" " return [[self alloc] initWithHost:host callOptions:callOptions];\n" @@ -417,7 +439,8 @@ void PrintMethodImplementations(Printer* printer, printer.Print("#pragma mark - Method Implementations\n\n"); for (int i = 0; i < service->method_count(); i++) { - PrintMethodImplementations(&printer, service->method(i)); + PrintMethodImplementations(&printer, service->method(i), + generator_params); } printer.Print("@end\n"); diff --git a/src/compiler/objective_c_generator.h b/src/compiler/objective_c_generator.h index c171e5bf772..518962fceee 100644 --- a/src/compiler/objective_c_generator.h +++ b/src/compiler/objective_c_generator.h @@ -23,6 +23,11 @@ namespace grpc_objective_c_generator { +struct Parameters { + // Do not generate V1 interface and implementation + bool no_v1_compatibility; +}; + using ::grpc::protobuf::FileDescriptor; using ::grpc::protobuf::FileDescriptor; using ::grpc::protobuf::ServiceDescriptor; @@ -34,7 +39,8 @@ string GetAllMessageClasses(const FileDescriptor* file); // Returns the content to be included defining the @protocol segment at the // insertion point of the generated implementation file. This interface is // legacy and for backwards compatibility. -string GetProtocol(const ServiceDescriptor* service); +string GetProtocol(const ServiceDescriptor* service, + const Parameters& generator_params); // Returns the content to be included defining the @protocol segment at the // insertion point of the generated implementation file. @@ -42,11 +48,13 @@ string GetV2Protocol(const ServiceDescriptor* service); // Returns the content to be included defining the @interface segment at the // insertion point of the generated implementation file. -string GetInterface(const ServiceDescriptor* service); +string GetInterface(const ServiceDescriptor* service, + const Parameters& generator_params); // Returns the content to be included in the "global_scope" insertion point of // the generated implementation file. -string GetSource(const ServiceDescriptor* service); +string GetSource(const ServiceDescriptor* service, + const Parameters& generator_params); } // namespace grpc_objective_c_generator diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index f398033f6db..a08064a08bd 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -111,6 +111,22 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string file_name = google::protobuf::compiler::objectivec::FilePath(file); + grpc_objective_c_generator::Parameters generator_params; + generator_params.no_v1_compatibility = false; + + if (!parameter.empty()) { + std::vector parameters_list = + grpc_generator::tokenize(parameter, ","); + for (auto parameter_string = parameters_list.begin(); + parameter_string != parameters_list.end(); parameter_string++) { + std::vector param = + grpc_generator::tokenize(*parameter_string, "="); + if (param[0] == "no_v1_compatibility") { + generator_params.no_v1_compatibility = true; + } + } + } + { // Generate .pbrpc.h @@ -121,18 +137,25 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { imports = FrameworkImport(file_name + ".pbobjc.h", framework); } - ::grpc::string system_imports = SystemImport("ProtoRPC/ProtoService.h") + - SystemImport("ProtoRPC/ProtoRPC.h") + - SystemImport("RxLibrary/GRXWriteable.h") + - SystemImport("RxLibrary/GRXWriter.h"); + ::grpc::string system_imports = + SystemImport("ProtoRPC/ProtoService.h") + + (generator_params.no_v1_compatibility + ? SystemImport("ProtoRPC/ProtoRPC.h") + : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); + if (!generator_params.no_v1_compatibility) { + system_imports += SystemImport("RxLibrary/GRXWriteable.h") + + SystemImport("RxLibrary/GRXWriter.h"); + } ::grpc::string forward_declarations = - "@class GRPCProtoCall;\n" "@class GRPCUnaryProtoCall;\n" "@class GRPCStreamingProtoCall;\n" "@class GRPCCallOptions;\n" - "@protocol GRPCProtoResponseHandler;\n" - "\n"; + "@protocol GRPCProtoResponseHandler;\n"; + if (!generator_params.no_v1_compatibility) { + forward_declarations += "@class GRPCProtoCall;\n"; + } + forward_declarations += "\n"; ::grpc::string class_declarations = grpc_objective_c_generator::GetAllMessageClasses(file); @@ -152,13 +175,15 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string protocols; for (int i = 0; i < file->service_count(); i++) { const grpc::protobuf::ServiceDescriptor* service = file->service(i); - protocols += grpc_objective_c_generator::GetProtocol(service); + protocols += + grpc_objective_c_generator::GetProtocol(service, generator_params); } ::grpc::string interfaces; for (int i = 0; i < file->service_count(); i++) { const grpc::protobuf::ServiceDescriptor* service = file->service(i); - interfaces += grpc_objective_c_generator::GetInterface(service); + interfaces += + grpc_objective_c_generator::GetInterface(service, generator_params); } Write(context, file_name + ".pbrpc.h", @@ -178,14 +203,16 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string imports; if (framework.empty()) { imports = LocalImport(file_name + ".pbrpc.h") + - LocalImport(file_name + ".pbobjc.h") + - SystemImport("ProtoRPC/ProtoRPC.h") + - SystemImport("RxLibrary/GRXWriter+Immediate.h"); + LocalImport(file_name + ".pbobjc.h"); } else { imports = FrameworkImport(file_name + ".pbrpc.h", framework) + - FrameworkImport(file_name + ".pbobjc.h", framework) + - SystemImport("ProtoRPC/ProtoRPC.h") + - SystemImport("RxLibrary/GRXWriter+Immediate.h"); + FrameworkImport(file_name + ".pbobjc.h", framework); + } + imports += (generator_params.no_v1_compatibility + ? SystemImport("ProtoRPC/ProtoRPC.h") + : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); + if (!generator_params.no_v1_compatibility) { + imports += SystemImport("RxLibrary/GRXWriter+Immediate.h"); } ::grpc::string class_imports; @@ -196,7 +223,8 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string definitions; for (int i = 0; i < file->service_count(); i++) { const grpc::protobuf::ServiceDescriptor* service = file->service(i); - definitions += grpc_objective_c_generator::GetSource(service); + definitions += + grpc_objective_c_generator::GetSource(service, generator_params); } Write(context, file_name + ".pbrpc.m", diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index 3a71086f0f6..5f53486d17e 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -18,24 +18,30 @@ licenses(["notice"]) # Apache v2 package(default_visibility = ["//visibility:public"]) -load("//bazel:grpc_build_system.bzl", "grpc_objc_library", "grpc_objc_use_cronet_config") +load("//bazel:grpc_build_system.bzl", "grpc_objc_library", "grpc_generate_objc_one_off_targets") exports_files(["LICENSE"]) -grpc_objc_use_cronet_config() +grpc_generate_objc_one_off_targets() + +grpc_objc_library( + name = "rx_library_headers", + hdrs = glob([ + "RxLibrary/*.h", + ]), + includes = ["."], +) grpc_objc_library( name = "rx_library", srcs = glob([ "RxLibrary/*.m", - "RxLibrary/transformations/*.m", - ]), - hdrs = glob([ - "RxLibrary/*.h", - "RxLibrary/transformations/*.h", ]), includes = ["."], - deps = [":rx_library_private"], + deps = [ + ":rx_library_headers", + ":rx_library_private", + ], ) grpc_objc_library( @@ -50,84 +56,196 @@ grpc_objc_library( ) grpc_objc_library( - name = "grpc_objc_client", - srcs = glob( - [ - "GRPCClient/*.m", - "GRPCClient/private/*.m", - ], - exclude = ["GRPCClient/GRPCCall+GID.m"], - ), - hdrs = glob( - [ - "GRPCClient/*.h", - "GRPCClient/internal/*.h", - ], - exclude = ["GRPCClient/GRPCCall+GID.h"], - ), - data = ["//:gRPCCertificates"], + name = "grpc_objc_interface_legacy", + hdrs = [ + "GRPCClient/GRPCCall+ChannelArg.h", + "GRPCClient/GRPCCall+ChannelCredentials.h", + "GRPCClient/GRPCCall+Cronet.h", + "GRPCClient/GRPCCall+OAuth2.h", + "GRPCClient/GRPCCall+Tests.h", + "GRPCClient/GRPCCallLegacy.h", + "GRPCClient/GRPCTypes.h", + ], + deps = [ + "rx_library_headers", + ], +) + +grpc_objc_library( + name = "grpc_objc_interface", + hdrs = [ + "GRPCClient/GRPCCall.h", + "GRPCClient/GRPCCall+Interceptor.h", + "GRPCClient/GRPCCallOptions.h", + "GRPCClient/GRPCInterceptor.h", + "GRPCClient/GRPCTransport.h", + "GRPCClient/GRPCDispatchable.h", + "GRPCClient/internal/GRPCCallOptions+Internal.h", + "GRPCClient/version.h", + ], + srcs = [ + "GRPCClient/GRPCCall.m", + "GRPCClient/GRPCCall+Interceptor.m", + "GRPCClient/GRPCCallOptions.m", + "GRPCClient/GRPCInterceptor.m", + "GRPCClient/GRPCTransport.m", + "GRPCClient/private/GRPCTransport+Private.m", + ], includes = ["."], - textual_hdrs = glob([ - "GRPCClient/private/*.h", - ]), + textual_hdrs = [ + "GRPCClient/private/GRPCTransport+Private.h", + ], deps = [ + ":grpc_objc_interface_legacy", + ], +) + +grpc_objc_library( + name = "grpc_objc_client_core", + hdrs = [ + "GRPCClient/GRPCCall+ChannelCredentials.h", + "GRPCClient/GRPCCall+Cronet.h", + "GRPCClient/GRPCCall+OAuth2.h", + "GRPCClient/GRPCCall+Tests.h", + "GRPCClient/GRPCCall+ChannelArg.h", + ], + textual_hdrs = glob(["GRPCClient/private/GRPCCore/*.h"]), + srcs = [ + "GRPCClient/GRPCCall+ChannelArg.m", + "GRPCClient/GRPCCall+ChannelCredentials.m", + "GRPCClient/GRPCCall+Cronet.m", + "GRPCClient/GRPCCall+OAuth2.m", + "GRPCClient/GRPCCall+Tests.m", + "GRPCClient/GRPCCallLegacy.m", + ] + glob(["GRPCClient/private/GRPCCore/*.m"]), + data = [":gRPCCertificates"], + includes = ["."], + deps = [ + ":grpc_objc_interface", + ":grpc_objc_interface_legacy", ":rx_library", "//:grpc_objc", ], ) +alias( + name = "grpc_objc_client", + actual = "grpc_objc_client_core", +) + +grpc_objc_library( + name = "proto_objc_rpc_legacy_header", + hdrs = [ + "ProtoRPC/ProtoRPCLegacy.h", + ], + includes = ["."], +) + grpc_objc_library( - name = "proto_objc_rpc", - srcs = glob( - ["ProtoRPC/*.m"], - ), - hdrs = glob( - ["ProtoRPC/*.h"], - ), - # Different from Cocoapods, do not import as if @com_google_protobuf//:protobuf_objc is a framework, - # use the real paths of @com_google_protobuf//:protobuf_objc instead + name = "proto_objc_rpc_v2", + srcs = [ + "ProtoRPC/ProtoMethod.m", + "ProtoRPC/ProtoRPC.m", + "ProtoRPC/ProtoService.m", + ], + hdrs = [ + "ProtoRPC/ProtoMethod.h", + "ProtoRPC/ProtoRPC.h", + "ProtoRPC/ProtoService.h", + ], + includes = ["."], defines = ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0"], deps = [ - ":grpc_objc_client", + ":grpc_objc_interface", + ":proto_objc_rpc_legacy_header", + "@com_google_protobuf//:protobuf_objc", + ], +) + +grpc_objc_library( + name = "proto_objc_rpc", + srcs = [ + "ProtoRPC/ProtoRPCLegacy.m", + "ProtoRPC/ProtoServiceLegacy.m", + ], + hdrs = [ + "ProtoRPC/ProtoMethod.h", + "ProtoRPC/ProtoRPCLegacy.h", + "ProtoRPC/ProtoService.h", + ], + deps = [ ":rx_library", + ":proto_objc_rpc_v2", + ":proto_objc_rpc_legacy_header", + ":grpc_objc_client_core", "@com_google_protobuf//:protobuf_objc", ], ) +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +apple_resource_bundle( + # The choice of name is signicant here, since it determines the bundle name. + name = "gRPCCertificates", + resources = ["//:etc/roots.pem"], +) + +# Internal target combining grpc_objc_client_core and proto_objc_rpc for testing grpc_objc_library( - name = "grpc_objc_client_internal_testing", - srcs = glob( - [ - "GRPCClient/*.m", - "GRPCClient/private/*.m", - "GRPCClient/internal_testing/*.m", - "ProtoRPC/*.m", - ], - exclude = ["GRPCClient/GRPCCall+GID.m"], - ), - hdrs = glob( - [ - "GRPCClient/*.h", - "GRPCClient/internal/*.h", - "GRPCClient/internal_testing/*.h", - "ProtoRPC/*.h", - ], - exclude = ["GRPCClient/GRPCCall+GID.h"], - ), + name = "grpc_objc_client_core_internal_testing", + hdrs = [ + "GRPCClient/GRPCCall+ChannelCredentials.h", + "GRPCClient/GRPCCall+Cronet.h", + "GRPCClient/GRPCCall+OAuth2.h", + "GRPCClient/GRPCCall+Tests.h", + "GRPCClient/GRPCCall+ChannelArg.h", + "GRPCClient/internal_testing/GRPCCall+InternalTests.h", + ], + textual_hdrs = glob(["GRPCClient/private/GRPCCore/*.h"]), + srcs = [ + "GRPCClient/GRPCCall+ChannelArg.m", + "GRPCClient/GRPCCall+ChannelCredentials.m", + "GRPCClient/GRPCCall+Cronet.m", + "GRPCClient/GRPCCall+OAuth2.m", + "GRPCClient/GRPCCall+Tests.m", + "GRPCClient/GRPCCallLegacy.m", + "GRPCClient/internal_testing/GRPCCall+InternalTests.m", + ] + glob(["GRPCClient/private/GRPCCore/*.m"]), + data = [":gRPCCertificates"], includes = ["."], - data = ["//:gRPCCertificates"], defines = [ "GRPC_TEST_OBJC=1", - "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0", ], - textual_hdrs = glob( - [ - "GRPCClient/private/*.h", - ], - ), deps = [ + ":grpc_objc_interface", + ":grpc_objc_interface_legacy", ":rx_library", "//:grpc_objc", + ], +) + +grpc_objc_library( + name = "proto_objc_rpc_internal_testing", + srcs = [ + "ProtoRPC/ProtoRPCLegacy.m", + "ProtoRPC/ProtoServiceLegacy.m", + ], + hdrs = [ + "ProtoRPC/ProtoMethod.h", + "ProtoRPC/ProtoRPC.h", + "ProtoRPC/ProtoRPCLegacy.h", + "ProtoRPC/ProtoService.h", + ], + deps = [ + ":rx_library", + ":proto_objc_rpc_v2", + ":proto_objc_rpc_legacy_header", + ":grpc_objc_client_core_internal_testing", "@com_google_protobuf//:protobuf_objc", ], ) + +alias( + name = "grpc_objc_client_internal_testing", + actual = "proto_objc_rpc_internal_testing", +) diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h index 2ddd53a5c66..ff5a153a0f6 100644 --- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h +++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h @@ -15,7 +15,7 @@ * limitations under the License. * */ -#import "GRPCCall.h" +#import "GRPCCallLegacy.h" #include diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m index ae60d6208e1..aae1b740c71 100644 --- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m +++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m @@ -18,8 +18,8 @@ #import "GRPCCall+ChannelArg.h" -#import "private/GRPCChannelPool.h" -#import "private/GRPCHost.h" +#import "private/GRPCCore/GRPCChannelPool.h" +#import "private/GRPCCore/GRPCHost.h" #import diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h index 7d6f79b7655..c3d194bff94 100644 --- a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h +++ b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h @@ -16,7 +16,7 @@ * */ -#import "GRPCCall.h" +#import "GRPCCallLegacy.h" // Deprecated interface. Please use GRPCCallOptions instead. @interface GRPCCall (ChannelCredentials) diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m index 2689ec2effb..aa97ca82bf8 100644 --- a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m +++ b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m @@ -18,7 +18,7 @@ #import "GRPCCall+ChannelCredentials.h" -#import "private/GRPCHost.h" +#import "private/GRPCCore/GRPCHost.h" @implementation GRPCCall (ChannelCredentials) diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.h b/src/objective-c/GRPCClient/GRPCCall+Cronet.h index 3059c6f1860..d107ada3672 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.h +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.h @@ -15,12 +15,16 @@ * limitations under the License. * */ -#ifdef GRPC_COMPILE_WITH_CRONET -#import -#import "GRPCCall.h" +#import "GRPCCallLegacy.h" +#import "GRPCTypes.h" -// Deprecated interface. Please use GRPCCallOptions instead. +typedef struct stream_engine stream_engine; + +// Transport id for Cronet transport +extern const GRPCTransportId gGRPCCoreCronetId; + +// Deprecated class. Please use the gGRPCCoreCronetId with GRPCCallOptions.transport instead. @interface GRPCCall (Cronet) + (void)useCronetWithEngine:(stream_engine*)engine; @@ -28,4 +32,3 @@ + (BOOL)isUsingCronet; @end -#endif diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.m b/src/objective-c/GRPCClient/GRPCCall+Cronet.m index ba8d2c23db8..a732208e1f6 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.m +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.m @@ -18,7 +18,8 @@ #import "GRPCCall+Cronet.h" -#ifdef GRPC_COMPILE_WITH_CRONET +const GRPCTransportId gGRPCCoreCronetId = "io.grpc.transport.core.cronet"; + static BOOL useCronet = NO; static stream_engine *globalCronetEngine; @@ -38,4 +39,3 @@ static stream_engine *globalCronetEngine; } @end -#endif diff --git a/src/objective-c/GRPCClient/GRPCCall+GID.h b/src/objective-c/GRPCClient/GRPCCall+GID.h index 8293e92ebe9..80e34ea98da 100644 --- a/src/objective-c/GRPCClient/GRPCCall+GID.h +++ b/src/objective-c/GRPCClient/GRPCCall+GID.h @@ -17,7 +17,7 @@ */ #import "GRPCCall+OAuth2.h" -#import "GRPCCall.h" +#import "GRPCCallLegacy.h" #import diff --git a/src/objective-c/GRPCClient/GRPCCall+OAuth2.h b/src/objective-c/GRPCClient/GRPCCall+OAuth2.h index 60cdc50bfda..cf60c794f27 100644 --- a/src/objective-c/GRPCClient/GRPCCall+OAuth2.h +++ b/src/objective-c/GRPCClient/GRPCCall+OAuth2.h @@ -16,9 +16,9 @@ * */ -#import "GRPCCall.h" +#import "GRPCCallLegacy.h" -#import "GRPCCallOptions.h" +@protocol GRPCAuthorizationProtocol; // Deprecated interface. Please use GRPCCallOptions instead. @interface GRPCCall (OAuth2) diff --git a/src/objective-c/GRPCClient/GRPCCall+Tests.h b/src/objective-c/GRPCClient/GRPCCall+Tests.h index edaa5ed582c..af81eec6b82 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Tests.h +++ b/src/objective-c/GRPCClient/GRPCCall+Tests.h @@ -16,7 +16,7 @@ * */ -#import "GRPCCall.h" +#import "GRPCCallLegacy.h" // Deprecated interface. Please use GRPCCallOptions instead. @interface GRPCCall (Tests) diff --git a/src/objective-c/GRPCClient/GRPCCall+Tests.m b/src/objective-c/GRPCClient/GRPCCall+Tests.m index 20f5cba4178..3a1dff38868 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Tests.m +++ b/src/objective-c/GRPCClient/GRPCCall+Tests.m @@ -18,7 +18,7 @@ #import "GRPCCall+Tests.h" -#import "private/GRPCHost.h" +#import "private/GRPCCore/GRPCHost.h" #import "GRPCCallOptions.h" diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index d02ec601727..1c7a10048cf 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -33,134 +33,19 @@ */ #import -#import -#include +#import "GRPCCallOptions.h" +#import "GRPCDispatchable.h" +#import "GRPCTypes.h" -#include "GRPCCallOptions.h" +// The legacy header is included for backwards compatibility. Some V1 API users are still using +// GRPCCall by importing GRPCCall.h header so we need this import. +#import "GRPCCallLegacy.h" NS_ASSUME_NONNULL_BEGIN -#pragma mark gRPC errors - -/** Domain of NSError objects produced by gRPC. */ -extern NSString *const kGRPCErrorDomain; - -/** - * gRPC error codes. - * Note that a few of these are never produced by the gRPC libraries, but are of general utility for - * server applications to produce. - */ -typedef NS_ENUM(NSUInteger, GRPCErrorCode) { - /** The operation was cancelled (typically by the caller). */ - GRPCErrorCodeCancelled = 1, - - /** - * Unknown error. Errors raised by APIs that do not return enough error information may be - * converted to this error. - */ - GRPCErrorCodeUnknown = 2, - - /** - * The client specified an invalid argument. Note that this differs from FAILED_PRECONDITION. - * INVALID_ARGUMENT indicates arguments that are problematic regardless of the state of the - * server (e.g., a malformed file name). - */ - GRPCErrorCodeInvalidArgument = 3, - - /** - * Deadline expired before operation could complete. For operations that change the state of the - * server, this error may be returned even if the operation has completed successfully. For - * example, a successful response from the server could have been delayed long enough for the - * deadline to expire. - */ - GRPCErrorCodeDeadlineExceeded = 4, - - /** Some requested entity (e.g., file or directory) was not found. */ - GRPCErrorCodeNotFound = 5, - - /** Some entity that we attempted to create (e.g., file or directory) already exists. */ - GRPCErrorCodeAlreadyExists = 6, - - /** - * The caller does not have permission to execute the specified operation. PERMISSION_DENIED isn't - * used for rejections caused by exhausting some resource (RESOURCE_EXHAUSTED is used instead for - * those errors). PERMISSION_DENIED doesn't indicate a failure to identify the caller - * (UNAUTHENTICATED is used instead for those errors). - */ - GRPCErrorCodePermissionDenied = 7, - - /** - * The request does not have valid authentication credentials for the operation (e.g. the caller's - * identity can't be verified). - */ - GRPCErrorCodeUnauthenticated = 16, - - /** Some resource has been exhausted, perhaps a per-user quota. */ - GRPCErrorCodeResourceExhausted = 8, - - /** - * The RPC was rejected because the server is not in a state required for the procedure's - * execution. For example, a directory to be deleted may be non-empty, etc. - * The client should not retry until the server state has been explicitly fixed (e.g. by - * performing another RPC). The details depend on the service being called, and should be found in - * the NSError's userInfo. - */ - GRPCErrorCodeFailedPrecondition = 9, - - /** - * The RPC was aborted, typically due to a concurrency issue like sequencer check failures, - * transaction aborts, etc. The client should retry at a higher-level (e.g., restarting a read- - * modify-write sequence). - */ - GRPCErrorCodeAborted = 10, - - /** - * The RPC was attempted past the valid range. E.g., enumerating past the end of a list. - * Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed if the system state - * changes. For example, an RPC to get elements of a list will generate INVALID_ARGUMENT if asked - * to return the element at a negative index, but it will generate OUT_OF_RANGE if asked to return - * the element at an index past the current size of the list. - */ - GRPCErrorCodeOutOfRange = 11, - - /** The procedure is not implemented or not supported/enabled in this server. */ - GRPCErrorCodeUnimplemented = 12, - - /** - * Internal error. Means some invariant expected by the server application or the gRPC library has - * been broken. - */ - GRPCErrorCodeInternal = 13, - - /** - * The server is currently unavailable. This is most likely a transient condition and may be - * corrected by retrying with a backoff. Note that it is not always safe to retry - * non-idempotent operations. - */ - GRPCErrorCodeUnavailable = 14, - - /** Unrecoverable data loss or corruption. */ - GRPCErrorCodeDataLoss = 15, -}; - -/** - * Keys used in |NSError|'s |userInfo| dictionary to store the response headers and trailers sent by - * the server. - */ -extern NSString *const kGRPCHeadersKey; -extern NSString *const kGRPCTrailersKey; - /** An object can implement this protocol to receive responses from server from a call. */ -@protocol GRPCResponseHandler - -@required - -/** - * All the responses must be issued to a user-provided dispatch queue. This property specifies the - * dispatch queue to be used for issuing the notifications. - */ -@property(atomic, readonly) dispatch_queue_t dispatchQueue; +@protocol GRPCResponseHandler @optional @@ -302,114 +187,3 @@ extern NSString *const kGRPCTrailersKey; @end NS_ASSUME_NONNULL_END - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnullability-completeness" - -/** - * This interface is deprecated. Please use \a GRPCcall2. - * - * Represents a single gRPC remote call. - */ -@interface GRPCCall : GRXWriter - -- (instancetype)init NS_UNAVAILABLE; - -/** - * The container of the request headers of an RPC conforms to this protocol, which is a subset of - * NSMutableDictionary's interface. It will become a NSMutableDictionary later on. - * The keys of this container are the header names, which per the HTTP standard are case- - * insensitive. They are stored in lowercase (which is how HTTP/2 mandates them on the wire), and - * can only consist of ASCII characters. - * A header value is a NSString object (with only ASCII characters), unless the header name has the - * suffix "-bin", in which case the value has to be a NSData object. - */ -/** - * These HTTP headers will be passed to the server as part of this call. Each HTTP header is a - * name-value pair with string names and either string or binary values. - * - * The passed dictionary has to use NSString keys, corresponding to the header names. The value - * associated to each can be a NSString object or a NSData object. E.g.: - * - * call.requestHeaders = @{@"authorization": @"Bearer ..."}; - * - * call.requestHeaders[@"my-header-bin"] = someData; - * - * After the call is started, trying to modify this property is an error. - * - * The property is initialized to an empty NSMutableDictionary. - */ -@property(atomic, readonly) NSMutableDictionary *requestHeaders; - -/** - * This dictionary is populated with the HTTP headers received from the server. This happens before - * any response message is received from the server. It has the same structure as the request - * headers dictionary: Keys are NSString header names; names ending with the suffix "-bin" have a - * NSData value; the others have a NSString value. - * - * The value of this property is nil until all response headers are received, and will change before - * any of -writeValue: or -writesFinishedWithError: are sent to the writeable. - */ -@property(atomic, readonly) NSDictionary *responseHeaders; - -/** - * Same as responseHeaders, but populated with the HTTP trailers received from the server before the - * call finishes. - * - * The value of this property is nil until all response trailers are received, and will change - * before -writesFinishedWithError: is sent to the writeable. - */ -@property(atomic, readonly) NSDictionary *responseTrailers; - -/** - * The request writer has to write NSData objects into the provided Writeable. The server will - * receive each of those separately and in order as distinct messages. - * A gRPC call might not complete until the request writer finishes. On the other hand, the request - * finishing doesn't necessarily make the call to finish, as the server might continue sending - * messages to the response side of the call indefinitely (depending on the semantics of the - * specific remote method called). - * To finish a call right away, invoke cancel. - * host parameter should not contain the scheme (http:// or https://), only the name or IP addr - * and the port number, for example @"localhost:5050". - */ -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - requestsWriter:(GRXWriter *)requestWriter; - -/** - * Finishes the request side of this call, notifies the server that the RPC should be cancelled, and - * finishes the response side of the call with an error of code CANCELED. - */ -- (void)cancel; - -/** - * The following methods are deprecated. - */ -+ (void)setCallSafety:(GRPCCallSafety)callSafety host:(NSString *)host path:(NSString *)path; -@property(atomic, copy, readwrite) NSString *serverName; -@property NSTimeInterval timeout; -- (void)setResponseDispatchQueue:(dispatch_queue_t)queue; - -@end - -#pragma mark Backwards compatibiity - -/** This protocol is kept for backwards compatibility with existing code. */ -DEPRECATED_MSG_ATTRIBUTE("Use NSDictionary or NSMutableDictionary instead.") -@protocol GRPCRequestHeaders -@property(nonatomic, readonly) NSUInteger count; - -- (id)objectForKeyedSubscript:(id)key; -- (void)setObject:(id)obj forKeyedSubscript:(id)key; - -- (void)removeAllObjects; -- (void)removeObjectForKey:(id)key; -@end - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" -/** This is only needed for backwards-compatibility. */ -@interface NSMutableDictionary (GRPCRequestHeaders) -@end -#pragma clang diagnostic pop -#pragma clang diagnostic pop diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index cd293cc8e59..73ee530ef2c 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -17,56 +17,86 @@ */ #import "GRPCCall.h" + #import "GRPCCall+Interceptor.h" -#import "GRPCCall+OAuth2.h" #import "GRPCCallOptions.h" #import "GRPCInterceptor.h" -#import -#import -#import -#import -#include -#include - -#import "private/GRPCCall+V2API.h" -#import "private/GRPCCallInternal.h" -#import "private/GRPCChannelPool.h" -#import "private/GRPCCompletionQueue.h" -#import "private/GRPCHost.h" -#import "private/GRPCRequestHeaders.h" -#import "private/GRPCWrappedCall.h" -#import "private/NSData+GRPC.h" -#import "private/NSDictionary+GRPC.h" -#import "private/NSError+GRPC.h" - -// At most 6 ops can be in an op batch for a client: SEND_INITIAL_METADATA, -// SEND_MESSAGE, SEND_CLOSE_FROM_CLIENT, RECV_INITIAL_METADATA, RECV_MESSAGE, -// and RECV_STATUS_ON_CLIENT. -NSInteger kMaxClientBatch = 6; +#import "private/GRPCTransport+Private.h" NSString *const kGRPCHeadersKey = @"io.grpc.HeadersKey"; NSString *const kGRPCTrailersKey = @"io.grpc.TrailersKey"; -static NSMutableDictionary *callFlags; -static NSString *const kAuthorizationHeader = @"authorization"; -static NSString *const kBearerPrefix = @"Bearer "; +NSString *const kGRPCErrorDomain = @"io.grpc"; + +/** + * The response dispatcher creates its own serial dispatch queue and target the queue to the + * dispatch queue of a user provided response handler. It removes the requirement of having to use + * serial dispatch queue in the user provided response handler. + */ +@interface GRPCResponseDispatcher : NSObject + +- (nullable instancetype)initWithResponseHandler:(id)responseHandler; + +@end -const char *kCFStreamVarName = "grpc_cfstream"; +@implementation GRPCResponseDispatcher { + id _responseHandler; + dispatch_queue_t _dispatchQueue; +} -@interface GRPCCall () -// Make them read-write. -@property(atomic, strong) NSDictionary *responseHeaders; -@property(atomic, strong) NSDictionary *responseTrailers; +- (instancetype)initWithResponseHandler:(id)responseHandler { + if ((self = [super init])) { + _responseHandler = responseHandler; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 + if (@available(iOS 8.0, macOS 10.10, *)) { + _dispatchQueue = dispatch_queue_create( + NULL, + dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); + } else { +#else + { +#endif + _dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); + } + dispatch_set_target_queue(_dispatchQueue, _responseHandler.dispatchQueue); + } -- (void)receiveNextMessages:(NSUInteger)numberOfMessages; + return self; +} + +- (dispatch_queue_t)dispatchQueue { + return _dispatchQueue; +} + +- (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata { + if ([_responseHandler respondsToSelector:@selector(didReceiveInitialMetadata:)]) { + [_responseHandler didReceiveInitialMetadata:initialMetadata]; + } +} + +- (void)didReceiveData:(id)data { + // For backwards compatibility with didReceiveRawMessage, if the user provided a response handler + // that handles didReceiveRawMesssage, we issue to that method instead + if ([_responseHandler respondsToSelector:@selector(didReceiveRawMessage:)]) { + [_responseHandler didReceiveRawMessage:data]; + } else if ([_responseHandler respondsToSelector:@selector(didReceiveData:)]) { + [_responseHandler didReceiveData:data]; + } +} + +- (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata + error:(nullable NSError *)error { + if ([_responseHandler respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { + [_responseHandler didCloseWithTrailingMetadata:trailingMetadata error:error]; + } +} -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - callSafety:(GRPCCallSafety)safety - requestsWriter:(GRXWriter *)requestsWriter - callOptions:(GRPCCallOptions *)callOptions - writeDone:(void (^)(void))writeDone; +- (void)didWriteData { + if ([_responseHandler respondsToSelector:@selector(didWriteData)]) { + [_responseHandler didWriteData]; + } +} @end @@ -140,54 +170,39 @@ const char *kCFStreamVarName = "grpc_cfstream"; } _responseHandler = responseHandler; - // Initialize the interceptor chain - - // First initialize the internal call - GRPCCall2Internal *internalCall = [[GRPCCall2Internal alloc] init]; - id nextInterceptor = internalCall; - GRPCInterceptorManager *nextManager = nil; - - // Then initialize the global interceptor, if applicable + GRPCResponseDispatcher *dispatcher = + [[GRPCResponseDispatcher alloc] initWithResponseHandler:_responseHandler]; + NSMutableArray> *interceptorFactories; + if (_actualCallOptions.interceptorFactories != nil) { + interceptorFactories = + [NSMutableArray arrayWithArray:_actualCallOptions.interceptorFactories]; + } else { + interceptorFactories = [NSMutableArray array]; + } id globalInterceptorFactory = [GRPCCall2 globalInterceptorFactory]; - if (globalInterceptorFactory) { - GRPCInterceptorManager *manager = - [[GRPCInterceptorManager alloc] initWithNextInterceptor:nextInterceptor]; - GRPCInterceptor *interceptor = - [globalInterceptorFactory createInterceptorWithManager:manager]; - if (interceptor != nil) { - [internalCall setResponseHandler:interceptor]; - nextInterceptor = interceptor; - nextManager = manager; - } + if (globalInterceptorFactory != nil) { + [interceptorFactories addObject:globalInterceptorFactory]; } - - // Finally initialize the interceptors in the chain - NSArray *interceptorFactories = _actualCallOptions.interceptorFactories; - for (int i = (int)interceptorFactories.count - 1; i >= 0; i--) { - GRPCInterceptorManager *manager = - [[GRPCInterceptorManager alloc] initWithNextInterceptor:nextInterceptor]; - GRPCInterceptor *interceptor = [interceptorFactories[i] createInterceptorWithManager:manager]; - NSAssert(interceptor != nil, @"Failed to create interceptor from factory: %@", - interceptorFactories[i]); - if (interceptor == nil) { - NSLog(@"Failed to create interceptor from factory: %@", interceptorFactories[i]); - continue; - } - if (nextManager == nil) { - [internalCall setResponseHandler:interceptor]; + // continuously create interceptor until one is successfully created + while (_firstInterceptor == nil) { + if (interceptorFactories.count == 0) { + _firstInterceptor = [[GRPCTransportManager alloc] initWithTransportId:_callOptions.transport + previousInterceptor:dispatcher]; + break; } else { - [nextManager setPreviousInterceptor:interceptor]; + _firstInterceptor = + [[GRPCInterceptorManager alloc] initWithFactories:interceptorFactories + previousInterceptor:dispatcher + transportId:_callOptions.transport]; + if (_firstInterceptor == nil) { + [interceptorFactories removeObjectAtIndex:0]; + } } - nextInterceptor = interceptor; - nextManager = manager; } - if (nextManager == nil) { - [internalCall setResponseHandler:_responseHandler]; - } else { - [nextManager setPreviousInterceptor:_responseHandler]; + NSAssert(_firstInterceptor != nil, @"Failed to create interceptor or transport."); + if (_firstInterceptor == nil) { + NSLog(@"Failed to create interceptor or transport."); } - - _firstInterceptor = nextInterceptor; } return self; @@ -200,696 +215,42 @@ const char *kCFStreamVarName = "grpc_cfstream"; } - (void)start { - id copiedFirstInterceptor; - @synchronized(self) { - copiedFirstInterceptor = _firstInterceptor; - } - GRPCRequestOptions *requestOptions = [_requestOptions copy]; - GRPCCallOptions *callOptions = [_actualCallOptions copy]; - if ([copiedFirstInterceptor respondsToSelector:@selector(startWithRequestOptions:callOptions:)]) { - dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ - [copiedFirstInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; - }); - } + id copiedFirstInterceptor = _firstInterceptor; + GRPCRequestOptions *requestOptions = _requestOptions; + GRPCCallOptions *callOptions = _actualCallOptions; + dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ + [copiedFirstInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; + }); } - (void)cancel { - id copiedFirstInterceptor; - @synchronized(self) { - copiedFirstInterceptor = _firstInterceptor; - } - if ([copiedFirstInterceptor respondsToSelector:@selector(cancel)]) { - dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ + id copiedFirstInterceptor = _firstInterceptor; + if (copiedFirstInterceptor != nil) { + dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ [copiedFirstInterceptor cancel]; }); } } - (void)writeData:(id)data { - id copiedFirstInterceptor; - @synchronized(self) { - copiedFirstInterceptor = _firstInterceptor; - } - if ([copiedFirstInterceptor respondsToSelector:@selector(writeData:)]) { - dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ - [copiedFirstInterceptor writeData:data]; - }); - } -} - -- (void)finish { - id copiedFirstInterceptor; - @synchronized(self) { - copiedFirstInterceptor = _firstInterceptor; - } - if ([copiedFirstInterceptor respondsToSelector:@selector(finish)]) { - dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ - [copiedFirstInterceptor finish]; - }); - } -} - -- (void)receiveNextMessages:(NSUInteger)numberOfMessages { - id copiedFirstInterceptor; - @synchronized(self) { - copiedFirstInterceptor = _firstInterceptor; - } - if ([copiedFirstInterceptor respondsToSelector:@selector(receiveNextMessages:)]) { - dispatch_async(copiedFirstInterceptor.requestDispatchQueue, ^{ - [copiedFirstInterceptor receiveNextMessages:numberOfMessages]; - }); - } -} - -@end - -// The following methods of a C gRPC call object aren't reentrant, and thus -// calls to them must be serialized: -// - start_batch -// - destroy -// -// start_batch with a SEND_MESSAGE argument can only be called after the -// OP_COMPLETE event for any previous write is received. This is achieved by -// pausing the requests writer immediately every time it writes a value, and -// resuming it again when OP_COMPLETE is received. -// -// Similarly, start_batch with a RECV_MESSAGE argument can only be called after -// the OP_COMPLETE event for any previous read is received.This is easier to -// enforce, as we're writing the received messages into the writeable: -// start_batch is enqueued once upon receiving the OP_COMPLETE event for the -// RECV_METADATA batch, and then once after receiving each OP_COMPLETE event for -// each RECV_MESSAGE batch. -@implementation GRPCCall { - dispatch_queue_t _callQueue; - - NSString *_host; - NSString *_path; - GRPCCallSafety _callSafety; - GRPCCallOptions *_callOptions; - GRPCWrappedCall *_wrappedCall; - - // The C gRPC library has less guarantees on the ordering of events than we - // do. Particularly, in the face of errors, there's no ordering guarantee at - // all. This wrapper over our actual writeable ensures thread-safety and - // correct ordering. - GRXConcurrentWriteable *_responseWriteable; - - // The network thread wants the requestWriter to resume (when the server is ready for more input), - // or to stop (on errors), concurrently with user threads that want to start it, pause it or stop - // it. Because a writer isn't thread-safe, we'll synchronize those operations on it. - // We don't use a dispatch queue for that purpose, because the writer can call writeValue: or - // writesFinishedWithError: on this GRPCCall as part of those operations. We want to be able to - // pause the writer immediately on writeValue:, so we need our locking to be recursive. - GRXWriter *_requestWriter; - - // To create a retain cycle when a call is started, up until it finishes. See - // |startWithWriteable:| and |finishWithError:|. This saves users from having to retain a - // reference to the call object if all they're interested in is the handler being executed when - // the response arrives. - GRPCCall *_retainSelf; - - GRPCRequestHeaders *_requestHeaders; - - // In the case that the call is a unary call (i.e. the writer to GRPCCall is of type - // GRXImmediateSingleWriter), GRPCCall will delay sending ops (not send them to C core - // immediately) and buffer them into a batch _unaryOpBatch. The batch is sent to C core when - // the SendClose op is added. - BOOL _unaryCall; - NSMutableArray *_unaryOpBatch; - - // The dispatch queue to be used for enqueuing responses to user. Defaulted to the main dispatch - // queue - dispatch_queue_t _responseQueue; - - // The OAuth2 token fetched from a token provider. - NSString *_fetchedOauth2AccessToken; - - // The callback to be called when a write message op is done. - void (^_writeDone)(void); - - // Indicate a read request to core is pending. - BOOL _pendingCoreRead; - - // Indicate pending read message request from user. - NSUInteger _pendingReceiveNextMessages; -} - -@synthesize state = _state; - -+ (void)initialize { - // Guarantees the code in {} block is invoked only once. See ref at: - // https://developer.apple.com/documentation/objectivec/nsobject/1418639-initialize?language=objc - if (self == [GRPCCall self]) { - grpc_init(); - callFlags = [NSMutableDictionary dictionary]; - } -} - -+ (void)setCallSafety:(GRPCCallSafety)callSafety host:(NSString *)host path:(NSString *)path { - if (host.length == 0 || path.length == 0) { - return; - } - NSString *hostAndPath = [NSString stringWithFormat:@"%@/%@", host, path]; - @synchronized(callFlags) { - switch (callSafety) { - case GRPCCallSafetyDefault: - callFlags[hostAndPath] = @0; - break; - case GRPCCallSafetyIdempotentRequest: - callFlags[hostAndPath] = @GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; - break; - case GRPCCallSafetyCacheableRequest: - callFlags[hostAndPath] = @GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; - break; - default: - break; - } - } -} - -+ (uint32_t)callFlagsForHost:(NSString *)host path:(NSString *)path { - NSString *hostAndPath = [NSString stringWithFormat:@"%@/%@", host, path]; - @synchronized(callFlags) { - return [callFlags[hostAndPath] intValue]; - } -} - -// Designated initializer -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - requestsWriter:(GRXWriter *)requestWriter { - return [self initWithHost:host - path:path - callSafety:GRPCCallSafetyDefault - requestsWriter:requestWriter - callOptions:nil]; -} - -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - callSafety:(GRPCCallSafety)safety - requestsWriter:(GRXWriter *)requestsWriter - callOptions:(GRPCCallOptions *)callOptions { - return [self initWithHost:host - path:path - callSafety:safety - requestsWriter:requestsWriter - callOptions:callOptions - writeDone:nil]; -} - -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - callSafety:(GRPCCallSafety)safety - requestsWriter:(GRXWriter *)requestsWriter - callOptions:(GRPCCallOptions *)callOptions - writeDone:(void (^)(void))writeDone { - // Purposely using pointer rather than length (host.length == 0) for backwards compatibility. - NSAssert(host != nil && path != nil, @"Neither host nor path can be nil."); - NSAssert(safety <= GRPCCallSafetyCacheableRequest, @"Invalid call safety value."); - NSAssert(requestsWriter.state == GRXWriterStateNotStarted, - @"The requests writer can't be already started."); - if (!host || !path) { - return nil; - } - if (safety > GRPCCallSafetyCacheableRequest) { - return nil; - } - if (requestsWriter.state != GRXWriterStateNotStarted) { - return nil; - } - - if ((self = [super init])) { - _host = [host copy]; - _path = [path copy]; - _callSafety = safety; - _callOptions = [callOptions copy]; - - // Serial queue to invoke the non-reentrant methods of the grpc_call object. - _callQueue = dispatch_queue_create("io.grpc.call", DISPATCH_QUEUE_SERIAL); - - _requestWriter = requestsWriter; - _requestHeaders = [[GRPCRequestHeaders alloc] initWithCall:self]; - _writeDone = writeDone; - - if ([requestsWriter isKindOfClass:[GRXImmediateSingleWriter class]]) { - _unaryCall = YES; - _unaryOpBatch = [NSMutableArray arrayWithCapacity:kMaxClientBatch]; - } - - _responseQueue = dispatch_get_main_queue(); - - // do not start a read until initial metadata is received - _pendingReceiveNextMessages = 0; - _pendingCoreRead = YES; - } - return self; -} - -- (void)setResponseDispatchQueue:(dispatch_queue_t)queue { - @synchronized(self) { - if (_state != GRXWriterStateNotStarted) { - return; - } - _responseQueue = queue; - } -} - -#pragma mark Finish - -// This function should support being called within a @synchronized(self) block in another function -// Should not manipulate _requestWriter for deadlock prevention. -- (void)finishWithError:(NSError *)errorOrNil { - @synchronized(self) { - if (_state == GRXWriterStateFinished) { - return; - } - _state = GRXWriterStateFinished; - - if (errorOrNil) { - [_responseWriteable cancelWithError:errorOrNil]; - } else { - [_responseWriteable enqueueSuccessfulCompletion]; - } - - // If the call isn't retained anywhere else, it can be deallocated now. - _retainSelf = nil; - } -} - -- (void)cancel { - @synchronized(self) { - if (_state == GRXWriterStateFinished) { - return; - } - [self finishWithError:[NSError - errorWithDomain:kGRPCErrorDomain - code:GRPCErrorCodeCancelled - userInfo:@{NSLocalizedDescriptionKey : @"Canceled by app"}]]; - [_wrappedCall cancel]; - } - _requestWriter.state = GRXWriterStateFinished; -} - -- (void)dealloc { - __block GRPCWrappedCall *wrappedCall = _wrappedCall; - dispatch_async(_callQueue, ^{ - wrappedCall = nil; - }); -} - -#pragma mark Read messages - -// Only called from the call queue. -// The handler will be called from the network queue. -- (void)startReadWithHandler:(void (^)(grpc_byte_buffer *))handler { - // TODO(jcanizales): Add error handlers for async failures - [_wrappedCall startBatchWithOperations:@[ [[GRPCOpRecvMessage alloc] initWithHandler:handler] ]]; -} - -// Called initially from the network queue once response headers are received, -// then "recursively" from the responseWriteable queue after each response from the -// server has been written. -// If the call is currently paused, this is a noop. Restarting the call will invoke this -// method. -// TODO(jcanizales): Rename to readResponseIfNotPaused. -- (void)maybeStartNextRead { - @synchronized(self) { - if (_state != GRXWriterStateStarted) { - return; - } - if (_callOptions.flowControlEnabled && (_pendingCoreRead || _pendingReceiveNextMessages == 0)) { - return; - } - _pendingCoreRead = YES; - _pendingReceiveNextMessages--; - } - - dispatch_async(_callQueue, ^{ - __weak GRPCCall *weakSelf = self; - [self startReadWithHandler:^(grpc_byte_buffer *message) { - if (message == NULL) { - // No more messages from the server - return; - } - __strong GRPCCall *strongSelf = weakSelf; - if (strongSelf == nil) { - grpc_byte_buffer_destroy(message); - return; - } - NSData *data = [NSData grpc_dataWithByteBuffer:message]; - grpc_byte_buffer_destroy(message); - if (!data) { - // The app doesn't have enough memory to hold the server response. We - // don't want to throw, because the app shouldn't crash for a behavior - // that's on the hands of any server to have. Instead we finish and ask - // the server to cancel. - @synchronized(strongSelf) { - strongSelf->_pendingCoreRead = NO; - [strongSelf - finishWithError:[NSError errorWithDomain:kGRPCErrorDomain - code:GRPCErrorCodeResourceExhausted - userInfo:@{ - NSLocalizedDescriptionKey : - @"Client does not have enough memory to " - @"hold the server response." - }]]; - [strongSelf->_wrappedCall cancel]; - } - strongSelf->_requestWriter.state = GRXWriterStateFinished; - } else { - @synchronized(strongSelf) { - [strongSelf->_responseWriteable enqueueValue:data - completionHandler:^{ - __strong GRPCCall *strongSelf = weakSelf; - if (strongSelf) { - @synchronized(strongSelf) { - strongSelf->_pendingCoreRead = NO; - [strongSelf maybeStartNextRead]; - } - } - }]; - } - } - }]; + id copiedFirstInterceptor = _firstInterceptor; + dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ + [copiedFirstInterceptor writeData:data]; }); } -#pragma mark Send headers - -- (void)sendHeaders { - // TODO (mxyan): Remove after deprecated methods are removed - uint32_t callSafetyFlags = 0; - switch (_callSafety) { - case GRPCCallSafetyDefault: - callSafetyFlags = 0; - break; - case GRPCCallSafetyIdempotentRequest: - callSafetyFlags = GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; - break; - case GRPCCallSafetyCacheableRequest: - callSafetyFlags = GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; - break; - } - - NSMutableDictionary *headers = [_requestHeaders mutableCopy]; - NSString *fetchedOauth2AccessToken; - @synchronized(self) { - fetchedOauth2AccessToken = _fetchedOauth2AccessToken; - } - if (fetchedOauth2AccessToken != nil) { - headers[@"authorization"] = [kBearerPrefix stringByAppendingString:fetchedOauth2AccessToken]; - } else if (_callOptions.oauth2AccessToken != nil) { - headers[@"authorization"] = - [kBearerPrefix stringByAppendingString:_callOptions.oauth2AccessToken]; - } - - // TODO(jcanizales): Add error handlers for async failures - GRPCOpSendMetadata *op = [[GRPCOpSendMetadata alloc] - initWithMetadata:headers - flags:callSafetyFlags - handler:nil]; // No clean-up needed after SEND_INITIAL_METADATA - dispatch_async(_callQueue, ^{ - if (!self->_unaryCall) { - [self->_wrappedCall startBatchWithOperations:@[ op ]]; - } else { - [self->_unaryOpBatch addObject:op]; - } +- (void)finish { + id copiedFirstInterceptor = _firstInterceptor; + dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ + [copiedFirstInterceptor finish]; }); } - (void)receiveNextMessages:(NSUInteger)numberOfMessages { - if (numberOfMessages == 0) { - return; - } - @synchronized(self) { - _pendingReceiveNextMessages += numberOfMessages; - - if (_state != GRXWriterStateStarted || !_callOptions.flowControlEnabled) { - return; - } - [self maybeStartNextRead]; - } -} - -#pragma mark GRXWriteable implementation - -// Only called from the call queue. The error handler will be called from the -// network queue if the write didn't succeed. -// If the call is a unary call, parameter \a errorHandler will be ignored and -// the error handler of GRPCOpSendClose will be executed in case of error. -- (void)writeMessage:(NSData *)message withErrorHandler:(void (^)(void))errorHandler { - __weak GRPCCall *weakSelf = self; - void (^resumingHandler)(void) = ^{ - // Resume the request writer. - GRPCCall *strongSelf = weakSelf; - if (strongSelf) { - strongSelf->_requestWriter.state = GRXWriterStateStarted; - if (strongSelf->_writeDone) { - strongSelf->_writeDone(); - } - } - }; - GRPCOpSendMessage *op = - [[GRPCOpSendMessage alloc] initWithMessage:message handler:resumingHandler]; - if (!_unaryCall) { - [_wrappedCall startBatchWithOperations:@[ op ] errorHandler:errorHandler]; - } else { - // Ignored errorHandler since it is the same as the one for GRPCOpSendClose. - // TODO (mxyan): unify the error handlers of all Ops into a single closure. - [_unaryOpBatch addObject:op]; - } -} - -- (void)writeValue:(id)value { - NSAssert([value isKindOfClass:[NSData class]], @"value must be of type NSData"); - - @synchronized(self) { - if (_state == GRXWriterStateFinished) { - return; - } - } - - // Pause the input and only resume it when the C layer notifies us that writes - // can proceed. - _requestWriter.state = GRXWriterStatePaused; - - dispatch_async(_callQueue, ^{ - // Write error is not processed here. It is handled by op batch of GRPC_OP_RECV_STATUS_ON_CLIENT - [self writeMessage:value withErrorHandler:nil]; - }); -} - -// Only called from the call queue. The error handler will be called from the -// network queue if the requests stream couldn't be closed successfully. -- (void)finishRequestWithErrorHandler:(void (^)(void))errorHandler { - if (!_unaryCall) { - [_wrappedCall startBatchWithOperations:@[ [[GRPCOpSendClose alloc] init] ] - errorHandler:errorHandler]; - } else { - [_unaryOpBatch addObject:[[GRPCOpSendClose alloc] init]]; - [_wrappedCall startBatchWithOperations:_unaryOpBatch errorHandler:errorHandler]; - } -} - -- (void)writesFinishedWithError:(NSError *)errorOrNil { - if (errorOrNil) { - [self cancel]; - } else { - dispatch_async(_callQueue, ^{ - // EOS error is not processed here. It is handled by op batch of GRPC_OP_RECV_STATUS_ON_CLIENT - [self finishRequestWithErrorHandler:nil]; - }); - } -} - -#pragma mark Invoke - -// Both handlers will eventually be called, from the network queue. Writes can start immediately -// after this. -// The first one (headersHandler), when the response headers are received. -// The second one (completionHandler), whenever the RPC finishes for any reason. -- (void)invokeCallWithHeadersHandler:(void (^)(NSDictionary *))headersHandler - completionHandler:(void (^)(NSError *, NSDictionary *))completionHandler { - dispatch_async(_callQueue, ^{ - // TODO(jcanizales): Add error handlers for async failures - [self->_wrappedCall - startBatchWithOperations:@[ [[GRPCOpRecvMetadata alloc] initWithHandler:headersHandler] ]]; - [self->_wrappedCall - startBatchWithOperations:@[ [[GRPCOpRecvStatus alloc] initWithHandler:completionHandler] ]]; + id copiedFirstInterceptor = _firstInterceptor; + dispatch_async(copiedFirstInterceptor.dispatchQueue, ^{ + [copiedFirstInterceptor receiveNextMessages:numberOfMessages]; }); } -- (void)invokeCall { - __weak GRPCCall *weakSelf = self; - [self invokeCallWithHeadersHandler:^(NSDictionary *headers) { - // Response headers received. - __strong GRPCCall *strongSelf = weakSelf; - if (strongSelf) { - @synchronized(strongSelf) { - // it is ok to set nil because headers are only received once - strongSelf.responseHeaders = nil; - // copy the header so that the GRPCOpRecvMetadata object may be dealloc'ed - NSDictionary *copiedHeaders = - [[NSDictionary alloc] initWithDictionary:headers copyItems:YES]; - strongSelf.responseHeaders = copiedHeaders; - strongSelf->_pendingCoreRead = NO; - [strongSelf maybeStartNextRead]; - } - } - } - completionHandler:^(NSError *error, NSDictionary *trailers) { - __strong GRPCCall *strongSelf = weakSelf; - if (strongSelf) { - strongSelf.responseTrailers = trailers; - - if (error) { - NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; - if (error.userInfo) { - [userInfo addEntriesFromDictionary:error.userInfo]; - } - userInfo[kGRPCTrailersKey] = strongSelf.responseTrailers; - // Since gRPC core does not guarantee the headers block being called before this block, - // responseHeaders might be nil. - userInfo[kGRPCHeadersKey] = strongSelf.responseHeaders; - error = [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo]; - } - [strongSelf finishWithError:error]; - strongSelf->_requestWriter.state = GRXWriterStateFinished; - } - }]; -} - -#pragma mark GRXWriter implementation - -// Lock acquired inside startWithWriteable: -- (void)startCallWithWriteable:(id)writeable { - @synchronized(self) { - if (_state == GRXWriterStateFinished) { - return; - } - - _responseWriteable = - [[GRXConcurrentWriteable alloc] initWithWriteable:writeable dispatchQueue:_responseQueue]; - - GRPCPooledChannel *channel = - [[GRPCChannelPool sharedInstance] channelWithHost:_host callOptions:_callOptions]; - _wrappedCall = [channel wrappedCallWithPath:_path - completionQueue:[GRPCCompletionQueue completionQueue] - callOptions:_callOptions]; - - if (_wrappedCall == nil) { - [self finishWithError:[NSError errorWithDomain:kGRPCErrorDomain - code:GRPCErrorCodeUnavailable - userInfo:@{ - NSLocalizedDescriptionKey : - @"Failed to create call or channel." - }]]; - return; - } - - [self sendHeaders]; - [self invokeCall]; - } - - // Now that the RPC has been initiated, request writes can start. - [_requestWriter startWithWriteable:self]; -} - -- (void)startWithWriteable:(id)writeable { - id tokenProvider = nil; - @synchronized(self) { - _state = GRXWriterStateStarted; - - // Create a retain cycle so that this instance lives until the RPC finishes (or is cancelled). - // This makes RPCs in which the call isn't externally retained possible (as long as it is - // started before being autoreleased). Care is taken not to retain self strongly in any of the - // blocks used in this implementation, so that the life of the instance is determined by this - // retain cycle. - _retainSelf = self; - - if (_callOptions == nil) { - GRPCMutableCallOptions *callOptions = [[GRPCHost callOptionsForHost:_host] mutableCopy]; - if (_serverName.length != 0) { - callOptions.serverAuthority = _serverName; - } - if (_timeout > 0) { - callOptions.timeout = _timeout; - } - uint32_t callFlags = [GRPCCall callFlagsForHost:_host path:_path]; - if (callFlags != 0) { - if (callFlags == GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) { - _callSafety = GRPCCallSafetyIdempotentRequest; - } else if (callFlags == GRPC_INITIAL_METADATA_CACHEABLE_REQUEST) { - _callSafety = GRPCCallSafetyCacheableRequest; - } - } - - id tokenProvider = self.tokenProvider; - if (tokenProvider != nil) { - callOptions.authTokenProvider = tokenProvider; - } - _callOptions = callOptions; - } - - NSAssert(_callOptions.authTokenProvider == nil || _callOptions.oauth2AccessToken == nil, - @"authTokenProvider and oauth2AccessToken cannot be set at the same time"); - - tokenProvider = _callOptions.authTokenProvider; - } - - if (tokenProvider != nil) { - __weak typeof(self) weakSelf = self; - [tokenProvider getTokenWithHandler:^(NSString *token) { - __strong typeof(self) strongSelf = weakSelf; - if (strongSelf) { - BOOL startCall = NO; - @synchronized(strongSelf) { - if (strongSelf->_state != GRXWriterStateFinished) { - startCall = YES; - if (token) { - strongSelf->_fetchedOauth2AccessToken = [token copy]; - } - } - } - if (startCall) { - [strongSelf startCallWithWriteable:writeable]; - } - } - }]; - } else { - [self startCallWithWriteable:writeable]; - } -} - -- (void)setState:(GRXWriterState)newState { - @synchronized(self) { - // Manual transitions are only allowed from the started or paused states. - if (_state == GRXWriterStateNotStarted || _state == GRXWriterStateFinished) { - return; - } - - switch (newState) { - case GRXWriterStateFinished: - _state = newState; - // Per GRXWriter's contract, setting the state to Finished manually - // means one doesn't wish the writeable to be messaged anymore. - [_responseWriteable cancelSilently]; - _responseWriteable = nil; - return; - case GRXWriterStatePaused: - _state = newState; - return; - case GRXWriterStateStarted: - if (_state == GRXWriterStatePaused) { - _state = newState; - [self maybeStartNextRead]; - } - return; - case GRXWriterStateNotStarted: - return; - } - } -} - @end diff --git a/src/objective-c/GRPCClient/GRPCCallLegacy.h b/src/objective-c/GRPCClient/GRPCCallLegacy.h new file mode 100644 index 00000000000..51dd7da3440 --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCCallLegacy.h @@ -0,0 +1,136 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/** + * This is the legacy interface of this gRPC library. This API is deprecated and users should use + * the API in GRPCCall.h. This API exists solely for the purpose of backwards compatibility. + */ + +#import +#import "GRPCTypes.h" + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnullability-completeness" + +/** + * This interface is deprecated. Please use \a GRPCCall2. + * + * Represents a single gRPC remote call. + */ +@interface GRPCCall : GRXWriter + +- (instancetype)init NS_UNAVAILABLE; + +/** + * The container of the request headers of an RPC conforms to this protocol, which is a subset of + * NSMutableDictionary's interface. It will become a NSMutableDictionary later on. + * The keys of this container are the header names, which per the HTTP standard are case- + * insensitive. They are stored in lowercase (which is how HTTP/2 mandates them on the wire), and + * can only consist of ASCII characters. + * A header value is a NSString object (with only ASCII characters), unless the header name has the + * suffix "-bin", in which case the value has to be a NSData object. + */ +/** + * These HTTP headers will be passed to the server as part of this call. Each HTTP header is a + * name-value pair with string names and either string or binary values. + * + * The passed dictionary has to use NSString keys, corresponding to the header names. The value + * associated to each can be a NSString object or a NSData object. E.g.: + * + * call.requestHeaders = @{@"authorization": @"Bearer ..."}; + * + * call.requestHeaders[@"my-header-bin"] = someData; + * + * After the call is started, trying to modify this property is an error. + * + * The property is initialized to an empty NSMutableDictionary. + */ +@property(atomic, readonly) NSMutableDictionary *requestHeaders; + +/** + * This dictionary is populated with the HTTP headers received from the server. This happens before + * any response message is received from the server. It has the same structure as the request + * headers dictionary: Keys are NSString header names; names ending with the suffix "-bin" have a + * NSData value; the others have a NSString value. + * + * The value of this property is nil until all response headers are received, and will change before + * any of -writeValue: or -writesFinishedWithError: are sent to the writeable. + */ +@property(atomic, readonly) NSDictionary *responseHeaders; + +/** + * Same as responseHeaders, but populated with the HTTP trailers received from the server before the + * call finishes. + * + * The value of this property is nil until all response trailers are received, and will change + * before -writesFinishedWithError: is sent to the writeable. + */ +@property(atomic, readonly) NSDictionary *responseTrailers; + +/** + * The request writer has to write NSData objects into the provided Writeable. The server will + * receive each of those separately and in order as distinct messages. + * A gRPC call might not complete until the request writer finishes. On the other hand, the request + * finishing doesn't necessarily make the call to finish, as the server might continue sending + * messages to the response side of the call indefinitely (depending on the semantics of the + * specific remote method called). + * To finish a call right away, invoke cancel. + * host parameter should not contain the scheme (http:// or https://), only the name or IP addr + * and the port number, for example @"localhost:5050". + */ +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + requestsWriter:(GRXWriter *)requestWriter; + +/** + * Finishes the request side of this call, notifies the server that the RPC should be cancelled, and + * finishes the response side of the call with an error of code CANCELED. + */ +- (void)cancel; + +/** + * The following methods are deprecated. + */ ++ (void)setCallSafety:(GRPCCallSafety)callSafety host:(NSString *)host path:(NSString *)path; +@property(atomic, copy, readwrite) NSString *serverName; +@property NSTimeInterval timeout; +- (void)setResponseDispatchQueue:(dispatch_queue_t)queue; + +@end + +#pragma mark Backwards compatibiity + +/** This protocol is kept for backwards compatibility with existing code. */ +DEPRECATED_MSG_ATTRIBUTE("Use NSDictionary or NSMutableDictionary instead.") +@protocol GRPCRequestHeaders +@property(nonatomic, readonly) NSUInteger count; + +- (id)objectForKeyedSubscript:(id)key; +- (void)setObject:(id)obj forKeyedSubscript:(id)key; + +- (void)removeAllObjects; +- (void)removeObjectForKey:(id)key; +@end + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" +/** This is only needed for backwards-compatibility. */ +@interface NSMutableDictionary (GRPCRequestHeaders) +@end +#pragma clang diagnostic pop +#pragma clang diagnostic pop diff --git a/src/objective-c/GRPCClient/GRPCCallLegacy.m b/src/objective-c/GRPCClient/GRPCCallLegacy.m new file mode 100644 index 00000000000..d06048c3a89 --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCCallLegacy.m @@ -0,0 +1,677 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "GRPCCallLegacy.h" + +#import "GRPCCall+OAuth2.h" +#import "GRPCCallOptions.h" +#import "GRPCTypes.h" + +#import "private/GRPCCore/GRPCChannelPool.h" +#import "private/GRPCCore/GRPCCompletionQueue.h" +#import "private/GRPCCore/GRPCHost.h" +#import "private/GRPCCore/GRPCWrappedCall.h" +#import "private/GRPCCore/NSData+GRPC.h" + +#import +#import +#import +#import + +#include + +const char *kCFStreamVarName = "grpc_cfstream"; +static NSMutableDictionary *callFlags; + +// At most 6 ops can be in an op batch for a client: SEND_INITIAL_METADATA, +// SEND_MESSAGE, SEND_CLOSE_FROM_CLIENT, RECV_INITIAL_METADATA, RECV_MESSAGE, +// and RECV_STATUS_ON_CLIENT. +NSInteger kMaxClientBatch = 6; + +static NSString *const kAuthorizationHeader = @"authorization"; +static NSString *const kBearerPrefix = @"Bearer "; + +@interface GRPCCall () +// Make them read-write. +@property(atomic, strong) NSDictionary *responseHeaders; +@property(atomic, strong) NSDictionary *responseTrailers; + +- (void)receiveNextMessages:(NSUInteger)numberOfMessages; + +@end + +// The following methods of a C gRPC call object aren't reentrant, and thus +// calls to them must be serialized: +// - start_batch +// - destroy +// +// start_batch with a SEND_MESSAGE argument can only be called after the +// OP_COMPLETE event for any previous write is received. This is achieved by +// pausing the requests writer immediately every time it writes a value, and +// resuming it again when OP_COMPLETE is received. +// +// Similarly, start_batch with a RECV_MESSAGE argument can only be called after +// the OP_COMPLETE event for any previous read is received.This is easier to +// enforce, as we're writing the received messages into the writeable: +// start_batch is enqueued once upon receiving the OP_COMPLETE event for the +// RECV_METADATA batch, and then once after receiving each OP_COMPLETE event for +// each RECV_MESSAGE batch. +@implementation GRPCCall { + dispatch_queue_t _callQueue; + + NSString *_host; + NSString *_path; + GRPCCallSafety _callSafety; + GRPCCallOptions *_callOptions; + GRPCWrappedCall *_wrappedCall; + + // The C gRPC library has less guarantees on the ordering of events than we + // do. Particularly, in the face of errors, there's no ordering guarantee at + // all. This wrapper over our actual writeable ensures thread-safety and + // correct ordering. + GRXConcurrentWriteable *_responseWriteable; + + // The network thread wants the requestWriter to resume (when the server is ready for more input), + // or to stop (on errors), concurrently with user threads that want to start it, pause it or stop + // it. Because a writer isn't thread-safe, we'll synchronize those operations on it. + // We don't use a dispatch queue for that purpose, because the writer can call writeValue: or + // writesFinishedWithError: on this GRPCCall as part of those operations. We want to be able to + // pause the writer immediately on writeValue:, so we need our locking to be recursive. + GRXWriter *_requestWriter; + + // To create a retain cycle when a call is started, up until it finishes. See + // |startWithWriteable:| and |finishWithError:|. This saves users from having to retain a + // reference to the call object if all they're interested in is the handler being executed when + // the response arrives. + GRPCCall *_retainSelf; + + GRPCRequestHeaders *_requestHeaders; + + // In the case that the call is a unary call (i.e. the writer to GRPCCall is of type + // GRXImmediateSingleWriter), GRPCCall will delay sending ops (not send them to C core + // immediately) and buffer them into a batch _unaryOpBatch. The batch is sent to C core when + // the SendClose op is added. + BOOL _unaryCall; + NSMutableArray *_unaryOpBatch; + + // The dispatch queue to be used for enqueuing responses to user. Defaulted to the main dispatch + // queue + dispatch_queue_t _responseQueue; + + // The OAuth2 token fetched from a token provider. + NSString *_fetchedOauth2AccessToken; + + // The callback to be called when a write message op is done. + void (^_writeDone)(void); + + // Indicate a read request to core is pending. + BOOL _pendingCoreRead; + + // Indicate pending read message request from user. + NSUInteger _pendingReceiveNextMessages; +} + +@synthesize state = _state; + ++ (void)initialize { + // Guarantees the code in {} block is invoked only once. See ref at: + // https://developer.apple.com/documentation/objectivec/nsobject/1418639-initialize?language=objc + if (self == [GRPCCall self]) { + grpc_init(); + callFlags = [NSMutableDictionary dictionary]; + } +} + ++ (void)setCallSafety:(GRPCCallSafety)callSafety host:(NSString *)host path:(NSString *)path { + if (host.length == 0 || path.length == 0) { + return; + } + NSString *hostAndPath = [NSString stringWithFormat:@"%@/%@", host, path]; + @synchronized(callFlags) { + switch (callSafety) { + case GRPCCallSafetyDefault: + callFlags[hostAndPath] = @0; + break; + case GRPCCallSafetyIdempotentRequest: + callFlags[hostAndPath] = @GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; + break; + case GRPCCallSafetyCacheableRequest: + callFlags[hostAndPath] = @GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; + break; + default: + break; + } + } +} + ++ (uint32_t)callFlagsForHost:(NSString *)host path:(NSString *)path { + NSString *hostAndPath = [NSString stringWithFormat:@"%@/%@", host, path]; + @synchronized(callFlags) { + return [callFlags[hostAndPath] intValue]; + } +} + +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + requestsWriter:(GRXWriter *)requestWriter { + return [self initWithHost:host + path:path + callSafety:GRPCCallSafetyDefault + requestsWriter:requestWriter + callOptions:nil + writeDone:nil]; +} + +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + callSafety:(GRPCCallSafety)safety + requestsWriter:(GRXWriter *)requestsWriter + callOptions:(GRPCCallOptions *)callOptions + writeDone:(void (^)(void))writeDone { + // Purposely using pointer rather than length (host.length == 0) for backwards compatibility. + NSAssert(host != nil && path != nil, @"Neither host nor path can be nil."); + NSAssert(safety <= GRPCCallSafetyCacheableRequest, @"Invalid call safety value."); + NSAssert(requestsWriter.state == GRXWriterStateNotStarted, + @"The requests writer can't be already started."); + if (!host || !path) { + return nil; + } + if (safety > GRPCCallSafetyCacheableRequest) { + return nil; + } + if (requestsWriter.state != GRXWriterStateNotStarted) { + return nil; + } + + if ((self = [super init])) { + _host = [host copy]; + _path = [path copy]; + _callSafety = safety; + _callOptions = [callOptions copy]; + + // Serial queue to invoke the non-reentrant methods of the grpc_call object. + _callQueue = dispatch_queue_create("io.grpc.call", DISPATCH_QUEUE_SERIAL); + + _requestWriter = requestsWriter; + _requestHeaders = [[GRPCRequestHeaders alloc] initWithCall:self]; + _writeDone = writeDone; + + if ([requestsWriter isKindOfClass:[GRXImmediateSingleWriter class]]) { + _unaryCall = YES; + _unaryOpBatch = [NSMutableArray arrayWithCapacity:kMaxClientBatch]; + } + + _responseQueue = dispatch_get_main_queue(); + + // do not start a read until initial metadata is received + _pendingReceiveNextMessages = 0; + _pendingCoreRead = YES; + } + return self; +} + +- (void)setResponseDispatchQueue:(dispatch_queue_t)queue { + @synchronized(self) { + if (_state != GRXWriterStateNotStarted) { + return; + } + _responseQueue = queue; + } +} + +#pragma mark Finish + +// This function should support being called within a @synchronized(self) block in another function +// Should not manipulate _requestWriter for deadlock prevention. +- (void)finishWithError:(NSError *)errorOrNil { + @synchronized(self) { + if (_state == GRXWriterStateFinished) { + return; + } + _state = GRXWriterStateFinished; + + if (errorOrNil) { + [_responseWriteable cancelWithError:errorOrNil]; + } else { + [_responseWriteable enqueueSuccessfulCompletion]; + } + + // If the call isn't retained anywhere else, it can be deallocated now. + _retainSelf = nil; + } +} + +- (void)cancel { + @synchronized(self) { + if (_state == GRXWriterStateFinished) { + return; + } + [self finishWithError:[NSError + errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeCancelled + userInfo:@{NSLocalizedDescriptionKey : @"Canceled by app"}]]; + [_wrappedCall cancel]; + } + _requestWriter.state = GRXWriterStateFinished; +} + +- (void)dealloc { + __block GRPCWrappedCall *wrappedCall = _wrappedCall; + dispatch_async(_callQueue, ^{ + wrappedCall = nil; + }); +} + +#pragma mark Read messages + +// Only called from the call queue. +// The handler will be called from the network queue. +- (void)startReadWithHandler:(void (^)(grpc_byte_buffer *))handler { + // TODO(jcanizales): Add error handlers for async failures + [_wrappedCall startBatchWithOperations:@[ [[GRPCOpRecvMessage alloc] initWithHandler:handler] ]]; +} + +// Called initially from the network queue once response headers are received, +// then "recursively" from the responseWriteable queue after each response from the +// server has been written. +// If the call is currently paused, this is a noop. Restarting the call will invoke this +// method. +// TODO(jcanizales): Rename to readResponseIfNotPaused. +- (void)maybeStartNextRead { + @synchronized(self) { + if (_state != GRXWriterStateStarted) { + return; + } + if (_callOptions.flowControlEnabled && (_pendingCoreRead || _pendingReceiveNextMessages == 0)) { + return; + } + _pendingCoreRead = YES; + _pendingReceiveNextMessages--; + } + + dispatch_async(_callQueue, ^{ + __weak GRPCCall *weakSelf = self; + [self startReadWithHandler:^(grpc_byte_buffer *message) { + if (message == NULL) { + // No more messages from the server + return; + } + __strong GRPCCall *strongSelf = weakSelf; + if (strongSelf == nil) { + grpc_byte_buffer_destroy(message); + return; + } + NSData *data = [NSData grpc_dataWithByteBuffer:message]; + grpc_byte_buffer_destroy(message); + if (!data) { + // The app doesn't have enough memory to hold the server response. We + // don't want to throw, because the app shouldn't crash for a behavior + // that's on the hands of any server to have. Instead we finish and ask + // the server to cancel. + @synchronized(strongSelf) { + strongSelf->_pendingCoreRead = NO; + [strongSelf + finishWithError:[NSError errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeResourceExhausted + userInfo:@{ + NSLocalizedDescriptionKey : + @"Client does not have enough memory to " + @"hold the server response." + }]]; + [strongSelf->_wrappedCall cancel]; + } + strongSelf->_requestWriter.state = GRXWriterStateFinished; + } else { + @synchronized(strongSelf) { + [strongSelf->_responseWriteable enqueueValue:data + completionHandler:^{ + __strong GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + @synchronized(strongSelf) { + strongSelf->_pendingCoreRead = NO; + [strongSelf maybeStartNextRead]; + } + } + }]; + } + } + }]; + }); +} + +#pragma mark Send headers + +- (void)sendHeaders { + // TODO (mxyan): Remove after deprecated methods are removed + uint32_t callSafetyFlags = 0; + switch (_callSafety) { + case GRPCCallSafetyDefault: + callSafetyFlags = 0; + break; + case GRPCCallSafetyIdempotentRequest: + callSafetyFlags = GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; + break; + case GRPCCallSafetyCacheableRequest: + callSafetyFlags = GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; + break; + } + + NSMutableDictionary *headers = [_requestHeaders mutableCopy]; + NSString *fetchedOauth2AccessToken; + @synchronized(self) { + fetchedOauth2AccessToken = _fetchedOauth2AccessToken; + } + if (fetchedOauth2AccessToken != nil) { + headers[@"authorization"] = [kBearerPrefix stringByAppendingString:fetchedOauth2AccessToken]; + } else if (_callOptions.oauth2AccessToken != nil) { + headers[@"authorization"] = + [kBearerPrefix stringByAppendingString:_callOptions.oauth2AccessToken]; + } + + // TODO(jcanizales): Add error handlers for async failures + GRPCOpSendMetadata *op = [[GRPCOpSendMetadata alloc] + initWithMetadata:headers + flags:callSafetyFlags + handler:nil]; // No clean-up needed after SEND_INITIAL_METADATA + dispatch_async(_callQueue, ^{ + if (!self->_unaryCall) { + [self->_wrappedCall startBatchWithOperations:@[ op ]]; + } else { + [self->_unaryOpBatch addObject:op]; + } + }); +} + +- (void)receiveNextMessages:(NSUInteger)numberOfMessages { + if (numberOfMessages == 0) { + return; + } + @synchronized(self) { + _pendingReceiveNextMessages += numberOfMessages; + + if (_state != GRXWriterStateStarted || !_callOptions.flowControlEnabled) { + return; + } + [self maybeStartNextRead]; + } +} + +#pragma mark GRXWriteable implementation + +// Only called from the call queue. The error handler will be called from the +// network queue if the write didn't succeed. +// If the call is a unary call, parameter \a errorHandler will be ignored and +// the error handler of GRPCOpSendClose will be executed in case of error. +- (void)writeMessage:(NSData *)message withErrorHandler:(void (^)(void))errorHandler { + __weak GRPCCall *weakSelf = self; + void (^resumingHandler)(void) = ^{ + // Resume the request writer. + GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + strongSelf->_requestWriter.state = GRXWriterStateStarted; + if (strongSelf->_writeDone) { + strongSelf->_writeDone(); + } + } + }; + GRPCOpSendMessage *op = + [[GRPCOpSendMessage alloc] initWithMessage:message handler:resumingHandler]; + if (!_unaryCall) { + [_wrappedCall startBatchWithOperations:@[ op ] errorHandler:errorHandler]; + } else { + // Ignored errorHandler since it is the same as the one for GRPCOpSendClose. + // TODO (mxyan): unify the error handlers of all Ops into a single closure. + [_unaryOpBatch addObject:op]; + } +} + +- (void)writeValue:(id)value { + NSAssert([value isKindOfClass:[NSData class]], @"value must be of type NSData"); + + @synchronized(self) { + if (_state == GRXWriterStateFinished) { + return; + } + } + + // Pause the input and only resume it when the C layer notifies us that writes + // can proceed. + _requestWriter.state = GRXWriterStatePaused; + + dispatch_async(_callQueue, ^{ + // Write error is not processed here. It is handled by op batch of GRPC_OP_RECV_STATUS_ON_CLIENT + [self writeMessage:value withErrorHandler:nil]; + }); +} + +// Only called from the call queue. The error handler will be called from the +// network queue if the requests stream couldn't be closed successfully. +- (void)finishRequestWithErrorHandler:(void (^)(void))errorHandler { + if (!_unaryCall) { + [_wrappedCall startBatchWithOperations:@[ [[GRPCOpSendClose alloc] init] ] + errorHandler:errorHandler]; + } else { + [_unaryOpBatch addObject:[[GRPCOpSendClose alloc] init]]; + [_wrappedCall startBatchWithOperations:_unaryOpBatch errorHandler:errorHandler]; + } +} + +- (void)writesFinishedWithError:(NSError *)errorOrNil { + if (errorOrNil) { + [self cancel]; + } else { + dispatch_async(_callQueue, ^{ + // EOS error is not processed here. It is handled by op batch of GRPC_OP_RECV_STATUS_ON_CLIENT + [self finishRequestWithErrorHandler:nil]; + }); + } +} + +#pragma mark Invoke + +// Both handlers will eventually be called, from the network queue. Writes can start immediately +// after this. +// The first one (headersHandler), when the response headers are received. +// The second one (completionHandler), whenever the RPC finishes for any reason. +- (void)invokeCallWithHeadersHandler:(void (^)(NSDictionary *))headersHandler + completionHandler:(void (^)(NSError *, NSDictionary *))completionHandler { + dispatch_async(_callQueue, ^{ + // TODO(jcanizales): Add error handlers for async failures + [self->_wrappedCall + startBatchWithOperations:@[ [[GRPCOpRecvMetadata alloc] initWithHandler:headersHandler] ]]; + [self->_wrappedCall + startBatchWithOperations:@[ [[GRPCOpRecvStatus alloc] initWithHandler:completionHandler] ]]; + }); +} + +- (void)invokeCall { + __weak GRPCCall *weakSelf = self; + [self invokeCallWithHeadersHandler:^(NSDictionary *headers) { + // Response headers received. + __strong GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + @synchronized(strongSelf) { + // it is ok to set nil because headers are only received once + strongSelf.responseHeaders = nil; + // copy the header so that the GRPCOpRecvMetadata object may be dealloc'ed + NSDictionary *copiedHeaders = + [[NSDictionary alloc] initWithDictionary:headers copyItems:YES]; + strongSelf.responseHeaders = copiedHeaders; + strongSelf->_pendingCoreRead = NO; + [strongSelf maybeStartNextRead]; + } + } + } + completionHandler:^(NSError *error, NSDictionary *trailers) { + __strong GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + strongSelf.responseTrailers = trailers; + + if (error) { + NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; + if (error.userInfo) { + [userInfo addEntriesFromDictionary:error.userInfo]; + } + userInfo[kGRPCTrailersKey] = strongSelf.responseTrailers; + // Since gRPC core does not guarantee the headers block being called before this block, + // responseHeaders might be nil. + userInfo[kGRPCHeadersKey] = strongSelf.responseHeaders; + error = [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo]; + } + [strongSelf finishWithError:error]; + strongSelf->_requestWriter.state = GRXWriterStateFinished; + } + }]; +} + +#pragma mark GRXWriter implementation + +// Lock acquired inside startWithWriteable: +- (void)startCallWithWriteable:(id)writeable { + @synchronized(self) { + if (_state == GRXWriterStateFinished) { + return; + } + + _responseWriteable = + [[GRXConcurrentWriteable alloc] initWithWriteable:writeable dispatchQueue:_responseQueue]; + + GRPCPooledChannel *channel = + [[GRPCChannelPool sharedInstance] channelWithHost:_host callOptions:_callOptions]; + _wrappedCall = [channel wrappedCallWithPath:_path + completionQueue:[GRPCCompletionQueue completionQueue] + callOptions:_callOptions]; + + if (_wrappedCall == nil) { + [self finishWithError:[NSError errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeUnavailable + userInfo:@{ + NSLocalizedDescriptionKey : + @"Failed to create call or channel." + }]]; + return; + } + + [self sendHeaders]; + [self invokeCall]; + } + + // Now that the RPC has been initiated, request writes can start. + [_requestWriter startWithWriteable:self]; +} + +- (void)startWithWriteable:(id)writeable { + id tokenProvider = nil; + @synchronized(self) { + _state = GRXWriterStateStarted; + + // Create a retain cycle so that this instance lives until the RPC finishes (or is cancelled). + // This makes RPCs in which the call isn't externally retained possible (as long as it is + // started before being autoreleased). Care is taken not to retain self strongly in any of the + // blocks used in this implementation, so that the life of the instance is determined by this + // retain cycle. + _retainSelf = self; + + // If _callOptions is nil, people must be using the deprecated v1 interface. In this case, + // generate the call options from the corresponding GRPCHost configs and apply other options + // that are not covered by GRPCHost. + if (_callOptions == nil) { + GRPCMutableCallOptions *callOptions = [[GRPCHost callOptionsForHost:_host] mutableCopy]; + if (_serverName.length != 0) { + callOptions.serverAuthority = _serverName; + } + if (_timeout > 0) { + callOptions.timeout = _timeout; + } + uint32_t callFlags = [GRPCCall callFlagsForHost:_host path:_path]; + if (callFlags != 0) { + if (callFlags == GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) { + _callSafety = GRPCCallSafetyIdempotentRequest; + } else if (callFlags == GRPC_INITIAL_METADATA_CACHEABLE_REQUEST) { + _callSafety = GRPCCallSafetyCacheableRequest; + } + } + + id tokenProvider = self.tokenProvider; + if (tokenProvider != nil) { + callOptions.authTokenProvider = tokenProvider; + } + _callOptions = callOptions; + } + + NSAssert(_callOptions.authTokenProvider == nil || _callOptions.oauth2AccessToken == nil, + @"authTokenProvider and oauth2AccessToken cannot be set at the same time"); + + tokenProvider = _callOptions.authTokenProvider; + } + + if (tokenProvider != nil) { + __weak typeof(self) weakSelf = self; + [tokenProvider getTokenWithHandler:^(NSString *token) { + __strong typeof(self) strongSelf = weakSelf; + if (strongSelf) { + BOOL startCall = NO; + @synchronized(strongSelf) { + if (strongSelf->_state != GRXWriterStateFinished) { + startCall = YES; + if (token) { + strongSelf->_fetchedOauth2AccessToken = [token copy]; + } + } + } + if (startCall) { + [strongSelf startCallWithWriteable:writeable]; + } + } + }]; + } else { + [self startCallWithWriteable:writeable]; + } +} + +- (void)setState:(GRXWriterState)newState { + @synchronized(self) { + // Manual transitions are only allowed from the started or paused states. + if (_state == GRXWriterStateNotStarted || _state == GRXWriterStateFinished) { + return; + } + + switch (newState) { + case GRXWriterStateFinished: + _state = newState; + // Per GRXWriter's contract, setting the state to Finished manually + // means one doesn't wish the writeable to be messaged anymore. + [_responseWriteable cancelSilently]; + _responseWriteable = nil; + return; + case GRXWriterStatePaused: + _state = newState; + return; + case GRXWriterStateStarted: + if (_state == GRXWriterStatePaused) { + _state = newState; + [self maybeStartNextRead]; + } + return; + case GRXWriterStateNotStarted: + return; + } + } +} + +@end diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.h b/src/objective-c/GRPCClient/GRPCCallOptions.h index 98511e3f5cb..e4261b5b5f9 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.h +++ b/src/objective-c/GRPCClient/GRPCCallOptions.h @@ -18,57 +18,11 @@ #import -NS_ASSUME_NONNULL_BEGIN - -/** - * Safety remark of a gRPC method as defined in RFC 2616 Section 9.1 - */ -typedef NS_ENUM(NSUInteger, GRPCCallSafety) { - /** Signal that there is no guarantees on how the call affects the server state. */ - GRPCCallSafetyDefault = 0, - /** Signal that the call is idempotent. gRPC is free to use PUT verb. */ - GRPCCallSafetyIdempotentRequest = 1, - /** - * Signal that the call is cacheable and will not affect server state. gRPC is free to use GET - * verb. - */ - GRPCCallSafetyCacheableRequest = 2, -}; - -// Compression algorithm to be used by a gRPC call -typedef NS_ENUM(NSUInteger, GRPCCompressionAlgorithm) { - GRPCCompressNone = 0, - GRPCCompressDeflate, - GRPCCompressGzip, - GRPCStreamCompressGzip, -}; - -// GRPCCompressAlgorithm is deprecated; use GRPCCompressionAlgorithm -typedef GRPCCompressionAlgorithm GRPCCompressAlgorithm; +#import "GRPCTypes.h" -/** The transport to be used by a gRPC call */ -typedef NS_ENUM(NSUInteger, GRPCTransportType) { - GRPCTransportTypeDefault = 0, - /** gRPC internal HTTP/2 stack with BoringSSL */ - GRPCTransportTypeChttp2BoringSSL = 0, - /** Cronet stack */ - GRPCTransportTypeCronet, - /** Insecure channel. FOR TEST ONLY! */ - GRPCTransportTypeInsecure, -}; - -/** - * Implement this protocol to provide a token to gRPC when a call is initiated. - */ -@protocol GRPCAuthorizationProtocol - -/** - * This method is called when gRPC is about to start the call. When OAuth token is acquired, - * \a handler is expected to be called with \a token being the new token to be used for this call. - */ -- (void)getTokenWithHandler:(void (^)(NSString *_Nullable token))handler; +NS_ASSUME_NONNULL_BEGIN -@end +@protocol GRPCInterceptorFactory; @interface GRPCCallOptions : NSObject @@ -104,7 +58,7 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) { * this array. This parameter should not be modified by any interceptor and will * not take effect if done so. */ -@property(copy, readonly) NSArray *interceptorFactories; +@property(copy, readonly) NSArray> *interceptorFactories; // OAuth2 parameters. Users of gRPC may specify one of the following two parameters. @@ -192,10 +146,23 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) { @property(copy, readonly, nullable) NSString *PEMCertificateChain; /** + * Deprecated: this option is deprecated. Please use the property \a transport + * instead. + * * Select the transport type to be used for this call. */ @property(readonly) GRPCTransportType transportType; +/** + * The transport to be used for this call. Users may choose a native transport + * identifier defined in \a GRPCTransport or provided by a non-native transport + * implementation. If the option is left to be NULL, gRPC will use its default + * transport. + * + * This is currently an experimental option. + */ +@property(readonly) GRPCTransportId transport; + /** * Override the hostname during the TLS hostname validation process. */ @@ -267,7 +234,7 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) { * this array. This parameter should not be modified by any interceptor and will * not take effect if done so. */ -@property(copy, readwrite) NSArray *interceptorFactories; +@property(copy, readwrite) NSArray> *interceptorFactories; // OAuth2 parameters. Users of gRPC may specify one of the following two parameters. @@ -357,10 +324,23 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) { @property(copy, readwrite, nullable) NSString *PEMCertificateChain; /** + * Deprecated: this option is deprecated. Please use the property \a transport + * instead. + * * Select the transport type to be used for this call. */ @property(readwrite) GRPCTransportType transportType; +/** + * The transport to be used for this call. Users may choose a native transport + * identifier defined in \a GRPCTransport or provided by a non-native ttransport + * implementation. If the option is left to be NULL, gRPC will use its default + * transport. + * + * An interceptor must not change the value of this option. + */ +@property(readwrite) GRPCTransportId transport; + /** * Override the hostname during the TLS hostname validation process. */ diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.m b/src/objective-c/GRPCClient/GRPCCallOptions.m index 392e42a9d47..7f88098eb6f 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.m +++ b/src/objective-c/GRPCClient/GRPCCallOptions.m @@ -17,13 +17,14 @@ */ #import "GRPCCallOptions.h" +#import "GRPCTransport.h" #import "internal/GRPCCallOptions+Internal.h" // The default values for the call options. static NSString *const kDefaultServerAuthority = nil; static const NSTimeInterval kDefaultTimeout = 0; static const BOOL kDefaultFlowControlEnabled = NO; -static NSArray *const kDefaultInterceptorFactories = nil; +static NSArray> *const kDefaultInterceptorFactories = nil; static NSDictionary *const kDefaultInitialMetadata = nil; static NSString *const kDefaultUserAgentPrefix = nil; static const NSUInteger kDefaultResponseSizeLimit = 0; @@ -41,6 +42,7 @@ static NSString *const kDefaultPEMCertificateChain = nil; static NSString *const kDefaultOauth2AccessToken = nil; static const id kDefaultAuthTokenProvider = nil; static const GRPCTransportType kDefaultTransportType = GRPCTransportTypeChttp2BoringSSL; +static const GRPCTransportId kDefaultTransport = NULL; static NSString *const kDefaultHostNameOverride = nil; static const id kDefaultLogContext = nil; static NSString *const kDefaultChannelPoolDomain = nil; @@ -62,7 +64,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { NSString *_serverAuthority; NSTimeInterval _timeout; BOOL _flowControlEnabled; - NSArray *_interceptorFactories; + NSArray> *_interceptorFactories; NSString *_oauth2AccessToken; id _authTokenProvider; NSDictionary *_initialMetadata; @@ -80,6 +82,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { NSString *_PEMPrivateKey; NSString *_PEMCertificateChain; GRPCTransportType _transportType; + GRPCTransportId _transport; NSString *_hostNameOverride; id _logContext; NSString *_channelPoolDomain; @@ -107,6 +110,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { @synthesize PEMPrivateKey = _PEMPrivateKey; @synthesize PEMCertificateChain = _PEMCertificateChain; @synthesize transportType = _transportType; +@synthesize transport = _transport; @synthesize hostNameOverride = _hostNameOverride; @synthesize logContext = _logContext; @synthesize channelPoolDomain = _channelPoolDomain; @@ -134,6 +138,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:kDefaultPEMPrivateKey PEMCertificateChain:kDefaultPEMCertificateChain transportType:kDefaultTransportType + transport:kDefaultTransport hostNameOverride:kDefaultHostNameOverride logContext:kDefaultLogContext channelPoolDomain:kDefaultChannelPoolDomain @@ -143,7 +148,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { - (instancetype)initWithServerAuthority:(NSString *)serverAuthority timeout:(NSTimeInterval)timeout flowControlEnabled:(BOOL)flowControlEnabled - interceptorFactories:(NSArray *)interceptorFactories + interceptorFactories:(NSArray> *)interceptorFactories oauth2AccessToken:(NSString *)oauth2AccessToken authTokenProvider:(id)authTokenProvider initialMetadata:(NSDictionary *)initialMetadata @@ -161,6 +166,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:(NSString *)PEMPrivateKey PEMCertificateChain:(NSString *)PEMCertificateChain transportType:(GRPCTransportType)transportType + transport:(GRPCTransportId)transport hostNameOverride:(NSString *)hostNameOverride logContext:(id)logContext channelPoolDomain:(NSString *)channelPoolDomain @@ -193,6 +199,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { _PEMPrivateKey = [PEMPrivateKey copy]; _PEMCertificateChain = [PEMCertificateChain copy]; _transportType = transportType; + _transport = transport; _hostNameOverride = [hostNameOverride copy]; _logContext = logContext; _channelPoolDomain = [channelPoolDomain copy]; @@ -224,6 +231,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:_PEMPrivateKey PEMCertificateChain:_PEMCertificateChain transportType:_transportType + transport:_transport hostNameOverride:_hostNameOverride logContext:_logContext channelPoolDomain:_channelPoolDomain @@ -256,6 +264,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:[_PEMPrivateKey copy] PEMCertificateChain:[_PEMCertificateChain copy] transportType:_transportType + transport:_transport hostNameOverride:[_hostNameOverride copy] logContext:_logContext channelPoolDomain:[_channelPoolDomain copy] @@ -280,6 +289,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { if (!areObjectsEqual(callOptions.PEMCertificateChain, _PEMCertificateChain)) return NO; if (!areObjectsEqual(callOptions.hostNameOverride, _hostNameOverride)) return NO; if (!(callOptions.transportType == _transportType)) return NO; + if (!(TransportIdIsEqual(callOptions.transport, _transport))) return NO; if (!areObjectsEqual(callOptions.logContext, _logContext)) return NO; if (!areObjectsEqual(callOptions.channelPoolDomain, _channelPoolDomain)) return NO; if (!(callOptions.channelID == _channelID)) return NO; @@ -304,6 +314,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { result ^= _PEMCertificateChain.hash; result ^= _hostNameOverride.hash; result ^= _transportType; + result ^= TransportIdHash(_transport); result ^= _logContext.hash; result ^= _channelPoolDomain.hash; result ^= _channelID; @@ -336,6 +347,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { @dynamic PEMPrivateKey; @dynamic PEMCertificateChain; @dynamic transportType; +@dynamic transport; @dynamic hostNameOverride; @dynamic logContext; @dynamic channelPoolDomain; @@ -363,6 +375,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:kDefaultPEMPrivateKey PEMCertificateChain:kDefaultPEMCertificateChain transportType:kDefaultTransportType + transport:kDefaultTransport hostNameOverride:kDefaultHostNameOverride logContext:kDefaultLogContext channelPoolDomain:kDefaultChannelPoolDomain @@ -392,6 +405,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:_PEMPrivateKey PEMCertificateChain:_PEMCertificateChain transportType:_transportType + transport:_transport hostNameOverride:_hostNameOverride logContext:_logContext channelPoolDomain:_channelPoolDomain @@ -422,6 +436,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:_PEMPrivateKey PEMCertificateChain:_PEMCertificateChain transportType:_transportType + transport:_transport hostNameOverride:_hostNameOverride logContext:_logContext channelPoolDomain:_channelPoolDomain @@ -445,7 +460,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { _flowControlEnabled = flowControlEnabled; } -- (void)setInterceptorFactories:(NSArray *)interceptorFactories { +- (void)setInterceptorFactories:(NSArray> *)interceptorFactories { _interceptorFactories = interceptorFactories; } @@ -538,6 +553,10 @@ static BOOL areObjectsEqual(id obj1, id obj2) { _transportType = transportType; } +- (void)setTransport:(GRPCTransportId)transport { + _transport = transport; +} + - (void)setHostNameOverride:(NSString *)hostNameOverride { _hostNameOverride = [hostNameOverride copy]; } diff --git a/src/objective-c/GRPCClient/GRPCDispatchable.h b/src/objective-c/GRPCClient/GRPCDispatchable.h new file mode 100644 index 00000000000..650103603d4 --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCDispatchable.h @@ -0,0 +1,30 @@ + +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/** + * An object that processes its methods with a dispatch queue. + */ +@protocol GRPCDispatchable + +/** + * The dispatch queue where the object's methods should be run on. + */ +@property(atomic, readonly) dispatch_queue_t dispatchQueue; + +@end diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.h b/src/objective-c/GRPCClient/GRPCInterceptor.h index 3b62c1b3ec0..509749769b3 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.h +++ b/src/objective-c/GRPCClient/GRPCInterceptor.h @@ -106,22 +106,20 @@ */ #import "GRPCCall.h" +#import "GRPCDispatchable.h" NS_ASSUME_NONNULL_BEGIN @class GRPCInterceptorManager; @class GRPCInterceptor; +@class GRPCRequestOptions; +@class GRPCCallOptions; +@protocol GRPCResponseHandler; /** * The GRPCInterceptorInterface defines the request events that can occur to an interceptr. */ -@protocol GRPCInterceptorInterface - -/** - * The queue on which all methods of this interceptor should be dispatched on. The queue must be a - * serial queue. - */ -@property(readonly) dispatch_queue_t requestDispatchQueue; +@protocol GRPCInterceptorInterface /** * To start the call. This method will only be called once for each instance. @@ -171,19 +169,20 @@ NS_ASSUME_NONNULL_BEGIN * invoke shutDown method of its corresponding manager so that references to other interceptors can * be released. */ -@interface GRPCInterceptorManager : NSObject +@interface GRPCInterceptorManager : NSObject - (instancetype)init NS_UNAVAILABLE; + (instancetype) new NS_UNAVAILABLE; -- (nullable instancetype)initWithNextInterceptor:(id)nextInterceptor - NS_DESIGNATED_INITIALIZER; - -/** Set the previous interceptor in the chain. Can only be set once. */ -- (void)setPreviousInterceptor:(id)previousInterceptor; +- (nullable instancetype)initWithFactories:(nullable NSArray> *)factories + previousInterceptor:(nullable id)previousInterceptor + transportId:(GRPCTransportId)transportId; -/** Indicate shutdown of the interceptor; release the reference to other interceptors */ +/** + * Notify the manager that the interceptor has shut down and the manager should release references + * to other interceptors and stop forwarding requests/responses. + */ - (void)shutDown; // Methods to forward GRPCInterceptorInterface calls to the next interceptor @@ -235,7 +234,6 @@ NS_ASSUME_NONNULL_BEGIN @interface GRPCInterceptor : NSObject - (instancetype)init NS_UNAVAILABLE; - + (instancetype) new NS_UNAVAILABLE; /** @@ -243,9 +241,7 @@ NS_ASSUME_NONNULL_BEGIN * that this interceptor's methods are dispatched onto. */ - (nullable instancetype)initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue - NS_DESIGNATED_INITIALIZER; + dispatchQueue:(dispatch_queue_t)dispatchQueue; // Default implementation of GRPCInterceptorInterface diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.m b/src/objective-c/GRPCClient/GRPCInterceptor.m index a385ecd7813..a7ffe05bddc 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.m +++ b/src/objective-c/GRPCClient/GRPCInterceptor.m @@ -19,117 +19,253 @@ #import #import "GRPCInterceptor.h" +#import "private/GRPCTransport+Private.h" + +@interface GRPCInterceptorManager () + +@end @implementation GRPCInterceptorManager { id _nextInterceptor; id _previousInterceptor; + GRPCInterceptor *_thisInterceptor; + dispatch_queue_t _dispatchQueue; + NSArray> *_factories; + GRPCTransportId _transportId; + BOOL _shutDown; } -- (instancetype)initWithNextInterceptor:(id)nextInterceptor { +- (instancetype)initWithFactories:(NSArray> *)factories + previousInterceptor:(id)previousInterceptor + transportId:(nonnull GRPCTransportId)transportId { if ((self = [super init])) { - _nextInterceptor = nextInterceptor; + if (factories.count == 0) { + [NSException raise:NSInternalInconsistencyException + format:@"Interceptor manager must have factories"]; + } + _thisInterceptor = [factories[0] createInterceptorWithManager:self]; + if (_thisInterceptor == nil) { + return nil; + } + _previousInterceptor = previousInterceptor; + _factories = factories; + // Generate interceptor +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 + if (@available(iOS 8.0, macOS 10.10, *)) { + _dispatchQueue = dispatch_queue_create( + NULL, + dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); + } else { +#else + { +#endif + _dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); + } + dispatch_set_target_queue(_dispatchQueue, _thisInterceptor.dispatchQueue); + _transportId = transportId; } - return self; } -- (void)setPreviousInterceptor:(id)previousInterceptor { - _previousInterceptor = previousInterceptor; +- (void)shutDown { + dispatch_async(_dispatchQueue, ^{ + self->_nextInterceptor = nil; + self->_previousInterceptor = nil; + self->_thisInterceptor = nil; + self->_shutDown = YES; + }); } -- (void)shutDown { - _nextInterceptor = nil; - _previousInterceptor = nil; +- (void)createNextInterceptor { + NSAssert(_nextInterceptor == nil, @"Starting the next interceptor more than once"); + NSAssert(_factories.count > 0, @"Interceptor manager of transport cannot start next interceptor"); + if (_nextInterceptor != nil) { + NSLog(@"Starting the next interceptor more than once"); + return; + } + NSMutableArray> *interceptorFactories = [NSMutableArray + arrayWithArray:[_factories subarrayWithRange:NSMakeRange(1, _factories.count - 1)]]; + while (_nextInterceptor == nil) { + if (interceptorFactories.count == 0) { + _nextInterceptor = + [[GRPCTransportManager alloc] initWithTransportId:_transportId previousInterceptor:self]; + break; + } else { + _nextInterceptor = [[GRPCInterceptorManager alloc] initWithFactories:interceptorFactories + previousInterceptor:self + transportId:_transportId]; + if (_nextInterceptor == nil) { + [interceptorFactories removeObjectAtIndex:0]; + } + } + } + NSAssert(_nextInterceptor != nil, @"Failed to create interceptor or transport."); + if (_nextInterceptor == nil) { + NSLog(@"Failed to create interceptor or transport."); + } } - (void)startNextInterceptorWithRequest:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { - if (_nextInterceptor != nil) { - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ - [copiedNextInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; - }); + if (_nextInterceptor == nil && !_shutDown) { + [self createNextInterceptor]; } + if (_nextInterceptor == nil) { + return; + } + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ + [copiedNextInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; + }); } - (void)writeNextInterceptorWithData:(id)data { - if (_nextInterceptor != nil) { - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ - [copiedNextInterceptor writeData:data]; - }); + if (_nextInterceptor == nil && !_shutDown) { + [self createNextInterceptor]; + } + if (_nextInterceptor == nil) { + return; } + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ + [copiedNextInterceptor writeData:data]; + }); } - (void)finishNextInterceptor { - if (_nextInterceptor != nil) { - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ - [copiedNextInterceptor finish]; - }); + if (_nextInterceptor == nil && !_shutDown) { + [self createNextInterceptor]; + } + if (_nextInterceptor == nil) { + return; } + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ + [copiedNextInterceptor finish]; + }); } - (void)cancelNextInterceptor { - if (_nextInterceptor != nil) { - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ - [copiedNextInterceptor cancel]; - }); + if (_nextInterceptor == nil && !_shutDown) { + [self createNextInterceptor]; + } + if (_nextInterceptor == nil) { + return; } + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ + [copiedNextInterceptor cancel]; + }); } /** Notify the next interceptor in the chain to receive more messages */ - (void)receiveNextInterceptorMessages:(NSUInteger)numberOfMessages { - if (_nextInterceptor != nil) { - id copiedNextInterceptor = _nextInterceptor; - dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ - [copiedNextInterceptor receiveNextMessages:numberOfMessages]; - }); + if (_nextInterceptor == nil && !_shutDown) { + [self createNextInterceptor]; + } + if (_nextInterceptor == nil) { + return; } + id copiedNextInterceptor = _nextInterceptor; + dispatch_async(copiedNextInterceptor.dispatchQueue, ^{ + [copiedNextInterceptor receiveNextMessages:numberOfMessages]; + }); } // Methods to forward GRPCResponseHandler callbacks to the previous object /** Forward initial metadata to the previous interceptor in the chain */ -- (void)forwardPreviousInterceptorWithInitialMetadata:(nullable NSDictionary *)initialMetadata { - if ([_previousInterceptor respondsToSelector:@selector(didReceiveInitialMetadata:)]) { - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didReceiveInitialMetadata:initialMetadata]; - }); +- (void)forwardPreviousInterceptorWithInitialMetadata:(NSDictionary *)initialMetadata { + if (_previousInterceptor == nil) { + return; } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didReceiveInitialMetadata:initialMetadata]; + }); } /** Forward a received message to the previous interceptor in the chain */ - (void)forwardPreviousInterceptorWithData:(id)data { - if ([_previousInterceptor respondsToSelector:@selector(didReceiveData:)]) { - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didReceiveData:data]; - }); + if (_previousInterceptor == nil) { + return; } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didReceiveData:data]; + }); } /** Forward call close and trailing metadata to the previous interceptor in the chain */ -- (void)forwardPreviousInterceptorCloseWithTrailingMetadata: - (nullable NSDictionary *)trailingMetadata - error:(nullable NSError *)error { - if ([_previousInterceptor respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; - }); +- (void)forwardPreviousInterceptorCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata + error:(NSError *)error { + if (_previousInterceptor == nil) { + return; } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; + }); } /** Forward write completion to the previous interceptor in the chain */ - (void)forwardPreviousInterceptorDidWriteData { - if ([_previousInterceptor respondsToSelector:@selector(didWriteData)]) { - id copiedPreviousInterceptor = _previousInterceptor; - dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ - [copiedPreviousInterceptor didWriteData]; - }); + if (_previousInterceptor == nil) { + return; + } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didWriteData]; + }); +} + +- (dispatch_queue_t)dispatchQueue { + return _dispatchQueue; +} + +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions + callOptions:(GRPCCallOptions *)callOptions { + [_thisInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; +} + +- (void)writeData:(id)data { + [_thisInterceptor writeData:data]; +} + +- (void)finish { + [_thisInterceptor finish]; +} + +- (void)cancel { + [_thisInterceptor cancel]; +} + +- (void)receiveNextMessages:(NSUInteger)numberOfMessages { + [_thisInterceptor receiveNextMessages:numberOfMessages]; +} + +- (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata { + if ([_thisInterceptor respondsToSelector:@selector(didReceiveInitialMetadata:)]) { + [_thisInterceptor didReceiveInitialMetadata:initialMetadata]; + } +} + +- (void)didReceiveData:(id)data { + if ([_thisInterceptor respondsToSelector:@selector(didReceiveData:)]) { + [_thisInterceptor didReceiveData:data]; + } +} + +- (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata + error:(nullable NSError *)error { + if ([_thisInterceptor respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { + [_thisInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; + } +} + +- (void)didWriteData { + if ([_thisInterceptor respondsToSelector:@selector(didWriteData)]) { + [_thisInterceptor didWriteData]; } } @@ -137,28 +273,21 @@ @implementation GRPCInterceptor { GRPCInterceptorManager *_manager; - dispatch_queue_t _requestDispatchQueue; - dispatch_queue_t _responseDispatchQueue; + dispatch_queue_t _dispatchQueue; } - (instancetype)initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue { + dispatchQueue:(dispatch_queue_t)dispatchQueue { if ((self = [super init])) { _manager = interceptorManager; - _requestDispatchQueue = requestDispatchQueue; - _responseDispatchQueue = responseDispatchQueue; + _dispatchQueue = dispatchQueue; } return self; } -- (dispatch_queue_t)requestDispatchQueue { - return _requestDispatchQueue; -} - - (dispatch_queue_t)dispatchQueue { - return _responseDispatchQueue; + return _dispatchQueue; } - (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions diff --git a/src/objective-c/GRPCClient/GRPCTransport.h b/src/objective-c/GRPCClient/GRPCTransport.h new file mode 100644 index 00000000000..d5637922152 --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCTransport.h @@ -0,0 +1,82 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// The interface for a transport implementation + +#import "GRPCInterceptor.h" + +NS_ASSUME_NONNULL_BEGIN + +#pragma mark Transport ID + +/** + * The default transport implementations available in gRPC. These implementations will be provided + * by gRPC by default unless explicitly excluded. + */ +extern const struct GRPCDefaultTransportImplList { + const GRPCTransportId core_secure; + const GRPCTransportId core_insecure; +} GRPCDefaultTransportImplList; + +/** Returns whether two transport id's are identical. */ +BOOL TransportIdIsEqual(GRPCTransportId lhs, GRPCTransportId rhs); + +/** Returns the hash value of a transport id. */ +NSUInteger TransportIdHash(GRPCTransportId); + +#pragma mark Transport and factory + +@protocol GRPCInterceptorInterface; +@protocol GRPCResponseHandler; +@class GRPCTransportManager; +@class GRPCRequestOptions; +@class GRPCCallOptions; +@class GRPCTransport; + +/** The factory method to create a transport. */ +@protocol GRPCTransportFactory + +- (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager; + +@end + +/** The registry of transport implementations. */ +@interface GRPCTransportRegistry : NSObject + ++ (instancetype)sharedInstance; + +/** + * Register a transport implementation with the registry. All transport implementations to be used + * in a process must register with the registry on process start-up in its +load: class method. + * Parameter \a transportId is the identifier of the implementation, and \a factory is the factory + * object to create the corresponding transport instance. + */ +- (void)registerTransportWithId:(GRPCTransportId)transportId + factory:(id)factory; + +@end + +/** + * Base class for transport implementations. All transport implementation should inherit from this + * class. + */ +@interface GRPCTransport : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/objective-c/GRPCClient/GRPCTransport.m b/src/objective-c/GRPCClient/GRPCTransport.m new file mode 100644 index 00000000000..439acfb9cc2 --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCTransport.m @@ -0,0 +1,142 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "GRPCTransport.h" + +static const GRPCTransportId gGRPCCoreSecureId = "io.grpc.transport.core.secure"; +static const GRPCTransportId gGRPCCoreInsecureId = "io.grpc.transport.core.insecure"; + +const struct GRPCDefaultTransportImplList GRPCDefaultTransportImplList = { + .core_secure = gGRPCCoreSecureId, .core_insecure = gGRPCCoreInsecureId}; + +static const GRPCTransportId gDefaultTransportId = gGRPCCoreSecureId; + +static GRPCTransportRegistry *gTransportRegistry = nil; +static dispatch_once_t initTransportRegistry; + +BOOL TransportIdIsEqual(GRPCTransportId lhs, GRPCTransportId rhs) { + // Directly comparing pointers works because we require users to use the id provided by each + // implementation, not coming up with their own string. + return lhs == rhs; +} + +NSUInteger TransportIdHash(GRPCTransportId transportId) { + if (transportId == NULL) { + transportId = gDefaultTransportId; + } + return [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding].hash; +} + +@implementation GRPCTransportRegistry { + NSMutableDictionary> *_registry; + id _defaultFactory; +} + ++ (instancetype)sharedInstance { + dispatch_once(&initTransportRegistry, ^{ + gTransportRegistry = [[GRPCTransportRegistry alloc] init]; + NSAssert(gTransportRegistry != nil, @"Unable to initialize transport registry."); + if (gTransportRegistry == nil) { + NSLog(@"Unable to initialize transport registry."); + [NSException raise:NSGenericException format:@"Unable to initialize transport registry."]; + } + }); + return gTransportRegistry; +} + +- (instancetype)init { + if ((self = [super init])) { + _registry = [NSMutableDictionary dictionary]; + } + return self; +} + +- (void)registerTransportWithId:(GRPCTransportId)transportId + factory:(id)factory { + NSString *nsTransportId = [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding]; + NSAssert(_registry[nsTransportId] == nil, @"The transport %@ has already been registered.", + nsTransportId); + if (_registry[nsTransportId] != nil) { + NSLog(@"The transport %@ has already been registered.", nsTransportId); + return; + } + _registry[nsTransportId] = factory; + + // if the default transport is registered, mark it. + if (0 == strcmp(transportId, gDefaultTransportId)) { + _defaultFactory = factory; + } +} + +- (id)getTransportFactoryWithId:(GRPCTransportId)transportId { + if (transportId == NULL) { + if (_defaultFactory == nil) { + [NSException raise:NSInvalidArgumentException + format:@"Unable to get default transport factory"]; + return nil; + } + return _defaultFactory; + } + NSString *nsTransportId = [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding]; + id transportFactory = _registry[nsTransportId]; + if (transportFactory == nil) { + // User named a transport id that was not registered with the registry. + [NSException raise:NSInvalidArgumentException + format:@"Unable to get transport factory with id %s", transportId]; + return nil; + } + return transportFactory; +} + +@end + +@implementation GRPCTransport + +- (dispatch_queue_t)dispatchQueue { + [NSException raise:NSGenericException + format:@"Implementations should override the dispatch queue"]; + return nil; +} + +- (void)startWithRequestOptions:(nonnull GRPCRequestOptions *)requestOptions + callOptions:(nonnull GRPCCallOptions *)callOptions { + [NSException raise:NSGenericException + format:@"Implementations should override the methods of GRPCTransport"]; +} + +- (void)writeData:(nonnull id)data { + [NSException raise:NSGenericException + format:@"Implementations should override the methods of GRPCTransport"]; +} + +- (void)cancel { + [NSException raise:NSGenericException + format:@"Implementations should override the methods of GRPCTransport"]; +} + +- (void)finish { + [NSException raise:NSGenericException + format:@"Implementations should override the methods of GRPCTransport"]; +} + +- (void)receiveNextMessages:(NSUInteger)numberOfMessages { + [NSException raise:NSGenericException + format:@"Implementations should override the methods of GRPCTransport"]; +} + +@end diff --git a/src/objective-c/GRPCClient/GRPCTypes.h b/src/objective-c/GRPCClient/GRPCTypes.h new file mode 100644 index 00000000000..c804bca4eaa --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCTypes.h @@ -0,0 +1,187 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/** + * gRPC error codes. + * Note that a few of these are never produced by the gRPC libraries, but are of + * general utility for server applications to produce. + */ +typedef NS_ENUM(NSUInteger, GRPCErrorCode) { + /** The operation was cancelled (typically by the caller). */ + GRPCErrorCodeCancelled = 1, + + /** + * Unknown error. Errors raised by APIs that do not return enough error + * information may be converted to this error. + */ + GRPCErrorCodeUnknown = 2, + + /** + * The client specified an invalid argument. Note that this differs from + * FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are + * problematic regardless of the state of the server (e.g., a malformed file + * name). + */ + GRPCErrorCodeInvalidArgument = 3, + + /** + * Deadline expired before operation could complete. For operations that + * change the state of the server, this error may be returned even if the + * operation has completed successfully. For example, a successful response + * from the server could have been delayed long enough for the deadline to + * expire. + */ + GRPCErrorCodeDeadlineExceeded = 4, + + /** Some requested entity (e.g., file or directory) was not found. */ + GRPCErrorCodeNotFound = 5, + + /** Some entity that we attempted to create (e.g., file or directory) already + exists. */ + GRPCErrorCodeAlreadyExists = 6, + + /** + * The caller does not have permission to execute the specified operation. + * PERMISSION_DENIED isn't used for rejections caused by exhausting some + * resource (RESOURCE_EXHAUSTED is used instead for those errors). + * PERMISSION_DENIED doesn't indicate a failure to identify the caller + * (UNAUTHENTICATED is used instead for those errors). + */ + GRPCErrorCodePermissionDenied = 7, + + /** + * The request does not have valid authentication credentials for the + * operation (e.g. the caller's identity can't be verified). + */ + GRPCErrorCodeUnauthenticated = 16, + + /** Some resource has been exhausted, perhaps a per-user quota. */ + GRPCErrorCodeResourceExhausted = 8, + + /** + * The RPC was rejected because the server is not in a state required for the + * procedure's execution. For example, a directory to be deleted may be + * non-empty, etc. The client should not retry until the server state has been + * explicitly fixed (e.g. by performing another RPC). The details depend on + * the service being called, and should be found in the NSError's userInfo. + */ + GRPCErrorCodeFailedPrecondition = 9, + + /** + * The RPC was aborted, typically due to a concurrency issue like sequencer + * check failures, transaction aborts, etc. The client should retry at a + * higher-level (e.g., restarting a read- modify-write sequence). + */ + GRPCErrorCodeAborted = 10, + + /** + * The RPC was attempted past the valid range. E.g., enumerating past the end + * of a list. Unlike INVALID_ARGUMENT, this error indicates a problem that may + * be fixed if the system state changes. For example, an RPC to get elements + * of a list will generate INVALID_ARGUMENT if asked to return the element at + * a negative index, but it will generate OUT_OF_RANGE if asked to return the + * element at an index past the current size of the list. + */ + GRPCErrorCodeOutOfRange = 11, + + /** The procedure is not implemented or not supported/enabled in this server. + */ + GRPCErrorCodeUnimplemented = 12, + + /** + * Internal error. Means some invariant expected by the server application or + * the gRPC library has been broken. + */ + GRPCErrorCodeInternal = 13, + + /** + * The server is currently unavailable. This is most likely a transient + * condition and may be corrected by retrying with a backoff. Note that it is + * not always safe to retry non-idempotent operations. + */ + GRPCErrorCodeUnavailable = 14, + + /** Unrecoverable data loss or corruption. */ + GRPCErrorCodeDataLoss = 15, +}; + +/** + * Safety remark of a gRPC method as defined in RFC 2616 Section 9.1 + */ +typedef NS_ENUM(NSUInteger, GRPCCallSafety) { + /** + * Signal that there is no guarantees on how the call affects the server + * state. + */ + GRPCCallSafetyDefault = 0, + /** Signal that the call is idempotent. gRPC is free to use PUT verb. */ + GRPCCallSafetyIdempotentRequest = 1, + /** + * Signal that the call is cacheable and will not affect server state. gRPC is + * free to use GET verb. + */ + GRPCCallSafetyCacheableRequest = 2, +}; + +// Compression algorithm to be used by a gRPC call +typedef NS_ENUM(NSUInteger, GRPCCompressionAlgorithm) { + GRPCCompressNone = 0, + GRPCCompressDeflate, + GRPCCompressGzip, + GRPCStreamCompressGzip, +}; + +// GRPCCompressAlgorithm is deprecated; use GRPCCompressionAlgorithm +typedef GRPCCompressionAlgorithm GRPCCompressAlgorithm; + +/** The transport to be used by a gRPC call */ +typedef NS_ENUM(NSUInteger, GRPCTransportType) { + GRPCTransportTypeDefault = 0, + /** gRPC internal HTTP/2 stack with BoringSSL */ + GRPCTransportTypeChttp2BoringSSL = 0, + /** Cronet stack */ + GRPCTransportTypeCronet, + /** Insecure channel. FOR TEST ONLY! */ + GRPCTransportTypeInsecure, +}; + +/** Domain of NSError objects produced by gRPC. */ +extern NSString* _Nonnull const kGRPCErrorDomain; + +/** + * Keys used in |NSError|'s |userInfo| dictionary to store the response headers + * and trailers sent by the server. + */ +extern NSString* _Nonnull const kGRPCHeadersKey; +extern NSString* _Nonnull const kGRPCTrailersKey; + +/** The id of a transport implementation. */ +typedef char* _Nonnull GRPCTransportId; + +/** + * Implement this protocol to provide a token to gRPC when a call is initiated. + */ +@protocol GRPCAuthorizationProtocol + +/** + * This method is called when gRPC is about to start the call. When OAuth token is acquired, + * \a handler is expected to be called with \a token being the new token to be used for this call. + */ +- (void)getTokenWithHandler:(void (^_Nonnull)(NSString* _Nullable token))handler; + +@end diff --git a/src/objective-c/GRPCClient/internal_testing/GRPCCall+InternalTests.m b/src/objective-c/GRPCClient/internal_testing/GRPCCall+InternalTests.m index 1bb352f0be2..8f98daa6348 100644 --- a/src/objective-c/GRPCClient/internal_testing/GRPCCall+InternalTests.m +++ b/src/objective-c/GRPCClient/internal_testing/GRPCCall+InternalTests.m @@ -20,7 +20,7 @@ #import "GRPCCall+InternalTests.h" -#import "../private/GRPCOpBatchLog.h" +#import "../private/GRPCCore/GRPCOpBatchLog.h" @implementation GRPCCall (InternalTests) diff --git a/src/objective-c/GRPCClient/private/ChannelArgsUtil.h b/src/objective-c/GRPCClient/private/GRPCCore/ChannelArgsUtil.h similarity index 100% rename from src/objective-c/GRPCClient/private/ChannelArgsUtil.h rename to src/objective-c/GRPCClient/private/GRPCCore/ChannelArgsUtil.h diff --git a/src/objective-c/GRPCClient/private/ChannelArgsUtil.m b/src/objective-c/GRPCClient/private/GRPCCore/ChannelArgsUtil.m similarity index 100% rename from src/objective-c/GRPCClient/private/ChannelArgsUtil.m rename to src/objective-c/GRPCClient/private/GRPCCore/ChannelArgsUtil.m diff --git a/src/objective-c/GRPCClient/private/GRPCCall+V2API.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCall+V2API.h similarity index 79% rename from src/objective-c/GRPCClient/private/GRPCCall+V2API.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCall+V2API.h index 22bf16962c6..f6db3023cac 100644 --- a/src/objective-c/GRPCClient/private/GRPCCall+V2API.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCall+V2API.h @@ -18,12 +18,6 @@ @interface GRPCCall (V2API) -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - callSafety:(GRPCCallSafety)safety - requestsWriter:(GRXWriter *)requestsWriter - callOptions:(GRPCCallOptions *)callOptions; - - (instancetype)initWithHost:(NSString *)host path:(NSString *)path callSafety:(GRPCCallSafety)safety diff --git a/src/objective-c/GRPCClient/private/GRPCCallInternal.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.h similarity index 70% rename from src/objective-c/GRPCClient/private/GRPCCallInternal.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.h index ac2d1cba2ec..641b1fb2e8a 100644 --- a/src/objective-c/GRPCClient/private/GRPCCallInternal.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.h @@ -16,20 +16,22 @@ * */ -#import +#import NS_ASSUME_NONNULL_BEGIN -@interface GRPCCall2Internal : NSObject +@protocol GRPCResponseHandler; +@class GRPCCallOptions; +@protocol GRPCChannelFactory; -- (instancetype)init; +@interface GRPCCall2Internal : GRPCTransport -- (void)setResponseHandler:(id)responseHandler; +- (instancetype)initWithTransportManager:(GRPCTransportManager *)transportManager; - (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions - callOptions:(nullable GRPCCallOptions *)callOptions; + callOptions:(GRPCCallOptions *)callOptions; -- (void)writeData:(NSData *)data; +- (void)writeData:(id)data; - (void)finish; diff --git a/src/objective-c/GRPCClient/private/GRPCCallInternal.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m similarity index 69% rename from src/objective-c/GRPCClient/private/GRPCCallInternal.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m index 32e38158fad..ea01fcaf594 100644 --- a/src/objective-c/GRPCClient/private/GRPCCallInternal.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m @@ -19,8 +19,10 @@ #import "GRPCCallInternal.h" #import +#import #import +#import "../GRPCTransport+Private.h" #import "GRPCCall+V2API.h" @implementation GRPCCall2Internal { @@ -28,8 +30,8 @@ GRPCRequestOptions *_requestOptions; /** Options for the call. */ GRPCCallOptions *_callOptions; - /** The handler of responses. */ - id _handler; + /** The interceptor manager to process responses. */ + GRPCTransportManager *_transportManager; /** * Make use of legacy GRPCCall to make calls. Nullified when call is finished. @@ -51,40 +53,28 @@ NSUInteger _pendingReceiveNextMessages; } -- (instancetype)init { - if ((self = [super init])) { +- (instancetype)initWithTransportManager:(GRPCTransportManager *)transportManager { + dispatch_queue_t dispatchQueue; // Set queue QoS only when iOS version is 8.0 or above and Xcode version is 9.0 or above #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 - if (@available(iOS 8.0, macOS 10.10, *)) { - _dispatchQueue = dispatch_queue_create( - NULL, - dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); - } else { + if (@available(iOS 8.0, macOS 10.10, *)) { + dispatchQueue = dispatch_queue_create( + NULL, dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0)); + } else { #else - { + { #endif - _dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); - } + dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); + } + if ((self = [super init])) { _pipe = [GRXBufferedPipe pipe]; + _transportManager = transportManager; + _dispatchQueue = dispatchQueue; } return self; } -- (void)setResponseHandler:(id)responseHandler { - @synchronized(self) { - NSAssert(!_started, @"Call already started."); - if (_started) { - return; - } - _handler = responseHandler; - _initialMetadataPublished = NO; - _started = NO; - _canceled = NO; - _finished = NO; - } -} - -- (dispatch_queue_t)requestDispatchQueue { +- (dispatch_queue_t)dispatchQueue { return _dispatchQueue; } @@ -102,26 +92,15 @@ return; } + GRPCCall *copiedCall = nil; @synchronized(self) { - NSAssert(_handler != nil, @"Response handler required."); - if (_handler == nil) { - NSLog(@"Invalid response handler."); - return; - } _requestOptions = requestOptions; if (callOptions == nil) { _callOptions = [[GRPCCallOptions alloc] init]; } else { _callOptions = [callOptions copy]; } - } - [self start]; -} - -- (void)start { - GRPCCall *copiedCall = nil; - @synchronized(self) { NSAssert(!_started, @"Call already started."); NSAssert(!_canceled, @"Call already canceled."); if (_started) { @@ -140,7 +119,7 @@ callOptions:_callOptions writeDone:^{ @synchronized(self) { - if (self->_handler) { + if (self->_transportManager) { [self issueDidWriteData]; } } @@ -158,7 +137,7 @@ void (^valueHandler)(id value) = ^(id value) { @synchronized(self) { - if (self->_handler) { + if (self->_transportManager) { if (!self->_initialMetadataPublished) { self->_initialMetadataPublished = YES; [self issueInitialMetadata:self->_call.responseHeaders]; @@ -171,7 +150,7 @@ }; void (^completionHandler)(NSError *errorOrNil) = ^(NSError *errorOrNil) { @synchronized(self) { - if (self->_handler) { + if (self->_transportManager) { if (!self->_initialMetadataPublished) { self->_initialMetadataPublished = YES; [self issueInitialMetadata:self->_call.responseHeaders]; @@ -207,20 +186,19 @@ _call = nil; _pipe = nil; - if ([_handler respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { - id copiedHandler = _handler; - _handler = nil; - dispatch_async(copiedHandler.dispatchQueue, ^{ - [copiedHandler didCloseWithTrailingMetadata:nil - error:[NSError errorWithDomain:kGRPCErrorDomain - code:GRPCErrorCodeCancelled - userInfo:@{ - NSLocalizedDescriptionKey : - @"Canceled by app" - }]]; - }); - } else { - _handler = nil; + if (_transportManager != nil) { + [_transportManager + forwardPreviousInterceptorCloseWithTrailingMetadata:nil + error: + [NSError + errorWithDomain:kGRPCErrorDomain + code: + GRPCErrorCodeCancelled + userInfo:@{ + NSLocalizedDescriptionKey : + @"Canceled by app" + }]]; + [_transportManager shutDown]; } } [copiedCall cancel]; @@ -271,59 +249,25 @@ } - (void)issueInitialMetadata:(NSDictionary *)initialMetadata { - @synchronized(self) { - if (initialMetadata != nil && - [_handler respondsToSelector:@selector(didReceiveInitialMetadata:)]) { - id copiedHandler = _handler; - dispatch_async(_handler.dispatchQueue, ^{ - [copiedHandler didReceiveInitialMetadata:initialMetadata]; - }); - } + if (initialMetadata != nil) { + [_transportManager forwardPreviousInterceptorWithInitialMetadata:initialMetadata]; } } - (void)issueMessage:(id)message { - @synchronized(self) { - if (message != nil) { - if ([_handler respondsToSelector:@selector(didReceiveData:)]) { - id copiedHandler = _handler; - dispatch_async(_handler.dispatchQueue, ^{ - [copiedHandler didReceiveData:message]; - }); - } else if ([_handler respondsToSelector:@selector(didReceiveRawMessage:)]) { - id copiedHandler = _handler; - dispatch_async(_handler.dispatchQueue, ^{ - [copiedHandler didReceiveRawMessage:message]; - }); - } - } + if (message != nil) { + [_transportManager forwardPreviousInterceptorWithData:message]; } } - (void)issueClosedWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { - @synchronized(self) { - if ([_handler respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { - id copiedHandler = _handler; - // Clean up _handler so that no more responses are reported to the handler. - _handler = nil; - dispatch_async(copiedHandler.dispatchQueue, ^{ - [copiedHandler didCloseWithTrailingMetadata:trailingMetadata error:error]; - }); - } else { - _handler = nil; - } - } + [_transportManager forwardPreviousInterceptorCloseWithTrailingMetadata:trailingMetadata + error:error]; + [_transportManager shutDown]; } - (void)issueDidWriteData { - @synchronized(self) { - if (_callOptions.flowControlEnabled && [_handler respondsToSelector:@selector(didWriteData)]) { - id copiedHandler = _handler; - dispatch_async(copiedHandler.dispatchQueue, ^{ - [copiedHandler didWriteData]; - }); - } - } + [_transportManager forwardPreviousInterceptorDidWriteData]; } - (void)receiveNextMessages:(NSUInteger)numberOfMessages { diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCChannel.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.h diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m similarity index 78% rename from src/objective-c/GRPCClient/private/GRPCChannel.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m index 1a79fb04a0d..cd2b4313acd 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m @@ -20,18 +20,19 @@ #include -#import "../internal/GRPCCallOptions+Internal.h" +#import "../../internal/GRPCCallOptions+Internal.h" +#import "../GRPCTransport+Private.h" #import "ChannelArgsUtil.h" #import "GRPCChannelFactory.h" #import "GRPCChannelPool.h" #import "GRPCCompletionQueue.h" -#import "GRPCCronetChannelFactory.h" +#import "GRPCCoreFactory.h" #import "GRPCInsecureChannelFactory.h" #import "GRPCSecureChannelFactory.h" -#import "version.h" #import #import +#import @implementation GRPCChannelConfiguration @@ -50,32 +51,48 @@ } - (id)channelFactory { - GRPCTransportType type = _callOptions.transportType; - switch (type) { - case GRPCTransportTypeChttp2BoringSSL: - // TODO (mxyan): Remove when the API is deprecated -#ifdef GRPC_COMPILE_WITH_CRONET - if (![GRPCCall isUsingCronet]) { -#else - { -#endif - NSError *error; - id factory = [GRPCSecureChannelFactory - factoryWithPEMRootCertificates:_callOptions.PEMRootCertificates - privateKey:_callOptions.PEMPrivateKey - certChain:_callOptions.PEMCertificateChain - error:&error]; - NSAssert(factory != nil, @"Failed to create secure channel factory"); - if (factory == nil) { - NSLog(@"Error creating secure channel factory: %@", error); + if (_callOptions.transport != NULL) { + id transportFactory = + [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:_callOptions.transport]; + if (! + [transportFactory respondsToSelector:@selector(createCoreChannelFactoryWithCallOptions:)]) { + // impossible because we are using GRPCCore now + [NSException raise:NSInternalInconsistencyException + format:@"Transport factory type is wrong"]; + } + id coreTransportFactory = + (id)transportFactory; + return [coreTransportFactory createCoreChannelFactoryWithCallOptions:_callOptions]; + } else { + // To maintain backwards compatibility with tranportType + GRPCTransportType type = _callOptions.transportType; + switch (type) { + case GRPCTransportTypeChttp2BoringSSL: + // TODO (mxyan): Remove when the API is deprecated + { + NSError *error; + id factory = [GRPCSecureChannelFactory + factoryWithPEMRootCertificates:_callOptions.PEMRootCertificates + privateKey:_callOptions.PEMPrivateKey + certChain:_callOptions.PEMCertificateChain + error:&error]; + NSAssert(factory != nil, @"Failed to create secure channel factory"); + if (factory == nil) { + NSLog(@"Error creating secure channel factory: %@", error); + } + return factory; } - return factory; + case GRPCTransportTypeCronet: { + id transportFactory = (id)[ + [GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:gGRPCCoreCronetId]; + return [transportFactory createCoreChannelFactoryWithCallOptions:_callOptions]; } - // fallthrough - case GRPCTransportTypeCronet: - return [GRPCCronetChannelFactory sharedInstance]; - case GRPCTransportTypeInsecure: - return [GRPCInsecureChannelFactory sharedInstance]; + case GRPCTransportTypeInsecure: + return [GRPCInsecureChannelFactory sharedInstance]; + default: + NSLog(@"Unrecognized transport type"); + return nil; + } } } @@ -198,6 +215,7 @@ } else { channelArgs = channelConfiguration.channelArgs; } + id factory = channelConfiguration.channelFactory; _unmanagedChannel = [factory createChannelWithHost:host channelArgs:channelArgs]; NSAssert(_unmanagedChannel != NULL, @"Failed to create channel"); diff --git a/src/objective-c/GRPCClient/private/GRPCChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelFactory.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCChannelFactory.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelFactory.h diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool+Test.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool+Test.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCChannelPool+Test.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool+Test.h diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.h similarity index 98% rename from src/objective-c/GRPCClient/private/GRPCChannelPool.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.h index e00ee69e63a..b83a28a2368 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannelPool.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.h @@ -18,8 +18,6 @@ #import -#import "GRPCChannelFactory.h" - NS_ASSUME_NONNULL_BEGIN @protocol GRPCChannel; diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m similarity index 98% rename from src/objective-c/GRPCClient/private/GRPCChannelPool.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m index d545793fcce..92f52e67b75 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannelPool.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m @@ -18,19 +18,16 @@ #import -#import "../internal/GRPCCallOptions+Internal.h" +#import "../../internal/GRPCCallOptions+Internal.h" #import "GRPCChannel.h" #import "GRPCChannelFactory.h" #import "GRPCChannelPool+Test.h" #import "GRPCChannelPool.h" #import "GRPCCompletionQueue.h" -#import "GRPCCronetChannelFactory.h" #import "GRPCInsecureChannelFactory.h" #import "GRPCSecureChannelFactory.h" #import "GRPCWrappedCall.h" -#import "version.h" -#import #include extern const char *kCFStreamVarName; diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCompletionQueue.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.h diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCCompletionQueue.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.m diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h new file mode 100644 index 00000000000..83d279d2c72 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h @@ -0,0 +1,32 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "../GRPCCoreFactory.h" + +/** + * The factory for gRPC Core + Cronet transport implementation. The + * implementation is not part of the default transports of gRPC and is for + * testing purpose only on Github. + * + * To use this transport, a user must include the GRPCCoreCronet module as a + * dependency of the project and use gGRPCCoreCronetId in call options to + * specify that this is the transport to be used for a call. + */ +@interface GRPCCoreCronetFactory : NSObject + +@end diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m new file mode 100644 index 00000000000..5772694fc54 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m @@ -0,0 +1,54 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "GRPCCoreCronetFactory.h" + +#import +#import + +#import "../GRPCCallInternal.h" +#import "../GRPCCoreFactory.h" +#import "GRPCCronetChannelFactory.h" + +static GRPCCoreCronetFactory *gGRPCCoreCronetFactory = nil; +static dispatch_once_t gInitGRPCCoreCronetFactory; + +@implementation GRPCCoreCronetFactory + ++ (instancetype)sharedInstance { + dispatch_once(&gInitGRPCCoreCronetFactory, ^{ + gGRPCCoreCronetFactory = [[GRPCCoreCronetFactory alloc] init]; + }); + return gGRPCCoreCronetFactory; +} + ++ (void)load { + [[GRPCTransportRegistry sharedInstance] + registerTransportWithId:gGRPCCoreCronetId + factory:[GRPCCoreCronetFactory sharedInstance]]; +} + +- (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager { + return [[GRPCCall2Internal alloc] initWithTransportManager:transportManager]; +} + +- (id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions { + return [GRPCCronetChannelFactory sharedInstance]; +} + +@end diff --git a/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.h similarity index 96% rename from src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.h index 738dfdb7370..138ddf1f730 100644 --- a/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.h @@ -15,7 +15,7 @@ * limitations under the License. * */ -#import "GRPCChannelFactory.h" +#import "../GRPCChannelFactory.h" @class GRPCChannel; typedef struct stream_engine stream_engine; diff --git a/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m similarity index 76% rename from src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m index 5bcb021dc4b..da3f3afd855 100644 --- a/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCronetChannelFactory.m @@ -18,10 +18,8 @@ #import "GRPCCronetChannelFactory.h" -#import "ChannelArgsUtil.h" -#import "GRPCChannel.h" - -#ifdef GRPC_COMPILE_WITH_CRONET +#import "../ChannelArgsUtil.h" +#import "../GRPCChannel.h" #import #include @@ -59,21 +57,3 @@ } @end - -#else - -@implementation GRPCCronetChannelFactory - -+ (instancetype)sharedInstance { - NSAssert(NO, @"Must enable macro GRPC_COMPILE_WITH_CRONET to build Cronet channel."); - return nil; -} - -- (grpc_channel *)createChannelWithHost:(NSString *)host channelArgs:(NSDictionary *)args { - NSAssert(NO, @"Must enable macro GRPC_COMPILE_WITH_CRONET to build Cronet channel."); - return NULL; -} - -@end - -#endif diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h new file mode 100644 index 00000000000..3cd312d4ad0 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.h @@ -0,0 +1,45 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol GRPCChannelFactory; +@protocol GRPCCallOptions; + +/** The interface for transport implementations that are based on Core. */ +@protocol GRPCCoreTransportFactory + +/** Get the channel factory for GRPCChannel from call options. */ +- (nullable id)createCoreChannelFactoryWithCallOptions: + (GRPCCallOptions *)callOptions; + +@end + +/** The factory for gRPC Core + CFStream + TLS secure channel transport implementation. */ +@interface GRPCCoreSecureFactory : NSObject + +@end + +/** The factory for gRPC Core + CFStream + insecure channel transport implementation. */ +@interface GRPCCoreInsecureFactory : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m new file mode 100644 index 00000000000..19d7231a203 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m @@ -0,0 +1,90 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "GRPCCoreFactory.h" + +#import + +#import "GRPCCallInternal.h" +#import "GRPCInsecureChannelFactory.h" +#import "GRPCSecureChannelFactory.h" + +static GRPCCoreSecureFactory *gGRPCCoreSecureFactory = nil; +static GRPCCoreInsecureFactory *gGRPCCoreInsecureFactory = nil; +static dispatch_once_t gInitGRPCCoreSecureFactory; +static dispatch_once_t gInitGRPCCoreInsecureFactory; + +@implementation GRPCCoreSecureFactory + ++ (instancetype)sharedInstance { + dispatch_once(&gInitGRPCCoreSecureFactory, ^{ + gGRPCCoreSecureFactory = [[GRPCCoreSecureFactory alloc] init]; + }); + return gGRPCCoreSecureFactory; +} + ++ (void)load { + [[GRPCTransportRegistry sharedInstance] + registerTransportWithId:GRPCDefaultTransportImplList.core_secure + factory:[self sharedInstance]]; +} + +- (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager { + return [[GRPCCall2Internal alloc] initWithTransportManager:transportManager]; +} + +- (id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions { + NSError *error; + id factory = + [GRPCSecureChannelFactory factoryWithPEMRootCertificates:callOptions.PEMRootCertificates + privateKey:callOptions.PEMPrivateKey + certChain:callOptions.PEMCertificateChain + error:&error]; + if (error != nil) { + NSLog(@"Unable to create secure channel factory"); + return nil; + } + return factory; +} + +@end + +@implementation GRPCCoreInsecureFactory + ++ (instancetype)sharedInstance { + dispatch_once(&gInitGRPCCoreInsecureFactory, ^{ + gGRPCCoreInsecureFactory = [[GRPCCoreInsecureFactory alloc] init]; + }); + return gGRPCCoreInsecureFactory; +} + ++ (void)load { + [[GRPCTransportRegistry sharedInstance] + registerTransportWithId:GRPCDefaultTransportImplList.core_insecure + factory:[self sharedInstance]]; +} + +- (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager { + return [[GRPCCall2Internal alloc] initWithTransportManager:transportManager]; +} + +- (id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions { + return [GRPCInsecureChannelFactory sharedInstance]; +} + +@end diff --git a/src/objective-c/GRPCClient/private/GRPCHost.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCHost.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.h diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m similarity index 82% rename from src/objective-c/GRPCClient/private/GRPCHost.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m index 63ffc927411..1f6a25ff78f 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m @@ -21,17 +21,16 @@ #import #import #import +#import #include #include -#import "../internal/GRPCCallOptions+Internal.h" +#import "../../internal/GRPCCallOptions+Internal.h" #import "GRPCChannelFactory.h" #import "GRPCCompletionQueue.h" -#import "GRPCCronetChannelFactory.h" #import "GRPCSecureChannelFactory.h" #import "NSDictionary+GRPC.h" -#import "version.h" NS_ASSUME_NONNULL_BEGIN @@ -113,20 +112,12 @@ static NSMutableDictionary *gHostCache; options.PEMPrivateKey = _PEMPrivateKey; options.PEMCertificateChain = _PEMCertificateChain; options.hostNameOverride = _hostNameOverride; -#ifdef GRPC_COMPILE_WITH_CRONET - // By old API logic, insecure channel precedes Cronet channel; Cronet channel preceeds default - // channel. - if ([GRPCCall isUsingCronet]) { - if (_transportType == GRPCTransportTypeInsecure) { - options.transportType = GRPCTransportTypeInsecure; - } else { - NSAssert(_transportType == GRPCTransportTypeDefault, @"Invalid transport type"); - options.transportType = GRPCTransportTypeCronet; - } - } else -#endif - { - options.transportType = _transportType; + if (_transportType == GRPCTransportTypeInsecure) { + options.transport = GRPCDefaultTransportImplList.core_insecure; + } else if ([GRPCCall isUsingCronet]) { + options.transport = gGRPCCoreCronetId; + } else { + options.transport = GRPCDefaultTransportImplList.core_secure; } options.logContext = _logContext; @@ -135,16 +126,14 @@ static NSMutableDictionary *gHostCache; + (GRPCCallOptions *)callOptionsForHost:(NSString *)host { // TODO (mxyan): Remove when old API is deprecated - NSURL *hostURL = [NSURL URLWithString:[@"https://" stringByAppendingString:host]]; - if (hostURL.host && hostURL.port == nil) { - host = [hostURL.host stringByAppendingString:@":443"]; - } - GRPCCallOptions *callOptions = nil; @synchronized(gHostCache) { - callOptions = [gHostCache[host] callOptions]; + GRPCHost *hostConfig = [GRPCHost hostWithAddress:host]; + callOptions = [hostConfig callOptions]; } + NSAssert(callOptions != nil, @"Unable to create call options object"); if (callOptions == nil) { + NSLog(@"Unable to create call options object"); callOptions = [[GRPCCallOptions alloc] init]; } return callOptions; diff --git a/src/objective-c/GRPCClient/private/GRPCInsecureChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCInsecureChannelFactory.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCInsecureChannelFactory.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCInsecureChannelFactory.h diff --git a/src/objective-c/GRPCClient/private/GRPCInsecureChannelFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCInsecureChannelFactory.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCInsecureChannelFactory.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCInsecureChannelFactory.m diff --git a/src/objective-c/GRPCClient/private/GRPCOpBatchLog.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCOpBatchLog.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCOpBatchLog.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCOpBatchLog.h diff --git a/src/objective-c/GRPCClient/private/GRPCOpBatchLog.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCOpBatchLog.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCOpBatchLog.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCOpBatchLog.m diff --git a/src/objective-c/GRPCClient/private/GRPCReachabilityFlagNames.xmacro.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCReachabilityFlagNames.xmacro.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCReachabilityFlagNames.xmacro.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCReachabilityFlagNames.xmacro.h diff --git a/src/objective-c/GRPCClient/private/GRPCRequestHeaders.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.h similarity index 95% rename from src/objective-c/GRPCClient/private/GRPCRequestHeaders.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.h index 545ff1cea82..0fced0c385a 100644 --- a/src/objective-c/GRPCClient/private/GRPCRequestHeaders.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.h @@ -18,7 +18,7 @@ #import -#import "../GRPCCall.h" +#import @interface GRPCRequestHeaders : NSMutableDictionary diff --git a/src/objective-c/GRPCClient/private/GRPCRequestHeaders.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCRequestHeaders.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCRequestHeaders.m diff --git a/src/objective-c/GRPCClient/private/GRPCSecureChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCSecureChannelFactory.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCSecureChannelFactory.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCSecureChannelFactory.h diff --git a/src/objective-c/GRPCClient/private/GRPCSecureChannelFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCSecureChannelFactory.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCSecureChannelFactory.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCSecureChannelFactory.m diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCWrappedCall.h similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCWrappedCall.h rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCWrappedCall.h diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCWrappedCall.m similarity index 100% rename from src/objective-c/GRPCClient/private/GRPCWrappedCall.m rename to src/objective-c/GRPCClient/private/GRPCCore/GRPCWrappedCall.m diff --git a/src/objective-c/GRPCClient/private/NSData+GRPC.h b/src/objective-c/GRPCClient/private/GRPCCore/NSData+GRPC.h similarity index 100% rename from src/objective-c/GRPCClient/private/NSData+GRPC.h rename to src/objective-c/GRPCClient/private/GRPCCore/NSData+GRPC.h diff --git a/src/objective-c/GRPCClient/private/NSData+GRPC.m b/src/objective-c/GRPCClient/private/GRPCCore/NSData+GRPC.m similarity index 100% rename from src/objective-c/GRPCClient/private/NSData+GRPC.m rename to src/objective-c/GRPCClient/private/GRPCCore/NSData+GRPC.m diff --git a/src/objective-c/GRPCClient/private/NSDictionary+GRPC.h b/src/objective-c/GRPCClient/private/GRPCCore/NSDictionary+GRPC.h similarity index 100% rename from src/objective-c/GRPCClient/private/NSDictionary+GRPC.h rename to src/objective-c/GRPCClient/private/GRPCCore/NSDictionary+GRPC.h diff --git a/src/objective-c/GRPCClient/private/NSDictionary+GRPC.m b/src/objective-c/GRPCClient/private/GRPCCore/NSDictionary+GRPC.m similarity index 100% rename from src/objective-c/GRPCClient/private/NSDictionary+GRPC.m rename to src/objective-c/GRPCClient/private/GRPCCore/NSDictionary+GRPC.m diff --git a/src/objective-c/GRPCClient/private/NSError+GRPC.h b/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.h similarity index 100% rename from src/objective-c/GRPCClient/private/NSError+GRPC.h rename to src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.h diff --git a/src/objective-c/GRPCClient/private/NSError+GRPC.m b/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m similarity index 96% rename from src/objective-c/GRPCClient/private/NSError+GRPC.m rename to src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m index 3eefed88d63..5b5fc6263c5 100644 --- a/src/objective-c/GRPCClient/private/NSError+GRPC.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/NSError+GRPC.m @@ -18,10 +18,9 @@ #import "NSError+GRPC.h" +#import #include -NSString *const kGRPCErrorDomain = @"io.grpc"; - @implementation NSError (GRPC) + (instancetype)grpc_errorFromStatusCode:(grpc_status_code)statusCode details:(const char *)details diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h new file mode 100644 index 00000000000..2dc7357c363 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h @@ -0,0 +1,65 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * Private interfaces of the transport registry. + */ +@interface GRPCTransportRegistry (Private) + +/** + * Get a transport implementation's factory by its transport id. If the transport id was not + * registered with the registry, the default transport factory (core + secure) is returned. If the + * default transport does not exist, an exception is thrown. + */ +- (id)getTransportFactoryWithId:(GRPCTransportId)transportId; + +@end + +@interface GRPCTransportManager : NSObject + +- (instancetype)initWithTransportId:(GRPCTransportId)transportId + previousInterceptor:(id)previousInterceptor; + +/** + * Notify the manager that the transport has shut down and the manager should release references to + * its response handler and stop forwarding requests/responses. + */ +- (void)shutDown; + +/** Forward initial metadata to the previous interceptor in the interceptor chain */ +- (void)forwardPreviousInterceptorWithInitialMetadata:(nullable NSDictionary *)initialMetadata; + +/** Forward a received message to the previous interceptor in the interceptor chain */ +- (void)forwardPreviousInterceptorWithData:(nullable id)data; + +/** Forward call close and trailing metadata to the previous interceptor in the interceptor chain */ +- (void)forwardPreviousInterceptorCloseWithTrailingMetadata: + (nullable NSDictionary *)trailingMetadata + error:(nullable NSError *)error; + +/** Forward write completion to the previous interceptor in the interceptor chain */ +- (void)forwardPreviousInterceptorDidWriteData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m new file mode 100644 index 00000000000..9072f7afbe2 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m @@ -0,0 +1,131 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "GRPCTransport+Private.h" + +#import + +@implementation GRPCTransportManager { + GRPCTransportId _transportId; + GRPCTransport *_transport; + id _previousInterceptor; + dispatch_queue_t _dispatchQueue; +} + +- (instancetype)initWithTransportId:(GRPCTransportId)transportId + previousInterceptor:(id)previousInterceptor { + if ((self = [super init])) { + id factory = + [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:transportId]; + + _transport = [factory createTransportWithManager:self]; + NSAssert(_transport != nil, @"Failed to create transport with id: %s", transportId); + if (_transport == nil) { + NSLog(@"Failed to create transport with id: %s", transportId); + return nil; + } + _previousInterceptor = previousInterceptor; + _dispatchQueue = _transport.dispatchQueue; + _transportId = transportId; + } + return self; +} + +- (void)shutDown { + dispatch_async(_dispatchQueue, ^{ + self->_transport = nil; + self->_previousInterceptor = nil; + }); +} + +- (dispatch_queue_t)dispatchQueue { + return _dispatchQueue; +} + +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions + callOptions:(GRPCCallOptions *)callOptions { + if (_transportId != callOptions.transport) { + [NSException raise:NSInvalidArgumentException + format:@"Interceptors cannot change the call option 'transport'"]; + return; + } + [_transport startWithRequestOptions:requestOptions callOptions:callOptions]; +} + +- (void)writeData:(id)data { + [_transport writeData:data]; +} + +- (void)finish { + [_transport finish]; +} + +- (void)cancel { + [_transport cancel]; +} + +- (void)receiveNextMessages:(NSUInteger)numberOfMessages { + [_transport receiveNextMessages:numberOfMessages]; +} + +/** Forward initial metadata to the previous interceptor in the chain */ +- (void)forwardPreviousInterceptorWithInitialMetadata:(NSDictionary *)initialMetadata { + if (initialMetadata == nil || _previousInterceptor == nil) { + return; + } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didReceiveInitialMetadata:initialMetadata]; + }); +} + +/** Forward a received message to the previous interceptor in the chain */ +- (void)forwardPreviousInterceptorWithData:(id)data { + if (data == nil || _previousInterceptor == nil) { + return; + } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didReceiveData:data]; + }); +} + +/** Forward call close and trailing metadata to the previous interceptor in the chain */ +- (void)forwardPreviousInterceptorCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata + error:(NSError *)error { + if (_previousInterceptor == nil) { + return; + } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; + }); +} + +/** Forward write completion to the previous interceptor in the chain */ +- (void)forwardPreviousInterceptorDidWriteData { + if (_previousInterceptor == nil) { + return; + } + id copiedPreviousInterceptor = _previousInterceptor; + dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ + [copiedPreviousInterceptor didWriteData]; + }); +} + +@end diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/version.h similarity index 100% rename from src/objective-c/GRPCClient/private/version.h rename to src/objective-c/GRPCClient/version.h diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h index 12db46adeda..c91adc7b7cd 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.h +++ b/src/objective-c/ProtoRPC/ProtoRPC.h @@ -17,12 +17,16 @@ */ #import -#import + +// import legacy header for compatibility with users using the ProtoRPC interface +#import "ProtoRPCLegacy.h" #import "ProtoMethod.h" NS_ASSUME_NONNULL_BEGIN +@class GRPCRequestOptions; +@class GRPCCallOptions; @class GPBMessage; /** An object can implement this protocol to receive responses from server from a call. */ @@ -160,35 +164,3 @@ NS_ASSUME_NONNULL_BEGIN @end NS_ASSUME_NONNULL_END - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnullability-completeness" - -__attribute__((deprecated("Please use GRPCProtoCall."))) @interface ProtoRPC - : GRPCCall - - /** - * host parameter should not contain the scheme (http:// or https://), only the name or IP - * addr and the port number, for example @"localhost:5050". - */ - - - (instancetype)initWithHost : (NSString *)host method - : (GRPCProtoMethod *)method requestsWriter : (GRXWriter *)requestsWriter responseClass - : (Class)responseClass responsesWriteable - : (id)responsesWriteable NS_DESIGNATED_INITIALIZER; - -- (void)start; -@end - -/** - * This subclass is empty now. Eventually we'll remove ProtoRPC class - * to avoid potential naming conflict - */ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - @interface GRPCProtoCall : ProtoRPC -#pragma clang diagnostic pop - - @end - -#pragma clang diagnostic pop diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m index 4700fdd1124..dbfa3c0f23d 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.m +++ b/src/objective-c/ProtoRPC/ProtoRPC.m @@ -27,24 +27,6 @@ #import #import -/** - * Generate an NSError object that represents a failure in parsing a proto class. - */ -static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError) { - NSDictionary *info = @{ - NSLocalizedDescriptionKey : @"Unable to parse response from the server", - NSLocalizedRecoverySuggestionErrorKey : - @"If this RPC is idempotent, retry " - @"with exponential backoff. Otherwise, query the server status before " - @"retrying.", - NSUnderlyingErrorKey : parsingError, - @"Expected class" : expectedClass, - @"Received value" : proto, - }; - // TODO(jcanizales): Use kGRPCErrorDomain and GRPCErrorCodeInternal when they're public. - return [NSError errorWithDomain:@"io.grpc" code:13 userInfo:info]; -} - @implementation GRPCUnaryProtoCall { GRPCStreamingProtoCall *_call; GPBMessage *_message; @@ -291,76 +273,3 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing } @end - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -@implementation ProtoRPC { -#pragma clang diagnostic pop - id _responseWriteable; -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-designated-initializers" -- (instancetype)initWithHost:(NSString *)host - path:(NSString *)path - requestsWriter:(GRXWriter *)requestsWriter { - [NSException raise:NSInvalidArgumentException - format:@"Please use ProtoRPC's designated initializer instead."]; - return nil; -} -#pragma clang diagnostic pop - -// Designated initializer -- (instancetype)initWithHost:(NSString *)host - method:(GRPCProtoMethod *)method - requestsWriter:(GRXWriter *)requestsWriter - responseClass:(Class)responseClass - responsesWriteable:(id)responsesWriteable { - // Because we can't tell the type system to constrain the class, we need to check at runtime: - if (![responseClass respondsToSelector:@selector(parseFromData:error:)]) { - [NSException raise:NSInvalidArgumentException - format:@"A protobuf class to parse the responses must be provided."]; - } - // A writer that serializes the proto messages to send. - GRXWriter *bytesWriter = [requestsWriter map:^id(GPBMessage *proto) { - if (![proto isKindOfClass:[GPBMessage class]]) { - [NSException raise:NSInvalidArgumentException - format:@"Request must be a proto message: %@", proto]; - } - return [proto data]; - }]; - if ((self = [super initWithHost:host path:method.HTTPPath requestsWriter:bytesWriter])) { - __weak ProtoRPC *weakSelf = self; - - // A writeable that parses the proto messages received. - _responseWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { - // TODO(jcanizales): This is done in the main thread, and needs to happen in another thread. - NSError *error = nil; - id parsed = [responseClass parseFromData:value error:&error]; - if (parsed) { - [responsesWriteable writeValue:parsed]; - } else { - [weakSelf finishWithError:ErrorForBadProto(value, responseClass, error)]; - } - } - completionHandler:^(NSError *errorOrNil) { - [responsesWriteable writesFinishedWithError:errorOrNil]; - }]; - } - return self; -} - -- (void)start { - [self startWithWriteable:_responseWriteable]; -} - -- (void)startWithWriteable:(id)writeable { - [super startWithWriteable:writeable]; - // Break retain cycles. - _responseWriteable = nil; -} -@end - -@implementation GRPCProtoCall - -@end diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.h b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h new file mode 100644 index 00000000000..b8d4003f695 --- /dev/null +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.h @@ -0,0 +1,67 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +// Import category headers for Swift build +#import +#import +#import +#import +#import +#import + +@class GRPCProtoMethod; +@class GRXWriter; +@protocol GRXWriteable; + +__attribute__((deprecated("Please use GRPCProtoCall."))) @interface ProtoRPC + : GRPCCall + + /** + * host parameter should not contain the scheme (http:// or https://), only the name or IP + * addr and the port number, for example @"localhost:5050". + */ + - + (instancetype)initWithHost : (NSString *)host method + : (GRPCProtoMethod *)method requestsWriter : (GRXWriter *)requestsWriter responseClass + : (Class)responseClass responsesWriteable + : (id)responsesWriteable NS_DESIGNATED_INITIALIZER; + +- (void)start; + +@end + +/** + * This subclass is empty now. Eventually we'll remove ProtoRPC class + * to avoid potential naming conflict + */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + @interface GRPCProtoCall + : ProtoRPC +#pragma clang diagnostic pop + + @end + + /** + * Generate an NSError object that represents a failure in parsing a proto class. For gRPC + * internal use only. + */ + NSError * + ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError); diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m new file mode 100644 index 00000000000..4ba93674063 --- /dev/null +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m @@ -0,0 +1,121 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "ProtoRPCLegacy.h" + +#import "ProtoMethod.h" + +#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS +#import +#else +#import +#endif +#import +#import +#import + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" +@implementation ProtoRPC { +#pragma clang diagnostic pop + id _responseWriteable; +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wobjc-designated-initializers" +- (instancetype)initWithHost:(NSString *)host + path:(NSString *)path + requestsWriter:(GRXWriter *)requestsWriter { + [NSException raise:NSInvalidArgumentException + format:@"Please use ProtoRPC's designated initializer instead."]; + return nil; +} +#pragma clang diagnostic pop + +// Designated initializer +- (instancetype)initWithHost:(NSString *)host + method:(GRPCProtoMethod *)method + requestsWriter:(GRXWriter *)requestsWriter + responseClass:(Class)responseClass + responsesWriteable:(id)responsesWriteable { + // Because we can't tell the type system to constrain the class, we need to check at runtime: + if (![responseClass respondsToSelector:@selector(parseFromData:error:)]) { + [NSException raise:NSInvalidArgumentException + format:@"A protobuf class to parse the responses must be provided."]; + } + // A writer that serializes the proto messages to send. + GRXWriter *bytesWriter = [requestsWriter map:^id(GPBMessage *proto) { + if (![proto isKindOfClass:[GPBMessage class]]) { + [NSException raise:NSInvalidArgumentException + format:@"Request must be a proto message: %@", proto]; + } + return [proto data]; + }]; + if ((self = [super initWithHost:host path:method.HTTPPath requestsWriter:bytesWriter])) { + __weak ProtoRPC *weakSelf = self; + + // A writeable that parses the proto messages received. + _responseWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { + // TODO(jcanizales): This is done in the main thread, and needs to happen in another thread. + NSError *error = nil; + id parsed = [responseClass parseFromData:value error:&error]; + if (parsed) { + [responsesWriteable writeValue:parsed]; + } else { + [weakSelf finishWithError:ErrorForBadProto(value, responseClass, error)]; + } + } + completionHandler:^(NSError *errorOrNil) { + [responsesWriteable writesFinishedWithError:errorOrNil]; + }]; + } + return self; +} + +- (void)start { + [self startWithWriteable:_responseWriteable]; +} + +- (void)startWithWriteable:(id)writeable { + [super startWithWriteable:writeable]; + // Break retain cycles. + _responseWriteable = nil; +} +@end + +@implementation GRPCProtoCall + +@end + +/** + * Generate an NSError object that represents a failure in parsing a proto class. + */ +NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError) { + NSDictionary *info = @{ + NSLocalizedDescriptionKey : @"Unable to parse response from the server", + NSLocalizedRecoverySuggestionErrorKey : + @"If this RPC is idempotent, retry " + @"with exponential backoff. Otherwise, query the server status before " + @"retrying.", + NSUnderlyingErrorKey : parsingError, + @"Expected class" : expectedClass, + @"Received value" : proto, + }; + // TODO(jcanizales): Use kGRPCErrorDomain and GRPCErrorCodeInternal when they're public. + return [NSError errorWithDomain:@"io.grpc" code:13 userInfo:info]; +} diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index 900ec8d0e1e..fd8a86bb2b2 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -18,14 +18,12 @@ #import -@class GRPCProtoCall; +#import +#import "ProtoRPC.h" + @protocol GRXWriteable; @class GRXWriter; @class GRPCCallOptions; -@class GRPCProtoCall; -@class GRPCUnaryProtoCall; -@class GRPCStreamingProtoCall; -@protocol GRPCProtoResponseHandler; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-completeness" @@ -38,15 +36,6 @@ __attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoServ : (nonnull NSString *)packageName serviceName : (nonnull NSString *)serviceName callOptions : (nullable GRPCCallOptions *)callOptions NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithHost:(NSString *)host - packageName:(NSString *)packageName - serviceName:(NSString *)serviceName; - -- (GRPCProtoCall *)RPCToMethod:(NSString *)method - requestsWriter:(GRXWriter *)requestsWriter - responseClass:(Class)responseClass - responsesWriteable:(id)responsesWriteable; - - (nullable GRPCUnaryProtoCall *)RPCToMethod:(nonnull NSString *)method message:(nonnull id)message responseHandler:(nonnull id)handler @@ -58,6 +47,18 @@ __attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoServ callOptions:(nullable GRPCCallOptions *)callOptions responseClass:(nonnull Class)responseClass; +@end + + @interface ProtoService(Legacy) + + - (instancetype)initWithHost : (NSString *)host packageName + : (NSString *)packageName serviceName : (NSString *)serviceName; + +- (GRPCProtoCall *)RPCToMethod:(NSString *)method + requestsWriter:(GRXWriter *)requestsWriter + responseClass:(Class)responseClass + responsesWriteable:(id)responsesWriteable; + @end #pragma clang diagnostic pop diff --git a/src/objective-c/ProtoRPC/ProtoService.m b/src/objective-c/ProtoRPC/ProtoService.m index 80a1f2f226c..e84cab8903f 100644 --- a/src/objective-c/ProtoRPC/ProtoService.m +++ b/src/objective-c/ProtoRPC/ProtoService.m @@ -29,15 +29,21 @@ #pragma clang diagnostic ignored "-Wdeprecated-implementations" @implementation ProtoService { #pragma clang diagnostic pop + + GRPCCallOptions *_callOptions; NSString *_host; NSString *_packageName; NSString *_serviceName; - GRPCCallOptions *_callOptions; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnonnull" +// Do not call the default init method - (instancetype)init { - return [self initWithHost:nil packageName:nil serviceName:nil]; + [NSException raise:NSGenericException format:@"Do not call init method of ProtoService"]; + return [self initWithHost:nil packageName:nil serviceName:nil callOptions:nil]; } +#pragma clang diagnostic pop // Designated initializer - (instancetype)initWithHost:(NSString *)host @@ -58,38 +64,6 @@ return self; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-designated-initializers" -// Do not call designated initializer here due to nullability incompatibility. This method is from -// old API and does not assert on nullability of the parameters. - -- (instancetype)initWithHost:(NSString *)host - packageName:(NSString *)packageName - serviceName:(NSString *)serviceName { - if ((self = [super init])) { - _host = [host copy]; - _packageName = [packageName copy]; - _serviceName = [serviceName copy]; - _callOptions = nil; - } - return self; -} - -#pragma clang diagnostic pop - -- (GRPCProtoCall *)RPCToMethod:(NSString *)method - requestsWriter:(GRXWriter *)requestsWriter - responseClass:(Class)responseClass - responsesWriteable:(id)responsesWriteable { - GRPCProtoMethod *methodName = - [[GRPCProtoMethod alloc] initWithPackage:_packageName service:_serviceName method:method]; - return [[GRPCProtoCall alloc] initWithHost:_host - method:methodName - requestsWriter:requestsWriter - responseClass:responseClass - responsesWriteable:responsesWriteable]; -} - - (GRPCUnaryProtoCall *)RPCToMethod:(NSString *)method message:(id)message responseHandler:(id)handler diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.h b/src/objective-c/ProtoRPC/ProtoServiceLegacy.h new file mode 100644 index 00000000000..7b0b7a4de7e --- /dev/null +++ b/src/objective-c/ProtoRPC/ProtoServiceLegacy.h @@ -0,0 +1,23 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "ProtoService.h" + +@class GRPCProtoCall; +@class GRXWriter; +@protocol GRXWriteable; diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m new file mode 100644 index 00000000000..6aa64955381 --- /dev/null +++ b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m @@ -0,0 +1,71 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +#import "ProtoMethod.h" +#import "ProtoRPCLegacy.h" +#import "ProtoService.h" + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" +@implementation ProtoService (Legacy) +#pragma clang diagnostic pop + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wobjc-designated-initializers" +// Do not call designated initializer here due to nullability incompatibility. This method is from +// old API and does not assert on nullability of the parameters. + +- (instancetype)initWithHost:(NSString *)host + packageName:(NSString *)packageName + serviceName:(NSString *)serviceName { + if ((self = [super init])) { + Ivar hostIvar = class_getInstanceVariable([ProtoService class], "_host"); + Ivar packageNameIvar = class_getInstanceVariable([ProtoService class], "_packageName"); + Ivar serviceNameIvar = class_getInstanceVariable([ProtoService class], "_serviceName"); + + object_setIvar(self, hostIvar, [host copy]); + object_setIvar(self, packageNameIvar, [packageName copy]); + object_setIvar(self, serviceNameIvar, [serviceName copy]); + } + return self; +} +#pragma clang diagnostic pop + +- (GRPCProtoCall *)RPCToMethod:(NSString *)method + requestsWriter:(GRXWriter *)requestsWriter + responseClass:(Class)responseClass + responsesWriteable:(id)responsesWriteable { + Ivar hostIvar = class_getInstanceVariable([ProtoService class], "_host"); + Ivar packageNameIvar = class_getInstanceVariable([ProtoService class], "_packageName"); + Ivar serviceNameIvar = class_getInstanceVariable([ProtoService class], "_serviceName"); + NSString *host = object_getIvar(self, hostIvar); + NSString *packageName = object_getIvar(self, packageNameIvar); + NSString *serviceName = object_getIvar(self, serviceNameIvar); + + GRPCProtoMethod *methodName = + [[GRPCProtoMethod alloc] initWithPackage:packageName service:serviceName method:method]; + return [[GRPCProtoCall alloc] initWithHost:host + method:methodName + requestsWriter:requestsWriter + responseClass:responseClass + responsesWriteable:responsesWriteable]; +} + +@end diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m index c94ee8c2569..9c466260121 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/ViewController.m @@ -25,6 +25,8 @@ #import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" #endif +#import +#import @interface ViewController () diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m index 3e97767cf0c..ce204a9c146 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/InterfaceController.m @@ -24,6 +24,8 @@ #import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" #endif +#import +#import @interface InterfaceController () diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index fed92596b17..65a32d742a9 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -95,19 +95,12 @@ tvos_application( deps = ["host-lib"], ) -grpc_objc_testing_library( - name = "CronetConfig", - srcs = ["ConfigureCronet.m"], - hdrs = ["ConfigureCronet.h"], -) - grpc_objc_testing_library( name = "InteropTests-lib", hdrs = ["InteropTests/InteropTests.h"], srcs = ["InteropTests/InteropTests.m"], deps = [ ":InteropTestsBlockCallbacks-lib", - ":CronetConfig", ], ) @@ -200,7 +193,6 @@ ios_unit_test( ":InteropTestsRemote-lib", ":InteropTestsLocalSSL-lib", ":InteropTestsLocalCleartext-lib", - # ":InteropTestsMulitpleChannels-lib", # needs Cronet ], test_host = ":ios-host", ) diff --git a/src/objective-c/tests/ConfigureCronet.h b/src/objective-c/tests/ConfigureCronet.h index cc5c038f3c6..ba0efc4df66 100644 --- a/src/objective-c/tests/ConfigureCronet.h +++ b/src/objective-c/tests/ConfigureCronet.h @@ -16,8 +16,6 @@ * */ -#ifdef GRPC_COMPILE_WITH_CRONET - #ifdef __cplusplus extern "C" { #endif @@ -30,5 +28,3 @@ void configureCronet(void); #ifdef __cplusplus } #endif - -#endif diff --git a/src/objective-c/tests/ConfigureCronet.m b/src/objective-c/tests/ConfigureCronet.m index ab137e28cad..6fc7e0ee9f5 100644 --- a/src/objective-c/tests/ConfigureCronet.m +++ b/src/objective-c/tests/ConfigureCronet.m @@ -16,8 +16,6 @@ * */ -#ifdef GRPC_COMPILE_WITH_CRONET - #import "ConfigureCronet.h" #import @@ -35,5 +33,3 @@ void configureCronet(void) { [Cronet startNetLogToFile:@"cronet_netlog.json" logBytes:YES]; }); } - -#endif diff --git a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m index a2a79c46316..aa1af301b96 100644 --- a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m +++ b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m @@ -22,6 +22,7 @@ #import #import +#import "../ConfigureCronet.h" #import "InteropTests.h" // The server address is derived from preprocessor macro, which is @@ -40,12 +41,19 @@ static int32_t kRemoteInteropServerOverhead = 12; @implementation InteropTestsRemoteWithCronet ++ (void)setUp { + configureCronet(); + [GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]]; + + [super setUp]; +} + + (NSString *)host { return kRemoteSSLHost; } -+ (BOOL)useCronet { - return YES; ++ (GRPCTransportId)transport { + return gGRPCCoreCronetId; } - (int32_t)encodingOverhead { diff --git a/src/objective-c/tests/InteropTests/InteropTests.h b/src/objective-c/tests/InteropTests/InteropTests.h index 28fcbff9695..a4adecd5415 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.h +++ b/src/objective-c/tests/InteropTests/InteropTests.h @@ -48,11 +48,19 @@ - (int32_t)encodingOverhead; /** + * DEPRECATED: \a transportType is a deprecated option. Please use \a transport instead. + * * The type of transport to be used. The base implementation returns default. Subclasses should * override to appropriate settings. */ + (GRPCTransportType)transportType; +/* + * The transport to be used. The base implementation returns NULL. Subclasses should override to + * appropriate settings. + */ ++ (GRPCTransportId)transport; + /** * The root certificates to be used. The base implementation returns nil. Subclasses should override * to appropriate settings. @@ -65,9 +73,4 @@ */ + (NSString *)hostNameOverride; -/** - * Whether to use Cronet for all the v1 API tests in the test suite. - */ -+ (BOOL)useCronet; - @end diff --git a/src/objective-c/tests/InteropTests/InteropTests.m b/src/objective-c/tests/InteropTests/InteropTests.m index a8f7db7ee93..21198f7bad9 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.m +++ b/src/objective-c/tests/InteropTests/InteropTests.m @@ -20,9 +20,6 @@ #include -#ifdef GRPC_COMPILE_WITH_CRONET -#import -#endif #import #import #import @@ -38,7 +35,6 @@ #import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" #import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" -#import "../ConfigureCronet.h" #import "InteropTestsBlockCallbacks.h" #define TEST_TIMEOUT 32 @@ -91,9 +87,8 @@ BOOL isRemoteInteropTest(NSString *host) { - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { dispatch_queue_t queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); - return [[GRPCInterceptor alloc] initWithInterceptorManager:interceptorManager - requestDispatchQueue:queue - responseDispatchQueue:queue]; + return + [[GRPCInterceptor alloc] initWithInterceptorManager:interceptorManager dispatchQueue:queue]; } @end @@ -101,21 +96,19 @@ BOOL isRemoteInteropTest(NSString *host) { @interface HookInterceptorFactory : NSObject - (instancetype) -initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue - startHook:(void (^)(GRPCRequestOptions *requestOptions, - GRPCCallOptions *callOptions, - GRPCInterceptorManager *manager))startHook - writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook - finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook - receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, - GRPCInterceptorManager *manager))receiveNextMessagesHook - responseHeaderHook:(void (^)(NSDictionary *initialMetadata, - GRPCInterceptorManager *manager))responseHeaderHook - responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook - responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, - GRPCInterceptorManager *manager))responseCloseHook - didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook; + initWithDispatchQueue:(dispatch_queue_t)dispatchQueue + startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, + GRPCInterceptorManager *manager))startHook + writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook + finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook +receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, + GRPCInterceptorManager *manager))receiveNextMessagesHook + responseHeaderHook:(void (^)(NSDictionary *initialMetadata, + GRPCInterceptorManager *manager))responseHeaderHook + responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook + responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, + GRPCInterceptorManager *manager))responseCloseHook + didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook; - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager; @@ -125,8 +118,7 @@ initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - (instancetype) initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue + dispatchQueue:(dispatch_queue_t)dispatchQueue startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook @@ -155,29 +147,25 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager void (^_responseCloseHook)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager); void (^_didWriteDataHook)(GRPCInterceptorManager *manager); - dispatch_queue_t _requestDispatchQueue; - dispatch_queue_t _responseDispatchQueue; + dispatch_queue_t _dispatchQueue; } - (instancetype) -initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue - startHook:(void (^)(GRPCRequestOptions *requestOptions, - GRPCCallOptions *callOptions, - GRPCInterceptorManager *manager))startHook - writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook - finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook - receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, - GRPCInterceptorManager *manager))receiveNextMessagesHook - responseHeaderHook:(void (^)(NSDictionary *initialMetadata, - GRPCInterceptorManager *manager))responseHeaderHook - responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook - responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, - GRPCInterceptorManager *manager))responseCloseHook - didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { + initWithDispatchQueue:(dispatch_queue_t)dispatchQueue + startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, + GRPCInterceptorManager *manager))startHook + writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook + finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook +receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, + GRPCInterceptorManager *manager))receiveNextMessagesHook + responseHeaderHook:(void (^)(NSDictionary *initialMetadata, + GRPCInterceptorManager *manager))responseHeaderHook + responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook + responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, + GRPCInterceptorManager *manager))responseCloseHook + didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { if ((self = [super init])) { - _requestDispatchQueue = requestDispatchQueue; - _responseDispatchQueue = responseDispatchQueue; + _dispatchQueue = dispatchQueue; _startHook = startHook; _writeDataHook = writeDataHook; _finishHook = finishHook; @@ -192,8 +180,7 @@ initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { return [[HookInterceptor alloc] initWithInterceptorManager:interceptorManager - requestDispatchQueue:_requestDispatchQueue - responseDispatchQueue:_responseDispatchQueue + dispatchQueue:_dispatchQueue startHook:_startHook writeDataHook:_writeDataHook finishHook:_finishHook @@ -218,22 +205,16 @@ initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue GRPCInterceptorManager *manager); void (^_didWriteDataHook)(GRPCInterceptorManager *manager); GRPCInterceptorManager *_manager; - dispatch_queue_t _requestDispatchQueue; - dispatch_queue_t _responseDispatchQueue; -} - -- (dispatch_queue_t)requestDispatchQueue { - return _requestDispatchQueue; + dispatch_queue_t _dispatchQueue; } - (dispatch_queue_t)dispatchQueue { - return _responseDispatchQueue; + return _dispatchQueue; } - (instancetype) initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue + dispatchQueue:(dispatch_queue_t)dispatchQueue startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook @@ -247,9 +228,7 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager))responseCloseHook didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { - if ((self = [super initWithInterceptorManager:interceptorManager - requestDispatchQueue:requestDispatchQueue - responseDispatchQueue:responseDispatchQueue])) { + if ((self = [super initWithInterceptorManager:interceptorManager dispatchQueue:dispatchQueue])) { _startHook = startHook; _writeDataHook = writeDataHook; _finishHook = finishHook; @@ -258,8 +237,7 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager _responseDataHook = responseDataHook; _responseCloseHook = responseCloseHook; _didWriteDataHook = didWriteDataHook; - _requestDispatchQueue = requestDispatchQueue; - _responseDispatchQueue = responseDispatchQueue; + _dispatchQueue = dispatchQueue; _manager = interceptorManager; } return self; @@ -320,8 +298,7 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager @property BOOL enabled; -- (instancetype)initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue; +- (instancetype)initWithDispatchQueue:(dispatch_queue_t)dispatchQueue; - (void)setStartHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook @@ -340,26 +317,23 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager @implementation GlobalInterceptorFactory -- (instancetype)initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue { +- (instancetype)initWithDispatchQueue:(dispatch_queue_t)dispatchQueue { _enabled = NO; - return [super initWithRequestDispatchQueue:requestDispatchQueue - responseDispatchQueue:responseDispatchQueue - startHook:nil - writeDataHook:nil - finishHook:nil - receiveNextMessagesHook:nil - responseHeaderHook:nil - responseDataHook:nil - responseCloseHook:nil - didWriteDataHook:nil]; + return [super initWithDispatchQueue:dispatchQueue + startHook:nil + writeDataHook:nil + finishHook:nil + receiveNextMessagesHook:nil + responseHeaderHook:nil + responseDataHook:nil + responseCloseHook:nil + didWriteDataHook:nil]; } - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { if (_enabled) { return [[HookInterceptor alloc] initWithInterceptorManager:interceptorManager - requestDispatchQueue:_requestDispatchQueue - responseDispatchQueue:_responseDispatchQueue + dispatchQueue:_dispatchQueue startHook:_startHook writeDataHook:_writeDataHook finishHook:_finishHook @@ -425,10 +399,15 @@ static dispatch_once_t initGlobalInterceptorFactory; return 0; } +// For backwards compatibility + (GRPCTransportType)transportType { return GRPCTransportTypeChttp2BoringSSL; } ++ (GRPCTransportId)transport { + return NULL; +} + + (NSString *)PEMRootCertificates { return nil; } @@ -437,26 +416,11 @@ static dispatch_once_t initGlobalInterceptorFactory; return nil; } -+ (BOOL)useCronet { - return NO; -} - + (void)setUp { -#ifdef GRPC_COMPILE_WITH_CRONET - configureCronet(); - if ([self useCronet]) { - [GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]]; - } -#endif -#ifdef GRPC_CFSTREAM - setenv(kCFStreamVarName, "1", 1); -#endif - dispatch_once(&initGlobalInterceptorFactory, ^{ dispatch_queue_t globalInterceptorQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); globalInterceptorFactory = - [[GlobalInterceptorFactory alloc] initWithRequestDispatchQueue:globalInterceptorQueue - responseDispatchQueue:globalInterceptorQueue]; + [[GlobalInterceptorFactory alloc] initWithDispatchQueue:globalInterceptorQueue]; [GRPCCall2 registerGlobalInterceptor:globalInterceptorFactory]; }); } @@ -502,7 +466,9 @@ static dispatch_once_t initGlobalInterceptorFactory; GPBEmpty *request = [GPBEmpty message]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -531,7 +497,9 @@ static dispatch_once_t initGlobalInterceptorFactory; GPBEmpty *request = [GPBEmpty message]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -608,7 +576,9 @@ static dispatch_once_t initGlobalInterceptorFactory; request.payload.body = [NSMutableData dataWithLength:271828]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -656,7 +626,9 @@ static dispatch_once_t initGlobalInterceptorFactory; request.responseStatus.code = GRPC_STATUS_CANCELLED; } GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -958,7 +930,9 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; @@ -1010,7 +984,9 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.flowControlEnabled = YES; @@ -1167,7 +1143,9 @@ static dispatch_once_t initGlobalInterceptorFactory; __block BOOL receivedResponse = NO; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = self.class.transportType; + options.transport = [[self class] transport]; options.PEMRootCertificates = self.class.PEMRootCertificates; options.hostNameOverride = [[self class] hostNameOverride]; @@ -1200,7 +1178,9 @@ static dispatch_once_t initGlobalInterceptorFactory; [self expectationWithDescription:@"Call completed."]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = self.class.transportType; + options.transport = [[self class] transport]; options.PEMRootCertificates = self.class.PEMRootCertificates; options.hostNameOverride = [[self class] hostNameOverride]; @@ -1286,48 +1266,47 @@ static dispatch_once_t initGlobalInterceptorFactory; [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil]; } -#ifndef GRPC_COMPILE_WITH_CRONET -- (void)testKeepalive { +- (void)testKeepaliveWithV2API { XCTAssertNotNil([[self class] host]); + if ([[self class] transport] == gGRPCCoreCronetId) { + // Cronet does not support keepalive + return; + } __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Keepalive"]; - [GRPCCall setKeepaliveWithInterval:1500 timeout:0 forHost:[[self class] host]]; - - NSArray *requests = @[ @27182, @8 ]; - NSArray *responses = @[ @31415, @9 ]; - - GRXBufferedPipe *requestsBuffer = [[GRXBufferedPipe alloc] init]; - - __block int index = 0; + NSNumber *kRequestSize = @27182; + NSNumber *kResponseSize = @31415; - id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] - requestedResponseSize:responses[index]]; - [requestsBuffer writeValue:request]; + id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:kRequestSize + requestedResponseSize:kResponseSize]; + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; + options.PEMRootCertificates = [[self class] PEMRootCertificates]; + options.hostNameOverride = [[self class] hostNameOverride]; + options.keepaliveInterval = 1.5; + options.keepaliveTimeout = 0; - [_service - fullDuplexCallWithRequestsWriter:requestsBuffer - eventHandler:^(BOOL done, RMTStreamingOutputCallResponse *response, - NSError *error) { - if (index == 0) { - XCTAssertNil(error, @"Finished with unexpected error: %@", error); - XCTAssertTrue(response, @"Event handler called without an event."); - XCTAssertFalse(done); - index++; - } else { - // Keepalive should kick after 1s elapsed and fails the call. - XCTAssertNotNil(error); - XCTAssertEqual(error.code, GRPC_STATUS_UNAVAILABLE); - XCTAssertEqualObjects( - error.localizedDescription, @"keepalive watchdog timeout", - @"Unexpected failure that is not keepalive watchdog timeout."); - XCTAssertTrue(done); - [expectation fulfill]; - } - }]; + __block GRPCStreamingProtoCall *call = [_service + fullDuplexCallWithResponseHandler: + [[InteropTestsBlockCallbacks alloc] + initWithInitialMetadataCallback:nil + messageCallback:nil + closeCallback:^(NSDictionary *trailingMetadata, NSError *error) { + XCTAssertNotNil(error); + XCTAssertEqual( + error.code, GRPC_STATUS_UNAVAILABLE, + @"Received status %ld instead of UNAVAILABLE (14).", + error.code); + [expectation fulfill]; + }] + callOptions:options]; + [call writeMessage:request]; + [call start]; [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil]; + [call finish]; } -#endif - (void)testDefaultInterceptor { XCTAssertNotNil([[self class] host]); @@ -1342,7 +1321,9 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.interceptorFactories = @[ [[DefaultInterceptorFactory alloc] init] ]; @@ -1397,8 +1378,7 @@ static dispatch_once_t initGlobalInterceptorFactory; __block NSUInteger responseCloseCount = 0; __block NSUInteger didWriteDataCount = 0; id factory = [[HookInterceptorFactory alloc] - initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) - responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager) { startCount++; @@ -1446,7 +1426,9 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.flowControlEnabled = YES; @@ -1524,8 +1506,7 @@ static dispatch_once_t initGlobalInterceptorFactory; __block NSUInteger responseDataCount = 0; __block NSUInteger responseCloseCount = 0; id factory = [[HookInterceptorFactory alloc] - initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) - responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager) { startCount++; @@ -1552,6 +1533,7 @@ static dispatch_once_t initGlobalInterceptorFactory; // finish must happen after the hijacking, so directly reply with a close [manager forwardPreviousInterceptorCloseWithTrailingMetadata:@{@"grpc-status" : @"0"} error:nil]; + [manager shutDown]; } receiveNextMessagesHook:nil responseHeaderHook:^(NSDictionary *initialMetadata, GRPCInterceptorManager *manager) { @@ -1578,7 +1560,9 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.interceptorFactories = @[ [[DefaultInterceptorFactory alloc] init], factory ]; @@ -1687,7 +1671,9 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.flowControlEnabled = YES; @@ -1742,16 +1728,15 @@ static dispatch_once_t initGlobalInterceptorFactory; - (void)testConflictingGlobalInterceptors { id factory = [[HookInterceptorFactory alloc] - initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) - responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) - startHook:nil - writeDataHook:nil - finishHook:nil - receiveNextMessagesHook:nil - responseHeaderHook:nil - responseDataHook:nil - responseCloseHook:nil - didWriteDataHook:nil]; + initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + startHook:nil + writeDataHook:nil + finishHook:nil + receiveNextMessagesHook:nil + responseHeaderHook:nil + responseDataHook:nil + responseCloseHook:nil + didWriteDataHook:nil]; @try { [GRPCCall2 registerGlobalInterceptor:factory]; XCTFail(@"Did not receive an exception when registering global interceptor the second time"); @@ -1775,8 +1760,7 @@ static dispatch_once_t initGlobalInterceptorFactory; __block NSUInteger didWriteDataCount = 0; id factory = [[HookInterceptorFactory alloc] - initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) - responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager) { startCount++; @@ -1872,7 +1856,9 @@ static dispatch_once_t initGlobalInterceptorFactory; id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index] requestedResponseSize:responses[index]]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + // For backwards compatibility options.transportType = [[self class] transportType]; + options.transport = [[self class] transport]; options.PEMRootCertificates = [[self class] PEMRootCertificates]; options.hostNameOverride = [[self class] hostNameOverride]; options.flowControlEnabled = YES; diff --git a/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m b/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m index a9c69183332..2e638099e1e 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m +++ b/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m @@ -17,6 +17,7 @@ */ #import +#import #import #import "InteropTests.h" @@ -60,8 +61,8 @@ static int32_t kLocalInteropServerOverhead = 10; [GRPCCall useInsecureConnectionsForHost:kLocalCleartextHost]; } -+ (GRPCTransportType)transportType { - return GRPCTransportTypeInsecure; ++ (GRPCTransportId)transport { + return GRPCDefaultTransportImplList.core_insecure; } @end diff --git a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m index e8222f602f4..30d8f4c34af 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m +++ b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m @@ -17,6 +17,7 @@ */ #import +#import #import #import "InteropTests.h" @@ -56,8 +57,8 @@ static int32_t kLocalInteropServerOverhead = 10; return kLocalInteropServerOverhead; // bytes } -+ (GRPCTransportType)transportType { - return GRPCTransportTypeChttp2BoringSSL; ++ (GRPCTransportId)transport { + return GRPCDefaultTransportImplList.core_secure; } - (void)setUp { diff --git a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m index 98893a466bd..dc48391cbcc 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m +++ b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m @@ -18,9 +18,8 @@ #import -#ifdef GRPC_COMPILE_WITH_CRONET #import -#endif +#import #import #import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" #import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" diff --git a/src/objective-c/tests/InteropTests/InteropTestsRemote.m b/src/objective-c/tests/InteropTests/InteropTestsRemote.m index c1cd9b81efc..2dd8f0aed89 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsRemote.m +++ b/src/objective-c/tests/InteropTests/InteropTestsRemote.m @@ -53,14 +53,8 @@ static int32_t kRemoteInteropServerOverhead = 12; return kRemoteInteropServerOverhead; // bytes } -#ifdef GRPC_COMPILE_WITH_CRONET -+ (GRPCTransportType)transportType { - return GRPCTransportTypeCronet; -} -#else + (GRPCTransportType)transportType { return GRPCTransportTypeChttp2BoringSSL; } -#endif @end diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index c2297aa00fd..c83e8861e93 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -30,25 +30,25 @@ target 'MacTests' do grpc_deps end -target 'UnitTests' do - platform :ios, '8.0' - grpc_deps -end - %w( + UnitTests InteropTests - CronetTests ).each do |target_name| target target_name do platform :ios, '8.0' grpc_deps - - pod 'gRPC-Core/Cronet-Implementation', :path => GRPC_LOCAL_SRC - pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c" - pod 'gRPC-Core/Tests', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true end end +target 'CronetTests' do + platform :ios, '8.0' + grpc_deps + + pod 'gRPC/GRPCCoreCronet', :path => GRPC_LOCAL_SRC + pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c" + pod 'gRPC-Core/Tests', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true +end + # gRPC-Core.podspec needs to be modified to be successfully used for local development. A Podfile's # pre_install hook lets us do that. The block passed to it runs after the podspecs are downloaded # and before they are installed in the user project. @@ -103,7 +103,7 @@ post_install do |installer| # the test target 'InteropTestsRemoteWithCronet' # Activate GRPCCall+InternalTests functions for the dedicated build configuration 'Test', which will # be used by all test targets using it. - if /gRPC-(mac|i|tv)OS/.match(target.name) + if /gRPC(-macOS|-iOS|-tvOS|\.|-[0-9a-f])/.match(target.name) target.build_configurations.each do |config| if config.name == 'Cronet' config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_COMPILE_WITH_CRONET=1 GRPC_TEST_OBJC=1' @@ -114,7 +114,7 @@ post_install do |installer| end # Enable NSAssert on gRPC - if /(gRPC|ProtoRPC|RxLibrary)-(mac|i|tv)OS/.match(target.name) + if /(gRPC|ProtoRPC|RxLibrary)/.match(target.name) target.build_configurations.each do |config| if config.name != 'Release' config.build_settings['ENABLE_NS_ASSERTIONS'] = 'YES' diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index a88838fdc8b..6cb9f5560b9 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -8,15 +8,14 @@ /* Begin PBXBuildFile section */ 5E0282E9215AA697007AC99D /* NSErrorUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0282E8215AA697007AC99D /* NSErrorUnitTests.m */; }; + 5E08D07023021E3B006D76EA /* InteropTestsMultipleChannels.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487722778226006656AD /* InteropTestsMultipleChannels.m */; }; 5E3F14842278B461007C6D90 /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; 5E3F14852278BF5D007C6D90 /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; 5E3F14862278BFFF007C6D90 /* InteropTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F14832278B461007C6D90 /* InteropTestsBlockCallbacks.m */; }; 5E3F148D22792856007C6D90 /* ConfigureCronet.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F1487227918AA007C6D90 /* ConfigureCronet.m */; }; - 5E3F148E22792AF5007C6D90 /* ConfigureCronet.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F1487227918AA007C6D90 /* ConfigureCronet.m */; }; 5E7F486422775B37006656AD /* InteropTestsRemoteWithCronet.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE84BF31D4717E40050C6CC /* InteropTestsRemoteWithCronet.m */; }; 5E7F486522775B41006656AD /* CronetUnitTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5EAD6D261E27047400002378 /* CronetUnitTests.mm */; }; 5E7F486E22778086006656AD /* CoreCronetEnd2EndTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F486D22778086006656AD /* CoreCronetEnd2EndTests.mm */; }; - 5E7F487922778226006656AD /* InteropTestsMultipleChannels.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487722778226006656AD /* InteropTestsMultipleChannels.m */; }; 5E7F487D22778256006656AD /* ChannelPoolTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487B22778256006656AD /* ChannelPoolTest.m */; }; 5E7F487E22778256006656AD /* ChannelTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487C22778256006656AD /* ChannelTests.m */; }; 5E7F4880227782C1006656AD /* APIv2Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487F227782C1006656AD /* APIv2Tests.m */; }; @@ -34,6 +33,7 @@ 5EA4770322736178000F72FC /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; }; 5EA477042273617B000F72FC /* InteropTestsLocalCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */; }; 5EA4770522736AC4000F72FC /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; + 5ECFED8623030DCC00626501 /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; 65EB19E418B39A8374D407BB /* libPods-CronetTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B1511C20E16A8422B58D61A /* libPods-CronetTests.a */; }; 903163C7FE885838580AEC7A /* libPods-InteropTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D457AD9797664CFA191C3280 /* libPods-InteropTests.a */; }; 953CD2942A3A6D6CE695BE87 /* libPods-MacTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 276873A05AC5479B60DF6079 /* libPods-MacTests.a */; }; @@ -515,7 +515,6 @@ 5EA476F12272816A000F72FC /* Frameworks */, 5EA476F22272816A000F72FC /* Resources */, D11CB94CF56A1E53760D29D8 /* [CP] Copy Pods Resources */, - 0FEFD5FC6B323AC95549AE4A /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -630,6 +629,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 5ECFED8623030DCC00626501 /* TestCertificates.bundle in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -678,24 +678,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 0FEFD5FC6B323AC95549AE4A /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh", - "${PODS_ROOT}/CronetFramework/Cronet.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InteropTests/Pods-InteropTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 292EA42A76AC7933A37235FD /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -721,7 +703,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-iOS/gRPCCertificates.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC.default-GRPCCoreCronet/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( @@ -898,6 +880,7 @@ files = ( 5E3F14852278BF5D007C6D90 /* InteropTestsBlockCallbacks.m in Sources */, 5E3F148D22792856007C6D90 /* ConfigureCronet.m in Sources */, + 5E08D07023021E3B006D76EA /* InteropTestsMultipleChannels.m in Sources */, 5E7F486E22778086006656AD /* CoreCronetEnd2EndTests.mm in Sources */, 5E7F488522778A88006656AD /* InteropTests.m in Sources */, 5E7F486422775B37006656AD /* InteropTestsRemoteWithCronet.m in Sources */, @@ -910,9 +893,7 @@ buildActionMask = 2147483647; files = ( 5E3F14842278B461007C6D90 /* InteropTestsBlockCallbacks.m in Sources */, - 5E3F148E22792AF5007C6D90 /* ConfigureCronet.m in Sources */, 5E7F488922778B04006656AD /* InteropTestsRemote.m in Sources */, - 5E7F487922778226006656AD /* InteropTestsMultipleChannels.m in Sources */, 5EA477042273617B000F72FC /* InteropTestsLocalCleartext.m in Sources */, 5EA4770322736178000F72FC /* InteropTestsLocalSSL.m in Sources */, 5E7F488422778A88006656AD /* InteropTests.m in Sources */, diff --git a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTests.xcscheme b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTests.xcscheme index adb3c366af2..cbde360a338 100644 --- a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTests.xcscheme +++ b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTests.xcscheme @@ -23,7 +23,7 @@ @@ -48,7 +48,7 @@ + buildConfiguration = "Test"> -#import "../../GRPCClient/private/GRPCChannel.h" -#import "../../GRPCClient/private/GRPCChannelPool+Test.h" -#import "../../GRPCClient/private/GRPCCompletionQueue.h" +#import "../../GRPCClient/private/GRPCCore/GRPCChannel.h" +#import "../../GRPCClient/private/GRPCCore/GRPCChannelPool+Test.h" +#import "../../GRPCClient/private/GRPCCore/GRPCCompletionQueue.h" #define TEST_TIMEOUT 32 diff --git a/src/objective-c/tests/UnitTests/ChannelTests.m b/src/objective-c/tests/UnitTests/ChannelTests.m index df78e8b1162..1ed0f16ecaf 100644 --- a/src/objective-c/tests/UnitTests/ChannelTests.m +++ b/src/objective-c/tests/UnitTests/ChannelTests.m @@ -19,11 +19,11 @@ #import #import "../../GRPCClient/GRPCCallOptions.h" -#import "../../GRPCClient/private/GRPCChannel.h" -#import "../../GRPCClient/private/GRPCChannelPool+Test.h" -#import "../../GRPCClient/private/GRPCChannelPool.h" -#import "../../GRPCClient/private/GRPCCompletionQueue.h" -#import "../../GRPCClient/private/GRPCWrappedCall.h" +#import "../../GRPCClient/private/GRPCCore/GRPCChannel.h" +#import "../../GRPCClient/private/GRPCCore/GRPCChannelPool+Test.h" +#import "../../GRPCClient/private/GRPCCore/GRPCChannelPool.h" +#import "../../GRPCClient/private/GRPCCore/GRPCCompletionQueue.h" +#import "../../GRPCClient/private/GRPCCore/GRPCWrappedCall.h" static NSString *kDummyHost = @"dummy.host"; static NSString *kDummyPath = @"/dummy/path"; diff --git a/src/objective-c/tests/UnitTests/NSErrorUnitTests.m b/src/objective-c/tests/UnitTests/NSErrorUnitTests.m index 8a4f03a4460..74e5794c480 100644 --- a/src/objective-c/tests/UnitTests/NSErrorUnitTests.m +++ b/src/objective-c/tests/UnitTests/NSErrorUnitTests.m @@ -20,7 +20,7 @@ #import -#import "../../GRPCClient/private/NSError+GRPC.h" +#import "../../GRPCClient/private/GRPCCore/NSError+GRPC.h" @interface NSErrorUnitTests : XCTestCase diff --git a/templates/gRPC-ProtoRPC.podspec.template b/templates/gRPC-ProtoRPC.podspec.template index 457d2988036..e94f149ee4a 100644 --- a/templates/gRPC-ProtoRPC.podspec.template +++ b/templates/gRPC-ProtoRPC.podspec.template @@ -44,22 +44,40 @@ s.module_name = name s.header_dir = name - src_dir = 'src/objective-c/ProtoRPC' + s.default_subspec = 'Main', 'Legacy', 'Legacy-Header' - s.default_subspec = 'Main' + s.subspec 'Legacy-Header' do |ss| + ss.header_mappings_dir = "src/objective-c/ProtoRPC" + ss.public_header_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.h" + ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.h" + end s.subspec 'Main' do |ss| - ss.header_mappings_dir = "#{src_dir}" - ss.dependency 'gRPC', version + ss.header_mappings_dir = "src/objective-c/ProtoRPC" + ss.dependency "#{s.name}/Legacy-Header", version + ss.dependency 'gRPC/Interface', version + ss.dependency 'Protobuf', '~> 3.0' + + ss.source_files = "src/objective-c/ProtoRPC/ProtoMethod.{h,m}", + "src/objective-c/ProtoRPC/ProtoRPC.{h,m}", + "src/objective-c/ProtoRPC/ProtoService.{h,m}" + end + + s.subspec 'Legacy' do |ss| + ss.header_mappings_dir = "src/objective-c/ProtoRPC" + ss.dependency "#{s.name}/Main", version + ss.dependency "#{s.name}/Legacy-Header", version + ss.dependency 'gRPC/GRPCCore', version ss.dependency 'gRPC-RxLibrary', version ss.dependency 'Protobuf', '~> 3.0' - ss.source_files = "#{src_dir}/*.{h,m}" + ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.m", + "src/objective-c/ProtoRPC/ProtoServiceLegacy.m" end # CFStream is now default. Leaving this subspec only for compatibility purpose. s.subspec 'CFStream' do |ss| - ss.dependency "#{s.name}/Main", version + ss.dependency "#{s.name}/Legacy", version end s.pod_target_xcconfig = { diff --git a/templates/gRPC-RxLibrary.podspec.template b/templates/gRPC-RxLibrary.podspec.template index 9389c5ecd8d..772265dadda 100644 --- a/templates/gRPC-RxLibrary.podspec.template +++ b/templates/gRPC-RxLibrary.podspec.template @@ -44,6 +44,23 @@ s.module_name = name s.header_dir = name + s.default_subspec = 'Interface', 'Implementation' + + src_dir = 'src/objective-c/RxLibrary' + s.subspec 'Interface' do |ss| + ss.header_mappings_dir = "#{src_dir}" + ss.source_files = "#{src_dir}/*.h" + ss.public_header_files = "#{src_dir}/*.h" + end + + s.subspec 'Implementation' do |ss| + ss.header_mappings_dir = "#{src_dir}" + ss.source_files = "#{src_dir}/*.m", "#{src_dir}/**/*.{h,m}" + ss.private_header_files = "#{src_dir}/**/*.h" + + ss.dependency "#{s.name}/Interface" + end + src_dir = 'src/objective-c/RxLibrary' s.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" s.private_header_files = "#{src_dir}/private/*.h" diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index 8cb380ede03..e705edc1748 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -43,13 +43,7 @@ s.module_name = name s.header_dir = name - src_dir = 'src/objective-c/GRPCClient' - - s.dependency 'gRPC-RxLibrary', version - s.default_subspec = 'Main' - - # Certificates, to be able to establish TLS connections: - s.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } + s.default_subspec = 'Interface', 'GRPCCore', 'Interface-Legacy' s.pod_target_xcconfig = { # This is needed by all pods that depend on gRPC-RxLibrary: @@ -57,29 +51,103 @@ 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } - s.subspec 'Main' do |ss| - ss.header_mappings_dir = "#{src_dir}" - - ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" - ss.exclude_files = "#{src_dir}/GRPCCall+GID.{h,m}" - ss.private_header_files = "#{src_dir}/private/*.h", "#{src_dir}/internal/*.h" - - ss.dependency 'gRPC-Core', version + s.subspec 'Interface-Legacy' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' + + ss.public_header_files = "GRPCClient/GRPCCall+ChannelArg.h", + "GRPCClient/GRPCCall+ChannelCredentials.h", + "GRPCClient/GRPCCall+Cronet.h", + "GRPCClient/GRPCCall+OAuth2.h", + "GRPCClient/GRPCCall+Tests.h", + "src/objective-c/GRPCClient/GRPCCallLegacy.h", + "src/objective-c/GRPCClient/GRPCTypes.h" + + ss.source_files = "GRPCClient/GRPCCall+ChannelArg.h", + "GRPCClient/GRPCCall+ChannelCredentials.h", + "GRPCClient/GRPCCall+Cronet.h", + "GRPCClient/GRPCCall+OAuth2.h", + "GRPCClient/GRPCCall+Tests.h", + "src/objective-c/GRPCClient/GRPCCallLegacy.h", + "src/objective-c/GRPCClient/GRPCTypes.h" + ss.dependency "gRPC-RxLibrary/Interface", version end - # CFStream is now default. Leaving this subspec only for compatibility purpose. - s.subspec 'CFStream' do |ss| - ss.dependency "#{s.name}/Main", version + s.subspec 'Interface' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' + + ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall.h', + 'src/objective-c/GRPCClient/GRPCCall+Interceptor.h', + 'src/objective-c/GRPCClient/GRPCCallOptions.h', + 'src/objective-c/GRPCClient/GRPCInterceptor.h', + 'src/objective-c/GRPCClient/GRPCTransport.h', + 'src/objective-c/GRPCClient/GRPCDispatchable.h', + 'src/objective-c/GRPCClient/version.h' + + ss.source_files = 'src/objective-c/GRPCClient/GRPCCall.h', + 'src/objective-c/GRPCClient/GRPCCall.m', + 'src/objective-c/GRPCClient/GRPCCall+Interceptor.h', + 'src/objective-c/GRPCClient/GRPCCall+Interceptor.m', + 'src/objective-c/GRPCClient/GRPCCallOptions.h', + 'src/objective-c/GRPCClient/GRPCCallOptions.m', + 'src/objective-c/GRPCClient/GRPCDispatchable.h', + 'src/objective-c/GRPCClient/GRPCInterceptor.h', + 'src/objective-c/GRPCClient/GRPCInterceptor.m', + 'src/objective-c/GRPCClient/GRPCTransport.h', + 'src/objective-c/GRPCClient/GRPCTransport.m', + 'src/objective-c/GRPCClient/internal/*.h', + 'src/objective-c/GRPCClient/private/GRPCTransport+Private.h', + 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m', + 'src/objective-c/GRPCClient/version.h' + + ss.dependency "#{s.name}/Interface-Legacy", version end - s.subspec 'GID' do |ss| - ss.ios.deployment_target = '7.0' + s.subspec 'GRPCCore' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' + + ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', + 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', + 'src/objective-c/GRPCClient/GRPCCall+Tests.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', + 'src/objective-c/GRPCClient/internal_testing/*.h' + ss.private_header_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.h' + ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.{h,m}', + 'src/objective-c/GRPCClient/private/GRPCCore/*.{h,m}', + 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelArg.m', + 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h', + 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.m', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', + 'src/objective-c/GRPCClient/GRPCCall+OAuth2.h', + 'src/objective-c/GRPCClient/GRPCCall+OAuth2.m', + 'src/objective-c/GRPCClient/GRPCCall+Tests.h', + 'src/objective-c/GRPCClient/GRPCCall+Tests.m', + 'src/objective-c/GRPCClient/GRPCCallLegacy.m' + + # Certificates, to be able to establish TLS connections: + ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] } + + ss.dependency "#{s.name}/Interface-Legacy", version + ss.dependency "#{s.name}/Interface", version + ss.dependency 'gRPC-Core', version + ss.dependency 'gRPC-RxLibrary', version + end - ss.header_mappings_dir = "#{src_dir}" + s.subspec 'GRPCCoreCronet' do |ss| + ss.header_mappings_dir = 'src/objective-c/GRPCClient' - ss.source_files = "#{src_dir}/GRPCCall+GID.{h,m}" + ss.source_files = 'src/objective-c/GRPCClient/GRPCCall+Cronet.h', + 'src/objective-c/GRPCClient/GRPCCall+Cronet.m', + 'src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/*.{h,m}' + ss.dependency "#{s.name}/GRPCCore", version + ss.dependency 'gRPC-Core/Cronet-Implementation', version + ss.dependency 'CronetFramework' + end - ss.dependency "#{s.name}/Main", version - ss.dependency 'Google/SignIn' + # CFStream is now default. Leaving this subspec only for compatibility purpose. + s.subspec 'CFStream' do |ss| + ss.dependency "#{s.name}/GRPCCore", version end end diff --git a/templates/src/objective-c/GRPCClient/private/version.h.template b/templates/src/objective-c/GRPCClient/version.h.template similarity index 100% rename from templates/src/objective-c/GRPCClient/private/version.h.template rename to templates/src/objective-c/GRPCClient/version.h.template From e70788364bf38947e9d3afb820800b14e44829b9 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 28 Aug 2019 13:50:37 -0700 Subject: [PATCH 484/661] Make dependency on template files explicit --- third_party/py/python_configure.bzl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/third_party/py/python_configure.bzl b/third_party/py/python_configure.bzl index 70380e9dde9..6f9a178a057 100644 --- a/third_party/py/python_configure.bzl +++ b/third_party/py/python_configure.bzl @@ -292,14 +292,24 @@ def _python_autoconf_impl(repository_ctx): python_configure = repository_rule( - implementation=_python_autoconf_impl, - environ=[ + implementation = _python_autoconf_impl, + environ = [ _BAZEL_SH, _PYTHON2_BIN_PATH, _PYTHON2_LIB_PATH, _PYTHON3_BIN_PATH, _PYTHON3_LIB_PATH, ], + attrs={ + "_build_tpl": attr.label( + default = Label("//third_party/py:BUILD.tpl"), + allow_single_file = True, + ), + "_variety_tpl": attr.label( + default = Label("//third_party/py:variety.tpl"), + allow_single_file = True, + ), + }, ) """Detects and configures the local Python. From 29bb3ef9733fbe61aa9fd7078952f5af662d1aa0 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Tue, 27 Aug 2019 10:19:40 -0700 Subject: [PATCH 485/661] Remove redundant MethodHandler friend declarations --- include/grpcpp/impl/codegen/byte_buffer.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/grpcpp/impl/codegen/byte_buffer.h b/include/grpcpp/impl/codegen/byte_buffer.h index 7fb678d5f7f..54886ae8086 100644 --- a/include/grpcpp/impl/codegen/byte_buffer.h +++ b/include/grpcpp/impl/codegen/byte_buffer.h @@ -173,8 +173,6 @@ class ByteBuffer final { friend class ::grpc_impl::internal::RpcMethodHandler; template friend class ::grpc_impl::internal::ServerStreamingHandler; - template - friend class ::grpc_impl::internal::RpcMethodHandler; template friend class ::grpc_impl::internal::CallbackUnaryHandler; template From 4dfa808e75fbf0fd94a9787c596bedaabb684215 Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Fri, 23 Aug 2019 17:12:41 -0700 Subject: [PATCH 486/661] Add test for timer expiry racing with cancelation --- test/cpp/common/timer_test.cc | 71 +++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 11 deletions(-) diff --git a/test/cpp/common/timer_test.cc b/test/cpp/common/timer_test.cc index 9b23be2885a..1abed1660e8 100644 --- a/test/cpp/common/timer_test.cc +++ b/test/cpp/common/timer_test.cc @@ -77,7 +77,7 @@ TEST_F(TimerTest, OneTimerExpires) { grpc_core::ExecCtx exec_ctx; grpc_timer timer; int timer_fired = 0; - grpc_timer_init(&timer, 500, + grpc_timer_init(&timer, grpc_core::ExecCtx::Get()->Now() + 500, GRPC_CLOSURE_CREATE( [](void* arg, grpc_error*) { int* timer_fired = static_cast(arg); @@ -102,7 +102,7 @@ TEST_F(TimerTest, MultipleTimersExpire) { grpc_timer timers[kNumTimers]; int timer_fired = 0; for (int i = 0; i < kNumTimers; ++i) { - grpc_timer_init(&timers[i], 500 + i, + grpc_timer_init(&timers[i], grpc_core::ExecCtx::Get()->Now() + 500 + i, GRPC_CLOSURE_CREATE( [](void* arg, grpc_error*) { int* timer_fired = static_cast(arg); @@ -129,7 +129,7 @@ TEST_F(TimerTest, CancelSomeTimers) { grpc_timer timers[kNumTimers]; int timer_fired = 0; for (int i = 0; i < kNumTimers; ++i) { - grpc_timer_init(&timers[i], 500 + i, + grpc_timer_init(&timers[i], grpc_core::ExecCtx::Get()->Now() + 500 + i, GRPC_CLOSURE_CREATE( [](void* arg, grpc_error* error) { if (error == GRPC_ERROR_CANCELLED) { @@ -157,17 +157,66 @@ TEST_F(TimerTest, CancelSomeTimers) { // Enable the following test after // https://github.com/grpc/grpc/issues/20049 has been fixed. -#if 0 -TEST_F(TimerTest, TimerNotCanceled) { +TEST_F(TimerTest, DISABLED_TimerNotCanceled) { grpc_core::ExecCtx exec_ctx; grpc_timer timer; - grpc_timer_init(&timer, 10000, - GRPC_CLOSURE_CREATE( - [](void*, grpc_error*) { - }, - nullptr, grpc_schedule_on_exec_ctx)); + grpc_timer_init(&timer, grpc_core::ExecCtx::Get()->Now() + 10000, + GRPC_CLOSURE_CREATE([](void*, grpc_error*) {}, nullptr, + grpc_schedule_on_exec_ctx)); +} + +// Enable the following test after +// https://github.com/grpc/grpc/issues/20064 has been fixed. +TEST_F(TimerTest, DISABLED_CancelRace) { + MAYBE_SKIP_TEST; + grpc_core::ExecCtx exec_ctx; + const int kNumTimers = 10; + grpc_timer timers[kNumTimers]; + for (int i = 0; i < kNumTimers; ++i) { + grpc_timer* arg = (i != 0) ? &timers[i - 1] : nullptr; + grpc_timer_init(&timers[i], grpc_core::ExecCtx::Get()->Now() + 100, + GRPC_CLOSURE_CREATE( + [](void* arg, grpc_error* error) { + grpc_timer* timer = static_cast(arg); + if (timer) { + grpc_timer_cancel(timer); + } + }, + arg, grpc_schedule_on_exec_ctx)); + } + gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); +} + +// Enable the following test after +// https://github.com/grpc/grpc/issues/20066 has been fixed. +TEST_F(TimerTest, DISABLED_CancelNextTimer) { + MAYBE_SKIP_TEST; + grpc_core::ExecCtx exec_ctx; + const int kNumTimers = 10; + grpc_timer timers[kNumTimers]; + + for (int i = 0; i < kNumTimers; ++i) { + grpc_timer_init_unset(&timers[i]); + } + + for (int i = 0; i < kNumTimers; ++i) { + grpc_timer* arg = nullptr; + if (i < kNumTimers - 1) { + arg = &timers[i + 1]; + } + grpc_timer_init(&timers[i], grpc_core::ExecCtx::Get()->Now() + 100, + GRPC_CLOSURE_CREATE( + [](void* arg, grpc_error* error) { + grpc_timer* timer = static_cast(arg); + if (timer) { + grpc_timer_cancel(timer); + } + }, + arg, grpc_schedule_on_exec_ctx)); + } + grpc_timer_cancel(&timers[0]); + gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); } -#endif int main(int argc, char** argv) { grpc::testing::TestEnvironment env(argc, argv); From 156a4cccdfe88580c6fb1b87a6a247e222b0fd3a Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Wed, 28 Aug 2019 18:00:38 -0700 Subject: [PATCH 487/661] Remove unusued arg --- src/core/lib/surface/call.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 1331e57ab0c..7bb818b91c9 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -1128,8 +1128,7 @@ static size_t batch_slot_for_op(grpc_op_type type) { } static batch_control* reuse_or_allocate_batch_control(grpc_call* call, - const grpc_op* ops, - size_t num_ops) { + const grpc_op* ops) { size_t slot_idx = batch_slot_for_op(ops[0].op); batch_control** pslot = &call->active_batches[slot_idx]; batch_control* bctl; @@ -1545,7 +1544,7 @@ static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops, goto done; } - bctl = reuse_or_allocate_batch_control(call, ops, nops); + bctl = reuse_or_allocate_batch_control(call, ops); if (bctl == nullptr) { return GRPC_CALL_ERROR_TOO_MANY_OPERATIONS; } From d34f3663379f7e010e985860b27d9f12ba702f32 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Wed, 28 Aug 2019 21:46:53 -0700 Subject: [PATCH 488/661] Test message size of 100MB --- test/core/util/test_config.cc | 4 +++ test/core/util/test_config.h | 3 ++ test/cpp/end2end/async_end2end_test.cc | 38 ++++++++++++++++++++++---- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/test/core/util/test_config.cc b/test/core/util/test_config.cc index 5b248a01daa..5033dc7b66a 100644 --- a/test/core/util/test_config.cc +++ b/test/core/util/test_config.cc @@ -342,6 +342,10 @@ bool BuiltUnderUbsan() { #endif } +bool grpc_test_built_under_tsan_or_msan() { + return BuiltUnderTsan() || BuiltUnderMsan(); +}; + int64_t grpc_test_sanitizer_slowdown_factor() { int64_t sanitizer_multiplier = 1; if (BuiltUnderValgrind()) { diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h index 112af3176f9..905d61f1dd6 100644 --- a/test/core/util/test_config.h +++ b/test/core/util/test_config.h @@ -24,6 +24,9 @@ extern int64_t g_fixture_slowdown_factor; extern int64_t g_poller_slowdown_factor; +/* Returns if the test is built under TSAN or MSAN. */ +bool grpc_test_built_under_tsan_or_msan(); + /* Returns an appropriate scaling factor for timeouts. */ int64_t grpc_test_slowdown_factor(); diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 6ca0edf123e..879f16815ee 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -34,6 +34,7 @@ #include "src/core/ext/filters/client_channel/backup_poller.h" #include "src/core/lib/gpr/tls.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/port.h" #include "src/proto/grpc/health/v1/health.grpc.pb.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" @@ -59,6 +60,18 @@ namespace testing { namespace { +const size_t MAX_TEST_MESSAGE_SIZE = +#if defined(GPR_APPLE) + // The test will time out with macos build. + GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH; +#else + // Don't test extreme size under tsan or msan, because it uses too much + // memory. + grpc_test_built_under_tsan_or_msan() + ? GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH + : GPR_MAX(100 * 1024 * 1024, GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH); +#endif + void* tag(int i) { return (void*)static_cast(i); } int detag(void* p) { return static_cast(reinterpret_cast(p)); } @@ -218,6 +231,17 @@ class ServerBuilderSyncPluginDisabler : public ::grpc::ServerBuilderOption { } }; +class ServerBuilderMaxRecvMessageSizeOption + : public ::grpc::ServerBuilderOption { + public: + void UpdateArguments(ChannelArguments* arg) override { + arg->SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, -1); + } + + void UpdatePlugins( + std::vector>* plugins) override {} +}; + class TestScenario { public: TestScenario(bool inproc_stub, const grpc::string& creds_type, bool hcs, @@ -290,6 +314,9 @@ class AsyncEnd2endTest : public ::testing::TestWithParam { std::unique_ptr sync_plugin_disabler( new ServerBuilderSyncPluginDisabler()); builder.SetOption(move(sync_plugin_disabler)); + std::unique_ptr max_recv_option( + new ServerBuilderMaxRecvMessageSizeOption()); + builder.SetOption(move(max_recv_option)); server_ = builder.BuildAndStart(); } @@ -297,6 +324,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam { ChannelArguments args; auto channel_creds = GetCredentialsProvider()->GetChannelCredentials( GetParam().credentials_type, &args); + args.SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, -1); std::shared_ptr channel = !(GetParam().inproc) ? ::grpc::CreateCustomChannel( server_address_.str(), channel_creds, args) @@ -1822,7 +1850,7 @@ TEST_P(AsyncEnd2endServerTryCancelTest, ServerBidiStreamingTryCancelAfter) { } std::vector CreateTestScenarios(bool test_secure, - bool test_message_size_limit) { + bool test_big_message) { std::vector scenarios; std::vector credentials_types; std::vector messages; @@ -1844,9 +1872,8 @@ std::vector CreateTestScenarios(bool test_secure, GPR_ASSERT(!credentials_types.empty()); messages.push_back("Hello"); - if (test_message_size_limit) { - for (size_t k = 1; k < GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH / 1024; - k *= 32) { + if (test_big_message) { + for (size_t k = 1; k < MAX_TEST_MESSAGE_SIZE / 1024; k *= 32) { grpc::string big_msg; for (size_t i = 0; i < k * 1024; ++i) { char c = 'a' + (i % 26); @@ -1854,8 +1881,7 @@ std::vector CreateTestScenarios(bool test_secure, } messages.push_back(big_msg); } - messages.push_back( - grpc::string(GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH - 10, 'a')); + messages.push_back(grpc::string(MAX_TEST_MESSAGE_SIZE - 10, 'a')); } // TODO (sreek) Renable tests with health check service after the issue From f113001d14410814777a7475867132107c7c77d6 Mon Sep 17 00:00:00 2001 From: Pavel Koshelev Date: Thu, 29 Aug 2019 11:49:47 +0300 Subject: [PATCH 489/661] Enable bitcode for ios native libraries --- src/csharp/experimental/build_native_ext_for_ios.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csharp/experimental/build_native_ext_for_ios.sh b/src/csharp/experimental/build_native_ext_for_ios.sh index 130f4c51e96..876588daa06 100755 --- a/src/csharp/experimental/build_native_ext_for_ios.sh +++ b/src/csharp/experimental/build_native_ext_for_ios.sh @@ -28,7 +28,7 @@ function build { PATH_CC="$(xcrun --sdk $SDK --find clang)" PATH_CXX="$(xcrun --sdk $SDK --find clang++)" - CPPFLAGS="-O2 -Wframe-larger-than=16384 -arch $ARCH -isysroot $(xcrun --sdk $SDK --show-sdk-path) -mios-version-min=6.0 -DPB_NO_PACKED_STRUCTS=1" + CPPFLAGS="-O2 -Wframe-larger-than=16384 -arch $ARCH -isysroot $(xcrun --sdk $SDK --show-sdk-path) -fembed-bitcode -mios-version-min=6.0 -DPB_NO_PACKED_STRUCTS=1" LDFLAGS="-arch $ARCH -isysroot $(xcrun --sdk $SDK --show-sdk-path) -Wl,ios_version_min=6.0" # TODO(jtattermusch): revisit the build arguments From cb6d3a0623bd19510610c07f7d114b33dc603793 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 29 Aug 2019 14:52:19 +0200 Subject: [PATCH 490/661] address review feedback --- src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs | 2 +- src/csharp/ext/grpc_csharp_ext.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs index 77c14f1d9fb..9cbdce1cfe3 100644 --- a/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/SliceBufferSafeHandle.cs @@ -138,7 +138,7 @@ namespace Grpc.Core.Internal // if no hint is provided, keep the available space within some "reasonable" boundaries. // This is quite a naive approach which could use some fine-tuning, but currently in most case we know // the required buffer size in advance anyway, so this approach seems good enough for now. - if (tailSpaceLen < DefaultTailSpaceSize /2 ) + if (tailSpaceLen < DefaultTailSpaceSize / 2) { AdjustTailSpace(DefaultTailSpaceSize); } diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 2360c9e1d5f..d9bf85e02c7 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -44,8 +44,7 @@ static grpc_byte_buffer* grpcsharp_create_byte_buffer_from_stolen_slices( grpc_slice_buffer* slice_buffer) { grpc_byte_buffer* bb = - (grpc_byte_buffer*)gpr_malloc(sizeof(grpc_byte_buffer)); - memset(bb, 0, sizeof(grpc_byte_buffer)); + (grpc_byte_buffer*)gpr_zalloc(sizeof(grpc_byte_buffer)); bb->type = GRPC_BB_RAW; bb->data.raw.compression = GRPC_COMPRESS_NONE; grpc_slice_buffer_init(&bb->data.raw.slice_buffer); From 7357f63c09096f4dcff953ff87a5cc59e2a726c9 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 29 Aug 2019 10:39:04 -0400 Subject: [PATCH 491/661] update check_submodules.sh and grpc_deps.bzl --- bazel/grpc_deps.bzl | 6 +++--- tools/run_tests/sanity/check_submodules.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index b226f15aa2a..7bee7547b61 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -157,9 +157,9 @@ def grpc_deps(): if "com_github_google_benchmark" not in native.existing_rules(): http_archive( name = "com_github_google_benchmark", - sha256 = "c7682e9007ddfd94072647abab3e89ffd9084089460ae47d67060974467b58bf", - strip_prefix = "benchmark-e776aa0275e293707b6a0901e0e8d8a8a3679508", - url = "https://github.com/google/benchmark/archive/e776aa0275e293707b6a0901e0e8d8a8a3679508.tar.gz", + sha256 = "f68aec93154d010324c05bcd8c5cc53468b87af88d87acb5ddcfaa1bba044837", + strip_prefix = "benchmark-090faecb454fbd6e6e17a75ef8146acb037118d4", + url = "https://github.com/google/benchmark/archive/090faecb454fbd6e6e17a75ef8146acb037118d4.tar.gz", ) if "com_github_cares_cares" not in native.existing_rules(): diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index d5eb6677796..98c1a1ecb5c 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -27,7 +27,7 @@ want_submodules=$(mktemp /tmp/submXXXXXX) git submodule | awk '{ print $1 }' | sort > "$submodules" cat << EOF | awk '{ print $1 }' | sort > "$want_submodules" 74d91756c11bc22f9b0108b94da9326f7f9e376f third_party/abseil-cpp (74d9175) - e776aa0275e293707b6a0901e0e8d8a8a3679508 third_party/benchmark (v1.2.0) + 090faecb454fbd6e6e17a75ef8146acb037118d4 third_party/benchmark (v1.5.0) 73594cde8c9a52a102c4341c244c833aa61b9c06 third_party/bloaty (remotes/origin/wide-14-g73594cd) b29b21a81b32ec273f118f589f46d56ad3332420 third_party/boringssl (remotes/origin/chromium-stable) afc30d43eef92979b05776ec0963c9cede5fb80f third_party/boringssl-with-bazel (fips-20180716-116-gafc30d43e) From 0ee7a3ae9321a7af2151070feef6bf11be2a9890 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 29 Aug 2019 10:40:22 -0400 Subject: [PATCH 492/661] regenerate projects --- Makefile | 3 +++ grpc.gyp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Makefile b/Makefile index a0692f38d20..afeda543c40 100644 --- a/Makefile +++ b/Makefile @@ -7954,8 +7954,11 @@ endif LIBBENCHMARK_SRC = \ third_party/benchmark/src/benchmark.cc \ + third_party/benchmark/src/benchmark_api_internal.cc \ third_party/benchmark/src/benchmark_main.cc \ + third_party/benchmark/src/benchmark_name.cc \ third_party/benchmark/src/benchmark_register.cc \ + third_party/benchmark/src/benchmark_runner.cc \ third_party/benchmark/src/colorprint.cc \ third_party/benchmark/src/commandlineflags.cc \ third_party/benchmark/src/complexity.cc \ diff --git a/grpc.gyp b/grpc.gyp index ba847d99548..aef5f61fb2a 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -2241,8 +2241,11 @@ ], 'sources': [ 'third_party/benchmark/src/benchmark.cc', + 'third_party/benchmark/src/benchmark_api_internal.cc', 'third_party/benchmark/src/benchmark_main.cc', + 'third_party/benchmark/src/benchmark_name.cc', 'third_party/benchmark/src/benchmark_register.cc', + 'third_party/benchmark/src/benchmark_runner.cc', 'third_party/benchmark/src/colorprint.cc', 'third_party/benchmark/src/commandlineflags.cc', 'third_party/benchmark/src/complexity.cc', From 24c562dbaa95539031c45ab4bdce5070ca6c2af5 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 29 Aug 2019 10:47:44 -0700 Subject: [PATCH 493/661] Revert "Merge pull request #20097 from gnossen/dual_version_python_tests" This reverts commit c9c847f334d9310f01456c5f69ec983cfcb99496, reversing changes made to 07ba4de3927dbb2c71b92b4ca38b2fcd1b52e306. --- BUILD | 2 +- bazel/grpc_build_system.bzl | 11 +- bazel/grpc_deps.bzl | 15 ++- bazel/grpc_python_deps.bzl | 9 -- bazel/python_rules.bzl | 26 ----- examples/python/auth/BUILD.bazel | 3 - examples/python/cancellation/BUILD.bazel | 3 - examples/python/compression/BUILD.bazel | 3 - examples/python/debug/BUILD.bazel | 3 - examples/python/errors/BUILD.bazel | 1 - examples/python/multiprocessing/BUILD | 3 - examples/python/wait_for_ready/BUILD.bazel | 1 - .../grpcio_tests/tests/channelz/BUILD.bazel | 4 +- .../tests/health_check/BUILD.bazel | 3 +- .../grpcio_tests/tests/interop/BUILD.bazel | 5 +- .../grpcio_tests/tests/reflection/BUILD.bazel | 3 +- .../grpcio_tests/tests/status/BUILD.bazel | 3 +- .../grpcio_tests/tests/unit/BUILD.bazel | 4 +- .../tests/unit/_cython/BUILD.bazel | 3 +- .../unit/framework/foundation/BUILD.bazel | 3 +- templates/tools/dockerfile/bazel.include | 2 +- third_party/py/BUILD.tpl | 49 ++++----- third_party/py/python_configure.bzl | 104 +++++++----------- third_party/py/remote.BUILD.tpl | 10 ++ third_party/py/variety.tpl | 26 ----- tools/bazel | 2 +- tools/bazel.rc | 4 + tools/dockerfile/test/bazel/Dockerfile | 2 +- tools/dockerfile/test/sanity/Dockerfile | 2 +- .../linux/grpc_python_bazel_test_in_docker.sh | 3 + tools/remote_build/kokoro.bazelrc | 7 +- tools/remote_build/manual.bazelrc | 7 +- tools/remote_build/rbe_common.bazelrc | 2 +- 33 files changed, 114 insertions(+), 214 deletions(-) create mode 100644 third_party/py/remote.BUILD.tpl delete mode 100644 third_party/py/variety.tpl diff --git a/BUILD b/BUILD index e489bc2584a..9198dd61282 100644 --- a/BUILD +++ b/BUILD @@ -65,7 +65,7 @@ config_setting( config_setting( name = "python3", - flag_values = {"@bazel_tools//tools/python:python_version": "PY3"}, + values = {"python_path": "python3"}, ) config_setting( diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index f4777e50bc1..f386b87b583 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -269,22 +269,13 @@ def grpc_sh_binary(name, srcs, data = []): data = data, ) -def grpc_py_binary(name, - srcs, - data = [], - deps = [], - external_deps = [], - testonly = False, - python_version = "PY2", - **kwargs): +def grpc_py_binary(name, srcs, data = [], deps = [], external_deps = [], testonly = False): native.py_binary( name = name, srcs = srcs, testonly = testonly, data = data, deps = deps + _get_external_deps(external_deps), - python_version = python_version, - **kwargs ) def grpc_package(name, visibility = "private", features = []): diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 6bbb960b6c3..06323ff3f24 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -176,11 +176,11 @@ def grpc_deps(): if "bazel_toolchains" not in native.existing_rules(): http_archive( name = "bazel_toolchains", - sha256 = "872955b658113924eb1a3594b04d43238da47f4f90c17b76e8785709490dc041", - strip_prefix = "bazel-toolchains-1083686fde6032378d52b4c98044922cebde364e", + sha256 = "d968b414b32aa99c86977e1171645d31da2b52ac88060de3ac1e49932d5dcbf1", + strip_prefix = "bazel-toolchains-4bd5df80d77aa7f4fb943dfdfad5c9056a62fb47", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/1083686fde6032378d52b4c98044922cebde364e.tar.gz", - "https://github.com/bazelbuild/bazel-toolchains/archive/1083686fde6032378d52b4c98044922cebde364e.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/4bd5df80d77aa7f4fb943dfdfad5c9056a62fb47.tar.gz", + "https://github.com/bazelbuild/bazel-toolchains/archive/4bd5df80d77aa7f4fb943dfdfad5c9056a62fb47.tar.gz", ], ) @@ -221,11 +221,10 @@ def grpc_deps(): ) if "build_bazel_rules_apple" not in native.existing_rules(): - http_archive( + git_repository( name = "build_bazel_rules_apple", - url = "https://github.com/bazelbuild/rules_apple/archive/b869b0d3868d78a1d4ffd866ccb304fb68aa12c3.tar.gz", - strip_prefix = "rules_apple-b869b0d3868d78a1d4ffd866ccb304fb68aa12c3", - sha256 = "bdc8e66e70b8a75da23b79f1f8c6207356df07d041d96d2189add7ee0780cf4e", + remote = "https://github.com/bazelbuild/rules_apple.git", + tag = "0.17.2", ) grpc_python_deps() diff --git a/bazel/grpc_python_deps.bzl b/bazel/grpc_python_deps.bzl index 2a439bdf226..4e7cc1537fa 100644 --- a/bazel/grpc_python_deps.bzl +++ b/bazel/grpc_python_deps.bzl @@ -47,15 +47,6 @@ def grpc_python_deps(): remote = "https://github.com/bazelbuild/rules_python.git", ) - - if "rules_python" not in native.existing_rules(): - http_archive( - name = "rules_python", - url = "https://github.com/bazelbuild/rules_python/archive/9d68f24659e8ce8b736590ba1e4418af06ec2552.zip", - sha256 = "f7402f11691d657161f871e11968a984e5b48b023321935f5a55d7e56cf4758a", - strip_prefix = "rules_python-9d68f24659e8ce8b736590ba1e4418af06ec2552", - ) - python_configure(name = "local_config_python") native.bind( diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl index e7e9e597b05..12f51f8b172 100644 --- a/bazel/python_rules.bzl +++ b/bazel/python_rules.bzl @@ -178,29 +178,3 @@ def py_grpc_library( deps = [Label("//src/python/grpcio/grpc:grpcio")] + deps, **kwargs ) - - -def py2and3_test(name, - py_test = native.py_test, - **kwargs): - if "python_version" in kwargs: - fail("Cannot specify 'python_version' in py2and3_test.") - - names = [name + suffix for suffix in (".python2", ".python3")] - python_versions = ["PY2", "PY3"] - for case_name, python_version in zip(names, python_versions): - py_test( - name = case_name, - python_version = python_version, - **kwargs - ) - - suite_kwargs = {} - if "visibility" in kwargs: - suite_kwargs["visibility"] = kwargs["visibility"] - - native.test_suite( - name = name, - tests = names, - **suite_kwargs - ) diff --git a/examples/python/auth/BUILD.bazel b/examples/python/auth/BUILD.bazel index 72620ee46c5..cc454fdfdfe 100644 --- a/examples/python/auth/BUILD.bazel +++ b/examples/python/auth/BUILD.bazel @@ -39,7 +39,6 @@ py_binary( "//examples:helloworld_py_pb2", "//examples:helloworld_py_pb2_grpc", ], - python_version = "PY3", ) py_binary( @@ -52,7 +51,6 @@ py_binary( "//examples:helloworld_py_pb2", "//examples:helloworld_py_pb2_grpc", ], - python_version = "PY3", ) py_test( @@ -65,5 +63,4 @@ py_test( ":customized_auth_server", ":_credentials", ], - python_version = "PY3", ) diff --git a/examples/python/cancellation/BUILD.bazel b/examples/python/cancellation/BUILD.bazel index b4451f60711..17b1b20168e 100644 --- a/examples/python/cancellation/BUILD.bazel +++ b/examples/python/cancellation/BUILD.bazel @@ -45,7 +45,6 @@ py_binary( "//external:six" ], srcs_version = "PY2AND3", - python_version = "PY3", ) py_library( @@ -69,7 +68,6 @@ py_binary( "//:python3": [], }), srcs_version = "PY2AND3", - python_version = "PY3", ) py_test( @@ -80,5 +78,4 @@ py_test( ":server" ], size = "small", - python_version = "PY3", ) diff --git a/examples/python/compression/BUILD.bazel b/examples/python/compression/BUILD.bazel index 4141eda2ffd..9d5f6bb83ed 100644 --- a/examples/python/compression/BUILD.bazel +++ b/examples/python/compression/BUILD.bazel @@ -21,7 +21,6 @@ py_binary( "//examples:helloworld_py_pb2_grpc", ], srcs_version = "PY2AND3", - python_version = "PY3", ) py_binary( @@ -33,7 +32,6 @@ py_binary( "//examples:helloworld_py_pb2_grpc", ], srcs_version = "PY2AND3", - python_version = "PY3", ) py_test( @@ -45,5 +43,4 @@ py_test( ":server", ], size = "small", - python_version = "PY3", ) diff --git a/examples/python/debug/BUILD.bazel b/examples/python/debug/BUILD.bazel index 332991332f8..657ae860ae3 100644 --- a/examples/python/debug/BUILD.bazel +++ b/examples/python/debug/BUILD.bazel @@ -35,7 +35,6 @@ py_binary( "//examples:helloworld_py_pb2", "//examples:helloworld_py_pb2_grpc", ], - python_version = "PY3", ) py_binary( @@ -46,7 +45,6 @@ py_binary( "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_channelz/grpc_channelz/v1:grpc_channelz", ], - python_version = "PY3", ) py_test( @@ -61,5 +59,4 @@ py_test( ":send_message", ":get_stats", ], - python_version = "PY3", ) diff --git a/examples/python/errors/BUILD.bazel b/examples/python/errors/BUILD.bazel index 367bd81925f..4b779ddfcf1 100644 --- a/examples/python/errors/BUILD.bazel +++ b/examples/python/errors/BUILD.bazel @@ -55,5 +55,4 @@ py_test( "../../../src/python/grpcio_status", "../../../src/python/grpcio_tests", ], - python_version = "PY3", ) diff --git a/examples/python/multiprocessing/BUILD b/examples/python/multiprocessing/BUILD index 2503970bc80..490aea0c1e6 100644 --- a/examples/python/multiprocessing/BUILD +++ b/examples/python/multiprocessing/BUILD @@ -42,7 +42,6 @@ py_binary( ":prime_proto_pb2_grpc", ], srcs_version = "PY3", - python_version = "PY3", ) py_binary( @@ -58,7 +57,6 @@ py_binary( "//:python3": [], }), srcs_version = "PY3", - python_version = "PY3", ) py_test( @@ -69,5 +67,4 @@ py_test( ":server" ], size = "small", - python_version = "PY3", ) diff --git a/examples/python/wait_for_ready/BUILD.bazel b/examples/python/wait_for_ready/BUILD.bazel index 9cbddd1a6e3..f074ae7bb7f 100644 --- a/examples/python/wait_for_ready/BUILD.bazel +++ b/examples/python/wait_for_ready/BUILD.bazel @@ -30,5 +30,4 @@ py_test( srcs = ["test/_wait_for_ready_example_test.py"], deps = [":wait_for_ready_example",], size = "small", - python_version = "PY3", ) diff --git a/src/python/grpcio_tests/tests/channelz/BUILD.bazel b/src/python/grpcio_tests/tests/channelz/BUILD.bazel index f4d246847f7..63513616e77 100644 --- a/src/python/grpcio_tests/tests/channelz/BUILD.bazel +++ b/src/python/grpcio_tests/tests/channelz/BUILD.bazel @@ -1,8 +1,6 @@ package(default_visibility = ["//visibility:public"]) -load("//bazel:python_rules.bzl", "py2and3_test") - -py2and3_test( +py_test( name = "channelz_servicer_test", srcs = ["_channelz_servicer_test.py"], main = "_channelz_servicer_test.py", diff --git a/src/python/grpcio_tests/tests/health_check/BUILD.bazel b/src/python/grpcio_tests/tests/health_check/BUILD.bazel index 797b6a48e91..49f076be9a1 100644 --- a/src/python/grpcio_tests/tests/health_check/BUILD.bazel +++ b/src/python/grpcio_tests/tests/health_check/BUILD.bazel @@ -1,7 +1,6 @@ package(default_visibility = ["//visibility:public"]) -load("//bazel:python_rules.bzl", "py2and3_test") -py2and3_test( +py_test( name = "health_servicer_test", srcs = ["_health_servicer_test.py"], main = "_health_servicer_test.py", diff --git a/src/python/grpcio_tests/tests/interop/BUILD.bazel b/src/python/grpcio_tests/tests/interop/BUILD.bazel index 4685852162b..8ac3f7d52d5 100644 --- a/src/python/grpcio_tests/tests/interop/BUILD.bazel +++ b/src/python/grpcio_tests/tests/interop/BUILD.bazel @@ -1,5 +1,4 @@ load("@grpc_python_dependencies//:requirements.bzl", "requirement") -load("//bazel:python_rules.bzl", "py2and3_test") package(default_visibility = ["//visibility:public"]) @@ -81,7 +80,7 @@ py_library( ], ) -py2and3_test( +py_test( name = "_insecure_intraop_test", size = "small", srcs = ["_insecure_intraop_test.py"], @@ -100,7 +99,7 @@ py2and3_test( ], ) -py2and3_test( +py_test( name = "_secure_intraop_test", size = "small", srcs = ["_secure_intraop_test.py"], diff --git a/src/python/grpcio_tests/tests/reflection/BUILD.bazel b/src/python/grpcio_tests/tests/reflection/BUILD.bazel index 65a08c2a435..e9b56191df8 100644 --- a/src/python/grpcio_tests/tests/reflection/BUILD.bazel +++ b/src/python/grpcio_tests/tests/reflection/BUILD.bazel @@ -1,9 +1,8 @@ load("@grpc_python_dependencies//:requirements.bzl", "requirement") -load("//bazel:python_rules.bzl", "py2and3_test") package(default_visibility = ["//visibility:public"]) -py2and3_test( +py_test( name="_reflection_servicer_test", size="small", timeout="moderate", diff --git a/src/python/grpcio_tests/tests/status/BUILD.bazel b/src/python/grpcio_tests/tests/status/BUILD.bazel index 0868de01acf..b163fe3975e 100644 --- a/src/python/grpcio_tests/tests/status/BUILD.bazel +++ b/src/python/grpcio_tests/tests/status/BUILD.bazel @@ -1,9 +1,8 @@ load("@grpc_python_dependencies//:requirements.bzl", "requirement") -load("//bazel:python_rules.bzl", "py2and3_test") package(default_visibility = ["//visibility:public"]) -py2and3_test( +py_test( name = "grpc_status_test", srcs = ["_grpc_status_test.py"], main = "_grpc_status_test.py", diff --git a/src/python/grpcio_tests/tests/unit/BUILD.bazel b/src/python/grpcio_tests/tests/unit/BUILD.bazel index 587d8cb246f..49203b7fa16 100644 --- a/src/python/grpcio_tests/tests/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/BUILD.bazel @@ -1,5 +1,3 @@ -load("//bazel:python_rules.bzl", "py2and3_test") - package(default_visibility = ["//visibility:public"]) GRPCIO_TESTS_UNIT = [ @@ -82,7 +80,7 @@ py_library( ) [ - py2and3_test( + py_test( name=test_file_name[:-3], size="small", srcs=[test_file_name], diff --git a/src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel b/src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel index 867649a6a50..458a6b1fb8a 100644 --- a/src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel @@ -1,5 +1,4 @@ load("@grpc_python_dependencies//:requirements.bzl", "requirement") -load("//bazel:python_rules.bzl", "py2and3_test") package(default_visibility = ["//visibility:public"]) @@ -24,7 +23,7 @@ py_library( ) [ - py2and3_test( + py_test( name=test_file_name[:-3], size="small", srcs=[test_file_name], diff --git a/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel b/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel index a93249301c4..d69186e1fde 100644 --- a/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel @@ -1,12 +1,11 @@ package(default_visibility = ["//visibility:public"]) -load("//bazel:python_rules.bzl", "py2and3_test") py_library( name = "stream_testing", srcs = ["stream_testing.py"], ) -py2and3_test( +py_test( name = "logging_pool_test", srcs = ["_logging_pool_test.py"], main = "_logging_pool_test.py", diff --git a/templates/tools/dockerfile/bazel.include b/templates/tools/dockerfile/bazel.include index 12a22785623..adde6ed4787 100644 --- a/templates/tools/dockerfile/bazel.include +++ b/templates/tools/dockerfile/bazel.include @@ -2,7 +2,7 @@ # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.28.1 +ENV BAZEL_VERSION 0.26.0 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/third_party/py/BUILD.tpl b/third_party/py/BUILD.tpl index 8f010f85a03..2283c573bc3 100644 --- a/third_party/py/BUILD.tpl +++ b/third_party/py/BUILD.tpl @@ -2,36 +2,35 @@ package(default_visibility=["//visibility:public"]) -config_setting( - name="windows", - values={"cpu": "x64_windows"}, - visibility=["//visibility:public"], +# To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib +# See https://docs.python.org/3/extending/windows.html +cc_import( + name="python_lib", + interface_library=select({ + ":windows": ":python_import_lib", + # A placeholder for Unix platforms which makes --no_build happy. + "//conditions:default": "not-existing.lib", + }), + system_provided=1, ) -config_setting( - name="python2", - flag_values = {"@rules_python//python:python_version": "PY2"} +cc_library( + name="python_headers", + hdrs=[":python_include"], + deps=select({ + ":windows": [":python_lib"], + "//conditions:default": [], + }), + includes=["python_include"], ) config_setting( - name="python3", - flag_values = {"@rules_python//python:python_version": "PY3"} + name="windows", + values={"cpu": "x64_windows"}, + visibility=["//visibility:public"], ) -cc_library( - name = "python_lib", - deps = select({ - ":python2": ["//_python2:_python2_lib"], - ":python3": ["//_python3:_python3_lib"], - "//conditions:default": ["not-existing.lib"], - }) -) +%{PYTHON_INCLUDE_GENRULE} +%{PYTHON_IMPORT_LIB_GENRULE} + -cc_library( - name = "python_headers", - deps = select({ - ":python2": ["//_python2:_python2_headers"], - ":python3": ["//_python3:_python3_headers"], - "//conditions:default": ["not-existing.headers"], - }) -) diff --git a/third_party/py/python_configure.bzl b/third_party/py/python_configure.bzl index 6f9a178a057..e6fa5ed10e9 100644 --- a/third_party/py/python_configure.bzl +++ b/third_party/py/python_configure.bzl @@ -3,15 +3,14 @@ `python_configure` depends on the following environment variables: - * `PYTHON2_BIN_PATH`: location of python binary. - * `PYTHON2_LIB_PATH`: Location of python libraries. + * `PYTHON_BIN_PATH`: location of python binary. + * `PYTHON_LIB_PATH`: Location of python libraries. """ _BAZEL_SH = "BAZEL_SH" -_PYTHON2_BIN_PATH = "PYTHON2_BIN_PATH" -_PYTHON2_LIB_PATH = "PYTHON2_LIB_PATH" -_PYTHON3_BIN_PATH = "PYTHON3_BIN_PATH" -_PYTHON3_LIB_PATH = "PYTHON3_LIB_PATH" +_PYTHON_BIN_PATH = "PYTHON_BIN_PATH" +_PYTHON_LIB_PATH = "PYTHON_LIB_PATH" +_PYTHON_CONFIG_REPO = "PYTHON_CONFIG_REPO" def _tpl(repository_ctx, tpl, substitutions={}, out=None): @@ -137,9 +136,9 @@ def _symlink_genrule_for_dir(repository_ctx, "\n".join(outs)) -def _get_python_bin(repository_ctx, bin_path_key, default_bin_path): +def _get_python_bin(repository_ctx): """Gets the python bin path.""" - python_bin = repository_ctx.os.environ.get(bin_path_key, default_bin_path) + python_bin = repository_ctx.os.environ.get(_PYTHON_BIN_PATH, 'python') if not repository_ctx.path(python_bin).exists: # It's a command, use 'which' to find its path. python_bin_path = repository_ctx.which(python_bin) @@ -151,7 +150,7 @@ def _get_python_bin(repository_ctx, bin_path_key, default_bin_path): _fail("Cannot find python in PATH, please make sure " + "python is installed and add its directory in PATH, or --define " + "%s='/something/else'.\nPATH=%s" % - (bin_path_key, repository_ctx.os.environ.get("PATH", ""))) + (_PYTHON_BIN_PATH, repository_ctx.os.environ.get("PATH", ""))) def _get_bash_bin(repository_ctx): @@ -171,9 +170,9 @@ def _get_bash_bin(repository_ctx): (_BAZEL_SH, repository_ctx.os.environ.get("PATH", ""))) -def _get_python_lib(repository_ctx, python_bin, lib_path_key): +def _get_python_lib(repository_ctx, python_bin): """Gets the python lib path.""" - python_lib = repository_ctx.os.environ.get(lib_path_key) + python_lib = repository_ctx.os.environ.get(_PYTHON_LIB_PATH) if python_lib != None: return python_lib print_lib = ( @@ -203,13 +202,13 @@ def _check_python_lib(repository_ctx, python_lib): _fail("Invalid python library path: %s" % python_lib) -def _check_python_bin(repository_ctx, python_bin, bin_path_key): +def _check_python_bin(repository_ctx, python_bin): """Checks the python bin path.""" cmd = '[[ -x "%s" ]] && [[ ! -d "%s" ]]' % (python_bin, python_bin) result = repository_ctx.execute([_get_bash_bin(repository_ctx), "-c", cmd]) if result.return_code == 1: _fail("--define %s='%s' is not executable. Is it the python binary?" % - (bin_path_key, python_bin)) + (_PYTHON_BIN_PATH, python_bin)) def _get_python_include(repository_ctx, python_bin): @@ -223,11 +222,11 @@ def _get_python_include(repository_ctx, python_bin): error_msg="Problem getting python include path.", error_details=( "Is the Python binary path set up right? " + "(See ./configure or " - + _PYTHON2_BIN_PATH + ".) " + "Is distutils installed?")) + + _PYTHON_BIN_PATH + ".) " + "Is distutils installed?")) return result.stdout.splitlines()[0] -def _get_python_import_lib_name(repository_ctx, python_bin, bin_path_key): +def _get_python_import_lib_name(repository_ctx, python_bin): """Get Python import library name (pythonXY.lib) on Windows.""" result = _execute( repository_ctx, [ @@ -237,85 +236,66 @@ def _get_python_import_lib_name(repository_ctx, python_bin, bin_path_key): ], error_msg="Problem getting python import library.", error_details=("Is the Python binary path set up right? " + - "(See ./configure or " + bin_path_key + ".) ")) + "(See ./configure or " + _PYTHON_BIN_PATH + ".) ")) return result.stdout.splitlines()[0] -def _create_single_version_package(repository_ctx, - variety_name, - bin_path_key, - default_bin_path, - lib_path_key): +def _create_local_python_repository(repository_ctx): """Creates the repository containing files set up to build with Python.""" - python_bin = _get_python_bin(repository_ctx, bin_path_key, default_bin_path) - _check_python_bin(repository_ctx, python_bin, bin_path_key) - python_lib = _get_python_lib(repository_ctx, python_bin, lib_path_key) + python_bin = _get_python_bin(repository_ctx) + _check_python_bin(repository_ctx, python_bin) + python_lib = _get_python_lib(repository_ctx, python_bin) _check_python_lib(repository_ctx, python_lib) python_include = _get_python_include(repository_ctx, python_bin) python_include_rule = _symlink_genrule_for_dir( - repository_ctx, python_include, '{}_include'.format(variety_name), - '{}_include'.format(variety_name)) + repository_ctx, python_include, 'python_include', 'python_include') python_import_lib_genrule = "" # To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib # See https://docs.python.org/3/extending/windows.html if _is_windows(repository_ctx): python_include = _normalize_path(python_include) - python_import_lib_name = _get_python_import_lib_name, bin_path_key( + python_import_lib_name = _get_python_import_lib_name( repository_ctx, python_bin) python_import_lib_src = python_include.rsplit( '/', 1)[0] + "/libs/" + python_import_lib_name python_import_lib_genrule = _symlink_genrule_for_dir( - repository_ctx, None, '', '{}_import_lib'.format(variety_name), + repository_ctx, None, '', 'python_import_lib', [python_import_lib_src], [python_import_lib_name]) _tpl( - repository_ctx, "variety", { + repository_ctx, "BUILD", { "%{PYTHON_INCLUDE_GENRULE}": python_include_rule, "%{PYTHON_IMPORT_LIB_GENRULE}": python_import_lib_genrule, - "%{VARIETY_NAME}": variety_name, - }, - out="{}/BUILD".format(variety_name)) + }) + + +def _create_remote_python_repository(repository_ctx, remote_config_repo): + """Creates pointers to a remotely configured repo set up to build with Python. + """ + _tpl(repository_ctx, "remote.BUILD", { + "%{REMOTE_PYTHON_REPO}": remote_config_repo, + }, "BUILD") def _python_autoconf_impl(repository_ctx): """Implementation of the python_autoconf repository rule.""" - _create_single_version_package(repository_ctx, - "_python2", - _PYTHON2_BIN_PATH, - "python", - _PYTHON2_LIB_PATH) - _create_single_version_package(repository_ctx, - "_python3", - _PYTHON3_BIN_PATH, - "python3", - _PYTHON3_LIB_PATH) - _tpl(repository_ctx, "BUILD") + if _PYTHON_CONFIG_REPO in repository_ctx.os.environ: + _create_remote_python_repository( + repository_ctx, repository_ctx.os.environ[_PYTHON_CONFIG_REPO]) + else: + _create_local_python_repository(repository_ctx) python_configure = repository_rule( - implementation = _python_autoconf_impl, - environ = [ + implementation=_python_autoconf_impl, + environ=[ _BAZEL_SH, - _PYTHON2_BIN_PATH, - _PYTHON2_LIB_PATH, - _PYTHON3_BIN_PATH, - _PYTHON3_LIB_PATH, + _PYTHON_BIN_PATH, + _PYTHON_LIB_PATH, + _PYTHON_CONFIG_REPO, ], - attrs={ - "_build_tpl": attr.label( - default = Label("//third_party/py:BUILD.tpl"), - allow_single_file = True, - ), - "_variety_tpl": attr.label( - default = Label("//third_party/py:variety.tpl"), - allow_single_file = True, - ), - }, ) """Detects and configures the local Python. -It is expected that the system have both a working Python 2 and python 3 -installation - Add the following to your WORKSPACE FILE: ```python diff --git a/third_party/py/remote.BUILD.tpl b/third_party/py/remote.BUILD.tpl new file mode 100644 index 00000000000..1bfe1f0bf65 --- /dev/null +++ b/third_party/py/remote.BUILD.tpl @@ -0,0 +1,10 @@ +# Adapted with modifications from tensorflow/third_party/py/ + +package(default_visibility=["//visibility:public"]) + +alias( + name="python_headers", + actual="%{REMOTE_PYTHON_REPO}:python_headers", +) + + diff --git a/third_party/py/variety.tpl b/third_party/py/variety.tpl deleted file mode 100644 index 0c466d6d8f0..00000000000 --- a/third_party/py/variety.tpl +++ /dev/null @@ -1,26 +0,0 @@ -package(default_visibility=["//visibility:public"]) - -# To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib -# See https://docs.python.org/3/extending/windows.html -cc_import( - name="%{VARIETY_NAME}_lib", - interface_library=select({ - "//:windows": ":%{VARIETY_NAME}_import_lib", - # A placeholder for Unix platforms which makes --no_build happy. - "//conditions:default": "not-existing.lib", - }), - system_provided=1, -) - -cc_library( - name="%{VARIETY_NAME}_headers", - hdrs=[":%{VARIETY_NAME}_include"], - deps=select({ - "//:windows": [":%{VARIETY_NAME}_lib"], - "//conditions:default": [], - }), - includes=["%{VARIETY_NAME}_include"], -) - -%{PYTHON_INCLUDE_GENRULE} -%{PYTHON_IMPORT_LIB_GENRULE} diff --git a/tools/bazel b/tools/bazel index 4d1d57f60d9..4f08d18c656 100755 --- a/tools/bazel +++ b/tools/bazel @@ -32,7 +32,7 @@ then exec -a "$0" "${BAZEL_REAL}" "$@" fi -VERSION=0.28.1 +VERSION=0.26.0 echo "INFO: Running bazel wrapper (see //tools/bazel for details), bazel version $VERSION will be used instead of system-wide bazel installation." diff --git a/tools/bazel.rc b/tools/bazel.rc index fcbe9337b9f..b24f603ddda 100644 --- a/tools/bazel.rc +++ b/tools/bazel.rc @@ -82,3 +82,7 @@ build:basicprof --copt=-DNDEBUG build:basicprof --copt=-O2 build:basicprof --copt=-DGRPC_BASIC_PROFILER build:basicprof --copt=-DGRPC_TIMERS_RDTSC + +build:python3 --python_path=python3 +build:python3 --python_version=PY3 +build:python3 --action_env=PYTHON_BIN_PATH=python3 diff --git a/tools/dockerfile/test/bazel/Dockerfile b/tools/dockerfile/test/bazel/Dockerfile index 7141fb9c5f1..7e7903359e7 100644 --- a/tools/dockerfile/test/bazel/Dockerfile +++ b/tools/dockerfile/test/bazel/Dockerfile @@ -52,7 +52,7 @@ RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 t # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.28.1 +ENV BAZEL_VERSION 0.26.0 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile index badff52de34..675378b305b 100644 --- a/tools/dockerfile/test/sanity/Dockerfile +++ b/tools/dockerfile/test/sanity/Dockerfile @@ -97,7 +97,7 @@ ENV CLANG_TIDY=clang-tidy # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.28.1 +ENV BAZEL_VERSION 0.26.0 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh index 4a48760aab1..f725eb7a3d7 100755 --- a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh +++ b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh @@ -26,6 +26,9 @@ ${name}') cd /var/local/git/grpc/test bazel test --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //src/python/... bazel test --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //examples/python/... +bazel clean --expunge +bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //src/python/... +bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //examples/python/... # TODO(https://github.com/grpc/grpc/issues/19854): Move this to a new Kokoro # job. diff --git a/tools/remote_build/kokoro.bazelrc b/tools/remote_build/kokoro.bazelrc index 5c1b061bce3..064e94b2e15 100644 --- a/tools/remote_build/kokoro.bazelrc +++ b/tools/remote_build/kokoro.bazelrc @@ -16,12 +16,13 @@ import %workspace%/tools/remote_build/rbe_common.bazelrc -build --remote_cache=grpcs://remotebuildexecution.googleapis.com -build --remote_executor=grpcs://remotebuildexecution.googleapis.com +build --remote_cache=remotebuildexecution.googleapis.com +build --remote_executor=remotebuildexecution.googleapis.com +build --tls_enabled=true build --auth_enabled=true -build --bes_backend=grpcs://buildeventservice.googleapis.com +build --bes_backend=buildeventservice.googleapis.com build --bes_timeout=600s build --project_id=grpc-testing diff --git a/tools/remote_build/manual.bazelrc b/tools/remote_build/manual.bazelrc index c3c6af42877..fcd41f57521 100644 --- a/tools/remote_build/manual.bazelrc +++ b/tools/remote_build/manual.bazelrc @@ -17,8 +17,9 @@ import %workspace%/tools/remote_build/rbe_common.bazelrc -build --remote_cache=grpcs://remotebuildexecution.googleapis.com -build --remote_executor=grpcs://remotebuildexecution.googleapis.com +build --remote_cache=remotebuildexecution.googleapis.com +build --remote_executor=remotebuildexecution.googleapis.com +build --tls_enabled=true # Enable authentication. This will pick up application default credentials by # default. You can use --auth_credentials=some_file.json to use a service @@ -29,7 +30,7 @@ build --auth_enabled=true # Set flags for uploading to BES in order to view results in the Bazel Build # Results UI. -build --bes_backend=grpcs://buildeventservice.googleapis.com +build --bes_backend="buildeventservice.googleapis.com" build --bes_timeout=60s build --bes_results_url="https://source.cloud.google.com/results/invocations/" build --project_id=grpc-testing diff --git a/tools/remote_build/rbe_common.bazelrc b/tools/remote_build/rbe_common.bazelrc index 6236003fe17..6baaf24732c 100644 --- a/tools/remote_build/rbe_common.bazelrc +++ b/tools/remote_build/rbe_common.bazelrc @@ -87,4 +87,4 @@ build:ubsan --test_timeout=3600 # how to update the bazel toolchain for ubsan: # - check for the latest released version in https://github.com/bazelbuild/bazel-toolchains/tree/master/configs/experimental/ubuntu16_04_clang # - you might need to update the bazel_toolchains dependency in grpc_deps.bzl -build:ubsan --crosstool_top=@bazel_toolchains//configs/experimental/ubuntu16_04_clang/1.2/bazel_0.28.0/ubsan:toolchain +build:ubsan --crosstool_top=@bazel_toolchains//configs/experimental/ubuntu16_04_clang/1.2/bazel_0.23.0/ubsan:toolchain From 1444cd1dd31c81daa63477be445a941722a42f5d Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 29 Aug 2019 10:51:36 -0700 Subject: [PATCH 494/661] Revert "Revert "Merge pull request #20097 from gnossen/dual_version_python_tests"" This reverts commit 24c562dbaa95539031c45ab4bdce5070ca6c2af5. --- BUILD | 2 +- bazel/grpc_build_system.bzl | 11 +- bazel/grpc_deps.bzl | 15 +-- bazel/grpc_python_deps.bzl | 9 ++ bazel/python_rules.bzl | 26 +++++ examples/python/auth/BUILD.bazel | 3 + examples/python/cancellation/BUILD.bazel | 3 + examples/python/compression/BUILD.bazel | 3 + examples/python/debug/BUILD.bazel | 3 + examples/python/errors/BUILD.bazel | 1 + examples/python/multiprocessing/BUILD | 3 + examples/python/wait_for_ready/BUILD.bazel | 1 + .../grpcio_tests/tests/channelz/BUILD.bazel | 4 +- .../tests/health_check/BUILD.bazel | 3 +- .../grpcio_tests/tests/interop/BUILD.bazel | 5 +- .../grpcio_tests/tests/reflection/BUILD.bazel | 3 +- .../grpcio_tests/tests/status/BUILD.bazel | 3 +- .../grpcio_tests/tests/unit/BUILD.bazel | 4 +- .../tests/unit/_cython/BUILD.bazel | 3 +- .../unit/framework/foundation/BUILD.bazel | 3 +- templates/tools/dockerfile/bazel.include | 2 +- third_party/py/BUILD.tpl | 49 +++++---- third_party/py/python_configure.bzl | 104 +++++++++++------- third_party/py/remote.BUILD.tpl | 10 -- third_party/py/variety.tpl | 26 +++++ tools/bazel | 2 +- tools/bazel.rc | 4 - tools/dockerfile/test/bazel/Dockerfile | 2 +- tools/dockerfile/test/sanity/Dockerfile | 2 +- .../linux/grpc_python_bazel_test_in_docker.sh | 3 - tools/remote_build/kokoro.bazelrc | 7 +- tools/remote_build/manual.bazelrc | 7 +- tools/remote_build/rbe_common.bazelrc | 2 +- 33 files changed, 214 insertions(+), 114 deletions(-) delete mode 100644 third_party/py/remote.BUILD.tpl create mode 100644 third_party/py/variety.tpl diff --git a/BUILD b/BUILD index 9198dd61282..e489bc2584a 100644 --- a/BUILD +++ b/BUILD @@ -65,7 +65,7 @@ config_setting( config_setting( name = "python3", - values = {"python_path": "python3"}, + flag_values = {"@bazel_tools//tools/python:python_version": "PY3"}, ) config_setting( diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index f386b87b583..f4777e50bc1 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -269,13 +269,22 @@ def grpc_sh_binary(name, srcs, data = []): data = data, ) -def grpc_py_binary(name, srcs, data = [], deps = [], external_deps = [], testonly = False): +def grpc_py_binary(name, + srcs, + data = [], + deps = [], + external_deps = [], + testonly = False, + python_version = "PY2", + **kwargs): native.py_binary( name = name, srcs = srcs, testonly = testonly, data = data, deps = deps + _get_external_deps(external_deps), + python_version = python_version, + **kwargs ) def grpc_package(name, visibility = "private", features = []): diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 06323ff3f24..6bbb960b6c3 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -176,11 +176,11 @@ def grpc_deps(): if "bazel_toolchains" not in native.existing_rules(): http_archive( name = "bazel_toolchains", - sha256 = "d968b414b32aa99c86977e1171645d31da2b52ac88060de3ac1e49932d5dcbf1", - strip_prefix = "bazel-toolchains-4bd5df80d77aa7f4fb943dfdfad5c9056a62fb47", + sha256 = "872955b658113924eb1a3594b04d43238da47f4f90c17b76e8785709490dc041", + strip_prefix = "bazel-toolchains-1083686fde6032378d52b4c98044922cebde364e", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/4bd5df80d77aa7f4fb943dfdfad5c9056a62fb47.tar.gz", - "https://github.com/bazelbuild/bazel-toolchains/archive/4bd5df80d77aa7f4fb943dfdfad5c9056a62fb47.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/1083686fde6032378d52b4c98044922cebde364e.tar.gz", + "https://github.com/bazelbuild/bazel-toolchains/archive/1083686fde6032378d52b4c98044922cebde364e.tar.gz", ], ) @@ -221,10 +221,11 @@ def grpc_deps(): ) if "build_bazel_rules_apple" not in native.existing_rules(): - git_repository( + http_archive( name = "build_bazel_rules_apple", - remote = "https://github.com/bazelbuild/rules_apple.git", - tag = "0.17.2", + url = "https://github.com/bazelbuild/rules_apple/archive/b869b0d3868d78a1d4ffd866ccb304fb68aa12c3.tar.gz", + strip_prefix = "rules_apple-b869b0d3868d78a1d4ffd866ccb304fb68aa12c3", + sha256 = "bdc8e66e70b8a75da23b79f1f8c6207356df07d041d96d2189add7ee0780cf4e", ) grpc_python_deps() diff --git a/bazel/grpc_python_deps.bzl b/bazel/grpc_python_deps.bzl index 4e7cc1537fa..2a439bdf226 100644 --- a/bazel/grpc_python_deps.bzl +++ b/bazel/grpc_python_deps.bzl @@ -47,6 +47,15 @@ def grpc_python_deps(): remote = "https://github.com/bazelbuild/rules_python.git", ) + + if "rules_python" not in native.existing_rules(): + http_archive( + name = "rules_python", + url = "https://github.com/bazelbuild/rules_python/archive/9d68f24659e8ce8b736590ba1e4418af06ec2552.zip", + sha256 = "f7402f11691d657161f871e11968a984e5b48b023321935f5a55d7e56cf4758a", + strip_prefix = "rules_python-9d68f24659e8ce8b736590ba1e4418af06ec2552", + ) + python_configure(name = "local_config_python") native.bind( diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl index 12f51f8b172..e7e9e597b05 100644 --- a/bazel/python_rules.bzl +++ b/bazel/python_rules.bzl @@ -178,3 +178,29 @@ def py_grpc_library( deps = [Label("//src/python/grpcio/grpc:grpcio")] + deps, **kwargs ) + + +def py2and3_test(name, + py_test = native.py_test, + **kwargs): + if "python_version" in kwargs: + fail("Cannot specify 'python_version' in py2and3_test.") + + names = [name + suffix for suffix in (".python2", ".python3")] + python_versions = ["PY2", "PY3"] + for case_name, python_version in zip(names, python_versions): + py_test( + name = case_name, + python_version = python_version, + **kwargs + ) + + suite_kwargs = {} + if "visibility" in kwargs: + suite_kwargs["visibility"] = kwargs["visibility"] + + native.test_suite( + name = name, + tests = names, + **suite_kwargs + ) diff --git a/examples/python/auth/BUILD.bazel b/examples/python/auth/BUILD.bazel index cc454fdfdfe..72620ee46c5 100644 --- a/examples/python/auth/BUILD.bazel +++ b/examples/python/auth/BUILD.bazel @@ -39,6 +39,7 @@ py_binary( "//examples:helloworld_py_pb2", "//examples:helloworld_py_pb2_grpc", ], + python_version = "PY3", ) py_binary( @@ -51,6 +52,7 @@ py_binary( "//examples:helloworld_py_pb2", "//examples:helloworld_py_pb2_grpc", ], + python_version = "PY3", ) py_test( @@ -63,4 +65,5 @@ py_test( ":customized_auth_server", ":_credentials", ], + python_version = "PY3", ) diff --git a/examples/python/cancellation/BUILD.bazel b/examples/python/cancellation/BUILD.bazel index 17b1b20168e..b4451f60711 100644 --- a/examples/python/cancellation/BUILD.bazel +++ b/examples/python/cancellation/BUILD.bazel @@ -45,6 +45,7 @@ py_binary( "//external:six" ], srcs_version = "PY2AND3", + python_version = "PY3", ) py_library( @@ -68,6 +69,7 @@ py_binary( "//:python3": [], }), srcs_version = "PY2AND3", + python_version = "PY3", ) py_test( @@ -78,4 +80,5 @@ py_test( ":server" ], size = "small", + python_version = "PY3", ) diff --git a/examples/python/compression/BUILD.bazel b/examples/python/compression/BUILD.bazel index 9d5f6bb83ed..4141eda2ffd 100644 --- a/examples/python/compression/BUILD.bazel +++ b/examples/python/compression/BUILD.bazel @@ -21,6 +21,7 @@ py_binary( "//examples:helloworld_py_pb2_grpc", ], srcs_version = "PY2AND3", + python_version = "PY3", ) py_binary( @@ -32,6 +33,7 @@ py_binary( "//examples:helloworld_py_pb2_grpc", ], srcs_version = "PY2AND3", + python_version = "PY3", ) py_test( @@ -43,4 +45,5 @@ py_test( ":server", ], size = "small", + python_version = "PY3", ) diff --git a/examples/python/debug/BUILD.bazel b/examples/python/debug/BUILD.bazel index 657ae860ae3..332991332f8 100644 --- a/examples/python/debug/BUILD.bazel +++ b/examples/python/debug/BUILD.bazel @@ -35,6 +35,7 @@ py_binary( "//examples:helloworld_py_pb2", "//examples:helloworld_py_pb2_grpc", ], + python_version = "PY3", ) py_binary( @@ -45,6 +46,7 @@ py_binary( "//src/python/grpcio/grpc:grpcio", "//src/python/grpcio_channelz/grpc_channelz/v1:grpc_channelz", ], + python_version = "PY3", ) py_test( @@ -59,4 +61,5 @@ py_test( ":send_message", ":get_stats", ], + python_version = "PY3", ) diff --git a/examples/python/errors/BUILD.bazel b/examples/python/errors/BUILD.bazel index 4b779ddfcf1..367bd81925f 100644 --- a/examples/python/errors/BUILD.bazel +++ b/examples/python/errors/BUILD.bazel @@ -55,4 +55,5 @@ py_test( "../../../src/python/grpcio_status", "../../../src/python/grpcio_tests", ], + python_version = "PY3", ) diff --git a/examples/python/multiprocessing/BUILD b/examples/python/multiprocessing/BUILD index 490aea0c1e6..2503970bc80 100644 --- a/examples/python/multiprocessing/BUILD +++ b/examples/python/multiprocessing/BUILD @@ -42,6 +42,7 @@ py_binary( ":prime_proto_pb2_grpc", ], srcs_version = "PY3", + python_version = "PY3", ) py_binary( @@ -57,6 +58,7 @@ py_binary( "//:python3": [], }), srcs_version = "PY3", + python_version = "PY3", ) py_test( @@ -67,4 +69,5 @@ py_test( ":server" ], size = "small", + python_version = "PY3", ) diff --git a/examples/python/wait_for_ready/BUILD.bazel b/examples/python/wait_for_ready/BUILD.bazel index f074ae7bb7f..9cbddd1a6e3 100644 --- a/examples/python/wait_for_ready/BUILD.bazel +++ b/examples/python/wait_for_ready/BUILD.bazel @@ -30,4 +30,5 @@ py_test( srcs = ["test/_wait_for_ready_example_test.py"], deps = [":wait_for_ready_example",], size = "small", + python_version = "PY3", ) diff --git a/src/python/grpcio_tests/tests/channelz/BUILD.bazel b/src/python/grpcio_tests/tests/channelz/BUILD.bazel index 63513616e77..f4d246847f7 100644 --- a/src/python/grpcio_tests/tests/channelz/BUILD.bazel +++ b/src/python/grpcio_tests/tests/channelz/BUILD.bazel @@ -1,6 +1,8 @@ package(default_visibility = ["//visibility:public"]) -py_test( +load("//bazel:python_rules.bzl", "py2and3_test") + +py2and3_test( name = "channelz_servicer_test", srcs = ["_channelz_servicer_test.py"], main = "_channelz_servicer_test.py", diff --git a/src/python/grpcio_tests/tests/health_check/BUILD.bazel b/src/python/grpcio_tests/tests/health_check/BUILD.bazel index 49f076be9a1..797b6a48e91 100644 --- a/src/python/grpcio_tests/tests/health_check/BUILD.bazel +++ b/src/python/grpcio_tests/tests/health_check/BUILD.bazel @@ -1,6 +1,7 @@ package(default_visibility = ["//visibility:public"]) +load("//bazel:python_rules.bzl", "py2and3_test") -py_test( +py2and3_test( name = "health_servicer_test", srcs = ["_health_servicer_test.py"], main = "_health_servicer_test.py", diff --git a/src/python/grpcio_tests/tests/interop/BUILD.bazel b/src/python/grpcio_tests/tests/interop/BUILD.bazel index 8ac3f7d52d5..4685852162b 100644 --- a/src/python/grpcio_tests/tests/interop/BUILD.bazel +++ b/src/python/grpcio_tests/tests/interop/BUILD.bazel @@ -1,4 +1,5 @@ load("@grpc_python_dependencies//:requirements.bzl", "requirement") +load("//bazel:python_rules.bzl", "py2and3_test") package(default_visibility = ["//visibility:public"]) @@ -80,7 +81,7 @@ py_library( ], ) -py_test( +py2and3_test( name = "_insecure_intraop_test", size = "small", srcs = ["_insecure_intraop_test.py"], @@ -99,7 +100,7 @@ py_test( ], ) -py_test( +py2and3_test( name = "_secure_intraop_test", size = "small", srcs = ["_secure_intraop_test.py"], diff --git a/src/python/grpcio_tests/tests/reflection/BUILD.bazel b/src/python/grpcio_tests/tests/reflection/BUILD.bazel index e9b56191df8..65a08c2a435 100644 --- a/src/python/grpcio_tests/tests/reflection/BUILD.bazel +++ b/src/python/grpcio_tests/tests/reflection/BUILD.bazel @@ -1,8 +1,9 @@ load("@grpc_python_dependencies//:requirements.bzl", "requirement") +load("//bazel:python_rules.bzl", "py2and3_test") package(default_visibility = ["//visibility:public"]) -py_test( +py2and3_test( name="_reflection_servicer_test", size="small", timeout="moderate", diff --git a/src/python/grpcio_tests/tests/status/BUILD.bazel b/src/python/grpcio_tests/tests/status/BUILD.bazel index b163fe3975e..0868de01acf 100644 --- a/src/python/grpcio_tests/tests/status/BUILD.bazel +++ b/src/python/grpcio_tests/tests/status/BUILD.bazel @@ -1,8 +1,9 @@ load("@grpc_python_dependencies//:requirements.bzl", "requirement") +load("//bazel:python_rules.bzl", "py2and3_test") package(default_visibility = ["//visibility:public"]) -py_test( +py2and3_test( name = "grpc_status_test", srcs = ["_grpc_status_test.py"], main = "_grpc_status_test.py", diff --git a/src/python/grpcio_tests/tests/unit/BUILD.bazel b/src/python/grpcio_tests/tests/unit/BUILD.bazel index 49203b7fa16..587d8cb246f 100644 --- a/src/python/grpcio_tests/tests/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/BUILD.bazel @@ -1,3 +1,5 @@ +load("//bazel:python_rules.bzl", "py2and3_test") + package(default_visibility = ["//visibility:public"]) GRPCIO_TESTS_UNIT = [ @@ -80,7 +82,7 @@ py_library( ) [ - py_test( + py2and3_test( name=test_file_name[:-3], size="small", srcs=[test_file_name], diff --git a/src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel b/src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel index 458a6b1fb8a..867649a6a50 100644 --- a/src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel @@ -1,4 +1,5 @@ load("@grpc_python_dependencies//:requirements.bzl", "requirement") +load("//bazel:python_rules.bzl", "py2and3_test") package(default_visibility = ["//visibility:public"]) @@ -23,7 +24,7 @@ py_library( ) [ - py_test( + py2and3_test( name=test_file_name[:-3], size="small", srcs=[test_file_name], diff --git a/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel b/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel index d69186e1fde..a93249301c4 100644 --- a/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel @@ -1,11 +1,12 @@ package(default_visibility = ["//visibility:public"]) +load("//bazel:python_rules.bzl", "py2and3_test") py_library( name = "stream_testing", srcs = ["stream_testing.py"], ) -py_test( +py2and3_test( name = "logging_pool_test", srcs = ["_logging_pool_test.py"], main = "_logging_pool_test.py", diff --git a/templates/tools/dockerfile/bazel.include b/templates/tools/dockerfile/bazel.include index adde6ed4787..12a22785623 100644 --- a/templates/tools/dockerfile/bazel.include +++ b/templates/tools/dockerfile/bazel.include @@ -2,7 +2,7 @@ # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.26.0 +ENV BAZEL_VERSION 0.28.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/third_party/py/BUILD.tpl b/third_party/py/BUILD.tpl index 2283c573bc3..8f010f85a03 100644 --- a/third_party/py/BUILD.tpl +++ b/third_party/py/BUILD.tpl @@ -2,35 +2,36 @@ package(default_visibility=["//visibility:public"]) -# To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib -# See https://docs.python.org/3/extending/windows.html -cc_import( - name="python_lib", - interface_library=select({ - ":windows": ":python_import_lib", - # A placeholder for Unix platforms which makes --no_build happy. - "//conditions:default": "not-existing.lib", - }), - system_provided=1, -) - -cc_library( - name="python_headers", - hdrs=[":python_include"], - deps=select({ - ":windows": [":python_lib"], - "//conditions:default": [], - }), - includes=["python_include"], -) - config_setting( name="windows", values={"cpu": "x64_windows"}, visibility=["//visibility:public"], ) -%{PYTHON_INCLUDE_GENRULE} -%{PYTHON_IMPORT_LIB_GENRULE} +config_setting( + name="python2", + flag_values = {"@rules_python//python:python_version": "PY2"} +) + +config_setting( + name="python3", + flag_values = {"@rules_python//python:python_version": "PY3"} +) +cc_library( + name = "python_lib", + deps = select({ + ":python2": ["//_python2:_python2_lib"], + ":python3": ["//_python3:_python3_lib"], + "//conditions:default": ["not-existing.lib"], + }) +) +cc_library( + name = "python_headers", + deps = select({ + ":python2": ["//_python2:_python2_headers"], + ":python3": ["//_python3:_python3_headers"], + "//conditions:default": ["not-existing.headers"], + }) +) diff --git a/third_party/py/python_configure.bzl b/third_party/py/python_configure.bzl index e6fa5ed10e9..6f9a178a057 100644 --- a/third_party/py/python_configure.bzl +++ b/third_party/py/python_configure.bzl @@ -3,14 +3,15 @@ `python_configure` depends on the following environment variables: - * `PYTHON_BIN_PATH`: location of python binary. - * `PYTHON_LIB_PATH`: Location of python libraries. + * `PYTHON2_BIN_PATH`: location of python binary. + * `PYTHON2_LIB_PATH`: Location of python libraries. """ _BAZEL_SH = "BAZEL_SH" -_PYTHON_BIN_PATH = "PYTHON_BIN_PATH" -_PYTHON_LIB_PATH = "PYTHON_LIB_PATH" -_PYTHON_CONFIG_REPO = "PYTHON_CONFIG_REPO" +_PYTHON2_BIN_PATH = "PYTHON2_BIN_PATH" +_PYTHON2_LIB_PATH = "PYTHON2_LIB_PATH" +_PYTHON3_BIN_PATH = "PYTHON3_BIN_PATH" +_PYTHON3_LIB_PATH = "PYTHON3_LIB_PATH" def _tpl(repository_ctx, tpl, substitutions={}, out=None): @@ -136,9 +137,9 @@ def _symlink_genrule_for_dir(repository_ctx, "\n".join(outs)) -def _get_python_bin(repository_ctx): +def _get_python_bin(repository_ctx, bin_path_key, default_bin_path): """Gets the python bin path.""" - python_bin = repository_ctx.os.environ.get(_PYTHON_BIN_PATH, 'python') + python_bin = repository_ctx.os.environ.get(bin_path_key, default_bin_path) if not repository_ctx.path(python_bin).exists: # It's a command, use 'which' to find its path. python_bin_path = repository_ctx.which(python_bin) @@ -150,7 +151,7 @@ def _get_python_bin(repository_ctx): _fail("Cannot find python in PATH, please make sure " + "python is installed and add its directory in PATH, or --define " + "%s='/something/else'.\nPATH=%s" % - (_PYTHON_BIN_PATH, repository_ctx.os.environ.get("PATH", ""))) + (bin_path_key, repository_ctx.os.environ.get("PATH", ""))) def _get_bash_bin(repository_ctx): @@ -170,9 +171,9 @@ def _get_bash_bin(repository_ctx): (_BAZEL_SH, repository_ctx.os.environ.get("PATH", ""))) -def _get_python_lib(repository_ctx, python_bin): +def _get_python_lib(repository_ctx, python_bin, lib_path_key): """Gets the python lib path.""" - python_lib = repository_ctx.os.environ.get(_PYTHON_LIB_PATH) + python_lib = repository_ctx.os.environ.get(lib_path_key) if python_lib != None: return python_lib print_lib = ( @@ -202,13 +203,13 @@ def _check_python_lib(repository_ctx, python_lib): _fail("Invalid python library path: %s" % python_lib) -def _check_python_bin(repository_ctx, python_bin): +def _check_python_bin(repository_ctx, python_bin, bin_path_key): """Checks the python bin path.""" cmd = '[[ -x "%s" ]] && [[ ! -d "%s" ]]' % (python_bin, python_bin) result = repository_ctx.execute([_get_bash_bin(repository_ctx), "-c", cmd]) if result.return_code == 1: _fail("--define %s='%s' is not executable. Is it the python binary?" % - (_PYTHON_BIN_PATH, python_bin)) + (bin_path_key, python_bin)) def _get_python_include(repository_ctx, python_bin): @@ -222,11 +223,11 @@ def _get_python_include(repository_ctx, python_bin): error_msg="Problem getting python include path.", error_details=( "Is the Python binary path set up right? " + "(See ./configure or " - + _PYTHON_BIN_PATH + ".) " + "Is distutils installed?")) + + _PYTHON2_BIN_PATH + ".) " + "Is distutils installed?")) return result.stdout.splitlines()[0] -def _get_python_import_lib_name(repository_ctx, python_bin): +def _get_python_import_lib_name(repository_ctx, python_bin, bin_path_key): """Get Python import library name (pythonXY.lib) on Windows.""" result = _execute( repository_ctx, [ @@ -236,66 +237,85 @@ def _get_python_import_lib_name(repository_ctx, python_bin): ], error_msg="Problem getting python import library.", error_details=("Is the Python binary path set up right? " + - "(See ./configure or " + _PYTHON_BIN_PATH + ".) ")) + "(See ./configure or " + bin_path_key + ".) ")) return result.stdout.splitlines()[0] -def _create_local_python_repository(repository_ctx): +def _create_single_version_package(repository_ctx, + variety_name, + bin_path_key, + default_bin_path, + lib_path_key): """Creates the repository containing files set up to build with Python.""" - python_bin = _get_python_bin(repository_ctx) - _check_python_bin(repository_ctx, python_bin) - python_lib = _get_python_lib(repository_ctx, python_bin) + python_bin = _get_python_bin(repository_ctx, bin_path_key, default_bin_path) + _check_python_bin(repository_ctx, python_bin, bin_path_key) + python_lib = _get_python_lib(repository_ctx, python_bin, lib_path_key) _check_python_lib(repository_ctx, python_lib) python_include = _get_python_include(repository_ctx, python_bin) python_include_rule = _symlink_genrule_for_dir( - repository_ctx, python_include, 'python_include', 'python_include') + repository_ctx, python_include, '{}_include'.format(variety_name), + '{}_include'.format(variety_name)) python_import_lib_genrule = "" # To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib # See https://docs.python.org/3/extending/windows.html if _is_windows(repository_ctx): python_include = _normalize_path(python_include) - python_import_lib_name = _get_python_import_lib_name( + python_import_lib_name = _get_python_import_lib_name, bin_path_key( repository_ctx, python_bin) python_import_lib_src = python_include.rsplit( '/', 1)[0] + "/libs/" + python_import_lib_name python_import_lib_genrule = _symlink_genrule_for_dir( - repository_ctx, None, '', 'python_import_lib', + repository_ctx, None, '', '{}_import_lib'.format(variety_name), [python_import_lib_src], [python_import_lib_name]) _tpl( - repository_ctx, "BUILD", { + repository_ctx, "variety", { "%{PYTHON_INCLUDE_GENRULE}": python_include_rule, "%{PYTHON_IMPORT_LIB_GENRULE}": python_import_lib_genrule, - }) - - -def _create_remote_python_repository(repository_ctx, remote_config_repo): - """Creates pointers to a remotely configured repo set up to build with Python. - """ - _tpl(repository_ctx, "remote.BUILD", { - "%{REMOTE_PYTHON_REPO}": remote_config_repo, - }, "BUILD") + "%{VARIETY_NAME}": variety_name, + }, + out="{}/BUILD".format(variety_name)) def _python_autoconf_impl(repository_ctx): """Implementation of the python_autoconf repository rule.""" - if _PYTHON_CONFIG_REPO in repository_ctx.os.environ: - _create_remote_python_repository( - repository_ctx, repository_ctx.os.environ[_PYTHON_CONFIG_REPO]) - else: - _create_local_python_repository(repository_ctx) + _create_single_version_package(repository_ctx, + "_python2", + _PYTHON2_BIN_PATH, + "python", + _PYTHON2_LIB_PATH) + _create_single_version_package(repository_ctx, + "_python3", + _PYTHON3_BIN_PATH, + "python3", + _PYTHON3_LIB_PATH) + _tpl(repository_ctx, "BUILD") python_configure = repository_rule( - implementation=_python_autoconf_impl, - environ=[ + implementation = _python_autoconf_impl, + environ = [ _BAZEL_SH, - _PYTHON_BIN_PATH, - _PYTHON_LIB_PATH, - _PYTHON_CONFIG_REPO, + _PYTHON2_BIN_PATH, + _PYTHON2_LIB_PATH, + _PYTHON3_BIN_PATH, + _PYTHON3_LIB_PATH, ], + attrs={ + "_build_tpl": attr.label( + default = Label("//third_party/py:BUILD.tpl"), + allow_single_file = True, + ), + "_variety_tpl": attr.label( + default = Label("//third_party/py:variety.tpl"), + allow_single_file = True, + ), + }, ) """Detects and configures the local Python. +It is expected that the system have both a working Python 2 and python 3 +installation + Add the following to your WORKSPACE FILE: ```python diff --git a/third_party/py/remote.BUILD.tpl b/third_party/py/remote.BUILD.tpl deleted file mode 100644 index 1bfe1f0bf65..00000000000 --- a/third_party/py/remote.BUILD.tpl +++ /dev/null @@ -1,10 +0,0 @@ -# Adapted with modifications from tensorflow/third_party/py/ - -package(default_visibility=["//visibility:public"]) - -alias( - name="python_headers", - actual="%{REMOTE_PYTHON_REPO}:python_headers", -) - - diff --git a/third_party/py/variety.tpl b/third_party/py/variety.tpl new file mode 100644 index 00000000000..0c466d6d8f0 --- /dev/null +++ b/third_party/py/variety.tpl @@ -0,0 +1,26 @@ +package(default_visibility=["//visibility:public"]) + +# To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib +# See https://docs.python.org/3/extending/windows.html +cc_import( + name="%{VARIETY_NAME}_lib", + interface_library=select({ + "//:windows": ":%{VARIETY_NAME}_import_lib", + # A placeholder for Unix platforms which makes --no_build happy. + "//conditions:default": "not-existing.lib", + }), + system_provided=1, +) + +cc_library( + name="%{VARIETY_NAME}_headers", + hdrs=[":%{VARIETY_NAME}_include"], + deps=select({ + "//:windows": [":%{VARIETY_NAME}_lib"], + "//conditions:default": [], + }), + includes=["%{VARIETY_NAME}_include"], +) + +%{PYTHON_INCLUDE_GENRULE} +%{PYTHON_IMPORT_LIB_GENRULE} diff --git a/tools/bazel b/tools/bazel index 4f08d18c656..4d1d57f60d9 100755 --- a/tools/bazel +++ b/tools/bazel @@ -32,7 +32,7 @@ then exec -a "$0" "${BAZEL_REAL}" "$@" fi -VERSION=0.26.0 +VERSION=0.28.1 echo "INFO: Running bazel wrapper (see //tools/bazel for details), bazel version $VERSION will be used instead of system-wide bazel installation." diff --git a/tools/bazel.rc b/tools/bazel.rc index b24f603ddda..fcbe9337b9f 100644 --- a/tools/bazel.rc +++ b/tools/bazel.rc @@ -82,7 +82,3 @@ build:basicprof --copt=-DNDEBUG build:basicprof --copt=-O2 build:basicprof --copt=-DGRPC_BASIC_PROFILER build:basicprof --copt=-DGRPC_TIMERS_RDTSC - -build:python3 --python_path=python3 -build:python3 --python_version=PY3 -build:python3 --action_env=PYTHON_BIN_PATH=python3 diff --git a/tools/dockerfile/test/bazel/Dockerfile b/tools/dockerfile/test/bazel/Dockerfile index 7e7903359e7..7141fb9c5f1 100644 --- a/tools/dockerfile/test/bazel/Dockerfile +++ b/tools/dockerfile/test/bazel/Dockerfile @@ -52,7 +52,7 @@ RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 t # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.26.0 +ENV BAZEL_VERSION 0.28.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile index 675378b305b..badff52de34 100644 --- a/tools/dockerfile/test/sanity/Dockerfile +++ b/tools/dockerfile/test/sanity/Dockerfile @@ -97,7 +97,7 @@ ENV CLANG_TIDY=clang-tidy # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.26.0 +ENV BAZEL_VERSION 0.28.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh index f725eb7a3d7..4a48760aab1 100755 --- a/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh +++ b/tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh @@ -26,9 +26,6 @@ ${name}') cd /var/local/git/grpc/test bazel test --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //src/python/... bazel test --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //examples/python/... -bazel clean --expunge -bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //src/python/... -bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //examples/python/... # TODO(https://github.com/grpc/grpc/issues/19854): Move this to a new Kokoro # job. diff --git a/tools/remote_build/kokoro.bazelrc b/tools/remote_build/kokoro.bazelrc index 064e94b2e15..5c1b061bce3 100644 --- a/tools/remote_build/kokoro.bazelrc +++ b/tools/remote_build/kokoro.bazelrc @@ -16,13 +16,12 @@ import %workspace%/tools/remote_build/rbe_common.bazelrc -build --remote_cache=remotebuildexecution.googleapis.com -build --remote_executor=remotebuildexecution.googleapis.com -build --tls_enabled=true +build --remote_cache=grpcs://remotebuildexecution.googleapis.com +build --remote_executor=grpcs://remotebuildexecution.googleapis.com build --auth_enabled=true -build --bes_backend=buildeventservice.googleapis.com +build --bes_backend=grpcs://buildeventservice.googleapis.com build --bes_timeout=600s build --project_id=grpc-testing diff --git a/tools/remote_build/manual.bazelrc b/tools/remote_build/manual.bazelrc index fcd41f57521..c3c6af42877 100644 --- a/tools/remote_build/manual.bazelrc +++ b/tools/remote_build/manual.bazelrc @@ -17,9 +17,8 @@ import %workspace%/tools/remote_build/rbe_common.bazelrc -build --remote_cache=remotebuildexecution.googleapis.com -build --remote_executor=remotebuildexecution.googleapis.com -build --tls_enabled=true +build --remote_cache=grpcs://remotebuildexecution.googleapis.com +build --remote_executor=grpcs://remotebuildexecution.googleapis.com # Enable authentication. This will pick up application default credentials by # default. You can use --auth_credentials=some_file.json to use a service @@ -30,7 +29,7 @@ build --auth_enabled=true # Set flags for uploading to BES in order to view results in the Bazel Build # Results UI. -build --bes_backend="buildeventservice.googleapis.com" +build --bes_backend=grpcs://buildeventservice.googleapis.com build --bes_timeout=60s build --bes_results_url="https://source.cloud.google.com/results/invocations/" build --project_id=grpc-testing diff --git a/tools/remote_build/rbe_common.bazelrc b/tools/remote_build/rbe_common.bazelrc index 6baaf24732c..6236003fe17 100644 --- a/tools/remote_build/rbe_common.bazelrc +++ b/tools/remote_build/rbe_common.bazelrc @@ -87,4 +87,4 @@ build:ubsan --test_timeout=3600 # how to update the bazel toolchain for ubsan: # - check for the latest released version in https://github.com/bazelbuild/bazel-toolchains/tree/master/configs/experimental/ubuntu16_04_clang # - you might need to update the bazel_toolchains dependency in grpc_deps.bzl -build:ubsan --crosstool_top=@bazel_toolchains//configs/experimental/ubuntu16_04_clang/1.2/bazel_0.23.0/ubsan:toolchain +build:ubsan --crosstool_top=@bazel_toolchains//configs/experimental/ubuntu16_04_clang/1.2/bazel_0.28.0/ubsan:toolchain From 1077b3435c3bf6699e118800a9c0681c900d240b Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 29 Aug 2019 11:27:00 -0700 Subject: [PATCH 495/661] Use range-based for on state rather than state.KeepRunning when possible --- test/cpp/microbenchmarks/bm_alarm.cc | 2 +- test/cpp/microbenchmarks/bm_arena.cc | 4 +- test/cpp/microbenchmarks/bm_byte_buffer.cc | 6 +-- test/cpp/microbenchmarks/bm_call_create.cc | 16 ++++---- test/cpp/microbenchmarks/bm_channel.cc | 2 +- test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 4 +- test/cpp/microbenchmarks/bm_closure.cc | 38 +++++++++---------- test/cpp/microbenchmarks/bm_cq.cc | 16 ++++---- .../microbenchmarks/bm_cq_multiple_threads.cc | 2 +- test/cpp/microbenchmarks/bm_error.cc | 34 ++++++++--------- test/cpp/microbenchmarks/bm_metadata.cc | 38 +++++++++---------- test/cpp/microbenchmarks/bm_pollset.cc | 10 ++--- test/cpp/microbenchmarks/bm_timer.cc | 4 +- .../fullstack_streaming_ping_pong.h | 6 +-- .../fullstack_streaming_pump.h | 4 +- .../fullstack_unary_ping_pong.h | 2 +- test/cpp/microbenchmarks/noop-benchmark.cc | 2 +- 17 files changed, 95 insertions(+), 95 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_alarm.cc b/test/cpp/microbenchmarks/bm_alarm.cc index d95771a57c6..5411b222eab 100644 --- a/test/cpp/microbenchmarks/bm_alarm.cc +++ b/test/cpp/microbenchmarks/bm_alarm.cc @@ -37,7 +37,7 @@ static void BM_Alarm_Tag_Immediate(benchmark::State& state) { void* output_tag; bool ok; auto deadline = grpc_timeout_seconds_to_deadline(0); - while (state.KeepRunning()) { + for (auto _ : state) { alarm.Set(&cq, deadline, nullptr); cq.Next(&output_tag, &ok); } diff --git a/test/cpp/microbenchmarks/bm_arena.cc b/test/cpp/microbenchmarks/bm_arena.cc index c3ded0d76f7..c0d76fa3d7d 100644 --- a/test/cpp/microbenchmarks/bm_arena.cc +++ b/test/cpp/microbenchmarks/bm_arena.cc @@ -26,7 +26,7 @@ using grpc_core::Arena; static void BM_Arena_NoOp(benchmark::State& state) { - while (state.KeepRunning()) { + for (auto _ : state) { Arena::Create(state.range(0))->Destroy(); } } @@ -49,7 +49,7 @@ static void BM_Arena_ManyAlloc(benchmark::State& state) { BENCHMARK(BM_Arena_ManyAlloc)->Ranges({{1, 1024 * 1024}, {1, 32 * 1024}}); static void BM_Arena_Batch(benchmark::State& state) { - while (state.KeepRunning()) { + for (auto _ : state) { Arena* a = Arena::Create(state.range(0)); for (int i = 0; i < state.range(1); i++) { a->Alloc(state.range(2)); diff --git a/test/cpp/microbenchmarks/bm_byte_buffer.cc b/test/cpp/microbenchmarks/bm_byte_buffer.cc index 595cc734b69..4dfa1326de9 100644 --- a/test/cpp/microbenchmarks/bm_byte_buffer.cc +++ b/test/cpp/microbenchmarks/bm_byte_buffer.cc @@ -40,7 +40,7 @@ static void BM_ByteBuffer_Copy(benchmark::State& state) { slices.emplace_back(buf.get(), slice_size); } grpc::ByteBuffer bb(slices.data(), num_slices); - while (state.KeepRunning()) { + for (auto _ : state) { grpc::ByteBuffer cc(bb); } } @@ -60,7 +60,7 @@ static void BM_ByteBufferReader_Next(benchmark::State& state) { grpc_byte_buffer_reader reader; GPR_ASSERT( g_core_codegen_interface->grpc_byte_buffer_reader_init(&reader, bb)); - while (state.KeepRunning()) { + for (auto _ : state) { grpc_slice* slice; if (GPR_UNLIKELY(!g_core_codegen_interface->grpc_byte_buffer_reader_peek( &reader, &slice))) { @@ -93,7 +93,7 @@ static void BM_ByteBufferReader_Peek(benchmark::State& state) { grpc_byte_buffer_reader reader; GPR_ASSERT( g_core_codegen_interface->grpc_byte_buffer_reader_init(&reader, bb)); - while (state.KeepRunning()) { + for (auto _ : state) { grpc_slice* slice; if (GPR_UNLIKELY(!g_core_codegen_interface->grpc_byte_buffer_reader_peek( &reader, &slice))) { diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 4eb717d82b5..99ea1e053e9 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -52,7 +52,7 @@ void BM_Zalloc(benchmark::State& state) { // sizes TrackCounters track_counters; size_t sz = state.range(0); - while (state.KeepRunning()) { + for (auto _ : state) { gpr_free(gpr_zalloc(sz)); } track_counters.Finish(state); @@ -107,7 +107,7 @@ static void BM_CallCreateDestroy(benchmark::State& state) { gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); void* method_hdl = grpc_channel_register_call(fixture.channel(), "/foo/bar", nullptr, nullptr); - while (state.KeepRunning()) { + for (auto _ : state) { grpc_call_unref(grpc_channel_create_registered_call( fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, cq, method_hdl, deadline, nullptr)); @@ -139,7 +139,7 @@ static void BM_LameChannelCallCreateCpp(benchmark::State& state) { grpc::testing::EchoRequest send_request; grpc::testing::EchoResponse recv_response; grpc::Status recv_status; - while (state.KeepRunning()) { + for (auto _ : state) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc::ClientContext cli_ctx; auto reader = stub->AsyncEcho(&cli_ctx, send_request, &cq); @@ -174,7 +174,7 @@ static void BM_LameChannelCallCreateCore(benchmark::State& state) { cq = grpc_completion_queue_create_for_next(nullptr); void* rc = grpc_channel_register_call( channel, "/grpc.testing.EchoTestService/Echo", nullptr, nullptr); - while (state.KeepRunning()) { + for (auto _ : state) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call* call = grpc_channel_create_registered_call( channel, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, rc, @@ -248,7 +248,7 @@ static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State& state) { cq = grpc_completion_queue_create_for_next(nullptr); void* rc = grpc_channel_register_call( channel, "/grpc.testing.EchoTestService/Echo", nullptr, nullptr); - while (state.KeepRunning()) { + for (auto _ : state) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call* call = grpc_channel_create_registered_call( channel, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, rc, @@ -720,7 +720,7 @@ static void BM_IsolatedCall_NoOp(benchmark::State& state) { gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); void* method_hdl = grpc_channel_register_call(fixture.channel(), "/foo/bar", nullptr, nullptr); - while (state.KeepRunning()) { + for (auto _ : state) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call_unref(grpc_channel_create_registered_call( fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(), @@ -759,7 +759,7 @@ static void BM_IsolatedCall_Unary(benchmark::State& state) { ops[5].data.recv_status_on_client.status = &status_code; ops[5].data.recv_status_on_client.status_details = &status_details; ops[5].data.recv_status_on_client.trailing_metadata = &recv_trailing_metadata; - while (state.KeepRunning()) { + for (auto _ : state) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call* call = grpc_channel_create_registered_call( fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(), @@ -802,7 +802,7 @@ static void BM_IsolatedCall_StreamingSend(benchmark::State& state) { memset(ops, 0, sizeof(ops)); ops[0].op = GRPC_OP_SEND_MESSAGE; ops[0].data.send_message.send_message = send_message; - while (state.KeepRunning()) { + for (auto _ : state) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call_start_batch(call, ops, 1, tag(2), nullptr); grpc_completion_queue_next(fixture.cq(), diff --git a/test/cpp/microbenchmarks/bm_channel.cc b/test/cpp/microbenchmarks/bm_channel.cc index 88856c3439b..224170b32e9 100644 --- a/test/cpp/microbenchmarks/bm_channel.cc +++ b/test/cpp/microbenchmarks/bm_channel.cc @@ -62,7 +62,7 @@ static void BM_InsecureChannelCreateDestroy(benchmark::State& state) { for (int i = 0; i < state.range(0); i++) { initial_channels[i].Init(); } - while (state.KeepRunning()) { + for (auto _ : state) { Fixture channel; channel.Init(); } diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 4950e7f7768..5d5be763d55 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -54,7 +54,7 @@ static void BM_HpackEncoderInitDestroy(benchmark::State& state) { grpc_core::ExecCtx exec_ctx; std::unique_ptr c( new grpc_chttp2_hpack_compressor); - while (state.KeepRunning()) { + for (auto _ : state) { grpc_chttp2_hpack_compressor_init(c.get()); grpc_chttp2_hpack_compressor_destroy(c.get()); grpc_core::ExecCtx::Get()->Flush(); @@ -435,7 +435,7 @@ static void BM_HpackParserInitDestroy(benchmark::State& state) { grpc_chttp2_hpack_parser p; // Initial destruction so we don't leak memory in the loop. grpc_chttp2_hptbl_destroy(&p.table); - while (state.KeepRunning()) { + for (auto _ : state) { grpc_chttp2_hpack_parser_init(&p); // Note that grpc_chttp2_hpack_parser_destroy frees the table dynamic // elements so we need to recreate it here. In actual operation, diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc index 84b1c536bf0..5133c2a0f43 100644 --- a/test/cpp/microbenchmarks/bm_closure.cc +++ b/test/cpp/microbenchmarks/bm_closure.cc @@ -32,7 +32,7 @@ static void BM_NoOpExecCtx(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { grpc_core::ExecCtx exec_ctx; } track_counters.Finish(state); @@ -42,7 +42,7 @@ BENCHMARK(BM_NoOpExecCtx); static void BM_WellFlushed(benchmark::State& state) { TrackCounters track_counters; grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { grpc_core::ExecCtx::Get()->Flush(); } @@ -55,7 +55,7 @@ static void DoNothing(void* arg, grpc_error* error) {} static void BM_ClosureInitAgainstExecCtx(benchmark::State& state) { TrackCounters track_counters; grpc_closure c; - while (state.KeepRunning()) { + for (auto _ : state) { benchmark::DoNotOptimize( GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_schedule_on_exec_ctx)); } @@ -68,7 +68,7 @@ static void BM_ClosureInitAgainstCombiner(benchmark::State& state) { grpc_combiner* combiner = grpc_combiner_create(); grpc_closure c; grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { benchmark::DoNotOptimize(GRPC_CLOSURE_INIT( &c, DoNothing, nullptr, grpc_combiner_scheduler(combiner))); } @@ -83,7 +83,7 @@ static void BM_ClosureRunOnExecCtx(benchmark::State& state) { grpc_closure c; GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_schedule_on_exec_ctx); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_CLOSURE_RUN(&c, GRPC_ERROR_NONE); grpc_core::ExecCtx::Get()->Flush(); } @@ -95,7 +95,7 @@ BENCHMARK(BM_ClosureRunOnExecCtx); static void BM_ClosureCreateAndRun(benchmark::State& state) { TrackCounters track_counters; grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_CLOSURE_RUN( GRPC_CLOSURE_CREATE(DoNothing, nullptr, grpc_schedule_on_exec_ctx), GRPC_ERROR_NONE); @@ -109,7 +109,7 @@ static void BM_ClosureInitAndRun(benchmark::State& state) { TrackCounters track_counters; grpc_core::ExecCtx exec_ctx; grpc_closure c; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_CLOSURE_RUN( GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_schedule_on_exec_ctx), GRPC_ERROR_NONE); @@ -124,7 +124,7 @@ static void BM_ClosureSchedOnExecCtx(benchmark::State& state) { grpc_closure c; GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_schedule_on_exec_ctx); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_CLOSURE_SCHED(&c, GRPC_ERROR_NONE); grpc_core::ExecCtx::Get()->Flush(); } @@ -140,7 +140,7 @@ static void BM_ClosureSched2OnExecCtx(benchmark::State& state) { GRPC_CLOSURE_INIT(&c1, DoNothing, nullptr, grpc_schedule_on_exec_ctx); GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_schedule_on_exec_ctx); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE); grpc_core::ExecCtx::Get()->Flush(); @@ -159,7 +159,7 @@ static void BM_ClosureSched3OnExecCtx(benchmark::State& state) { GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_schedule_on_exec_ctx); GRPC_CLOSURE_INIT(&c3, DoNothing, nullptr, grpc_schedule_on_exec_ctx); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c3, GRPC_ERROR_NONE); @@ -176,7 +176,7 @@ static void BM_AcquireMutex(benchmark::State& state) { gpr_mu mu; gpr_mu_init(&mu); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { gpr_mu_lock(&mu); DoNothing(nullptr, GRPC_ERROR_NONE); gpr_mu_unlock(&mu); @@ -193,7 +193,7 @@ static void BM_TryAcquireMutex(benchmark::State& state) { gpr_mu mu; gpr_mu_init(&mu); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { if (gpr_mu_trylock(&mu)) { DoNothing(nullptr, GRPC_ERROR_NONE); gpr_mu_unlock(&mu); @@ -212,7 +212,7 @@ static void BM_AcquireSpinlock(benchmark::State& state) { // for comparison with the combiner stuff below gpr_spinlock mu = GPR_SPINLOCK_INITIALIZER; grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { gpr_spinlock_lock(&mu); DoNothing(nullptr, GRPC_ERROR_NONE); gpr_spinlock_unlock(&mu); @@ -227,7 +227,7 @@ static void BM_TryAcquireSpinlock(benchmark::State& state) { // for comparison with the combiner stuff below gpr_spinlock mu = GPR_SPINLOCK_INITIALIZER; grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { if (gpr_spinlock_trylock(&mu)) { DoNothing(nullptr, GRPC_ERROR_NONE); gpr_spinlock_unlock(&mu); @@ -246,7 +246,7 @@ static void BM_ClosureSchedOnCombiner(benchmark::State& state) { grpc_closure c; GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_CLOSURE_SCHED(&c, GRPC_ERROR_NONE); grpc_core::ExecCtx::Get()->Flush(); } @@ -264,7 +264,7 @@ static void BM_ClosureSched2OnCombiner(benchmark::State& state) { GRPC_CLOSURE_INIT(&c1, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE); grpc_core::ExecCtx::Get()->Flush(); @@ -285,7 +285,7 @@ static void BM_ClosureSched3OnCombiner(benchmark::State& state) { GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); GRPC_CLOSURE_INIT(&c3, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c3, GRPC_ERROR_NONE); @@ -308,7 +308,7 @@ static void BM_ClosureSched2OnTwoCombiners(benchmark::State& state) { GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_combiner_scheduler(combiner2)); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE); grpc_core::ExecCtx::Get()->Flush(); @@ -337,7 +337,7 @@ static void BM_ClosureSched4OnTwoCombiners(benchmark::State& state) { GRPC_CLOSURE_INIT(&c4, DoNothing, nullptr, grpc_combiner_scheduler(combiner2)); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c3, GRPC_ERROR_NONE); diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index edbff9c2be3..e72de05537c 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -34,7 +34,7 @@ namespace testing { static void BM_CreateDestroyCpp(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { CompletionQueue cq; } track_counters.Finish(state); @@ -44,7 +44,7 @@ BENCHMARK(BM_CreateDestroyCpp); /* Create cq using a different constructor */ static void BM_CreateDestroyCpp2(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { grpc_completion_queue* core_cq = grpc_completion_queue_create_for_next(nullptr); CompletionQueue cq(core_cq); @@ -55,7 +55,7 @@ BENCHMARK(BM_CreateDestroyCpp2); static void BM_CreateDestroyCore(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { // TODO: sreek Templatize this benchmark and pass completion type and // polling type as parameters grpc_completion_queue_destroy( @@ -77,7 +77,7 @@ static void BM_Pass1Cpp(benchmark::State& state) { TrackCounters track_counters; CompletionQueue cq; grpc_completion_queue* c_cq = cq.cq(); - while (state.KeepRunning()) { + for (auto _ : state) { grpc_cq_completion completion; DummyTag dummy_tag; grpc_core::ExecCtx exec_ctx; @@ -98,7 +98,7 @@ static void BM_Pass1Core(benchmark::State& state) { // TODO: sreek Templatize this benchmark and pass polling_type as a param grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); - while (state.KeepRunning()) { + for (auto _ : state) { grpc_cq_completion completion; grpc_core::ExecCtx exec_ctx; GPR_ASSERT(grpc_cq_begin_op(cq, nullptr)); @@ -117,7 +117,7 @@ static void BM_Pluck1Core(benchmark::State& state) { // TODO: sreek Templatize this benchmark and pass polling_type as a param grpc_completion_queue* cq = grpc_completion_queue_create_for_pluck(nullptr); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); - while (state.KeepRunning()) { + for (auto _ : state) { grpc_cq_completion completion; grpc_core::ExecCtx exec_ctx; GPR_ASSERT(grpc_cq_begin_op(cq, nullptr)); @@ -136,7 +136,7 @@ static void BM_EmptyCore(benchmark::State& state) { // TODO: sreek Templatize this benchmark and pass polling_type as a param grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_MONOTONIC); - while (state.KeepRunning()) { + for (auto _ : state) { grpc_completion_queue_next(cq, deadline, nullptr); } grpc_completion_queue_destroy(cq); @@ -202,7 +202,7 @@ static void BM_Callback_CQ_Pass1Core(benchmark::State& state) { ShutdownCallback shutdown_cb(&got_shutdown); grpc_completion_queue* cc = grpc_completion_queue_create_for_callback(&shutdown_cb, nullptr); - while (state.KeepRunning()) { + for (auto _ : state) { grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; grpc_core::ExecCtx exec_ctx; grpc_cq_completion completion; diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index 329eaf2434e..4dc471b1bc5 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -174,7 +174,7 @@ static void BM_Cq_Throughput(benchmark::State& state) { // (optionally including low-level counters) before and after the test TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { GPR_ASSERT(grpc_completion_queue_next(g_cq, deadline, nullptr).type == GRPC_OP_COMPLETE); } diff --git a/test/cpp/microbenchmarks/bm_error.cc b/test/cpp/microbenchmarks/bm_error.cc index a71817f7e54..c58453be4f5 100644 --- a/test/cpp/microbenchmarks/bm_error.cc +++ b/test/cpp/microbenchmarks/bm_error.cc @@ -35,7 +35,7 @@ typedef std::unique_ptr ErrorPtr; static void BM_ErrorCreateFromStatic(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_ERROR_UNREF(GRPC_ERROR_CREATE_FROM_STATIC_STRING("Error")); } track_counters.Finish(state); @@ -44,7 +44,7 @@ BENCHMARK(BM_ErrorCreateFromStatic); static void BM_ErrorCreateFromCopied(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_ERROR_UNREF(GRPC_ERROR_CREATE_FROM_COPIED_STRING("Error not inline")); } track_counters.Finish(state); @@ -53,7 +53,7 @@ BENCHMARK(BM_ErrorCreateFromCopied); static void BM_ErrorCreateAndSetStatus(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_ERROR_UNREF( grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING("Error"), GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_ABORTED)); @@ -64,7 +64,7 @@ BENCHMARK(BM_ErrorCreateAndSetStatus); static void BM_ErrorCreateAndSetIntAndStr(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_ERROR_UNREF(grpc_error_set_str( grpc_error_set_int( GRPC_ERROR_CREATE_FROM_STATIC_STRING("GOAWAY received"), @@ -79,7 +79,7 @@ static void BM_ErrorCreateAndSetIntLoop(benchmark::State& state) { TrackCounters track_counters; grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Error"); int n = 0; - while (state.KeepRunning()) { + for (auto _ : state) { error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS, n++); } GRPC_ERROR_UNREF(error); @@ -91,7 +91,7 @@ static void BM_ErrorCreateAndSetStrLoop(benchmark::State& state) { TrackCounters track_counters; grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Error"); const char* str = "hello"; - while (state.KeepRunning()) { + for (auto _ : state) { error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE, grpc_slice_from_static_string(str)); } @@ -103,7 +103,7 @@ BENCHMARK(BM_ErrorCreateAndSetStrLoop); static void BM_ErrorRefUnref(benchmark::State& state) { TrackCounters track_counters; grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Error"); - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_ERROR_UNREF(GRPC_ERROR_REF(error)); } GRPC_ERROR_UNREF(error); @@ -113,7 +113,7 @@ BENCHMARK(BM_ErrorRefUnref); static void BM_ErrorUnrefNone(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_ERROR_UNREF(GRPC_ERROR_NONE); } } @@ -121,7 +121,7 @@ BENCHMARK(BM_ErrorUnrefNone); static void BM_ErrorGetIntFromNoError(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { intptr_t value; grpc_error_get_int(GRPC_ERROR_NONE, GRPC_ERROR_INT_GRPC_STATUS, &value); } @@ -133,7 +133,7 @@ static void BM_ErrorGetMissingInt(benchmark::State& state) { TrackCounters track_counters; ErrorPtr error(grpc_error_set_int( GRPC_ERROR_CREATE_FROM_STATIC_STRING("Error"), GRPC_ERROR_INT_INDEX, 1)); - while (state.KeepRunning()) { + for (auto _ : state) { intptr_t value; grpc_error_get_int(error.get(), GRPC_ERROR_INT_OFFSET, &value); } @@ -145,7 +145,7 @@ static void BM_ErrorGetPresentInt(benchmark::State& state) { TrackCounters track_counters; ErrorPtr error(grpc_error_set_int( GRPC_ERROR_CREATE_FROM_STATIC_STRING("Error"), GRPC_ERROR_INT_OFFSET, 1)); - while (state.KeepRunning()) { + for (auto _ : state) { intptr_t value; grpc_error_get_int(error.get(), GRPC_ERROR_INT_OFFSET, &value); } @@ -224,7 +224,7 @@ class ErrorWithNestedGrpcStatus { template static void BM_ErrorStringOnNewError(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { Fixture fixture; grpc_error_string(fixture.error()); } @@ -235,7 +235,7 @@ template static void BM_ErrorStringRepeatedly(benchmark::State& state) { TrackCounters track_counters; Fixture fixture; - while (state.KeepRunning()) { + for (auto _ : state) { grpc_error_string(fixture.error()); } track_counters.Finish(state); @@ -246,7 +246,7 @@ static void BM_ErrorGetStatus(benchmark::State& state) { TrackCounters track_counters; Fixture fixture; grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { grpc_status_code status; grpc_slice slice; grpc_error_get_status(fixture.error(), fixture.deadline(), &status, &slice, @@ -261,7 +261,7 @@ static void BM_ErrorGetStatusCode(benchmark::State& state) { TrackCounters track_counters; Fixture fixture; grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { grpc_status_code status; grpc_error_get_status(fixture.error(), fixture.deadline(), &status, nullptr, nullptr, nullptr); @@ -275,7 +275,7 @@ static void BM_ErrorHttpError(benchmark::State& state) { TrackCounters track_counters; Fixture fixture; grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { grpc_http2_error_code error; grpc_error_get_status(fixture.error(), fixture.deadline(), nullptr, nullptr, &error, nullptr); @@ -288,7 +288,7 @@ template static void BM_HasClearGrpcStatus(benchmark::State& state) { TrackCounters track_counters; Fixture fixture; - while (state.KeepRunning()) { + for (auto _ : state) { grpc_error_has_clear_grpc_status(fixture.error()); } track_counters.Finish(state); diff --git a/test/cpp/microbenchmarks/bm_metadata.cc b/test/cpp/microbenchmarks/bm_metadata.cc index d472363eb87..d6ccee5ceef 100644 --- a/test/cpp/microbenchmarks/bm_metadata.cc +++ b/test/cpp/microbenchmarks/bm_metadata.cc @@ -30,7 +30,7 @@ static void BM_SliceFromStatic(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { benchmark::DoNotOptimize(grpc_core::ExternallyManagedSlice("abc")); } track_counters.Finish(state); @@ -39,7 +39,7 @@ BENCHMARK(BM_SliceFromStatic); static void BM_SliceFromCopied(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { grpc_slice_unref(grpc_core::UnmanagedMemorySlice("abc")); } track_counters.Finish(state); @@ -49,7 +49,7 @@ BENCHMARK(BM_SliceFromCopied); static void BM_SliceIntern(benchmark::State& state) { TrackCounters track_counters; grpc_core::ExternallyManagedSlice slice("abc"); - while (state.KeepRunning()) { + for (auto _ : state) { grpc_slice_unref(grpc_core::ManagedMemorySlice(&slice)); } track_counters.Finish(state); @@ -60,7 +60,7 @@ static void BM_SliceReIntern(benchmark::State& state) { TrackCounters track_counters; grpc_core::ExternallyManagedSlice static_slice("abc"); grpc_core::ManagedMemorySlice slice(&static_slice); - while (state.KeepRunning()) { + for (auto _ : state) { grpc_slice_unref(grpc_core::ManagedMemorySlice(&slice)); } track_counters.Finish(state); @@ -69,7 +69,7 @@ BENCHMARK(BM_SliceReIntern); static void BM_SliceInternStaticMetadata(benchmark::State& state) { TrackCounters track_counters; - while (state.KeepRunning()) { + for (auto _ : state) { benchmark::DoNotOptimize(grpc_core::ManagedMemorySlice(&GRPC_MDSTR_GZIP)); } track_counters.Finish(state); @@ -79,7 +79,7 @@ BENCHMARK(BM_SliceInternStaticMetadata); static void BM_SliceInternEqualToStaticMetadata(benchmark::State& state) { TrackCounters track_counters; grpc_core::ExternallyManagedSlice slice("gzip"); - while (state.KeepRunning()) { + for (auto _ : state) { benchmark::DoNotOptimize(grpc_core::ManagedMemorySlice(&slice)); } track_counters.Finish(state); @@ -91,7 +91,7 @@ static void BM_MetadataFromNonInternedSlices(benchmark::State& state) { grpc_core::ExternallyManagedSlice k("key"); grpc_core::ExternallyManagedSlice v("value"); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); } @@ -104,7 +104,7 @@ static void BM_MetadataFromInternedSlices(benchmark::State& state) { grpc_core::ManagedMemorySlice k("key"); grpc_core::ManagedMemorySlice v("value"); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); } @@ -121,7 +121,7 @@ static void BM_MetadataFromInternedSlicesAlreadyInIndex( grpc_core::ManagedMemorySlice v("value"); grpc_core::ExecCtx exec_ctx; grpc_mdelem seed = grpc_mdelem_create(k, v, nullptr); - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); } GRPC_MDELEM_UNREF(seed); @@ -137,7 +137,7 @@ static void BM_MetadataFromInternedKey(benchmark::State& state) { grpc_core::ManagedMemorySlice k("key"); grpc_core::ExternallyManagedSlice v("value"); grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); } @@ -153,7 +153,7 @@ static void BM_MetadataFromNonInternedSlicesWithBackingStore( grpc_core::ExternallyManagedSlice v("value"); char backing_store[sizeof(grpc_mdelem_data)]; grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_MDELEM_UNREF(grpc_mdelem_create( k, v, reinterpret_cast(backing_store))); } @@ -169,7 +169,7 @@ static void BM_MetadataFromInternedSlicesWithBackingStore( grpc_core::ManagedMemorySlice v("value"); char backing_store[sizeof(grpc_mdelem_data)]; grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_MDELEM_UNREF(grpc_mdelem_create( k, v, reinterpret_cast(backing_store))); } @@ -187,7 +187,7 @@ static void BM_MetadataFromInternedKeyWithBackingStore( grpc_core::ExternallyManagedSlice v("value"); char backing_store[sizeof(grpc_mdelem_data)]; grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_MDELEM_UNREF(grpc_mdelem_create( k, v, reinterpret_cast(backing_store))); } @@ -200,7 +200,7 @@ BENCHMARK(BM_MetadataFromInternedKeyWithBackingStore); static void BM_MetadataFromStaticMetadataStrings(benchmark::State& state) { TrackCounters track_counters; grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_MDELEM_UNREF( grpc_mdelem_create(GRPC_MDSTR_STATUS, GRPC_MDSTR_200, nullptr)); } @@ -213,7 +213,7 @@ static void BM_MetadataFromStaticMetadataStringsNotIndexed( benchmark::State& state) { TrackCounters track_counters; grpc_core::ExecCtx exec_ctx; - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_MDELEM_UNREF( grpc_mdelem_create(GRPC_MDSTR_STATUS, GRPC_MDSTR_GZIP, nullptr)); } @@ -230,7 +230,7 @@ static void BM_MetadataRefUnrefExternal(benchmark::State& state) { grpc_mdelem_create(grpc_core::ExternallyManagedSlice("a"), grpc_core::ExternallyManagedSlice("b"), reinterpret_cast(backing_store)); - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_MDELEM_UNREF(GRPC_MDELEM_REF(el)); } GRPC_MDELEM_UNREF(el); @@ -249,7 +249,7 @@ static void BM_MetadataRefUnrefInterned(benchmark::State& state) { k, v, reinterpret_cast(backing_store)); grpc_slice_unref(k); grpc_slice_unref(v); - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_MDELEM_UNREF(GRPC_MDELEM_REF(el)); } GRPC_MDELEM_UNREF(el); @@ -264,7 +264,7 @@ static void BM_MetadataRefUnrefAllocated(benchmark::State& state) { grpc_mdelem el = grpc_mdelem_create(grpc_core::ExternallyManagedSlice("a"), grpc_core::ExternallyManagedSlice("b"), nullptr); - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_MDELEM_UNREF(GRPC_MDELEM_REF(el)); } GRPC_MDELEM_UNREF(el); @@ -278,7 +278,7 @@ static void BM_MetadataRefUnrefStatic(benchmark::State& state) { grpc_core::ExecCtx exec_ctx; grpc_mdelem el = grpc_mdelem_create(GRPC_MDSTR_STATUS, GRPC_MDSTR_200, nullptr); - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_MDELEM_UNREF(GRPC_MDELEM_REF(el)); } GRPC_MDELEM_UNREF(el); diff --git a/test/cpp/microbenchmarks/bm_pollset.cc b/test/cpp/microbenchmarks/bm_pollset.cc index f8e36f178e4..c360f02d466 100644 --- a/test/cpp/microbenchmarks/bm_pollset.cc +++ b/test/cpp/microbenchmarks/bm_pollset.cc @@ -53,7 +53,7 @@ static void BM_CreateDestroyPollset(benchmark::State& state) { grpc_closure shutdown_ps_closure; GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps, grpc_schedule_on_exec_ctx); - while (state.KeepRunning()) { + for (auto _ : state) { memset(ps, 0, ps_sz); grpc_pollset_init(ps, &mu); gpr_mu_lock(mu); @@ -84,7 +84,7 @@ static void BM_PollEmptyPollset_SpeedOfLight(benchmark::State& state) { ev.events = EPOLLIN; epoll_ctl(epfd, EPOLL_CTL_ADD, fds.back(), &ev); } - while (state.KeepRunning()) { + for (auto _ : state) { epoll_wait(epfd, ev, nev, 0); } for (auto fd : fds) { @@ -115,7 +115,7 @@ static void BM_PollEmptyPollset(benchmark::State& state) { grpc_pollset_init(ps, &mu); grpc_core::ExecCtx exec_ctx; gpr_mu_lock(mu); - while (state.KeepRunning()) { + for (auto _ : state) { GRPC_ERROR_UNREF(grpc_pollset_work(ps, nullptr, 0)); } grpc_closure shutdown_ps_closure; @@ -140,7 +140,7 @@ static void BM_PollAddFd(benchmark::State& state) { GPR_ASSERT( GRPC_LOG_IF_ERROR("wakeup_fd_init", grpc_wakeup_fd_init(&wakeup_fd))); grpc_fd* fd = grpc_fd_create(wakeup_fd.read_fd, "xxx", false); - while (state.KeepRunning()) { + for (auto _ : state) { grpc_pollset_add_fd(ps, fd); grpc_core::ExecCtx::Get()->Flush(); } @@ -188,7 +188,7 @@ static void BM_SingleThreadPollOneFd_SpeedOfLight(benchmark::State& state) { int fd = eventfd(0, EFD_NONBLOCK); ev[0].events = EPOLLIN; epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &ev[0]); - while (state.KeepRunning()) { + for (auto _ : state) { int err; do { err = eventfd_write(fd, 1); diff --git a/test/cpp/microbenchmarks/bm_timer.cc b/test/cpp/microbenchmarks/bm_timer.cc index 53aaead992d..7a493df5826 100644 --- a/test/cpp/microbenchmarks/bm_timer.cc +++ b/test/cpp/microbenchmarks/bm_timer.cc @@ -43,7 +43,7 @@ static void BM_InitCancelTimer(benchmark::State& state) { grpc_core::ExecCtx exec_ctx; std::vector timer_closures(kTimerCount); int i = 0; - while (state.KeepRunning()) { + for (auto _ : state) { TimerClosure* timer_closure = &timer_closures[i++ % kTimerCount]; GRPC_CLOSURE_INIT(&timer_closure->closure, [](void* /*args*/, grpc_error* /*err*/) {}, nullptr, @@ -71,7 +71,7 @@ static void BM_TimerBatch(benchmark::State& state) { TrackCounters track_counters; grpc_core::ExecCtx exec_ctx; std::vector timer_closures(kTimerCount); - while (state.KeepRunning()) { + for (auto _ : state) { for (grpc_millis deadline = start; deadline != end; deadline += increment) { TimerClosure* timer_closure = &timer_closures[deadline % kTimerCount]; GRPC_CLOSURE_INIT(&timer_closure->closure, diff --git a/test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h b/test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h index f399949a32f..db9be84fefb 100644 --- a/test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h +++ b/test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h @@ -65,7 +65,7 @@ static void BM_StreamingPingPong(benchmark::State& state) { std::unique_ptr stub( EchoTestService::NewStub(fixture->channel())); - while (state.KeepRunning()) { + for (auto _ : state) { ServerContext svr_ctx; ServerContextMutator svr_ctx_mut(&svr_ctx); ServerAsyncReaderWriter response_rw(&svr_ctx); @@ -180,7 +180,7 @@ static void BM_StreamingPingPongMsgs(benchmark::State& state) { need_tags &= ~(1 << i); } - while (state.KeepRunning()) { + for (auto _ : state) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); request_rw->Write(send_request, tag(0)); // Start client send response_rw.Read(&recv_request, tag(1)); // Start server recv @@ -262,7 +262,7 @@ static void BM_StreamingPingPongWithCoalescingApi(benchmark::State& state) { std::unique_ptr stub( EchoTestService::NewStub(fixture->channel())); - while (state.KeepRunning()) { + for (auto _ : state) { ServerContext svr_ctx; ServerContextMutator svr_ctx_mut(&svr_ctx); ServerAsyncReaderWriter response_rw(&svr_ctx); diff --git a/test/cpp/microbenchmarks/fullstack_streaming_pump.h b/test/cpp/microbenchmarks/fullstack_streaming_pump.h index 3623e373f6f..cf72710ccb9 100644 --- a/test/cpp/microbenchmarks/fullstack_streaming_pump.h +++ b/test/cpp/microbenchmarks/fullstack_streaming_pump.h @@ -67,7 +67,7 @@ static void BM_PumpStreamClientToServer(benchmark::State& state) { need_tags &= ~(1 << i); } response_rw.Read(&recv_request, tag(0)); - while (state.KeepRunning()) { + for (auto _ : state) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); request_rw->Write(send_request, tag(1)); while (true) { @@ -136,7 +136,7 @@ static void BM_PumpStreamServerToClient(benchmark::State& state) { need_tags &= ~(1 << i); } request_rw->Read(&recv_response, tag(0)); - while (state.KeepRunning()) { + for (auto _ : state) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); response_rw.Write(send_response, tag(1)); while (true) { diff --git a/test/cpp/microbenchmarks/fullstack_unary_ping_pong.h b/test/cpp/microbenchmarks/fullstack_unary_ping_pong.h index 843c8e14862..604e0ed511e 100644 --- a/test/cpp/microbenchmarks/fullstack_unary_ping_pong.h +++ b/test/cpp/microbenchmarks/fullstack_unary_ping_pong.h @@ -71,7 +71,7 @@ static void BM_UnaryPingPong(benchmark::State& state) { fixture->cq(), tag(1)); std::unique_ptr stub( EchoTestService::NewStub(fixture->channel())); - while (state.KeepRunning()) { + for (auto _ : state) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); recv_response.Clear(); ClientContext cli_ctx; diff --git a/test/cpp/microbenchmarks/noop-benchmark.cc b/test/cpp/microbenchmarks/noop-benchmark.cc index 96605215dc6..49ffbf84bef 100644 --- a/test/cpp/microbenchmarks/noop-benchmark.cc +++ b/test/cpp/microbenchmarks/noop-benchmark.cc @@ -22,7 +22,7 @@ #include static void BM_NoOp(benchmark::State& state) { - while (state.KeepRunning()) { + for (auto _ : state) { } } BENCHMARK(BM_NoOp); From 88f5f130dd78bb18f683e7d410f427211500934a Mon Sep 17 00:00:00 2001 From: Steven E Wright Date: Thu, 29 Aug 2019 12:00:02 -0700 Subject: [PATCH 496/661] Fix `shorten-64-to-32` warning in `GRPCChannel` Per: https://github.com/grpc/grpc/issues/20122 this change avoids the `shorten-64-to-32` warning by calling the correct `NSNumber` factory method for an `NSUInteger` (the base type for the `GRPCCompressionAlgorithm` enum) --- src/objective-c/GRPCClient/private/GRPCChannel.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index 1a79fb04a0d..2081d0534fa 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -103,7 +103,7 @@ if (_callOptions.compressionAlgorithm != GRPC_COMPRESS_NONE) { args[@GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM] = - [NSNumber numberWithInt:_callOptions.compressionAlgorithm]; + [NSNumber numberWithInteger:_callOptions.compressionAlgorithm]; } if (_callOptions.keepaliveInterval != 0) { From 9c4de3a983f54a23cbf574356c55be3704ce19f6 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 29 Aug 2019 12:16:36 -0700 Subject: [PATCH 497/661] Move reference to external workspace to OSS-specific file --- BUILD | 8 +++----- bazel/grpc_build_system.bzl | 7 +++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/BUILD b/BUILD index e489bc2584a..d911050b1be 100644 --- a/BUILD +++ b/BUILD @@ -31,6 +31,7 @@ load( "grpc_cc_library", "grpc_generate_one_off_targets", "grpc_upb_proto_library", + "python_config_settings", ) config_setting( @@ -63,11 +64,6 @@ config_setting( values = {"cpu": "x64_windows_msvc"}, ) -config_setting( - name = "python3", - flag_values = {"@bazel_tools//tools/python:python_version": "PY3"}, -) - config_setting( name = "mac_x86_64", values = {"cpu": "darwin"}, @@ -78,6 +74,8 @@ config_setting( values = {"define": "GRPC_USE_CPP_STD_LIB=1"}, ) +python_config_settings() + # This should be updated along with build.yaml g_stands_for = "ganges" diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index f4777e50bc1..74a9c66ff67 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -342,3 +342,10 @@ def grpc_objc_library( def grpc_upb_proto_library(name, deps): upb_proto_library(name = name, deps = deps) + +def python_config_settings(): + native.config_setting( + name = "python3", + flag_values = {"@bazel_tools//tools/python:python_version": "PY3"}, + ) + From aa2a65faedd62be2024e270a88f1001b3f5b2f80 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Thu, 29 Aug 2019 14:08:52 -0700 Subject: [PATCH 498/661] Remove call from queued picks when failing it due to channel destruction --- src/core/ext/filters/client_channel/client_channel.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 3272bc3ffed..8a0fabfa6fd 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -3881,6 +3881,7 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) { GRPC_ERROR_UNREF(result.error); GRPC_CLOSURE_SCHED(&calld->pick_closure_, GRPC_ERROR_REF(disconnect_error)); + if (calld->pick_queued_) calld->RemoveCallFromQueuedPicksLocked(elem); break; } // If wait_for_ready is false, then the error indicates the RPC From 32801fb5eb1b5f50e9282a563eb6226ce602b855 Mon Sep 17 00:00:00 2001 From: Hope Casey-Allen Date: Thu, 29 Aug 2019 14:11:05 -0700 Subject: [PATCH 499/661] Remove build target for microbenchmark --- test/cpp/microbenchmarks/BUILD | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD index fdae8246c31..b8e9b14d4b4 100644 --- a/test/cpp/microbenchmarks/BUILD +++ b/test/cpp/microbenchmarks/BUILD @@ -27,14 +27,6 @@ grpc_cc_test( deps = ["//test/core/util:grpc_test_util"], ) -grpc_cc_binary( - name = "bm_chttp2_transport", - testonly = 1, - srcs = ["bm_chttp2_transport.cc"], - tags = ["no_windows"], - deps = [":helpers"], -) - grpc_cc_library( name = "helpers", testonly = 1, From 8a352221646479bc60dcc4a7e1099cda6e36510c Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 29 Aug 2019 15:52:42 -0700 Subject: [PATCH 500/661] fix Swift build --- src/objective-c/BUILD | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index 5f53486d17e..be1cd09d0fa 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -101,7 +101,7 @@ grpc_objc_library( ) grpc_objc_library( - name = "grpc_objc_client_core", + name = "grpc_objc_client", hdrs = [ "GRPCClient/GRPCCall+ChannelCredentials.h", "GRPCClient/GRPCCall+Cronet.h", @@ -128,9 +128,11 @@ grpc_objc_library( ], ) +# TODO (mxyan): Switch "name" and "actual" when import is done +# Some internal Swift projects will need to be updated with the new name alias( - name = "grpc_objc_client", - actual = "grpc_objc_client_core", + name = "grpc_objc_client_core", + actual = "grpc_objc_client", ) grpc_objc_library( @@ -170,6 +172,7 @@ grpc_objc_library( ], hdrs = [ "ProtoRPC/ProtoMethod.h", + "ProtoRPC/ProtoRPC.h", "ProtoRPC/ProtoRPCLegacy.h", "ProtoRPC/ProtoService.h", ], From d1dae7d9d8cac4366766ca625d902060fa17cd9e Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Thu, 29 Aug 2019 16:50:42 -0700 Subject: [PATCH 501/661] Log errors in ALTS handshaker message op completion cb --- src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc index 917d375fd82..c5383b3a0ba 100644 --- a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +++ b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc @@ -251,7 +251,14 @@ static void on_handshaker_service_resp_recv(void* arg, grpc_error* error) { gpr_log(GPR_ERROR, "ALTS handshaker client is nullptr"); return; } - alts_handshaker_client_handle_response(client, true); + bool success = true; + if (error != GRPC_ERROR_NONE) { + gpr_log(GPR_ERROR, + "ALTS handshaker on_handshaker_service_resp_recv error: %s", + grpc_error_string(error)); + success = false; + } + alts_handshaker_client_handle_response(client, success); } /* gRPC provided callback used when dedicatd CQ and thread are used. From deee1f08268b78b16909e9767f5965aae1d2947a Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Fri, 30 Aug 2019 08:24:38 +0800 Subject: [PATCH 502/661] Update: add offical guide link --- examples/python/data_transmission/README.cn.md | 10 +++++----- examples/python/data_transmission/README.en.md | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/python/data_transmission/README.cn.md b/examples/python/data_transmission/README.cn.md index 500e9bf95de..c5cbb71c41d 100644 --- a/examples/python/data_transmission/README.cn.md +++ b/examples/python/data_transmission/README.cn.md @@ -1,10 +1,10 @@ ## Data transmission demo for using gRPC in Python -在Python中使用gRPC时, 进行数据传输的四种方式。 +在Python中使用gRPC时, 进行数据传输的四种方式 [官方指南]() -- #### 简单模式 +- #### 一元模式 - 没啥好说的,跟调普通方法没差 + 在一次调用中, 客户端只能向服务器传输一次请求数据, 服务器也只能返回一次响应 `client.py - line:13 - simple_method` @@ -12,7 +12,7 @@ - #### 客户端流模式 - 在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应. + 在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应 `clien.py - line:24 - client_streaming_method ` @@ -20,7 +20,7 @@ - #### 服务端流模式 - 在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应 + 在一次调用中, 客户端只能向服务器传输一次请求数据, 但是服务器可以多次返回响应 `clien.py - line:42 - server_streaming_method` diff --git a/examples/python/data_transmission/README.en.md b/examples/python/data_transmission/README.en.md index 7fc527cf51a..f87682f2038 100644 --- a/examples/python/data_transmission/README.en.md +++ b/examples/python/data_transmission/README.en.md @@ -1,10 +1,10 @@ ## Data transmission demo for using gRPC in Python -Four ways of data transmission when gRPC is used in Python. +Four ways of data transmission when gRPC is used in Python. [Offical Guide]() - #### unary-unary - There's nothing to say. It's no different from the usual way. + In a single call, the client can only send request once, and the server can only respond once. `client.py - line:13 - simple_method` From 25a1caa9b08d03729dbd2cce3c2bacd493ef4ce0 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Fri, 30 Aug 2019 08:30:07 +0800 Subject: [PATCH 503/661] Update: add proto3 document link, change chinese translation and comment of 'unary' --- examples/python/data_transmission/client.py | 7 ++++--- examples/python/data_transmission/demo.proto | 20 ++++++++++++-------- examples/python/data_transmission/server.py | 7 ++++--- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/examples/python/data_transmission/client.py b/examples/python/data_transmission/client.py index 21c61d6cc6e..66bfc76450d 100644 --- a/examples/python/data_transmission/client.py +++ b/examples/python/data_transmission/client.py @@ -4,12 +4,13 @@ import grpc import demo_pb2_grpc import demo_pb2 -SERVER_ADDRESS = "localhost:23334" +SERVER_ADDRESS = "localhost:23333" CLIENT_ID = 1 -# 简单模式 -# unary-unary +# 一元模式(在一次调用中, 客户端只能向服务器传输一次请求数据, 服务器也只能返回一次响应) +# unary-unary(In a single call, the client can only send request once, and the server can +# only respond once.) def simple_method(stub): print("--------------Call SimpleMethod Begin--------------") request = demo_pb2.Request(client_id=CLIENT_ID, request_data="called by Python client") diff --git a/examples/python/data_transmission/demo.proto b/examples/python/data_transmission/demo.proto index dd29a178d77..d3d96b523d1 100644 --- a/examples/python/data_transmission/demo.proto +++ b/examples/python/data_transmission/demo.proto @@ -1,9 +1,11 @@ // 语法版本声明,必须放在非注释的第一行 // Syntax version declaration. Must be placed on the first line of non-commentary. + syntax = "proto3"; +// The document of proto3: https://developers.google.com/protocol-buffers/docs/proto3 -// 包名定义, Python中使用时可以省略不写(PS:我还要再Go中使用,所以留在这里了) -// Package name definition, which can be omitted in Python. (PS: I'll use it again in Go, so stay here) +// 包名定义, Python中使用时可以省略不写 +// Package name definition, which can be omitted in Python. package demo; /* @@ -12,8 +14,8 @@ package demo; 总体格式类似于Python中定义一个类或者Golang中定义一个结构体 */ /* -`message` is used to define the structure of the data to be transmitted, After the equal sign is the field number. -Each field in the message definition has a unique number. +`message` is used to define the structure of the data to be transmitted, after the equal sign +is the field number. Each field in the message definition has a unique number. The overall format is similar to defining a class in Python or a structure in Golang. */ message Request { @@ -26,11 +28,13 @@ message Response { string response_data = 2; } -// service是用来给GRPC服务定义方法的, 格式固定, 类似于Golang中定义一个接口 -// `service` is used to define methods for GRPC services in a fixed format, similar to defining an interface in Golang +// `service` 是用来给gRPC服务定义方法的, 格式固定, 类似于Golang中定义一个接口 +// `service` is used to define methods for gRPC services in a fixed format, similar to defining +//an interface in Golang service GRPCDemo { - // 简单模式 - // unary-unary + // 一元模式(在一次调用中, 客户端只能向服务器传输一次请求数据, 服务器也只能返回一次响应) + // unary-unary(In a single call, the client can only send request once, and the server can + // only respond once.) rpc SimpleMethod (Request) returns (Response); // 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) diff --git a/examples/python/data_transmission/server.py b/examples/python/data_transmission/server.py index e6e51e1b733..64c697dd952 100644 --- a/examples/python/data_transmission/server.py +++ b/examples/python/data_transmission/server.py @@ -6,14 +6,15 @@ from concurrent import futures import demo_pb2_grpc import demo_pb2 -SERVER_ADDRESS = 'localhost:23334' +SERVER_ADDRESS = 'localhost:23333' SERVER_ID = 1 class DemoServer(demo_pb2_grpc.GRPCDemoServicer): - # 简单模式 - # unary-unary + # 一元模式(在一次调用中, 客户端只能向服务器传输一次请求数据, 服务器也只能返回一次响应) + # unary-unary(In a single call, the client can only send request once, and the server can + # only respond once.) def SimpleMethod(self, request, context): print("SimpleMethod called by client(%d) the message: %s" % (request.client_id, request.request_data)) response = demo_pb2.Response(server_id=SERVER_ID, response_data="Python server SimpleMethod Ok!!!!") From 5c0fed241d8ac0f7a90899ed262759fc1f57b675 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Fri, 30 Aug 2019 08:44:20 +0800 Subject: [PATCH 504/661] Fix: reformat code with YAPF script, and check with PyLint --- examples/python/data_transmission/client.py | 29 +++++++++++++------ examples/python/data_transmission/server.py | 32 ++++++++++++++------- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/examples/python/data_transmission/client.py b/examples/python/data_transmission/client.py index 66bfc76450d..0a9559ed79a 100644 --- a/examples/python/data_transmission/client.py +++ b/examples/python/data_transmission/client.py @@ -13,9 +13,11 @@ CLIENT_ID = 1 # only respond once.) def simple_method(stub): print("--------------Call SimpleMethod Begin--------------") - request = demo_pb2.Request(client_id=CLIENT_ID, request_data="called by Python client") + request = demo_pb2.Request( + client_id=CLIENT_ID, request_data="called by Python client") response = stub.SimpleMethod(request) - print("resp from server(%d), the message=%s" % (response.server_id, response.response_data)) + print("resp from server(%d), the message=%s" % (response.server_id, + response.response_data)) print("--------------Call SimpleMethod Over---------------") @@ -29,11 +31,14 @@ def client_streaming_method(stub): # create a generator def request_messages(): for i in range(5): - request = demo_pb2.Request(client_id=CLIENT_ID, request_data=("called by Python client, message:%d" % i)) + request = demo_pb2.Request( + client_id=CLIENT_ID, + request_data=("called by Python client, message:%d" % i)) yield request response = stub.ClientStreamingMethod(request_messages()) - print("resp from server(%d), the message=%s" % (response.server_id, response.response_data)) + print("resp from server(%d), the message=%s" % (response.server_id, + response.response_data)) print("--------------Call ClientStreamingMethod Over---------------") @@ -42,10 +47,12 @@ def client_streaming_method(stub): # but the server can return the response many times.) def server_streaming_method(stub): print("--------------Call ServerStreamingMethod Begin--------------") - request = demo_pb2.Request(client_id=CLIENT_ID, request_data="called by Python client") + request = demo_pb2.Request( + client_id=CLIENT_ID, request_data="called by Python client") response_iterator = stub.ServerStreamingMethod(request) for response in response_iterator: - print("recv from server(%d), message=%s" % (response.server_id, response.response_data)) + print("recv from server(%d), message=%s" % (response.server_id, + response.response_data)) print("--------------Call ServerStreamingMethod Over---------------") @@ -54,19 +61,23 @@ def server_streaming_method(stub): # stream-stream (In a single call, both client and server can send and receive data # to each other multiple times.) def bidirectional_streaming_method(stub): - print("--------------Call BidirectionalStreamingMethod Begin---------------") + print( + "--------------Call BidirectionalStreamingMethod Begin---------------") # 创建一个生成器 # create a generator def request_messages(): for i in range(5): - request = demo_pb2.Request(client_id=CLIENT_ID, request_data=("called by Python client, message: %d" % i)) + request = demo_pb2.Request( + client_id=CLIENT_ID, + request_data=("called by Python client, message: %d" % i)) yield request time.sleep(1) response_iterator = stub.BidirectionalStreamingMethod(request_messages()) for response in response_iterator: - print("recv from server(%d), message=%s" % (response.server_id, response.response_data)) + print("recv from server(%d), message=%s" % (response.server_id, + response.response_data)) print("--------------Call BidirectionalStreamingMethod Over---------------") diff --git a/examples/python/data_transmission/server.py b/examples/python/data_transmission/server.py index 64c697dd952..288c561382b 100644 --- a/examples/python/data_transmission/server.py +++ b/examples/python/data_transmission/server.py @@ -1,8 +1,7 @@ -import grpc - from threading import Thread from concurrent import futures +import grpc import demo_pb2_grpc import demo_pb2 @@ -16,8 +15,11 @@ class DemoServer(demo_pb2_grpc.GRPCDemoServicer): # unary-unary(In a single call, the client can only send request once, and the server can # only respond once.) def SimpleMethod(self, request, context): - print("SimpleMethod called by client(%d) the message: %s" % (request.client_id, request.request_data)) - response = demo_pb2.Response(server_id=SERVER_ID, response_data="Python server SimpleMethod Ok!!!!") + print("SimpleMethod called by client(%d) the message: %s" % + (request.client_id, request.request_data)) + response = demo_pb2.Response( + server_id=SERVER_ID, + response_data="Python server SimpleMethod Ok!!!!") return response # 客户端流模式(在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应) @@ -26,22 +28,27 @@ class DemoServer(demo_pb2_grpc.GRPCDemoServicer): def ClientStreamingMethod(self, request_iterator, context): print("ClientStreamingMethod called by client...") for request in request_iterator: - print("recv from client(%d), message= %s" % (request.client_id, request.request_data)) - response = demo_pb2.Response(server_id=SERVER_ID, response_data="Python server ClientStreamingMethod ok") + print("recv from client(%d), message= %s" % (request.client_id, + request.request_data)) + response = demo_pb2.Response( + server_id=SERVER_ID, + response_data="Python server ClientStreamingMethod ok") return response # 服务端流模式(在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应) # unary-stream (In a single call, the client can only transmit data to the server at one time, # but the server can return the response many times.) def ServerStreamingMethod(self, request, context): - print("ServerStreamingMethod called by client(%d), message= %s" % (request.client_id, request.request_data)) + print("ServerStreamingMethod called by client(%d), message= %s" % + (request.client_id, request.request_data)) # 创建一个生成器 # create a generator def response_messages(): for i in range(5): - response = demo_pb2.Response(server_id=SERVER_ID, - response_data=("send by Python server, message=%d" % i)) + response = demo_pb2.Response( + server_id=SERVER_ID, + response_data=("send by Python server, message=%d" % i)) yield response return response_messages() @@ -56,13 +63,16 @@ class DemoServer(demo_pb2_grpc.GRPCDemoServicer): # Open a sub thread to receive data def parse_request(): for request in request_iterator: - print("recv from client(%d), message= %s" % (request.client_id, request.request_data)) + print("recv from client(%d), message= %s" % + (request.client_id, request.request_data)) t = Thread(target=parse_request) t.start() for i in range(5): - yield demo_pb2.Response(server_id=SERVER_ID, response_data=("send by Python server, message= %d" % i)) + yield demo_pb2.Response( + server_id=SERVER_ID, + response_data=("send by Python server, message= %d" % i)) t.join() From 1859799ee326f06768ed7d0845cc1f0268a74d47 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Fri, 30 Aug 2019 08:55:01 +0800 Subject: [PATCH 505/661] Fix: update README because code reformat by YAPF script --- examples/python/data_transmission/README.cn.md | 14 +++++++------- examples/python/data_transmission/README.en.md | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/python/data_transmission/README.cn.md b/examples/python/data_transmission/README.cn.md index c5cbb71c41d..812a8bbb7d6 100644 --- a/examples/python/data_transmission/README.cn.md +++ b/examples/python/data_transmission/README.cn.md @@ -6,7 +6,7 @@ 在一次调用中, 客户端只能向服务器传输一次请求数据, 服务器也只能返回一次响应 - `client.py - line:13 - simple_method` + `client.py - line:14 - simple_method` `server.py - line:17 - SimpleMethod` @@ -14,23 +14,23 @@ 在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应 - `clien.py - line:24 - client_streaming_method ` + `clien.py - line:27 - client_streaming_method ` - `server.py - line:25 - ClientStreamingMethod` + `server.py - line:28 - ClientStreamingMethod` - #### 服务端流模式 在一次调用中, 客户端只能向服务器传输一次请求数据, 但是服务器可以多次返回响应 - `clien.py - line:42 - server_streaming_method` + `clien.py - line:48 - server_streaming_method` - `server.py - line:35 - ServerStreamingMethod` + `server.py - line:41 - ServerStreamingMethod` - #### 双向流模式 在一次调用中, 客户端和服务器都可以向对方多次收发数据 - `client.py - line:55 - bidirectional_streaming_method` + `client.py - line:63 - bidirectional_streaming_method` - `server.py - line:51 - BidirectionalStreamingMethod` + `server.py - line:59 - BidirectionalStreamingMethod` diff --git a/examples/python/data_transmission/README.en.md b/examples/python/data_transmission/README.en.md index f87682f2038..fb834ab80c9 100644 --- a/examples/python/data_transmission/README.en.md +++ b/examples/python/data_transmission/README.en.md @@ -6,31 +6,31 @@ Four ways of data transmission when gRPC is used in Python. [Offical Guide]( Date: Tue, 27 Aug 2019 17:35:49 -0700 Subject: [PATCH 506/661] Added test for time jumps --- test/cpp/common/BUILD | 13 ++ test/cpp/common/time_jump_test.cc | 128 ++++++++++++++++++ .../internal_ci/macos/grpc_run_bazel_tests.sh | 13 +- 3 files changed, 145 insertions(+), 9 deletions(-) create mode 100644 test/cpp/common/time_jump_test.cc diff --git a/test/cpp/common/BUILD b/test/cpp/common/BUILD index f0d0e9a6223..c31eb10344e 100644 --- a/test/cpp/common/BUILD +++ b/test/cpp/common/BUILD @@ -42,6 +42,19 @@ grpc_cc_test( ], ) +grpc_cc_test( + name = "time_jump_test", + srcs = ["time_jump_test.cc"], + external_deps = [ + "gtest", + ], + tags = ["manual"], + deps = [ + "//:grpc++", + "//test/core/util:grpc_test_util", + ], +) + grpc_cc_test( name = "auth_property_iterator_test", srcs = ["auth_property_iterator_test.cc"], diff --git a/test/cpp/common/time_jump_test.cc b/test/cpp/common/time_jump_test.cc new file mode 100644 index 00000000000..86bf012f7c0 --- /dev/null +++ b/test/cpp/common/time_jump_test.cc @@ -0,0 +1,128 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "src/core/lib/gprpp/sync.h" +#include "src/core/lib/iomgr/closure.h" +#include "src/core/lib/iomgr/error.h" +#include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/lib/iomgr/timer.h" +#include "src/core/lib/iomgr/timer_manager.h" +#include "test/core/util/test_config.h" + +extern char** environ; + +void run_cmd(const char* cmd) { + pid_t pid; + const char* argv[] = {const_cast("sh"), + const_cast("-c"), cmd, nullptr}; + int status; + + status = posix_spawn(&pid, const_cast("/bin/sh"), nullptr, + nullptr, const_cast(argv), environ); + if (status == 0) { + if (waitpid(pid, &status, 0) == -1) { + perror("waitpid"); + } + } +} + +class TimeJumpTest : public ::testing::TestWithParam { + protected: + void SetUp() override { grpc_init(); } + void TearDown() override { + run_cmd("sudo sntp -sS pool.ntp.org"); + grpc_shutdown_blocking(); + } + + const int kWaitTimeMs = 1500; +}; + +std::vector CreateTestScenarios() { + return {"-1M", "+1M", "-1H", "+1H", "-1d", "+1d", "-1y", "+1y"}; +} +INSTANTIATE_TEST_CASE_P(TimeJump, TimeJumpTest, + ::testing::ValuesIn(CreateTestScenarios())); + +TEST_P(TimeJumpTest, TimerRunning) { + grpc_core::ExecCtx exec_ctx; + grpc_timer timer; + grpc_timer_init(&timer, grpc_core::ExecCtx::Get()->Now() + 3000, + GRPC_CLOSURE_CREATE( + [](void*, grpc_error* error) { + GPR_ASSERT(error == GRPC_ERROR_CANCELLED); + }, + nullptr, grpc_schedule_on_exec_ctx)); + gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); + std::ostringstream cmd; + cmd << "sudo date `date -v" << GetParam() << " \"+%m%d%H%M%y\"`"; + run_cmd(cmd.str().c_str()); + gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(kWaitTimeMs)); + // We expect 1 wakeup/sec when there are not timer expiries + int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); + gpr_log(GPR_DEBUG, "wakeups: %" PRId64 "", wakeups); + GPR_ASSERT(wakeups <= 3); + grpc_timer_cancel(&timer); +} + +TEST_P(TimeJumpTest, TimedWait) { + grpc_core::CondVar cond; + grpc_core::Mutex mu; + { + grpc_core::MutexLock lock(&mu); + std::thread thd = std::thread([]() { + gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); + std::ostringstream cmd; + cmd << "sudo date `date -v" << GetParam() << " \"+%m%d%H%M%y\"`"; + run_cmd(cmd.str().c_str()); + }); + gpr_timespec before = gpr_now(GPR_CLOCK_MONOTONIC); + int timedout = cond.Wait( + &mu, grpc_millis_to_timespec(kWaitTimeMs, GPR_CLOCK_REALTIME)); + gpr_timespec after = gpr_now(GPR_CLOCK_MONOTONIC); + int32_t elapsed_ms = gpr_time_to_millis(gpr_time_sub(after, before)); + gpr_log(GPR_DEBUG, "After wait, timedout = %d elapsed_ms = %d", timedout, + elapsed_ms); + GPR_ASSERT(1 == timedout); + GPR_ASSERT(1 == + gpr_time_similar(gpr_time_sub(after, before), + gpr_time_from_millis(kWaitTimeMs, GPR_TIMESPAN), + gpr_time_from_millis(10, GPR_TIMESPAN))); + + thd.join(); + } + // We expect 1 wakeup/sec when there are not timer expiries + int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); + gpr_log(GPR_DEBUG, "wakeups: %" PRId64 "", wakeups); + GPR_ASSERT(wakeups <= 3); +} + +int main(int argc, char** argv) { + grpc::testing::TestEnvironment env(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tools/internal_ci/macos/grpc_run_bazel_tests.sh b/tools/internal_ci/macos/grpc_run_bazel_tests.sh index d3db59e9379..aaa2dc3f63c 100644 --- a/tools/internal_ci/macos/grpc_run_bazel_tests.sh +++ b/tools/internal_ci/macos/grpc_run_bazel_tests.sh @@ -18,18 +18,13 @@ set -ex # change to grpc repo root cd $(dirname $0)/../../.. -# Download bazel -temp_dir="$(mktemp -d)" -wget -q https://github.com/bazelbuild/bazel/releases/download/0.26.0/bazel-0.26.0-darwin-x86_64 -O "${temp_dir}/bazel" -chmod 755 "${temp_dir}/bazel" -export PATH="${temp_dir}:${PATH}" -# This should show ${temp_dir}/bazel -which bazel - ./tools/run_tests/start_port_server.py # run cfstream_test separately because it messes with the network -bazel test $RUN_TESTS_FLAGS --spawn_strategy=standalone --genrule_strategy=standalone --test_output=all //test/cpp/end2end:cfstream_test +tools/bazel test $RUN_TESTS_FLAGS --spawn_strategy=standalone --genrule_strategy=standalone --test_output=all //test/cpp/end2end:cfstream_test + +# run time_jump_test separately because it changes system time +tools/bazel test $RUN_TESTS_FLAGS --spawn_strategy=standalone --genrule_strategy=standalone --test_output=all //test/cpp/common:time_jump_test # kill port_server.py to prevent the build from hanging ps aux | grep port_server\\.py | awk '{print $2}' | xargs kill -9 From 65eb9c9ddb188bddaf5b2a1fa2f04812903b7337 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Fri, 30 Aug 2019 08:14:44 -0700 Subject: [PATCH 507/661] Revert "Test message size of 100MB" --- test/core/util/test_config.cc | 4 --- test/core/util/test_config.h | 3 -- test/cpp/end2end/async_end2end_test.cc | 38 ++++---------------------- 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/test/core/util/test_config.cc b/test/core/util/test_config.cc index 5033dc7b66a..5b248a01daa 100644 --- a/test/core/util/test_config.cc +++ b/test/core/util/test_config.cc @@ -342,10 +342,6 @@ bool BuiltUnderUbsan() { #endif } -bool grpc_test_built_under_tsan_or_msan() { - return BuiltUnderTsan() || BuiltUnderMsan(); -}; - int64_t grpc_test_sanitizer_slowdown_factor() { int64_t sanitizer_multiplier = 1; if (BuiltUnderValgrind()) { diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h index 905d61f1dd6..112af3176f9 100644 --- a/test/core/util/test_config.h +++ b/test/core/util/test_config.h @@ -24,9 +24,6 @@ extern int64_t g_fixture_slowdown_factor; extern int64_t g_poller_slowdown_factor; -/* Returns if the test is built under TSAN or MSAN. */ -bool grpc_test_built_under_tsan_or_msan(); - /* Returns an appropriate scaling factor for timeouts. */ int64_t grpc_test_slowdown_factor(); diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 879f16815ee..6ca0edf123e 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -34,7 +34,6 @@ #include "src/core/ext/filters/client_channel/backup_poller.h" #include "src/core/lib/gpr/tls.h" -#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/port.h" #include "src/proto/grpc/health/v1/health.grpc.pb.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" @@ -60,18 +59,6 @@ namespace testing { namespace { -const size_t MAX_TEST_MESSAGE_SIZE = -#if defined(GPR_APPLE) - // The test will time out with macos build. - GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH; -#else - // Don't test extreme size under tsan or msan, because it uses too much - // memory. - grpc_test_built_under_tsan_or_msan() - ? GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH - : GPR_MAX(100 * 1024 * 1024, GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH); -#endif - void* tag(int i) { return (void*)static_cast(i); } int detag(void* p) { return static_cast(reinterpret_cast(p)); } @@ -231,17 +218,6 @@ class ServerBuilderSyncPluginDisabler : public ::grpc::ServerBuilderOption { } }; -class ServerBuilderMaxRecvMessageSizeOption - : public ::grpc::ServerBuilderOption { - public: - void UpdateArguments(ChannelArguments* arg) override { - arg->SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, -1); - } - - void UpdatePlugins( - std::vector>* plugins) override {} -}; - class TestScenario { public: TestScenario(bool inproc_stub, const grpc::string& creds_type, bool hcs, @@ -314,9 +290,6 @@ class AsyncEnd2endTest : public ::testing::TestWithParam { std::unique_ptr sync_plugin_disabler( new ServerBuilderSyncPluginDisabler()); builder.SetOption(move(sync_plugin_disabler)); - std::unique_ptr max_recv_option( - new ServerBuilderMaxRecvMessageSizeOption()); - builder.SetOption(move(max_recv_option)); server_ = builder.BuildAndStart(); } @@ -324,7 +297,6 @@ class AsyncEnd2endTest : public ::testing::TestWithParam { ChannelArguments args; auto channel_creds = GetCredentialsProvider()->GetChannelCredentials( GetParam().credentials_type, &args); - args.SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, -1); std::shared_ptr channel = !(GetParam().inproc) ? ::grpc::CreateCustomChannel( server_address_.str(), channel_creds, args) @@ -1850,7 +1822,7 @@ TEST_P(AsyncEnd2endServerTryCancelTest, ServerBidiStreamingTryCancelAfter) { } std::vector CreateTestScenarios(bool test_secure, - bool test_big_message) { + bool test_message_size_limit) { std::vector scenarios; std::vector credentials_types; std::vector messages; @@ -1872,8 +1844,9 @@ std::vector CreateTestScenarios(bool test_secure, GPR_ASSERT(!credentials_types.empty()); messages.push_back("Hello"); - if (test_big_message) { - for (size_t k = 1; k < MAX_TEST_MESSAGE_SIZE / 1024; k *= 32) { + if (test_message_size_limit) { + for (size_t k = 1; k < GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH / 1024; + k *= 32) { grpc::string big_msg; for (size_t i = 0; i < k * 1024; ++i) { char c = 'a' + (i % 26); @@ -1881,7 +1854,8 @@ std::vector CreateTestScenarios(bool test_secure, } messages.push_back(big_msg); } - messages.push_back(grpc::string(MAX_TEST_MESSAGE_SIZE - 10, 'a')); + messages.push_back( + grpc::string(GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH - 10, 'a')); } // TODO (sreek) Renable tests with health check service after the issue From fa7bdff69f6de851e5b34f9bb112cee7618baa84 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 28 Aug 2019 16:32:00 -0700 Subject: [PATCH 508/661] Fix buffer-overflow in grpc_static_mdelem_for_static_strings --- src/core/lib/transport/static_metadata.cc | 7 +------ tools/codegen/core/gen_static_metadata.py | 3 +-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/core/lib/transport/static_metadata.cc b/src/core/lib/transport/static_metadata.cc index bd6ff09c80d..f412edb1efe 100644 --- a/src/core/lib/transport/static_metadata.cc +++ b/src/core/lib/transport/static_metadata.cc @@ -1217,12 +1217,7 @@ static const uint16_t elem_keys[] = { 9076, 9185, 9294, 9403, 9512, 9621, 6242, 9730, 9839, 9948, 10057, 10166, 1189, 538, 10275, 10384, 212, 10493, 1195, 1196, 1197, 1198, 1080, 10602, 1843, 11365, 0, 0, 0, 1734, 0, 1850, 0, - 0, 0, 356, 1627, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0}; + 0, 0, 356, 1627}; static const uint8_t elem_idxs[] = { 7, 8, 9, 10, 11, 12, 13, 76, 78, 71, 1, 2, 5, 6, 25, 3, 4, 66, 65, 30, 83, 62, 63, 67, 61, 73, 57, 37, 14, 19, 21, 22, diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index 4ac8f9dada7..8560fa47657 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -627,7 +627,6 @@ def perfect_hash(keys, name): return x + p.r[y] return { - 'PHASHRANGE': p.t - 1 + max(p.r), 'PHASHNKEYS': len(p.slots), 'pyfunc': f, 'code': """ @@ -659,7 +658,7 @@ elem_keys = [ elem_hash = perfect_hash(elem_keys, 'elems') print >> C, elem_hash['code'] -keys = [0] * int(elem_hash['PHASHRANGE']) +keys = [0] * int(elem_hash['PHASHNKEYS']) idxs = [255] * int(elem_hash['PHASHNKEYS']) for i, k in enumerate(elem_keys): h = elem_hash['pyfunc'](k) From 2e1cb0d91a3c8c2d2e818d5ea0dfd806cb5f7440 Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Fri, 30 Aug 2019 11:36:46 -0700 Subject: [PATCH 509/661] Don't run time_jump_test under sanitizers --- test/cpp/common/time_jump_test.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/cpp/common/time_jump_test.cc b/test/cpp/common/time_jump_test.cc index 86bf012f7c0..ea6711dfce3 100644 --- a/test/cpp/common/time_jump_test.cc +++ b/test/cpp/common/time_jump_test.cc @@ -53,10 +53,20 @@ void run_cmd(const char* cmd) { class TimeJumpTest : public ::testing::TestWithParam { protected: - void SetUp() override { grpc_init(); } + void SetUp() override { + // Skip test if slowdown factor > 1 + if (grpc_test_slowdown_factor() != 1) { + GTEST_SKIP(); + } else { + grpc_init(); + } + } void TearDown() override { - run_cmd("sudo sntp -sS pool.ntp.org"); - grpc_shutdown_blocking(); + // Skip test if slowdown factor > 1 + if (grpc_test_slowdown_factor() == 1) { + run_cmd("sudo sntp -sS pool.ntp.org"); + grpc_shutdown_blocking(); + } } const int kWaitTimeMs = 1500; From b436758b14fa15200089ca42216f4a41fd0902ca Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Fri, 28 Jun 2019 17:11:02 -0700 Subject: [PATCH 510/661] Added documentation for C++ tests on iOS --- test/cpp/README-iOS.md | 52 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 test/cpp/README-iOS.md diff --git a/test/cpp/README-iOS.md b/test/cpp/README-iOS.md new file mode 100644 index 00000000000..898931085b3 --- /dev/null +++ b/test/cpp/README-iOS.md @@ -0,0 +1,52 @@ +## C++ tests on iOS + +[GTMGoogleTestRunner](https://github.com/google/google-toolbox-for-mac/blob/master/UnitTesting/GTMGoogleTestRunner.mm) is used to convert googletest cases to XCTest that can be run on iOS. GTMGoogleTestRunner doesn't execute the `main` function, so we can't have any test logic in `main`. +However, it's ok to call `::testing::InitGoogleTest` in `main`, as `GTMGoogleTestRunner` [calls InitGoogleTest](https://github.com/google/google-toolbox-for-mac/blob/master/UnitTesting/GTMGoogleTestRunner.mm#L151). +`grpc::testing::TestEnvironment` can also be called from `main`, as it does some test initialization (install crash handler, seed RNG) that's not strictly required to run testcases on iOS. + + +## Porting exising C++ tests to run on iOS + +Please follow these guidelines when porting tests to run on iOS: + +- Tests need to use the googletest framework +- Any setup/teardown code in `main` needs to be moved to `SetUpTestCase`/`TearDownTestCase`, and `TEST` needs to be changed to `TEST_F`. +- [Death tests](https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#death-tests) are not supported on iOS, so use the `*_IF_SUPPORTED()` macros to ensure that your code compiles on iOS. + +For example, the following test +```c++ +TEST(MyTest, TestOne) { + ASSERT_DEATH(ThisShouldDie(), ""); +} + +int main(int argc, char** argv) { + grpc::testing::TestEnvironment env(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + grpc_init(); + return RUN_ALL_TESTS(); + grpc_shutdown(); +} +``` + +should be changed to +```c++ +class MyTest : public ::testing::Test { + protected: + static void SetUpTestCase() { grpc_init(); } + static void TearDownTestCase() { grpc_shutdown(); } +}; + +TEST_F(MyTest, TestOne) { + ASSERT_DEATH_IF_SUPPORTED(ThisShouldDie(), ""); +} + +int main(int argc, char** argv) { + grpc::testing::TestEnvironment env(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} +``` + +## Limitations + +Due to a [limitation](https://github.com/google/google-toolbox-for-mac/blob/master/UnitTesting/GTMGoogleTestRunner.mm#L48-L56) in GTMGoogleTestRunner, `SetUpTestCase`/`TeardownTestCase` will be called before/after *every* individual test case, similar to `SetUp`/`TearDown`. From 3c6bb96a1fbc07a59e4def4600e5e0249e98ab53 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 30 Aug 2019 12:12:26 -0700 Subject: [PATCH 511/661] Add test for static elements --- test/core/transport/BUILD | 14 ++++++ test/core/transport/static_metadata_test.cc | 51 +++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 test/core/transport/static_metadata_test.cc diff --git a/test/core/transport/BUILD b/test/core/transport/BUILD index f38ecf2f66b..44e4fcb978e 100644 --- a/test/core/transport/BUILD +++ b/test/core/transport/BUILD @@ -82,6 +82,20 @@ grpc_cc_test( ], ) +grpc_cc_test( + name = "static_metadata_test", + srcs = ["static_metadata_test.cc"], + external_deps = [ + "gtest", + ], + language = "C++", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], +) + grpc_cc_test( name = "status_conversion_test", srcs = ["status_conversion_test.cc"], diff --git a/test/core/transport/static_metadata_test.cc b/test/core/transport/static_metadata_test.cc new file mode 100644 index 00000000000..6d3d5ef5c37 --- /dev/null +++ b/test/core/transport/static_metadata_test.cc @@ -0,0 +1,51 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#include + +#include "src/core/lib/transport/metadata.h" +#include "src/core/lib/transport/static_metadata.h" +#include "test/core/util/test_config.h" + +namespace grpc_core { +namespace { + +TEST(StaticMetadataTest, ReadAllStaticElements) { + // This makes sure that all static elements are returned when + // grpc_mdelem_from_slices is called with key pairs pregenerated. + for (int i = 0; i < GRPC_STATIC_MDELEM_COUNT; i++) { + const grpc_mdelem mdelem = grpc_static_mdelem_manifested()[i]; + const grpc_mdelem mdelem2 = + grpc_mdelem_from_slices(GRPC_MDKEY(mdelem), GRPC_MDVALUE(mdelem)); + EXPECT_EQ(mdelem.payload, mdelem2.payload); + } +} + +} // namespace +} // namespace grpc_core + +int main(int argc, char** argv) { + grpc_init(); + grpc::testing::TestEnvironment env(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + int retval = RUN_ALL_TESTS(); + grpc_shutdown(); + return retval; +} From a96cbbd592af2f705402b28e3f0337cff54d7d27 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 28 Aug 2019 16:39:08 -0700 Subject: [PATCH 512/661] Fix ubsan on InternNewStringLocked --- src/core/lib/slice/slice_intern.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/lib/slice/slice_intern.cc b/src/core/lib/slice/slice_intern.cc index d813e5195ad..369135c9eac 100644 --- a/src/core/lib/slice/slice_intern.cc +++ b/src/core/lib/slice/slice_intern.cc @@ -208,7 +208,11 @@ static InternedSliceRefcount* InternNewStringLocked(slice_shard* shard, InternedSliceRefcount* s = static_cast(gpr_malloc(sizeof(*s) + len)); new (s) grpc_core::InternedSliceRefcount(len, hash, shard->strs[shard_idx]); - memcpy(reinterpret_cast(s + 1), buffer, len); + // TODO(arjunroy): Investigate why hpack tried to intern the nullptr string. + // https://github.com/grpc/grpc/pull/20110#issuecomment-526729282 + if (len > 0) { + memcpy(reinterpret_cast(s + 1), buffer, len); + } shard->strs[shard_idx] = s; shard->count++; if (shard->count > shard->capacity * 2) { From e6ffb2c3bb97046605de54d4a74516d728aa6ae4 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Fri, 30 Aug 2019 14:36:35 -0700 Subject: [PATCH 513/661] Replace direct closure callback calls with GRPC_CLOSURE_SCHED --- src/core/ext/transport/chttp2/server/chttp2_server.cc | 2 +- src/core/lib/iomgr/tcp_posix.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc index 5e9cd77d18a..c0ae64eb2cc 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.cc +++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc @@ -266,7 +266,7 @@ static void tcp_server_shutdown_complete(void* arg, grpc_error* error) { // may do a synchronous unref. grpc_core::ExecCtx::Get()->Flush(); if (destroy_done != nullptr) { - destroy_done->cb(destroy_done->cb_arg, GRPC_ERROR_REF(error)); + GRPC_CLOSURE_SCHED(destroy_done, GRPC_ERROR_REF(error)); grpc_core::ExecCtx::Get()->Flush(); } grpc_channel_args_destroy(state->args); diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index 498aecc069b..f0c591d1c6d 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -1020,7 +1020,7 @@ static void tcp_handle_write(void* arg /* grpc_tcp */, grpc_error* error) { if (error != GRPC_ERROR_NONE) { cb = tcp->write_cb; tcp->write_cb = nullptr; - cb->cb(cb->cb_arg, error); + GRPC_CLOSURE_SCHED(cb, error); TCP_UNREF(tcp, "write"); return; } From 3476df0b5021b7517d8c756ffdffc771349e8964 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Fri, 30 Aug 2019 15:04:06 -0700 Subject: [PATCH 514/661] Add in ref to error --- src/core/lib/iomgr/tcp_posix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index f0c591d1c6d..571c7d229f2 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -1020,7 +1020,7 @@ static void tcp_handle_write(void* arg /* grpc_tcp */, grpc_error* error) { if (error != GRPC_ERROR_NONE) { cb = tcp->write_cb; tcp->write_cb = nullptr; - GRPC_CLOSURE_SCHED(cb, error); + GRPC_CLOSURE_SCHED(cb, GRPC_ERROR_REF(error)); TCP_UNREF(tcp, "write"); return; } From 7315e75ce6c8cea17196f9c0f907187caa851437 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Fri, 30 Aug 2019 15:25:50 -0700 Subject: [PATCH 515/661] Add comments --- src/core/lib/iomgr/tcp_posix.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index 571c7d229f2..b6d1381298a 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -1030,6 +1030,8 @@ static void tcp_handle_write(void* arg /* grpc_tcp */, grpc_error* error) { gpr_log(GPR_INFO, "write: delayed"); } notify_on_write(tcp); + // tcp_flush does not populate error if it has returned false. + GPR_DEBUG_ASSERT(error == GRPC_ERROR_NONE); } else { cb = tcp->write_cb; tcp->write_cb = nullptr; @@ -1037,6 +1039,7 @@ static void tcp_handle_write(void* arg /* grpc_tcp */, grpc_error* error) { const char* str = grpc_error_string(error); gpr_log(GPR_INFO, "write: %s", str); } + // No need to take a ref on error since tcp_flush provides a ref. GRPC_CLOSURE_SCHED(cb, error); TCP_UNREF(tcp, "write"); } From d6498800441e68e22854ee7daf94cadb709ffac9 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Fri, 30 Aug 2019 16:39:02 -0700 Subject: [PATCH 516/661] Add strip_prefix to python protoc plugin and py_grpc_library --- bazel/python_rules.bzl | 11 +++++- examples/python/debug/get_stats.py | 9 ++--- src/compiler/generator_helpers.h | 9 ++--- src/compiler/python_generator.cc | 35 ++++++++++++++++--- .../grpc_channelz/v1/BUILD.bazel | 1 + .../grpc_channelz/v1/channelz.py | 9 ++--- .../grpc_health/v1/BUILD.bazel | 1 + .../grpc_health/v1/health.py | 9 ++--- .../grpc_reflection/v1alpha/BUILD.bazel | 1 + .../grpc_reflection/v1alpha/reflection.py | 11 ++---- .../tests/channelz/_channelz_servicer_test.py | 12 ++----- .../health_check/_health_servicer_test.py | 12 ++----- .../reflection/_reflection_servicer_test.py | 12 ++----- 13 files changed, 66 insertions(+), 66 deletions(-) diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl index 12f51f8b172..0cdd2b9739c 100644 --- a/bazel/python_rules.bzl +++ b/bazel/python_rules.bzl @@ -93,11 +93,13 @@ def _generate_pb2_grpc_src_impl(context): proto_root = get_proto_root(context.label.workspace_root) out_files = declare_out_files(protos, context, _GENERATED_GRPC_PROTO_FORMAT) + plugin_flags = ["grpc_2_0"] + context.attr.strip_prefixes + arguments = [] tools = [context.executable._protoc, context.executable._plugin] arguments += get_plugin_args( context.executable._plugin, - [], + plugin_flags, context.genfiles_dir.path, False, ) @@ -127,6 +129,7 @@ _generate_pb2_grpc_src = rule( allow_empty = False, providers = [ProtoInfo], ), + "strip_prefixes": attr.string_list(), "_plugin": attr.label( executable = True, providers = ["files_to_run"], @@ -147,6 +150,7 @@ def py_grpc_library( name, srcs, deps, + strip_prefixes = [], **kwargs): """Generate python code for gRPC services defined in a protobuf. @@ -156,6 +160,10 @@ def py_grpc_library( schema of the service. deps: (List of `labels`) a single py_proto_library target for the proto_library in `srcs`. + strip_prefixes: (List of `strings`) If provided, this prefix will be + stripped from the beginning of foo_pb2 modules imported by the + generated stubs. This is useful in combination with the `imports` + attribute of the `py_library` rule. """ codegen_grpc_target = "_{}_grpc_codegen".format(name) if len(srcs) != 1: @@ -167,6 +175,7 @@ def py_grpc_library( _generate_pb2_grpc_src( name = codegen_grpc_target, deps = srcs, + strip_prefixes = strip_prefixes, **kwargs ) diff --git a/examples/python/debug/get_stats.py b/examples/python/debug/get_stats.py index 2da51d0efcf..d8cb08df55e 100644 --- a/examples/python/debug/get_stats.py +++ b/examples/python/debug/get_stats.py @@ -21,13 +21,8 @@ import logging import argparse import grpc -# TODO(https://github.com/grpc/grpc/issues/19863): Remove. -try: - from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2 - from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2_grpc -except ImportError: - from grpc_channelz.v1 import channelz_pb2 - from grpc_channelz.v1 import channelz_pb2_grpc +from grpc_channelz.v1 import channelz_pb2 +from grpc_channelz.v1 import channelz_pb2_grpc def run(addr): diff --git a/src/compiler/generator_helpers.h b/src/compiler/generator_helpers.h index 747096f0657..0f261fb5a83 100644 --- a/src/compiler/generator_helpers.h +++ b/src/compiler/generator_helpers.h @@ -168,10 +168,11 @@ inline MethodType GetMethodType( inline void Split(const grpc::string& s, char delim, std::vector* append_to) { - std::istringstream iss(s); - grpc::string piece; - while (std::getline(iss, piece)) { - append_to->push_back(piece); + auto current = s.begin(); + while (current <= s.end()) { + auto next = std::find(current, s.end(), delim); + append_to->emplace_back(current, next); + current = next + 1; } } diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index 705aef1c884..7afb2c532e0 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -756,6 +756,28 @@ static bool GenerateGrpc(GeneratorContext* context, PrivateGenerator& generator, } } +static bool ParseParameters(const grpc::string& parameter, + grpc::string* grpc_version, + std::vector* strip_prefixes, + grpc::string* error) { + std::vector comma_delimited_parameters; + grpc_generator::Split(parameter, ',', &comma_delimited_parameters); + if (comma_delimited_parameters.empty()) { + *grpc_version = "grpc_2_0"; + } else if (comma_delimited_parameters.size() == 1) { + *grpc_version = comma_delimited_parameters[0]; + } else if (comma_delimited_parameters.size() == 2) { + *grpc_version = comma_delimited_parameters[0]; + std::copy(comma_delimited_parameters.begin() + 1, + comma_delimited_parameters.end(), + std::back_inserter(*strip_prefixes)); + } else { + *error = "--grpc_python_out received too many comma-delimited parameters."; + return false; + } + return true; +} + bool PythonGrpcGenerator::Generate(const FileDescriptor* file, const grpc::string& parameter, GeneratorContext* context, @@ -778,14 +800,19 @@ bool PythonGrpcGenerator::Generate(const FileDescriptor* file, generator_file_name = file->name(); ProtoBufFile pbfile(file); - PrivateGenerator generator(config_, &pbfile); - if (parameter == "" || parameter == "grpc_2_0") { + grpc::string grpc_version; + GeneratorConfiguration extended_config(config_); + bool success = ParseParameters(parameter, &grpc_version, + &(extended_config.prefixes_to_filter), error); + PrivateGenerator generator(extended_config, &pbfile); + if (!success) return false; + if (grpc_version == "grpc_2_0") { return GenerateGrpc(context, generator, pb2_grpc_file_name, true); - } else if (parameter == "grpc_1_0") { + } else if (grpc_version == "grpc_1_0") { return GenerateGrpc(context, generator, pb2_grpc_file_name, true) && GenerateGrpc(context, generator, pb2_file_name, false); } else { - *error = "Invalid parameter '" + parameter + "'."; + *error = "Invalid grpc version '" + grpc_version + "'."; return false; } } diff --git a/src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel b/src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel index 5f4e512e9f4..c034297ff2d 100644 --- a/src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel +++ b/src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel @@ -10,6 +10,7 @@ py_grpc_library( name = "channelz_py_pb2_grpc", srcs = ["//src/proto/grpc/channelz:channelz_proto_descriptors"], deps = [":channelz_py_pb2"], + strip_prefixes = ["src.python.grpcio_channelz."], ) py_library( diff --git a/src/python/grpcio_channelz/grpc_channelz/v1/channelz.py b/src/python/grpcio_channelz/grpc_channelz/v1/channelz.py index 965797f89ec..00eca311dc1 100644 --- a/src/python/grpcio_channelz/grpc_channelz/v1/channelz.py +++ b/src/python/grpcio_channelz/grpc_channelz/v1/channelz.py @@ -16,13 +16,8 @@ import grpc from grpc._cython import cygrpc -# TODO(https://github.com/grpc/grpc/issues/19863): Remove. -try: - from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2 as _channelz_pb2 - from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2_grpc as _channelz_pb2_grpc -except ImportError: - import grpc_channelz.v1.channelz_pb2 as _channelz_pb2 - import grpc_channelz.v1.channelz_pb2_grpc as _channelz_pb2_grpc +import grpc_channelz.v1.channelz_pb2 as _channelz_pb2 +import grpc_channelz.v1.channelz_pb2_grpc as _channelz_pb2_grpc from google.protobuf import json_format diff --git a/src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel b/src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel index 62a44df7707..a3e2c7dfe3d 100644 --- a/src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel +++ b/src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel @@ -10,6 +10,7 @@ py_grpc_library( name = "health_py_pb2_grpc", srcs = ["//src/proto/grpc/health/v1:health_proto_descriptor",], deps = [":health_py_pb2"], + strip_prefixes = ["src.python.grpcio_health_checking."], ) py_library( diff --git a/src/python/grpcio_health_checking/grpc_health/v1/health.py b/src/python/grpcio_health_checking/grpc_health/v1/health.py index a0d55570990..15494fafdbc 100644 --- a/src/python/grpcio_health_checking/grpc_health/v1/health.py +++ b/src/python/grpcio_health_checking/grpc_health/v1/health.py @@ -18,13 +18,8 @@ import threading import grpc -# TODO(https://github.com/grpc/grpc/issues/19863): Remove. -try: - from src.python.grpcio_health_checking.grpc_health.v1 import health_pb2 as _health_pb2 - from src.python.grpcio_health_checking.grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc -except ImportError: - from grpc_health.v1 import health_pb2 as _health_pb2 - from grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc +from grpc_health.v1 import health_pb2 as _health_pb2 +from grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc SERVICE_NAME = _health_pb2.DESCRIPTOR.services_by_name['Health'].full_name diff --git a/src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel b/src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel index 10077fd9568..bad54d06c63 100644 --- a/src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel +++ b/src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel @@ -12,6 +12,7 @@ py_grpc_library( name = "reflection_py_pb2_grpc", srcs = ["//src/proto/grpc/reflection/v1alpha:reflection_proto_descriptor",], deps = ["reflection_py_pb2"], + strip_prefixes = ["src.python.grpcio_reflection."], ) py_library( diff --git a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py index 61153d9d625..6df1a364269 100644 --- a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py +++ b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py @@ -17,15 +17,8 @@ import grpc from google.protobuf import descriptor_pb2 from google.protobuf import descriptor_pool -# TODO(https://github.com/grpc/grpc/issues/19863): Remove. -try: - from src.python.grpcio_reflection.grpc_reflection.v1alpha \ - import reflection_pb2 as _reflection_pb2 - from src.python.grpcio_reflection.grpc_reflection.v1alpha \ - import reflection_pb2_grpc as _reflection_pb2_grpc -except ImportError: - from grpc_reflection.v1alpha import reflection_pb2 as _reflection_pb2 - from grpc_reflection.v1alpha import reflection_pb2_grpc as _reflection_pb2_grpc +from grpc_reflection.v1alpha import reflection_pb2 as _reflection_pb2 +from grpc_reflection.v1alpha import reflection_pb2_grpc as _reflection_pb2_grpc _POOL = descriptor_pool.Default() SERVICE_NAME = _reflection_pb2.DESCRIPTOR.services_by_name[ diff --git a/src/python/grpcio_tests/tests/channelz/_channelz_servicer_test.py b/src/python/grpcio_tests/tests/channelz/_channelz_servicer_test.py index f2357a4e4a3..48d25e99e35 100644 --- a/src/python/grpcio_tests/tests/channelz/_channelz_servicer_test.py +++ b/src/python/grpcio_tests/tests/channelz/_channelz_servicer_test.py @@ -19,15 +19,9 @@ from concurrent import futures import grpc -# TODO(https://github.com/grpc/grpc/issues/19863): Remove. -try: - from src.python.grpcio_channelz.grpc_channelz.v1 import channelz - from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2 - from src.python.grpcio_channelz.grpc_channelz.v1 import channelz_pb2_grpc -except ImportError: - from grpc_channelz.v1 import channelz - from grpc_channelz.v1 import channelz_pb2 - from grpc_channelz.v1 import channelz_pb2_grpc +from grpc_channelz.v1 import channelz +from grpc_channelz.v1 import channelz_pb2 +from grpc_channelz.v1 import channelz_pb2_grpc from tests.unit import test_common from tests.unit.framework.common import test_constants diff --git a/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py b/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py index 428806c71b0..8faffb448c3 100644 --- a/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py +++ b/src/python/grpcio_tests/tests/health_check/_health_servicer_test.py @@ -20,15 +20,9 @@ import unittest import grpc -# TODO(https://github.com/grpc/grpc/issues/19863): Remove. -try: - from src.python.grpcio_health_checking.grpc_health.v1 import health - from src.python.grpcio_health_checking.grpc_health.v1 import health_pb2 - from src.python.grpcio_health_checking.grpc_health.v1 import health_pb2_grpc -except ImportError: - from grpc_health.v1 import health - from grpc_health.v1 import health_pb2 - from grpc_health.v1 import health_pb2_grpc +from grpc_health.v1 import health +from grpc_health.v1 import health_pb2 +from grpc_health.v1 import health_pb2_grpc from tests.unit import test_common from tests.unit import thread_pool diff --git a/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py b/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py index e45f98abec6..169e55022da 100644 --- a/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py +++ b/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py @@ -17,15 +17,9 @@ import unittest import grpc -# TODO(https://github.com/grpc/grpc/issues/19863): Remove. -try: - from src.python.grpcio_reflection.grpc_reflection.v1alpha import reflection - from src.python.grpcio_reflection.grpc_reflection.v1alpha import reflection_pb2 - from src.python.grpcio_reflection.grpc_reflection.v1alpha import reflection_pb2_grpc -except ImportError: - from grpc_reflection.v1alpha import reflection - from grpc_reflection.v1alpha import reflection_pb2 - from grpc_reflection.v1alpha import reflection_pb2_grpc +from grpc_reflection.v1alpha import reflection +from grpc_reflection.v1alpha import reflection_pb2 +from grpc_reflection.v1alpha import reflection_pb2_grpc from google.protobuf import descriptor_pool from google.protobuf import descriptor_pb2 From 358676db444d84db7412c695101c6b2f0e9774fd Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Fri, 30 Aug 2019 17:53:41 -0700 Subject: [PATCH 517/661] Alright. We'll do our own thing then --- src/compiler/generator_helpers.h | 9 ++++----- src/compiler/python_generator.cc | 2 +- src/compiler/python_generator_helpers.h | 10 ++++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/compiler/generator_helpers.h b/src/compiler/generator_helpers.h index 0f261fb5a83..747096f0657 100644 --- a/src/compiler/generator_helpers.h +++ b/src/compiler/generator_helpers.h @@ -168,11 +168,10 @@ inline MethodType GetMethodType( inline void Split(const grpc::string& s, char delim, std::vector* append_to) { - auto current = s.begin(); - while (current <= s.end()) { - auto next = std::find(current, s.end(), delim); - append_to->emplace_back(current, next); - current = next + 1; + std::istringstream iss(s); + grpc::string piece; + while (std::getline(iss, piece)) { + append_to->push_back(piece); } } diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index 7afb2c532e0..0e76c95aed4 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -761,7 +761,7 @@ static bool ParseParameters(const grpc::string& parameter, std::vector* strip_prefixes, grpc::string* error) { std::vector comma_delimited_parameters; - grpc_generator::Split(parameter, ',', &comma_delimited_parameters); + grpc_python_generator::Split(parameter, ',', &comma_delimited_parameters); if (comma_delimited_parameters.empty()) { *grpc_version = "grpc_2_0"; } else if (comma_delimited_parameters.size() == 1) { diff --git a/src/compiler/python_generator_helpers.h b/src/compiler/python_generator_helpers.h index 171dd730a24..862292db475 100644 --- a/src/compiler/python_generator_helpers.h +++ b/src/compiler/python_generator_helpers.h @@ -136,6 +136,16 @@ StringVector get_all_comments(const DescriptorType* descriptor) { return comments; } +inline void Split(const grpc::string& s, char delim, + std::vector* append_to) { + auto current = s.begin(); + while (current <= s.end()) { + auto next = std::find(current, s.end(), delim); + append_to->emplace_back(current, next); + current = next + 1; + } +} + } // namespace } // namespace grpc_python_generator From e6fe85bc2ddb12bf2960fd27dc6f90a0e29d3ec5 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Fri, 30 Aug 2019 18:20:49 -0700 Subject: [PATCH 518/661] Properly handle default case --- src/compiler/python_generator.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index 0e76c95aed4..f553d9e7a3c 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -762,7 +762,8 @@ static bool ParseParameters(const grpc::string& parameter, grpc::string* error) { std::vector comma_delimited_parameters; grpc_python_generator::Split(parameter, ',', &comma_delimited_parameters); - if (comma_delimited_parameters.empty()) { + if (comma_delimited_parameters.size() == 1 && + comma_delimited_parameters.empty()) { *grpc_version = "grpc_2_0"; } else if (comma_delimited_parameters.size() == 1) { *grpc_version = comma_delimited_parameters[0]; From e5e2b79c01cec333257ea5ec011128348e6d2a88 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sat, 31 Aug 2019 22:10:33 -0700 Subject: [PATCH 519/661] GRPCTransportId -> GRPCTransportID --- src/objective-c/GRPCClient/GRPCCall+Cronet.h | 2 +- src/objective-c/GRPCClient/GRPCCall+Cronet.m | 2 +- src/objective-c/GRPCClient/GRPCCallOptions.h | 4 ++-- src/objective-c/GRPCClient/GRPCCallOptions.m | 8 ++++---- src/objective-c/GRPCClient/GRPCInterceptor.h | 2 +- src/objective-c/GRPCClient/GRPCInterceptor.m | 4 ++-- src/objective-c/GRPCClient/GRPCTransport.h | 10 +++++----- src/objective-c/GRPCClient/GRPCTransport.m | 14 +++++++------- src/objective-c/GRPCClient/GRPCTypes.h | 2 +- .../GRPCClient/private/GRPCTransport+Private.h | 4 ++-- .../GRPCClient/private/GRPCTransport+Private.m | 4 ++-- .../CronetTests/InteropTestsRemoteWithCronet.m | 2 +- src/objective-c/tests/InteropTests/InteropTests.h | 2 +- src/objective-c/tests/InteropTests/InteropTests.m | 2 +- .../InteropTests/InteropTestsLocalCleartext.m | 2 +- .../tests/InteropTests/InteropTestsLocalSSL.m | 2 +- 16 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.h b/src/objective-c/GRPCClient/GRPCCall+Cronet.h index d107ada3672..10cea963631 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.h +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.h @@ -22,7 +22,7 @@ typedef struct stream_engine stream_engine; // Transport id for Cronet transport -extern const GRPCTransportId gGRPCCoreCronetId; +extern const GRPCTransportID gGRPCCoreCronetId; // Deprecated class. Please use the gGRPCCoreCronetId with GRPCCallOptions.transport instead. @interface GRPCCall (Cronet) diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.m b/src/objective-c/GRPCClient/GRPCCall+Cronet.m index a732208e1f6..33b09136b33 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.m +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.m @@ -18,7 +18,7 @@ #import "GRPCCall+Cronet.h" -const GRPCTransportId gGRPCCoreCronetId = "io.grpc.transport.core.cronet"; +const GRPCTransportID gGRPCCoreCronetId = "io.grpc.transport.core.cronet"; static BOOL useCronet = NO; static stream_engine *globalCronetEngine; diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.h b/src/objective-c/GRPCClient/GRPCCallOptions.h index e4261b5b5f9..adb4ecad48e 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.h +++ b/src/objective-c/GRPCClient/GRPCCallOptions.h @@ -161,7 +161,7 @@ NS_ASSUME_NONNULL_BEGIN * * This is currently an experimental option. */ -@property(readonly) GRPCTransportId transport; +@property(readonly) GRPCTransportID transport; /** * Override the hostname during the TLS hostname validation process. @@ -339,7 +339,7 @@ NS_ASSUME_NONNULL_BEGIN * * An interceptor must not change the value of this option. */ -@property(readwrite) GRPCTransportId transport; +@property(readwrite) GRPCTransportID transport; /** * Override the hostname during the TLS hostname validation process. diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.m b/src/objective-c/GRPCClient/GRPCCallOptions.m index 7f88098eb6f..f9044ddcd34 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.m +++ b/src/objective-c/GRPCClient/GRPCCallOptions.m @@ -42,7 +42,7 @@ static NSString *const kDefaultPEMCertificateChain = nil; static NSString *const kDefaultOauth2AccessToken = nil; static const id kDefaultAuthTokenProvider = nil; static const GRPCTransportType kDefaultTransportType = GRPCTransportTypeChttp2BoringSSL; -static const GRPCTransportId kDefaultTransport = NULL; +static const GRPCTransportID kDefaultTransport = NULL; static NSString *const kDefaultHostNameOverride = nil; static const id kDefaultLogContext = nil; static NSString *const kDefaultChannelPoolDomain = nil; @@ -82,7 +82,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { NSString *_PEMPrivateKey; NSString *_PEMCertificateChain; GRPCTransportType _transportType; - GRPCTransportId _transport; + GRPCTransportID _transport; NSString *_hostNameOverride; id _logContext; NSString *_channelPoolDomain; @@ -166,7 +166,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { PEMPrivateKey:(NSString *)PEMPrivateKey PEMCertificateChain:(NSString *)PEMCertificateChain transportType:(GRPCTransportType)transportType - transport:(GRPCTransportId)transport + transport:(GRPCTransportID)transport hostNameOverride:(NSString *)hostNameOverride logContext:(id)logContext channelPoolDomain:(NSString *)channelPoolDomain @@ -553,7 +553,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { _transportType = transportType; } -- (void)setTransport:(GRPCTransportId)transport { +- (void)setTransport:(GRPCTransportID)transport { _transport = transport; } diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.h b/src/objective-c/GRPCClient/GRPCInterceptor.h index 509749769b3..1794ef4b892 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.h +++ b/src/objective-c/GRPCClient/GRPCInterceptor.h @@ -177,7 +177,7 @@ NS_ASSUME_NONNULL_BEGIN - (nullable instancetype)initWithFactories:(nullable NSArray> *)factories previousInterceptor:(nullable id)previousInterceptor - transportId:(GRPCTransportId)transportId; + transportId:(GRPCTransportID)transportId; /** * Notify the manager that the interceptor has shut down and the manager should release references diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.m b/src/objective-c/GRPCClient/GRPCInterceptor.m index a7ffe05bddc..abada5a80c1 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.m +++ b/src/objective-c/GRPCClient/GRPCInterceptor.m @@ -31,13 +31,13 @@ GRPCInterceptor *_thisInterceptor; dispatch_queue_t _dispatchQueue; NSArray> *_factories; - GRPCTransportId _transportId; + GRPCTransportID _transportId; BOOL _shutDown; } - (instancetype)initWithFactories:(NSArray> *)factories previousInterceptor:(id)previousInterceptor - transportId:(nonnull GRPCTransportId)transportId { + transportId:(nonnull GRPCTransportID)transportId { if ((self = [super init])) { if (factories.count == 0) { [NSException raise:NSInternalInconsistencyException diff --git a/src/objective-c/GRPCClient/GRPCTransport.h b/src/objective-c/GRPCClient/GRPCTransport.h index d5637922152..d9f341d08a3 100644 --- a/src/objective-c/GRPCClient/GRPCTransport.h +++ b/src/objective-c/GRPCClient/GRPCTransport.h @@ -29,15 +29,15 @@ NS_ASSUME_NONNULL_BEGIN * by gRPC by default unless explicitly excluded. */ extern const struct GRPCDefaultTransportImplList { - const GRPCTransportId core_secure; - const GRPCTransportId core_insecure; + const GRPCTransportID core_secure; + const GRPCTransportID core_insecure; } GRPCDefaultTransportImplList; /** Returns whether two transport id's are identical. */ -BOOL TransportIdIsEqual(GRPCTransportId lhs, GRPCTransportId rhs); +BOOL TransportIdIsEqual(GRPCTransportID lhs, GRPCTransportID rhs); /** Returns the hash value of a transport id. */ -NSUInteger TransportIdHash(GRPCTransportId); +NSUInteger TransportIdHash(GRPCTransportID); #pragma mark Transport and factory @@ -66,7 +66,7 @@ NSUInteger TransportIdHash(GRPCTransportId); * Parameter \a transportId is the identifier of the implementation, and \a factory is the factory * object to create the corresponding transport instance. */ -- (void)registerTransportWithId:(GRPCTransportId)transportId +- (void)registerTransportWithId:(GRPCTransportID)transportId factory:(id)factory; @end diff --git a/src/objective-c/GRPCClient/GRPCTransport.m b/src/objective-c/GRPCClient/GRPCTransport.m index 439acfb9cc2..966dc50d64d 100644 --- a/src/objective-c/GRPCClient/GRPCTransport.m +++ b/src/objective-c/GRPCClient/GRPCTransport.m @@ -18,24 +18,24 @@ #import "GRPCTransport.h" -static const GRPCTransportId gGRPCCoreSecureId = "io.grpc.transport.core.secure"; -static const GRPCTransportId gGRPCCoreInsecureId = "io.grpc.transport.core.insecure"; +static const GRPCTransportID gGRPCCoreSecureId = "io.grpc.transport.core.secure"; +static const GRPCTransportID gGRPCCoreInsecureId = "io.grpc.transport.core.insecure"; const struct GRPCDefaultTransportImplList GRPCDefaultTransportImplList = { .core_secure = gGRPCCoreSecureId, .core_insecure = gGRPCCoreInsecureId}; -static const GRPCTransportId gDefaultTransportId = gGRPCCoreSecureId; +static const GRPCTransportID gDefaultTransportId = gGRPCCoreSecureId; static GRPCTransportRegistry *gTransportRegistry = nil; static dispatch_once_t initTransportRegistry; -BOOL TransportIdIsEqual(GRPCTransportId lhs, GRPCTransportId rhs) { +BOOL TransportIdIsEqual(GRPCTransportID lhs, GRPCTransportID rhs) { // Directly comparing pointers works because we require users to use the id provided by each // implementation, not coming up with their own string. return lhs == rhs; } -NSUInteger TransportIdHash(GRPCTransportId transportId) { +NSUInteger TransportIdHash(GRPCTransportID transportId) { if (transportId == NULL) { transportId = gDefaultTransportId; } @@ -66,7 +66,7 @@ NSUInteger TransportIdHash(GRPCTransportId transportId) { return self; } -- (void)registerTransportWithId:(GRPCTransportId)transportId +- (void)registerTransportWithId:(GRPCTransportID)transportId factory:(id)factory { NSString *nsTransportId = [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding]; NSAssert(_registry[nsTransportId] == nil, @"The transport %@ has already been registered.", @@ -83,7 +83,7 @@ NSUInteger TransportIdHash(GRPCTransportId transportId) { } } -- (id)getTransportFactoryWithId:(GRPCTransportId)transportId { +- (id)getTransportFactoryWithId:(GRPCTransportID)transportId { if (transportId == NULL) { if (_defaultFactory == nil) { [NSException raise:NSInvalidArgumentException diff --git a/src/objective-c/GRPCClient/GRPCTypes.h b/src/objective-c/GRPCClient/GRPCTypes.h index c804bca4eaa..8d434851aa6 100644 --- a/src/objective-c/GRPCClient/GRPCTypes.h +++ b/src/objective-c/GRPCClient/GRPCTypes.h @@ -171,7 +171,7 @@ extern NSString* _Nonnull const kGRPCHeadersKey; extern NSString* _Nonnull const kGRPCTrailersKey; /** The id of a transport implementation. */ -typedef char* _Nonnull GRPCTransportId; +typedef char* _Nonnull GRPCTransportID; /** * Implement this protocol to provide a token to gRPC when a call is initiated. diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h index 2dc7357c363..075d185e5d7 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h @@ -31,13 +31,13 @@ NS_ASSUME_NONNULL_BEGIN * registered with the registry, the default transport factory (core + secure) is returned. If the * default transport does not exist, an exception is thrown. */ -- (id)getTransportFactoryWithId:(GRPCTransportId)transportId; +- (id)getTransportFactoryWithId:(GRPCTransportID)transportId; @end @interface GRPCTransportManager : NSObject -- (instancetype)initWithTransportId:(GRPCTransportId)transportId +- (instancetype)initWithTransportId:(GRPCTransportID)transportId previousInterceptor:(id)previousInterceptor; /** diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m index 9072f7afbe2..5e9c2b52ab4 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m @@ -21,13 +21,13 @@ #import @implementation GRPCTransportManager { - GRPCTransportId _transportId; + GRPCTransportID _transportId; GRPCTransport *_transport; id _previousInterceptor; dispatch_queue_t _dispatchQueue; } -- (instancetype)initWithTransportId:(GRPCTransportId)transportId +- (instancetype)initWithTransportId:(GRPCTransportID)transportId previousInterceptor:(id)previousInterceptor { if ((self = [super init])) { id factory = diff --git a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m index aa1af301b96..f4cd9e064d2 100644 --- a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m +++ b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m @@ -52,7 +52,7 @@ static int32_t kRemoteInteropServerOverhead = 12; return kRemoteSSLHost; } -+ (GRPCTransportId)transport { ++ (GRPCTransportID)transport { return gGRPCCoreCronetId; } diff --git a/src/objective-c/tests/InteropTests/InteropTests.h b/src/objective-c/tests/InteropTests/InteropTests.h index a4adecd5415..4ebce5c961d 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.h +++ b/src/objective-c/tests/InteropTests/InteropTests.h @@ -59,7 +59,7 @@ * The transport to be used. The base implementation returns NULL. Subclasses should override to * appropriate settings. */ -+ (GRPCTransportId)transport; ++ (GRPCTransportID)transport; /** * The root certificates to be used. The base implementation returns nil. Subclasses should override diff --git a/src/objective-c/tests/InteropTests/InteropTests.m b/src/objective-c/tests/InteropTests/InteropTests.m index 21198f7bad9..0c7ef44e0fa 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.m +++ b/src/objective-c/tests/InteropTests/InteropTests.m @@ -404,7 +404,7 @@ static dispatch_once_t initGlobalInterceptorFactory; return GRPCTransportTypeChttp2BoringSSL; } -+ (GRPCTransportId)transport { ++ (GRPCTransportID)transport { return NULL; } diff --git a/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m b/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m index 2e638099e1e..23f39401230 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m +++ b/src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m @@ -61,7 +61,7 @@ static int32_t kLocalInteropServerOverhead = 10; [GRPCCall useInsecureConnectionsForHost:kLocalCleartextHost]; } -+ (GRPCTransportId)transport { ++ (GRPCTransportID)transport { return GRPCDefaultTransportImplList.core_insecure; } diff --git a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m index 30d8f4c34af..9c8ce7fe810 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m +++ b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m @@ -57,7 +57,7 @@ static int32_t kLocalInteropServerOverhead = 10; return kLocalInteropServerOverhead; // bytes } -+ (GRPCTransportId)transport { ++ (GRPCTransportID)transport { return GRPCDefaultTransportImplList.core_secure; } From 8274502af8142a4581a199d94f451e1efe8c1c91 Mon Sep 17 00:00:00 2001 From: Brian Zhao Date: Sun, 1 Sep 2019 23:01:30 -0700 Subject: [PATCH 520/661] Windows's STACKFRAME Frame Addr should be RBP, the base pointer, not RSP, the stack pointer. This is documented here: https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/ns-dbghelp-stackframe with the comment "AddrFrame x64: The frame pointer is RBP or RDI." Note that this is also what StackWalker uses: https://github.com/JochenKalmbach/StackWalker#initializing-the-stackframe64 and what Chromium uses: https://codesearch.chromium.org/chromium/src/v8/src/base/debug/stack_trace_win.cc?l=200&rcl=69d20d247f62a3378d15ce0956ed8bf9665e6a44 release notes: no --- test/core/util/test_config.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core/util/test_config.cc b/test/core/util/test_config.cc index 5033dc7b66a..2216328dc08 100644 --- a/test/core/util/test_config.cc +++ b/test/core/util/test_config.cc @@ -114,7 +114,7 @@ static void print_stack_from_context(CONTEXT c) { imageType = IMAGE_FILE_MACHINE_AMD64; s.AddrPC.Offset = c.Rip; s.AddrPC.Mode = AddrModeFlat; - s.AddrFrame.Offset = c.Rsp; + s.AddrFrame.Offset = c.Rbp; s.AddrFrame.Mode = AddrModeFlat; s.AddrStack.Offset = c.Rsp; s.AddrStack.Mode = AddrModeFlat; From 7b2c253530c9675148e552d2761a0a8f28daed60 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 2 Sep 2019 10:57:36 -0400 Subject: [PATCH 521/661] Revert "only generate full or lite client, never both" This reverts commit 1b8418b5460a63c331288cd475db7198cb2c494a. --- src/compiler/csharp_generator.cc | 56 +++++++++++++++++--------------- src/compiler/csharp_generator.h | 4 +-- src/compiler/csharp_plugin.cc | 12 +++---- 3 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index d7ba4f2636a..7f178f63bb0 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -176,8 +176,9 @@ std::string GetServiceClassName(const ServiceDescriptor* service) { return service->name(); } -std::string GetClientClassName(const ServiceDescriptor* service) { - return service->name() + "Client"; +std::string GetClientClassName(const ServiceDescriptor* service, + bool lite_client) { + return service->name() + (lite_client ? "LiteClient" : "Client"); } std::string GetServerClassName(const ServiceDescriptor* service) { @@ -420,28 +421,26 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service, out->Print("/// Client for $servicename$\n", "servicename", GetServiceClassName(service)); out->Print("public partial class $name$ : grpc::ClientBase<$name$>\n", - "name", GetClientClassName(service)); + "name", GetClientClassName(service, lite_client)); } else { out->Print("/// Lite client for $servicename$\n", "servicename", GetServiceClassName(service)); out->Print("public partial class $name$ : grpc::LiteClientBase\n", "name", - GetClientClassName(service)); + GetClientClassName(service, lite_client)); } out->Print("{\n"); out->Indent(); // constructors - if (!lite_client) { - out->Print( - "/// Creates a new client for $servicename$\n" - "/// The channel to use to make remote " - "calls.\n", - "servicename", GetServiceClassName(service)); - out->Print("public $name$(grpc::ChannelBase channel) : base(channel)\n", - "name", GetClientClassName(service)); - out->Print("{\n"); - out->Print("}\n"); - } + out->Print( + "/// Creates a new client for $servicename$\n" + "/// The channel to use to make remote " + "calls.\n", + "servicename", GetServiceClassName(service)); + out->Print("public $name$(grpc::ChannelBase channel) : base(channel)\n", + "name", GetClientClassName(service)); + out->Print("{\n"); + out->Print("}\n"); out->Print( "/// Creates a new client for $servicename$ that uses a custom " "CallInvoker.\n" @@ -450,14 +449,14 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service, "servicename", GetServiceClassName(service)); out->Print( "public $name$(grpc::CallInvoker callInvoker) : base(callInvoker)\n", - "name", GetClientClassName(service)); + "name", GetClientClassName(service, lite_client)); out->Print("{\n"); out->Print("}\n"); out->Print( "/// Protected parameterless constructor to allow creation" " of test doubles.\n"); out->Print("protected $name$() : base()\n", "name", - GetClientClassName(service)); + GetClientClassName(service, lite_client)); out->Print("{\n"); out->Print("}\n"); if (!lite_client) { @@ -469,7 +468,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service, out->Print( "protected $name$(ClientBaseConfiguration configuration)" " : base(configuration)\n", - "name", GetClientClassName(service)); + "name", GetClientClassName(service, lite_client)); out->Print("{\n"); out->Print("}\n"); } @@ -598,11 +597,11 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service, out->Print( "protected override $name$ NewInstance(ClientBaseConfiguration " "configuration)\n", - "name", GetClientClassName(service)); + "name", GetClientClassName(service, lite_client)); out->Print("{\n"); out->Indent(); out->Print("return new $name$(configuration);\n", "name", - GetClientClassName(service)); + GetClientClassName(service, lite_client)); out->Outdent(); out->Print("}\n"); } @@ -686,8 +685,8 @@ void GenerateBindServiceWithBinderMethod(Printer* out, } void GenerateService(Printer* out, const ServiceDescriptor* service, - bool generate_client, bool generate_server, - bool internal_access, bool lite_client) { + bool generate_client, bool generate_lite_client, + bool generate_server, bool internal_access) { GenerateDocCommentBody(out, service); out->Print("$access_level$ static partial class $classname$\n", "access_level", GetAccessLevel(internal_access), "classname", @@ -709,7 +708,10 @@ void GenerateService(Printer* out, const ServiceDescriptor* service, GenerateServerClass(out, service); } if (generate_client) { - GenerateClientStub(out, service, lite_client); + GenerateClientStub(out, service, false); + } + if (generate_lite_client) { + GenerateClientStub(out, service, true); } if (generate_server) { @@ -724,8 +726,8 @@ void GenerateService(Printer* out, const ServiceDescriptor* service, } // anonymous namespace grpc::string GetServices(const FileDescriptor* file, bool generate_client, - bool generate_server, bool internal_access, - bool lite_client) { + bool generate_lite_client, bool generate_server, + bool internal_access) { grpc::string output; { // Scope the output stream so it closes and finalizes output to the string. @@ -766,8 +768,8 @@ grpc::string GetServices(const FileDescriptor* file, bool generate_client, out.Indent(); } for (int i = 0; i < file->service_count(); i++) { - GenerateService(&out, file->service(i), generate_client, generate_server, - internal_access, lite_client); + GenerateService(&out, file->service(i), generate_client, + generate_lite_client, generate_server, internal_access); } if (file_namespace != "") { out.Outdent(); diff --git a/src/compiler/csharp_generator.h b/src/compiler/csharp_generator.h index d4c13c67363..842d136494c 100644 --- a/src/compiler/csharp_generator.h +++ b/src/compiler/csharp_generator.h @@ -26,8 +26,8 @@ namespace grpc_csharp_generator { grpc::string GetServices(const grpc::protobuf::FileDescriptor* file, - bool generate_client, bool generate_server, - bool internal_access, bool lite_client); + bool generate_client, bool generate_lite_client, + bool generate_server, bool internal_access); } // namespace grpc_csharp_generator diff --git a/src/compiler/csharp_plugin.cc b/src/compiler/csharp_plugin.cc index c503fd61ded..a495f876792 100644 --- a/src/compiler/csharp_plugin.cc +++ b/src/compiler/csharp_plugin.cc @@ -38,19 +38,18 @@ class CSharpGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { bool generate_client = true; bool generate_server = true; + bool generate_lite_client = true; bool internal_access = false; - bool lite_client = false; for (size_t i = 0; i < options.size(); i++) { if (options[i].first == "no_client") { generate_client = false; + } else if (options[i].first == "no_lite_client") { + // TODO: better option + generate_lite_client = false; } else if (options[i].first == "no_server") { generate_server = false; } else if (options[i].first == "internal_access") { internal_access = true; - } else if (options[i].first == "lite_client") { - // will only be used if generate_client is true. - // NOTE: experimental option, can be removed in future release - lite_client = true; } else { *error = "Unknown generator option: " + options[i].first; return false; @@ -58,7 +57,8 @@ class CSharpGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { } grpc::string code = grpc_csharp_generator::GetServices( - file, generate_client, generate_server, internal_access, lite_client); + file, generate_client, generate_lite_client, generate_server, + internal_access); if (code.size() == 0) { return true; // don't generate a file if there are no services } From f73c03f47c29b0ef2bfe0f1fb0975ce210bce59a Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 2 Sep 2019 10:58:00 -0400 Subject: [PATCH 522/661] Revert "C# lite client codegen" This reverts commit 25e3d26e8cb361692101555cdb199933079cd90f. --- src/compiler/csharp_generator.cc | 96 +++++++++++++------------------- src/compiler/csharp_generator.h | 4 +- src/compiler/csharp_plugin.cc | 7 +-- 3 files changed, 41 insertions(+), 66 deletions(-) diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index 7f178f63bb0..f630da7c58e 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -176,9 +176,8 @@ std::string GetServiceClassName(const ServiceDescriptor* service) { return service->name(); } -std::string GetClientClassName(const ServiceDescriptor* service, - bool lite_client) { - return service->name() + (lite_client ? "LiteClient" : "Client"); +std::string GetClientClassName(const ServiceDescriptor* service) { + return service->name() + "Client"; } std::string GetServerClassName(const ServiceDescriptor* service) { @@ -415,19 +414,11 @@ void GenerateServerClass(Printer* out, const ServiceDescriptor* service) { out->Print("\n"); } -void GenerateClientStub(Printer* out, const ServiceDescriptor* service, - bool lite_client) { - if (!lite_client) { - out->Print("/// Client for $servicename$\n", - "servicename", GetServiceClassName(service)); - out->Print("public partial class $name$ : grpc::ClientBase<$name$>\n", - "name", GetClientClassName(service, lite_client)); - } else { - out->Print("/// Lite client for $servicename$\n", - "servicename", GetServiceClassName(service)); - out->Print("public partial class $name$ : grpc::LiteClientBase\n", "name", - GetClientClassName(service, lite_client)); - } +void GenerateClientStub(Printer* out, const ServiceDescriptor* service) { + out->Print("/// Client for $servicename$\n", "servicename", + GetServiceClassName(service)); + out->Print("public partial class $name$ : grpc::ClientBase<$name$>\n", "name", + GetClientClassName(service)); out->Print("{\n"); out->Indent(); @@ -449,30 +440,26 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service, "servicename", GetServiceClassName(service)); out->Print( "public $name$(grpc::CallInvoker callInvoker) : base(callInvoker)\n", - "name", GetClientClassName(service, lite_client)); + "name", GetClientClassName(service)); out->Print("{\n"); out->Print("}\n"); out->Print( "/// Protected parameterless constructor to allow creation" " of test doubles.\n"); out->Print("protected $name$() : base()\n", "name", - GetClientClassName(service, lite_client)); + GetClientClassName(service)); out->Print("{\n"); out->Print("}\n"); - if (!lite_client) { - out->Print( - "/// Protected constructor to allow creation of configured " - "clients.\n" - "/// The client " - "configuration.\n"); - out->Print( - "protected $name$(ClientBaseConfiguration configuration)" - " : base(configuration)\n", - "name", GetClientClassName(service, lite_client)); - out->Print("{\n"); - out->Print("}\n"); - } - out->Print("\n"); + out->Print( + "/// Protected constructor to allow creation of configured " + "clients.\n" + "/// The client configuration.\n"); + out->Print( + "protected $name$(ClientBaseConfiguration configuration)" + " : base(configuration)\n", + "name", GetClientClassName(service)); + out->Print("{\n"); + out->Print("}\n\n"); for (int i = 0; i < service->method_count(); i++) { const MethodDescriptor* method = service->method(i); @@ -590,21 +577,19 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service, } // override NewInstance method - if (!lite_client) { - out->Print( - "/// Creates a new instance of client from given " - "ClientBaseConfiguration.\n"); - out->Print( - "protected override $name$ NewInstance(ClientBaseConfiguration " - "configuration)\n", - "name", GetClientClassName(service, lite_client)); - out->Print("{\n"); - out->Indent(); - out->Print("return new $name$(configuration);\n", "name", - GetClientClassName(service, lite_client)); - out->Outdent(); - out->Print("}\n"); - } + out->Print( + "/// Creates a new instance of client from given " + "ClientBaseConfiguration.\n"); + out->Print( + "protected override $name$ NewInstance(ClientBaseConfiguration " + "configuration)\n", + "name", GetClientClassName(service)); + out->Print("{\n"); + out->Indent(); + out->Print("return new $name$(configuration);\n", "name", + GetClientClassName(service)); + out->Outdent(); + out->Print("}\n"); out->Outdent(); out->Print("}\n"); @@ -685,8 +670,8 @@ void GenerateBindServiceWithBinderMethod(Printer* out, } void GenerateService(Printer* out, const ServiceDescriptor* service, - bool generate_client, bool generate_lite_client, - bool generate_server, bool internal_access) { + bool generate_client, bool generate_server, + bool internal_access) { GenerateDocCommentBody(out, service); out->Print("$access_level$ static partial class $classname$\n", "access_level", GetAccessLevel(internal_access), "classname", @@ -708,12 +693,8 @@ void GenerateService(Printer* out, const ServiceDescriptor* service, GenerateServerClass(out, service); } if (generate_client) { - GenerateClientStub(out, service, false); - } - if (generate_lite_client) { - GenerateClientStub(out, service, true); + GenerateClientStub(out, service); } - if (generate_server) { GenerateBindServiceMethod(out, service); GenerateBindServiceWithBinderMethod(out, service); @@ -726,8 +707,7 @@ void GenerateService(Printer* out, const ServiceDescriptor* service, } // anonymous namespace grpc::string GetServices(const FileDescriptor* file, bool generate_client, - bool generate_lite_client, bool generate_server, - bool internal_access) { + bool generate_server, bool internal_access) { grpc::string output; { // Scope the output stream so it closes and finalizes output to the string. @@ -768,8 +748,8 @@ grpc::string GetServices(const FileDescriptor* file, bool generate_client, out.Indent(); } for (int i = 0; i < file->service_count(); i++) { - GenerateService(&out, file->service(i), generate_client, - generate_lite_client, generate_server, internal_access); + GenerateService(&out, file->service(i), generate_client, generate_server, + internal_access); } if (file_namespace != "") { out.Outdent(); diff --git a/src/compiler/csharp_generator.h b/src/compiler/csharp_generator.h index 842d136494c..fd36e11851b 100644 --- a/src/compiler/csharp_generator.h +++ b/src/compiler/csharp_generator.h @@ -26,8 +26,8 @@ namespace grpc_csharp_generator { grpc::string GetServices(const grpc::protobuf::FileDescriptor* file, - bool generate_client, bool generate_lite_client, - bool generate_server, bool internal_access); + bool generate_client, bool generate_server, + bool internal_access); } // namespace grpc_csharp_generator diff --git a/src/compiler/csharp_plugin.cc b/src/compiler/csharp_plugin.cc index a495f876792..5f13aa6749e 100644 --- a/src/compiler/csharp_plugin.cc +++ b/src/compiler/csharp_plugin.cc @@ -38,14 +38,10 @@ class CSharpGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { bool generate_client = true; bool generate_server = true; - bool generate_lite_client = true; bool internal_access = false; for (size_t i = 0; i < options.size(); i++) { if (options[i].first == "no_client") { generate_client = false; - } else if (options[i].first == "no_lite_client") { - // TODO: better option - generate_lite_client = false; } else if (options[i].first == "no_server") { generate_server = false; } else if (options[i].first == "internal_access") { @@ -57,8 +53,7 @@ class CSharpGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { } grpc::string code = grpc_csharp_generator::GetServices( - file, generate_client, generate_lite_client, generate_server, - internal_access); + file, generate_client, generate_server, internal_access); if (code.size() == 0) { return true; // don't generate a file if there are no services } From 28f031f915e0a7b326f4845b868bd2b35f7f3ed3 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 2 Sep 2019 11:12:11 -0400 Subject: [PATCH 523/661] Revert "also generate code with "lite_client" option set" This reverts commit 4a4cf280a1d5f8690ee063a22a6b4b1d1d49f27f. --- .../math_with_protoc_options.proto | 65 ------------------- src/csharp/generate_proto_csharp.sh | 2 - 2 files changed, 67 deletions(-) delete mode 100644 src/csharp/Grpc.Examples/math_with_protoc_options.proto diff --git a/src/csharp/Grpc.Examples/math_with_protoc_options.proto b/src/csharp/Grpc.Examples/math_with_protoc_options.proto deleted file mode 100644 index ca13c6d4466..00000000000 --- a/src/csharp/Grpc.Examples/math_with_protoc_options.proto +++ /dev/null @@ -1,65 +0,0 @@ - -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package math_with_protoc_options; - -message DivArgs { - int64 dividend = 1; - int64 divisor = 2; -} - -message DivReply { - int64 quotient = 1; - int64 remainder = 2; -} - -message FibArgs { - int64 limit = 1; -} - -message Num { - int64 num = 1; -} - -message FibReply { - int64 count = 1; -} - -service Math { - // Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient - // and remainder. - rpc Div (DivArgs) returns (DivReply) { - } - - // DivMany accepts an arbitrary number of division args from the client stream - // and sends back the results in the reply stream. The stream continues until - // the client closes its end; the server does the same after sending all the - // replies. The stream ends immediately if either end aborts. - rpc DivMany (stream DivArgs) returns (stream DivReply) { - } - - // Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib - // generates up to limit numbers; otherwise it continues until the call is - // canceled. Unlike Fib above, Fib has no final FibReply. - rpc Fib (FibArgs) returns (stream Num) { - } - - // Sum sums a stream of numbers, returning the final result once the stream - // is closed. - rpc Sum (stream Num) returns (Num) { - } -} diff --git a/src/csharp/generate_proto_csharp.sh b/src/csharp/generate_proto_csharp.sh index 81463ace6ad..e79728ff959 100755 --- a/src/csharp/generate_proto_csharp.sh +++ b/src/csharp/generate_proto_csharp.sh @@ -26,8 +26,6 @@ TESTING_DIR=src/csharp/Grpc.IntegrationTesting $PROTOC --plugin=$PLUGIN --csharp_out=$EXAMPLES_DIR --grpc_out=$EXAMPLES_DIR \ -I src/proto src/proto/math/math.proto -$PROTOC --plugin=$PLUGIN --csharp_out=$EXAMPLES_DIR --grpc_out=$EXAMPLES_DIR --grpc_opt=lite_client,no_server \ - -I src/csharp/Grpc.Examples src/csharp/Grpc.Examples/math_with_protoc_options.proto $PROTOC --plugin=$PLUGIN --csharp_out=$HEALTHCHECK_DIR --grpc_out=$HEALTHCHECK_DIR \ -I src/proto src/proto/grpc/health/v1/health.proto From e84d0a2875b4e10b217fcf140a2cec8475b0a0e6 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 2 Sep 2019 11:15:32 -0400 Subject: [PATCH 524/661] remove LiteClientBase --- src/csharp/Grpc.Core.Api/LiteClientBase.cs | 63 ---------------------- 1 file changed, 63 deletions(-) delete mode 100644 src/csharp/Grpc.Core.Api/LiteClientBase.cs diff --git a/src/csharp/Grpc.Core.Api/LiteClientBase.cs b/src/csharp/Grpc.Core.Api/LiteClientBase.cs deleted file mode 100644 index 132f10a912f..00000000000 --- a/src/csharp/Grpc.Core.Api/LiteClientBase.cs +++ /dev/null @@ -1,63 +0,0 @@ -#region Copyright notice and license - -// Copyright 2019 The gRPC Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#endregion - -using System; -using Grpc.Core.Internal; -using Grpc.Core.Utils; - -namespace Grpc.Core -{ - /// - /// Base class for lightweight client-side stubs. - /// All calls are invoked via a CallInvoker. - /// Lite client stubs have no configuration knobs, all configuration - /// is provided by decorating the call invoker. - /// Note: experimental API that can change or be removed without any prior notice. - /// - public abstract class LiteClientBase - { - readonly CallInvoker callInvoker; - - /// - /// Initializes a new instance of LiteClientBase class that - /// throws NotImplementedException upon invocation of any RPC. - /// This constructor is only provided to allow creation of test doubles - /// for client classes (e.g. mocking requires a parameterless constructor). - /// - protected LiteClientBase() : this(new UnimplementedCallInvoker()) - { - } - - /// - /// Initializes a new instance of ClientBase class. - /// - /// The CallInvoker for remote call invocation. - public LiteClientBase(CallInvoker callInvoker) - { - this.callInvoker = GrpcPreconditions.CheckNotNull(callInvoker, nameof(callInvoker)); - } - - /// - /// Gets the call invoker. - /// - protected CallInvoker CallInvoker - { - get { return this.callInvoker; } - } - } -} From 3a6042b824170fbca329aa07a8137b9359a7432a Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 2 Sep 2019 11:22:08 -0400 Subject: [PATCH 525/661] regenerate C# protos --- .../Grpc.IntegrationTesting/Messages.cs | 137 +++++++++++++++--- 1 file changed, 113 insertions(+), 24 deletions(-) diff --git a/src/csharp/Grpc.IntegrationTesting/Messages.cs b/src/csharp/Grpc.IntegrationTesting/Messages.cs index 5c5042b75b6..dab90d8ae46 100644 --- a/src/csharp/Grpc.IntegrationTesting/Messages.cs +++ b/src/csharp/Grpc.IntegrationTesting/Messages.cs @@ -28,7 +28,7 @@ namespace Grpc.Testing { "LnRlc3RpbmciGgoJQm9vbFZhbHVlEg0KBXZhbHVlGAEgASgIIkAKB1BheWxv", "YWQSJwoEdHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXlsb2FkVHlwZRIM", "CgRib2R5GAIgASgMIisKCkVjaG9TdGF0dXMSDAoEY29kZRgBIAEoBRIPCgdt", - "ZXNzYWdlGAIgASgJIuYCCg1TaW1wbGVSZXF1ZXN0EjAKDXJlc3BvbnNlX3R5", + "ZXNzYWdlGAIgASgJIoYDCg1TaW1wbGVSZXF1ZXN0EjAKDXJlc3BvbnNlX3R5", "cGUYASABKA4yGS5ncnBjLnRlc3RpbmcuUGF5bG9hZFR5cGUSFQoNcmVzcG9u", "c2Vfc2l6ZRgCIAEoBRImCgdwYXlsb2FkGAMgASgLMhUuZ3JwYy50ZXN0aW5n", "LlBheWxvYWQSFQoNZmlsbF91c2VybmFtZRgEIAEoCBIYChBmaWxsX29hdXRo", @@ -36,34 +36,38 @@ namespace Grpc.Testing { "cnBjLnRlc3RpbmcuQm9vbFZhbHVlEjEKD3Jlc3BvbnNlX3N0YXR1cxgHIAEo", "CzIYLmdycGMudGVzdGluZy5FY2hvU3RhdHVzEjIKEWV4cGVjdF9jb21wcmVz", "c2VkGAggASgLMhcuZ3JwYy50ZXN0aW5nLkJvb2xWYWx1ZRIWCg5maWxsX3Nl", - "cnZlcl9pZBgJIAEoCCJyCg5TaW1wbGVSZXNwb25zZRImCgdwYXlsb2FkGAEg", - "ASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxvYWQSEAoIdXNlcm5hbWUYAiABKAkS", - "EwoLb2F1dGhfc2NvcGUYAyABKAkSEQoJc2VydmVyX2lkGAQgASgJIncKGVN0", - "cmVhbWluZ0lucHV0Q2FsbFJlcXVlc3QSJgoHcGF5bG9hZBgBIAEoCzIVLmdy", - "cGMudGVzdGluZy5QYXlsb2FkEjIKEWV4cGVjdF9jb21wcmVzc2VkGAIgASgL", - "MhcuZ3JwYy50ZXN0aW5nLkJvb2xWYWx1ZSI9ChpTdHJlYW1pbmdJbnB1dENh", - "bGxSZXNwb25zZRIfChdhZ2dyZWdhdGVkX3BheWxvYWRfc2l6ZRgBIAEoBSJk", - "ChJSZXNwb25zZVBhcmFtZXRlcnMSDAoEc2l6ZRgBIAEoBRITCgtpbnRlcnZh", - "bF91cxgCIAEoBRIrCgpjb21wcmVzc2VkGAMgASgLMhcuZ3JwYy50ZXN0aW5n", - "LkJvb2xWYWx1ZSLoAQoaU3RyZWFtaW5nT3V0cHV0Q2FsbFJlcXVlc3QSMAoN", - "cmVzcG9uc2VfdHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXlsb2FkVHlw", - "ZRI9ChNyZXNwb25zZV9wYXJhbWV0ZXJzGAIgAygLMiAuZ3JwYy50ZXN0aW5n", - "LlJlc3BvbnNlUGFyYW1ldGVycxImCgdwYXlsb2FkGAMgASgLMhUuZ3JwYy50", - "ZXN0aW5nLlBheWxvYWQSMQoPcmVzcG9uc2Vfc3RhdHVzGAcgASgLMhguZ3Jw", - "Yy50ZXN0aW5nLkVjaG9TdGF0dXMiRQobU3RyZWFtaW5nT3V0cHV0Q2FsbFJl", - "c3BvbnNlEiYKB3BheWxvYWQYASABKAsyFS5ncnBjLnRlc3RpbmcuUGF5bG9h", - "ZCIzCg9SZWNvbm5lY3RQYXJhbXMSIAoYbWF4X3JlY29ubmVjdF9iYWNrb2Zm", - "X21zGAEgASgFIjMKDVJlY29ubmVjdEluZm8SDgoGcGFzc2VkGAEgASgIEhIK", - "CmJhY2tvZmZfbXMYAiADKAUqHwoLUGF5bG9hZFR5cGUSEAoMQ09NUFJFU1NB", - "QkxFEABiBnByb3RvMw==")); + "cnZlcl9pZBgJIAEoCBIeChZmaWxsX2dycGNsYl9yb3V0ZV90eXBlGAogASgI", + "IqwBCg5TaW1wbGVSZXNwb25zZRImCgdwYXlsb2FkGAEgASgLMhUuZ3JwYy50", + "ZXN0aW5nLlBheWxvYWQSEAoIdXNlcm5hbWUYAiABKAkSEwoLb2F1dGhfc2Nv", + "cGUYAyABKAkSEQoJc2VydmVyX2lkGAQgASgJEjgKEWdycGNsYl9yb3V0ZV90", + "eXBlGAUgASgOMh0uZ3JwYy50ZXN0aW5nLkdycGNsYlJvdXRlVHlwZSJ3ChlT", + "dHJlYW1pbmdJbnB1dENhbGxSZXF1ZXN0EiYKB3BheWxvYWQYASABKAsyFS5n", + "cnBjLnRlc3RpbmcuUGF5bG9hZBIyChFleHBlY3RfY29tcHJlc3NlZBgCIAEo", + "CzIXLmdycGMudGVzdGluZy5Cb29sVmFsdWUiPQoaU3RyZWFtaW5nSW5wdXRD", + "YWxsUmVzcG9uc2USHwoXYWdncmVnYXRlZF9wYXlsb2FkX3NpemUYASABKAUi", + "ZAoSUmVzcG9uc2VQYXJhbWV0ZXJzEgwKBHNpemUYASABKAUSEwoLaW50ZXJ2", + "YWxfdXMYAiABKAUSKwoKY29tcHJlc3NlZBgDIAEoCzIXLmdycGMudGVzdGlu", + "Zy5Cb29sVmFsdWUi6AEKGlN0cmVhbWluZ091dHB1dENhbGxSZXF1ZXN0EjAK", + "DXJlc3BvbnNlX3R5cGUYASABKA4yGS5ncnBjLnRlc3RpbmcuUGF5bG9hZFR5", + "cGUSPQoTcmVzcG9uc2VfcGFyYW1ldGVycxgCIAMoCzIgLmdycGMudGVzdGlu", + "Zy5SZXNwb25zZVBhcmFtZXRlcnMSJgoHcGF5bG9hZBgDIAEoCzIVLmdycGMu", + "dGVzdGluZy5QYXlsb2FkEjEKD3Jlc3BvbnNlX3N0YXR1cxgHIAEoCzIYLmdy", + "cGMudGVzdGluZy5FY2hvU3RhdHVzIkUKG1N0cmVhbWluZ091dHB1dENhbGxS", + "ZXNwb25zZRImCgdwYXlsb2FkGAEgASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxv", + "YWQiMwoPUmVjb25uZWN0UGFyYW1zEiAKGG1heF9yZWNvbm5lY3RfYmFja29m", + "Zl9tcxgBIAEoBSIzCg1SZWNvbm5lY3RJbmZvEg4KBnBhc3NlZBgBIAEoCBIS", + "CgpiYWNrb2ZmX21zGAIgAygFKh8KC1BheWxvYWRUeXBlEhAKDENPTVBSRVNT", + "QUJMRRAAKm8KD0dycGNsYlJvdXRlVHlwZRIdChlHUlBDTEJfUk9VVEVfVFlQ", + "RV9VTktOT1dOEAASHgoaR1JQQ0xCX1JPVVRFX1RZUEVfRkFMTEJBQ0sQARId", + "ChlHUlBDTEJfUk9VVEVfVFlQRV9CQUNLRU5EEAJiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Grpc.Testing.PayloadType), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Grpc.Testing.PayloadType), typeof(global::Grpc.Testing.GrpclbRouteType), }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.BoolValue), global::Grpc.Testing.BoolValue.Parser, new[]{ "Value" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Payload), global::Grpc.Testing.Payload.Parser, new[]{ "Type", "Body" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.EchoStatus), global::Grpc.Testing.EchoStatus.Parser, new[]{ "Code", "Message" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleRequest), global::Grpc.Testing.SimpleRequest.Parser, new[]{ "ResponseType", "ResponseSize", "Payload", "FillUsername", "FillOauthScope", "ResponseCompressed", "ResponseStatus", "ExpectCompressed", "FillServerId" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleResponse), global::Grpc.Testing.SimpleResponse.Parser, new[]{ "Payload", "Username", "OauthScope", "ServerId" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleRequest), global::Grpc.Testing.SimpleRequest.Parser, new[]{ "ResponseType", "ResponseSize", "Payload", "FillUsername", "FillOauthScope", "ResponseCompressed", "ResponseStatus", "ExpectCompressed", "FillServerId", "FillGrpclbRouteType" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleResponse), global::Grpc.Testing.SimpleResponse.Parser, new[]{ "Payload", "Username", "OauthScope", "ServerId", "GrpclbRouteType" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingInputCallRequest), global::Grpc.Testing.StreamingInputCallRequest.Parser, new[]{ "Payload", "ExpectCompressed" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingInputCallResponse), global::Grpc.Testing.StreamingInputCallResponse.Parser, new[]{ "AggregatedPayloadSize" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ResponseParameters), global::Grpc.Testing.ResponseParameters.Parser, new[]{ "Size", "IntervalUs", "Compressed" }, null, null, null), @@ -87,6 +91,29 @@ namespace Grpc.Testing { [pbr::OriginalName("COMPRESSABLE")] Compressable = 0, } + /// + /// The type of route that a client took to reach a server w.r.t. gRPCLB. + /// The server must fill in "fallback" if it detects that the RPC reached + /// the server via the "gRPCLB fallback" path, and "backend" if it detects + /// that the RPC reached the server via "gRPCLB backend" path (i.e. if it got + /// the address of this server from the gRPCLB server BalanceLoad RPC). Exactly + /// how this detection is done is context and server dependant. + /// + public enum GrpclbRouteType { + /// + /// Server didn't detect the route that a client took to reach it. + /// + [pbr::OriginalName("GRPCLB_ROUTE_TYPE_UNKNOWN")] Unknown = 0, + /// + /// Indicates that a client reached a server via gRPCLB fallback. + /// + [pbr::OriginalName("GRPCLB_ROUTE_TYPE_FALLBACK")] Fallback = 1, + /// + /// Indicates that a client reached a server as a gRPCLB-given backend. + /// + [pbr::OriginalName("GRPCLB_ROUTE_TYPE_BACKEND")] Backend = 2, + } + #endregion #region Messages @@ -591,6 +618,7 @@ namespace Grpc.Testing { responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; expectCompressed_ = other.expectCompressed_ != null ? other.expectCompressed_.Clone() : null; fillServerId_ = other.fillServerId_; + fillGrpclbRouteType_ = other.fillGrpclbRouteType_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -729,6 +757,20 @@ namespace Grpc.Testing { } } + /// Field number for the "fill_grpclb_route_type" field. + public const int FillGrpclbRouteTypeFieldNumber = 10; + private bool fillGrpclbRouteType_; + /// + /// Whether SimpleResponse should include grpclb_route_type. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool FillGrpclbRouteType { + get { return fillGrpclbRouteType_; } + set { + fillGrpclbRouteType_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as SimpleRequest); @@ -751,6 +793,7 @@ namespace Grpc.Testing { if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; if (!object.Equals(ExpectCompressed, other.ExpectCompressed)) return false; if (FillServerId != other.FillServerId) return false; + if (FillGrpclbRouteType != other.FillGrpclbRouteType) return false; return Equals(_unknownFields, other._unknownFields); } @@ -766,6 +809,7 @@ namespace Grpc.Testing { if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); if (expectCompressed_ != null) hash ^= ExpectCompressed.GetHashCode(); if (FillServerId != false) hash ^= FillServerId.GetHashCode(); + if (FillGrpclbRouteType != false) hash ^= FillGrpclbRouteType.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -815,6 +859,10 @@ namespace Grpc.Testing { output.WriteRawTag(72); output.WriteBool(FillServerId); } + if (FillGrpclbRouteType != false) { + output.WriteRawTag(80); + output.WriteBool(FillGrpclbRouteType); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -850,6 +898,9 @@ namespace Grpc.Testing { if (FillServerId != false) { size += 1 + 1; } + if (FillGrpclbRouteType != false) { + size += 1 + 1; + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -900,6 +951,9 @@ namespace Grpc.Testing { if (other.FillServerId != false) { FillServerId = other.FillServerId; } + if (other.FillGrpclbRouteType != false) { + FillGrpclbRouteType = other.FillGrpclbRouteType; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -959,6 +1013,10 @@ namespace Grpc.Testing { FillServerId = input.ReadBool(); break; } + case 80: { + FillGrpclbRouteType = input.ReadBool(); + break; + } } } } @@ -997,6 +1055,7 @@ namespace Grpc.Testing { username_ = other.username_; oauthScope_ = other.oauthScope_; serverId_ = other.serverId_; + grpclbRouteType_ = other.grpclbRouteType_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -1063,6 +1122,20 @@ namespace Grpc.Testing { } } + /// Field number for the "grpclb_route_type" field. + public const int GrpclbRouteTypeFieldNumber = 5; + private global::Grpc.Testing.GrpclbRouteType grpclbRouteType_ = 0; + /// + /// gRPCLB Path. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Grpc.Testing.GrpclbRouteType GrpclbRouteType { + get { return grpclbRouteType_; } + set { + grpclbRouteType_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as SimpleResponse); @@ -1080,6 +1153,7 @@ namespace Grpc.Testing { if (Username != other.Username) return false; if (OauthScope != other.OauthScope) return false; if (ServerId != other.ServerId) return false; + if (GrpclbRouteType != other.GrpclbRouteType) return false; return Equals(_unknownFields, other._unknownFields); } @@ -1090,6 +1164,7 @@ namespace Grpc.Testing { if (Username.Length != 0) hash ^= Username.GetHashCode(); if (OauthScope.Length != 0) hash ^= OauthScope.GetHashCode(); if (ServerId.Length != 0) hash ^= ServerId.GetHashCode(); + if (GrpclbRouteType != 0) hash ^= GrpclbRouteType.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1119,6 +1194,10 @@ namespace Grpc.Testing { output.WriteRawTag(34); output.WriteString(ServerId); } + if (GrpclbRouteType != 0) { + output.WriteRawTag(40); + output.WriteEnum((int) GrpclbRouteType); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -1139,6 +1218,9 @@ namespace Grpc.Testing { if (ServerId.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(ServerId); } + if (GrpclbRouteType != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) GrpclbRouteType); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1165,6 +1247,9 @@ namespace Grpc.Testing { if (other.ServerId.Length != 0) { ServerId = other.ServerId; } + if (other.GrpclbRouteType != 0) { + GrpclbRouteType = other.GrpclbRouteType; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1195,6 +1280,10 @@ namespace Grpc.Testing { ServerId = input.ReadString(); break; } + case 40: { + GrpclbRouteType = (global::Grpc.Testing.GrpclbRouteType) input.ReadEnum(); + break; + } } } } From 2ea334a60b6cb9f2a6d750cd7e033441d86c33d1 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 2 Sep 2019 11:27:38 -0400 Subject: [PATCH 526/661] remove no-longer-needed generated files --- .../Grpc.Examples/MathWithProtocOptions.cs | 759 ------------------ .../MathWithProtocOptionsGrpc.cs | 208 ----- 2 files changed, 967 deletions(-) delete mode 100644 src/csharp/Grpc.Examples/MathWithProtocOptions.cs delete mode 100644 src/csharp/Grpc.Examples/MathWithProtocOptionsGrpc.cs diff --git a/src/csharp/Grpc.Examples/MathWithProtocOptions.cs b/src/csharp/Grpc.Examples/MathWithProtocOptions.cs deleted file mode 100644 index ef9a5a4ff5c..00000000000 --- a/src/csharp/Grpc.Examples/MathWithProtocOptions.cs +++ /dev/null @@ -1,759 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: math_with_protoc_options.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace MathWithProtocOptions { - - /// Holder for reflection information generated from math_with_protoc_options.proto - public static partial class MathWithProtocOptionsReflection { - - #region Descriptor - /// File descriptor for math_with_protoc_options.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static MathWithProtocOptionsReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Ch5tYXRoX3dpdGhfcHJvdG9jX29wdGlvbnMucHJvdG8SGG1hdGhfd2l0aF9w", - "cm90b2Nfb3B0aW9ucyIsCgdEaXZBcmdzEhAKCGRpdmlkZW5kGAEgASgDEg8K", - "B2Rpdmlzb3IYAiABKAMiLwoIRGl2UmVwbHkSEAoIcXVvdGllbnQYASABKAMS", - "EQoJcmVtYWluZGVyGAIgASgDIhgKB0ZpYkFyZ3MSDQoFbGltaXQYASABKAMi", - "EgoDTnVtEgsKA251bRgBIAEoAyIZCghGaWJSZXBseRINCgVjb3VudBgBIAEo", - "AzLEAgoETWF0aBJOCgNEaXYSIS5tYXRoX3dpdGhfcHJvdG9jX29wdGlvbnMu", - "RGl2QXJncxoiLm1hdGhfd2l0aF9wcm90b2Nfb3B0aW9ucy5EaXZSZXBseSIA", - "ElYKB0Rpdk1hbnkSIS5tYXRoX3dpdGhfcHJvdG9jX29wdGlvbnMuRGl2QXJn", - "cxoiLm1hdGhfd2l0aF9wcm90b2Nfb3B0aW9ucy5EaXZSZXBseSIAKAEwARJL", - "CgNGaWISIS5tYXRoX3dpdGhfcHJvdG9jX29wdGlvbnMuRmliQXJncxodLm1h", - "dGhfd2l0aF9wcm90b2Nfb3B0aW9ucy5OdW0iADABEkcKA1N1bRIdLm1hdGhf", - "d2l0aF9wcm90b2Nfb3B0aW9ucy5OdW0aHS5tYXRoX3dpdGhfcHJvdG9jX29w", - "dGlvbnMuTnVtIgAoAWIGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::MathWithProtocOptions.DivArgs), global::MathWithProtocOptions.DivArgs.Parser, new[]{ "Dividend", "Divisor" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::MathWithProtocOptions.DivReply), global::MathWithProtocOptions.DivReply.Parser, new[]{ "Quotient", "Remainder" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::MathWithProtocOptions.FibArgs), global::MathWithProtocOptions.FibArgs.Parser, new[]{ "Limit" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::MathWithProtocOptions.Num), global::MathWithProtocOptions.Num.Parser, new[]{ "Num_" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::MathWithProtocOptions.FibReply), global::MathWithProtocOptions.FibReply.Parser, new[]{ "Count" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class DivArgs : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DivArgs()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MathWithProtocOptions.MathWithProtocOptionsReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DivArgs() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DivArgs(DivArgs other) : this() { - dividend_ = other.dividend_; - divisor_ = other.divisor_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DivArgs Clone() { - return new DivArgs(this); - } - - /// Field number for the "dividend" field. - public const int DividendFieldNumber = 1; - private long dividend_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Dividend { - get { return dividend_; } - set { - dividend_ = value; - } - } - - /// Field number for the "divisor" field. - public const int DivisorFieldNumber = 2; - private long divisor_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Divisor { - get { return divisor_; } - set { - divisor_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DivArgs); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DivArgs other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Dividend != other.Dividend) return false; - if (Divisor != other.Divisor) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Dividend != 0L) hash ^= Dividend.GetHashCode(); - if (Divisor != 0L) hash ^= Divisor.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Dividend != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Dividend); - } - if (Divisor != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Divisor); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Dividend != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Dividend); - } - if (Divisor != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Divisor); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DivArgs other) { - if (other == null) { - return; - } - if (other.Dividend != 0L) { - Dividend = other.Dividend; - } - if (other.Divisor != 0L) { - Divisor = other.Divisor; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Dividend = input.ReadInt64(); - break; - } - case 16: { - Divisor = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class DivReply : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DivReply()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MathWithProtocOptions.MathWithProtocOptionsReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DivReply() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DivReply(DivReply other) : this() { - quotient_ = other.quotient_; - remainder_ = other.remainder_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DivReply Clone() { - return new DivReply(this); - } - - /// Field number for the "quotient" field. - public const int QuotientFieldNumber = 1; - private long quotient_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Quotient { - get { return quotient_; } - set { - quotient_ = value; - } - } - - /// Field number for the "remainder" field. - public const int RemainderFieldNumber = 2; - private long remainder_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Remainder { - get { return remainder_; } - set { - remainder_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DivReply); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DivReply other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Quotient != other.Quotient) return false; - if (Remainder != other.Remainder) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Quotient != 0L) hash ^= Quotient.GetHashCode(); - if (Remainder != 0L) hash ^= Remainder.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Quotient != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Quotient); - } - if (Remainder != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Remainder); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Quotient != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Quotient); - } - if (Remainder != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Remainder); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DivReply other) { - if (other == null) { - return; - } - if (other.Quotient != 0L) { - Quotient = other.Quotient; - } - if (other.Remainder != 0L) { - Remainder = other.Remainder; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Quotient = input.ReadInt64(); - break; - } - case 16: { - Remainder = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class FibArgs : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FibArgs()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MathWithProtocOptions.MathWithProtocOptionsReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FibArgs() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FibArgs(FibArgs other) : this() { - limit_ = other.limit_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FibArgs Clone() { - return new FibArgs(this); - } - - /// Field number for the "limit" field. - public const int LimitFieldNumber = 1; - private long limit_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Limit { - get { return limit_; } - set { - limit_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as FibArgs); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FibArgs other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Limit != other.Limit) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Limit != 0L) hash ^= Limit.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Limit != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Limit); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Limit != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Limit); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FibArgs other) { - if (other == null) { - return; - } - if (other.Limit != 0L) { - Limit = other.Limit; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Limit = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class Num : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Num()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MathWithProtocOptions.MathWithProtocOptionsReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Num() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Num(Num other) : this() { - num_ = other.num_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Num Clone() { - return new Num(this); - } - - /// Field number for the "num" field. - public const int Num_FieldNumber = 1; - private long num_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Num_ { - get { return num_; } - set { - num_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Num); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Num other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Num_ != other.Num_) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Num_ != 0L) hash ^= Num_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Num_ != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Num_); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Num_ != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Num_); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Num other) { - if (other == null) { - return; - } - if (other.Num_ != 0L) { - Num_ = other.Num_; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Num_ = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class FibReply : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FibReply()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MathWithProtocOptions.MathWithProtocOptionsReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FibReply() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FibReply(FibReply other) : this() { - count_ = other.count_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FibReply Clone() { - return new FibReply(this); - } - - /// Field number for the "count" field. - public const int CountFieldNumber = 1; - private long count_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Count { - get { return count_; } - set { - count_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as FibReply); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FibReply other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Count != other.Count) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Count != 0L) hash ^= Count.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Count != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Count); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Count != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Count); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FibReply other) { - if (other == null) { - return; - } - if (other.Count != 0L) { - Count = other.Count; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Count = input.ReadInt64(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/csharp/Grpc.Examples/MathWithProtocOptionsGrpc.cs b/src/csharp/Grpc.Examples/MathWithProtocOptionsGrpc.cs deleted file mode 100644 index dd61b72163f..00000000000 --- a/src/csharp/Grpc.Examples/MathWithProtocOptionsGrpc.cs +++ /dev/null @@ -1,208 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: math_with_protoc_options.proto -// -// Original file comments: -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using grpc = global::Grpc.Core; - -namespace MathWithProtocOptions { - public static partial class Math - { - static readonly string __ServiceName = "math_with_protoc_options.Math"; - - static readonly grpc::Marshaller __Marshaller_math_with_protoc_options_DivArgs = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::MathWithProtocOptions.DivArgs.Parser.ParseFrom); - static readonly grpc::Marshaller __Marshaller_math_with_protoc_options_DivReply = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::MathWithProtocOptions.DivReply.Parser.ParseFrom); - static readonly grpc::Marshaller __Marshaller_math_with_protoc_options_FibArgs = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::MathWithProtocOptions.FibArgs.Parser.ParseFrom); - static readonly grpc::Marshaller __Marshaller_math_with_protoc_options_Num = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::MathWithProtocOptions.Num.Parser.ParseFrom); - - static readonly grpc::Method __Method_Div = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "Div", - __Marshaller_math_with_protoc_options_DivArgs, - __Marshaller_math_with_protoc_options_DivReply); - - static readonly grpc::Method __Method_DivMany = new grpc::Method( - grpc::MethodType.DuplexStreaming, - __ServiceName, - "DivMany", - __Marshaller_math_with_protoc_options_DivArgs, - __Marshaller_math_with_protoc_options_DivReply); - - static readonly grpc::Method __Method_Fib = new grpc::Method( - grpc::MethodType.ServerStreaming, - __ServiceName, - "Fib", - __Marshaller_math_with_protoc_options_FibArgs, - __Marshaller_math_with_protoc_options_Num); - - static readonly grpc::Method __Method_Sum = new grpc::Method( - grpc::MethodType.ClientStreaming, - __ServiceName, - "Sum", - __Marshaller_math_with_protoc_options_Num, - __Marshaller_math_with_protoc_options_Num); - - /// Service descriptor - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::MathWithProtocOptions.MathWithProtocOptionsReflection.Descriptor.Services[0]; } - } - - /// Lite client for Math - public partial class MathClient : grpc::LiteClientBase - { - /// Creates a new client for Math that uses a custom CallInvoker. - /// The callInvoker to use to make remote calls. - public MathClient(grpc::CallInvoker callInvoker) : base(callInvoker) - { - } - /// Protected parameterless constructor to allow creation of test doubles. - protected MathClient() : base() - { - } - - /// - /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient - /// and remainder. - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The response received from the server. - public virtual global::MathWithProtocOptions.DivReply Div(global::MathWithProtocOptions.DivArgs request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Div(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient - /// and remainder. - /// - /// The request to send to the server. - /// The options for the call. - /// The response received from the server. - public virtual global::MathWithProtocOptions.DivReply Div(global::MathWithProtocOptions.DivArgs request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_Div, null, options, request); - } - /// - /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient - /// and remainder. - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncUnaryCall DivAsync(global::MathWithProtocOptions.DivArgs request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return DivAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient - /// and remainder. - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncUnaryCall DivAsync(global::MathWithProtocOptions.DivArgs request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_Div, null, options, request); - } - /// - /// DivMany accepts an arbitrary number of division args from the client stream - /// and sends back the results in the reply stream. The stream continues until - /// the client closes its end; the server does the same after sending all the - /// replies. The stream ends immediately if either end aborts. - /// - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncDuplexStreamingCall DivMany(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return DivMany(new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// DivMany accepts an arbitrary number of division args from the client stream - /// and sends back the results in the reply stream. The stream continues until - /// the client closes its end; the server does the same after sending all the - /// replies. The stream ends immediately if either end aborts. - /// - /// The options for the call. - /// The call object. - public virtual grpc::AsyncDuplexStreamingCall DivMany(grpc::CallOptions options) - { - return CallInvoker.AsyncDuplexStreamingCall(__Method_DivMany, null, options); - } - /// - /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib - /// generates up to limit numbers; otherwise it continues until the call is - /// canceled. Unlike Fib above, Fib has no final FibReply. - /// - /// The request to send to the server. - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncServerStreamingCall Fib(global::MathWithProtocOptions.FibArgs request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Fib(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib - /// generates up to limit numbers; otherwise it continues until the call is - /// canceled. Unlike Fib above, Fib has no final FibReply. - /// - /// The request to send to the server. - /// The options for the call. - /// The call object. - public virtual grpc::AsyncServerStreamingCall Fib(global::MathWithProtocOptions.FibArgs request, grpc::CallOptions options) - { - return CallInvoker.AsyncServerStreamingCall(__Method_Fib, null, options, request); - } - /// - /// Sum sums a stream of numbers, returning the final result once the stream - /// is closed. - /// - /// The initial metadata to send with the call. This parameter is optional. - /// An optional deadline for the call. The call will be cancelled if deadline is hit. - /// An optional token for canceling the call. - /// The call object. - public virtual grpc::AsyncClientStreamingCall Sum(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return Sum(new grpc::CallOptions(headers, deadline, cancellationToken)); - } - /// - /// Sum sums a stream of numbers, returning the final result once the stream - /// is closed. - /// - /// The options for the call. - /// The call object. - public virtual grpc::AsyncClientStreamingCall Sum(grpc::CallOptions options) - { - return CallInvoker.AsyncClientStreamingCall(__Method_Sum, null, options); - } - } - - } -} -#endregion From 7b54e095cbed9cbec7da473e56012578eaa938e8 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 2 Sep 2019 12:30:22 -0400 Subject: [PATCH 527/661] fix microbenchmarks --- src/csharp/Grpc.Microbenchmarks/PingBenchmark.cs | 2 +- src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/csharp/Grpc.Microbenchmarks/PingBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/PingBenchmark.cs index 3949040aac0..cbcf5d361ca 100644 --- a/src/csharp/Grpc.Microbenchmarks/PingBenchmark.cs +++ b/src/csharp/Grpc.Microbenchmarks/PingBenchmark.cs @@ -86,7 +86,7 @@ namespace Grpc.Microbenchmarks await server.ShutdownAsync(); } - class PingClient : LiteClientBase + class PingClient : ClientBase { public PingClient(CallInvoker callInvoker) : base(callInvoker) { } public AsyncUnaryCall PingAsync(string request, CallOptions options) diff --git a/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs index 8448f03dd62..1f87b41169c 100644 --- a/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs +++ b/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs @@ -91,7 +91,7 @@ namespace Grpc.Microbenchmarks await channel.ShutdownAsync(); } - class PingClient : LiteClientBase + class PingClient : ClientBase { public PingClient(CallInvoker callInvoker) : base(callInvoker) { } From 406a2473a60a3ef78f73344724fabd20024775f2 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 2 Sep 2019 19:36:11 -0700 Subject: [PATCH 528/661] Enable stale bot --- .github/stale.yml | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 00000000000..ff9049ddb96 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,59 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +# Number of days of inactivity before an Issue or Pull Request becomes stale +daysUntilStale: 180 + +# Number of days of inactivity before an Issue or Pull Request with the stale label is closed. +# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. +daysUntilClose: 1 + +# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) +onlyLabels: [] + +# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable +exemptLabels: + - "disposition/never stale" + +# Set to true to ignore issues in a project (defaults to false) +exemptProjects: false + +# Set to true to ignore issues in a milestone (defaults to false) +exemptMilestones: false + +# Set to true to ignore issues with an assignee (defaults to false) +exemptAssignees: false + +# Label to use when marking as stale +staleLabel: "disposition/stale" + +# Comment to post when marking as stale. Set to `false` to disable +markComment: > + This issue/PR has been automatically marked as stale because it has not had any update (including + commits, comments, labels, milestones, etc) for 180 days. It will be closed automatically if no + further update occurs in 1 day. Thank you for your contributions! + +# Comment to post when removing the stale label. +# unmarkComment: > +# Your comment here. + +# Comment to post when closing a stale Issue or Pull Request. +# closeComment: > +# Your comment here. + +# Limit the number of actions per hour, from 1-30. Default is 30 +limitPerRun: 30 + +# Limit to only `issues` or `pulls` +# only: issues + +# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': +# pulls: +# daysUntilStale: 30 +# markComment: > +# This pull request has been automatically marked as stale because it has not had +# recent activity. It will be closed if no further activity occurs. Thank you +# for your contributions. + +# issues: +# exemptLabels: +# - confirmed \ No newline at end of file From 903d30080d99b1601093b7af5a6db4c154bd7f27 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 3 Sep 2019 01:36:24 -0400 Subject: [PATCH 529/661] Revert "Mark as experiemental" This reverts commit 4275312e5174149357283c263e10c45c5552dd4b. --- src/csharp/Grpc.Tools/build/_grpc/Grpc.CSharp.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Tools/build/_grpc/Grpc.CSharp.xml b/src/csharp/Grpc.Tools/build/_grpc/Grpc.CSharp.xml index 2728c8bfdc2..dd220bf564d 100644 --- a/src/csharp/Grpc.Tools/build/_grpc/Grpc.CSharp.xml +++ b/src/csharp/Grpc.Tools/build/_grpc/Grpc.CSharp.xml @@ -28,7 +28,7 @@ + Description="The base type to use for the client."> From bac5b38c3641582684da353094fa6d1d6dfbf5ae Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 3 Sep 2019 01:38:32 -0400 Subject: [PATCH 530/661] Revert "Feedbackg" This reverts commit a0adb5003ce6066b795009cc9f2d3abaca9180b7. --- src/csharp/Grpc.Tools/build/_grpc/Grpc.CSharp.xml | 11 ----------- src/csharp/Grpc.Tools/build/_grpc/_Grpc.Tools.targets | 4 +--- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/csharp/Grpc.Tools/build/_grpc/Grpc.CSharp.xml b/src/csharp/Grpc.Tools/build/_grpc/Grpc.CSharp.xml index dd220bf564d..66862582dad 100644 --- a/src/csharp/Grpc.Tools/build/_grpc/Grpc.CSharp.xml +++ b/src/csharp/Grpc.Tools/build/_grpc/Grpc.CSharp.xml @@ -26,16 +26,5 @@ - - - - - - - - diff --git a/src/csharp/Grpc.Tools/build/_grpc/_Grpc.Tools.targets b/src/csharp/Grpc.Tools/build/_grpc/_Grpc.Tools.targets index bc78e340e33..493212fe7e5 100644 --- a/src/csharp/Grpc.Tools/build/_grpc/_Grpc.Tools.targets +++ b/src/csharp/Grpc.Tools/build/_grpc/_Grpc.Tools.targets @@ -38,13 +38,11 @@ <_GrpcOutputOptions>%(Protobuf_Compile._GrpcOutputOptions);no_server + <_GrpcOutputOptions Condition=" '%(Protobuf_Compile.ClientType)' == 'LiteClient' ">%(Protobuf_Compile._GrpcOutputOptions);lite_client <_GrpcOutputOptions>%(Protobuf_Compile._GrpcOutputOptions);no_client - - <_GrpcOutputOptions Condition=" '%(Protobuf_Compile.ClientBaseType)' == 'LiteClientBase' ">%(Protobuf_Compile._GrpcOutputOptions);lite_client - From 0afe3dba92921230ab87b88ad3d62895e40375cb Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 3 Sep 2019 01:39:01 -0400 Subject: [PATCH 531/661] Revert "Add MSBuild metadata to set LiteClient for client generation." This reverts commit 9b3c9e3635a360bfe2b7bd8b09e787b5d8f73d11. --- src/csharp/Grpc.Tools/build/_grpc/_Grpc.Tools.targets | 1 - 1 file changed, 1 deletion(-) diff --git a/src/csharp/Grpc.Tools/build/_grpc/_Grpc.Tools.targets b/src/csharp/Grpc.Tools/build/_grpc/_Grpc.Tools.targets index 493212fe7e5..dd01b8183db 100644 --- a/src/csharp/Grpc.Tools/build/_grpc/_Grpc.Tools.targets +++ b/src/csharp/Grpc.Tools/build/_grpc/_Grpc.Tools.targets @@ -38,7 +38,6 @@ <_GrpcOutputOptions>%(Protobuf_Compile._GrpcOutputOptions);no_server - <_GrpcOutputOptions Condition=" '%(Protobuf_Compile.ClientType)' == 'LiteClient' ">%(Protobuf_Compile._GrpcOutputOptions);lite_client <_GrpcOutputOptions>%(Protobuf_Compile._GrpcOutputOptions);no_client From 4c34f8352c0d3f02527297de8f7cc8e23eb1c6a8 Mon Sep 17 00:00:00 2001 From: Tim Gates Date: Tue, 3 Sep 2019 20:09:42 +1000 Subject: [PATCH 532/661] Fix simple typo: avaiable -> available --- doc/server_side_auth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/server_side_auth.md b/doc/server_side_auth.md index e425289faa9..5905626fea6 100644 --- a/doc/server_side_auth.md +++ b/doc/server_side_auth.md @@ -2,7 +2,7 @@ Server-side API for Authenticating Clients ========================================== NOTE: This document describes how server-side authentication works in C-core based gRPC implementations only. In gRPC Java and Go, server side authentication is handled differently. -NOTE2: `CallCredentials` class is only valid for secure channels in C-Core. So, for connections under insecure channels, features below might not be avaiable. +NOTE2: `CallCredentials` class is only valid for secure channels in C-Core. So, for connections under insecure channels, features below might not be available. ## AuthContext From 3c5715466fb95a83186277f9e68e818316f9f32f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 3 Sep 2019 17:03:11 +0200 Subject: [PATCH 533/661] remove C# workaround for DeadlineExceeded status #2685 --- src/csharp/Grpc.Core.Tests/TimeoutsTest.cs | 10 +++------- .../Grpc.Examples.Tests/MathClientServerTests.cs | 4 +--- src/csharp/Grpc.IntegrationTesting/InteropClient.cs | 3 +-- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/TimeoutsTest.cs b/src/csharp/Grpc.Core.Tests/TimeoutsTest.cs index 55e69a01813..d92a2b9ff72 100644 --- a/src/csharp/Grpc.Core.Tests/TimeoutsTest.cs +++ b/src/csharp/Grpc.Core.Tests/TimeoutsTest.cs @@ -96,8 +96,7 @@ namespace Grpc.Core.Tests }); var ex = Assert.Throws(() => Calls.BlockingUnaryCall(helper.CreateUnaryCall(new CallOptions(deadline: DateTime.MinValue)), "abc")); - // We can't guarantee the status code always DeadlineExceeded. See issue #2685. - Assert.Contains(ex.Status.StatusCode, new[] { StatusCode.DeadlineExceeded, StatusCode.Internal }); + Assert.AreEqual(StatusCode.DeadlineExceeded, ex.Status.StatusCode); } [Test] @@ -110,8 +109,7 @@ namespace Grpc.Core.Tests }); var ex = Assert.Throws(() => Calls.BlockingUnaryCall(helper.CreateUnaryCall(new CallOptions(deadline: DateTime.UtcNow.Add(TimeSpan.FromSeconds(5)))), "abc")); - // We can't guarantee the status code always DeadlineExceeded. See issue #2685. - Assert.Contains(ex.Status.StatusCode, new[] { StatusCode.DeadlineExceeded, StatusCode.Internal }); + Assert.AreEqual(StatusCode.DeadlineExceeded, ex.Status.StatusCode); } [Test] @@ -130,9 +128,7 @@ namespace Grpc.Core.Tests }); var ex = Assert.Throws(() => Calls.BlockingUnaryCall(helper.CreateUnaryCall(new CallOptions(deadline: DateTime.UtcNow.Add(TimeSpan.FromSeconds(5)))), "abc")); - // We can't guarantee the status code always DeadlineExceeded. See issue #2685. - Assert.Contains(ex.Status.StatusCode, new[] { StatusCode.DeadlineExceeded, StatusCode.Internal }); - + Assert.AreEqual(StatusCode.DeadlineExceeded, ex.Status.StatusCode); Assert.IsTrue(await serverReceivedCancellationTcs.Task); } } diff --git a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs index ded80ffba5f..6fa27a6b9af 100644 --- a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs +++ b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs @@ -136,9 +136,7 @@ namespace Math.Tests deadline: DateTime.UtcNow.AddMilliseconds(500))) { var ex = Assert.ThrowsAsync(async () => await call.ResponseStream.ToListAsync()); - - // We can't guarantee the status code always DeadlineExceeded. See issue #2685. - Assert.Contains(ex.Status.StatusCode, new[] { StatusCode.DeadlineExceeded, StatusCode.Internal }); + Assert.AreEqual(StatusCode.DeadlineExceeded, ex.Status.StatusCode); } } diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 83b0095f7f0..53cd4562ead 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -476,8 +476,7 @@ namespace Grpc.IntegrationTesting } catch (RpcException ex) { - // We can't guarantee the status code always DeadlineExceeded. See issue #2685. - Assert.Contains(ex.Status.StatusCode, new[] { StatusCode.DeadlineExceeded, StatusCode.Internal }); + Assert.AreEqual(StatusCode.DeadlineExceeded, ex.Status.StatusCode); } } Console.WriteLine("Passed!"); From b28b483628e28b1438652896e705c1164b08b5a0 Mon Sep 17 00:00:00 2001 From: Moiz Haidry Date: Tue, 3 Sep 2019 09:05:56 -0700 Subject: [PATCH 534/661] Assing Nana to next Github rotation --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/cleanup_request.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/pull_request_template.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index e44c8966012..4709997666e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Report a bug about: Create a report to help us improve labels: kind/bug, priority/P2 -assignees: mhaidrygoog +assignees: nanahpang --- diff --git a/.github/ISSUE_TEMPLATE/cleanup_request.md b/.github/ISSUE_TEMPLATE/cleanup_request.md index 4fe128984b9..4ec33fafb58 100644 --- a/.github/ISSUE_TEMPLATE/cleanup_request.md +++ b/.github/ISSUE_TEMPLATE/cleanup_request.md @@ -2,7 +2,7 @@ name: Request a cleanup about: Suggest a cleanup in our repository labels: kind/internal cleanup -assignees: mhaidrygoog +assignees: nanahpang --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 499de024dd4..efa5b1611bb 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,7 +2,7 @@ name: Request a feature about: Suggest an idea for this project labels: kind/enhancement -assignees: mhaidrygoog +assignees: nanahpang --- diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ac8c41a9f26..55d8d600541 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,4 +8,4 @@ If you know who should review your pull request, please remove the mentioning be --> -@mhaidrygoog \ No newline at end of file +@nanahpang From 647a9701f715a805da2bcefce49f8757c9dbcc9e Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 3 Sep 2019 09:23:56 -0700 Subject: [PATCH 535/661] Update debian:jessie docker to pin bundler version --- tools/dockerfile/distribtest/ruby_jessie_x64/Dockerfile | 2 +- tools/dockerfile/distribtest/ruby_jessie_x86/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/dockerfile/distribtest/ruby_jessie_x64/Dockerfile b/tools/dockerfile/distribtest/ruby_jessie_x64/Dockerfile index 57d6771f9db..077aa16a057 100644 --- a/tools/dockerfile/distribtest/ruby_jessie_x64/Dockerfile +++ b/tools/dockerfile/distribtest/ruby_jessie_x64/Dockerfile @@ -16,4 +16,4 @@ FROM debian:jessie RUN apt-get update && apt-get install -y ruby-full -RUN gem install bundler +RUN gem install bundler -v 1.17.3 --no-document diff --git a/tools/dockerfile/distribtest/ruby_jessie_x86/Dockerfile b/tools/dockerfile/distribtest/ruby_jessie_x86/Dockerfile index 04cfa51069c..48fba1fc2a2 100644 --- a/tools/dockerfile/distribtest/ruby_jessie_x86/Dockerfile +++ b/tools/dockerfile/distribtest/ruby_jessie_x86/Dockerfile @@ -16,4 +16,4 @@ FROM i386/debian:jessie RUN apt-get update && apt-get install -y ruby-full -RUN gem install bundler +RUN gem install bundler -v 1.17.3 --no-document From 49b9fb2b3ca8cc048db476b4b7aedb703dbb1734 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Mon, 12 Aug 2019 16:43:24 -0700 Subject: [PATCH 536/661] Enable C++ standard library --- CMakeLists.txt | 1034 --------------------- Makefile | 418 ++++----- config.m4 | 2 + include/grpc/impl/codegen/port_platform.h | 3 +- src/php/ext/grpc/config.m4 | 3 +- src/ruby/ext/grpc/rb_enable_cpp.cc | 22 + templates/CMakeLists.txt.template | 20 - templates/Makefile.template | 4 +- templates/config.m4.template | 2 + 9 files changed, 240 insertions(+), 1268 deletions(-) create mode 100644 src/ruby/ext/grpc/rb_enable_cpp.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index c5cdfff7f56..599f1441583 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,11 +125,6 @@ if(gRPC_BACKWARDS_COMPATIBILITY_MODE) endif() if (_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_IOS) - # C core has C++ source code, but should not depend on libstc++ (for better portability). - # We need to use a few tricks to convince cmake to do that. - # https://stackoverflow.com/questions/15058403/how-to-stop-cmake-from-linking-against-libstdc - set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") - # Exceptions and RTTI must be off to avoid dependency on libstdc++ set(_gRPC_CORE_NOSTDCXX_FLAGS -fno-exceptions -fno-rtti) else() set(_gRPC_CORE_NOSTDCXX_FLAGS "") @@ -797,12 +792,6 @@ target_include_directories(address_sorting PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(address_sorting PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(address_sorting PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(address_sorting ${_gRPC_BASELIB_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} @@ -851,12 +840,6 @@ target_include_directories(alts_test_util PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(alts_test_util PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(alts_test_util PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(alts_test_util ${_gRPC_SSL_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} @@ -935,12 +918,6 @@ target_include_directories(gpr PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(gpr PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(gpr ${_gRPC_ALLTARGETS_LIBRARIES} ) @@ -1404,12 +1381,6 @@ target_include_directories(grpc PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(grpc PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(grpc ${_gRPC_BASELIB_LIBRARIES} ${_gRPC_SSL_LIBRARIES} @@ -1824,12 +1795,6 @@ target_include_directories(grpc_cronet PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_cronet PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(grpc_cronet PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(grpc_cronet ${_gRPC_BASELIB_LIBRARIES} ${_gRPC_SSL_LIBRARIES} @@ -2181,12 +2146,6 @@ target_include_directories(grpc_test_util PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_test_util PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(grpc_test_util PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(grpc_test_util ${_gRPC_ALLTARGETS_LIBRARIES} gpr @@ -2535,12 +2494,6 @@ target_include_directories(grpc_test_util_unsecure PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_test_util_unsecure PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(grpc_test_util_unsecure PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(grpc_test_util_unsecure ${_gRPC_ALLTARGETS_LIBRARIES} gpr @@ -2929,12 +2882,6 @@ target_include_directories(grpc_unsecure PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_unsecure PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(grpc_unsecure PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(grpc_unsecure ${_gRPC_BASELIB_LIBRARIES} ${_gRPC_ZLIB_LIBRARIES} @@ -3032,12 +2979,6 @@ target_include_directories(reconnect_server PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(reconnect_server PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(reconnect_server PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(reconnect_server ${_gRPC_ALLTARGETS_LIBRARIES} test_tcp_server @@ -3080,12 +3021,6 @@ target_include_directories(test_tcp_server PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(test_tcp_server PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(test_tcp_server PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(test_tcp_server ${_gRPC_ALLTARGETS_LIBRARIES} grpc_test_util @@ -5445,12 +5380,6 @@ target_include_directories(grpc_csharp_ext PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_csharp_ext PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(grpc_csharp_ext PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(grpc_csharp_ext ${_gRPC_ALLTARGETS_LIBRARIES} grpc @@ -5548,12 +5477,6 @@ target_include_directories(bad_ssl_test_server PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(bad_ssl_test_server PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(bad_ssl_test_server PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(bad_ssl_test_server ${_gRPC_ALLTARGETS_LIBRARIES} grpc_test_util @@ -5674,12 +5597,6 @@ target_include_directories(end2end_tests PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(end2end_tests PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(end2end_tests PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(end2end_tests ${_gRPC_SSL_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} @@ -5800,12 +5717,6 @@ target_include_directories(end2end_nosec_tests PRIVATE ${_gRPC_UPB_INCLUDE_DIR} PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(end2end_nosec_tests PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(end2end_nosec_tests PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() target_link_libraries(end2end_nosec_tests ${_gRPC_ALLTARGETS_LIBRARIES} grpc_test_util_unsecure @@ -5845,11 +5756,6 @@ target_link_libraries(algorithm_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(algorithm_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(algorithm_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -5881,11 +5787,6 @@ target_link_libraries(alloc_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(alloc_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(alloc_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -5917,11 +5818,6 @@ target_link_libraries(alpn_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(alpn_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(alpn_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -5953,11 +5849,6 @@ target_link_libraries(arena_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(arena_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(arena_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -5989,11 +5880,6 @@ target_link_libraries(avl_test grpc ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(avl_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(avl_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6026,11 +5912,6 @@ target_link_libraries(bad_server_response_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(bad_server_response_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(bad_server_response_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6061,11 +5942,6 @@ target_link_libraries(bin_decoder_test grpc ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(bin_decoder_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(bin_decoder_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6096,11 +5972,6 @@ target_link_libraries(bin_encoder_test grpc ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(bin_encoder_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(bin_encoder_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6133,11 +6004,6 @@ target_link_libraries(buffer_list_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(buffer_list_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(buffer_list_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -6170,11 +6036,6 @@ target_link_libraries(channel_create_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(channel_create_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(channel_create_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) @@ -6204,11 +6065,6 @@ target_link_libraries(check_epollexclusive gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(check_epollexclusive PROPERTIES LINKER_LANGUAGE C) - target_compile_options(check_epollexclusive PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() if (gRPC_BUILD_TESTS) @@ -6239,11 +6095,6 @@ target_link_libraries(chttp2_hpack_encoder_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(chttp2_hpack_encoder_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(chttp2_hpack_encoder_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6275,11 +6126,6 @@ target_link_libraries(chttp2_stream_map_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(chttp2_stream_map_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(chttp2_stream_map_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6311,11 +6157,6 @@ target_link_libraries(chttp2_varint_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(chttp2_varint_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(chttp2_varint_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6348,11 +6189,6 @@ target_link_libraries(close_fd_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(close_fd_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(close_fd_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -6385,11 +6221,6 @@ target_link_libraries(cmdline_test grpc ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(cmdline_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(cmdline_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6421,11 +6252,6 @@ target_link_libraries(combiner_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(combiner_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(combiner_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6457,11 +6283,6 @@ target_link_libraries(compression_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(compression_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(compression_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6493,11 +6314,6 @@ target_link_libraries(concurrent_connectivity_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(concurrent_connectivity_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(concurrent_connectivity_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6529,11 +6345,6 @@ target_link_libraries(connection_refused_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(connection_refused_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(connection_refused_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6565,11 +6376,6 @@ target_link_libraries(dns_resolver_connectivity_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(dns_resolver_connectivity_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(dns_resolver_connectivity_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6601,11 +6407,6 @@ target_link_libraries(dns_resolver_cooldown_using_ares_resolver_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(dns_resolver_cooldown_using_ares_resolver_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(dns_resolver_cooldown_using_ares_resolver_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6637,11 +6438,6 @@ target_link_libraries(dns_resolver_cooldown_using_native_resolver_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(dns_resolver_cooldown_using_native_resolver_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(dns_resolver_cooldown_using_native_resolver_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6673,11 +6469,6 @@ target_link_libraries(dns_resolver_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(dns_resolver_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(dns_resolver_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6710,11 +6501,6 @@ target_link_libraries(dualstack_socket_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(dualstack_socket_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(dualstack_socket_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -6747,11 +6533,6 @@ target_link_libraries(endpoint_pair_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(endpoint_pair_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(endpoint_pair_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6783,11 +6564,6 @@ target_link_libraries(error_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(error_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(error_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6820,11 +6596,6 @@ target_link_libraries(ev_epollex_linux_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(ev_epollex_linux_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(ev_epollex_linux_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -6857,11 +6628,6 @@ target_link_libraries(fake_resolver_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(fake_resolver_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(fake_resolver_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -6895,11 +6661,6 @@ target_link_libraries(fake_transport_security_test grpc ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(fake_transport_security_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(fake_transport_security_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -6933,11 +6694,6 @@ target_link_libraries(fd_conservation_posix_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(fd_conservation_posix_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(fd_conservation_posix_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -6971,11 +6727,6 @@ target_link_libraries(fd_posix_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(fd_posix_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(fd_posix_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -7008,11 +6759,6 @@ target_link_libraries(fling_client gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(fling_client PROPERTIES LINKER_LANGUAGE C) - target_compile_options(fling_client PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7044,11 +6790,6 @@ target_link_libraries(fling_server gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(fling_server PROPERTIES LINKER_LANGUAGE C) - target_compile_options(fling_server PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7081,11 +6822,6 @@ target_link_libraries(fling_stream_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(fling_stream_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(fling_stream_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -7119,11 +6855,6 @@ target_link_libraries(fling_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(fling_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(fling_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -7157,11 +6888,6 @@ target_link_libraries(fork_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(fork_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(fork_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -7195,11 +6921,6 @@ target_link_libraries(goaway_server_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(goaway_server_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(goaway_server_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -7232,11 +6953,6 @@ target_link_libraries(gpr_cpu_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr_cpu_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(gpr_cpu_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7268,11 +6984,6 @@ target_link_libraries(gpr_env_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr_env_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(gpr_env_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7304,11 +7015,6 @@ target_link_libraries(gpr_host_port_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr_host_port_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(gpr_host_port_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7340,11 +7046,6 @@ target_link_libraries(gpr_log_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr_log_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(gpr_log_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7376,11 +7077,6 @@ target_link_libraries(gpr_manual_constructor_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr_manual_constructor_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(gpr_manual_constructor_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7412,11 +7108,6 @@ target_link_libraries(gpr_mpscq_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr_mpscq_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(gpr_mpscq_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7448,11 +7139,6 @@ target_link_libraries(gpr_spinlock_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr_spinlock_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(gpr_spinlock_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7484,11 +7170,6 @@ target_link_libraries(gpr_string_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr_string_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(gpr_string_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7520,11 +7201,6 @@ target_link_libraries(gpr_sync_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr_sync_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(gpr_sync_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7556,11 +7232,6 @@ target_link_libraries(gpr_thd_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr_thd_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(gpr_thd_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7592,11 +7263,6 @@ target_link_libraries(gpr_time_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr_time_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(gpr_time_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7628,11 +7294,6 @@ target_link_libraries(gpr_tls_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr_tls_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(gpr_tls_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7664,11 +7325,6 @@ target_link_libraries(gpr_useful_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(gpr_useful_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(gpr_useful_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7700,11 +7356,6 @@ target_link_libraries(grpc_auth_context_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_auth_context_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_auth_context_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7736,11 +7387,6 @@ target_link_libraries(grpc_b64_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_b64_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_b64_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7772,11 +7418,6 @@ target_link_libraries(grpc_byte_buffer_reader_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_byte_buffer_reader_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_byte_buffer_reader_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7808,11 +7449,6 @@ target_link_libraries(grpc_channel_args_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_channel_args_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_channel_args_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7844,11 +7480,6 @@ target_link_libraries(grpc_channel_stack_builder_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_channel_stack_builder_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_channel_stack_builder_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7880,11 +7511,6 @@ target_link_libraries(grpc_channel_stack_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_channel_stack_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_channel_stack_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7916,11 +7542,6 @@ target_link_libraries(grpc_completion_queue_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_completion_queue_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_completion_queue_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7952,11 +7573,6 @@ target_link_libraries(grpc_completion_queue_threading_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_completion_queue_threading_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_completion_queue_threading_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -7988,11 +7604,6 @@ target_link_libraries(grpc_control_plane_credentials_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_control_plane_credentials_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_control_plane_credentials_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) @@ -8024,11 +7635,6 @@ target_link_libraries(grpc_create_jwt gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_create_jwt PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_create_jwt PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() if (gRPC_BUILD_TESTS) @@ -8059,11 +7665,6 @@ target_link_libraries(grpc_credentials_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_credentials_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_credentials_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8095,11 +7696,6 @@ target_link_libraries(grpc_ipv6_loopback_available_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_ipv6_loopback_available_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_ipv6_loopback_available_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8132,11 +7728,6 @@ target_link_libraries(grpc_json_token_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_json_token_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_json_token_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -8169,11 +7760,6 @@ target_link_libraries(grpc_jwt_verifier_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_jwt_verifier_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_jwt_verifier_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) @@ -8204,11 +7790,6 @@ target_link_libraries(grpc_print_google_default_creds_token gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_print_google_default_creds_token PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_print_google_default_creds_token PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() if (gRPC_BUILD_TESTS) @@ -8239,11 +7820,6 @@ target_link_libraries(grpc_security_connector_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_security_connector_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_security_connector_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8275,11 +7851,6 @@ target_link_libraries(grpc_ssl_credentials_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_ssl_credentials_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_ssl_credentials_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) @@ -8310,11 +7881,6 @@ target_link_libraries(grpc_verify_jwt gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(grpc_verify_jwt PROPERTIES LINKER_LANGUAGE C) - target_compile_options(grpc_verify_jwt PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() if (gRPC_BUILD_TESTS) if(_gRPC_PLATFORM_LINUX) @@ -8347,11 +7913,6 @@ target_link_libraries(handshake_client_ssl gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(handshake_client_ssl PROPERTIES LINKER_LANGUAGE C) - target_compile_options(handshake_client_ssl PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -8387,11 +7948,6 @@ target_link_libraries(handshake_server_ssl gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(handshake_server_ssl PROPERTIES LINKER_LANGUAGE C) - target_compile_options(handshake_server_ssl PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -8427,11 +7983,6 @@ target_link_libraries(handshake_server_with_readahead_handshaker gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(handshake_server_with_readahead_handshaker PROPERTIES LINKER_LANGUAGE C) - target_compile_options(handshake_server_with_readahead_handshaker PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -8466,11 +8017,6 @@ target_link_libraries(handshake_verify_peer_options gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(handshake_verify_peer_options PROPERTIES LINKER_LANGUAGE C) - target_compile_options(handshake_verify_peer_options PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -8502,11 +8048,6 @@ target_link_libraries(histogram_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(histogram_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(histogram_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8538,11 +8079,6 @@ target_link_libraries(hpack_parser_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(hpack_parser_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(hpack_parser_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8574,11 +8110,6 @@ target_link_libraries(hpack_table_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(hpack_table_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(hpack_table_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8610,11 +8141,6 @@ target_link_libraries(http_parser_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(http_parser_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(http_parser_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8646,11 +8172,6 @@ target_link_libraries(httpcli_format_request_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(httpcli_format_request_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(httpcli_format_request_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8683,11 +8204,6 @@ target_link_libraries(httpcli_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(httpcli_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(httpcli_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -8721,11 +8237,6 @@ target_link_libraries(httpscli_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(httpscli_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(httpscli_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -8758,11 +8269,6 @@ target_link_libraries(init_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(init_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(init_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8794,11 +8300,6 @@ target_link_libraries(inproc_callback_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(inproc_callback_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(inproc_callback_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8830,11 +8331,6 @@ target_link_libraries(invalid_call_argument_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(invalid_call_argument_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(invalid_call_argument_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8866,11 +8362,6 @@ target_link_libraries(json_rewrite gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(json_rewrite PROPERTIES LINKER_LANGUAGE C) - target_compile_options(json_rewrite PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8902,11 +8393,6 @@ target_link_libraries(json_rewrite_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(json_rewrite_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(json_rewrite_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8938,11 +8424,6 @@ target_link_libraries(json_stream_error_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(json_stream_error_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(json_stream_error_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -8974,11 +8455,6 @@ target_link_libraries(json_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(json_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(json_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9010,11 +8486,6 @@ target_link_libraries(lame_client_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(lame_client_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(lame_client_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9046,11 +8517,6 @@ target_link_libraries(load_file_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(load_file_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(load_file_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9082,11 +8548,6 @@ target_link_libraries(memory_usage_client gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(memory_usage_client PROPERTIES LINKER_LANGUAGE C) - target_compile_options(memory_usage_client PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9118,11 +8579,6 @@ target_link_libraries(memory_usage_server gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(memory_usage_server PROPERTIES LINKER_LANGUAGE C) - target_compile_options(memory_usage_server PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9155,11 +8611,6 @@ target_link_libraries(memory_usage_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(memory_usage_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(memory_usage_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -9192,11 +8643,6 @@ target_link_libraries(message_compress_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(message_compress_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(message_compress_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9228,11 +8674,6 @@ target_link_libraries(minimal_stack_is_minimal_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(minimal_stack_is_minimal_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(minimal_stack_is_minimal_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9264,11 +8705,6 @@ target_link_libraries(mpmcqueue_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(mpmcqueue_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(mpmcqueue_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9300,11 +8736,6 @@ target_link_libraries(multiple_server_queues_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(multiple_server_queues_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(multiple_server_queues_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9336,11 +8767,6 @@ target_link_libraries(murmur_hash_test grpc_unsecure ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(murmur_hash_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(murmur_hash_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9372,11 +8798,6 @@ target_link_libraries(no_server_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(no_server_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(no_server_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9408,11 +8829,6 @@ target_link_libraries(num_external_connectivity_watchers_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(num_external_connectivity_watchers_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(num_external_connectivity_watchers_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9444,11 +8860,6 @@ target_link_libraries(parse_address_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(parse_address_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(parse_address_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9481,11 +8892,6 @@ target_link_libraries(parse_address_with_named_scope_id_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(parse_address_with_named_scope_id_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(parse_address_with_named_scope_id_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -9518,11 +8924,6 @@ target_link_libraries(percent_encoding_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(percent_encoding_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(percent_encoding_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9555,11 +8956,6 @@ target_link_libraries(resolve_address_using_ares_resolver_posix_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(resolve_address_using_ares_resolver_posix_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(resolve_address_using_ares_resolver_posix_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -9592,11 +8988,6 @@ target_link_libraries(resolve_address_using_ares_resolver_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(resolve_address_using_ares_resolver_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(resolve_address_using_ares_resolver_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9629,11 +9020,6 @@ target_link_libraries(resolve_address_using_native_resolver_posix_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(resolve_address_using_native_resolver_posix_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(resolve_address_using_native_resolver_posix_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -9666,11 +9052,6 @@ target_link_libraries(resolve_address_using_native_resolver_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(resolve_address_using_native_resolver_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(resolve_address_using_native_resolver_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9702,11 +9083,6 @@ target_link_libraries(resource_quota_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(resource_quota_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(resource_quota_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9738,11 +9114,6 @@ target_link_libraries(secure_channel_create_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(secure_channel_create_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(secure_channel_create_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9774,11 +9145,6 @@ target_link_libraries(secure_endpoint_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(secure_endpoint_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(secure_endpoint_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9810,11 +9176,6 @@ target_link_libraries(sequential_connectivity_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(sequential_connectivity_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(sequential_connectivity_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9846,11 +9207,6 @@ target_link_libraries(server_chttp2_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(server_chttp2_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(server_chttp2_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9882,11 +9238,6 @@ target_link_libraries(server_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(server_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(server_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9918,11 +9269,6 @@ target_link_libraries(slice_buffer_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(slice_buffer_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(slice_buffer_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9954,11 +9300,6 @@ target_link_libraries(slice_string_helpers_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(slice_string_helpers_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(slice_string_helpers_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -9990,11 +9331,6 @@ target_link_libraries(slice_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(slice_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(slice_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10026,11 +9362,6 @@ target_link_libraries(sockaddr_resolver_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(sockaddr_resolver_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(sockaddr_resolver_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10062,11 +9393,6 @@ target_link_libraries(sockaddr_utils_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(sockaddr_utils_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(sockaddr_utils_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10099,11 +9425,6 @@ target_link_libraries(socket_utils_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(socket_utils_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(socket_utils_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -10138,11 +9459,6 @@ target_link_libraries(ssl_transport_security_test grpc ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(ssl_transport_security_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(ssl_transport_security_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -10175,11 +9491,6 @@ target_link_libraries(status_conversion_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(status_conversion_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(status_conversion_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10211,11 +9522,6 @@ target_link_libraries(stream_compression_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(stream_compression_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(stream_compression_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10247,11 +9553,6 @@ target_link_libraries(stream_owned_slice_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(stream_owned_slice_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(stream_owned_slice_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10284,11 +9585,6 @@ target_link_libraries(tcp_client_posix_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(tcp_client_posix_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(tcp_client_posix_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -10321,11 +9617,6 @@ target_link_libraries(tcp_client_uv_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(tcp_client_uv_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(tcp_client_uv_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10358,11 +9649,6 @@ target_link_libraries(tcp_posix_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(tcp_posix_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(tcp_posix_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -10396,11 +9682,6 @@ target_link_libraries(tcp_server_posix_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(tcp_server_posix_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(tcp_server_posix_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -10433,11 +9714,6 @@ target_link_libraries(tcp_server_uv_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(tcp_server_uv_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(tcp_server_uv_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10469,11 +9745,6 @@ target_link_libraries(threadpool_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(threadpool_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(threadpool_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10505,11 +9776,6 @@ target_link_libraries(time_averaged_stats_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(time_averaged_stats_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(time_averaged_stats_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10541,11 +9807,6 @@ target_link_libraries(timeout_encoding_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(timeout_encoding_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(timeout_encoding_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10577,11 +9838,6 @@ target_link_libraries(timer_heap_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(timer_heap_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(timer_heap_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10613,11 +9869,6 @@ target_link_libraries(timer_list_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(timer_list_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(timer_list_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10649,11 +9900,6 @@ target_link_libraries(transport_connectivity_state_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(transport_connectivity_state_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(transport_connectivity_state_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10685,11 +9931,6 @@ target_link_libraries(transport_metadata_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(transport_metadata_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(transport_metadata_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -10722,11 +9963,6 @@ target_link_libraries(transport_security_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(transport_security_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(transport_security_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -10760,11 +9996,6 @@ target_link_libraries(udp_server_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(udp_server_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(udp_server_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -10797,11 +10028,6 @@ target_link_libraries(uri_parser_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(uri_parser_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(uri_parser_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18226,11 +17452,6 @@ target_link_libraries(bad_ssl_cert_server gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(bad_ssl_cert_server PROPERTIES LINKER_LANGUAGE C) - target_compile_options(bad_ssl_cert_server PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -18264,11 +17485,6 @@ target_link_libraries(bad_ssl_cert_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(bad_ssl_cert_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(bad_ssl_cert_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -18302,11 +17518,6 @@ target_link_libraries(h2_census_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_census_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_census_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18339,11 +17550,6 @@ target_link_libraries(h2_compress_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_compress_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_compress_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18376,11 +17582,6 @@ target_link_libraries(h2_fakesec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_fakesec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_fakesec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18414,11 +17615,6 @@ target_link_libraries(h2_fd_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_fd_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_fd_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -18452,11 +17648,6 @@ target_link_libraries(h2_full_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_full_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_full_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18490,11 +17681,6 @@ target_link_libraries(h2_full+pipe_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_full+pipe_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_full+pipe_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -18528,11 +17714,6 @@ target_link_libraries(h2_full+trace_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_full+trace_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_full+trace_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18565,11 +17746,6 @@ target_link_libraries(h2_full+workarounds_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_full+workarounds_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_full+workarounds_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18602,11 +17778,6 @@ target_link_libraries(h2_http_proxy_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_http_proxy_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_http_proxy_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18640,11 +17811,6 @@ target_link_libraries(h2_local_ipv4_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_local_ipv4_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_local_ipv4_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -18679,11 +17845,6 @@ target_link_libraries(h2_local_ipv6_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_local_ipv6_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_local_ipv6_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -18718,11 +17879,6 @@ target_link_libraries(h2_local_uds_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_local_uds_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_local_uds_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -18756,11 +17912,6 @@ target_link_libraries(h2_oauth2_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_oauth2_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_oauth2_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18793,11 +17944,6 @@ target_link_libraries(h2_proxy_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_proxy_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_proxy_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18830,11 +17976,6 @@ target_link_libraries(h2_sockpair_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_sockpair_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_sockpair_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18867,11 +18008,6 @@ target_link_libraries(h2_sockpair+trace_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_sockpair+trace_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_sockpair+trace_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18904,11 +18040,6 @@ target_link_libraries(h2_sockpair_1byte_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_sockpair_1byte_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_sockpair_1byte_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18941,11 +18072,6 @@ target_link_libraries(h2_spiffe_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_spiffe_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_spiffe_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -18978,11 +18104,6 @@ target_link_libraries(h2_ssl_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_ssl_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_ssl_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19015,11 +18136,6 @@ target_link_libraries(h2_ssl_cred_reload_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_ssl_cred_reload_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_ssl_cred_reload_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19052,11 +18168,6 @@ target_link_libraries(h2_ssl_proxy_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_ssl_proxy_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_ssl_proxy_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19090,11 +18201,6 @@ target_link_libraries(h2_uds_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_uds_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_uds_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -19128,11 +18234,6 @@ target_link_libraries(inproc_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(inproc_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(inproc_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19165,11 +18266,6 @@ target_link_libraries(h2_census_nosec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_census_nosec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_census_nosec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19202,11 +18298,6 @@ target_link_libraries(h2_compress_nosec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_compress_nosec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_compress_nosec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19240,11 +18331,6 @@ target_link_libraries(h2_fd_nosec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_fd_nosec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_fd_nosec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -19278,11 +18364,6 @@ target_link_libraries(h2_full_nosec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_full_nosec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_full_nosec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19316,11 +18397,6 @@ target_link_libraries(h2_full+pipe_nosec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_full+pipe_nosec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_full+pipe_nosec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -19354,11 +18430,6 @@ target_link_libraries(h2_full+trace_nosec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_full+trace_nosec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_full+trace_nosec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19391,11 +18462,6 @@ target_link_libraries(h2_full+workarounds_nosec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_full+workarounds_nosec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_full+workarounds_nosec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19428,11 +18494,6 @@ target_link_libraries(h2_http_proxy_nosec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_http_proxy_nosec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_http_proxy_nosec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19465,11 +18526,6 @@ target_link_libraries(h2_proxy_nosec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_proxy_nosec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_proxy_nosec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19502,11 +18558,6 @@ target_link_libraries(h2_sockpair_nosec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_sockpair_nosec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_sockpair_nosec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19539,11 +18590,6 @@ target_link_libraries(h2_sockpair+trace_nosec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_sockpair+trace_nosec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_sockpair+trace_nosec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19576,11 +18622,6 @@ target_link_libraries(h2_sockpair_1byte_nosec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_sockpair_1byte_nosec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_sockpair_1byte_nosec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19614,11 +18655,6 @@ target_link_libraries(h2_uds_nosec_test gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(h2_uds_nosec_test PROPERTIES LINKER_LANGUAGE C) - target_compile_options(h2_uds_nosec_test PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif() endif (gRPC_BUILD_TESTS) @@ -19960,11 +18996,6 @@ target_link_libraries(alts_credentials_fuzzer_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(alts_credentials_fuzzer_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(alts_credentials_fuzzer_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -19997,11 +19028,6 @@ target_link_libraries(api_fuzzer_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(api_fuzzer_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(api_fuzzer_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -20034,11 +19060,6 @@ target_link_libraries(client_fuzzer_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(client_fuzzer_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(client_fuzzer_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -20071,11 +19092,6 @@ target_link_libraries(hpack_parser_fuzzer_test_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(hpack_parser_fuzzer_test_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(hpack_parser_fuzzer_test_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -20108,11 +19124,6 @@ target_link_libraries(http_request_fuzzer_test_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(http_request_fuzzer_test_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(http_request_fuzzer_test_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -20145,11 +19156,6 @@ target_link_libraries(http_response_fuzzer_test_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(http_response_fuzzer_test_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(http_response_fuzzer_test_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -20182,11 +19188,6 @@ target_link_libraries(json_fuzzer_test_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(json_fuzzer_test_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(json_fuzzer_test_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -20219,11 +19220,6 @@ target_link_libraries(nanopb_fuzzer_response_test_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(nanopb_fuzzer_response_test_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(nanopb_fuzzer_response_test_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -20256,11 +19252,6 @@ target_link_libraries(nanopb_fuzzer_serverlist_test_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(nanopb_fuzzer_serverlist_test_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(nanopb_fuzzer_serverlist_test_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -20293,11 +19284,6 @@ target_link_libraries(percent_decode_fuzzer_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(percent_decode_fuzzer_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(percent_decode_fuzzer_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -20330,11 +19316,6 @@ target_link_libraries(percent_encode_fuzzer_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(percent_encode_fuzzer_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(percent_encode_fuzzer_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -20367,11 +19348,6 @@ target_link_libraries(server_fuzzer_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(server_fuzzer_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(server_fuzzer_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -20404,11 +19380,6 @@ target_link_libraries(ssl_server_fuzzer_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(ssl_server_fuzzer_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(ssl_server_fuzzer_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -20441,11 +19412,6 @@ target_link_libraries(uri_fuzzer_test_one_entry gpr ) - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(uri_fuzzer_test_one_entry PROPERTIES LINKER_LANGUAGE C) - target_compile_options(uri_fuzzer_test_one_entry PRIVATE $<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() endif (gRPC_BUILD_TESTS) diff --git a/Makefile b/Makefile index 4ebf5b36cf8..9ac8955d33c 100644 --- a/Makefile +++ b/Makefile @@ -3339,15 +3339,15 @@ ifeq ($(SYSTEM),MINGW32) $(LIBDIR)/$(CONFIG)/address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBADDRESS_SORTING_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/address_sorting$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBADDRESS_SORTING_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/address_sorting$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBADDRESS_SORTING_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBADDRESS_SORTING_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBADDRESS_SORTING_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBADDRESS_SORTING_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libaddress_sorting.so.8 -o $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBADDRESS_SORTING_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libaddress_sorting.so.8 -o $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBADDRESS_SORTING_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) $(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).so.8 $(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).so endif @@ -3535,15 +3535,15 @@ ifeq ($(SYSTEM),MINGW32) $(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGPR_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGPR_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgpr.so.8 -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgpr.so.8 -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so.8 $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so endif @@ -3997,15 +3997,15 @@ ifeq ($(SYSTEM),MINGW32) $(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.8 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.8 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.8 $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so endif @@ -4395,15 +4395,15 @@ ifeq ($(SYSTEM),MINGW32) $(LIBDIR)/$(CONFIG)/grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_CRONET_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_cronet$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_cronet$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_CRONET_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_cronet.so.8 -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_cronet.so.8 -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).so.8 $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).so endif @@ -5438,15 +5438,15 @@ ifeq ($(SYSTEM),MINGW32) $(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_UNSECURE_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_UNSECURE_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_unsecure.so.8 -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_unsecure.so.8 -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so.8 $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so endif @@ -7679,15 +7679,15 @@ ifeq ($(SYSTEM),MINGW32) $(LIBDIR)/$(CONFIG)/grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP): $(LIBGRPC_CSHARP_EXT_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_csharp_ext$(SHARED_VERSION_CSHARP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_csharp_ext$(SHARED_VERSION_CSHARP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP): $(LIBGRPC_CSHARP_EXT_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) $(LDXX) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so endif @@ -8525,7 +8525,7 @@ else $(BINDIR)/$(CONFIG)/algorithm_test: $(ALGORITHM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(ALGORITHM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/algorithm_test + $(Q) $(LDXX) $(LDFLAGS) $(ALGORITHM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/algorithm_test endif @@ -8557,7 +8557,7 @@ else $(BINDIR)/$(CONFIG)/alloc_test: $(ALLOC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(ALLOC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/alloc_test + $(Q) $(LDXX) $(LDFLAGS) $(ALLOC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/alloc_test endif @@ -8589,7 +8589,7 @@ else $(BINDIR)/$(CONFIG)/alpn_test: $(ALPN_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(ALPN_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/alpn_test + $(Q) $(LDXX) $(LDFLAGS) $(ALPN_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/alpn_test endif @@ -8685,7 +8685,7 @@ else $(BINDIR)/$(CONFIG)/arena_test: $(ARENA_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(ARENA_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/arena_test + $(Q) $(LDXX) $(LDFLAGS) $(ARENA_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/arena_test endif @@ -8717,7 +8717,7 @@ else $(BINDIR)/$(CONFIG)/avl_test: $(AVL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(AVL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/avl_test + $(Q) $(LDXX) $(LDFLAGS) $(AVL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/avl_test endif @@ -8749,7 +8749,7 @@ else $(BINDIR)/$(CONFIG)/bad_server_response_test: $(BAD_SERVER_RESPONSE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libtest_tcp_server.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(BAD_SERVER_RESPONSE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libtest_tcp_server.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/bad_server_response_test + $(Q) $(LDXX) $(LDFLAGS) $(BAD_SERVER_RESPONSE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libtest_tcp_server.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/bad_server_response_test endif @@ -8781,7 +8781,7 @@ else $(BINDIR)/$(CONFIG)/bin_decoder_test: $(BIN_DECODER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(BIN_DECODER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/bin_decoder_test + $(Q) $(LDXX) $(LDFLAGS) $(BIN_DECODER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/bin_decoder_test endif @@ -8813,7 +8813,7 @@ else $(BINDIR)/$(CONFIG)/bin_encoder_test: $(BIN_ENCODER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(BIN_ENCODER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/bin_encoder_test + $(Q) $(LDXX) $(LDFLAGS) $(BIN_ENCODER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/bin_encoder_test endif @@ -8845,7 +8845,7 @@ else $(BINDIR)/$(CONFIG)/buffer_list_test: $(BUFFER_LIST_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(BUFFER_LIST_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/buffer_list_test + $(Q) $(LDXX) $(LDFLAGS) $(BUFFER_LIST_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/buffer_list_test endif @@ -8877,7 +8877,7 @@ else $(BINDIR)/$(CONFIG)/channel_create_test: $(CHANNEL_CREATE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(CHANNEL_CREATE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/channel_create_test + $(Q) $(LDXX) $(LDFLAGS) $(CHANNEL_CREATE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/channel_create_test endif @@ -8909,7 +8909,7 @@ else $(BINDIR)/$(CONFIG)/check_epollexclusive: $(CHECK_EPOLLEXCLUSIVE_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(CHECK_EPOLLEXCLUSIVE_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/check_epollexclusive + $(Q) $(LDXX) $(LDFLAGS) $(CHECK_EPOLLEXCLUSIVE_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/check_epollexclusive endif @@ -8941,7 +8941,7 @@ else $(BINDIR)/$(CONFIG)/chttp2_hpack_encoder_test: $(CHTTP2_HPACK_ENCODER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(CHTTP2_HPACK_ENCODER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/chttp2_hpack_encoder_test + $(Q) $(LDXX) $(LDFLAGS) $(CHTTP2_HPACK_ENCODER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/chttp2_hpack_encoder_test endif @@ -8973,7 +8973,7 @@ else $(BINDIR)/$(CONFIG)/chttp2_stream_map_test: $(CHTTP2_STREAM_MAP_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(CHTTP2_STREAM_MAP_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/chttp2_stream_map_test + $(Q) $(LDXX) $(LDFLAGS) $(CHTTP2_STREAM_MAP_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/chttp2_stream_map_test endif @@ -9005,7 +9005,7 @@ else $(BINDIR)/$(CONFIG)/chttp2_varint_test: $(CHTTP2_VARINT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(CHTTP2_VARINT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/chttp2_varint_test + $(Q) $(LDXX) $(LDFLAGS) $(CHTTP2_VARINT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/chttp2_varint_test endif @@ -9069,7 +9069,7 @@ else $(BINDIR)/$(CONFIG)/close_fd_test: $(CLOSE_FD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(CLOSE_FD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/close_fd_test + $(Q) $(LDXX) $(LDFLAGS) $(CLOSE_FD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/close_fd_test endif @@ -9101,7 +9101,7 @@ else $(BINDIR)/$(CONFIG)/cmdline_test: $(CMDLINE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(CMDLINE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/cmdline_test + $(Q) $(LDXX) $(LDFLAGS) $(CMDLINE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/cmdline_test endif @@ -9133,7 +9133,7 @@ else $(BINDIR)/$(CONFIG)/combiner_test: $(COMBINER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(COMBINER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/combiner_test + $(Q) $(LDXX) $(LDFLAGS) $(COMBINER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/combiner_test endif @@ -9165,7 +9165,7 @@ else $(BINDIR)/$(CONFIG)/compression_test: $(COMPRESSION_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(COMPRESSION_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/compression_test + $(Q) $(LDXX) $(LDFLAGS) $(COMPRESSION_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/compression_test endif @@ -9197,7 +9197,7 @@ else $(BINDIR)/$(CONFIG)/concurrent_connectivity_test: $(CONCURRENT_CONNECTIVITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(CONCURRENT_CONNECTIVITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/concurrent_connectivity_test + $(Q) $(LDXX) $(LDFLAGS) $(CONCURRENT_CONNECTIVITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/concurrent_connectivity_test endif @@ -9229,7 +9229,7 @@ else $(BINDIR)/$(CONFIG)/connection_refused_test: $(CONNECTION_REFUSED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(CONNECTION_REFUSED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/connection_refused_test + $(Q) $(LDXX) $(LDFLAGS) $(CONNECTION_REFUSED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/connection_refused_test endif @@ -9261,7 +9261,7 @@ else $(BINDIR)/$(CONFIG)/dns_resolver_connectivity_test: $(DNS_RESOLVER_CONNECTIVITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(DNS_RESOLVER_CONNECTIVITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/dns_resolver_connectivity_test + $(Q) $(LDXX) $(LDFLAGS) $(DNS_RESOLVER_CONNECTIVITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/dns_resolver_connectivity_test endif @@ -9293,7 +9293,7 @@ else $(BINDIR)/$(CONFIG)/dns_resolver_cooldown_using_ares_resolver_test: $(DNS_RESOLVER_COOLDOWN_USING_ARES_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(DNS_RESOLVER_COOLDOWN_USING_ARES_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/dns_resolver_cooldown_using_ares_resolver_test + $(Q) $(LDXX) $(LDFLAGS) $(DNS_RESOLVER_COOLDOWN_USING_ARES_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/dns_resolver_cooldown_using_ares_resolver_test endif @@ -9325,7 +9325,7 @@ else $(BINDIR)/$(CONFIG)/dns_resolver_cooldown_using_native_resolver_test: $(DNS_RESOLVER_COOLDOWN_USING_NATIVE_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(DNS_RESOLVER_COOLDOWN_USING_NATIVE_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/dns_resolver_cooldown_using_native_resolver_test + $(Q) $(LDXX) $(LDFLAGS) $(DNS_RESOLVER_COOLDOWN_USING_NATIVE_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/dns_resolver_cooldown_using_native_resolver_test endif @@ -9357,7 +9357,7 @@ else $(BINDIR)/$(CONFIG)/dns_resolver_test: $(DNS_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(DNS_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/dns_resolver_test + $(Q) $(LDXX) $(LDFLAGS) $(DNS_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/dns_resolver_test endif @@ -9389,7 +9389,7 @@ else $(BINDIR)/$(CONFIG)/dualstack_socket_test: $(DUALSTACK_SOCKET_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(DUALSTACK_SOCKET_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/dualstack_socket_test + $(Q) $(LDXX) $(LDFLAGS) $(DUALSTACK_SOCKET_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/dualstack_socket_test endif @@ -9421,7 +9421,7 @@ else $(BINDIR)/$(CONFIG)/endpoint_pair_test: $(ENDPOINT_PAIR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(ENDPOINT_PAIR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/endpoint_pair_test + $(Q) $(LDXX) $(LDFLAGS) $(ENDPOINT_PAIR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/endpoint_pair_test endif @@ -9453,7 +9453,7 @@ else $(BINDIR)/$(CONFIG)/error_test: $(ERROR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(ERROR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/error_test + $(Q) $(LDXX) $(LDFLAGS) $(ERROR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/error_test endif @@ -9485,7 +9485,7 @@ else $(BINDIR)/$(CONFIG)/ev_epollex_linux_test: $(EV_EPOLLEX_LINUX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(EV_EPOLLEX_LINUX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/ev_epollex_linux_test + $(Q) $(LDXX) $(LDFLAGS) $(EV_EPOLLEX_LINUX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/ev_epollex_linux_test endif @@ -9517,7 +9517,7 @@ else $(BINDIR)/$(CONFIG)/fake_resolver_test: $(FAKE_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(FAKE_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fake_resolver_test + $(Q) $(LDXX) $(LDFLAGS) $(FAKE_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fake_resolver_test endif @@ -9550,7 +9550,7 @@ else $(BINDIR)/$(CONFIG)/fake_transport_security_test: $(FAKE_TRANSPORT_SECURITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(FAKE_TRANSPORT_SECURITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fake_transport_security_test + $(Q) $(LDXX) $(LDFLAGS) $(FAKE_TRANSPORT_SECURITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fake_transport_security_test endif @@ -9584,7 +9584,7 @@ else $(BINDIR)/$(CONFIG)/fd_conservation_posix_test: $(FD_CONSERVATION_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(FD_CONSERVATION_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fd_conservation_posix_test + $(Q) $(LDXX) $(LDFLAGS) $(FD_CONSERVATION_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fd_conservation_posix_test endif @@ -9616,7 +9616,7 @@ else $(BINDIR)/$(CONFIG)/fd_posix_test: $(FD_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(FD_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fd_posix_test + $(Q) $(LDXX) $(LDFLAGS) $(FD_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fd_posix_test endif @@ -9648,7 +9648,7 @@ else $(BINDIR)/$(CONFIG)/fling_client: $(FLING_CLIENT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(FLING_CLIENT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fling_client + $(Q) $(LDXX) $(LDFLAGS) $(FLING_CLIENT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fling_client endif @@ -9680,7 +9680,7 @@ else $(BINDIR)/$(CONFIG)/fling_server: $(FLING_SERVER_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(FLING_SERVER_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fling_server + $(Q) $(LDXX) $(LDFLAGS) $(FLING_SERVER_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fling_server endif @@ -9712,7 +9712,7 @@ else $(BINDIR)/$(CONFIG)/fling_stream_test: $(FLING_STREAM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(FLING_STREAM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fling_stream_test + $(Q) $(LDXX) $(LDFLAGS) $(FLING_STREAM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fling_stream_test endif @@ -9744,7 +9744,7 @@ else $(BINDIR)/$(CONFIG)/fling_test: $(FLING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(FLING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fling_test + $(Q) $(LDXX) $(LDFLAGS) $(FLING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fling_test endif @@ -9776,7 +9776,7 @@ else $(BINDIR)/$(CONFIG)/fork_test: $(FORK_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(FORK_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fork_test + $(Q) $(LDXX) $(LDFLAGS) $(FORK_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fork_test endif @@ -9808,7 +9808,7 @@ else $(BINDIR)/$(CONFIG)/goaway_server_test: $(GOAWAY_SERVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GOAWAY_SERVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/goaway_server_test + $(Q) $(LDXX) $(LDFLAGS) $(GOAWAY_SERVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/goaway_server_test endif @@ -9840,7 +9840,7 @@ else $(BINDIR)/$(CONFIG)/gpr_cpu_test: $(GPR_CPU_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_CPU_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_cpu_test + $(Q) $(LDXX) $(LDFLAGS) $(GPR_CPU_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_cpu_test endif @@ -9872,7 +9872,7 @@ else $(BINDIR)/$(CONFIG)/gpr_env_test: $(GPR_ENV_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_ENV_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_env_test + $(Q) $(LDXX) $(LDFLAGS) $(GPR_ENV_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_env_test endif @@ -9904,7 +9904,7 @@ else $(BINDIR)/$(CONFIG)/gpr_host_port_test: $(GPR_HOST_PORT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_HOST_PORT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_host_port_test + $(Q) $(LDXX) $(LDFLAGS) $(GPR_HOST_PORT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_host_port_test endif @@ -9936,7 +9936,7 @@ else $(BINDIR)/$(CONFIG)/gpr_log_test: $(GPR_LOG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_LOG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_log_test + $(Q) $(LDXX) $(LDFLAGS) $(GPR_LOG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_log_test endif @@ -9968,7 +9968,7 @@ else $(BINDIR)/$(CONFIG)/gpr_manual_constructor_test: $(GPR_MANUAL_CONSTRUCTOR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_MANUAL_CONSTRUCTOR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_manual_constructor_test + $(Q) $(LDXX) $(LDFLAGS) $(GPR_MANUAL_CONSTRUCTOR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_manual_constructor_test endif @@ -10000,7 +10000,7 @@ else $(BINDIR)/$(CONFIG)/gpr_mpscq_test: $(GPR_MPSCQ_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_MPSCQ_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_mpscq_test + $(Q) $(LDXX) $(LDFLAGS) $(GPR_MPSCQ_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_mpscq_test endif @@ -10032,7 +10032,7 @@ else $(BINDIR)/$(CONFIG)/gpr_spinlock_test: $(GPR_SPINLOCK_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_SPINLOCK_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_spinlock_test + $(Q) $(LDXX) $(LDFLAGS) $(GPR_SPINLOCK_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_spinlock_test endif @@ -10064,7 +10064,7 @@ else $(BINDIR)/$(CONFIG)/gpr_string_test: $(GPR_STRING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_STRING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_string_test + $(Q) $(LDXX) $(LDFLAGS) $(GPR_STRING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_string_test endif @@ -10096,7 +10096,7 @@ else $(BINDIR)/$(CONFIG)/gpr_sync_test: $(GPR_SYNC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_SYNC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_sync_test + $(Q) $(LDXX) $(LDFLAGS) $(GPR_SYNC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_sync_test endif @@ -10128,7 +10128,7 @@ else $(BINDIR)/$(CONFIG)/gpr_thd_test: $(GPR_THD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_THD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_thd_test + $(Q) $(LDXX) $(LDFLAGS) $(GPR_THD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_thd_test endif @@ -10160,7 +10160,7 @@ else $(BINDIR)/$(CONFIG)/gpr_time_test: $(GPR_TIME_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_TIME_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_time_test + $(Q) $(LDXX) $(LDFLAGS) $(GPR_TIME_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_time_test endif @@ -10192,7 +10192,7 @@ else $(BINDIR)/$(CONFIG)/gpr_tls_test: $(GPR_TLS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_TLS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_tls_test + $(Q) $(LDXX) $(LDFLAGS) $(GPR_TLS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_tls_test endif @@ -10224,7 +10224,7 @@ else $(BINDIR)/$(CONFIG)/gpr_useful_test: $(GPR_USEFUL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_USEFUL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_useful_test + $(Q) $(LDXX) $(LDFLAGS) $(GPR_USEFUL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_useful_test endif @@ -10256,7 +10256,7 @@ else $(BINDIR)/$(CONFIG)/grpc_auth_context_test: $(GRPC_AUTH_CONTEXT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_AUTH_CONTEXT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_auth_context_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_AUTH_CONTEXT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_auth_context_test endif @@ -10288,7 +10288,7 @@ else $(BINDIR)/$(CONFIG)/grpc_b64_test: $(GRPC_B64_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_B64_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_b64_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_B64_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_b64_test endif @@ -10320,7 +10320,7 @@ else $(BINDIR)/$(CONFIG)/grpc_byte_buffer_reader_test: $(GRPC_BYTE_BUFFER_READER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_BYTE_BUFFER_READER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_byte_buffer_reader_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_BYTE_BUFFER_READER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_byte_buffer_reader_test endif @@ -10352,7 +10352,7 @@ else $(BINDIR)/$(CONFIG)/grpc_channel_args_test: $(GRPC_CHANNEL_ARGS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_CHANNEL_ARGS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_channel_args_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_CHANNEL_ARGS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_channel_args_test endif @@ -10384,7 +10384,7 @@ else $(BINDIR)/$(CONFIG)/grpc_channel_stack_builder_test: $(GRPC_CHANNEL_STACK_BUILDER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_CHANNEL_STACK_BUILDER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_channel_stack_builder_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_CHANNEL_STACK_BUILDER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_channel_stack_builder_test endif @@ -10416,7 +10416,7 @@ else $(BINDIR)/$(CONFIG)/grpc_channel_stack_test: $(GRPC_CHANNEL_STACK_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_CHANNEL_STACK_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_channel_stack_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_CHANNEL_STACK_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_channel_stack_test endif @@ -10448,7 +10448,7 @@ else $(BINDIR)/$(CONFIG)/grpc_completion_queue_test: $(GRPC_COMPLETION_QUEUE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_COMPLETION_QUEUE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_completion_queue_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_COMPLETION_QUEUE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_completion_queue_test endif @@ -10480,7 +10480,7 @@ else $(BINDIR)/$(CONFIG)/grpc_completion_queue_threading_test: $(GRPC_COMPLETION_QUEUE_THREADING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_COMPLETION_QUEUE_THREADING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_completion_queue_threading_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_COMPLETION_QUEUE_THREADING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_completion_queue_threading_test endif @@ -10512,7 +10512,7 @@ else $(BINDIR)/$(CONFIG)/grpc_control_plane_credentials_test: $(GRPC_CONTROL_PLANE_CREDENTIALS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_CONTROL_PLANE_CREDENTIALS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_control_plane_credentials_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_CONTROL_PLANE_CREDENTIALS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_control_plane_credentials_test endif @@ -10545,7 +10545,7 @@ else $(BINDIR)/$(CONFIG)/grpc_create_jwt: $(GRPC_CREATE_JWT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_CREATE_JWT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_create_jwt + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_CREATE_JWT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_create_jwt endif @@ -10579,7 +10579,7 @@ else $(BINDIR)/$(CONFIG)/grpc_credentials_test: $(GRPC_CREDENTIALS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_CREDENTIALS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_credentials_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_CREDENTIALS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_credentials_test endif @@ -10611,7 +10611,7 @@ else $(BINDIR)/$(CONFIG)/grpc_ipv6_loopback_available_test: $(GRPC_IPV6_LOOPBACK_AVAILABLE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_IPV6_LOOPBACK_AVAILABLE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_ipv6_loopback_available_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_IPV6_LOOPBACK_AVAILABLE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_ipv6_loopback_available_test endif @@ -10643,7 +10643,7 @@ else $(BINDIR)/$(CONFIG)/grpc_json_token_test: $(GRPC_JSON_TOKEN_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_JSON_TOKEN_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_json_token_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_JSON_TOKEN_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_json_token_test endif @@ -10675,7 +10675,7 @@ else $(BINDIR)/$(CONFIG)/grpc_jwt_verifier_test: $(GRPC_JWT_VERIFIER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_JWT_VERIFIER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_jwt_verifier_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_JWT_VERIFIER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_jwt_verifier_test endif @@ -10708,7 +10708,7 @@ else $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token: $(GRPC_PRINT_GOOGLE_DEFAULT_CREDS_TOKEN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_PRINT_GOOGLE_DEFAULT_CREDS_TOKEN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_PRINT_GOOGLE_DEFAULT_CREDS_TOKEN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token endif @@ -10742,7 +10742,7 @@ else $(BINDIR)/$(CONFIG)/grpc_security_connector_test: $(GRPC_SECURITY_CONNECTOR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_SECURITY_CONNECTOR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_security_connector_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_SECURITY_CONNECTOR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_security_connector_test endif @@ -10774,7 +10774,7 @@ else $(BINDIR)/$(CONFIG)/grpc_ssl_credentials_test: $(GRPC_SSL_CREDENTIALS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_SSL_CREDENTIALS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_ssl_credentials_test + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_SSL_CREDENTIALS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_ssl_credentials_test endif @@ -10807,7 +10807,7 @@ else $(BINDIR)/$(CONFIG)/grpc_verify_jwt: $(GRPC_VERIFY_JWT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_VERIFY_JWT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_verify_jwt + $(Q) $(LDXX) $(LDFLAGS) $(GRPC_VERIFY_JWT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_verify_jwt endif @@ -10841,7 +10841,7 @@ else $(BINDIR)/$(CONFIG)/handshake_client_ssl: $(HANDSHAKE_CLIENT_SSL_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HANDSHAKE_CLIENT_SSL_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/handshake_client_ssl + $(Q) $(LDXX) $(LDFLAGS) $(HANDSHAKE_CLIENT_SSL_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/handshake_client_ssl endif @@ -10874,7 +10874,7 @@ else $(BINDIR)/$(CONFIG)/handshake_server_ssl: $(HANDSHAKE_SERVER_SSL_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HANDSHAKE_SERVER_SSL_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/handshake_server_ssl + $(Q) $(LDXX) $(LDFLAGS) $(HANDSHAKE_SERVER_SSL_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/handshake_server_ssl endif @@ -10909,7 +10909,7 @@ else $(BINDIR)/$(CONFIG)/handshake_server_with_readahead_handshaker: $(HANDSHAKE_SERVER_WITH_READAHEAD_HANDSHAKER_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HANDSHAKE_SERVER_WITH_READAHEAD_HANDSHAKER_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/handshake_server_with_readahead_handshaker + $(Q) $(LDXX) $(LDFLAGS) $(HANDSHAKE_SERVER_WITH_READAHEAD_HANDSHAKER_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/handshake_server_with_readahead_handshaker endif @@ -10943,7 +10943,7 @@ else $(BINDIR)/$(CONFIG)/handshake_verify_peer_options: $(HANDSHAKE_VERIFY_PEER_OPTIONS_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HANDSHAKE_VERIFY_PEER_OPTIONS_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/handshake_verify_peer_options + $(Q) $(LDXX) $(LDFLAGS) $(HANDSHAKE_VERIFY_PEER_OPTIONS_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/handshake_verify_peer_options endif @@ -10975,7 +10975,7 @@ else $(BINDIR)/$(CONFIG)/histogram_test: $(HISTOGRAM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HISTOGRAM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/histogram_test + $(Q) $(LDXX) $(LDFLAGS) $(HISTOGRAM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/histogram_test endif @@ -11039,7 +11039,7 @@ else $(BINDIR)/$(CONFIG)/hpack_parser_test: $(HPACK_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HPACK_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/hpack_parser_test + $(Q) $(LDXX) $(LDFLAGS) $(HPACK_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/hpack_parser_test endif @@ -11071,7 +11071,7 @@ else $(BINDIR)/$(CONFIG)/hpack_table_test: $(HPACK_TABLE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HPACK_TABLE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/hpack_table_test + $(Q) $(LDXX) $(LDFLAGS) $(HPACK_TABLE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/hpack_table_test endif @@ -11103,7 +11103,7 @@ else $(BINDIR)/$(CONFIG)/http_parser_test: $(HTTP_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HTTP_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/http_parser_test + $(Q) $(LDXX) $(LDFLAGS) $(HTTP_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/http_parser_test endif @@ -11199,7 +11199,7 @@ else $(BINDIR)/$(CONFIG)/httpcli_format_request_test: $(HTTPCLI_FORMAT_REQUEST_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HTTPCLI_FORMAT_REQUEST_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/httpcli_format_request_test + $(Q) $(LDXX) $(LDFLAGS) $(HTTPCLI_FORMAT_REQUEST_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/httpcli_format_request_test endif @@ -11231,7 +11231,7 @@ else $(BINDIR)/$(CONFIG)/httpcli_test: $(HTTPCLI_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HTTPCLI_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/httpcli_test + $(Q) $(LDXX) $(LDFLAGS) $(HTTPCLI_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/httpcli_test endif @@ -11263,7 +11263,7 @@ else $(BINDIR)/$(CONFIG)/httpscli_test: $(HTTPSCLI_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HTTPSCLI_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/httpscli_test + $(Q) $(LDXX) $(LDFLAGS) $(HTTPSCLI_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/httpscli_test endif @@ -11295,7 +11295,7 @@ else $(BINDIR)/$(CONFIG)/init_test: $(INIT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(INIT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/init_test + $(Q) $(LDXX) $(LDFLAGS) $(INIT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/init_test endif @@ -11327,7 +11327,7 @@ else $(BINDIR)/$(CONFIG)/inproc_callback_test: $(INPROC_CALLBACK_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(INPROC_CALLBACK_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/inproc_callback_test + $(Q) $(LDXX) $(LDFLAGS) $(INPROC_CALLBACK_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/inproc_callback_test endif @@ -11359,7 +11359,7 @@ else $(BINDIR)/$(CONFIG)/invalid_call_argument_test: $(INVALID_CALL_ARGUMENT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(INVALID_CALL_ARGUMENT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/invalid_call_argument_test + $(Q) $(LDXX) $(LDFLAGS) $(INVALID_CALL_ARGUMENT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/invalid_call_argument_test endif @@ -11423,7 +11423,7 @@ else $(BINDIR)/$(CONFIG)/json_rewrite: $(JSON_REWRITE_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(JSON_REWRITE_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_rewrite + $(Q) $(LDXX) $(LDFLAGS) $(JSON_REWRITE_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_rewrite endif @@ -11455,7 +11455,7 @@ else $(BINDIR)/$(CONFIG)/json_rewrite_test: $(JSON_REWRITE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(JSON_REWRITE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_rewrite_test + $(Q) $(LDXX) $(LDFLAGS) $(JSON_REWRITE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_rewrite_test endif @@ -11487,7 +11487,7 @@ else $(BINDIR)/$(CONFIG)/json_stream_error_test: $(JSON_STREAM_ERROR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(JSON_STREAM_ERROR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_stream_error_test + $(Q) $(LDXX) $(LDFLAGS) $(JSON_STREAM_ERROR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_stream_error_test endif @@ -11519,7 +11519,7 @@ else $(BINDIR)/$(CONFIG)/json_test: $(JSON_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(JSON_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_test + $(Q) $(LDXX) $(LDFLAGS) $(JSON_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_test endif @@ -11551,7 +11551,7 @@ else $(BINDIR)/$(CONFIG)/lame_client_test: $(LAME_CLIENT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(LAME_CLIENT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/lame_client_test + $(Q) $(LDXX) $(LDFLAGS) $(LAME_CLIENT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/lame_client_test endif @@ -11583,7 +11583,7 @@ else $(BINDIR)/$(CONFIG)/load_file_test: $(LOAD_FILE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(LOAD_FILE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/load_file_test + $(Q) $(LDXX) $(LDFLAGS) $(LOAD_FILE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/load_file_test endif @@ -11615,7 +11615,7 @@ else $(BINDIR)/$(CONFIG)/low_level_ping_pong_benchmark: $(LOW_LEVEL_PING_PONG_BENCHMARK_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(LOW_LEVEL_PING_PONG_BENCHMARK_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/low_level_ping_pong_benchmark + $(Q) $(LDXX) $(LDFLAGS) $(LOW_LEVEL_PING_PONG_BENCHMARK_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/low_level_ping_pong_benchmark endif @@ -11647,7 +11647,7 @@ else $(BINDIR)/$(CONFIG)/memory_usage_client: $(MEMORY_USAGE_CLIENT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(MEMORY_USAGE_CLIENT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/memory_usage_client + $(Q) $(LDXX) $(LDFLAGS) $(MEMORY_USAGE_CLIENT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/memory_usage_client endif @@ -11679,7 +11679,7 @@ else $(BINDIR)/$(CONFIG)/memory_usage_server: $(MEMORY_USAGE_SERVER_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(MEMORY_USAGE_SERVER_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/memory_usage_server + $(Q) $(LDXX) $(LDFLAGS) $(MEMORY_USAGE_SERVER_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/memory_usage_server endif @@ -11711,7 +11711,7 @@ else $(BINDIR)/$(CONFIG)/memory_usage_test: $(MEMORY_USAGE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(MEMORY_USAGE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/memory_usage_test + $(Q) $(LDXX) $(LDFLAGS) $(MEMORY_USAGE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/memory_usage_test endif @@ -11743,7 +11743,7 @@ else $(BINDIR)/$(CONFIG)/message_compress_test: $(MESSAGE_COMPRESS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(MESSAGE_COMPRESS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/message_compress_test + $(Q) $(LDXX) $(LDFLAGS) $(MESSAGE_COMPRESS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/message_compress_test endif @@ -11775,7 +11775,7 @@ else $(BINDIR)/$(CONFIG)/minimal_stack_is_minimal_test: $(MINIMAL_STACK_IS_MINIMAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(MINIMAL_STACK_IS_MINIMAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/minimal_stack_is_minimal_test + $(Q) $(LDXX) $(LDFLAGS) $(MINIMAL_STACK_IS_MINIMAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/minimal_stack_is_minimal_test endif @@ -11807,7 +11807,7 @@ else $(BINDIR)/$(CONFIG)/mpmcqueue_test: $(MPMCQUEUE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(MPMCQUEUE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/mpmcqueue_test + $(Q) $(LDXX) $(LDFLAGS) $(MPMCQUEUE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/mpmcqueue_test endif @@ -11839,7 +11839,7 @@ else $(BINDIR)/$(CONFIG)/multiple_server_queues_test: $(MULTIPLE_SERVER_QUEUES_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(MULTIPLE_SERVER_QUEUES_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/multiple_server_queues_test + $(Q) $(LDXX) $(LDFLAGS) $(MULTIPLE_SERVER_QUEUES_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/multiple_server_queues_test endif @@ -11871,7 +11871,7 @@ else $(BINDIR)/$(CONFIG)/murmur_hash_test: $(MURMUR_HASH_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(MURMUR_HASH_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/murmur_hash_test + $(Q) $(LDXX) $(LDFLAGS) $(MURMUR_HASH_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/murmur_hash_test endif @@ -11967,7 +11967,7 @@ else $(BINDIR)/$(CONFIG)/no_server_test: $(NO_SERVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(NO_SERVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/no_server_test + $(Q) $(LDXX) $(LDFLAGS) $(NO_SERVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/no_server_test endif @@ -11999,7 +11999,7 @@ else $(BINDIR)/$(CONFIG)/num_external_connectivity_watchers_test: $(NUM_EXTERNAL_CONNECTIVITY_WATCHERS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(NUM_EXTERNAL_CONNECTIVITY_WATCHERS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/num_external_connectivity_watchers_test + $(Q) $(LDXX) $(LDFLAGS) $(NUM_EXTERNAL_CONNECTIVITY_WATCHERS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/num_external_connectivity_watchers_test endif @@ -12031,7 +12031,7 @@ else $(BINDIR)/$(CONFIG)/parse_address_test: $(PARSE_ADDRESS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(PARSE_ADDRESS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/parse_address_test + $(Q) $(LDXX) $(LDFLAGS) $(PARSE_ADDRESS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/parse_address_test endif @@ -12063,7 +12063,7 @@ else $(BINDIR)/$(CONFIG)/parse_address_with_named_scope_id_test: $(PARSE_ADDRESS_WITH_NAMED_SCOPE_ID_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(PARSE_ADDRESS_WITH_NAMED_SCOPE_ID_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/parse_address_with_named_scope_id_test + $(Q) $(LDXX) $(LDFLAGS) $(PARSE_ADDRESS_WITH_NAMED_SCOPE_ID_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/parse_address_with_named_scope_id_test endif @@ -12159,7 +12159,7 @@ else $(BINDIR)/$(CONFIG)/percent_encoding_test: $(PERCENT_ENCODING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(PERCENT_ENCODING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/percent_encoding_test + $(Q) $(LDXX) $(LDFLAGS) $(PERCENT_ENCODING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/percent_encoding_test endif @@ -12191,7 +12191,7 @@ else $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_posix_test: $(RESOLVE_ADDRESS_USING_ARES_RESOLVER_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(RESOLVE_ADDRESS_USING_ARES_RESOLVER_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_posix_test + $(Q) $(LDXX) $(LDFLAGS) $(RESOLVE_ADDRESS_USING_ARES_RESOLVER_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_posix_test endif @@ -12223,7 +12223,7 @@ else $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_test: $(RESOLVE_ADDRESS_USING_ARES_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(RESOLVE_ADDRESS_USING_ARES_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_test + $(Q) $(LDXX) $(LDFLAGS) $(RESOLVE_ADDRESS_USING_ARES_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_test endif @@ -12255,7 +12255,7 @@ else $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_posix_test: $(RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_posix_test + $(Q) $(LDXX) $(LDFLAGS) $(RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_posix_test endif @@ -12287,7 +12287,7 @@ else $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_test: $(RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_test + $(Q) $(LDXX) $(LDFLAGS) $(RESOLVE_ADDRESS_USING_NATIVE_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_test endif @@ -12319,7 +12319,7 @@ else $(BINDIR)/$(CONFIG)/resource_quota_test: $(RESOURCE_QUOTA_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(RESOURCE_QUOTA_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resource_quota_test + $(Q) $(LDXX) $(LDFLAGS) $(RESOURCE_QUOTA_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resource_quota_test endif @@ -12351,7 +12351,7 @@ else $(BINDIR)/$(CONFIG)/secure_channel_create_test: $(SECURE_CHANNEL_CREATE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SECURE_CHANNEL_CREATE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/secure_channel_create_test + $(Q) $(LDXX) $(LDFLAGS) $(SECURE_CHANNEL_CREATE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/secure_channel_create_test endif @@ -12383,7 +12383,7 @@ else $(BINDIR)/$(CONFIG)/secure_endpoint_test: $(SECURE_ENDPOINT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SECURE_ENDPOINT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/secure_endpoint_test + $(Q) $(LDXX) $(LDFLAGS) $(SECURE_ENDPOINT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/secure_endpoint_test endif @@ -12415,7 +12415,7 @@ else $(BINDIR)/$(CONFIG)/sequential_connectivity_test: $(SEQUENTIAL_CONNECTIVITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SEQUENTIAL_CONNECTIVITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/sequential_connectivity_test + $(Q) $(LDXX) $(LDFLAGS) $(SEQUENTIAL_CONNECTIVITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/sequential_connectivity_test endif @@ -12447,7 +12447,7 @@ else $(BINDIR)/$(CONFIG)/server_chttp2_test: $(SERVER_CHTTP2_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SERVER_CHTTP2_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/server_chttp2_test + $(Q) $(LDXX) $(LDFLAGS) $(SERVER_CHTTP2_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/server_chttp2_test endif @@ -12511,7 +12511,7 @@ else $(BINDIR)/$(CONFIG)/server_test: $(SERVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SERVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/server_test + $(Q) $(LDXX) $(LDFLAGS) $(SERVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/server_test endif @@ -12543,7 +12543,7 @@ else $(BINDIR)/$(CONFIG)/slice_buffer_test: $(SLICE_BUFFER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SLICE_BUFFER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/slice_buffer_test + $(Q) $(LDXX) $(LDFLAGS) $(SLICE_BUFFER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/slice_buffer_test endif @@ -12575,7 +12575,7 @@ else $(BINDIR)/$(CONFIG)/slice_string_helpers_test: $(SLICE_STRING_HELPERS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SLICE_STRING_HELPERS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/slice_string_helpers_test + $(Q) $(LDXX) $(LDFLAGS) $(SLICE_STRING_HELPERS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/slice_string_helpers_test endif @@ -12607,7 +12607,7 @@ else $(BINDIR)/$(CONFIG)/slice_test: $(SLICE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SLICE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/slice_test + $(Q) $(LDXX) $(LDFLAGS) $(SLICE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/slice_test endif @@ -12639,7 +12639,7 @@ else $(BINDIR)/$(CONFIG)/sockaddr_resolver_test: $(SOCKADDR_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SOCKADDR_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/sockaddr_resolver_test + $(Q) $(LDXX) $(LDFLAGS) $(SOCKADDR_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/sockaddr_resolver_test endif @@ -12671,7 +12671,7 @@ else $(BINDIR)/$(CONFIG)/sockaddr_utils_test: $(SOCKADDR_UTILS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SOCKADDR_UTILS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/sockaddr_utils_test + $(Q) $(LDXX) $(LDFLAGS) $(SOCKADDR_UTILS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/sockaddr_utils_test endif @@ -12703,7 +12703,7 @@ else $(BINDIR)/$(CONFIG)/socket_utils_test: $(SOCKET_UTILS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SOCKET_UTILS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/socket_utils_test + $(Q) $(LDXX) $(LDFLAGS) $(SOCKET_UTILS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/socket_utils_test endif @@ -12768,7 +12768,7 @@ else $(BINDIR)/$(CONFIG)/ssl_transport_security_test: $(SSL_TRANSPORT_SECURITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SSL_TRANSPORT_SECURITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/ssl_transport_security_test + $(Q) $(LDXX) $(LDFLAGS) $(SSL_TRANSPORT_SECURITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/ssl_transport_security_test endif @@ -12802,7 +12802,7 @@ else $(BINDIR)/$(CONFIG)/status_conversion_test: $(STATUS_CONVERSION_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(STATUS_CONVERSION_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/status_conversion_test + $(Q) $(LDXX) $(LDFLAGS) $(STATUS_CONVERSION_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/status_conversion_test endif @@ -12834,7 +12834,7 @@ else $(BINDIR)/$(CONFIG)/stream_compression_test: $(STREAM_COMPRESSION_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(STREAM_COMPRESSION_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/stream_compression_test + $(Q) $(LDXX) $(LDFLAGS) $(STREAM_COMPRESSION_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/stream_compression_test endif @@ -12866,7 +12866,7 @@ else $(BINDIR)/$(CONFIG)/stream_owned_slice_test: $(STREAM_OWNED_SLICE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(STREAM_OWNED_SLICE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/stream_owned_slice_test + $(Q) $(LDXX) $(LDFLAGS) $(STREAM_OWNED_SLICE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/stream_owned_slice_test endif @@ -12898,7 +12898,7 @@ else $(BINDIR)/$(CONFIG)/tcp_client_posix_test: $(TCP_CLIENT_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(TCP_CLIENT_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/tcp_client_posix_test + $(Q) $(LDXX) $(LDFLAGS) $(TCP_CLIENT_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/tcp_client_posix_test endif @@ -12930,7 +12930,7 @@ else $(BINDIR)/$(CONFIG)/tcp_client_uv_test: $(TCP_CLIENT_UV_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(TCP_CLIENT_UV_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/tcp_client_uv_test + $(Q) $(LDXX) $(LDFLAGS) $(TCP_CLIENT_UV_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/tcp_client_uv_test endif @@ -12962,7 +12962,7 @@ else $(BINDIR)/$(CONFIG)/tcp_posix_test: $(TCP_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(TCP_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/tcp_posix_test + $(Q) $(LDXX) $(LDFLAGS) $(TCP_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/tcp_posix_test endif @@ -12994,7 +12994,7 @@ else $(BINDIR)/$(CONFIG)/tcp_server_posix_test: $(TCP_SERVER_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(TCP_SERVER_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/tcp_server_posix_test + $(Q) $(LDXX) $(LDFLAGS) $(TCP_SERVER_POSIX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/tcp_server_posix_test endif @@ -13026,7 +13026,7 @@ else $(BINDIR)/$(CONFIG)/tcp_server_uv_test: $(TCP_SERVER_UV_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(TCP_SERVER_UV_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/tcp_server_uv_test + $(Q) $(LDXX) $(LDFLAGS) $(TCP_SERVER_UV_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/tcp_server_uv_test endif @@ -13058,7 +13058,7 @@ else $(BINDIR)/$(CONFIG)/threadpool_test: $(THREADPOOL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(THREADPOOL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/threadpool_test + $(Q) $(LDXX) $(LDFLAGS) $(THREADPOOL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/threadpool_test endif @@ -13090,7 +13090,7 @@ else $(BINDIR)/$(CONFIG)/time_averaged_stats_test: $(TIME_AVERAGED_STATS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(TIME_AVERAGED_STATS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/time_averaged_stats_test + $(Q) $(LDXX) $(LDFLAGS) $(TIME_AVERAGED_STATS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/time_averaged_stats_test endif @@ -13122,7 +13122,7 @@ else $(BINDIR)/$(CONFIG)/timeout_encoding_test: $(TIMEOUT_ENCODING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(TIMEOUT_ENCODING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/timeout_encoding_test + $(Q) $(LDXX) $(LDFLAGS) $(TIMEOUT_ENCODING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/timeout_encoding_test endif @@ -13154,7 +13154,7 @@ else $(BINDIR)/$(CONFIG)/timer_heap_test: $(TIMER_HEAP_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(TIMER_HEAP_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/timer_heap_test + $(Q) $(LDXX) $(LDFLAGS) $(TIMER_HEAP_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/timer_heap_test endif @@ -13186,7 +13186,7 @@ else $(BINDIR)/$(CONFIG)/timer_list_test: $(TIMER_LIST_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(TIMER_LIST_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/timer_list_test + $(Q) $(LDXX) $(LDFLAGS) $(TIMER_LIST_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/timer_list_test endif @@ -13218,7 +13218,7 @@ else $(BINDIR)/$(CONFIG)/transport_connectivity_state_test: $(TRANSPORT_CONNECTIVITY_STATE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(TRANSPORT_CONNECTIVITY_STATE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/transport_connectivity_state_test + $(Q) $(LDXX) $(LDFLAGS) $(TRANSPORT_CONNECTIVITY_STATE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/transport_connectivity_state_test endif @@ -13250,7 +13250,7 @@ else $(BINDIR)/$(CONFIG)/transport_metadata_test: $(TRANSPORT_METADATA_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(TRANSPORT_METADATA_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/transport_metadata_test + $(Q) $(LDXX) $(LDFLAGS) $(TRANSPORT_METADATA_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/transport_metadata_test endif @@ -13282,7 +13282,7 @@ else $(BINDIR)/$(CONFIG)/transport_security_test: $(TRANSPORT_SECURITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(TRANSPORT_SECURITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/transport_security_test + $(Q) $(LDXX) $(LDFLAGS) $(TRANSPORT_SECURITY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/transport_security_test endif @@ -13314,7 +13314,7 @@ else $(BINDIR)/$(CONFIG)/udp_server_test: $(UDP_SERVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(UDP_SERVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/udp_server_test + $(Q) $(LDXX) $(LDFLAGS) $(UDP_SERVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/udp_server_test endif @@ -13378,7 +13378,7 @@ else $(BINDIR)/$(CONFIG)/uri_parser_test: $(URI_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(URI_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/uri_parser_test + $(Q) $(LDXX) $(LDFLAGS) $(URI_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/uri_parser_test endif @@ -20127,7 +20127,7 @@ else $(BINDIR)/$(CONFIG)/public_headers_must_be_c89: $(PUBLIC_HEADERS_MUST_BE_C89_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(PUBLIC_HEADERS_MUST_BE_C89_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/public_headers_must_be_c89 + $(Q) $(LDXX) $(LDFLAGS) $(PUBLIC_HEADERS_MUST_BE_C89_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/public_headers_must_be_c89 endif @@ -20796,7 +20796,7 @@ else $(BINDIR)/$(CONFIG)/bad_ssl_cert_server: $(BAD_SSL_CERT_SERVER_OBJS) $(LIBDIR)/$(CONFIG)/libbad_ssl_test_server.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(BAD_SSL_CERT_SERVER_OBJS) $(LIBDIR)/$(CONFIG)/libbad_ssl_test_server.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/bad_ssl_cert_server + $(Q) $(LDXX) $(LDFLAGS) $(BAD_SSL_CERT_SERVER_OBJS) $(LIBDIR)/$(CONFIG)/libbad_ssl_test_server.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/bad_ssl_cert_server endif @@ -20828,7 +20828,7 @@ else $(BINDIR)/$(CONFIG)/bad_ssl_cert_test: $(BAD_SSL_CERT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(BAD_SSL_CERT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/bad_ssl_cert_test + $(Q) $(LDXX) $(LDFLAGS) $(BAD_SSL_CERT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/bad_ssl_cert_test endif @@ -20860,7 +20860,7 @@ else $(BINDIR)/$(CONFIG)/h2_census_test: $(H2_CENSUS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_CENSUS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_census_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_CENSUS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_census_test endif @@ -20892,7 +20892,7 @@ else $(BINDIR)/$(CONFIG)/h2_compress_test: $(H2_COMPRESS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_COMPRESS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_compress_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_COMPRESS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_compress_test endif @@ -20924,7 +20924,7 @@ else $(BINDIR)/$(CONFIG)/h2_fakesec_test: $(H2_FAKESEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_FAKESEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_fakesec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_FAKESEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_fakesec_test endif @@ -20956,7 +20956,7 @@ else $(BINDIR)/$(CONFIG)/h2_fd_test: $(H2_FD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_FD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_fd_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_FD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_fd_test endif @@ -20988,7 +20988,7 @@ else $(BINDIR)/$(CONFIG)/h2_full_test: $(H2_FULL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_FULL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_full_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_FULL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_full_test endif @@ -21020,7 +21020,7 @@ else $(BINDIR)/$(CONFIG)/h2_full+pipe_test: $(H2_FULL+PIPE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_FULL+PIPE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_full+pipe_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_FULL+PIPE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_full+pipe_test endif @@ -21052,7 +21052,7 @@ else $(BINDIR)/$(CONFIG)/h2_full+trace_test: $(H2_FULL+TRACE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_FULL+TRACE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_full+trace_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_FULL+TRACE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_full+trace_test endif @@ -21084,7 +21084,7 @@ else $(BINDIR)/$(CONFIG)/h2_full+workarounds_test: $(H2_FULL+WORKAROUNDS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_FULL+WORKAROUNDS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_full+workarounds_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_FULL+WORKAROUNDS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_full+workarounds_test endif @@ -21116,7 +21116,7 @@ else $(BINDIR)/$(CONFIG)/h2_http_proxy_test: $(H2_HTTP_PROXY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_HTTP_PROXY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_http_proxy_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_HTTP_PROXY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_http_proxy_test endif @@ -21148,7 +21148,7 @@ else $(BINDIR)/$(CONFIG)/h2_local_ipv4_test: $(H2_LOCAL_IPV4_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_LOCAL_IPV4_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_local_ipv4_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_LOCAL_IPV4_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_local_ipv4_test endif @@ -21180,7 +21180,7 @@ else $(BINDIR)/$(CONFIG)/h2_local_ipv6_test: $(H2_LOCAL_IPV6_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_LOCAL_IPV6_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_local_ipv6_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_LOCAL_IPV6_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_local_ipv6_test endif @@ -21212,7 +21212,7 @@ else $(BINDIR)/$(CONFIG)/h2_local_uds_test: $(H2_LOCAL_UDS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_LOCAL_UDS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_local_uds_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_LOCAL_UDS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_local_uds_test endif @@ -21244,7 +21244,7 @@ else $(BINDIR)/$(CONFIG)/h2_oauth2_test: $(H2_OAUTH2_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_OAUTH2_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_oauth2_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_OAUTH2_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_oauth2_test endif @@ -21276,7 +21276,7 @@ else $(BINDIR)/$(CONFIG)/h2_proxy_test: $(H2_PROXY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_PROXY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_proxy_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_PROXY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_proxy_test endif @@ -21308,7 +21308,7 @@ else $(BINDIR)/$(CONFIG)/h2_sockpair_test: $(H2_SOCKPAIR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_SOCKPAIR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_sockpair_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_SOCKPAIR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_sockpair_test endif @@ -21340,7 +21340,7 @@ else $(BINDIR)/$(CONFIG)/h2_sockpair+trace_test: $(H2_SOCKPAIR+TRACE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_SOCKPAIR+TRACE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_sockpair+trace_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_SOCKPAIR+TRACE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_sockpair+trace_test endif @@ -21372,7 +21372,7 @@ else $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_test: $(H2_SOCKPAIR_1BYTE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_SOCKPAIR_1BYTE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_SOCKPAIR_1BYTE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_test endif @@ -21404,7 +21404,7 @@ else $(BINDIR)/$(CONFIG)/h2_spiffe_test: $(H2_SPIFFE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_SPIFFE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_spiffe_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_SPIFFE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_spiffe_test endif @@ -21436,7 +21436,7 @@ else $(BINDIR)/$(CONFIG)/h2_ssl_test: $(H2_SSL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_SSL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_ssl_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_SSL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_ssl_test endif @@ -21468,7 +21468,7 @@ else $(BINDIR)/$(CONFIG)/h2_ssl_cred_reload_test: $(H2_SSL_CRED_RELOAD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_SSL_CRED_RELOAD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_ssl_cred_reload_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_SSL_CRED_RELOAD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_ssl_cred_reload_test endif @@ -21500,7 +21500,7 @@ else $(BINDIR)/$(CONFIG)/h2_ssl_proxy_test: $(H2_SSL_PROXY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_SSL_PROXY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_ssl_proxy_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_SSL_PROXY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_ssl_proxy_test endif @@ -21532,7 +21532,7 @@ else $(BINDIR)/$(CONFIG)/h2_uds_test: $(H2_UDS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_UDS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_uds_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_UDS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_uds_test endif @@ -21564,7 +21564,7 @@ else $(BINDIR)/$(CONFIG)/inproc_test: $(INPROC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(INPROC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/inproc_test + $(Q) $(LDXX) $(LDFLAGS) $(INPROC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/inproc_test endif @@ -21588,7 +21588,7 @@ H2_CENSUS_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $( $(BINDIR)/$(CONFIG)/h2_census_nosec_test: $(H2_CENSUS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_CENSUS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_census_nosec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_CENSUS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_census_nosec_test $(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_census.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -21608,7 +21608,7 @@ H2_COMPRESS_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(BINDIR)/$(CONFIG)/h2_compress_nosec_test: $(H2_COMPRESS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_COMPRESS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_compress_nosec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_COMPRESS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_compress_nosec_test $(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_compress.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -21628,7 +21628,7 @@ H2_FD_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(base $(BINDIR)/$(CONFIG)/h2_fd_nosec_test: $(H2_FD_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_FD_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_fd_nosec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_FD_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_fd_nosec_test $(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_fd.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -21648,7 +21648,7 @@ H2_FULL_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(ba $(BINDIR)/$(CONFIG)/h2_full_nosec_test: $(H2_FULL_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_FULL_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_full_nosec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_FULL_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_full_nosec_test $(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_full.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -21668,7 +21668,7 @@ H2_FULL+PIPE_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(BINDIR)/$(CONFIG)/h2_full+pipe_nosec_test: $(H2_FULL+PIPE_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_FULL+PIPE_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_full+pipe_nosec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_FULL+PIPE_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_full+pipe_nosec_test $(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_full+pipe.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -21688,7 +21688,7 @@ H2_FULL+TRACE_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o $(BINDIR)/$(CONFIG)/h2_full+trace_nosec_test: $(H2_FULL+TRACE_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_FULL+TRACE_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_full+trace_nosec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_FULL+TRACE_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_full+trace_nosec_test $(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_full+trace.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -21708,7 +21708,7 @@ H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuf $(BINDIR)/$(CONFIG)/h2_full+workarounds_nosec_test: $(H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_full+workarounds_nosec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_full+workarounds_nosec_test $(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_full+workarounds.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -21728,7 +21728,7 @@ H2_HTTP_PROXY_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o $(BINDIR)/$(CONFIG)/h2_http_proxy_nosec_test: $(H2_HTTP_PROXY_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_HTTP_PROXY_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_http_proxy_nosec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_HTTP_PROXY_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_http_proxy_nosec_test $(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_http_proxy.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -21748,7 +21748,7 @@ H2_PROXY_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(b $(BINDIR)/$(CONFIG)/h2_proxy_nosec_test: $(H2_PROXY_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_PROXY_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_proxy_nosec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_PROXY_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_proxy_nosec_test $(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_proxy.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -21768,7 +21768,7 @@ H2_SOCKPAIR_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(BINDIR)/$(CONFIG)/h2_sockpair_nosec_test: $(H2_SOCKPAIR_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_SOCKPAIR_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_sockpair_nosec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_SOCKPAIR_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_sockpair_nosec_test $(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_sockpair.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -21788,7 +21788,7 @@ H2_SOCKPAIR+TRACE_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffi $(BINDIR)/$(CONFIG)/h2_sockpair+trace_nosec_test: $(H2_SOCKPAIR+TRACE_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_SOCKPAIR+TRACE_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_sockpair+trace_nosec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_SOCKPAIR+TRACE_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_sockpair+trace_nosec_test $(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_sockpair+trace.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -21808,7 +21808,7 @@ H2_SOCKPAIR_1BYTE_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffi $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_nosec_test: $(H2_SOCKPAIR_1BYTE_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_SOCKPAIR_1BYTE_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_nosec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_SOCKPAIR_1BYTE_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_nosec_test $(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_sockpair_1byte.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -21828,7 +21828,7 @@ H2_UDS_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(bas $(BINDIR)/$(CONFIG)/h2_uds_nosec_test: $(H2_UDS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(H2_UDS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_uds_nosec_test + $(Q) $(LDXX) $(LDFLAGS) $(H2_UDS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_uds_nosec_test $(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_uds.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -22158,7 +22158,7 @@ else $(BINDIR)/$(CONFIG)/alts_credentials_fuzzer_one_entry: $(ALTS_CREDENTIALS_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(ALTS_CREDENTIALS_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/alts_credentials_fuzzer_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(ALTS_CREDENTIALS_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/alts_credentials_fuzzer_one_entry endif @@ -22193,7 +22193,7 @@ else $(BINDIR)/$(CONFIG)/api_fuzzer_one_entry: $(API_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(API_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/api_fuzzer_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(API_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/api_fuzzer_one_entry endif @@ -22228,7 +22228,7 @@ else $(BINDIR)/$(CONFIG)/client_fuzzer_one_entry: $(CLIENT_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(CLIENT_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/client_fuzzer_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(CLIENT_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/client_fuzzer_one_entry endif @@ -22263,7 +22263,7 @@ else $(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test_one_entry: $(HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test_one_entry endif @@ -22298,7 +22298,7 @@ else $(BINDIR)/$(CONFIG)/http_request_fuzzer_test_one_entry: $(HTTP_REQUEST_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HTTP_REQUEST_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/http_request_fuzzer_test_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(HTTP_REQUEST_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/http_request_fuzzer_test_one_entry endif @@ -22333,7 +22333,7 @@ else $(BINDIR)/$(CONFIG)/http_response_fuzzer_test_one_entry: $(HTTP_RESPONSE_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(HTTP_RESPONSE_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/http_response_fuzzer_test_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(HTTP_RESPONSE_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/http_response_fuzzer_test_one_entry endif @@ -22368,7 +22368,7 @@ else $(BINDIR)/$(CONFIG)/json_fuzzer_test_one_entry: $(JSON_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(JSON_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_fuzzer_test_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(JSON_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_fuzzer_test_one_entry endif @@ -22403,7 +22403,7 @@ else $(BINDIR)/$(CONFIG)/nanopb_fuzzer_response_test_one_entry: $(NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/nanopb_fuzzer_response_test_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/nanopb_fuzzer_response_test_one_entry endif @@ -22438,7 +22438,7 @@ else $(BINDIR)/$(CONFIG)/nanopb_fuzzer_serverlist_test_one_entry: $(NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/nanopb_fuzzer_serverlist_test_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/nanopb_fuzzer_serverlist_test_one_entry endif @@ -22473,7 +22473,7 @@ else $(BINDIR)/$(CONFIG)/percent_decode_fuzzer_one_entry: $(PERCENT_DECODE_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(PERCENT_DECODE_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/percent_decode_fuzzer_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(PERCENT_DECODE_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/percent_decode_fuzzer_one_entry endif @@ -22508,7 +22508,7 @@ else $(BINDIR)/$(CONFIG)/percent_encode_fuzzer_one_entry: $(PERCENT_ENCODE_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(PERCENT_ENCODE_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/percent_encode_fuzzer_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(PERCENT_ENCODE_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/percent_encode_fuzzer_one_entry endif @@ -22543,7 +22543,7 @@ else $(BINDIR)/$(CONFIG)/server_fuzzer_one_entry: $(SERVER_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SERVER_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/server_fuzzer_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(SERVER_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/server_fuzzer_one_entry endif @@ -22578,7 +22578,7 @@ else $(BINDIR)/$(CONFIG)/ssl_server_fuzzer_one_entry: $(SSL_SERVER_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(SSL_SERVER_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/ssl_server_fuzzer_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(SSL_SERVER_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/ssl_server_fuzzer_one_entry endif @@ -22613,7 +22613,7 @@ else $(BINDIR)/$(CONFIG)/uri_fuzzer_test_one_entry: $(URI_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(URI_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/uri_fuzzer_test_one_entry + $(Q) $(LDXX) $(LDFLAGS) $(URI_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/uri_fuzzer_test_one_entry endif diff --git a/config.m4 b/config.m4 index effefa9b561..4a8651dae38 100644 --- a/config.m4 +++ b/config.m4 @@ -24,8 +24,10 @@ if test "$PHP_GRPC" != "no"; then case $host in *darwin*) + PHP_ADD_LIBRARY(c++,1,GRPC_SHARED_LIBADD) ;; *) + PHP_ADD_LIBRARY(stdc++,1,GRPC_SHARED_LIBADD) PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD) PHP_ADD_LIBRARY(rt) ;; diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index bab57657a00..ca1d0aeef72 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -32,8 +32,7 @@ * in-house library if possible. (e.g. std::map) */ #ifndef GRPC_USE_CPP_STD_LIB -/* Default value will be 1 once all tests become green. */ -#define GRPC_USE_CPP_STD_LIB 0 +#define GRPC_USE_CPP_STD_LIB 1 #endif /* Get windows.h included everywhere (we need it) */ diff --git a/src/php/ext/grpc/config.m4 b/src/php/ext/grpc/config.m4 index 9ec2c7cf04c..1af93ceecad 100755 --- a/src/php/ext/grpc/config.m4 +++ b/src/php/ext/grpc/config.m4 @@ -42,7 +42,8 @@ if test "$PHP_GRPC" != "no"; then dnl PHP_ADD_LIBRARY(pthread,,GRPC_SHARED_LIBADD) GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD" PHP_ADD_LIBRARY(pthread) - + PHP_ADD_LIBRARY(stdc++,,GRPC_SHARED_LIBADD) + PHP_ADD_LIBRARY(stdc++) PHP_ADD_LIBRARY(dl,,GRPC_SHARED_LIBADD) PHP_ADD_LIBRARY(dl) diff --git a/src/ruby/ext/grpc/rb_enable_cpp.cc b/src/ruby/ext/grpc/rb_enable_cpp.cc new file mode 100644 index 00000000000..f44e4f515a7 --- /dev/null +++ b/src/ruby/ext/grpc/rb_enable_cpp.cc @@ -0,0 +1,22 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +// This is a dummy C++ source file to trigger ruby extension builder to +// pick C++ rather than C linker to link with c++ library properly. diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index b6a0e83056f..16fc78d99ae 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -174,11 +174,6 @@ endif() if (_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_IOS) - # C core has C++ source code, but should not depend on libstc++ (for better portability). - # We need to use a few tricks to convince cmake to do that. - # https://stackoverflow.com/questions/15058403/how-to-stop-cmake-from-linking-against-libstdc - set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") - # Exceptions and RTTI must be off to avoid dependency on libstdc++ set(_gRPC_CORE_NOSTDCXX_FLAGS -fno-exceptions -fno-rtti) else() set(_gRPC_CORE_NOSTDCXX_FLAGS "") @@ -444,14 +439,6 @@ PRIVATE <%text>${_gRPC_PROTO_GENS_DIR} % endif ) - % if lib.language in ['c', 'csharp']: - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(${lib.name} PROPERTIES LINKER_LANGUAGE C) - # only use the flags for C++ source files - target_compile_options(${lib.name} PRIVATE <%text>$<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() - % endif % if len(get_deps(lib)) > 0: target_link_libraries(${lib.name} % for dep in get_deps(lib): @@ -550,13 +537,6 @@ % endfor ) - % if tgt.language in ['c', 'csharp']: - # avoid dependency on libstdc++ - if (_gRPC_CORE_NOSTDCXX_FLAGS) - set_target_properties(${tgt.name} PROPERTIES LINKER_LANGUAGE C) - target_compile_options(${tgt.name} PRIVATE <%text>$<$:${_gRPC_CORE_NOSTDCXX_FLAGS}>) - endif() - % endif % endif diff --git a/templates/Makefile.template b/templates/Makefile.template index b17423cc4aa..bd8874c8154 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -1588,7 +1588,7 @@ if lib.language == 'c++': ld = '$(LDXX)' else: - ld = '$(LD)' + ld = '$(LDXX)' out_mingbase = '$(LIBDIR)/$(CONFIG)/' + lib.name + '$(SHARED_VERSION_' + lang_to_var[lib.language] + ')' out_libbase = '$(LIBDIR)/$(CONFIG)/lib' + lib.name + '$(SHARED_VERSION_' + lang_to_var[lib.language] + ')' @@ -1781,7 +1781,7 @@ ## C-only targets specificities. $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) \ + $(Q) $(LDXX) $(LDFLAGS) \ % if not has_no_sources: $(${tgt.name.upper()}_OBJS)\ % endif diff --git a/templates/config.m4.template b/templates/config.m4.template index 4dbeeafb86a..f13ac75914f 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -26,8 +26,10 @@ case $host in *darwin*) + PHP_ADD_LIBRARY(c++,1,GRPC_SHARED_LIBADD) ;; *) + PHP_ADD_LIBRARY(stdc++,1,GRPC_SHARED_LIBADD) PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD) PHP_ADD_LIBRARY(rt) ;; From db7365753e7e590e5bed13ac8cb0db1565d1fc84 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Tue, 3 Sep 2019 16:08:48 -0700 Subject: [PATCH 537/661] Fix the compile error due to ByteBuffer in method_handler_impl.h --- include/grpcpp/impl/codegen/method_handler_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grpcpp/impl/codegen/method_handler_impl.h b/include/grpcpp/impl/codegen/method_handler_impl.h index 232580cf839..f65a1736ad2 100644 --- a/include/grpcpp/impl/codegen/method_handler_impl.h +++ b/include/grpcpp/impl/codegen/method_handler_impl.h @@ -207,7 +207,7 @@ class ServerStreamingHandler : public ::grpc::internal::MethodHandler { void* Deserialize(grpc_call* call, grpc_byte_buffer* req, ::grpc::Status* status, void** /*handler_data*/) final { - ByteBuffer buf; + ::grpc::ByteBuffer buf; buf.set_buffer(req); auto* request = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc( From c831a28dbd694f929fbbc0a4ac88fc4656d0caf3 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 2 Sep 2019 20:44:32 -0700 Subject: [PATCH 538/661] Organize test cases for xds test --- test/cpp/end2end/xds_end2end_test.cc | 413 ++++++++++++++------------- 1 file changed, 218 insertions(+), 195 deletions(-) diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 1c073de1b12..17436bbc13a 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -914,6 +914,8 @@ class XdsResolverTest : public XdsEnd2endTest { XdsResolverTest() : XdsEnd2endTest(0, 0, 0) {} }; +// Tests that if the "xds-experimental" scheme is used, xDS resolver will be +// used. TEST_F(XdsResolverTest, XdsResolverIsUsed) { // Use xds-experimental scheme in URI. ResetStub(0, "", "xds-experimental"); @@ -923,12 +925,14 @@ TEST_F(XdsResolverTest, XdsResolverIsUsed) { EXPECT_EQ("xds_experimental", channel_->GetLoadBalancingPolicyName()); } -class SingleBalancerTest : public XdsEnd2endTest { +class BasicTest : public XdsEnd2endTest { public: - SingleBalancerTest() : XdsEnd2endTest(4, 1, 0) {} + BasicTest() : XdsEnd2endTest(4, 1, 0) {} }; -TEST_F(SingleBalancerTest, Vanilla) { +// Tests that the balancer sends the correct response to the client, and the +// client sends RPCs to the backends using the default child policy. +TEST_F(BasicTest, Vanilla) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); const size_t kNumRpcsPerAddress = 100; @@ -954,7 +958,9 @@ TEST_F(SingleBalancerTest, Vanilla) { EXPECT_EQ("xds_experimental", channel_->GetLoadBalancingPolicyName()); } -TEST_F(SingleBalancerTest, SameBackendListedMultipleTimes) { +// Tests that subchannel sharing works when the same backend is listed multiple +// times. +TEST_F(BasicTest, SameBackendListedMultipleTimes) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); // Same backend listed twice. @@ -976,55 +982,8 @@ TEST_F(SingleBalancerTest, SameBackendListedMultipleTimes) { EXPECT_EQ(1UL, backends_[0]->backend_service()->clients().size()); } -TEST_F(SingleBalancerTest, SecureNaming) { - // TODO(juanlishen): Use separate fake creds for the balancer channel. - ResetStub(0, kApplicationTargetName_ + ";lb"); - SetNextResolution({}, kDefaultServiceConfig_.c_str()); - SetNextResolutionForLbChannel({balancers_[0]->port()}); - const size_t kNumRpcsPerAddress = 100; - EdsServiceImpl::ResponseArgs args({ - {"locality0", GetBackendPorts()}, - }); - ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); - // Make sure that trying to connect works without a call. - channel_->GetState(true /* try_to_connect */); - // We need to wait for all backends to come online. - WaitForAllBackends(); - // Send kNumRpcsPerAddress RPCs per server. - CheckRpcSendOk(kNumRpcsPerAddress * num_backends_); - - // Each backend should have gotten 100 requests. - for (size_t i = 0; i < backends_.size(); ++i) { - EXPECT_EQ(kNumRpcsPerAddress, - backends_[i]->backend_service()->request_count()); - } - // The EDS service got a single request, and sent a single response. - EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); - EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); -} - -TEST_F(SingleBalancerTest, SecureNamingDeathTest) { - ::testing::FLAGS_gtest_death_test_style = "threadsafe"; - // Make sure that we blow up (via abort() from the security connector) when - // the name from the balancer doesn't match expectations. - ASSERT_DEATH_IF_SUPPORTED( - { - ResetStub(0, kApplicationTargetName_ + ";lb"); - SetNextResolution({}, - "{\n" - " \"loadBalancingConfig\":[\n" - " { \"does_not_exist\":{} },\n" - " { \"xds_experimental\":{ \"balancerName\": " - "\"fake:///wrong_lb\" } }\n" - " ]\n" - "}"); - SetNextResolutionForLbChannel({balancers_[0]->port()}); - channel_->WaitForConnected(grpc_timeout_seconds_to_deadline(1)); - }, - ""); -} - -TEST_F(SingleBalancerTest, InitiallyEmptyServerlist) { +// Tests that RPCs will be blocked until a non-empty serverlist is received. +TEST_F(BasicTest, InitiallyEmptyServerlist) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); const int kServerlistDelayMs = 500 * grpc_test_slowdown_factor(); @@ -1058,7 +1017,9 @@ TEST_F(SingleBalancerTest, InitiallyEmptyServerlist) { EXPECT_EQ(2U, balancers_[0]->eds_service()->response_count()); } -TEST_F(SingleBalancerTest, AllServersUnreachableFailFast) { +// Tests that RPCs will fail with UNAVAILABLE instead of DEADLINE_EXCEEDED if +// all the servers are unreachable. +TEST_F(BasicTest, AllServersUnreachableFailFast) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); const size_t kNumUnreachableServers = 5; @@ -1078,7 +1039,81 @@ TEST_F(SingleBalancerTest, AllServersUnreachableFailFast) { EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } -TEST_F(SingleBalancerTest, LocalityMapWeightedRoundRobin) { +// Tests that RPCs fail when the backends are down, and will succeed again after +// the backends are restarted. +TEST_F(BasicTest, BackendsRestart) { + SetNextResolution({}, kDefaultServiceConfig_.c_str()); + SetNextResolutionForLbChannelAllBalancers(); + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts()}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); + WaitForAllBackends(); + // Stop backends. RPCs should fail. + ShutdownAllBackends(); + CheckRpcSendFailure(); + // Restart all backends. RPCs should start succeeding again. + StartAllBackends(); + CheckRpcSendOk(1 /* times */, 2000 /* timeout_ms */, + true /* wait_for_ready */); +} + +using SecureNamingTest = BasicTest; + +// Tests that secure naming check passes if target name is expected. +TEST_F(SecureNamingTest, TargetNameIsExpected) { + // TODO(juanlishen): Use separate fake creds for the balancer channel. + ResetStub(0, kApplicationTargetName_ + ";lb"); + SetNextResolution({}, kDefaultServiceConfig_.c_str()); + SetNextResolutionForLbChannel({balancers_[0]->port()}); + const size_t kNumRpcsPerAddress = 100; + EdsServiceImpl::ResponseArgs args({ + {"locality0", GetBackendPorts()}, + }); + ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); + // Make sure that trying to connect works without a call. + channel_->GetState(true /* try_to_connect */); + // We need to wait for all backends to come online. + WaitForAllBackends(); + // Send kNumRpcsPerAddress RPCs per server. + CheckRpcSendOk(kNumRpcsPerAddress * num_backends_); + // Each backend should have gotten 100 requests. + for (size_t i = 0; i < backends_.size(); ++i) { + EXPECT_EQ(kNumRpcsPerAddress, + backends_[i]->backend_service()->request_count()); + } + // The EDS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); +} + +// Tests that secure naming check fails if target name is unexpected. +TEST_F(SecureNamingTest, TargetNameIsUnexpected) { + ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + // Make sure that we blow up (via abort() from the security connector) when + // the name from the balancer doesn't match expectations. + ASSERT_DEATH_IF_SUPPORTED( + { + ResetStub(0, kApplicationTargetName_ + ";lb"); + SetNextResolution({}, + "{\n" + " \"loadBalancingConfig\":[\n" + " { \"does_not_exist\":{} },\n" + " { \"xds_experimental\":{ \"balancerName\": " + "\"fake:///wrong_lb\" } }\n" + " ]\n" + "}"); + SetNextResolutionForLbChannel({balancers_[0]->port()}); + channel_->WaitForConnected(grpc_timeout_seconds_to_deadline(1)); + }, + ""); +} + +using LocalityMapTest = BasicTest; + +// Tests that the localities in a locality map are picked according to their +// weights. +TEST_F(LocalityMapTest, WeightedRoundRobin) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); const size_t kNumRpcs = 5000; @@ -1120,7 +1155,9 @@ TEST_F(SingleBalancerTest, LocalityMapWeightedRoundRobin) { EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } -TEST_F(SingleBalancerTest, LocalityMapStressTest) { +// Tests that the locality map can work properly even when it contains a large +// number of localities. +TEST_F(LocalityMapTest, StressTest) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); const size_t kNumLocalities = 100; @@ -1153,7 +1190,9 @@ TEST_F(SingleBalancerTest, LocalityMapStressTest) { EXPECT_EQ(2U, balancers_[0]->eds_service()->response_count()); } -TEST_F(SingleBalancerTest, LocalityMapUpdate) { +// Tests that the localities in a locality map are picked correctly after update +// (addition, modification, deletion). +TEST_F(LocalityMapTest, UpdateMap) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); const size_t kNumRpcs = 1000; @@ -1244,7 +1283,10 @@ TEST_F(SingleBalancerTest, LocalityMapUpdate) { EXPECT_EQ(2U, balancers_[0]->eds_service()->response_count()); } -TEST_F(SingleBalancerTest, Drop) { +using DropTest = BasicTest; + +// Tests that RPCs are dropped according to the drop config. +TEST_F(DropTest, Vanilla) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); const size_t kNumRpcs = 5000; @@ -1289,7 +1331,8 @@ TEST_F(SingleBalancerTest, Drop) { EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } -TEST_F(SingleBalancerTest, DropPerHundred) { +// Tests that drop config is converted correctly from per hundred. +TEST_F(DropTest, DropPerHundred) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); const size_t kNumRpcs = 5000; @@ -1329,7 +1372,8 @@ TEST_F(SingleBalancerTest, DropPerHundred) { EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } -TEST_F(SingleBalancerTest, DropPerTenThousand) { +// Tests that drop config is converted correctly from per ten thousand. +TEST_F(DropTest, DropPerTenThousand) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); const size_t kNumRpcs = 5000; @@ -1369,7 +1413,8 @@ TEST_F(SingleBalancerTest, DropPerTenThousand) { EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } -TEST_F(SingleBalancerTest, DropUpdate) { +// Tests that drop is working correctly after update. +TEST_F(DropTest, Update) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); const size_t kNumRpcs = 5000; @@ -1464,7 +1509,8 @@ TEST_F(SingleBalancerTest, DropUpdate) { EXPECT_EQ(2U, balancers_[0]->eds_service()->response_count()); } -TEST_F(SingleBalancerTest, DropAll) { +// Tests that all the RPCs are dropped if any drop category drops 100%. +TEST_F(DropTest, DropAll) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); const size_t kNumRpcs = 1000; @@ -1489,7 +1535,11 @@ TEST_F(SingleBalancerTest, DropAll) { EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } -TEST_F(SingleBalancerTest, Fallback) { +using FallbackTest = BasicTest; + +// Tests that RPCs are handled by the fallback backends before the serverlist is +// received, but will be handled by the serverlist after it's received. +TEST_F(FallbackTest, Vanilla) { const int kFallbackTimeoutMs = 200 * grpc_test_slowdown_factor(); const int kServerlistDelayMs = 500 * grpc_test_slowdown_factor(); const size_t kNumBackendsInResolution = backends_.size() / 2; @@ -1537,7 +1587,9 @@ TEST_F(SingleBalancerTest, Fallback) { EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } -TEST_F(SingleBalancerTest, FallbackUpdate) { +// Tests that RPCs are handled by the updated fallback backends before +// serverlist is received, +TEST_F(FallbackTest, Update) { const int kFallbackTimeoutMs = 200 * grpc_test_slowdown_factor(); const int kServerlistDelayMs = 500 * grpc_test_slowdown_factor(); const size_t kNumBackendsInResolution = backends_.size() / 3; @@ -1617,7 +1669,8 @@ TEST_F(SingleBalancerTest, FallbackUpdate) { EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); } -TEST_F(SingleBalancerTest, FallbackEarlyWhenBalancerChannelFails) { +// Tests that fallback will kick in immediately if the balancer channel fails. +TEST_F(FallbackTest, FallbackEarlyWhenBalancerChannelFails) { const int kFallbackTimeoutMs = 10000 * grpc_test_slowdown_factor(); ResetStub(kFallbackTimeoutMs); // Return an unreachable balancer and one fallback backend. @@ -1629,7 +1682,8 @@ TEST_F(SingleBalancerTest, FallbackEarlyWhenBalancerChannelFails) { /* wait_for_ready */ false); } -TEST_F(SingleBalancerTest, FallbackEarlyWhenBalancerCallFails) { +// Tests that fallback will kick in immediately if the balancer call fails. +TEST_F(FallbackTest, FallbackEarlyWhenBalancerCallFails) { const int kFallbackTimeoutMs = 10000 * grpc_test_slowdown_factor(); ResetStub(kFallbackTimeoutMs); // Return one balancer and one fallback backend. @@ -1643,7 +1697,9 @@ TEST_F(SingleBalancerTest, FallbackEarlyWhenBalancerCallFails) { /* wait_for_ready */ false); } -TEST_F(SingleBalancerTest, FallbackIfResponseReceivedButChildNotReady) { +// Tests that fallback mode is entered if balancer response is received but the +// backends can't be reached. +TEST_F(FallbackTest, FallbackIfResponseReceivedButChildNotReady) { const int kFallbackTimeoutMs = 500 * grpc_test_slowdown_factor(); ResetStub(kFallbackTimeoutMs); SetNextResolution({backends_[0]->port()}, kDefaultServiceConfig_.c_str()); @@ -1659,7 +1715,9 @@ TEST_F(SingleBalancerTest, FallbackIfResponseReceivedButChildNotReady) { WaitForBackend(0); } -TEST_F(SingleBalancerTest, FallbackModeIsExitedWhenBalancerSaysToDropAllCalls) { +// Tests that fallback mode is exited if the balancer tells the client to drop +// all the calls. +TEST_F(FallbackTest, FallbackModeIsExitedWhenBalancerSaysToDropAllCalls) { // Return an unreachable balancer and one fallback backend. SetNextResolution({backends_[0]->port()}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannel({grpc_pick_unused_port_or_die()}); @@ -1682,7 +1740,8 @@ TEST_F(SingleBalancerTest, FallbackModeIsExitedWhenBalancerSaysToDropAllCalls) { CheckRpcSendFailure(); } -TEST_F(SingleBalancerTest, FallbackModeIsExitedAfterChildRready) { +// Tests that fallback mode is exited if the child policy becomes ready. +TEST_F(FallbackTest, FallbackModeIsExitedAfterChildRready) { // Return an unreachable balancer and one fallback backend. SetNextResolution({backends_[0]->port()}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannel({grpc_pick_unused_port_or_die()}); @@ -1714,29 +1773,14 @@ TEST_F(SingleBalancerTest, FallbackModeIsExitedAfterChildRready) { EXPECT_EQ(100U, backends_[1]->backend_service()->request_count()); } -TEST_F(SingleBalancerTest, BackendsRestart) { - SetNextResolution({}, kDefaultServiceConfig_.c_str()); - SetNextResolutionForLbChannelAllBalancers(); - EdsServiceImpl::ResponseArgs args({ - {"locality0", GetBackendPorts()}, - }); - ScheduleResponseForBalancer(0, EdsServiceImpl::BuildResponse(args), 0); - WaitForAllBackends(); - // Stop backends. RPCs should fail. - ShutdownAllBackends(); - CheckRpcSendFailure(); - // Restart all backends. RPCs should start succeeding again. - StartAllBackends(); - CheckRpcSendOk(1 /* times */, 2000 /* timeout_ms */, - true /* wait_for_ready */); -} - -class UpdatesTest : public XdsEnd2endTest { +class BalancerUpdateTest : public XdsEnd2endTest { public: - UpdatesTest() : XdsEnd2endTest(4, 3, 0) {} + BalancerUpdateTest() : XdsEnd2endTest(4, 3, 0) {} }; -TEST_F(UpdatesTest, UpdateBalancersButKeepUsingOriginalBalancer) { +// Tests that the old LB call is still used after the balancer address update as +// long as that call is still alive. +TEST_F(BalancerUpdateTest, UpdateBalancersButKeepUsingOriginalBalancer) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); EdsServiceImpl::ResponseArgs args({ @@ -1747,18 +1791,14 @@ TEST_F(UpdatesTest, UpdateBalancersButKeepUsingOriginalBalancer) { {"locality0", {backends_[1]->port()}}, }); ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(args), 0); - // Wait until the first backend is ready. WaitForBackend(0); - // Send 10 requests. gpr_log(GPR_INFO, "========= BEFORE FIRST BATCH =========="); CheckRpcSendOk(10); gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH =========="); - // All 10 requests should have gone to the first backend. EXPECT_EQ(10U, backends_[0]->backend_service()->request_count()); - // The EDS service of balancer 0 got a single request, and sent a single // response. EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); @@ -1767,11 +1807,9 @@ TEST_F(UpdatesTest, UpdateBalancersButKeepUsingOriginalBalancer) { EXPECT_EQ(0U, balancers_[1]->eds_service()->response_count()); EXPECT_EQ(0U, balancers_[2]->eds_service()->request_count()); EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); - gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 1 =========="); SetNextResolutionForLbChannel({balancers_[1]->port()}); gpr_log(GPR_INFO, "========= UPDATE 1 DONE =========="); - EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); gpr_timespec deadline = gpr_time_add( gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(10000, GPR_TIMESPAN)); @@ -1782,7 +1820,6 @@ TEST_F(UpdatesTest, UpdateBalancersButKeepUsingOriginalBalancer) { // The current LB call is still working, so xds continued using it to the // first balancer, which doesn't assign the second backend. EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); - EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); EXPECT_EQ(0U, balancers_[1]->eds_service()->request_count()); @@ -1791,7 +1828,12 @@ TEST_F(UpdatesTest, UpdateBalancersButKeepUsingOriginalBalancer) { EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); } -TEST_F(UpdatesTest, UpdateBalancerName) { +// Tests that the old LB call is still used after multiple balancer address +// updates as long as that call is still alive. Send an update with the same set +// of LBs as the one in SetUp() in order to verify that the LB channel inside +// xds keeps the initial connection (which by definition is also present in the +// update). +TEST_F(BalancerUpdateTest, Repeated) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); EdsServiceImpl::ResponseArgs args({ @@ -1802,18 +1844,14 @@ TEST_F(UpdatesTest, UpdateBalancerName) { {"locality0", {backends_[1]->port()}}, }); ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(args), 0); - // Wait until the first backend is ready. WaitForBackend(0); - // Send 10 requests. gpr_log(GPR_INFO, "========= BEFORE FIRST BATCH =========="); CheckRpcSendOk(10); gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH =========="); - // All 10 requests should have gone to the first backend. EXPECT_EQ(10U, backends_[0]->backend_service()->request_count()); - // The EDS service of balancer 0 got a single request, and sent a single // response. EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); @@ -1822,49 +1860,44 @@ TEST_F(UpdatesTest, UpdateBalancerName) { EXPECT_EQ(0U, balancers_[1]->eds_service()->response_count()); EXPECT_EQ(0U, balancers_[2]->eds_service()->request_count()); EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); - std::vector ports; + ports.emplace_back(balancers_[0]->port()); ports.emplace_back(balancers_[1]->port()); - auto new_lb_channel_response_generator = - grpc_core::MakeRefCounted(); - SetNextResolutionForLbChannel(ports, nullptr, - new_lb_channel_response_generator.get()); - gpr_log(GPR_INFO, "========= ABOUT TO UPDATE BALANCER NAME =========="); - SetNextResolution({}, - "{\n" - " \"loadBalancingConfig\":[\n" - " { \"does_not_exist\":{} },\n" - " { \"xds_experimental\":{ \"balancerName\": " - "\"fake:///updated_lb\" } }\n" - " ]\n" - "}", - new_lb_channel_response_generator.get()); - gpr_log(GPR_INFO, "========= UPDATED BALANCER NAME =========="); - - // Wait until update has been processed, as signaled by the second backend - // receiving a request. + ports.emplace_back(balancers_[2]->port()); + gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 1 =========="); + SetNextResolutionForLbChannel(ports); + gpr_log(GPR_INFO, "========= UPDATE 1 DONE =========="); + EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); + gpr_timespec deadline = gpr_time_add( + gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(10000, GPR_TIMESPAN)); + // Send 10 seconds worth of RPCs + do { + CheckRpcSendOk(); + } while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0); + // xds continued using the original LB call to the first balancer, which + // doesn't assign the second backend. + EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); + ports.clear(); + ports.emplace_back(balancers_[0]->port()); + ports.emplace_back(balancers_[1]->port()); + gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 2 =========="); + SetNextResolutionForLbChannel(ports); + gpr_log(GPR_INFO, "========= UPDATE 2 DONE =========="); + EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); + deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_millis(10000, GPR_TIMESPAN)); + // Send 10 seconds worth of RPCs + do { + CheckRpcSendOk(); + } while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0); + // xds continued using the original LB call to the first balancer, which + // doesn't assign the second backend. EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); - WaitForBackend(1); - - backends_[1]->backend_service()->ResetCounters(); - gpr_log(GPR_INFO, "========= BEFORE SECOND BATCH =========="); - CheckRpcSendOk(10); - gpr_log(GPR_INFO, "========= DONE WITH SECOND BATCH =========="); - // All 10 requests should have gone to the second backend. - EXPECT_EQ(10U, backends_[1]->backend_service()->request_count()); - - EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); - EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); - EXPECT_EQ(1U, balancers_[1]->eds_service()->request_count()); - EXPECT_EQ(1U, balancers_[1]->eds_service()->response_count()); - EXPECT_EQ(0U, balancers_[2]->eds_service()->request_count()); - EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); } -// Send an update with the same set of LBs as the one in SetUp() in order to -// verify that the LB channel inside xds keeps the initial connection (which -// by definition is also present in the update). -TEST_F(UpdatesTest, UpdateBalancersRepeated) { +// Tests that if the balancer name changes, a new LB channel will be created to +// replace the old one. +TEST_F(BalancerUpdateTest, UpdateBalancerName) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); EdsServiceImpl::ResponseArgs args({ @@ -1875,18 +1908,14 @@ TEST_F(UpdatesTest, UpdateBalancersRepeated) { {"locality0", {backends_[1]->port()}}, }); ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(args), 0); - // Wait until the first backend is ready. WaitForBackend(0); - // Send 10 requests. gpr_log(GPR_INFO, "========= BEFORE FIRST BATCH =========="); CheckRpcSendOk(10); gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH =========="); - // All 10 requests should have gone to the first backend. EXPECT_EQ(10U, backends_[0]->backend_service()->request_count()); - // The EDS service of balancer 0 got a single request, and sent a single // response. EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); @@ -1895,46 +1924,45 @@ TEST_F(UpdatesTest, UpdateBalancersRepeated) { EXPECT_EQ(0U, balancers_[1]->eds_service()->response_count()); EXPECT_EQ(0U, balancers_[2]->eds_service()->request_count()); EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); - std::vector ports; - ports.emplace_back(balancers_[0]->port()); ports.emplace_back(balancers_[1]->port()); - ports.emplace_back(balancers_[2]->port()); - gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 1 =========="); - SetNextResolutionForLbChannel(ports); - gpr_log(GPR_INFO, "========= UPDATE 1 DONE =========="); - - EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); - gpr_timespec deadline = gpr_time_add( - gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(10000, GPR_TIMESPAN)); - // Send 10 seconds worth of RPCs - do { - CheckRpcSendOk(); - } while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0); - // xds continued using the original LB call to the first balancer, which - // doesn't assign the second backend. - EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); - - ports.clear(); - ports.emplace_back(balancers_[0]->port()); - ports.emplace_back(balancers_[1]->port()); - gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 2 =========="); - SetNextResolutionForLbChannel(ports); - gpr_log(GPR_INFO, "========= UPDATE 2 DONE =========="); - - EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); - deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_millis(10000, GPR_TIMESPAN)); - // Send 10 seconds worth of RPCs - do { - CheckRpcSendOk(); - } while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0); - // xds continued using the original LB call to the first balancer, which - // doesn't assign the second backend. + auto new_lb_channel_response_generator = + grpc_core::MakeRefCounted(); + SetNextResolutionForLbChannel(ports, nullptr, + new_lb_channel_response_generator.get()); + gpr_log(GPR_INFO, "========= ABOUT TO UPDATE BALANCER NAME =========="); + SetNextResolution({}, + "{\n" + " \"loadBalancingConfig\":[\n" + " { \"does_not_exist\":{} },\n" + " { \"xds_experimental\":{ \"balancerName\": " + "\"fake:///updated_lb\" } }\n" + " ]\n" + "}", + new_lb_channel_response_generator.get()); + gpr_log(GPR_INFO, "========= UPDATED BALANCER NAME =========="); + // Wait until update has been processed, as signaled by the second backend + // receiving a request. EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); + WaitForBackend(1); + backends_[1]->backend_service()->ResetCounters(); + gpr_log(GPR_INFO, "========= BEFORE SECOND BATCH =========="); + CheckRpcSendOk(10); + gpr_log(GPR_INFO, "========= DONE WITH SECOND BATCH =========="); + // All 10 requests should have gone to the second backend. + EXPECT_EQ(10U, backends_[1]->backend_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); + EXPECT_EQ(1U, balancers_[1]->eds_service()->request_count()); + EXPECT_EQ(1U, balancers_[1]->eds_service()->response_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->request_count()); + EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); } -TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) { +// Tests that if the balancer is down, the RPCs will still be sent to the +// backends according to the last balancer response, until a new balancer is +// reachable. +TEST_F(BalancerUpdateTest, DeadUpdate) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannel({balancers_[0]->port()}); EdsServiceImpl::ResponseArgs args({ @@ -1945,19 +1973,16 @@ TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) { {"locality0", {backends_[1]->port()}}, }); ScheduleResponseForBalancer(1, EdsServiceImpl::BuildResponse(args), 0); - // Start servers and send 10 RPCs per server. gpr_log(GPR_INFO, "========= BEFORE FIRST BATCH =========="); CheckRpcSendOk(10); gpr_log(GPR_INFO, "========= DONE WITH FIRST BATCH =========="); // All 10 requests should have gone to the first backend. EXPECT_EQ(10U, backends_[0]->backend_service()->request_count()); - // Kill balancer 0 gpr_log(GPR_INFO, "********** ABOUT TO KILL BALANCER 0 *************"); balancers_[0]->Shutdown(); gpr_log(GPR_INFO, "********** KILLED BALANCER 0 *************"); - // This is serviced by the existing child policy. gpr_log(GPR_INFO, "========= BEFORE SECOND BATCH =========="); CheckRpcSendOk(10); @@ -1965,7 +1990,6 @@ TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) { // All 10 requests should again have gone to the first backend. EXPECT_EQ(20U, backends_[0]->backend_service()->request_count()); EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); - // The EDS service of balancer 0 got a single request, and sent a single // response. EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); @@ -1974,17 +1998,14 @@ TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) { EXPECT_EQ(0U, balancers_[1]->eds_service()->response_count()); EXPECT_EQ(0U, balancers_[2]->eds_service()->request_count()); EXPECT_EQ(0U, balancers_[2]->eds_service()->response_count()); - gpr_log(GPR_INFO, "========= ABOUT TO UPDATE 1 =========="); SetNextResolutionForLbChannel({balancers_[1]->port()}); gpr_log(GPR_INFO, "========= UPDATE 1 DONE =========="); - // Wait until update has been processed, as signaled by the second backend // receiving a request. In the meantime, the client continues to be serviced // (by the first backend) without interruption. EXPECT_EQ(0U, backends_[1]->backend_service()->request_count()); WaitForBackend(1); - // This is serviced by the updated RR policy backends_[1]->backend_service()->ResetCounters(); gpr_log(GPR_INFO, "========= BEFORE THIRD BATCH =========="); @@ -1992,7 +2013,6 @@ TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) { gpr_log(GPR_INFO, "========= DONE WITH THIRD BATCH =========="); // All 10 requests should have gone to the second backend. EXPECT_EQ(10U, backends_[1]->backend_service()->request_count()); - EXPECT_EQ(1U, balancers_[0]->eds_service()->request_count()); EXPECT_EQ(1U, balancers_[0]->eds_service()->response_count()); // The second balancer, published as part of the first update, may end up @@ -2010,17 +2030,18 @@ TEST_F(UpdatesTest, UpdateBalancersDeadUpdate) { // The re-resolution tests are deferred because they rely on the fallback mode, // which hasn't been supported. -// TODO(juanlishen): Add TEST_F(UpdatesTest, ReresolveDeadBackend). +// TODO(juanlishen): Add TEST_F(BalancerUpdateTest, ReresolveDeadBackend). // TODO(juanlishen): Add TEST_F(UpdatesWithClientLoadReportingTest, // ReresolveDeadBalancer) -class SingleBalancerWithClientLoadReportingTest : public XdsEnd2endTest { +class ClientLoadReportingTest : public XdsEnd2endTest { public: - SingleBalancerWithClientLoadReportingTest() : XdsEnd2endTest(4, 1, 3) {} + ClientLoadReportingTest() : XdsEnd2endTest(4, 1, 3) {} }; -TEST_F(SingleBalancerWithClientLoadReportingTest, Vanilla) { +// Tests that the load report received at the balancer is correct. +TEST_F(ClientLoadReportingTest, Vanilla) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannel({balancers_[0]->port()}); const size_t kNumRpcsPerAddress = 100; @@ -2059,7 +2080,9 @@ TEST_F(SingleBalancerWithClientLoadReportingTest, Vanilla) { EXPECT_EQ(0U, client_stats->total_dropped_requests()); } -TEST_F(SingleBalancerWithClientLoadReportingTest, BalancerRestart) { +// Tests that if the balancer restarts, the client load report contains the +// stats before and after the restart correctly. +TEST_F(ClientLoadReportingTest, BalancerRestart) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannel({balancers_[0]->port()}); const size_t kNumBackendsFirstPass = backends_.size() / 2; @@ -2116,13 +2139,13 @@ TEST_F(SingleBalancerWithClientLoadReportingTest, BalancerRestart) { EXPECT_EQ(0U, client_stats->total_dropped_requests()); } -class SingleBalancerWithClientLoadReportingAndDropTest : public XdsEnd2endTest { +class ClientLoadReportingWithDropTest : public XdsEnd2endTest { public: - SingleBalancerWithClientLoadReportingAndDropTest() - : XdsEnd2endTest(4, 1, 20) {} + ClientLoadReportingWithDropTest() : XdsEnd2endTest(4, 1, 20) {} }; -TEST_F(SingleBalancerWithClientLoadReportingAndDropTest, Vanilla) { +// Tests that the drop stats are correctly reported by client load reporting. +TEST_F(ClientLoadReportingWithDropTest, Vanilla) { SetNextResolution({}, kDefaultServiceConfig_.c_str()); SetNextResolutionForLbChannelAllBalancers(); const size_t kNumRpcs = 3000; From 88aef7cd75bcdb703d041317a5b719619fc71da8 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 3 Sep 2019 17:12:28 -0700 Subject: [PATCH 539/661] Fix default case --- src/compiler/python_generator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index f553d9e7a3c..8935a516f8a 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -763,7 +763,7 @@ static bool ParseParameters(const grpc::string& parameter, std::vector comma_delimited_parameters; grpc_python_generator::Split(parameter, ',', &comma_delimited_parameters); if (comma_delimited_parameters.size() == 1 && - comma_delimited_parameters.empty()) { + comma_delimited_parameters[0].empty()) { *grpc_version = "grpc_2_0"; } else if (comma_delimited_parameters.size() == 1) { *grpc_version = comma_delimited_parameters[0]; From ce9e6376149a82840645e8b7cef152033f71c741 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 29 Aug 2019 13:53:37 +0200 Subject: [PATCH 540/661] enable server compression tests for grpc.aspnetcore.server --- tools/run_tests/run_interop_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index 0847d8426b8..099b8c7b1a5 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -211,7 +211,7 @@ class AspNetCoreLanguage: _SKIP_COMPUTE_ENGINE_CHANNEL_CREDS def unimplemented_test_cases_server(self): - return _SKIP_SERVER_COMPRESSION + return [] def __str__(self): return 'aspnetcore' From 36574888be8cabfb66345be8ffd1c152d80e0183 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 29 Aug 2019 09:53:41 -0400 Subject: [PATCH 541/661] upgrade bazel to 0.29 --- templates/tools/dockerfile/bazel.include | 2 +- tools/bazel | 2 +- tools/dockerfile/test/bazel/Dockerfile | 2 +- tools/dockerfile/test/sanity/Dockerfile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/tools/dockerfile/bazel.include b/templates/tools/dockerfile/bazel.include index 12a22785623..9762bdcb85f 100644 --- a/templates/tools/dockerfile/bazel.include +++ b/templates/tools/dockerfile/bazel.include @@ -2,7 +2,7 @@ # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.28.1 +ENV BAZEL_VERSION 0.29.0 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/bazel b/tools/bazel index 4d1d57f60d9..cfa875b0e63 100755 --- a/tools/bazel +++ b/tools/bazel @@ -32,7 +32,7 @@ then exec -a "$0" "${BAZEL_REAL}" "$@" fi -VERSION=0.28.1 +VERSION=0.29.0 echo "INFO: Running bazel wrapper (see //tools/bazel for details), bazel version $VERSION will be used instead of system-wide bazel installation." diff --git a/tools/dockerfile/test/bazel/Dockerfile b/tools/dockerfile/test/bazel/Dockerfile index 7141fb9c5f1..fde54bae877 100644 --- a/tools/dockerfile/test/bazel/Dockerfile +++ b/tools/dockerfile/test/bazel/Dockerfile @@ -52,7 +52,7 @@ RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 t # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.28.1 +ENV BAZEL_VERSION 0.29.0 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile index badff52de34..4d3691f32bd 100644 --- a/tools/dockerfile/test/sanity/Dockerfile +++ b/tools/dockerfile/test/sanity/Dockerfile @@ -97,7 +97,7 @@ ENV CLANG_TIDY=clang-tidy # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.28.1 +ENV BAZEL_VERSION 0.29.0 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 From 0c3a5990b1c3117f5808eed8933607772ef37e69 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 4 Sep 2019 03:48:40 -0400 Subject: [PATCH 542/661] upgrade windows RBE to bazel 0.29 --- tools/internal_ci/windows/bazel_rbe.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/internal_ci/windows/bazel_rbe.bat b/tools/internal_ci/windows/bazel_rbe.bat index 153b2d59687..e55534e2e84 100644 --- a/tools/internal_ci/windows/bazel_rbe.bat +++ b/tools/internal_ci/windows/bazel_rbe.bat @@ -14,7 +14,7 @@ @rem TODO(jtattermusch): make this generate less output @rem TODO(jtattermusch): use tools/bazel script to keep the versions in sync -choco install bazel -y --version 0.26.0 --limit-output +choco install bazel -y --version 0.29.0 --limit-output cd github/grpc set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH% From 08dc3310191031cf6eccb98c49216a407d4d0c0f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 4 Sep 2019 04:09:21 -0400 Subject: [PATCH 543/661] try fix win RBE build --- tools/internal_ci/windows/bazel_rbe.bat | 2 +- tools/remote_build/windows.bazelrc | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/internal_ci/windows/bazel_rbe.bat b/tools/internal_ci/windows/bazel_rbe.bat index e55534e2e84..8d8ea118ebd 100644 --- a/tools/internal_ci/windows/bazel_rbe.bat +++ b/tools/internal_ci/windows/bazel_rbe.bat @@ -24,7 +24,7 @@ powershell -Command "[guid]::NewGuid().ToString()" >%KOKORO_ARTIFACTS_DIR%/bazel set /p BAZEL_INVOCATION_ID=<%KOKORO_ARTIFACTS_DIR%/bazel_invocation_ids @rem TODO(jtattermusch): windows RBE should be able to use the same credentials as Linux RBE. -bazel --bazelrc=tools/remote_build/windows.bazelrc build --invocation_id="%BAZEL_INVOCATION_ID%" --workspace_status_command=tools/remote_build/workspace_status_kokoro.sh :all --incompatible_disallow_filetype=false --google_credentials=%KOKORO_GFILE_DIR%/rbe-windows-credentials.json +bazel --bazelrc=tools/remote_build/windows.bazelrc build --invocation_id="%BAZEL_INVOCATION_ID%" --workspace_status_command=tools/remote_build/workspace_status_kokoro.sh :all --google_credentials=%KOKORO_GFILE_DIR%/rbe-windows-credentials.json set BAZEL_EXITCODE=%errorlevel% @rem TODO(jtattermusch): upload results to bigquery diff --git a/tools/remote_build/windows.bazelrc b/tools/remote_build/windows.bazelrc index 9fd3071e79f..825d6765de9 100644 --- a/tools/remote_build/windows.bazelrc +++ b/tools/remote_build/windows.bazelrc @@ -1,8 +1,7 @@ startup --host_jvm_args=-Dbazel.DigestFunction=SHA256 -build --remote_cache=remotebuildexecution.googleapis.com -build --remote_executor=remotebuildexecution.googleapis.com -build --tls_enabled=true +build --remote_cache=grpcs://remotebuildexecution.googleapis.com +build --remote_executor=grpcs://remotebuildexecution.googleapis.com build --host_crosstool_top=//third_party/toolchains/bazel_0.26.0_rbe_windows:toolchain build --crosstool_top=//third_party/toolchains/bazel_0.26.0_rbe_windows:toolchain @@ -38,7 +37,7 @@ test --test_env=GRPC_VERBOSITY=debug # Set flags for uploading to BES in order to view results in the Bazel Build # Results UI. -build --bes_backend="buildeventservice.googleapis.com" +build --bes_backend=grpcs://buildeventservice.googleapis.com build --bes_timeout=60s build --bes_results_url="https://source.cloud.google.com/results/invocations/" build --project_id=grpc-testing From 0040bb9353f782b788e4bbbe20efdc87b36aa619 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 21 Nov 2018 10:55:41 +0100 Subject: [PATCH 544/661] attempt to add alpine C# distribtest --- .../DistribTest/DistribTestDotNet.csproj | 2 +- .../csharp/run_distrib_test_dotnetcli.sh | 17 ++++++++----- .../distribtest/csharp_alpine_x64/Dockerfile | 24 +++++++++++++++++++ .../artifacts/distribtest_targets.py | 1 + 4 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 tools/dockerfile/distribtest/csharp_alpine_x64/Dockerfile diff --git a/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj b/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj index d19eac91ba4..8cdf926f07f 100644 --- a/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj +++ b/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp1.0;net45 + netcoreapp2.1 false false false diff --git a/test/distrib/csharp/run_distrib_test_dotnetcli.sh b/test/distrib/csharp/run_distrib_test_dotnetcli.sh index 86c2d5231e1..357ce136cb7 100755 --- a/test/distrib/csharp/run_distrib_test_dotnetcli.sh +++ b/test/distrib/csharp/run_distrib_test_dotnetcli.sh @@ -28,19 +28,24 @@ cd DistribTest dotnet restore DistribTestDotNet.csproj dotnet build DistribTestDotNet.csproj -dotnet publish -f netcoreapp1.0 DistribTestDotNet.csproj -dotnet publish -f net45 DistribTestDotNet.csproj +dotnet publish -f netcoreapp2.1 DistribTestDotNet.csproj +#dotnet publish -f net45 DistribTestDotNet.csproj ls -R bin +#ldd /root/.nuget/packages/grpc.core/*/lib/netstandard1.5/../../runtimes/linux/native/libgrpc_csharp_ext.x64.so + +#ldd /root/.nuget/packages/grpc.tools/*/tools/linux_x64/grpc_csharp_plugin + +#exit 1 # .NET 4.5 target after dotnet build -mono bin/Debug/net45/publish/DistribTestDotNet.exe +#mono bin/Debug/net45/publish/DistribTestDotNet.exe # .NET 4.5 target after dotnet publish -mono bin/Debug/net45/publish/DistribTestDotNet.exe +#mono bin/Debug/net45/publish/DistribTestDotNet.exe # .NET Core target after dotnet build -dotnet exec bin/Debug/netcoreapp1.0/DistribTestDotNet.dll +dotnet exec bin/Debug/netcoreapp2.1/DistribTestDotNet.dll # .NET Core target after dotnet publish -dotnet exec bin/Debug/netcoreapp1.0/publish/DistribTestDotNet.dll +dotnet exec bin/Debug/netcoreapp2.1/publish/DistribTestDotNet.dll diff --git a/tools/dockerfile/distribtest/csharp_alpine_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_alpine_x64/Dockerfile new file mode 100644 index 00000000000..aa5034872c3 --- /dev/null +++ b/tools/dockerfile/distribtest/csharp_alpine_x64/Dockerfile @@ -0,0 +1,24 @@ +# Copyright 2015 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM microsoft/dotnet:2.1-sdk-alpine + +RUN apk update && apk add bash +RUN apk update && apk add unzip + +# needed to satisfy the "ld-linux-x86-64.so.2" dependency +RUN apk add libc6-compat + +#RUN apk add libnsl +#RUN cp /usr/lib/libnsl.so.2 /usr/lib/libnsl.so.1 diff --git a/tools/run_tests/artifacts/distribtest_targets.py b/tools/run_tests/artifacts/distribtest_targets.py index 35a561ea928..d45abdcbd41 100644 --- a/tools/run_tests/artifacts/distribtest_targets.py +++ b/tools/run_tests/artifacts/distribtest_targets.py @@ -309,6 +309,7 @@ def targets(): CSharpDistribTest('linux', 'x64', 'ubuntu1404'), CSharpDistribTest('linux', 'x64', 'ubuntu1604'), CSharpDistribTest('linux', 'x64', 'ubuntu1404', use_dotnet_cli=True), + CSharpDistribTest('linux', 'x64', 'alpine', use_dotnet_cli=True), CSharpDistribTest('macos', 'x86'), CSharpDistribTest('windows', 'x86'), CSharpDistribTest('windows', 'x64'), From 32dbe30b3517c8f4d93b6141d1f9066c2b53d960 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 4 Sep 2019 11:04:04 -0400 Subject: [PATCH 545/661] add .NET Core distribtest for ubuntu 16.04 --- .../distribtest/csharp_ubuntu1604_x64/Dockerfile | 10 ++++++++++ tools/run_tests/artifacts/distribtest_targets.py | 1 + 2 files changed, 11 insertions(+) diff --git a/tools/dockerfile/distribtest/csharp_ubuntu1604_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_ubuntu1604_x64/Dockerfile index 93ee75cfcd4..e0d8c458d0a 100644 --- a/tools/dockerfile/distribtest/csharp_ubuntu1604_x64/Dockerfile +++ b/tools/dockerfile/distribtest/csharp_ubuntu1604_x64/Dockerfile @@ -24,6 +24,16 @@ RUN apt-get update && apt-get install -y \ nuget \ && apt-get clean +RUN apt-get update && apt-get install -y curl && apt-get clean + +# Install dotnet SDK +ENV DOTNET_SDK_VERSION 2.1.500 +RUN curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz \ + && mkdir -p /usr/share/dotnet \ + && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ + && rm dotnet.tar.gz \ + && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet + RUN apt-get update && apt-get install -y unzip && apt-get clean # Make sure the mono certificate store is up-to-date to prevent issues with nuget restore diff --git a/tools/run_tests/artifacts/distribtest_targets.py b/tools/run_tests/artifacts/distribtest_targets.py index d45abdcbd41..e221dee3ab8 100644 --- a/tools/run_tests/artifacts/distribtest_targets.py +++ b/tools/run_tests/artifacts/distribtest_targets.py @@ -308,6 +308,7 @@ def targets(): CSharpDistribTest('linux', 'x64', 'centos7'), CSharpDistribTest('linux', 'x64', 'ubuntu1404'), CSharpDistribTest('linux', 'x64', 'ubuntu1604'), + CSharpDistribTest('linux', 'x64', 'ubuntu1604', use_dotnet_cli=True), CSharpDistribTest('linux', 'x64', 'ubuntu1404', use_dotnet_cli=True), CSharpDistribTest('linux', 'x64', 'alpine', use_dotnet_cli=True), CSharpDistribTest('macos', 'x86'), From f4c723556650dd49df1c1ad0c93eab4e7d86e5ca Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 4 Sep 2019 11:06:23 -0400 Subject: [PATCH 546/661] get rid of ubuntu14.04 C# distribtests --- .../csharp_ubuntu1404_x64/Dockerfile | 44 ------------------- .../artifacts/distribtest_targets.py | 2 - 2 files changed, 46 deletions(-) delete mode 100644 tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile diff --git a/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile deleted file mode 100644 index 61ca1a08a46..00000000000 --- a/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM ubuntu:14.04 - -RUN apt-get update && apt-get install -y apt-transport-https && apt-get clean - -RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb https://download.mono-project.com/repo/ubuntu stable-trusty main" | tee /etc/apt/sources.list.d/mono-official-stable.list - -RUN apt-get update && apt-get install -y \ - mono-devel \ - nuget \ - && apt-get clean - -RUN apt-get update && apt-get install -y unzip && apt-get clean - -# Install dotnet CLI -RUN apt-get install -y apt-transport-https -RUN sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' -RUN apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 -RUN apt-get update && apt-get install -y dotnet-dev-1.0.4 - -# Trigger the population of the local package cache for dotnet CLI -RUN mkdir warmup \ - && cd warmup \ - && dotnet new \ - && cd .. \ - && rm -rf warmup - -# Make sure the mono certificate store is up-to-date to prevent issues with nuget restore -RUN apt-get update && apt-get install -y curl && apt-get clean -RUN curl https://curl.haxx.se/ca/cacert.pem > ~/cacert.pem && cert-sync ~/cacert.pem && rm -f ~/cacert.pem diff --git a/tools/run_tests/artifacts/distribtest_targets.py b/tools/run_tests/artifacts/distribtest_targets.py index e221dee3ab8..2c7af6e37fc 100644 --- a/tools/run_tests/artifacts/distribtest_targets.py +++ b/tools/run_tests/artifacts/distribtest_targets.py @@ -306,10 +306,8 @@ def targets(): CSharpDistribTest('linux', 'x64', 'jessie'), CSharpDistribTest('linux', 'x86', 'jessie'), CSharpDistribTest('linux', 'x64', 'centos7'), - CSharpDistribTest('linux', 'x64', 'ubuntu1404'), CSharpDistribTest('linux', 'x64', 'ubuntu1604'), CSharpDistribTest('linux', 'x64', 'ubuntu1604', use_dotnet_cli=True), - CSharpDistribTest('linux', 'x64', 'ubuntu1404', use_dotnet_cli=True), CSharpDistribTest('linux', 'x64', 'alpine', use_dotnet_cli=True), CSharpDistribTest('macos', 'x86'), CSharpDistribTest('windows', 'x86'), From e0b87cd4a13bb29eb68350b0207b75fdb9f8cd9f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 4 Sep 2019 11:26:27 -0400 Subject: [PATCH 547/661] add debian stretch distribtest --- .../distribtest/csharp_stretch_x64/Dockerfile | 41 +++++++++++++++++++ .../artifacts/distribtest_targets.py | 2 + 2 files changed, 43 insertions(+) create mode 100644 tools/dockerfile/distribtest/csharp_stretch_x64/Dockerfile diff --git a/tools/dockerfile/distribtest/csharp_stretch_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_stretch_x64/Dockerfile new file mode 100644 index 00000000000..97779c52f8b --- /dev/null +++ b/tools/dockerfile/distribtest/csharp_stretch_x64/Dockerfile @@ -0,0 +1,41 @@ +# Copyright 2019 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM debian:stretch + +RUN apt-get update && apt-get install -y apt-transport-https dirmngr gnupg ca-certificates && apt-get clean + +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +RUN echo "deb https://download.mono-project.com/repo/debian stable-stretch main" | tee /etc/apt/sources.list.d/mono-official-stable.list + +RUN apt-get update && apt-get install -y \ + mono-devel \ + nuget \ + && apt-get clean + +RUN apt-get update && apt-get install -y curl && apt-get clean + +# Install dotnet SDK +ENV DOTNET_SDK_VERSION 2.1.500 +RUN curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz \ + && mkdir -p /usr/share/dotnet \ + && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ + && rm dotnet.tar.gz \ + && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet + +RUN apt-get update && apt-get install -y unzip && apt-get clean + +# Make sure the mono certificate store is up-to-date to prevent issues with nuget restore +RUN apt-get update && apt-get install -y curl && apt-get clean +RUN curl https://curl.haxx.se/ca/cacert.pem > ~/cacert.pem && cert-sync ~/cacert.pem && rm -f ~/cacert.pem diff --git a/tools/run_tests/artifacts/distribtest_targets.py b/tools/run_tests/artifacts/distribtest_targets.py index 2c7af6e37fc..5baf9d6c298 100644 --- a/tools/run_tests/artifacts/distribtest_targets.py +++ b/tools/run_tests/artifacts/distribtest_targets.py @@ -305,6 +305,8 @@ def targets(): CppDistribTest('windows', 'x86', testcase='cmake_as_externalproject'), CSharpDistribTest('linux', 'x64', 'jessie'), CSharpDistribTest('linux', 'x86', 'jessie'), + CSharpDistribTest('linux', 'x64', 'stretch'), + CSharpDistribTest('linux', 'x64', 'stretch', use_dotnet_cli=True), CSharpDistribTest('linux', 'x64', 'centos7'), CSharpDistribTest('linux', 'x64', 'ubuntu1604'), CSharpDistribTest('linux', 'x64', 'ubuntu1604', use_dotnet_cli=True), From 21104ec1ee26d2f89affaa76a737ec23fb185e61 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 4 Sep 2019 11:29:22 -0400 Subject: [PATCH 548/661] remove BOM --- test/distrib/csharp/DistribTest/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/distrib/csharp/DistribTest/Program.cs b/test/distrib/csharp/DistribTest/Program.cs index 0ea7211fc45..92f416785a6 100644 --- a/test/distrib/csharp/DistribTest/Program.cs +++ b/test/distrib/csharp/DistribTest/Program.cs @@ -16,7 +16,7 @@ #endregion -using System; +using System; using Grpc.Core; namespace TestGrpcPackage From 504c4ace804ba7e18c84125501628cf5cb327e97 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 4 Sep 2019 11:32:31 -0400 Subject: [PATCH 549/661] remove legacy c# testcodegen --- test/distrib/csharp/run_distrib_test.sh | 3 -- .../csharp/test_codegen/test_codegen.sh | 38 ------------------- .../csharp/test_codegen/testcodegen.proto | 29 -------------- test/distrib/csharp/update_version.sh | 2 +- 4 files changed, 1 insertion(+), 71 deletions(-) delete mode 100755 test/distrib/csharp/test_codegen/test_codegen.sh delete mode 100644 test/distrib/csharp/test_codegen/testcodegen.proto diff --git a/test/distrib/csharp/run_distrib_test.sh b/test/distrib/csharp/run_distrib_test.sh index 45911cd91a7..824e33e2876 100755 --- a/test/distrib/csharp/run_distrib_test.sh +++ b/test/distrib/csharp/run_distrib_test.sh @@ -27,6 +27,3 @@ nuget restore || nuget restore || nuget restore msbuild DistribTest.sln mono DistribTest/bin/Debug/DistribTest.exe - -# test that codegen work -test_codegen/test_codegen.sh diff --git a/test/distrib/csharp/test_codegen/test_codegen.sh b/test/distrib/csharp/test_codegen/test_codegen.sh deleted file mode 100755 index fa101889f68..00000000000 --- a/test/distrib/csharp/test_codegen/test_codegen.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# Copyright 2018 The gRPC Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex - -cd "$(dirname "$0")" - -ls -lR "../packages/Grpc.Tools.__GRPC_NUGET_VERSION__/tools" - -PLATFORM_ARCH=linux_x64 -if [ "$(uname)" == "Darwin" ] -then - PLATFORM_ARCH=macosx_x64 -elif [ "$(getconf LONG_BIT)" == "32" ] -then - PLATFORM_ARCH=linux_x86 -fi - -PROTOC=../packages/Grpc.Tools.__GRPC_NUGET_VERSION__/tools/${PLATFORM_ARCH}/protoc -PLUGIN=../packages/Grpc.Tools.__GRPC_NUGET_VERSION__/tools/${PLATFORM_ARCH}/grpc_csharp_plugin - -"${PROTOC}" --plugin="protoc-gen-grpc=${PLUGIN}" --csharp_out=. --grpc_out=. -I . testcodegen.proto - -ls ./*.cs - -echo 'Code generation works.' diff --git a/test/distrib/csharp/test_codegen/testcodegen.proto b/test/distrib/csharp/test_codegen/testcodegen.proto deleted file mode 100644 index 5c228b81dba..00000000000 --- a/test/distrib/csharp/test_codegen/testcodegen.proto +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The gRPC Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package testcodegen; - -service Greeter { - rpc SayHello (HelloRequest) returns (HelloReply) {} -} - -message HelloRequest { - string name = 1; -} - -message HelloReply { - string message = 1; -} diff --git a/test/distrib/csharp/update_version.sh b/test/distrib/csharp/update_version.sh index 0e47ed3abd5..9759cc56481 100755 --- a/test/distrib/csharp/update_version.sh +++ b/test/distrib/csharp/update_version.sh @@ -28,4 +28,4 @@ then fi # Replaces version placeholder with value provided as first argument. -sed -ibak "s/__GRPC_NUGET_VERSION__/${CSHARP_VERSION}/g" DistribTest/packages.config DistribTest/DistribTest.csproj DistribTest/DistribTestDotNet.csproj test_codegen/test_codegen.sh +sed -ibak "s/__GRPC_NUGET_VERSION__/${CSHARP_VERSION}/g" DistribTest/packages.config DistribTest/DistribTest.csproj DistribTest/DistribTestDotNet.csproj From aeb04913adfcbf90cf3dd4c2cb1aa8f55ac54508 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 9 Apr 2019 12:41:27 -0400 Subject: [PATCH 550/661] improved C# distribtest --- test/distrib/csharp/DistribTest/Program.cs | 44 +++++++++++++++---- .../csharp/DistribTest/testcodegen.proto | 2 +- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/test/distrib/csharp/DistribTest/Program.cs b/test/distrib/csharp/DistribTest/Program.cs index 92f416785a6..bda7b2104d6 100644 --- a/test/distrib/csharp/DistribTest/Program.cs +++ b/test/distrib/csharp/DistribTest/Program.cs @@ -17,7 +17,10 @@ #endregion using System; +using System.Linq; +using System.Threading.Tasks; using Grpc.Core; +using Helloworld; namespace TestGrpcPackage { @@ -25,14 +28,39 @@ namespace TestGrpcPackage { public static void Main(string[] args) { - // test codegen works - var reply = new Testcodegen.HelloReply(); - - // This code doesn't do much but makes sure the native extension is loaded - // which is what we are testing here. - Channel c = new Channel("127.0.0.1:1000", ChannelCredentials.Insecure); - c.ShutdownAsync().Wait(); - Console.WriteLine("Success!"); + // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755 + Server server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) }) + { + Services = { Greeter.BindService(new GreeterImpl()) }, + Ports = { new ServerPort("localhost", ServerPort.PickUnused, ServerCredentials.Insecure) } + }; + server.Start(); + + Channel channel = new Channel("localhost", server.Ports.Single().BoundPort, ChannelCredentials.Insecure); + + try + { + var client = new Greeter.GreeterClient(channel); + String user = "you"; + + var reply = client.SayHello(new HelloRequest { Name = user }); + Console.WriteLine("Greeting: " + reply.Message); + Console.WriteLine("Success!"); + } + finally + { + channel.ShutdownAsync().Wait(); + server.ShutdownAsync().Wait(); + } + } + } + + class GreeterImpl : Greeter.GreeterBase + { + // Server side handler of the SayHello RPC + public override Task SayHello(HelloRequest request, ServerCallContext context) + { + return Task.FromResult(new HelloReply { Message = "Hello " + request.Name }); } } } diff --git a/test/distrib/csharp/DistribTest/testcodegen.proto b/test/distrib/csharp/DistribTest/testcodegen.proto index 7845ac92c49..61444fc080e 100644 --- a/test/distrib/csharp/DistribTest/testcodegen.proto +++ b/test/distrib/csharp/DistribTest/testcodegen.proto @@ -14,7 +14,7 @@ syntax = "proto3"; -package testcodegen; +package helloworld; service Greeter { rpc SayHello (HelloRequest) returns (HelloReply) {} From a5560e8f7300463d4cb3506bb5fee73446affd8c Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 4 Sep 2019 09:20:33 -0700 Subject: [PATCH 551/661] Fix PHP build error --- config.m4 | 2 ++ src/php/ext/grpc/config.m4 | 7 ++++--- templates/config.m4.template | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config.m4 b/config.m4 index 4a8651dae38..efa86576f84 100644 --- a/config.m4 +++ b/config.m4 @@ -33,6 +33,8 @@ if test "$PHP_GRPC" != "no"; then ;; esac + PHP_SUBST(GRPC_SHARED_LIBADD) + PHP_NEW_EXTENSION(grpc, src/php/ext/grpc/byte_buffer.c \ src/php/ext/grpc/call.c \ diff --git a/src/php/ext/grpc/config.m4 b/src/php/ext/grpc/config.m4 index 1af93ceecad..ed62dee71cc 100755 --- a/src/php/ext/grpc/config.m4 +++ b/src/php/ext/grpc/config.m4 @@ -42,14 +42,15 @@ if test "$PHP_GRPC" != "no"; then dnl PHP_ADD_LIBRARY(pthread,,GRPC_SHARED_LIBADD) GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD" PHP_ADD_LIBRARY(pthread) - PHP_ADD_LIBRARY(stdc++,,GRPC_SHARED_LIBADD) - PHP_ADD_LIBRARY(stdc++) PHP_ADD_LIBRARY(dl,,GRPC_SHARED_LIBADD) PHP_ADD_LIBRARY(dl) case $host in - *darwin*) ;; + *darwin*) + PHP_ADD_LIBRARY(c++,1,GRPC_SHARED_LIBADD) + ;; *) + PHP_ADD_LIBRARY(stdc++,1,GRPC_SHARED_LIBADD) PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD) PHP_ADD_LIBRARY(rt) ;; diff --git a/templates/config.m4.template b/templates/config.m4.template index f13ac75914f..edb6a99dc67 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -35,6 +35,8 @@ ;; esac + PHP_SUBST(GRPC_SHARED_LIBADD) + PHP_NEW_EXTENSION(grpc, % for source in php_config_m4.src: ${source} ${"\\"} From 539b422708be9fc4ced914bf6738de49dc794852 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 4 Sep 2019 17:26:26 -0700 Subject: [PATCH 552/661] Trim trailing spaces --- src/php/ext/grpc/config.m4 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/php/ext/grpc/config.m4 b/src/php/ext/grpc/config.m4 index ed62dee71cc..7260dbc72ef 100755 --- a/src/php/ext/grpc/config.m4 +++ b/src/php/ext/grpc/config.m4 @@ -46,7 +46,7 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_LIBRARY(dl) case $host in - *darwin*) + *darwin*) PHP_ADD_LIBRARY(c++,1,GRPC_SHARED_LIBADD) ;; *) @@ -94,7 +94,7 @@ if test "$PHP_COVERAGE" = "yes"; then if test "$GCC" != "yes"; then AC_MSG_ERROR([GCC is required for --enable-coverage]) fi - + dnl Check if ccache is being used case `$php_shtool path $CC` in *ccache*[)] gcc_ccache=yes;; @@ -104,7 +104,7 @@ if test "$PHP_COVERAGE" = "yes"; then if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then AC_MSG_ERROR([ccache must be disabled when --enable-coverage option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) fi - + lcov_version_list="1.5 1.6 1.7 1.9 1.10 1.11 1.12 1.13" AC_CHECK_PROG(LCOV, lcov, lcov) @@ -123,7 +123,7 @@ if test "$PHP_COVERAGE" = "yes"; then done ]) else - lcov_msg="To enable code coverage reporting you must have one of the following LCOV versions installed: $lcov_version_list" + lcov_msg="To enable code coverage reporting you must have one of the following LCOV versions installed: $lcov_version_list" AC_MSG_ERROR([$lcov_msg]) fi From 1a331967102a7741369ee7f333a50e6418bb50ed Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 5 Sep 2019 09:50:21 +0200 Subject: [PATCH 553/661] upgrade helloworld example to 2.23.0 --- examples/csharp/Helloworld/Greeter/Greeter.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/csharp/Helloworld/Greeter/Greeter.csproj b/examples/csharp/Helloworld/Greeter/Greeter.csproj index 7989f795418..223b7fe1242 100644 --- a/examples/csharp/Helloworld/Greeter/Greeter.csproj +++ b/examples/csharp/Helloworld/Greeter/Greeter.csproj @@ -5,9 +5,9 @@ - - - + + + From cbac0b43616a1cb121923a70748be821c1cd02be Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 5 Sep 2019 09:50:41 +0200 Subject: [PATCH 554/661] upgrade routeguide example to 2.23.0 --- examples/csharp/RouteGuide/RouteGuide/RouteGuide.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/csharp/RouteGuide/RouteGuide/RouteGuide.csproj b/examples/csharp/RouteGuide/RouteGuide/RouteGuide.csproj index 4c6949488c7..bd374a887c1 100644 --- a/examples/csharp/RouteGuide/RouteGuide/RouteGuide.csproj +++ b/examples/csharp/RouteGuide/RouteGuide/RouteGuide.csproj @@ -5,9 +5,9 @@ - - - + + + From 10156898ea52c46e628aee42cd4c29d16ae21364 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 5 Sep 2019 09:58:11 +0200 Subject: [PATCH 555/661] upgrade helloworld classic example to 2.23.0 --- .../Greeter/Greeter.csproj | 30 ++++++++++++------- .../Greeter/packages.config | 15 ++++++---- .../GreeterClient/GreeterClient.csproj | 28 ++++++++++------- .../GreeterClient/packages.config | 13 ++++---- .../GreeterServer/GreeterServer.csproj | 28 ++++++++++------- .../GreeterServer/packages.config | 13 ++++---- 6 files changed, 80 insertions(+), 47 deletions(-) diff --git a/examples/csharp/HelloworldLegacyCsproj/Greeter/Greeter.csproj b/examples/csharp/HelloworldLegacyCsproj/Greeter/Greeter.csproj index da15ba3954b..adb2c7ac2c9 100644 --- a/examples/csharp/HelloworldLegacyCsproj/Greeter/Greeter.csproj +++ b/examples/csharp/HelloworldLegacyCsproj/Greeter/Greeter.csproj @@ -1,4 +1,4 @@ - + @@ -33,18 +33,26 @@ false - - ..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll + + ..\packages\Google.Protobuf.3.8.0\lib\net45\Google.Protobuf.dll - - ..\packages\Grpc.Core.1.17.0\lib\net45\Grpc.Core.dll + + ..\packages\Grpc.Core.2.23.0\lib\net45\Grpc.Core.dll + + + ..\packages\Grpc.Core.Api.2.23.0\lib\net45\Grpc.Core.Api.dll - - ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll - True + + ..\packages\System.Buffers.4.4.0\lib\netstandard1.1\System.Buffers.dll + + ..\packages\System.Memory.4.5.3\lib\netstandard1.1\System.Memory.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll + @@ -57,14 +65,14 @@ - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + - + + \ No newline at end of file diff --git a/examples/csharp/HelloworldLegacyCsproj/Greeter/packages.config b/examples/csharp/HelloworldLegacyCsproj/Greeter/packages.config index 154b5993213..418bfaba736 100644 --- a/examples/csharp/HelloworldLegacyCsproj/Greeter/packages.config +++ b/examples/csharp/HelloworldLegacyCsproj/Greeter/packages.config @@ -1,8 +1,11 @@ - + - - - + + + + - - + + + + \ No newline at end of file diff --git a/examples/csharp/HelloworldLegacyCsproj/GreeterClient/GreeterClient.csproj b/examples/csharp/HelloworldLegacyCsproj/GreeterClient/GreeterClient.csproj index 31a3a90345b..ec860440cfb 100644 --- a/examples/csharp/HelloworldLegacyCsproj/GreeterClient/GreeterClient.csproj +++ b/examples/csharp/HelloworldLegacyCsproj/GreeterClient/GreeterClient.csproj @@ -1,4 +1,4 @@ - + Debug @@ -32,18 +32,26 @@ true - - ..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll + + ..\packages\Google.Protobuf.3.8.0\lib\net45\Google.Protobuf.dll - - ..\packages\Grpc.Core.1.17.0\lib\net45\Grpc.Core.dll + + ..\packages\Grpc.Core.2.23.0\lib\net45\Grpc.Core.dll + + + ..\packages\Grpc.Core.Api.2.23.0\lib\net45\Grpc.Core.Api.dll - - ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll - True + + ..\packages\System.Buffers.4.4.0\lib\netstandard1.1\System.Buffers.dll + + ..\packages\System.Memory.4.5.3\lib\netstandard1.1\System.Memory.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll + @@ -59,11 +67,11 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/examples/csharp/HelloworldLegacyCsproj/GreeterClient/packages.config b/examples/csharp/HelloworldLegacyCsproj/GreeterClient/packages.config index 2fd8228689d..1f648dd06b8 100644 --- a/examples/csharp/HelloworldLegacyCsproj/GreeterClient/packages.config +++ b/examples/csharp/HelloworldLegacyCsproj/GreeterClient/packages.config @@ -1,7 +1,10 @@ - + - - - - + + + + + + + \ No newline at end of file diff --git a/examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj index 27ca9630401..e4685a6fc07 100644 --- a/examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj +++ b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj @@ -1,4 +1,4 @@ - + Debug @@ -32,18 +32,26 @@ true - - ..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll + + ..\packages\Google.Protobuf.3.8.0\lib\net45\Google.Protobuf.dll - - ..\packages\Grpc.Core.1.17.0\lib\net45\Grpc.Core.dll + + ..\packages\Grpc.Core.2.23.0\lib\net45\Grpc.Core.dll + + + ..\packages\Grpc.Core.Api.2.23.0\lib\net45\Grpc.Core.Api.dll - - ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll - True + + ..\packages\System.Buffers.4.4.0\lib\netstandard1.1\System.Buffers.dll + + ..\packages\System.Memory.4.5.3\lib\netstandard1.1\System.Memory.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll + @@ -59,11 +67,11 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config index 2fd8228689d..1f648dd06b8 100644 --- a/examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config +++ b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config @@ -1,7 +1,10 @@ - + - - - - + + + + + + + \ No newline at end of file From 12dc0da99db8da3d399d1acd77bb8f190b978c7d Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 5 Sep 2019 10:14:10 +0200 Subject: [PATCH 556/661] upgrade HelloworldXamarin example to 2.23.0 --- .../Droid/HelloworldXamarin.Droid.csproj | 38 ++++++++++++---- .../Droid/Properties/AndroidManifest.xml | 7 ++- .../HelloworldXamarin/Droid/packages.config | 8 +++- .../HelloworldXamarin/HelloworldXamarin.sln | 36 ++++++++++----- .../iOS/HelloworldXamarin.iOS.csproj | 45 ++++++++++++++----- .../HelloworldXamarin/iOS/packages.config | 8 +++- 6 files changed, 103 insertions(+), 39 deletions(-) diff --git a/examples/csharp/HelloworldXamarin/Droid/HelloworldXamarin.Droid.csproj b/examples/csharp/HelloworldXamarin/Droid/HelloworldXamarin.Droid.csproj index 991fa0c9bcc..a25dfdf92d0 100644 --- a/examples/csharp/HelloworldXamarin/Droid/HelloworldXamarin.Droid.csproj +++ b/examples/csharp/HelloworldXamarin/Droid/HelloworldXamarin.Droid.csproj @@ -1,4 +1,4 @@ - + Debug @@ -15,7 +15,8 @@ Properties\AndroidManifest.xml Resources Assets - true + + true @@ -38,7 +39,25 @@ false + + ..\packages\Google.Protobuf.3.8.0\lib\netstandard2.0\Google.Protobuf.dll + + + ..\packages\Grpc.Core.2.23.0\lib\netstandard2.0\Grpc.Core.dll + + + ..\packages\Grpc.Core.Api.2.23.0\lib\netstandard2.0\Grpc.Core.Api.dll + + + ..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll + + + ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll + @@ -50,12 +69,6 @@ ..\packages\System.Interactive.Async.3.1.1\lib\netstandard1.3\System.Interactive.Async.dll - - ..\packages\Google.Protobuf.3.6.0\lib\netstandard1.0\Google.Protobuf.dll - - - ..\packages\Grpc.Core.1.18.0\lib\netstandard1.5\Grpc.Core.dll - @@ -63,6 +76,7 @@ + @@ -79,5 +93,11 @@ - + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + \ No newline at end of file diff --git a/examples/csharp/HelloworldXamarin/Droid/Properties/AndroidManifest.xml b/examples/csharp/HelloworldXamarin/Droid/Properties/AndroidManifest.xml index 4f2167a1a03..9d767ff323d 100644 --- a/examples/csharp/HelloworldXamarin/Droid/Properties/AndroidManifest.xml +++ b/examples/csharp/HelloworldXamarin/Droid/Properties/AndroidManifest.xml @@ -1,6 +1,5 @@  - - - - + + + \ No newline at end of file diff --git a/examples/csharp/HelloworldXamarin/Droid/packages.config b/examples/csharp/HelloworldXamarin/Droid/packages.config index 29201117298..d56f8b7d22e 100644 --- a/examples/csharp/HelloworldXamarin/Droid/packages.config +++ b/examples/csharp/HelloworldXamarin/Droid/packages.config @@ -1,11 +1,13 @@  - - + + + + @@ -22,6 +24,7 @@ + @@ -31,6 +34,7 @@ + diff --git a/examples/csharp/HelloworldXamarin/HelloworldXamarin.sln b/examples/csharp/HelloworldXamarin/HelloworldXamarin.sln index e2a738f157e..ee3ea5c95d6 100644 --- a/examples/csharp/HelloworldXamarin/HelloworldXamarin.sln +++ b/examples/csharp/HelloworldXamarin/HelloworldXamarin.sln @@ -1,6 +1,7 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.329 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "HelloworldXamarin", "HelloworldXamarin\HelloworldXamarin.shproj", "{42FFF3D8-934F-4475-8E68-08DA340BF6E8}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloworldXamarin.Droid", "Droid\HelloworldXamarin.Droid.csproj", "{B9B0D41C-1C07-4590-A919-5865E741B2EA}" @@ -8,38 +9,49 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloworldXamarin.iOS", "iOS\HelloworldXamarin.iOS.csproj", "{62336DF0-60D8-478F-8140-B3CB089B417E}" EndProject Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + HelloworldXamarin\HelloworldXamarin.projitems*{42fff3d8-934f-4475-8e68-08da340bf6e8}*SharedItemsImports = 13 + HelloworldXamarin\HelloworldXamarin.projitems*{62336df0-60d8-478f-8140-b3cb089b417e}*SharedItemsImports = 4 + HelloworldXamarin\HelloworldXamarin.projitems*{b9b0d41c-1c07-4590-a919-5865e741b2ea}*SharedItemsImports = 4 + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU + Debug|iPhone = Debug|iPhone Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|Any CPU = Release|Any CPU Release|iPhone = Release|iPhone Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|Any CPU.Build.0 = Release|Any CPU + {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|iPhone.Build.0 = Debug|Any CPU {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|Any CPU.Build.0 = Release|Any CPU {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|iPhone.ActiveCfg = Release|Any CPU {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|iPhone.Build.0 = Release|Any CPU {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|iPhone.Build.0 = Debug|Any CPU {62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {62336DF0-60D8-478F-8140-B3CB089B417E}.Release|Any CPU.ActiveCfg = Release|iPhone - {62336DF0-60D8-478F-8140-B3CB089B417E}.Release|Any CPU.Build.0 = Release|iPhone + {62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|iPhone.ActiveCfg = Debug|iPhone + {62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|iPhone.Build.0 = Debug|iPhone {62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator {62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {62336DF0-60D8-478F-8140-B3CB089B417E}.Release|Any CPU.ActiveCfg = Release|iPhone + {62336DF0-60D8-478F-8140-B3CB089B417E}.Release|Any CPU.Build.0 = Release|iPhone {62336DF0-60D8-478F-8140-B3CB089B417E}.Release|iPhone.ActiveCfg = Release|iPhone {62336DF0-60D8-478F-8140-B3CB089B417E}.Release|iPhone.Build.0 = Release|iPhone {62336DF0-60D8-478F-8140-B3CB089B417E}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {62336DF0-60D8-478F-8140-B3CB089B417E}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|iPhone.ActiveCfg = Debug|iPhone - {62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|iPhone.Build.0 = Debug|iPhone + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CDC6F6DC-E1C6-45A7-ACC2-A61CDCCA1436} EndGlobalSection EndGlobal diff --git a/examples/csharp/HelloworldXamarin/iOS/HelloworldXamarin.iOS.csproj b/examples/csharp/HelloworldXamarin/iOS/HelloworldXamarin.iOS.csproj index 9154bf33527..844e06c24c6 100644 --- a/examples/csharp/HelloworldXamarin/iOS/HelloworldXamarin.iOS.csproj +++ b/examples/csharp/HelloworldXamarin/iOS/HelloworldXamarin.iOS.csproj @@ -1,4 +1,4 @@ - + Debug @@ -9,6 +9,8 @@ HelloworldXamarin.iOS HelloworldXamarin.iOS Resources + + true @@ -77,7 +79,25 @@ x86 + + ..\packages\Google.Protobuf.3.8.0\lib\netstandard2.0\Google.Protobuf.dll + + + ..\packages\Grpc.Core.2.23.0\lib\netstandard2.0\Grpc.Core.dll + + + ..\packages\Grpc.Core.Api.2.23.0\lib\netstandard2.0\Grpc.Core.Api.dll + + + ..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll + + + ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll + @@ -89,16 +109,14 @@ ..\packages\System.Interactive.Async.3.1.1\lib\netstandard1.3\System.Interactive.Async.dll - - ..\packages\Google.Protobuf.3.6.0\lib\netstandard1.0\Google.Protobuf.dll - - - ..\packages\Grpc.Core.1.18.0\lib\netstandard1.5\Grpc.Core.dll - - - + + false + + + false + @@ -108,6 +126,7 @@ + @@ -122,5 +141,11 @@ - + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + \ No newline at end of file diff --git a/examples/csharp/HelloworldXamarin/iOS/packages.config b/examples/csharp/HelloworldXamarin/iOS/packages.config index 055222ba48f..80802a8d124 100644 --- a/examples/csharp/HelloworldXamarin/iOS/packages.config +++ b/examples/csharp/HelloworldXamarin/iOS/packages.config @@ -1,11 +1,13 @@  - - + + + + @@ -22,6 +24,7 @@ + @@ -31,6 +34,7 @@ + From b876b35457121878345de26a1542d24cbb2d56a4 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 5 Sep 2019 13:48:31 +0200 Subject: [PATCH 557/661] address review comments --- src/csharp/Grpc.Core.Api/SerializationContext.cs | 4 ++-- .../Internal/DefaultSerializationContextTest.cs | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/csharp/Grpc.Core.Api/SerializationContext.cs b/src/csharp/Grpc.Core.Api/SerializationContext.cs index 76f1951b68e..59e14c12e3b 100644 --- a/src/csharp/Grpc.Core.Api/SerializationContext.cs +++ b/src/csharp/Grpc.Core.Api/SerializationContext.cs @@ -28,7 +28,7 @@ namespace Grpc.Core { /// /// Use the byte array as serialized form of current message and mark serialization process as complete. - /// Complete() can only be called once. By calling this method the caller gives up the ownership of the + /// Complete(byte[]) can only be called once. By calling this method the caller gives up the ownership of the /// payload which must not be accessed afterwards. /// /// the serialized form of current message @@ -47,7 +47,7 @@ namespace Grpc.Core } /// - /// Complete the payload written to the buffer writer. Complete() can only be called once. + /// Complete the payload written to the buffer writer. Complete() can only be called once. /// public virtual void Complete() { diff --git a/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs b/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs index fcb12ae6656..061230d8ca4 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/DefaultSerializationContextTest.cs @@ -189,9 +189,6 @@ namespace Grpc.Core.Internal.Tests } } - // other ideas: - // AdjustTailSpace(0) if previous tail size is 0... (better for SliceBufferSafeHandle) - private DefaultSerializationContext.UsageScope NewDefaultSerializationContextScope() { return new DefaultSerializationContext.UsageScope(new DefaultSerializationContext()); From 91716467138c03fb97391c68cab3365ccf14a122 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 5 Sep 2019 08:05:36 -0400 Subject: [PATCH 558/661] fix dependencies for classic .csproj --- test/distrib/csharp/DistribTest/DistribTest.csproj | 10 ++++++++-- test/distrib/csharp/DistribTest/packages.config | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/test/distrib/csharp/DistribTest/DistribTest.csproj b/test/distrib/csharp/DistribTest/DistribTest.csproj index e3fc94b4f23..a7f48146a5d 100644 --- a/test/distrib/csharp/DistribTest/DistribTest.csproj +++ b/test/distrib/csharp/DistribTest/DistribTest.csproj @@ -68,8 +68,14 @@ - - ..\packages\System.Interactive.Async.3.0.0\lib\net45\System.Interactive.Async.dll + + ..\packages\System.Buffers.4.4.0\lib\netstandard1.1\System.Buffers.dll + + + ..\packages\System.Memory.4.5.3\lib\netstandard1.1\System.Memory.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll diff --git a/test/distrib/csharp/DistribTest/packages.config b/test/distrib/csharp/DistribTest/packages.config index 5e09d5dad01..b6c6730e34b 100644 --- a/test/distrib/csharp/DistribTest/packages.config +++ b/test/distrib/csharp/DistribTest/packages.config @@ -9,6 +9,8 @@ - + + + \ No newline at end of file From ece5fbdcb0aecc152da6cce81b33695c7adad453 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 5 Sep 2019 08:06:39 -0400 Subject: [PATCH 559/661] partially revert alpine distribtest attempts --- .../csharp/DistribTest/DistribTestDotNet.csproj | 12 +++++------- test/distrib/csharp/run_distrib_test_dotnetcli.sh | 11 +++-------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj b/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj index 8cdf926f07f..c855feb3fb3 100644 --- a/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj +++ b/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.1 + net45;netcoreapp2.1 false false false @@ -23,10 +23,8 @@ - - - /usr/lib/mono/4.5-api - /usr/local/lib/mono/4.5-api - /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api - + + + + \ No newline at end of file diff --git a/test/distrib/csharp/run_distrib_test_dotnetcli.sh b/test/distrib/csharp/run_distrib_test_dotnetcli.sh index 357ce136cb7..ca22bce9d85 100755 --- a/test/distrib/csharp/run_distrib_test_dotnetcli.sh +++ b/test/distrib/csharp/run_distrib_test_dotnetcli.sh @@ -29,20 +29,15 @@ dotnet restore DistribTestDotNet.csproj dotnet build DistribTestDotNet.csproj dotnet publish -f netcoreapp2.1 DistribTestDotNet.csproj -#dotnet publish -f net45 DistribTestDotNet.csproj +dotnet publish -f net45 DistribTestDotNet.csproj ls -R bin -#ldd /root/.nuget/packages/grpc.core/*/lib/netstandard1.5/../../runtimes/linux/native/libgrpc_csharp_ext.x64.so - -#ldd /root/.nuget/packages/grpc.tools/*/tools/linux_x64/grpc_csharp_plugin - -#exit 1 # .NET 4.5 target after dotnet build -#mono bin/Debug/net45/publish/DistribTestDotNet.exe +mono bin/Debug/net45/publish/DistribTestDotNet.exe # .NET 4.5 target after dotnet publish -#mono bin/Debug/net45/publish/DistribTestDotNet.exe +mono bin/Debug/net45/publish/DistribTestDotNet.exe # .NET Core target after dotnet build dotnet exec bin/Debug/netcoreapp2.1/DistribTestDotNet.dll From 54c02148664047d610cd60178a5dc2faaa654252 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 5 Sep 2019 08:08:46 -0400 Subject: [PATCH 560/661] protoc cannot be run on alpine linux --- .../distribtest/csharp_alpine_x64/Dockerfile | 24 ------------------- .../artifacts/distribtest_targets.py | 1 - 2 files changed, 25 deletions(-) delete mode 100644 tools/dockerfile/distribtest/csharp_alpine_x64/Dockerfile diff --git a/tools/dockerfile/distribtest/csharp_alpine_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_alpine_x64/Dockerfile deleted file mode 100644 index aa5034872c3..00000000000 --- a/tools/dockerfile/distribtest/csharp_alpine_x64/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM microsoft/dotnet:2.1-sdk-alpine - -RUN apk update && apk add bash -RUN apk update && apk add unzip - -# needed to satisfy the "ld-linux-x86-64.so.2" dependency -RUN apk add libc6-compat - -#RUN apk add libnsl -#RUN cp /usr/lib/libnsl.so.2 /usr/lib/libnsl.so.1 diff --git a/tools/run_tests/artifacts/distribtest_targets.py b/tools/run_tests/artifacts/distribtest_targets.py index 5baf9d6c298..0674fc4c689 100644 --- a/tools/run_tests/artifacts/distribtest_targets.py +++ b/tools/run_tests/artifacts/distribtest_targets.py @@ -310,7 +310,6 @@ def targets(): CSharpDistribTest('linux', 'x64', 'centos7'), CSharpDistribTest('linux', 'x64', 'ubuntu1604'), CSharpDistribTest('linux', 'x64', 'ubuntu1604', use_dotnet_cli=True), - CSharpDistribTest('linux', 'x64', 'alpine', use_dotnet_cli=True), CSharpDistribTest('macos', 'x86'), CSharpDistribTest('windows', 'x86'), CSharpDistribTest('windows', 'x64'), From d3f50ace3953651c1f67a3c9da84821abae747fe Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 5 Sep 2019 08:13:59 -0700 Subject: [PATCH 561/661] Use mutex instead of combiner in client channel data plane. --- .../filters/client_channel/client_channel.cc | 450 +++++++++--------- src/core/lib/gprpp/ref_counted_ptr.h | 2 + test/core/gprpp/ref_counted_ptr_test.cc | 14 + 3 files changed, 229 insertions(+), 237 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 8a0fabfa6fd..40ac1f22059 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -130,7 +130,7 @@ class ChannelData { return disconnect_error_.Load(MemoryOrder::ACQUIRE); } - grpc_combiner* data_plane_combiner() const { return data_plane_combiner_; } + Mutex* data_plane_mu() const { return &data_plane_mu_; } LoadBalancingPolicy::SubchannelPicker* picker() const { return picker_.get(); @@ -166,8 +166,6 @@ class ChannelData { private: class SubchannelWrapper; - class ConnectivityStateAndPickerSetter; - class ServiceConfigSetter; class ClientChannelControlHelper; class ExternalConnectivityWatcher { @@ -214,6 +212,14 @@ class ChannelData { ChannelData(grpc_channel_element_args* args, grpc_error** error); ~ChannelData(); + void UpdateStateAndPickerLocked( + grpc_connectivity_state state, const char* reason, + UniquePtr picker); + + void UpdateServiceConfigLocked( + RefCountedPtr retry_throttle_data, + RefCountedPtr service_config); + void CreateResolvingLoadBalancingPolicyLocked(); void DestroyResolvingLoadBalancingPolicyLocked(); @@ -250,9 +256,9 @@ class ChannelData { channelz::ChannelNode* channelz_node_; // - // Fields used in the data plane. Guarded by data_plane_combiner. + // Fields used in the data plane. Guarded by data_plane_mu. // - grpc_combiner* data_plane_combiner_; + mutable Mutex data_plane_mu_; UniquePtr picker_; QueuedPick* queued_picks_ = nullptr; // Linked list of queued picks. // Data from service config. @@ -282,13 +288,13 @@ class ChannelData { Map subchannel_wrappers_; // Pending ConnectedSubchannel updates for each SubchannelWrapper. // Updates are queued here in the control plane combiner and then applied - // in the data plane combiner when the picker is updated. + // in the data plane mutex when the picker is updated. Map, RefCountedPtr, RefCountedPtrLess> pending_subchannel_updates_; // - // Fields accessed from both data plane and control plane combiners. + // Fields accessed from both data plane mutex and control plane combiner. // Atomic disconnect_error_; @@ -322,7 +328,16 @@ class CallData { void MaybeApplyServiceConfigToCallLocked(grpc_call_element* elem); // Invoked by channel for queued picks when the picker is updated. - static void StartPickLocked(void* arg, grpc_error* error); + static void PickSubchannel(void* arg, grpc_error* error); + + // Helper function for performing a pick while holding the data plane + // mutex. Returns true if the pick is complete, in which case the caller + // must invoke PickDone() or AsyncPickDone() with the returned error. + bool PickSubchannelLocked(grpc_call_element* elem, grpc_error** error); + + // Schedules a callback to process the completed pick. The callback + // will not run until after this method returns. + void AsyncPickDone(grpc_call_element* elem, grpc_error* error); private: class QueuedPickCanceller; @@ -931,7 +946,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { return connected_subchannel_.get(); } - // Caller must be holding the data-plane combiner. + // Caller must be holding the data-plane mutex. ConnectedSubchannel* connected_subchannel_in_data_plane() const { return connected_subchannel_in_data_plane_.get(); } @@ -1059,7 +1074,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { // Update the connected subchannel only if the channel is not shutting // down. This is because once the channel is shutting down, we // ignore picker updates from the LB policy, which means that - // ConnectivityStateAndPickerSetter will never process the entries + // UpdateStateAndPickerLocked() will never process the entries // in chand_->pending_subchannel_updates_. So we don't want to add // entries there that will never be processed, since that would // leave dangling refs to the channel and prevent its destruction. @@ -1069,7 +1084,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { if (connected_subchannel_ != connected_subchannel) { connected_subchannel_ = std::move(connected_subchannel); // Record the new connected subchannel so that it can be updated - // in the data plane combiner the next time the picker is updated. + // in the data plane mutex the next time the picker is updated. chand_->pending_subchannel_updates_[Ref( DEBUG_LOCATION, "ConnectedSubchannelUpdate")] = connected_subchannel_; } @@ -1086,159 +1101,10 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { Map watcher_map_; // To be accessed only in the control plane combiner. RefCountedPtr connected_subchannel_; - // To be accessed only in the data plane combiner. + // To be accessed only in the data plane mutex. RefCountedPtr connected_subchannel_in_data_plane_; }; -// -// ChannelData::ConnectivityStateAndPickerSetter -// - -// A fire-and-forget class that sets the channel's connectivity state -// and then hops into the data plane combiner to update the picker. -// Must be instantiated while holding the control plane combiner. -// Deletes itself when done. -class ChannelData::ConnectivityStateAndPickerSetter { - public: - ConnectivityStateAndPickerSetter( - ChannelData* chand, grpc_connectivity_state state, const char* reason, - UniquePtr picker) - : chand_(chand), picker_(std::move(picker)) { - // Clean the control plane when entering IDLE, while holding control plane - // combiner. - if (picker_ == nullptr) { - chand->health_check_service_name_.reset(); - chand->saved_service_config_.reset(); - chand->received_first_resolver_result_ = false; - } - // Update connectivity state here, while holding control plane combiner. - grpc_connectivity_state_set(&chand->state_tracker_, state, reason); - if (chand->channelz_node_ != nullptr) { - chand->channelz_node_->SetConnectivityState(state); - chand->channelz_node_->AddTraceEvent( - channelz::ChannelTrace::Severity::Info, - grpc_slice_from_static_string( - channelz::ChannelNode::GetChannelConnectivityStateChangeString( - state))); - } - // Grab any pending subchannel updates. - pending_subchannel_updates_ = - std::move(chand_->pending_subchannel_updates_); - // Bounce into the data plane combiner to reset the picker. - GRPC_CHANNEL_STACK_REF(chand->owning_stack_, - "ConnectivityStateAndPickerSetter"); - GRPC_CLOSURE_INIT(&closure_, SetPickerInDataPlane, this, - grpc_combiner_scheduler(chand->data_plane_combiner_)); - GRPC_CLOSURE_SCHED(&closure_, GRPC_ERROR_NONE); - } - - private: - static void SetPickerInDataPlane(void* arg, grpc_error* ignored) { - auto* self = static_cast(arg); - // Handle subchannel updates. - for (auto& p : self->pending_subchannel_updates_) { - if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) { - gpr_log(GPR_INFO, - "chand=%p: updating subchannel wrapper %p data plane " - "connected_subchannel to %p", - self->chand_, p.first.get(), p.second.get()); - } - p.first->set_connected_subchannel_in_data_plane(std::move(p.second)); - } - // Swap out the picker. We hang on to the old picker so that it can - // be deleted in the control-plane combiner, since that's where we need - // to unref the subchannel wrappers that are reffed by the picker. - self->picker_.swap(self->chand_->picker_); - // Clean the data plane if the updated picker is nullptr. - if (self->chand_->picker_ == nullptr) { - self->chand_->received_service_config_data_ = false; - self->chand_->retry_throttle_data_.reset(); - self->chand_->service_config_.reset(); - } - // Re-process queued picks. - for (QueuedPick* pick = self->chand_->queued_picks_; pick != nullptr; - pick = pick->next) { - CallData::StartPickLocked(pick->elem, GRPC_ERROR_NONE); - } - // Pop back into the control plane combiner to delete ourself, so - // that we make sure to unref subchannel wrappers there. This - // includes both the ones reffed by the old picker (now stored in - // self->picker_) and the ones in self->pending_subchannel_updates_. - GRPC_CLOSURE_INIT(&self->closure_, CleanUpInControlPlane, self, - grpc_combiner_scheduler(self->chand_->combiner_)); - GRPC_CLOSURE_SCHED(&self->closure_, GRPC_ERROR_NONE); - } - - static void CleanUpInControlPlane(void* arg, grpc_error* ignored) { - auto* self = static_cast(arg); - GRPC_CHANNEL_STACK_UNREF(self->chand_->owning_stack_, - "ConnectivityStateAndPickerSetter"); - Delete(self); - } - - ChannelData* chand_; - UniquePtr picker_; - Map, RefCountedPtr, - RefCountedPtrLess> - pending_subchannel_updates_; - grpc_closure closure_; -}; - -// -// ChannelData::ServiceConfigSetter -// - -// A fire-and-forget class that sets the channel's service config data -// in the data plane combiner. Deletes itself when done. -class ChannelData::ServiceConfigSetter { - public: - ServiceConfigSetter( - ChannelData* chand, - Optional - retry_throttle_data, - RefCountedPtr service_config) - : chand_(chand), - retry_throttle_data_(retry_throttle_data), - service_config_(std::move(service_config)) { - GRPC_CHANNEL_STACK_REF(chand->owning_stack_, "ServiceConfigSetter"); - GRPC_CLOSURE_INIT(&closure_, SetServiceConfigData, this, - grpc_combiner_scheduler(chand->data_plane_combiner_)); - GRPC_CLOSURE_SCHED(&closure_, GRPC_ERROR_NONE); - } - - private: - static void SetServiceConfigData(void* arg, grpc_error* ignored) { - ServiceConfigSetter* self = static_cast(arg); - ChannelData* chand = self->chand_; - // Update channel state. - chand->received_service_config_data_ = true; - if (self->retry_throttle_data_.has_value()) { - chand->retry_throttle_data_ = - internal::ServerRetryThrottleMap::GetDataForServer( - chand->server_name_.get(), - self->retry_throttle_data_.value().max_milli_tokens, - self->retry_throttle_data_.value().milli_token_ratio); - } - chand->service_config_ = std::move(self->service_config_); - // Apply service config to queued picks. - for (QueuedPick* pick = chand->queued_picks_; pick != nullptr; - pick = pick->next) { - CallData* calld = static_cast(pick->elem->call_data); - calld->MaybeApplyServiceConfigToCallLocked(pick->elem); - } - // Clean up. - GRPC_CHANNEL_STACK_UNREF(self->chand_->owning_stack_, - "ServiceConfigSetter"); - Delete(self); - } - - ChannelData* chand_; - Optional - retry_throttle_data_; - RefCountedPtr service_config_; - grpc_closure closure_; -}; - // // ChannelData::ExternalConnectivityWatcher::WatcherList // @@ -1409,9 +1275,7 @@ class ChannelData::ClientChannelControlHelper } // Do update only if not shutting down. if (disconnect_error == GRPC_ERROR_NONE) { - // Will delete itself. - New(chand_, state, "helper", - std::move(picker)); + chand_->UpdateStateAndPickerLocked(state, "helper", std::move(picker)); } } @@ -1495,7 +1359,6 @@ ChannelData::ChannelData(grpc_channel_element_args* args, grpc_error** error) client_channel_factory_( ClientChannelFactory::GetFromChannelArgs(args->channel_args)), channelz_node_(GetChannelzNode(args->channel_args)), - data_plane_combiner_(grpc_combiner_create()), combiner_(grpc_combiner_create()), interested_parties_(grpc_pollset_set_create()), subchannel_pool_(GetSubchannelPool(args->channel_args)), @@ -1568,13 +1431,108 @@ ChannelData::~ChannelData() { // Stop backup polling. grpc_client_channel_stop_backup_polling(interested_parties_); grpc_pollset_set_destroy(interested_parties_); - GRPC_COMBINER_UNREF(data_plane_combiner_, "client_channel"); GRPC_COMBINER_UNREF(combiner_, "client_channel"); GRPC_ERROR_UNREF(disconnect_error_.Load(MemoryOrder::RELAXED)); grpc_connectivity_state_destroy(&state_tracker_); gpr_mu_destroy(&info_mu_); } +void ChannelData::UpdateStateAndPickerLocked( + grpc_connectivity_state state, const char* reason, + UniquePtr picker) { + // Clean the control plane when entering IDLE. + if (picker_ == nullptr) { + health_check_service_name_.reset(); + saved_service_config_.reset(); + received_first_resolver_result_ = false; + } + // Update connectivity state. + grpc_connectivity_state_set(&state_tracker_, state, reason); + if (channelz_node_ != nullptr) { + channelz_node_->SetConnectivityState(state); + channelz_node_->AddTraceEvent( + channelz::ChannelTrace::Severity::Info, + grpc_slice_from_static_string( + channelz::ChannelNode::GetChannelConnectivityStateChangeString( + state))); + } + // Grab data plane lock to do subchannel updates and update the picker. + // + // Note that we want to minimize the work done while holding the data + // plane lock, to keep the critical section small. So, for all of the + // objects that we might wind up unreffing here, we actually hold onto + // the refs until after we release the lock, and then unref them at + // that point. This includes the following: + // - refs to subchannel wrappers in the keys of pending_subchannel_updates_ + // - ref stored in retry_throttle_data_ + // - ref stored in service_config_ + // - ownership of the existing picker in picker_ + RefCountedPtr retry_throttle_data_to_unref; + RefCountedPtr service_config_to_unref; + { + MutexLock lock(&data_plane_mu_); + // Handle subchannel updates. + for (auto& p : pending_subchannel_updates_) { + if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) { + gpr_log(GPR_INFO, + "chand=%p: updating subchannel wrapper %p data plane " + "connected_subchannel to %p", + this, p.first.get(), p.second.get()); + } + // Note: We do not remove the entry from pending_subchannel_updates_ + // here, since this would unref the subchannel wrapper; instead, + // we wait until we've released the lock to clear the map. + p.first->set_connected_subchannel_in_data_plane(std::move(p.second)); + } + // Swap out the picker. + // Note: Original value will be destroyed after the lock is released. + picker_.swap(picker); + // Clean the data plane if the updated picker is nullptr. + if (picker_ == nullptr) { + received_service_config_data_ = false; + // Note: We save the objects to unref until after the lock is released. + retry_throttle_data_to_unref = std::move(retry_throttle_data_); + service_config_to_unref = std::move(service_config_); + } + // Re-process queued picks. + for (QueuedPick* pick = queued_picks_; pick != nullptr; pick = pick->next) { + grpc_call_element* elem = pick->elem; + CallData* calld = static_cast(elem->call_data); + grpc_error* error = GRPC_ERROR_NONE; + if (calld->PickSubchannelLocked(elem, &error)) { + calld->AsyncPickDone(elem, error); + } + } + } + // Clear the pending update map after releasing the lock, to keep the + // critical section small. + pending_subchannel_updates_.clear(); +} + +void ChannelData::UpdateServiceConfigLocked( + RefCountedPtr retry_throttle_data, + RefCountedPtr service_config) { + // Grab data plane lock to update service config. + // + // We defer unreffing the old values (and deallocating memory) until + // after releasing the lock to keep the critical section small. + { + MutexLock lock(&data_plane_mu_); + // Update service config. + received_service_config_data_ = true; + // Old values will be unreffed after lock is released. + retry_throttle_data_.swap(retry_throttle_data); + service_config_.swap(service_config); + // Apply service config to queued picks. + for (QueuedPick* pick = queued_picks_; pick != nullptr; pick = pick->next) { + CallData* calld = static_cast(pick->elem->call_data); + calld->MaybeApplyServiceConfigToCallLocked(pick->elem); + } + } + // Old values will be unreffed after lock is released when they go out + // of scope. +} + void ChannelData::CreateResolvingLoadBalancingPolicyLocked() { // Instantiate resolving LB policy. LoadBalancingPolicy::Args lb_args; @@ -1746,15 +1704,20 @@ bool ChannelData::ProcessResolverResultLocked( // if we feel it is unnecessary. if (service_config_changed || !chand->received_first_resolver_result_) { chand->received_first_resolver_result_ = true; - Optional - retry_throttle_data; + RefCountedPtr retry_throttle_data; if (parsed_service_config != nullptr) { - retry_throttle_data = parsed_service_config->retry_throttling(); + Optional + retry_throttle_config = parsed_service_config->retry_throttling(); + if (retry_throttle_config.has_value()) { + retry_throttle_data = + internal::ServerRetryThrottleMap::GetDataForServer( + chand->server_name_.get(), + retry_throttle_config.value().max_milli_tokens, + retry_throttle_config.value().milli_token_ratio); + } } - // Create service config setter to update channel state in the data - // plane combiner. Destroys itself when done. - New(chand, retry_throttle_data, - chand->saved_service_config_); + chand->UpdateServiceConfigLocked(std::move(retry_throttle_data), + chand->saved_service_config_); } UniquePtr processed_lb_policy_name; chand->ProcessLbPolicy(result, parsed_service_config, @@ -1838,8 +1801,8 @@ void ChannelData::StartTransportOpLocked(void* arg, grpc_error* ignored) { static_cast(value) == GRPC_CHANNEL_IDLE) { if (chand->disconnect_error() == GRPC_ERROR_NONE) { // Enter IDLE state. - New(chand, GRPC_CHANNEL_IDLE, - "channel entering IDLE", nullptr); + chand->UpdateStateAndPickerLocked(GRPC_CHANNEL_IDLE, + "channel entering IDLE", nullptr); } GRPC_ERROR_UNREF(op->disconnect_with_error); } else { @@ -1848,8 +1811,8 @@ void ChannelData::StartTransportOpLocked(void* arg, grpc_error* ignored) { GRPC_ERROR_NONE); chand->disconnect_error_.Store(op->disconnect_with_error, MemoryOrder::RELEASE); - New( - chand, GRPC_CHANNEL_SHUTDOWN, "shutdown from API", + chand->UpdateStateAndPickerLocked( + GRPC_CHANNEL_SHUTDOWN, "shutdown from API", UniquePtr( New( GRPC_ERROR_REF(op->disconnect_with_error)))); @@ -2092,8 +2055,8 @@ void CallData::StartTransportStreamOpBatch( // Add the batch to the pending list. calld->PendingBatchesAdd(elem, batch); // Check if we've already gotten a subchannel call. - // Note that once we have completed the pick, we do not need to enter - // the channel combiner, which is more efficient (especially for + // Note that once we have picked a subchannel, we do not need to acquire + // the channel's data plane mutex, which is more efficient (especially for // streaming calls). if (calld->subchannel_call_ != nullptr) { if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) { @@ -2105,18 +2068,15 @@ void CallData::StartTransportStreamOpBatch( return; } // We do not yet have a subchannel call. - // For batches containing a send_initial_metadata op, enter the channel - // combiner to start a pick. + // For batches containing a send_initial_metadata op, acquire the + // channel's data plane mutex to pick a subchannel. if (GPR_LIKELY(batch->send_initial_metadata)) { if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) { - gpr_log(GPR_INFO, "chand=%p calld=%p: entering client_channel combiner", + gpr_log(GPR_INFO, + "chand=%p calld=%p: grabbing data plane mutex to perform pick", chand, calld); } - GRPC_CLOSURE_SCHED( - GRPC_CLOSURE_INIT( - &batch->handler_private.closure, StartPickLocked, elem, - grpc_combiner_scheduler(chand->data_plane_combiner())), - GRPC_ERROR_NONE); + PickSubchannel(elem, GRPC_ERROR_NONE); } else { // For all other batches, release the call combiner. if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) { @@ -2544,8 +2504,8 @@ void CallData::DoRetry(grpc_call_element* elem, this, next_attempt_time - ExecCtx::Get()->Now()); } // Schedule retry after computed delay. - GRPC_CLOSURE_INIT(&pick_closure_, StartPickLocked, elem, - grpc_combiner_scheduler(chand->data_plane_combiner())); + GRPC_CLOSURE_INIT(&pick_closure_, PickSubchannel, elem, + grpc_schedule_on_exec_ctx); grpc_timer_init(&retry_timer_, next_attempt_time, &pick_closure_); // Update bookkeeping. if (retry_state != nullptr) retry_state->retry_dispatched = true; @@ -3660,6 +3620,11 @@ void CallData::CreateSubchannelCall(grpc_call_element* elem) { } } +void CallData::AsyncPickDone(grpc_call_element* elem, grpc_error* error) { + GRPC_CLOSURE_INIT(&pick_closure_, PickDone, elem, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_SCHED(&pick_closure_, error); +} + void CallData::PickDone(void* arg, grpc_error* error) { grpc_call_element* elem = static_cast(arg); ChannelData* chand = static_cast(elem->channel_data); @@ -3682,10 +3647,9 @@ class CallData::QueuedPickCanceller { public: explicit QueuedPickCanceller(grpc_call_element* elem) : elem_(elem) { auto* calld = static_cast(elem->call_data); - auto* chand = static_cast(elem->channel_data); GRPC_CALL_STACK_REF(calld->owning_call_, "QueuedPickCanceller"); GRPC_CLOSURE_INIT(&closure_, &CancelLocked, this, - grpc_combiner_scheduler(chand->data_plane_combiner())); + grpc_schedule_on_exec_ctx); calld->call_combiner_->SetNotifyOnCancel(&closure_); } @@ -3694,6 +3658,7 @@ class CallData::QueuedPickCanceller { auto* self = static_cast(arg); auto* chand = static_cast(self->elem_->channel_data); auto* calld = static_cast(self->elem_->call_data); + MutexLock lock(chand->data_plane_mu()); if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) { gpr_log(GPR_INFO, "chand=%p calld=%p: cancelling queued pick: " @@ -3818,23 +3783,38 @@ const char* PickResultTypeName( GPR_UNREACHABLE_CODE(return "UNKNOWN"); } -void CallData::StartPickLocked(void* arg, grpc_error* error) { +void CallData::PickSubchannel(void* arg, grpc_error* error) { grpc_call_element* elem = static_cast(arg); CallData* calld = static_cast(elem->call_data); ChannelData* chand = static_cast(elem->channel_data); - GPR_ASSERT(calld->connected_subchannel_ == nullptr); - GPR_ASSERT(calld->subchannel_call_ == nullptr); - // picker's being null means the channel is currently in IDLE state. The - // incoming call will make the channel exit IDLE and queue itself. + bool pick_complete; + { + MutexLock lock(chand->data_plane_mu()); + pick_complete = calld->PickSubchannelLocked(elem, &error); + } + if (pick_complete) { + PickDone(elem, error); + GRPC_ERROR_UNREF(error); + } +} + +bool CallData::PickSubchannelLocked(grpc_call_element* elem, + grpc_error** error) { + ChannelData* chand = static_cast(elem->channel_data); + GPR_ASSERT(connected_subchannel_ == nullptr); + GPR_ASSERT(subchannel_call_ == nullptr); + // The picker being null means that the channel is currently in IDLE state. + // The incoming call will make the channel exit IDLE. if (chand->picker() == nullptr) { - // We are currently in the data plane. - // Bounce into the control plane to exit IDLE. - chand->CheckConnectivityState(true); - calld->AddCallToQueuedPicksLocked(elem); - return; + // Bounce into the control plane combiner to exit IDLE. + chand->CheckConnectivityState(/*try_to_connect=*/true); + // Queue the pick, so that it will be attempted once the channel + // becomes connected. + AddCallToQueuedPicksLocked(elem); + return false; } // Apply service config to call if needed. - calld->MaybeApplyServiceConfigToCallLocked(elem); + MaybeApplyServiceConfigToCallLocked(elem); // If this is a retry, use the send_initial_metadata payload that // we've cached; otherwise, use the pending batch. The // send_initial_metadata batch will be the first pending batch in the @@ -3846,31 +3826,27 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) { // subchannel's copy of the metadata batch (which is copied for each // attempt) to the LB policy instead the one from the parent channel. LoadBalancingPolicy::PickArgs pick_args; - pick_args.call_state = &calld->lb_call_state_; + pick_args.call_state = &lb_call_state_; Metadata initial_metadata( - calld, - calld->seen_send_initial_metadata_ - ? &calld->send_initial_metadata_ - : calld->pending_batches_[0] + this, + seen_send_initial_metadata_ + ? &send_initial_metadata_ + : pending_batches_[0] .batch->payload->send_initial_metadata.send_initial_metadata); pick_args.initial_metadata = &initial_metadata; // Grab initial metadata flags so that we can check later if the call has // wait_for_ready enabled. const uint32_t send_initial_metadata_flags = - calld->seen_send_initial_metadata_ - ? calld->send_initial_metadata_flags_ - : calld->pending_batches_[0] - .batch->payload->send_initial_metadata - .send_initial_metadata_flags; - // When done, we schedule this closure to leave the data plane combiner. - GRPC_CLOSURE_INIT(&calld->pick_closure_, PickDone, elem, - grpc_schedule_on_exec_ctx); + seen_send_initial_metadata_ ? send_initial_metadata_flags_ + : pending_batches_[0] + .batch->payload->send_initial_metadata + .send_initial_metadata_flags; // Attempt pick. auto result = chand->picker()->Pick(pick_args); if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) { gpr_log(GPR_INFO, "chand=%p calld=%p: LB pick returned %s (subchannel=%p, error=%s)", - chand, calld, PickResultTypeName(result.type), + chand, this, PickResultTypeName(result.type), result.subchannel.get(), grpc_error_string(result.error)); } switch (result.type) { @@ -3879,10 +3855,9 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) { grpc_error* disconnect_error = chand->disconnect_error(); if (disconnect_error != GRPC_ERROR_NONE) { GRPC_ERROR_UNREF(result.error); - GRPC_CLOSURE_SCHED(&calld->pick_closure_, - GRPC_ERROR_REF(disconnect_error)); - if (calld->pick_queued_) calld->RemoveCallFromQueuedPicksLocked(elem); - break; + if (pick_queued_) RemoveCallFromQueuedPicksLocked(elem); + *error = GRPC_ERROR_REF(disconnect_error); + return true; } // If wait_for_ready is false, then the error indicates the RPC // attempt's final status. @@ -3890,19 +3865,20 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) { GRPC_INITIAL_METADATA_WAIT_FOR_READY) == 0) { // Retry if appropriate; otherwise, fail. grpc_status_code status = GRPC_STATUS_OK; - grpc_error_get_status(result.error, calld->deadline_, &status, nullptr, + grpc_error_get_status(result.error, deadline_, &status, nullptr, nullptr, nullptr); - if (!calld->enable_retries_ || - !calld->MaybeRetry(elem, nullptr /* batch_data */, status, - nullptr /* server_pushback_md */)) { + const bool retried = enable_retries_ && + MaybeRetry(elem, nullptr /* batch_data */, status, + nullptr /* server_pushback_md */); + if (!retried) { grpc_error* new_error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Failed to pick subchannel", &result.error, 1); GRPC_ERROR_UNREF(result.error); - GRPC_CLOSURE_SCHED(&calld->pick_closure_, new_error); + *error = new_error; } - if (calld->pick_queued_) calld->RemoveCallFromQueuedPicksLocked(elem); - break; + if (pick_queued_) RemoveCallFromQueuedPicksLocked(elem); + return !retried; } // If wait_for_ready is true, then queue to retry when we get a new // picker. @@ -3910,26 +3886,26 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) { } // Fallthrough case LoadBalancingPolicy::PickResult::PICK_QUEUE: - if (!calld->pick_queued_) calld->AddCallToQueuedPicksLocked(elem); - break; + if (!pick_queued_) AddCallToQueuedPicksLocked(elem); + return false; default: // PICK_COMPLETE + if (pick_queued_) RemoveCallFromQueuedPicksLocked(elem); // Handle drops. if (GPR_UNLIKELY(result.subchannel == nullptr)) { result.error = GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Call dropped by load balancing policy"); } else { // Grab a ref to the connected subchannel while we're still - // holding the data plane combiner. - calld->connected_subchannel_ = + // holding the data plane mutex. + connected_subchannel_ = chand->GetConnectedSubchannelInDataPlane(result.subchannel.get()); - GPR_ASSERT(calld->connected_subchannel_ != nullptr); + GPR_ASSERT(connected_subchannel_ != nullptr); } - calld->lb_recv_trailing_metadata_ready_ = - result.recv_trailing_metadata_ready; - calld->lb_recv_trailing_metadata_ready_user_data_ = + lb_recv_trailing_metadata_ready_ = result.recv_trailing_metadata_ready; + lb_recv_trailing_metadata_ready_user_data_ = result.recv_trailing_metadata_ready_user_data; - GRPC_CLOSURE_SCHED(&calld->pick_closure_, result.error); - if (calld->pick_queued_) calld->RemoveCallFromQueuedPicksLocked(elem); + *error = result.error; + return true; } } diff --git a/src/core/lib/gprpp/ref_counted_ptr.h b/src/core/lib/gprpp/ref_counted_ptr.h index 19f38d7f013..2e3f4671581 100644 --- a/src/core/lib/gprpp/ref_counted_ptr.h +++ b/src/core/lib/gprpp/ref_counted_ptr.h @@ -103,6 +103,8 @@ class RefCountedPtr { if (value_ != nullptr) value_->Unref(); } + void swap(RefCountedPtr& other) { std::swap(value_, other.value_); } + // If value is non-null, we take ownership of a ref to it. void reset(T* value = nullptr) { if (value_ != nullptr) value_->Unref(); diff --git a/test/core/gprpp/ref_counted_ptr_test.cc b/test/core/gprpp/ref_counted_ptr_test.cc index 96dbdf884b0..38bd4b61364 100644 --- a/test/core/gprpp/ref_counted_ptr_test.cc +++ b/test/core/gprpp/ref_counted_ptr_test.cc @@ -151,6 +151,20 @@ TEST(RefCountedPtr, EqualityOperators) { EXPECT_NE(foo, nullptr); } +TEST(RefCountedPtr, Swap) { + Foo* foo = New(); + Foo* bar = New(); + RefCountedPtr ptr1(foo); + RefCountedPtr ptr2(bar); + ptr1.swap(ptr2); + EXPECT_EQ(foo, ptr2.get()); + EXPECT_EQ(bar, ptr1.get()); + RefCountedPtr ptr3; + ptr3.swap(ptr2); + EXPECT_EQ(nullptr, ptr2.get()); + EXPECT_EQ(foo, ptr3.get()); +} + TEST(MakeRefCounted, NoArgs) { RefCountedPtr foo = MakeRefCounted(); EXPECT_EQ(0, foo->value()); From fd9bdd9922fffe88ae9f2752f790922d0ed8f369 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 5 Sep 2019 08:17:16 -0700 Subject: [PATCH 562/661] Avoid duplicate initialization of SSL (from within grpc and from test) --- test/core/handshake/server_ssl_common.cc | 56 +++++++++++++++++++----- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/test/core/handshake/server_ssl_common.cc b/test/core/handshake/server_ssl_common.cc index 41b2829d8b7..1493094e3c3 100644 --- a/test/core/handshake/server_ssl_common.cc +++ b/test/core/handshake/server_ssl_common.cc @@ -32,6 +32,7 @@ #include #include +#include "src/core/lib/gprpp/sync.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/load_file.h" #include "test/core/util/port.h" @@ -41,10 +42,12 @@ #define SSL_KEY_PATH "src/core/tsi/test_creds/server1.key" #define SSL_CA_PATH "src/core/tsi/test_creds/ca.pem" +namespace { + // Handshake completed signal to server thread. -static gpr_event client_handshake_complete; +gpr_event client_handshake_complete; -static int create_socket(int port) { +int create_socket(int port) { int s; struct sockaddr_in addr; @@ -66,9 +69,34 @@ static int create_socket(int port) { return s; } +class ServerInfo { + public: + explicit ServerInfo(int p) : port_(p) {} + + int port() const { return port_; } + + void Activate() { + grpc_core::MutexLock lock(&mu_); + ready_ = true; + cv_.Signal(); + } + + void Await() { + grpc_core::MutexLock lock(&mu_); + cv_.WaitUntil(&mu_, [this] { return ready_; }); + } + + private: + const int port_; + grpc_core::Mutex mu_; + grpc_core::CondVar cv_; + bool ready_ = false; +}; + // Simple gRPC server. This listens until client_handshake_complete occurs. -static void server_thread(void* arg) { - const int port = *static_cast(arg); +void server_thread(void* arg) { + ServerInfo* s = static_cast(arg); + const int port = s->port(); // Load key pair and establish server SSL credentials. grpc_ssl_pem_key_cert_pair pem_key_cert_pair; @@ -100,6 +128,10 @@ static void server_thread(void* arg) { grpc_server_register_completion_queue(server, cq, nullptr); grpc_server_start(server); + // Notify the other side that it is now ok to start working since SSL is + // definitely already started. + s->Activate(); + // Wait a bounded number of time until client_handshake_complete is set, // sleeping between polls. int retries = 10; @@ -125,6 +157,8 @@ static void server_thread(void* arg) { grpc_slice_unref(ca_slice); } +} // namespace + // This test launches a gRPC server on a separate thread and then establishes a // TLS handshake via a minimal TLS client. The TLS client has configurable (via // alpn_list) ALPN settings and can probe at the supported ALPN preferences @@ -134,17 +168,19 @@ bool server_ssl_test(const char* alpn_list[], unsigned int alpn_list_len, bool success = true; grpc_init(); - int port = grpc_pick_unused_port_or_die(); + ServerInfo s(grpc_pick_unused_port_or_die()); gpr_event_init(&client_handshake_complete); // Launch the gRPC server thread. bool ok; - grpc_core::Thread thd("grpc_ssl_test", server_thread, &port, &ok); + grpc_core::Thread thd("grpc_ssl_test", server_thread, &s, &ok); GPR_ASSERT(ok); thd.Start(); - SSL_load_error_strings(); - OpenSSL_add_ssl_algorithms(); + // The work in server_thread will cause the SSL initialization to take place + // so long as we wait for it to reach beyond the point of adding a secure + // server port. + s.Await(); const SSL_METHOD* method = TLSv1_2_client_method(); SSL_CTX* ctx = SSL_CTX_new(method); @@ -197,13 +233,13 @@ bool server_ssl_test(const char* alpn_list[], unsigned int alpn_list_len, int retries = 10; int sock = -1; while (sock == -1 && retries-- > 0) { - sock = create_socket(port); + sock = create_socket(s.port()); if (sock < 0) { sleep(1); } } GPR_ASSERT(sock > 0); - gpr_log(GPR_INFO, "Connected to server on port %d", port); + gpr_log(GPR_INFO, "Connected to server on port %d", s.port()); // Establish a SSL* and connect at SSL layer. SSL* ssl = SSL_new(ctx); From ee603bf172d9905d172883106b8c64bf15beba34 Mon Sep 17 00:00:00 2001 From: Arjun Roy Date: Wed, 4 Sep 2019 20:05:38 -0700 Subject: [PATCH 563/661] Better codegenfor validate_filtered_metadata. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit validate_filtered_metadata() performs several checks to see if a call must be failed. Failure is the unlikely case; to that end, failing branches are marked unlikely, and the specific code handling failure cases is refactored into explicitly un-inlined helper methods. This will prevent us from unnecessarily clobbering registers and give us a straight-line codepath for the success case. Results: BM_UnaryPingPong/8/0 [polls/iter:3.00008 ] 22.5µs ± 0% 21.6µs ± 0% -4.02% (p=0.036 n=5+3) BM_UnaryPingPong/64/64 [polls/iter:3.00008 ] 23.4µs ± 1% 23.0µs ± 1% -1.63% (p=0.010 n=6+4) BM_UnaryPingPong/32768/0 [polls/iter:3.00007 ] 34.4µs ± 1% 34.1µs ± 0% -0.99% (p=0.024 n=6+3) BM_UnaryPingPong/0/0 [polls/iter:0 ] 6.36µs ± 5% 6.16µs ± 2% -3.26% (p=0.013 n=20+19) BM_UnaryPingPong/1/1 [polls/iter:0 ] 6.62µs ± 6% 6.50µs ± 4% -1.72% (p=0.049 n=20+20) BM_UnaryPingPong/512/0 [polls/iter:0 ] 6.67µs ± 6% 6.59µs ± 2% -1.29% (p=0.047 n=20+19) BM_UnaryPingPong/4096/0 [polls/iter:0 ] 7.68µs ± 1% 7.65µs ± 2% -0.46% (p=0.031 n=18+18) BM_UnaryPingPong/0/262144 [polls/iter:0 ] 86.0µs ± 2% 85.3µs ± 2% -0.77% (p=0.046 n=19+19) BM_UnaryPingPong/0/0 [polls/iter:0 ] 6.28µs ± 5% 6.00µs ± 2% -4.37% (p=0.000 n=20+20) BM_UnaryPingPong/1/0 [polls/iter:0 ] 6.39µs ± 6% 6.20µs ± 2% -3.03% (p=0.001 n=20+19) BM_UnaryPingPong/0/1 [polls/iter:0 ] 6.36µs ± 6% 6.17µs ± 1% -3.00% (p=0.006 n=20+17) BM_UnaryPingPong/1/1 [polls/iter:0 ] 6.59µs ± 5% 6.30µs ± 2% -4.37% (p=0.000 n=20+19) BM_UnaryPingPong/8/0 [polls/iter:0 ] 6.37µs ± 5% 6.20µs ± 2% -2.76% (p=0.001 n=20+20) BM_UnaryPingPong/0/8 [polls/iter:0 ] 6.36µs ± 5% 6.17µs ± 2% -2.95% (p=0.001 n=20+19) BM_UnaryPingPong/8/8 [polls/iter:0 ] 6.45µs ± 7% 6.27µs ± 1% -2.72% (p=0.002 n=20+18) BM_UnaryPingPong/64/0 [polls/iter:0 ] 6.46µs ± 6% 6.31µs ± 1% -2.39% (p=0.001 n=20+20) BM_UnaryPingPong/512/0 [polls/iter:0 ] 6.62µs ± 6% 6.43µs ± 2% -2.92% (p=0.000 n=20+18) BM_UnaryPingPong/0/512 [polls/iter:0 ] 6.58µs ± 7% 6.41µs ± 1% -2.57% (p=0.002 n=20+17) BM_UnaryPingPong/512/512 [polls/iter:0 ] 6.88µs ± 7% 6.76µs ± 2% -1.81% (p=0.047 n=20+19) BM_UnaryPingPong/4096/0 [polls/iter:0 ] 7.57µs ± 3% 7.49µs ± 2% -0.99% (p=0.007 n=20+20) BM_UnaryPingPong/0/4096 [polls/iter:0 ] 7.66µs ± 5% 7.50µs ± 2% -2.15% (p=0.003 n=20+20) BM_UnaryPingPong/32768/0 [polls/iter:0 ] 15.8µs ± 2% 15.7µs ± 1% -0.75% (p=0.001 n=20+19) BM_UnaryPingPong/0/32768 [polls/iter:0 ] 16.1µs ± 2% 16.0µs ± 2% -0.84% (p=0.002 n=20+20) BM_UnaryPingPong/32768/32768 [polls/iter:0 ] 25.5µs ± 1% 25.4µs ± 1% -0.42% (p=0.011 n=20+19) BM_UnaryPingPong, 2>, NoOpMutator>/0/0 [polls/iter:0 ] 7.99µs ± 5% 7.85µs ± 2% -1.81% (p=0.028 n=20+20) BM_UnaryPingPong, 1>>/0/0 [polls/iter:0 ] 7.07µs ± 6% 7.14µs ± 5% +0.95% (p=0.007 n=19+18) BM_UnaryPingPong, 1>, NoOpMutator>/0/0 [polls/iter:0 ] 6.95µs ± 5% 7.02µs ± 3% +0.94% (p=0.017 n=18+19) BM_UnaryPingPong, 1>, NoOpMutator>/0/0 [polls/iter:0 ] 7.10µs ± 2% 7.19µs ± 2% +1.31% (p=0.000 n=16+20) BM_UnaryPingPong, 1>>/0/0 [polls/iter:0 ] 6.89µs ± 2% 7.00µs ± 3% +1.61% (p=0.000 n=17+19) BM_UnaryPingPong/512/512 [polls/iter:3.00007 ] 24.1µs ± 1% 23.7µs ± 1% -1.77% (p=0.024 n=6+3) BM_UnaryPingPong/1/0 [polls/iter:3.00009 ] 21.5µs ± 1% 20.9µs ± 0% -2.78% (p=0.024 n=6+3) BM_UnaryPingPong/4096/0 [polls/iter:3.00005 ] 24.4µs ± 2% 23.9µs ± 2% -2.16% (p=0.020 n=9+4) BM_UnaryPingPong/32768/0 [polls/iter:3.0001 ] 35.3µs ± 1% 34.8µs ± 1% -1.45% (p=0.008 n=5+5) BM_UnaryPingPong/0/0 [polls/iter:3.00008 ] 19.5µs ± 1% 19.1µs ± 1% -2.30% (p=0.016 n=4+5) BM_UnaryPingPong/0/32768 [polls/iter:3.0001 ] 35.4µs ± 1% 34.7µs ± 1% -1.77% (p=0.016 n=4+5) --- src/core/lib/compression/compression.cc | 3 +- .../lib/compression/compression_internal.h | 8 ++ src/core/lib/surface/call.cc | 127 +++++++++++------- 3 files changed, 89 insertions(+), 49 deletions(-) diff --git a/src/core/lib/compression/compression.cc b/src/core/lib/compression/compression.cc index 2f35e5fa03f..8a0abca8dd7 100644 --- a/src/core/lib/compression/compression.cc +++ b/src/core/lib/compression/compression.cc @@ -127,7 +127,8 @@ void grpc_compression_options_disable_algorithm( int grpc_compression_options_is_algorithm_enabled( const grpc_compression_options* opts, grpc_compression_algorithm algorithm) { - return GPR_BITGET(opts->enabled_algorithms_bitset, algorithm); + return grpc_compression_options_is_algorithm_enabled_internal(opts, + algorithm); } grpc_slice grpc_compression_algorithm_slice( diff --git a/src/core/lib/compression/compression_internal.h b/src/core/lib/compression/compression_internal.h index 73947a2c34d..49afb941d73 100644 --- a/src/core/lib/compression/compression_internal.h +++ b/src/core/lib/compression/compression_internal.h @@ -23,6 +23,8 @@ #include +#include "src/core/lib/gpr/useful.h" + #ifdef __cplusplus extern "C" { #endif @@ -85,4 +87,10 @@ int grpc_stream_compression_algorithm_parse( } #endif +inline int grpc_compression_options_is_algorithm_enabled_internal( + const grpc_compression_options* opts, + grpc_compression_algorithm algorithm) { + return GPR_BITGET(opts->enabled_algorithms_bitset, algorithm); +} + #endif /* GRPC_CORE_LIB_COMPRESSION_COMPRESSION_INTERNAL_H */ diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 1331e57ab0c..3c6a5d098ae 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -1365,64 +1365,95 @@ static void receiving_stream_ready_in_call_combiner(void* bctlp, receiving_stream_ready(bctlp, error); } +static void GPR_ATTRIBUTE_NOINLINE +handle_both_stream_and_msg_compression_set(grpc_call* call) { + char* error_msg = nullptr; + gpr_asprintf(&error_msg, + "Incoming stream has both stream compression (%d) and message " + "compression (%d).", + call->incoming_stream_compression_algorithm, + call->incoming_message_compression_algorithm); + gpr_log(GPR_ERROR, "%s", error_msg); + cancel_with_status(call, GRPC_STATUS_INTERNAL, error_msg); + gpr_free(error_msg); +} + +static void GPR_ATTRIBUTE_NOINLINE +handle_error_parsing_compression_algorithm(grpc_call* call) { + char* error_msg = nullptr; + gpr_asprintf(&error_msg, + "Error in incoming message compression (%d) or stream " + "compression (%d).", + call->incoming_stream_compression_algorithm, + call->incoming_message_compression_algorithm); + cancel_with_status(call, GRPC_STATUS_INTERNAL, error_msg); + gpr_free(error_msg); +} + +static void GPR_ATTRIBUTE_NOINLINE handle_invalid_compression( + grpc_call* call, grpc_compression_algorithm compression_algorithm) { + char* error_msg = nullptr; + gpr_asprintf(&error_msg, "Invalid compression algorithm value '%d'.", + compression_algorithm); + gpr_log(GPR_ERROR, "%s", error_msg); + cancel_with_status(call, GRPC_STATUS_UNIMPLEMENTED, error_msg); + gpr_free(error_msg); +} + +static void GPR_ATTRIBUTE_NOINLINE handle_compression_algorithm_disabled( + grpc_call* call, grpc_compression_algorithm compression_algorithm) { + char* error_msg = nullptr; + const char* algo_name = nullptr; + grpc_compression_algorithm_name(compression_algorithm, &algo_name); + gpr_asprintf(&error_msg, "Compression algorithm '%s' is disabled.", + algo_name); + gpr_log(GPR_ERROR, "%s", error_msg); + cancel_with_status(call, GRPC_STATUS_UNIMPLEMENTED, error_msg); + gpr_free(error_msg); +} + +static void GPR_ATTRIBUTE_NOINLINE handle_compression_algorithm_not_accepted( + grpc_call* call, grpc_compression_algorithm compression_algorithm) { + const char* algo_name = nullptr; + grpc_compression_algorithm_name(compression_algorithm, &algo_name); + gpr_log(GPR_ERROR, + "Compression algorithm ('%s') not present in the bitset of " + "accepted encodings ('0x%x')", + algo_name, call->encodings_accepted_by_peer); +} + static void validate_filtered_metadata(batch_control* bctl) { grpc_compression_algorithm compression_algorithm; grpc_call* call = bctl->call; - if (call->incoming_stream_compression_algorithm != - GRPC_STREAM_COMPRESS_NONE && - call->incoming_message_compression_algorithm != - GRPC_MESSAGE_COMPRESS_NONE) { - char* error_msg = nullptr; - gpr_asprintf(&error_msg, - "Incoming stream has both stream compression (%d) and message " - "compression (%d).", - call->incoming_stream_compression_algorithm, - call->incoming_message_compression_algorithm); - gpr_log(GPR_ERROR, "%s", error_msg); - cancel_with_status(call, GRPC_STATUS_INTERNAL, error_msg); - gpr_free(error_msg); + if (GPR_UNLIKELY(call->incoming_stream_compression_algorithm != + GRPC_STREAM_COMPRESS_NONE && + call->incoming_message_compression_algorithm != + GRPC_MESSAGE_COMPRESS_NONE)) { + handle_both_stream_and_msg_compression_set(call); } else if ( - grpc_compression_algorithm_from_message_stream_compression_algorithm( - &compression_algorithm, call->incoming_message_compression_algorithm, - call->incoming_stream_compression_algorithm) == 0) { - char* error_msg = nullptr; - gpr_asprintf(&error_msg, - "Error in incoming message compression (%d) or stream " - "compression (%d).", - call->incoming_stream_compression_algorithm, - call->incoming_message_compression_algorithm); - cancel_with_status(call, GRPC_STATUS_INTERNAL, error_msg); - gpr_free(error_msg); + GPR_UNLIKELY( + grpc_compression_algorithm_from_message_stream_compression_algorithm( + &compression_algorithm, + call->incoming_message_compression_algorithm, + call->incoming_stream_compression_algorithm) == 0)) { + handle_error_parsing_compression_algorithm(call); } else { - char* error_msg = nullptr; const grpc_compression_options compression_options = grpc_channel_compression_options(call->channel); - if (compression_algorithm >= GRPC_COMPRESS_ALGORITHMS_COUNT) { - gpr_asprintf(&error_msg, "Invalid compression algorithm value '%d'.", - compression_algorithm); - gpr_log(GPR_ERROR, "%s", error_msg); - cancel_with_status(call, GRPC_STATUS_UNIMPLEMENTED, error_msg); - } else if (grpc_compression_options_is_algorithm_enabled( - &compression_options, compression_algorithm) == 0) { + if (GPR_UNLIKELY(compression_algorithm >= GRPC_COMPRESS_ALGORITHMS_COUNT)) { + handle_invalid_compression(call, compression_algorithm); + } else if (GPR_UNLIKELY( + grpc_compression_options_is_algorithm_enabled_internal( + &compression_options, compression_algorithm) == 0)) { /* check if algorithm is supported by current channel config */ - const char* algo_name = nullptr; - grpc_compression_algorithm_name(compression_algorithm, &algo_name); - gpr_asprintf(&error_msg, "Compression algorithm '%s' is disabled.", - algo_name); - gpr_log(GPR_ERROR, "%s", error_msg); - cancel_with_status(call, GRPC_STATUS_UNIMPLEMENTED, error_msg); + handle_compression_algorithm_disabled(call, compression_algorithm); } - gpr_free(error_msg); - - GPR_ASSERT(call->encodings_accepted_by_peer != 0); - if (!GPR_BITGET(call->encodings_accepted_by_peer, compression_algorithm)) { + /* GRPC_COMPRESS_NONE is always set. */ + GPR_DEBUG_ASSERT(call->encodings_accepted_by_peer != 0); + if (GPR_UNLIKELY(!GPR_BITGET(call->encodings_accepted_by_peer, + compression_algorithm))) { if (GRPC_TRACE_FLAG_ENABLED(grpc_compression_trace)) { - const char* algo_name = nullptr; - grpc_compression_algorithm_name(compression_algorithm, &algo_name); - gpr_log(GPR_ERROR, - "Compression algorithm ('%s') not present in the bitset of " - "accepted encodings ('0x%x')", - algo_name, call->encodings_accepted_by_peer); + handle_compression_algorithm_not_accepted(call, compression_algorithm); } } } From 51d18ecc63cf2444c5e216b14e0c4bd0f542185a Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 5 Sep 2019 10:32:36 -0700 Subject: [PATCH 564/661] Convert mpscq API from C to C++. --- BUILD | 4 +- BUILD.gn | 6 +- CMakeLists.txt | 75 +++++++------ Makefile | 86 +++++++------- build.yaml | 26 ++--- config.m4 | 2 +- config.w32 | 2 +- gRPC-C++.podspec | 2 +- gRPC-Core.podspec | 6 +- grpc.gemspec | 4 +- grpc.gyp | 2 +- package.xml | 4 +- src/core/lib/gpr/mpscq.cc | 117 -------------------- src/core/lib/gpr/mpscq.h | 88 --------------- src/core/lib/gprpp/mpscq.cc | 108 ++++++++++++++++++ src/core/lib/gprpp/mpscq.h | 98 ++++++++++++++++ src/core/lib/iomgr/call_combiner.cc | 9 +- src/core/lib/iomgr/call_combiner.h | 4 +- src/core/lib/iomgr/closure.h | 11 +- src/core/lib/iomgr/combiner.cc | 17 ++- src/core/lib/iomgr/combiner.h | 1 - src/core/lib/surface/completion_queue.cc | 23 ++-- src/core/lib/surface/completion_queue.h | 5 +- src/core/lib/surface/server.cc | 33 +++--- src/python/grpcio/grpc_core_dependencies.py | 2 +- test/core/gpr/BUILD | 11 -- test/core/gprpp/BUILD | 11 ++ test/core/{gpr => gprpp}/mpscq_test.cc | 37 +++---- tools/doxygen/Doxyfile.c++.internal | 2 +- tools/doxygen/Doxyfile.core.internal | 4 +- tools/run_tests/generated/tests.json | 48 ++++---- 31 files changed, 438 insertions(+), 410 deletions(-) delete mode 100644 src/core/lib/gpr/mpscq.cc delete mode 100644 src/core/lib/gpr/mpscq.h create mode 100644 src/core/lib/gprpp/mpscq.cc create mode 100644 src/core/lib/gprpp/mpscq.h rename test/core/{gpr => gprpp}/mpscq_test.cc (85%) diff --git a/BUILD b/BUILD index d911050b1be..9bb6533b4b6 100644 --- a/BUILD +++ b/BUILD @@ -471,7 +471,6 @@ grpc_cc_library( "src/core/lib/gpr/log_linux.cc", "src/core/lib/gpr/log_posix.cc", "src/core/lib/gpr/log_windows.cc", - "src/core/lib/gpr/mpscq.cc", "src/core/lib/gpr/murmur_hash.cc", "src/core/lib/gpr/string.cc", "src/core/lib/gpr/string_posix.cc", @@ -493,6 +492,7 @@ grpc_cc_library( "src/core/lib/gprpp/fork.cc", "src/core/lib/gprpp/global_config_env.cc", "src/core/lib/gprpp/host_port.cc", + "src/core/lib/gprpp/mpscq.cc", "src/core/lib/gprpp/thd_posix.cc", "src/core/lib/gprpp/thd_windows.cc", "src/core/lib/profiling/basic_timers.cc", @@ -502,7 +502,6 @@ grpc_cc_library( "src/core/lib/gpr/alloc.h", "src/core/lib/gpr/arena.h", "src/core/lib/gpr/env.h", - "src/core/lib/gpr/mpscq.h", "src/core/lib/gpr/murmur_hash.h", "src/core/lib/gpr/spinlock.h", "src/core/lib/gpr/string.h", @@ -526,6 +525,7 @@ grpc_cc_library( "src/core/lib/gprpp/manual_constructor.h", "src/core/lib/gprpp/map.h", "src/core/lib/gprpp/memory.h", + "src/core/lib/gprpp/mpscq.h", "src/core/lib/gprpp/pair.h", "src/core/lib/gprpp/string_view.h", "src/core/lib/gprpp/sync.h", diff --git a/BUILD.gn b/BUILD.gn index 771e968f366..0f340214aa3 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -104,8 +104,6 @@ config("grpc_config") { "src/core/lib/gpr/log_linux.cc", "src/core/lib/gpr/log_posix.cc", "src/core/lib/gpr/log_windows.cc", - "src/core/lib/gpr/mpscq.cc", - "src/core/lib/gpr/mpscq.h", "src/core/lib/gpr/murmur_hash.cc", "src/core/lib/gpr/murmur_hash.h", "src/core/lib/gpr/spinlock.h", @@ -150,6 +148,8 @@ config("grpc_config") { "src/core/lib/gprpp/manual_constructor.h", "src/core/lib/gprpp/map.h", "src/core/lib/gprpp/memory.h", + "src/core/lib/gprpp/mpscq.cc", + "src/core/lib/gprpp/mpscq.h", "src/core/lib/gprpp/pair.h", "src/core/lib/gprpp/sync.h", "src/core/lib/gprpp/thd.h", @@ -1223,7 +1223,6 @@ config("grpc_config") { "src/core/lib/gpr/alloc.h", "src/core/lib/gpr/arena.h", "src/core/lib/gpr/env.h", - "src/core/lib/gpr/mpscq.h", "src/core/lib/gpr/murmur_hash.h", "src/core/lib/gpr/spinlock.h", "src/core/lib/gpr/string.h", @@ -1249,6 +1248,7 @@ config("grpc_config") { "src/core/lib/gprpp/manual_constructor.h", "src/core/lib/gprpp/map.h", "src/core/lib/gprpp/memory.h", + "src/core/lib/gprpp/mpscq.h", "src/core/lib/gprpp/optional.h", "src/core/lib/gprpp/orphanable.h", "src/core/lib/gprpp/pair.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 599f1441583..23fafa061d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -308,7 +308,6 @@ add_dependencies(buildtests_c gpr_env_test) add_dependencies(buildtests_c gpr_host_port_test) add_dependencies(buildtests_c gpr_log_test) add_dependencies(buildtests_c gpr_manual_constructor_test) -add_dependencies(buildtests_c gpr_mpscq_test) add_dependencies(buildtests_c gpr_spinlock_test) add_dependencies(buildtests_c gpr_string_test) add_dependencies(buildtests_c gpr_sync_test) @@ -628,6 +627,7 @@ add_dependencies(buildtests_cxx generic_end2end_test) add_dependencies(buildtests_cxx global_config_env_test) add_dependencies(buildtests_cxx global_config_test) add_dependencies(buildtests_cxx golden_file_test) +add_dependencies(buildtests_cxx gprpp_mpscq_test) add_dependencies(buildtests_cxx grpc_alts_credentials_options_test) add_dependencies(buildtests_cxx grpc_cli) add_dependencies(buildtests_cxx grpc_core_map_test) @@ -864,7 +864,6 @@ add_library(gpr src/core/lib/gpr/log_linux.cc src/core/lib/gpr/log_posix.cc src/core/lib/gpr/log_windows.cc - src/core/lib/gpr/mpscq.cc src/core/lib/gpr/murmur_hash.cc src/core/lib/gpr/string.cc src/core/lib/gpr/string_posix.cc @@ -886,6 +885,7 @@ add_library(gpr src/core/lib/gprpp/fork.cc src/core/lib/gprpp/global_config_env.cc src/core/lib/gprpp/host_port.cc + src/core/lib/gprpp/mpscq.cc src/core/lib/gprpp/thd_posix.cc src/core/lib/gprpp/thd_windows.cc src/core/lib/profiling/basic_timers.cc @@ -7078,37 +7078,6 @@ target_link_libraries(gpr_manual_constructor_test ) -endif (gRPC_BUILD_TESTS) -if (gRPC_BUILD_TESTS) - -add_executable(gpr_mpscq_test - test/core/gpr/mpscq_test.cc -) - - -target_include_directories(gpr_mpscq_test - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} - PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} - PRIVATE ${_gRPC_CARES_INCLUDE_DIR} - PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_UPB_GENERATED_DIR} - PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} - PRIVATE ${_gRPC_UPB_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} -) - -target_link_libraries(gpr_mpscq_test - ${_gRPC_ALLTARGETS_LIBRARIES} - gpr - grpc_test_util_unsecure - grpc_unsecure -) - - endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) @@ -13340,6 +13309,46 @@ target_link_libraries(golden_file_test ) +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_executable(gprpp_mpscq_test + test/core/gprpp/mpscq_test.cc + third_party/googletest/googletest/src/gtest-all.cc + third_party/googletest/googlemock/src/gmock-all.cc +) + + +target_include_directories(gprpp_mpscq_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} + PRIVATE ${_gRPC_CARES_INCLUDE_DIR} + PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_UPB_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_GRPC_GENERATED_DIR} + PRIVATE ${_gRPC_UPB_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest + PRIVATE third_party/googletest/googlemock/include + PRIVATE third_party/googletest/googlemock + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(gprpp_mpscq_test + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + gpr + grpc_test_util_unsecure + grpc_unsecure + ${_gRPC_GFLAGS_LIBRARIES} +) + + endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) diff --git a/Makefile b/Makefile index d48b36a531f..5e334107f5a 100644 --- a/Makefile +++ b/Makefile @@ -1038,7 +1038,6 @@ gpr_env_test: $(BINDIR)/$(CONFIG)/gpr_env_test gpr_host_port_test: $(BINDIR)/$(CONFIG)/gpr_host_port_test gpr_log_test: $(BINDIR)/$(CONFIG)/gpr_log_test gpr_manual_constructor_test: $(BINDIR)/$(CONFIG)/gpr_manual_constructor_test -gpr_mpscq_test: $(BINDIR)/$(CONFIG)/gpr_mpscq_test gpr_spinlock_test: $(BINDIR)/$(CONFIG)/gpr_spinlock_test gpr_string_test: $(BINDIR)/$(CONFIG)/gpr_string_test gpr_sync_test: $(BINDIR)/$(CONFIG)/gpr_sync_test @@ -1219,6 +1218,7 @@ generic_end2end_test: $(BINDIR)/$(CONFIG)/generic_end2end_test global_config_env_test: $(BINDIR)/$(CONFIG)/global_config_env_test global_config_test: $(BINDIR)/$(CONFIG)/global_config_test golden_file_test: $(BINDIR)/$(CONFIG)/golden_file_test +gprpp_mpscq_test: $(BINDIR)/$(CONFIG)/gprpp_mpscq_test grpc_alts_credentials_options_test: $(BINDIR)/$(CONFIG)/grpc_alts_credentials_options_test grpc_cli: $(BINDIR)/$(CONFIG)/grpc_cli grpc_core_map_test: $(BINDIR)/$(CONFIG)/grpc_core_map_test @@ -1478,7 +1478,6 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/gpr_host_port_test \ $(BINDIR)/$(CONFIG)/gpr_log_test \ $(BINDIR)/$(CONFIG)/gpr_manual_constructor_test \ - $(BINDIR)/$(CONFIG)/gpr_mpscq_test \ $(BINDIR)/$(CONFIG)/gpr_spinlock_test \ $(BINDIR)/$(CONFIG)/gpr_string_test \ $(BINDIR)/$(CONFIG)/gpr_sync_test \ @@ -1698,6 +1697,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/global_config_env_test \ $(BINDIR)/$(CONFIG)/global_config_test \ $(BINDIR)/$(CONFIG)/golden_file_test \ + $(BINDIR)/$(CONFIG)/gprpp_mpscq_test \ $(BINDIR)/$(CONFIG)/grpc_alts_credentials_options_test \ $(BINDIR)/$(CONFIG)/grpc_cli \ $(BINDIR)/$(CONFIG)/grpc_core_map_test \ @@ -1867,6 +1867,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/global_config_env_test \ $(BINDIR)/$(CONFIG)/global_config_test \ $(BINDIR)/$(CONFIG)/golden_file_test \ + $(BINDIR)/$(CONFIG)/gprpp_mpscq_test \ $(BINDIR)/$(CONFIG)/grpc_alts_credentials_options_test \ $(BINDIR)/$(CONFIG)/grpc_cli \ $(BINDIR)/$(CONFIG)/grpc_core_map_test \ @@ -2048,8 +2049,6 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/gpr_log_test || ( echo test gpr_log_test failed ; exit 1 ) $(E) "[RUN] Testing gpr_manual_constructor_test" $(Q) $(BINDIR)/$(CONFIG)/gpr_manual_constructor_test || ( echo test gpr_manual_constructor_test failed ; exit 1 ) - $(E) "[RUN] Testing gpr_mpscq_test" - $(Q) $(BINDIR)/$(CONFIG)/gpr_mpscq_test || ( echo test gpr_mpscq_test failed ; exit 1 ) $(E) "[RUN] Testing gpr_spinlock_test" $(Q) $(BINDIR)/$(CONFIG)/gpr_spinlock_test || ( echo test gpr_spinlock_test failed ; exit 1 ) $(E) "[RUN] Testing gpr_string_test" @@ -2376,6 +2375,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/global_config_test || ( echo test global_config_test failed ; exit 1 ) $(E) "[RUN] Testing golden_file_test" $(Q) $(BINDIR)/$(CONFIG)/golden_file_test || ( echo test golden_file_test failed ; exit 1 ) + $(E) "[RUN] Testing gprpp_mpscq_test" + $(Q) $(BINDIR)/$(CONFIG)/gprpp_mpscq_test || ( echo test gprpp_mpscq_test failed ; exit 1 ) $(E) "[RUN] Testing grpc_alts_credentials_options_test" $(Q) $(BINDIR)/$(CONFIG)/grpc_alts_credentials_options_test || ( echo test grpc_alts_credentials_options_test failed ; exit 1 ) $(E) "[RUN] Testing grpc_core_map_test" @@ -3457,7 +3458,6 @@ LIBGPR_SRC = \ src/core/lib/gpr/log_linux.cc \ src/core/lib/gpr/log_posix.cc \ src/core/lib/gpr/log_windows.cc \ - src/core/lib/gpr/mpscq.cc \ src/core/lib/gpr/murmur_hash.cc \ src/core/lib/gpr/string.cc \ src/core/lib/gpr/string_posix.cc \ @@ -3479,6 +3479,7 @@ LIBGPR_SRC = \ src/core/lib/gprpp/fork.cc \ src/core/lib/gprpp/global_config_env.cc \ src/core/lib/gprpp/host_port.cc \ + src/core/lib/gprpp/mpscq.cc \ src/core/lib/gprpp/thd_posix.cc \ src/core/lib/gprpp/thd_windows.cc \ src/core/lib/profiling/basic_timers.cc \ @@ -9986,38 +9987,6 @@ endif endif -GPR_MPSCQ_TEST_SRC = \ - test/core/gpr/mpscq_test.cc \ - -GPR_MPSCQ_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GPR_MPSCQ_TEST_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/gpr_mpscq_test: openssl_dep_error - -else - - - -$(BINDIR)/$(CONFIG)/gpr_mpscq_test: $(GPR_MPSCQ_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(GPR_MPSCQ_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_mpscq_test - -endif - -$(OBJDIR)/$(CONFIG)/test/core/gpr/mpscq_test.o: $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a - -deps_gpr_mpscq_test: $(GPR_MPSCQ_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(GPR_MPSCQ_TEST_OBJS:.o=.dep) -endif -endif - - GPR_SPINLOCK_TEST_SRC = \ test/core/gpr/spinlock_test.cc \ @@ -16730,6 +16699,49 @@ endif $(OBJDIR)/$(CONFIG)/test/cpp/codegen/golden_file_test.o: $(GENDIR)/src/proto/grpc/testing/compiler_test.pb.cc $(GENDIR)/src/proto/grpc/testing/compiler_test.grpc.pb.cc +GPRPP_MPSCQ_TEST_SRC = \ + test/core/gprpp/mpscq_test.cc \ + +GPRPP_MPSCQ_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GPRPP_MPSCQ_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/gprpp_mpscq_test: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+. + +$(BINDIR)/$(CONFIG)/gprpp_mpscq_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/gprpp_mpscq_test: $(PROTOBUF_DEP) $(GPRPP_MPSCQ_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(GPRPP_MPSCQ_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/gprpp_mpscq_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/core/gprpp/mpscq_test.o: $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a + +deps_gprpp_mpscq_test: $(GPRPP_MPSCQ_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(GPRPP_MPSCQ_TEST_OBJS:.o=.dep) +endif +endif + + GRPC_ALTS_CREDENTIALS_OPTIONS_TEST_SRC = \ test/core/security/grpc_alts_credentials_options_test.cc \ diff --git a/build.yaml b/build.yaml index 9c546246ab0..bbbf4eb6374 100644 --- a/build.yaml +++ b/build.yaml @@ -217,7 +217,6 @@ filegroups: - src/core/lib/gpr/log_linux.cc - src/core/lib/gpr/log_posix.cc - src/core/lib/gpr/log_windows.cc - - src/core/lib/gpr/mpscq.cc - src/core/lib/gpr/murmur_hash.cc - src/core/lib/gpr/string.cc - src/core/lib/gpr/string_posix.cc @@ -239,6 +238,7 @@ filegroups: - src/core/lib/gprpp/fork.cc - src/core/lib/gprpp/global_config_env.cc - src/core/lib/gprpp/host_port.cc + - src/core/lib/gprpp/mpscq.cc - src/core/lib/gprpp/thd_posix.cc - src/core/lib/gprpp/thd_windows.cc - src/core/lib/profiling/basic_timers.cc @@ -268,7 +268,6 @@ filegroups: - src/core/lib/gpr/alloc.h - src/core/lib/gpr/arena.h - src/core/lib/gpr/env.h - - src/core/lib/gpr/mpscq.h - src/core/lib/gpr/murmur_hash.h - src/core/lib/gpr/spinlock.h - src/core/lib/gpr/string.h @@ -292,6 +291,7 @@ filegroups: - src/core/lib/gprpp/manual_constructor.h - src/core/lib/gprpp/map.h - src/core/lib/gprpp/memory.h + - src/core/lib/gprpp/mpscq.h - src/core/lib/gprpp/pair.h - src/core/lib/gprpp/sync.h - src/core/lib/gprpp/thd.h @@ -2738,17 +2738,6 @@ targets: - grpc_test_util_unsecure - grpc_unsecure uses_polling: false -- name: gpr_mpscq_test - cpu_cost: 30 - build: test - language: c - src: - - test/core/gpr/mpscq_test.cc - deps: - - gpr - - grpc_test_util_unsecure - - grpc_unsecure - uses_polling: false - name: gpr_spinlock_test cpu_cost: 3 build: test @@ -5001,6 +4990,17 @@ targets: args: - --generated_file_path=gens/src/proto/grpc/testing/ uses_polling: false +- name: gprpp_mpscq_test + cpu_cost: 30 + build: test + language: c++ + src: + - test/core/gprpp/mpscq_test.cc + deps: + - gpr + - grpc_test_util_unsecure + - grpc_unsecure + uses_polling: false - name: grpc_alts_credentials_options_test build: test language: c++ diff --git a/config.m4 b/config.m4 index efa86576f84..05bb4eada44 100644 --- a/config.m4 +++ b/config.m4 @@ -63,7 +63,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/gpr/log_linux.cc \ src/core/lib/gpr/log_posix.cc \ src/core/lib/gpr/log_windows.cc \ - src/core/lib/gpr/mpscq.cc \ src/core/lib/gpr/murmur_hash.cc \ src/core/lib/gpr/string.cc \ src/core/lib/gpr/string_posix.cc \ @@ -85,6 +84,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/gprpp/fork.cc \ src/core/lib/gprpp/global_config_env.cc \ src/core/lib/gprpp/host_port.cc \ + src/core/lib/gprpp/mpscq.cc \ src/core/lib/gprpp/thd_posix.cc \ src/core/lib/gprpp/thd_windows.cc \ src/core/lib/profiling/basic_timers.cc \ diff --git a/config.w32 b/config.w32 index 13b5f1350f0..ed52f91e87d 100644 --- a/config.w32 +++ b/config.w32 @@ -33,7 +33,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\gpr\\log_linux.cc " + "src\\core\\lib\\gpr\\log_posix.cc " + "src\\core\\lib\\gpr\\log_windows.cc " + - "src\\core\\lib\\gpr\\mpscq.cc " + "src\\core\\lib\\gpr\\murmur_hash.cc " + "src\\core\\lib\\gpr\\string.cc " + "src\\core\\lib\\gpr\\string_posix.cc " + @@ -55,6 +54,7 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\gprpp\\fork.cc " + "src\\core\\lib\\gprpp\\global_config_env.cc " + "src\\core\\lib\\gprpp\\host_port.cc " + + "src\\core\\lib\\gprpp\\mpscq.cc " + "src\\core\\lib\\gprpp\\thd_posix.cc " + "src\\core\\lib\\gprpp\\thd_windows.cc " + "src\\core\\lib\\profiling\\basic_timers.cc " + diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 881e8959651..1a1a6365488 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -287,7 +287,6 @@ Pod::Spec.new do |s| 'src/core/lib/gpr/alloc.h', 'src/core/lib/gpr/arena.h', 'src/core/lib/gpr/env.h', - 'src/core/lib/gpr/mpscq.h', 'src/core/lib/gpr/murmur_hash.h', 'src/core/lib/gpr/spinlock.h', 'src/core/lib/gpr/string.h', @@ -311,6 +310,7 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/manual_constructor.h', 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', + 'src/core/lib/gprpp/mpscq.h', 'src/core/lib/gprpp/pair.h', 'src/core/lib/gprpp/sync.h', 'src/core/lib/gprpp/thd.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 658a3ad6158..189cf935128 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -191,7 +191,6 @@ Pod::Spec.new do |s| ss.source_files = 'src/core/lib/gpr/alloc.h', 'src/core/lib/gpr/arena.h', 'src/core/lib/gpr/env.h', - 'src/core/lib/gpr/mpscq.h', 'src/core/lib/gpr/murmur_hash.h', 'src/core/lib/gpr/spinlock.h', 'src/core/lib/gpr/string.h', @@ -215,6 +214,7 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/manual_constructor.h', 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', + 'src/core/lib/gprpp/mpscq.h', 'src/core/lib/gprpp/pair.h', 'src/core/lib/gprpp/sync.h', 'src/core/lib/gprpp/thd.h', @@ -233,7 +233,6 @@ Pod::Spec.new do |s| 'src/core/lib/gpr/log_linux.cc', 'src/core/lib/gpr/log_posix.cc', 'src/core/lib/gpr/log_windows.cc', - 'src/core/lib/gpr/mpscq.cc', 'src/core/lib/gpr/murmur_hash.cc', 'src/core/lib/gpr/string.cc', 'src/core/lib/gpr/string_posix.cc', @@ -255,6 +254,7 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/fork.cc', 'src/core/lib/gprpp/global_config_env.cc', 'src/core/lib/gprpp/host_port.cc', + 'src/core/lib/gprpp/mpscq.cc', 'src/core/lib/gprpp/thd_posix.cc', 'src/core/lib/gprpp/thd_windows.cc', 'src/core/lib/profiling/basic_timers.cc', @@ -965,7 +965,6 @@ Pod::Spec.new do |s| ss.private_header_files = 'src/core/lib/gpr/alloc.h', 'src/core/lib/gpr/arena.h', 'src/core/lib/gpr/env.h', - 'src/core/lib/gpr/mpscq.h', 'src/core/lib/gpr/murmur_hash.h', 'src/core/lib/gpr/spinlock.h', 'src/core/lib/gpr/string.h', @@ -989,6 +988,7 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/manual_constructor.h', 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', + 'src/core/lib/gprpp/mpscq.h', 'src/core/lib/gprpp/pair.h', 'src/core/lib/gprpp/sync.h', 'src/core/lib/gprpp/thd.h', diff --git a/grpc.gemspec b/grpc.gemspec index 1b705016cee..0319a265a66 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -85,7 +85,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/gpr/alloc.h ) s.files += %w( src/core/lib/gpr/arena.h ) s.files += %w( src/core/lib/gpr/env.h ) - s.files += %w( src/core/lib/gpr/mpscq.h ) s.files += %w( src/core/lib/gpr/murmur_hash.h ) s.files += %w( src/core/lib/gpr/spinlock.h ) s.files += %w( src/core/lib/gpr/string.h ) @@ -109,6 +108,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/gprpp/manual_constructor.h ) s.files += %w( src/core/lib/gprpp/map.h ) s.files += %w( src/core/lib/gprpp/memory.h ) + s.files += %w( src/core/lib/gprpp/mpscq.h ) s.files += %w( src/core/lib/gprpp/pair.h ) s.files += %w( src/core/lib/gprpp/sync.h ) s.files += %w( src/core/lib/gprpp/thd.h ) @@ -127,7 +127,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/gpr/log_linux.cc ) s.files += %w( src/core/lib/gpr/log_posix.cc ) s.files += %w( src/core/lib/gpr/log_windows.cc ) - s.files += %w( src/core/lib/gpr/mpscq.cc ) s.files += %w( src/core/lib/gpr/murmur_hash.cc ) s.files += %w( src/core/lib/gpr/string.cc ) s.files += %w( src/core/lib/gpr/string_posix.cc ) @@ -149,6 +148,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/gprpp/fork.cc ) s.files += %w( src/core/lib/gprpp/global_config_env.cc ) s.files += %w( src/core/lib/gprpp/host_port.cc ) + s.files += %w( src/core/lib/gprpp/mpscq.cc ) s.files += %w( src/core/lib/gprpp/thd_posix.cc ) s.files += %w( src/core/lib/gprpp/thd_windows.cc ) s.files += %w( src/core/lib/profiling/basic_timers.cc ) diff --git a/grpc.gyp b/grpc.gyp index 5468675e768..e7bb27d9ed2 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -254,7 +254,6 @@ 'src/core/lib/gpr/log_linux.cc', 'src/core/lib/gpr/log_posix.cc', 'src/core/lib/gpr/log_windows.cc', - 'src/core/lib/gpr/mpscq.cc', 'src/core/lib/gpr/murmur_hash.cc', 'src/core/lib/gpr/string.cc', 'src/core/lib/gpr/string_posix.cc', @@ -276,6 +275,7 @@ 'src/core/lib/gprpp/fork.cc', 'src/core/lib/gprpp/global_config_env.cc', 'src/core/lib/gprpp/host_port.cc', + 'src/core/lib/gprpp/mpscq.cc', 'src/core/lib/gprpp/thd_posix.cc', 'src/core/lib/gprpp/thd_windows.cc', 'src/core/lib/profiling/basic_timers.cc', diff --git a/package.xml b/package.xml index 385a57c77ea..b05be16f392 100644 --- a/package.xml +++ b/package.xml @@ -90,7 +90,6 @@ - @@ -114,6 +113,7 @@ + @@ -132,7 +132,6 @@ - @@ -154,6 +153,7 @@ + diff --git a/src/core/lib/gpr/mpscq.cc b/src/core/lib/gpr/mpscq.cc deleted file mode 100644 index 076a6bb033c..00000000000 --- a/src/core/lib/gpr/mpscq.cc +++ /dev/null @@ -1,117 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include "src/core/lib/gpr/mpscq.h" - -#include - -void gpr_mpscq_init(gpr_mpscq* q) { - gpr_atm_no_barrier_store(&q->head, (gpr_atm)&q->stub); - q->tail = &q->stub; - gpr_atm_no_barrier_store(&q->stub.next, (gpr_atm)NULL); -} - -void gpr_mpscq_destroy(gpr_mpscq* q) { - GPR_ASSERT(gpr_atm_no_barrier_load(&q->head) == (gpr_atm)&q->stub); - GPR_ASSERT(q->tail == &q->stub); -} - -bool gpr_mpscq_push(gpr_mpscq* q, gpr_mpscq_node* n) { - gpr_atm_no_barrier_store(&n->next, (gpr_atm)NULL); - gpr_mpscq_node* prev = - (gpr_mpscq_node*)gpr_atm_full_xchg(&q->head, (gpr_atm)n); - gpr_atm_rel_store(&prev->next, (gpr_atm)n); - return prev == &q->stub; -} - -gpr_mpscq_node* gpr_mpscq_pop(gpr_mpscq* q) { - bool empty; - return gpr_mpscq_pop_and_check_end(q, &empty); -} - -gpr_mpscq_node* gpr_mpscq_pop_and_check_end(gpr_mpscq* q, bool* empty) { - gpr_mpscq_node* tail = q->tail; - gpr_mpscq_node* next = (gpr_mpscq_node*)gpr_atm_acq_load(&tail->next); - if (tail == &q->stub) { - // indicates the list is actually (ephemerally) empty - if (next == nullptr) { - *empty = true; - return nullptr; - } - q->tail = next; - tail = next; - next = (gpr_mpscq_node*)gpr_atm_acq_load(&tail->next); - } - if (next != nullptr) { - *empty = false; - q->tail = next; - return tail; - } - gpr_mpscq_node* head = (gpr_mpscq_node*)gpr_atm_acq_load(&q->head); - if (tail != head) { - *empty = false; - // indicates a retry is in order: we're still adding - return nullptr; - } - gpr_mpscq_push(q, &q->stub); - next = (gpr_mpscq_node*)gpr_atm_acq_load(&tail->next); - if (next != nullptr) { - *empty = false; - q->tail = next; - return tail; - } - // indicates a retry is in order: we're still adding - *empty = false; - return nullptr; -} - -void gpr_locked_mpscq_init(gpr_locked_mpscq* q) { - gpr_mpscq_init(&q->queue); - gpr_mu_init(&q->mu); -} - -void gpr_locked_mpscq_destroy(gpr_locked_mpscq* q) { - gpr_mpscq_destroy(&q->queue); - gpr_mu_destroy(&q->mu); -} - -bool gpr_locked_mpscq_push(gpr_locked_mpscq* q, gpr_mpscq_node* n) { - return gpr_mpscq_push(&q->queue, n); -} - -gpr_mpscq_node* gpr_locked_mpscq_try_pop(gpr_locked_mpscq* q) { - if (gpr_mu_trylock(&q->mu)) { - gpr_mpscq_node* n = gpr_mpscq_pop(&q->queue); - gpr_mu_unlock(&q->mu); - return n; - } - return nullptr; -} - -gpr_mpscq_node* gpr_locked_mpscq_pop(gpr_locked_mpscq* q) { - gpr_mu_lock(&q->mu); - bool empty = false; - gpr_mpscq_node* n; - do { - n = gpr_mpscq_pop_and_check_end(&q->queue, &empty); - } while (n == nullptr && !empty); - gpr_mu_unlock(&q->mu); - return n; -} diff --git a/src/core/lib/gpr/mpscq.h b/src/core/lib/gpr/mpscq.h deleted file mode 100644 index 5ded2522bd6..00000000000 --- a/src/core/lib/gpr/mpscq.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPC_CORE_LIB_GPR_MPSCQ_H -#define GRPC_CORE_LIB_GPR_MPSCQ_H - -#include - -#include -#include -#include -#include - -// Multiple-producer single-consumer lock free queue, based upon the -// implementation from Dmitry Vyukov here: -// http://www.1024cores.net/home/lock-free-algorithms/queues/intrusive-mpsc-node-based-queue - -// List node (include this in a data structure at the top, and add application -// fields after it - to simulate inheritance) -typedef struct gpr_mpscq_node { - gpr_atm next; -} gpr_mpscq_node; - -// Actual queue type -typedef struct gpr_mpscq { - // make sure head & tail don't share a cacheline - union { - char padding[GPR_CACHELINE_SIZE]; - gpr_atm head; - }; - gpr_mpscq_node* tail; - gpr_mpscq_node stub; -} gpr_mpscq; - -void gpr_mpscq_init(gpr_mpscq* q); -void gpr_mpscq_destroy(gpr_mpscq* q); -// Push a node -// Thread safe - can be called from multiple threads concurrently -// Returns true if this was possibly the first node (may return true -// sporadically, will not return false sporadically) -bool gpr_mpscq_push(gpr_mpscq* q, gpr_mpscq_node* n); -// Pop a node (returns NULL if no node is ready - which doesn't indicate that -// the queue is empty!!) -// Thread compatible - can only be called from one thread at a time -gpr_mpscq_node* gpr_mpscq_pop(gpr_mpscq* q); -// Pop a node; sets *empty to true if the queue is empty, or false if it is not -gpr_mpscq_node* gpr_mpscq_pop_and_check_end(gpr_mpscq* q, bool* empty); - -// An mpscq with a lock: it's safe to pop from multiple threads, but doing -// only one thread will succeed concurrently -typedef struct gpr_locked_mpscq { - gpr_mpscq queue; - gpr_mu mu; -} gpr_locked_mpscq; - -void gpr_locked_mpscq_init(gpr_locked_mpscq* q); -void gpr_locked_mpscq_destroy(gpr_locked_mpscq* q); -// Push a node -// Thread safe - can be called from multiple threads concurrently -// Returns true if this was possibly the first node (may return true -// sporadically, will not return false sporadically) -bool gpr_locked_mpscq_push(gpr_locked_mpscq* q, gpr_mpscq_node* n); - -// Pop a node (returns NULL if no node is ready - which doesn't indicate that -// the queue is empty!!) -// Thread safe - can be called from multiple threads concurrently -gpr_mpscq_node* gpr_locked_mpscq_try_pop(gpr_locked_mpscq* q); - -// Pop a node. Returns NULL only if the queue was empty at some point after -// calling this function -gpr_mpscq_node* gpr_locked_mpscq_pop(gpr_locked_mpscq* q); - -#endif /* GRPC_CORE_LIB_GPR_MPSCQ_H */ diff --git a/src/core/lib/gprpp/mpscq.cc b/src/core/lib/gprpp/mpscq.cc new file mode 100644 index 00000000000..2bf9981ee26 --- /dev/null +++ b/src/core/lib/gprpp/mpscq.cc @@ -0,0 +1,108 @@ +/* + * + * Copyright 2016 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#include "src/core/lib/gprpp/mpscq.h" + +namespace grpc_core { + +// +// MultiProducerSingleConsumerQueue +// + +bool MultiProducerSingleConsumerQueue::Push(Node* node) { + node->next.Store(nullptr, MemoryOrder::RELAXED); + Node* prev = head_.Exchange(node, MemoryOrder::ACQ_REL); + prev->next.Store(node, MemoryOrder::RELEASE); + return prev == &stub_; +} + +MultiProducerSingleConsumerQueue::Node* +MultiProducerSingleConsumerQueue::Pop() { + bool empty; + return PopAndCheckEnd(&empty); +} + +MultiProducerSingleConsumerQueue::Node* +MultiProducerSingleConsumerQueue::PopAndCheckEnd(bool* empty) { + Node* tail = tail_; + Node* next = tail_->next.Load(MemoryOrder::ACQUIRE); + if (tail == &stub_) { + // indicates the list is actually (ephemerally) empty + if (next == nullptr) { + *empty = true; + return nullptr; + } + tail_ = next; + tail = next; + next = tail->next.Load(MemoryOrder::ACQUIRE); + } + if (next != nullptr) { + *empty = false; + tail_ = next; + return tail; + } + Node* head = head_.Load(MemoryOrder::ACQUIRE); + if (tail != head) { + *empty = false; + // indicates a retry is in order: we're still adding + return nullptr; + } + Push(&stub_); + next = tail->next.Load(MemoryOrder::ACQUIRE); + if (next != nullptr) { + *empty = false; + tail_ = next; + return tail; + } + // indicates a retry is in order: we're still adding + *empty = false; + return nullptr; +} + +// +// LockedMultiProducerSingleConsumerQueue +// + +bool LockedMultiProducerSingleConsumerQueue::Push(Node* node) { + return queue_.Push(node); +} + +LockedMultiProducerSingleConsumerQueue::Node* +LockedMultiProducerSingleConsumerQueue::TryPop() { + if (gpr_mu_trylock(mu_.get())) { + Node* node = queue_.Pop(); + gpr_mu_unlock(mu_.get()); + return node; + } + return nullptr; +} + +LockedMultiProducerSingleConsumerQueue::Node* +LockedMultiProducerSingleConsumerQueue::Pop() { + MutexLock lock(&mu_); + bool empty = false; + Node* node; + do { + node = queue_.PopAndCheckEnd(&empty); + } while (node == nullptr && !empty); + return node; +} + +} // namespace grpc_core diff --git a/src/core/lib/gprpp/mpscq.h b/src/core/lib/gprpp/mpscq.h new file mode 100644 index 00000000000..a1c04cae23c --- /dev/null +++ b/src/core/lib/gprpp/mpscq.h @@ -0,0 +1,98 @@ +/* + * + * Copyright 2016 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_LIB_GPRPP_MPSCQ_H +#define GRPC_CORE_LIB_GPRPP_MPSCQ_H + +#include + +#include "src/core/lib/gprpp/atomic.h" +#include "src/core/lib/gprpp/sync.h" + +#include + +namespace grpc_core { + +// Multiple-producer single-consumer lock free queue, based upon the +// implementation from Dmitry Vyukov here: +// http://www.1024cores.net/home/lock-free-algorithms/queues/intrusive-mpsc-node-based-queue +class MultiProducerSingleConsumerQueue { + public: + // List node. Application node types can inherit from this. + struct Node { + Atomic next; + }; + + MultiProducerSingleConsumerQueue() : head_{&stub_}, tail_(&stub_) {} + ~MultiProducerSingleConsumerQueue() { + GPR_ASSERT(head_.Load(MemoryOrder::RELAXED) == &stub_); + GPR_ASSERT(tail_ == &stub_); + } + + // Push a node + // Thread safe - can be called from multiple threads concurrently + // Returns true if this was possibly the first node (may return true + // sporadically, will not return false sporadically) + bool Push(Node* node); + // Pop a node (returns NULL if no node is ready - which doesn't indicate that + // the queue is empty!!) + // Thread compatible - can only be called from one thread at a time + Node* Pop(); + // Pop a node; sets *empty to true if the queue is empty, or false if it is + // not. + Node* PopAndCheckEnd(bool* empty); + + private: + // make sure head & tail don't share a cacheline + union { + char padding_[GPR_CACHELINE_SIZE]; + Atomic head_; + }; + Node* tail_; + Node stub_; +}; + +// An mpscq with a lock: it's safe to pop from multiple threads, but doing +// only one thread will succeed concurrently. +class LockedMultiProducerSingleConsumerQueue { + public: + typedef MultiProducerSingleConsumerQueue::Node Node; + + // Push a node + // Thread safe - can be called from multiple threads concurrently + // Returns true if this was possibly the first node (may return true + // sporadically, will not return false sporadically) + bool Push(Node* node); + + // Pop a node (returns NULL if no node is ready - which doesn't indicate that + // the queue is empty!!) + // Thread safe - can be called from multiple threads concurrently + Node* TryPop(); + + // Pop a node. Returns NULL only if the queue was empty at some point after + // calling this function + Node* Pop(); + + private: + MultiProducerSingleConsumerQueue queue_; + Mutex mu_; +}; + +} // namespace grpc_core + +#endif /* GRPC_CORE_LIB_GPRPP_MPSCQ_H */ diff --git a/src/core/lib/iomgr/call_combiner.cc b/src/core/lib/iomgr/call_combiner.cc index 6530d1c6ce6..bfbbb7f385d 100644 --- a/src/core/lib/iomgr/call_combiner.cc +++ b/src/core/lib/iomgr/call_combiner.cc @@ -48,7 +48,6 @@ gpr_atm EncodeCancelStateError(grpc_error* error) { CallCombiner::CallCombiner() { gpr_atm_no_barrier_store(&cancel_state_, 0); gpr_atm_no_barrier_store(&size_, 0); - gpr_mpscq_init(&queue_); #ifdef GRPC_TSAN_ENABLED GRPC_CLOSURE_INIT(&tsan_closure_, TsanClosure, this, grpc_schedule_on_exec_ctx); @@ -56,7 +55,6 @@ CallCombiner::CallCombiner() { } CallCombiner::~CallCombiner() { - gpr_mpscq_destroy(&queue_); GRPC_ERROR_UNREF(DecodeCancelStateError(cancel_state_)); } @@ -140,7 +138,8 @@ void CallCombiner::Start(grpc_closure* closure, grpc_error* error, } // Queue was not empty, so add closure to queue. closure->error_data.error = error; - gpr_mpscq_push(&queue_, reinterpret_cast(closure)); + queue_.Push( + reinterpret_cast(closure)); } } @@ -163,8 +162,8 @@ void CallCombiner::Stop(DEBUG_ARGS const char* reason) { gpr_log(GPR_INFO, " checking queue"); } bool empty; - grpc_closure* closure = reinterpret_cast( - gpr_mpscq_pop_and_check_end(&queue_, &empty)); + grpc_closure* closure = + reinterpret_cast(queue_.PopAndCheckEnd(&empty)); if (closure == nullptr) { // This can happen either due to a race condition within the mpscq // code or because of a race with Start(). diff --git a/src/core/lib/iomgr/call_combiner.h b/src/core/lib/iomgr/call_combiner.h index b56966f4196..c90e565860a 100644 --- a/src/core/lib/iomgr/call_combiner.h +++ b/src/core/lib/iomgr/call_combiner.h @@ -25,8 +25,8 @@ #include -#include "src/core/lib/gpr/mpscq.h" #include "src/core/lib/gprpp/inlined_vector.h" +#include "src/core/lib/gprpp/mpscq.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/closure.h" @@ -108,7 +108,7 @@ class CallCombiner { #endif gpr_atm size_ = 0; // size_t, num closures in queue or currently executing - gpr_mpscq queue_; + MultiProducerSingleConsumerQueue queue_; // Either 0 (if not cancelled and no cancellation closure set), // a grpc_closure* (if the lowest bit is 0), // or a grpc_error* (if the lowest bit is 1). diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index bde3437c02e..c7b2e8299b9 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -22,10 +22,13 @@ #include #include +#include + #include #include -#include -#include "src/core/lib/gpr/mpscq.h" + +#include "src/core/lib/gprpp/manual_constructor.h" +#include "src/core/lib/gprpp/mpscq.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/profiling/timers.h" @@ -69,7 +72,9 @@ struct grpc_closure { * space */ union { grpc_closure* next; - gpr_mpscq_node atm_next; + grpc_core::ManualConstructor< + grpc_core::MultiProducerSingleConsumerQueue::Node> + mpscq_node; uintptr_t scratch; } next_data; diff --git a/src/core/lib/iomgr/combiner.cc b/src/core/lib/iomgr/combiner.cc index 9a6290f29a8..31db1b70bab 100644 --- a/src/core/lib/iomgr/combiner.cc +++ b/src/core/lib/iomgr/combiner.cc @@ -28,6 +28,7 @@ #include #include "src/core/lib/debug/stats.h" +#include "src/core/lib/gprpp/mpscq.h" #include "src/core/lib/iomgr/executor.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/profiling/timers.h" @@ -45,10 +46,10 @@ grpc_core::DebugOnlyTraceFlag grpc_combiner_trace(false, "combiner"); #define STATE_ELEM_COUNT_LOW_BIT 2 struct grpc_combiner { - grpc_combiner* next_combiner_on_this_exec_ctx; + grpc_combiner* next_combiner_on_this_exec_ctx = nullptr; grpc_closure_scheduler scheduler; grpc_closure_scheduler finally_scheduler; - gpr_mpscq queue; + grpc_core::MultiProducerSingleConsumerQueue queue; // either: // a pointer to the initiating exec ctx if that is the only exec_ctx that has // ever queued to this combiner, or NULL. If this is non-null, it's not @@ -58,7 +59,7 @@ struct grpc_combiner { // lower bit - zero if orphaned (STATE_UNORPHANED) // other bits - number of items queued on the lock (STATE_ELEM_COUNT_LOW_BIT) gpr_atm state; - bool time_to_execute_final_list; + bool time_to_execute_final_list = false; grpc_closure_list final_list; grpc_closure offload; gpr_refcount refs; @@ -76,12 +77,11 @@ static const grpc_closure_scheduler_vtable finally_scheduler = { static void offload(void* arg, grpc_error* error); grpc_combiner* grpc_combiner_create(void) { - grpc_combiner* lock = static_cast(gpr_zalloc(sizeof(*lock))); + grpc_combiner* lock = grpc_core::New(); gpr_ref_init(&lock->refs, 1); lock->scheduler.vtable = &scheduler; lock->finally_scheduler.vtable = &finally_scheduler; gpr_atm_no_barrier_store(&lock->state, STATE_UNORPHANED); - gpr_mpscq_init(&lock->queue); grpc_closure_list_init(&lock->final_list); GRPC_CLOSURE_INIT( &lock->offload, offload, lock, @@ -93,8 +93,7 @@ grpc_combiner* grpc_combiner_create(void) { static void really_destroy(grpc_combiner* lock) { GRPC_COMBINER_TRACE(gpr_log(GPR_INFO, "C:%p really_destroy", lock)); GPR_ASSERT(gpr_atm_no_barrier_load(&lock->state) == 0); - gpr_mpscq_destroy(&lock->queue); - gpr_free(lock); + grpc_core::Delete(lock); } static void start_destroy(grpc_combiner* lock) { @@ -185,7 +184,7 @@ static void combiner_exec(grpc_closure* cl, grpc_error* error) { GPR_ASSERT(last & STATE_UNORPHANED); // ensure lock has not been destroyed assert(cl->cb); cl->error_data.error = error; - gpr_mpscq_push(&lock->queue, &cl->next_data.atm_next); + lock->queue.Push(cl->next_data.mpscq_node.get()); } static void move_next() { @@ -249,7 +248,7 @@ bool grpc_combiner_continue_exec_ctx() { // peek to see if something new has shown up, and execute that with // priority (gpr_atm_acq_load(&lock->state) >> 1) > 1) { - gpr_mpscq_node* n = gpr_mpscq_pop(&lock->queue); + grpc_core::MultiProducerSingleConsumerQueue::Node* n = lock->queue.Pop(); GRPC_COMBINER_TRACE( gpr_log(GPR_INFO, "C:%p maybe_finish_one n=%p", lock, n)); if (n == nullptr) { diff --git a/src/core/lib/iomgr/combiner.h b/src/core/lib/iomgr/combiner.h index b9274216993..8401dd97d2d 100644 --- a/src/core/lib/iomgr/combiner.h +++ b/src/core/lib/iomgr/combiner.h @@ -25,7 +25,6 @@ #include #include "src/core/lib/debug/trace.h" -#include "src/core/lib/gpr/mpscq.h" #include "src/core/lib/iomgr/exec_ctx.h" // Provides serialized access to some resource. diff --git a/src/core/lib/surface/completion_queue.cc b/src/core/lib/surface/completion_queue.cc index acdf42eae34..bb249331e12 100644 --- a/src/core/lib/surface/completion_queue.cc +++ b/src/core/lib/surface/completion_queue.cc @@ -210,14 +210,14 @@ struct cq_vtable { namespace { -/* Queue that holds the cq_completion_events. Internally uses gpr_mpscq queue - * (a lockfree multiproducer single consumer queue). It uses a queue_lock - * to support multiple consumers. +/* Queue that holds the cq_completion_events. Internally uses + * MultiProducerSingleConsumerQueue (a lockfree multiproducer single consumer + * queue). It uses a queue_lock to support multiple consumers. * Only used in completion queues whose completion_type is GRPC_CQ_NEXT */ class CqEventQueue { public: - CqEventQueue() { gpr_mpscq_init(&queue_); } - ~CqEventQueue() { gpr_mpscq_destroy(&queue_); } + CqEventQueue() = default; + ~CqEventQueue() = default; /* Note: The counter is not incremented/decremented atomically with push/pop. * The count is only eventually consistent */ @@ -232,7 +232,7 @@ class CqEventQueue { /* Spinlock to serialize consumers i.e pop() operations */ gpr_spinlock queue_lock_ = GPR_SPINLOCK_INITIALIZER; - gpr_mpscq queue_; + grpc_core::MultiProducerSingleConsumerQueue queue_; /* A lazy counter of number of items in the queue. This is NOT atomically incremented/decremented along with push/pop operations and hence is only @@ -462,7 +462,8 @@ int grpc_completion_queue_thread_local_cache_flush(grpc_completion_queue* cq, } bool CqEventQueue::Push(grpc_cq_completion* c) { - gpr_mpscq_push(&queue_, reinterpret_cast(c)); + queue_.Push( + reinterpret_cast(c)); return num_queue_items_.FetchAdd(1, grpc_core::MemoryOrder::RELAXED) == 0; } @@ -473,8 +474,7 @@ grpc_cq_completion* CqEventQueue::Pop() { GRPC_STATS_INC_CQ_EV_QUEUE_TRYLOCK_SUCCESSES(); bool is_empty = false; - c = reinterpret_cast( - gpr_mpscq_pop_and_check_end(&queue_, &is_empty)); + c = reinterpret_cast(queue_.PopAndCheckEnd(&is_empty)); gpr_spinlock_unlock(&queue_lock_); if (c == nullptr && !is_empty) { @@ -1007,8 +1007,9 @@ static grpc_event cq_next(grpc_completion_queue* cq, gpr_timespec deadline, if (cqd->pending_events.Load(grpc_core::MemoryOrder::ACQUIRE) == 0) { /* Before returning, check if the queue has any items left over (since - gpr_mpscq_pop() can sometimes return NULL even if the queue is not - empty. If so, keep retrying but do not return GRPC_QUEUE_SHUTDOWN */ + MultiProducerSingleConsumerQueue::Pop() can sometimes return NULL + even if the queue is not empty. If so, keep retrying but do not + return GRPC_QUEUE_SHUTDOWN */ if (cqd->queue.num_items() > 0) { /* Go to the beginning of the loop. No point doing a poll because (cq->shutdown == true) is only possible when there is no pending diff --git a/src/core/lib/surface/completion_queue.h b/src/core/lib/surface/completion_queue.h index 3ba9fbb8765..dc13bc50f91 100644 --- a/src/core/lib/surface/completion_queue.h +++ b/src/core/lib/surface/completion_queue.h @@ -24,8 +24,10 @@ #include #include + #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/abstract.h" +#include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/iomgr/pollset.h" /* These trace flags default to 1. The corresponding lines are only traced @@ -36,7 +38,8 @@ extern grpc_core::DebugOnlyTraceFlag grpc_trace_pending_tags; extern grpc_core::DebugOnlyTraceFlag grpc_trace_cq_refcount; typedef struct grpc_cq_completion { - gpr_mpscq_node node; + grpc_core::ManualConstructor + node; /** user supplied tag */ void* tag; diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index 2cc7e88cab4..784ffe2b79a 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -34,9 +34,9 @@ #include "src/core/lib/channel/channelz.h" #include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/debug/stats.h" -#include "src/core/lib/gpr/mpscq.h" #include "src/core/lib/gpr/spinlock.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/mpscq.h" #include "src/core/lib/iomgr/executor.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/slice/slice_internal.h" @@ -50,6 +50,8 @@ grpc_core::TraceFlag grpc_server_channel_trace(false, "server_channel"); +using grpc_core::LockedMultiProducerSingleConsumerQueue; + static void server_on_recv_initial_metadata(void* ptr, grpc_error* error); static void server_recv_trailing_metadata_ready(void* user_data, grpc_error* error); @@ -70,7 +72,9 @@ enum requested_call_type { BATCH_CALL, REGISTERED_CALL }; struct registered_method; struct requested_call { - gpr_mpscq_node request_link; /* must be first */ + grpc_core::ManualConstructor< + grpc_core::MultiProducerSingleConsumerQueue::Node> + mpscq_node; requested_call_type type; size_t cq_idx; void* tag; @@ -198,7 +202,7 @@ struct request_matcher { grpc_server* server; call_data* pending_head; call_data* pending_tail; - gpr_locked_mpscq* requests_per_cq; + LockedMultiProducerSingleConsumerQueue* requests_per_cq; }; struct registered_method { @@ -350,17 +354,17 @@ static void channel_broadcaster_shutdown(channel_broadcaster* cb, static void request_matcher_init(request_matcher* rm, grpc_server* server) { rm->server = server; rm->pending_head = rm->pending_tail = nullptr; - rm->requests_per_cq = static_cast( + rm->requests_per_cq = static_cast( gpr_malloc(sizeof(*rm->requests_per_cq) * server->cq_count)); for (size_t i = 0; i < server->cq_count; i++) { - gpr_locked_mpscq_init(&rm->requests_per_cq[i]); + new (&rm->requests_per_cq[i]) LockedMultiProducerSingleConsumerQueue(); } } static void request_matcher_destroy(request_matcher* rm) { for (size_t i = 0; i < rm->server->cq_count; i++) { - GPR_ASSERT(gpr_locked_mpscq_pop(&rm->requests_per_cq[i]) == nullptr); - gpr_locked_mpscq_destroy(&rm->requests_per_cq[i]); + GPR_ASSERT(rm->requests_per_cq[i].Pop() == nullptr); + rm->requests_per_cq[i].~LockedMultiProducerSingleConsumerQueue(); } gpr_free(rm->requests_per_cq); } @@ -389,7 +393,7 @@ static void request_matcher_kill_requests(grpc_server* server, requested_call* rc; for (size_t i = 0; i < server->cq_count; i++) { while ((rc = reinterpret_cast( - gpr_locked_mpscq_pop(&rm->requests_per_cq[i]))) != nullptr) { + rm->requests_per_cq[i].Pop())) != nullptr) { fail_call(server, i, rc, GRPC_ERROR_REF(error)); } } @@ -534,8 +538,8 @@ static void publish_new_rpc(void* arg, grpc_error* error) { for (size_t i = 0; i < server->cq_count; i++) { size_t cq_idx = (chand->cq_idx + i) % server->cq_count; - requested_call* rc = reinterpret_cast( - gpr_locked_mpscq_try_pop(&rm->requests_per_cq[cq_idx])); + requested_call* rc = + reinterpret_cast(rm->requests_per_cq[cq_idx].TryPop()); if (rc == nullptr) { continue; } else { @@ -556,8 +560,8 @@ static void publish_new_rpc(void* arg, grpc_error* error) { // added to the pending list. for (size_t i = 0; i < server->cq_count; i++) { size_t cq_idx = (chand->cq_idx + i) % server->cq_count; - requested_call* rc = reinterpret_cast( - gpr_locked_mpscq_pop(&rm->requests_per_cq[cq_idx])); + requested_call* rc = + reinterpret_cast(rm->requests_per_cq[cq_idx].Pop()); if (rc == nullptr) { continue; } else { @@ -1430,13 +1434,12 @@ static grpc_call_error queue_call_request(grpc_server* server, size_t cq_idx, rm = &rc->data.registered.method->matcher; break; } - if (gpr_locked_mpscq_push(&rm->requests_per_cq[cq_idx], &rc->request_link)) { + if (rm->requests_per_cq[cq_idx].Push(rc->mpscq_node.get())) { /* this was the first queued request: we need to lock and start matching calls */ gpr_mu_lock(&server->mu_call); while ((calld = rm->pending_head) != nullptr) { - rc = reinterpret_cast( - gpr_locked_mpscq_pop(&rm->requests_per_cq[cq_idx])); + rc = reinterpret_cast(rm->requests_per_cq[cq_idx].Pop()); if (rc == nullptr) break; rm->pending_head = calld->pending_next; gpr_mu_unlock(&server->mu_call); diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 6eb8bc8c9c1..30caf49806c 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -32,7 +32,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/gpr/log_linux.cc', 'src/core/lib/gpr/log_posix.cc', 'src/core/lib/gpr/log_windows.cc', - 'src/core/lib/gpr/mpscq.cc', 'src/core/lib/gpr/murmur_hash.cc', 'src/core/lib/gpr/string.cc', 'src/core/lib/gpr/string_posix.cc', @@ -54,6 +53,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/gprpp/fork.cc', 'src/core/lib/gprpp/global_config_env.cc', 'src/core/lib/gprpp/host_port.cc', + 'src/core/lib/gprpp/mpscq.cc', 'src/core/lib/gprpp/thd_posix.cc', 'src/core/lib/gprpp/thd_windows.cc', 'src/core/lib/profiling/basic_timers.cc', diff --git a/test/core/gpr/BUILD b/test/core/gpr/BUILD index c2b2576ff03..c4ee5e977ad 100644 --- a/test/core/gpr/BUILD +++ b/test/core/gpr/BUILD @@ -68,17 +68,6 @@ grpc_cc_test( ], ) -grpc_cc_test( - name = "mpscq_test", - srcs = ["mpscq_test.cc"], - exec_compatible_with = ["//third_party/toolchains/machine_size:large"], - language = "C++", - deps = [ - "//:gpr", - "//test/core/util:grpc_test_util", - ], -) - grpc_cc_test( name = "murmur_hash_test", srcs = ["murmur_hash_test.cc"], diff --git a/test/core/gprpp/BUILD b/test/core/gprpp/BUILD index 5cee96a3ad2..142fcbb571b 100644 --- a/test/core/gprpp/BUILD +++ b/test/core/gprpp/BUILD @@ -113,6 +113,17 @@ grpc_cc_test( ], ) +grpc_cc_test( + name = "mpscq_test", + srcs = ["mpscq_test.cc"], + exec_compatible_with = ["//third_party/toolchains/machine_size:large"], + language = "C++", + deps = [ + "//:gpr", + "//test/core/util:grpc_test_util", + ], +) + grpc_cc_test( name = "optional_test", srcs = ["optional_test.cc"], diff --git a/test/core/gpr/mpscq_test.cc b/test/core/gprpp/mpscq_test.cc similarity index 85% rename from test/core/gpr/mpscq_test.cc rename to test/core/gprpp/mpscq_test.cc index 744cea934c5..a3b6bb59e4b 100644 --- a/test/core/gpr/mpscq_test.cc +++ b/test/core/gprpp/mpscq_test.cc @@ -16,7 +16,7 @@ * */ -#include "src/core/lib/gpr/mpscq.h" +#include "src/core/lib/gprpp/mpscq.h" #include #include @@ -29,14 +29,16 @@ #include "src/core/lib/gprpp/thd.h" #include "test/core/util/test_config.h" +using grpc_core::MultiProducerSingleConsumerQueue; + typedef struct test_node { - gpr_mpscq_node node; + MultiProducerSingleConsumerQueue::Node node; size_t i; size_t* ctr; } test_node; static test_node* new_node(size_t i, size_t* ctr) { - test_node* n = static_cast(gpr_malloc(sizeof(test_node))); + test_node* n = grpc_core::New(); n->i = i; n->ctr = ctr; return n; @@ -44,13 +46,12 @@ static test_node* new_node(size_t i, size_t* ctr) { static void test_serial(void) { gpr_log(GPR_DEBUG, "test_serial"); - gpr_mpscq q; - gpr_mpscq_init(&q); + MultiProducerSingleConsumerQueue q; for (size_t i = 0; i < 10000000; i++) { - gpr_mpscq_push(&q, &new_node(i, nullptr)->node); + q.Push(&new_node(i, nullptr)->node); } for (size_t i = 0; i < 10000000; i++) { - test_node* n = reinterpret_cast(gpr_mpscq_pop(&q)); + test_node* n = reinterpret_cast(q.Pop()); GPR_ASSERT(n); GPR_ASSERT(n->i == i); gpr_free(n); @@ -59,7 +60,7 @@ static void test_serial(void) { typedef struct { size_t ctr; - gpr_mpscq* q; + MultiProducerSingleConsumerQueue* q; gpr_event* start; } thd_args; @@ -69,7 +70,7 @@ static void test_thread(void* args) { thd_args* a = static_cast(args); gpr_event_wait(a->start, gpr_inf_future(GPR_CLOCK_REALTIME)); for (size_t i = 1; i <= THREAD_ITERATIONS; i++) { - gpr_mpscq_push(a->q, &new_node(i, &a->ctr)->node); + a->q->Push(&new_node(i, &a->ctr)->node); } } @@ -79,8 +80,7 @@ static void test_mt(void) { gpr_event_init(&start); grpc_core::Thread thds[100]; thd_args ta[GPR_ARRAY_SIZE(thds)]; - gpr_mpscq q; - gpr_mpscq_init(&q); + MultiProducerSingleConsumerQueue q; for (size_t i = 0; i < GPR_ARRAY_SIZE(thds); i++) { ta[i].ctr = 0; ta[i].q = &q; @@ -92,8 +92,8 @@ static void test_mt(void) { size_t spins = 0; gpr_event_set(&start, (void*)1); while (num_done != GPR_ARRAY_SIZE(thds)) { - gpr_mpscq_node* n; - while ((n = gpr_mpscq_pop(&q)) == nullptr) { + MultiProducerSingleConsumerQueue::Node* n; + while ((n = q.Pop()) == nullptr) { spins++; } test_node* tn = reinterpret_cast(n); @@ -106,7 +106,6 @@ static void test_mt(void) { for (auto& th : thds) { th.Join(); } - gpr_mpscq_destroy(&q); } typedef struct { @@ -115,7 +114,7 @@ typedef struct { gpr_mu mu; size_t num_done; size_t spins; - gpr_mpscq* q; + MultiProducerSingleConsumerQueue* q; gpr_event* start; } pull_args; @@ -129,8 +128,8 @@ static void pull_thread(void* arg) { gpr_mu_unlock(&pa->mu); return; } - gpr_mpscq_node* n; - while ((n = gpr_mpscq_pop(pa->q)) == nullptr) { + MultiProducerSingleConsumerQueue::Node* n; + while ((n = pa->q->Pop()) == nullptr) { pa->spins++; } test_node* tn = reinterpret_cast(n); @@ -149,8 +148,7 @@ static void test_mt_multipop(void) { grpc_core::Thread thds[50]; grpc_core::Thread pull_thds[50]; thd_args ta[GPR_ARRAY_SIZE(thds)]; - gpr_mpscq q; - gpr_mpscq_init(&q); + MultiProducerSingleConsumerQueue q; for (size_t i = 0; i < GPR_ARRAY_SIZE(thds); i++) { ta[i].ctr = 0; ta[i].q = &q; @@ -179,7 +177,6 @@ static void test_mt_multipop(void) { th.Join(); } gpr_mu_destroy(&pa.mu); - gpr_mpscq_destroy(&q); } int main(int argc, char** argv) { diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 3b7af742baa..6a37a440479 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1089,7 +1089,6 @@ src/core/lib/debug/trace.h \ src/core/lib/gpr/alloc.h \ src/core/lib/gpr/arena.h \ src/core/lib/gpr/env.h \ -src/core/lib/gpr/mpscq.h \ src/core/lib/gpr/murmur_hash.h \ src/core/lib/gpr/spinlock.h \ src/core/lib/gpr/string.h \ @@ -1115,6 +1114,7 @@ src/core/lib/gprpp/inlined_vector.h \ src/core/lib/gprpp/manual_constructor.h \ src/core/lib/gprpp/map.h \ src/core/lib/gprpp/memory.h \ +src/core/lib/gprpp/mpscq.h \ src/core/lib/gprpp/optional.h \ src/core/lib/gprpp/orphanable.h \ src/core/lib/gprpp/pair.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index ed6f88dde3c..0878bb4de49 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1203,8 +1203,6 @@ src/core/lib/gpr/log_android.cc \ src/core/lib/gpr/log_linux.cc \ src/core/lib/gpr/log_posix.cc \ src/core/lib/gpr/log_windows.cc \ -src/core/lib/gpr/mpscq.cc \ -src/core/lib/gpr/mpscq.h \ src/core/lib/gpr/murmur_hash.cc \ src/core/lib/gpr/murmur_hash.h \ src/core/lib/gpr/spinlock.h \ @@ -1252,6 +1250,8 @@ src/core/lib/gprpp/inlined_vector.h \ src/core/lib/gprpp/manual_constructor.h \ src/core/lib/gprpp/map.h \ src/core/lib/gprpp/memory.h \ +src/core/lib/gprpp/mpscq.cc \ +src/core/lib/gprpp/mpscq.h \ src/core/lib/gprpp/optional.h \ src/core/lib/gprpp/orphanable.h \ src/core/lib/gprpp/pair.h \ diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 8f0b447abac..28140a8e71a 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -955,30 +955,6 @@ ], "uses_polling": false }, - { - "args": [], - "benchmark": false, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 30, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "gtest": false, - "language": "c", - "name": "gpr_mpscq_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "uses_polling": false - }, { "args": [], "benchmark": false, @@ -4739,6 +4715,30 @@ ], "uses_polling": false }, + { + "args": [], + "benchmark": false, + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 30, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": false, + "language": "c++", + "name": "gprpp_mpscq_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "uses_polling": false + }, { "args": [], "benchmark": false, From 7235091dc26918f1b112d706786ca62b6ca17b45 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 5 Sep 2019 10:41:32 -0700 Subject: [PATCH 565/661] Don't start AuthMetadataProcessor threadpool for non-blocking processor --- src/cpp/server/secure_server_credentials.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cpp/server/secure_server_credentials.h b/src/cpp/server/secure_server_credentials.h index 24b133cf7f0..cc5ed1e1f92 100644 --- a/src/cpp/server/secure_server_credentials.h +++ b/src/cpp/server/secure_server_credentials.h @@ -46,7 +46,11 @@ class AuthMetadataProcessorAyncWrapper final { AuthMetadataProcessorAyncWrapper( const std::shared_ptr& processor) - : thread_pool_(CreateDefaultThreadPool()), processor_(processor) {} + : processor_(processor) { + if (processor && processor->IsBlocking()) { + thread_pool_.reset(CreateDefaultThreadPool()); + } + } private: void InvokeProcessor(grpc_auth_context* context, const grpc_metadata* md, From 63cd77c835de2d0ea56d7a3535eb3dc2a975071d Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 5 Sep 2019 11:01:46 -0700 Subject: [PATCH 566/661] Fix transport manager shutdown queuing --- src/objective-c/GRPCClient/private/GRPCTransport+Private.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m index 5e9c2b52ab4..1ce9e8940ef 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m @@ -46,11 +46,10 @@ return self; } +// Must be called on _dispatchQueue or queues targeted by _dispatchQueue - (void)shutDown { - dispatch_async(_dispatchQueue, ^{ - self->_transport = nil; - self->_previousInterceptor = nil; - }); + _transport = nil; + _previousInterceptor = nil; } - (dispatch_queue_t)dispatchQueue { From ecf7274aaae21a2828b393c263520901a5fbad53 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 5 Sep 2019 11:41:36 -0700 Subject: [PATCH 567/661] Add docstring to py2and3_test --- bazel/python_rules.bzl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl index e7e9e597b05..373895fc94d 100644 --- a/bazel/python_rules.bzl +++ b/bazel/python_rules.bzl @@ -183,6 +183,12 @@ def py_grpc_library( def py2and3_test(name, py_test = native.py_test, **kwargs): + """Runs a Python test under both Python 2 and Python 3. + + Args: + name: The name of the test. + py_test: The rule to use for each test. + """ if "python_version" in kwargs: fail("Cannot specify 'python_version' in py2and3_test.") From 04dd147b411dfbb203df73d8b2b39f82338691e9 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 5 Sep 2019 12:24:26 -0700 Subject: [PATCH 568/661] Add Python 3.6 to default gRPC Python test environments --- tools/run_tests/run_tests.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 1ff37ca85af..a90f6e3245e 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -846,6 +846,7 @@ class PythonLanguage(object): else: return ( python27_config, + python36_config, python37_config, ) elif args.compiler == 'python2.7': From c11539f79e75e6f6dd4fb17debe4e4f09755f07e Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 5 Sep 2019 12:32:58 -0700 Subject: [PATCH 569/661] Document kwargs --- bazel/python_rules.bzl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl index 373895fc94d..356c62d673a 100644 --- a/bazel/python_rules.bzl +++ b/bazel/python_rules.bzl @@ -188,6 +188,8 @@ def py2and3_test(name, Args: name: The name of the test. py_test: The rule to use for each test. + **kwargs: Keyword arguments passed directly to the underlying py_test + rule. """ if "python_version" in kwargs: fail("Cannot specify 'python_version' in py2and3_test.") From 9f02fc7f91aa40e364835b4cf9fe9e78429d9ffb Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Wed, 21 Aug 2019 14:54:56 -0700 Subject: [PATCH 570/661] Enable end2end C++ tests on iOS. Some e2e tests were disabled on iOS because they hit the Apple CFStream bug. This commit enables e2e tests and works around the Apple bug by disabling CFStream. --- test/cpp/common/time_jump_test.cc | 2 +- test/cpp/end2end/BUILD | 8 +- test/cpp/end2end/channelz_service_test.cc | 8 +- .../end2end/client_callback_end2end_test.cc | 6 ++ test/cpp/end2end/client_lb_end2end_test.cc | 5 ++ test/cpp/end2end/end2end_test.cc | 14 +++- test/cpp/end2end/grpclb_end2end_test.cc | 5 ++ test/cpp/end2end/hybrid_end2end_test.cc | 8 ++ test/cpp/end2end/port_sharing_end2end_test.cc | 7 ++ test/cpp/end2end/thread_stress_test.cc | 8 +- test/cpp/end2end/xds_end2end_test.cc | 4 + .../UnitTesting/GTMGoogleTestRunner.mm | 83 +++++++++---------- 12 files changed, 100 insertions(+), 58 deletions(-) diff --git a/test/cpp/common/time_jump_test.cc b/test/cpp/common/time_jump_test.cc index ea6711dfce3..a997982d9fa 100644 --- a/test/cpp/common/time_jump_test.cc +++ b/test/cpp/common/time_jump_test.cc @@ -121,7 +121,7 @@ TEST_P(TimeJumpTest, TimedWait) { GPR_ASSERT(1 == gpr_time_similar(gpr_time_sub(after, before), gpr_time_from_millis(kWaitTimeMs, GPR_TIMESPAN), - gpr_time_from_millis(10, GPR_TIMESPAN))); + gpr_time_from_millis(50, GPR_TIMESPAN))); thd.join(); } diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index 1b487602a7a..9153439341f 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -165,7 +165,6 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], - tags = ["no_test_ios"], ) grpc_cc_test( @@ -224,6 +223,7 @@ grpc_cc_library( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], + alwayslink = 1, ) grpc_cc_test( @@ -272,6 +272,7 @@ grpc_cc_test( # system uses it to specialize targets "//:grpc++", ], + tags = ["no_test_ios"], ) grpc_cc_test( @@ -441,7 +442,6 @@ grpc_cc_test( "//test/core/util:test_lb_policies", "//test/cpp/util:test_util", ], - tags = ["no_test_ios"], ) grpc_cc_test( @@ -482,7 +482,6 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], - tags = ["no_test_ios"], ) grpc_cc_test( @@ -505,7 +504,6 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], - tags = ["no_test_ios"], ) grpc_cc_test( @@ -698,7 +696,6 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], - tags = ["no_test_ios"], ) grpc_cc_test( @@ -756,5 +753,4 @@ grpc_cc_test( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], - tags = ["no_test_ios"], ) diff --git a/test/cpp/end2end/channelz_service_test.cc b/test/cpp/end2end/channelz_service_test.cc index 1ed2d8c65f2..325a6ef7094 100644 --- a/test/cpp/end2end/channelz_service_test.cc +++ b/test/cpp/end2end/channelz_service_test.cc @@ -29,6 +29,7 @@ #include #include +#include "src/core/lib/gpr/env.h" #include "src/proto/grpc/channelz/channelz.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" @@ -104,7 +105,12 @@ class Proxy : public ::grpc::testing::EchoTestService::Service { class ChannelzServerTest : public ::testing::Test { public: ChannelzServerTest() {} - + static void SetUpTestCase() { +#if TARGET_OS_IPHONE + // Workaround Apple CFStream bug + gpr_setenv("grpc_cfstream", "0"); +#endif + } void SetUp() override { // ensure channel server is brought up on all severs we build. ::grpc::channelz::experimental::InitChannelzService(); diff --git a/test/cpp/end2end/client_callback_end2end_test.cc b/test/cpp/end2end/client_callback_end2end_test.cc index a54158ac1d1..c4375b884ee 100644 --- a/test/cpp/end2end/client_callback_end2end_test.cc +++ b/test/cpp/end2end/client_callback_end2end_test.cc @@ -32,6 +32,7 @@ #include #include +#include "src/core/lib/gpr/env.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" @@ -1336,6 +1337,11 @@ TEST_P(ClientCallbackEnd2endTest, } std::vector CreateTestScenarios(bool test_insecure) { +#if TARGET_OS_IPHONE + // Workaround Apple CFStream bug + gpr_setenv("grpc_cfstream", "0"); +#endif + std::vector scenarios; std::vector credentials_types{ GetCredentialsProvider()->GetSecureCredentialsTypeList()}; diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index 1a96aafd7a1..e0b4b074ff2 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -45,6 +45,7 @@ #include "src/core/ext/filters/client_channel/service_config.h" #include "src/core/lib/backoff/backoff.h" #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gpr/env.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/tcp_client.h" @@ -220,6 +221,10 @@ class ClientLbEnd2endTest : public ::testing::Test { // Make the backup poller poll very frequently in order to pick up // updates from all the subchannels's FDs. GPR_GLOBAL_CONFIG_SET(grpc_client_channel_backup_poll_interval_ms, 1); +#if TARGET_OS_IPHONE + // Workaround Apple CFStream bug + gpr_setenv("grpc_cfstream", "0"); +#endif } void SetUp() override { grpc_init(); } diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index a8592fd97c2..a5a9675d14d 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -36,6 +36,7 @@ #include #include "src/core/ext/filters/client_channel/backup_poller.h" +#include "src/core/lib/gpr/env.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" @@ -254,6 +255,8 @@ void TestScenario::Log() const { class End2endTest : public ::testing::TestWithParam { protected: + static void SetUpTestCase() { grpc_init(); } + static void TearDownTestCase() { grpc_shutdown(); } End2endTest() : is_server_started_(false), kMaxMessageSize_(8192), @@ -2106,6 +2109,13 @@ std::vector CreateTestScenarios(bool use_proxy, bool test_callback_server) { std::vector scenarios; std::vector credentials_types; + + GPR_GLOBAL_CONFIG_SET(grpc_client_channel_backup_poll_interval_ms, 200); +#if TARGET_OS_IPHONE + // Workaround Apple CFStream bug + gpr_setenv("grpc_cfstream", "0"); +#endif + if (test_secure) { credentials_types = GetCredentialsProvider()->GetSecureCredentialsTypeList(); @@ -2173,12 +2183,8 @@ INSTANTIATE_TEST_CASE_P( } // namespace grpc int main(int argc, char** argv) { - GPR_GLOBAL_CONFIG_SET(grpc_client_channel_backup_poll_interval_ms, 200); grpc::testing::TestEnvironment env(argc, argv); - // The grpc_init is to cover the MAYBE_SKIP_TEST. - grpc_init(); ::testing::InitGoogleTest(&argc, argv); int ret = RUN_ALL_TESTS(); - grpc_shutdown(); return ret; } diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc index d71dafc855f..8f0b4cef2ee 100644 --- a/test/cpp/end2end/grpclb_end2end_test.cc +++ b/test/cpp/end2end/grpclb_end2end_test.cc @@ -39,6 +39,7 @@ #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" #include "src/core/ext/filters/client_channel/server_address.h" #include "src/core/ext/filters/client_channel/service_config.h" +#include "src/core/lib/gpr/env.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/security/credentials/fake/fake_credentials.h" @@ -378,6 +379,10 @@ class GrpclbEnd2endTest : public ::testing::Test { // Make the backup poller poll very frequently in order to pick up // updates from all the subchannels's FDs. GPR_GLOBAL_CONFIG_SET(grpc_client_channel_backup_poll_interval_ms, 1); +#if TARGET_OS_IPHONE + // Workaround Apple CFStream bug + gpr_setenv("grpc_cfstream", "0"); +#endif grpc_init(); } diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc index 75001f0ab27..58ee1e3abb3 100644 --- a/test/cpp/end2end/hybrid_end2end_test.cc +++ b/test/cpp/end2end/hybrid_end2end_test.cc @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gpr/env.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" @@ -229,6 +230,13 @@ class HybridEnd2endTest : public ::testing::TestWithParam { protected: HybridEnd2endTest() {} + static void SetUpTestCase() { +#if TARGET_OS_IPHONE + // Workaround Apple CFStream bug + gpr_setenv("grpc_cfstream", "0"); +#endif + } + void SetUp() override { inproc_ = (::testing::UnitTest::GetInstance() ->current_test_info() diff --git a/test/cpp/end2end/port_sharing_end2end_test.cc b/test/cpp/end2end/port_sharing_end2end_test.cc index 4f30290d815..2c094c523c0 100644 --- a/test/cpp/end2end/port_sharing_end2end_test.cc +++ b/test/cpp/end2end/port_sharing_end2end_test.cc @@ -33,6 +33,7 @@ #include #include +#include "src/core/lib/gpr/env.h" #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/pollset.h" @@ -310,6 +311,12 @@ static void SendRpc(EchoTestService::Stub* stub, int num_rpcs) { std::vector CreateTestScenarios() { std::vector scenarios; std::vector credentials_types; + +#if TARGET_OS_IPHONE + // Workaround Apple CFStream bug + gpr_setenv("grpc_cfstream", "0"); +#endif + credentials_types = GetCredentialsProvider()->GetSecureCredentialsTypeList(); // Only allow insecure credentials type when it is registered with the // provider. User may create providers that do not have insecure. diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index eb8e7958b4b..fee20c82679 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -31,6 +31,7 @@ #include #include +#include "src/core/lib/gpr/env.h" #include "src/core/lib/surface/api_trace.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" @@ -66,7 +67,12 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { template class CommonStressTest { public: - CommonStressTest() : kMaxMessageSize_(8192) {} + CommonStressTest() : kMaxMessageSize_(8192) { +#if TARGET_OS_IPHONE + // Workaround Apple CFStream bug + gpr_setenv("grpc_cfstream", "0"); +#endif + } virtual ~CommonStressTest() {} virtual void SetUp() = 0; virtual void TearDown() = 0; diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 17436bbc13a..2d506c56c87 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -521,6 +521,10 @@ class XdsEnd2endTest : public ::testing::Test { // Make the backup poller poll very frequently in order to pick up // updates from all the subchannels's FDs. GPR_GLOBAL_CONFIG_SET(grpc_client_channel_backup_poll_interval_ms, 1); +#if TARGET_OS_IPHONE + // Workaround Apple CFStream bug + gpr_setenv("grpc_cfstream", "0"); +#endif grpc_init(); } diff --git a/third_party/objective_c/google_toolbox_for_mac/UnitTesting/GTMGoogleTestRunner.mm b/third_party/objective_c/google_toolbox_for_mac/UnitTesting/GTMGoogleTestRunner.mm index 3e8e9245fd4..20b2855cfb1 100644 --- a/third_party/objective_c/google_toolbox_for_mac/UnitTesting/GTMGoogleTestRunner.mm +++ b/third_party/objective_c/google_toolbox_for_mac/UnitTesting/GTMGoogleTestRunner.mm @@ -20,14 +20,14 @@ #error "This file requires ARC support." #endif -// This is a SenTest/XCTest based unit test that will run all of the GoogleTest +// This is a XCTest based unit test that will run all of the GoogleTest // https://code.google.com/p/googletest/ -// based tests in the project, and will report results correctly via SenTest so +// based tests in the project, and will report results correctly via XCTest so // that Xcode can pick them up in it's UI. -// SenTest dynamically creates one SenTest per GoogleTest. +// XCTest dynamically creates one XCTest per GoogleTest. // GoogleTest is set up using a custom event listener (GoogleTestPrinter) -// which knows how to log GoogleTest test results in a manner that SenTest (and +// which knows how to log GoogleTest test results in a manner that XCTest (and // the Xcode IDE) understand. // Note that this does not able you to control individual tests from the Xcode @@ -39,33 +39,30 @@ // project because of it's dependency on https://code.google.com/p/googletest/ // To use this: -// - If you are using XCTest (vs SenTest) make sure to define GTM_USING_XCTEST -// in the settings for your testing bundle. // - Add GTMGoogleTestRunner to your test bundle sources. // - Add gtest-all.cc from gtest to your test bundle sources. // - Write some C++ tests and add them to your test bundle sources. // - Build and run tests. Your C++ tests should just execute. -// If you are using this with XCTest (as opposed to SenTestingKit) -// make sure to define GTM_USING_XCTEST. -#ifndef GTM_USING_XCTEST -#define GTM_USING_XCTEST 0 -#endif +// NOTE: +// A key difference between how GTMGoogleTestRunner runs tests versus how a +// "standard" unit test package runs tests is that SetUpTestSuite/SetupTestCase +// and TeardownTestSuite/TeardownTestCase are going to be called before/after +// *every* individual test. Unfortunately this is due to restrictions in the +// design of GoogleTest in that the only way to run individual tests is to +// use a filter to focus on a specific test, and then "run" all the tests +// multiple times. +// If you have state that you need maintained across tests (not normally a +// great idea anyhow), using SetUp*, Teardown* is not going to work for you. -#if GTM_USING_XCTEST #import -#define SenTestCase XCTestCase -#define SenTestSuite XCTestSuite -#else // GTM_USING_XCTEST -#import -#endif // GTM_USING_XCTEST - #import #include using ::testing::EmptyTestEventListener; using ::testing::TestCase; +using ::testing::TestEventListener; using ::testing::TestEventListeners; using ::testing::TestInfo; using ::testing::TestPartResult; @@ -75,18 +72,19 @@ using ::testing::UnitTest; namespace { // A gtest printer that takes care of reporting gtest results via the -// SenTest interface. Note that a test suite in SenTest == a test case in gtest -// and a test case in SenTest == a test in gtest. +// XCTest interface. Note that a test suite in XCTest == a test case in gtest +// and a test case in XCTest == a test in gtest. // This will handle fatal and non-fatal gtests properly. class GoogleTestPrinter : public EmptyTestEventListener { public: - GoogleTestPrinter(SenTestCase *test_case) : test_case_(test_case) {} + GoogleTestPrinter(XCTestCase *test_case) : test_case_(test_case) {} virtual ~GoogleTestPrinter() {} virtual void OnTestPartResult(const TestPartResult &test_part_result) { if (!test_part_result.passed()) { - NSString *file = @(test_part_result.file_name()); + const char *file_name = test_part_result.file_name(); + NSString *file = @(file_name ? file_name : ""); int line = test_part_result.line_number(); NSString *summary = @(test_part_result.summary()); @@ -94,26 +92,16 @@ class GoogleTestPrinter : public EmptyTestEventListener { // the Xcode UI, so we clean them up. NSString *oneLineSummary = [summary stringByReplacingOccurrencesOfString:@"\n" withString:@" "]; -#if GTM_USING_XCTEST BOOL expected = test_part_result.nonfatally_failed(); [test_case_ recordFailureWithDescription:oneLineSummary inFile:file atLine:line expected:expected]; -#else // GTM_USING_XCTEST - NSException *exception = - [NSException failureInFile:file - atLine:line - withDescription:@"%@", oneLineSummary]; - - // failWithException: will log appropriately. - [test_case_ failWithException:exception]; -#endif // GTM_USING_XCTEST } } private: - SenTestCase *test_case_; + XCTestCase *test_case_; }; NSString *SelectorNameFromGTestName(NSString *testName) { @@ -127,7 +115,7 @@ NSString *SelectorNameFromGTestName(NSString *testName) { // GTMGoogleTestRunner is a GTMTestCase that makes a sub test suite populated // with all of the GoogleTest unit tests. -@interface GTMGoogleTestRunner : SenTestCase { +@interface GTMGoogleTestRunner : XCTestCase { NSString *testName_; } @@ -154,8 +142,7 @@ NSString *SelectorNameFromGTestName(NSString *testName) { + (id)defaultTestSuite { [GTMGoogleTestRunner initGoogleTest]; - SenTestSuite *result = - [[SenTestSuite alloc] initWithName:NSStringFromClass(self)]; + XCTestSuite *result = [[XCTestSuite alloc] initWithName:NSStringFromClass(self)]; UnitTest *test = UnitTest::GetInstance(); // Walk the GoogleTest tests, adding sub tests and sub suites as appropriate. @@ -163,15 +150,14 @@ NSString *SelectorNameFromGTestName(NSString *testName) { for (int i = 0; i < total_test_case_count; ++i) { const TestCase *test_case = test->GetTestCase(i); int total_test_count = test_case->total_test_count(); - SenTestSuite *subSuite = - [[SenTestSuite alloc] initWithName:@(test_case->name())]; + XCTestSuite *subSuite = [[XCTestSuite alloc] initWithName:@(test_case->name())]; [result addTest:subSuite]; for (int j = 0; j < total_test_count; ++j) { const TestInfo *test_info = test_case->GetTestInfo(j); NSString *testName = [NSString stringWithFormat:@"%s.%s", test_case->name(), test_info->name()]; - SenTestCase *senTest = [[self alloc] initWithName:testName]; - [subSuite addTest:senTest]; + XCTestCase *xcTest = [[self alloc] initWithName:testName]; + [subSuite addTest:xcTest]; } } return result; @@ -201,7 +187,7 @@ NSString *SelectorNameFromGTestName(NSString *testName) { } - (NSString *)name { - // A SenTest name must be "-[foo bar]" or it won't be parsed properly. + // An XCTest name must be "-[foo bar]" or it won't be parsed properly. NSRange dot = [testName_ rangeOfString:@"."]; return [NSString stringWithFormat:@"-[%@ %@]", [testName_ substringToIndex:dot.location], @@ -214,11 +200,15 @@ NSString *SelectorNameFromGTestName(NSString *testName) { // Gets hold of the event listener list. TestEventListeners& listeners = UnitTest::GetInstance()->listeners(); - // Adds a listener to the end. Google Test takes the ownership. - listeners.Append(new GoogleTestPrinter(self)); + // Adds a listener to the end. + GoogleTestPrinter printer = GoogleTestPrinter(self); + listeners.Append(&printer); - // Remove the default printer. - delete listeners.Release(listeners.default_result_printer()); + // Remove the default printer if it exists. + TestEventListener *defaultListener = listeners.default_result_printer(); + if (defaultListener) { + delete listeners.Release(defaultListener); + } // Since there is no way of running a single GoogleTest directly, we use the // filter mechanism in GoogleTest to simulate it for us. @@ -228,6 +218,9 @@ NSString *SelectorNameFromGTestName(NSString *testName) { // the output appropriately, and there is no reason to mark this test as // "failed" if RUN_ALL_TESTS returns non-zero. (void)RUN_ALL_TESTS(); + + // Remove the listener that we added. + listeners.Release(&printer); } @end From e6e5d2d5318ddbc218e2a02896f6be4c931e7329 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Thu, 5 Sep 2019 14:18:35 -0700 Subject: [PATCH 571/661] Use libc++ for clang sanity test --- Makefile | 24 ++++++++++++------------ build.yaml | 35 ++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index d48b36a531f..1e8acd7e99e 100644 --- a/Makefile +++ b/Makefile @@ -86,8 +86,8 @@ CC_asan-trace-cmp = clang CXX_asan-trace-cmp = clang++ LD_asan-trace-cmp = clang++ LDXX_asan-trace-cmp = clang++ -CPPFLAGS_asan-trace-cmp = -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize-coverage=trace-cmp -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS -LDFLAGS_asan-trace-cmp = -fsanitize=address +CPPFLAGS_asan-trace-cmp = -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize-coverage=trace-cmp -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS +LDFLAGS_asan-trace-cmp = -stdlib=libc++ -fsanitize=address VALID_CONFIG_dbg = 1 CC_dbg = $(DEFAULT_CC) @@ -103,8 +103,8 @@ CC_asan = clang CXX_asan = clang++ LD_asan = clang++ LDXX_asan = clang++ -CPPFLAGS_asan = -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS -LDFLAGS_asan = -fsanitize=address +CPPFLAGS_asan = -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS +LDFLAGS_asan = -stdlib=libc++ -fsanitize=address VALID_CONFIG_msan = 1 REQUIRE_CUSTOM_LIBRARIES_msan = 1 @@ -112,8 +112,8 @@ CC_msan = clang CXX_msan = clang++ LD_msan = clang++ LDXX_msan = clang++ -CPPFLAGS_msan = -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=memory -fsanitize-memory-track-origins -fsanitize-memory-use-after-dtor -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-command-line-argument -fPIE -pie -DGPR_NO_DIRECT_SYSCALLS -LDFLAGS_msan = -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -fPIE -pie $(if $(JENKINS_BUILD),-Wl$(comma)-Ttext-segment=0x7e0000000000,) +CPPFLAGS_msan = -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize=memory -fsanitize-memory-track-origins -fsanitize-memory-use-after-dtor -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-command-line-argument -fPIE -pie -DGPR_NO_DIRECT_SYSCALLS +LDFLAGS_msan = -stdlib=libc++ -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -fPIE -pie $(if $(JENKINS_BUILD),-Wl$(comma)-Ttext-segment=0x7e0000000000,) DEFINES_msan = NDEBUG VALID_CONFIG_basicprof = 1 @@ -139,8 +139,8 @@ CC_asan-noleaks = clang CXX_asan-noleaks = clang++ LD_asan-noleaks = clang++ LDXX_asan-noleaks = clang++ -CPPFLAGS_asan-noleaks = -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS -LDFLAGS_asan-noleaks = -fsanitize=address +CPPFLAGS_asan-noleaks = -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS +LDFLAGS_asan-noleaks = -stdlib=libc++ -fsanitize=address VALID_CONFIG_noexcept = 1 CC_noexcept = $(DEFAULT_CC) @@ -157,8 +157,8 @@ CC_ubsan = clang CXX_ubsan = clang++ LD_ubsan = clang++ LDXX_ubsan = clang++ -CPPFLAGS_ubsan = -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=undefined -fno-omit-frame-pointer -Wno-unused-command-line-argument -Wvarargs -LDFLAGS_ubsan = -fsanitize=undefined,unsigned-integer-overflow +CPPFLAGS_ubsan = -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize=undefined -fno-omit-frame-pointer -Wno-unused-command-line-argument -Wvarargs +LDFLAGS_ubsan = -stdlib=libc++ -fsanitize=undefined,unsigned-integer-overflow DEFINES_ubsan = NDEBUG GRPC_UBSAN VALID_CONFIG_tsan = 1 @@ -167,8 +167,8 @@ CC_tsan = clang CXX_tsan = clang++ LD_tsan = clang++ LDXX_tsan = clang++ -CPPFLAGS_tsan = -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS -LDFLAGS_tsan = -fsanitize=thread +CPPFLAGS_tsan = -O0 -stdlib=libc++ -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS +LDFLAGS_tsan = -stdlib=libc++ -fsanitize=thread DEFINES_tsan = GRPC_TSAN VALID_CONFIG_stapprof = 1 diff --git a/build.yaml b/build.yaml index 9c546246ab0..ee51a72bb8d 100644 --- a/build.yaml +++ b/build.yaml @@ -6067,11 +6067,11 @@ vspackages: configs: asan: CC: clang - CPPFLAGS: -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer - -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS + CPPFLAGS: -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address + -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ LD: clang++ - LDFLAGS: -fsanitize=address + LDFLAGS: -stdlib=libc++ -fsanitize=address LDXX: clang++ compile_the_world: true test_environ: @@ -6079,23 +6079,23 @@ configs: LSAN_OPTIONS: suppressions=test/core/util/lsan_suppressions.txt:report_objects=1 asan-noleaks: CC: clang - CPPFLAGS: -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer - -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS + CPPFLAGS: -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address + -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ LD: clang++ - LDFLAGS: -fsanitize=address + LDFLAGS: -stdlib=libc++ -fsanitize=address LDXX: clang++ compile_the_world: true test_environ: ASAN_OPTIONS: detect_leaks=0:color=always asan-trace-cmp: CC: clang - CPPFLAGS: -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize-coverage=trace-cmp + CPPFLAGS: -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize-coverage=trace-cmp -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ LD: clang++ - LDFLAGS: -fsanitize=address + LDFLAGS: -stdlib=libc++ -fsanitize=address LDXX: clang++ compile_the_world: true test_environ: @@ -6137,13 +6137,14 @@ configs: valgrind: --tool=memcheck --leak-check=full msan: CC: clang - CPPFLAGS: -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=memory -fsanitize-memory-track-origins - -fsanitize-memory-use-after-dtor -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 - -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-command-line-argument -fPIE -pie -DGPR_NO_DIRECT_SYSCALLS + CPPFLAGS: -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize=memory + -fsanitize-memory-track-origins -fsanitize-memory-use-after-dtor -fno-omit-frame-pointer + -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-command-line-argument + -fPIE -pie -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ DEFINES: NDEBUG LD: clang++ - LDFLAGS: -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 + LDFLAGS: -stdlib=libc++ -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -fPIE -pie $(if $(JENKINS_BUILD),-Wl$(comma)-Ttext-segment=0x7e0000000000,) LDXX: clang++ compile_the_world: true @@ -6165,24 +6166,24 @@ configs: DEFINES: NDEBUG tsan: CC: clang - CPPFLAGS: -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument + CPPFLAGS: -O0 -stdlib=libc++ -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ DEFINES: GRPC_TSAN LD: clang++ - LDFLAGS: -fsanitize=thread + LDFLAGS: -stdlib=libc++ -fsanitize=thread LDXX: clang++ compile_the_world: true test_environ: TSAN_OPTIONS: suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1 ubsan: CC: clang - CPPFLAGS: -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=undefined -fno-omit-frame-pointer - -Wno-unused-command-line-argument -Wvarargs + CPPFLAGS: -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize=undefined + -fno-omit-frame-pointer -Wno-unused-command-line-argument -Wvarargs CXX: clang++ DEFINES: NDEBUG GRPC_UBSAN LD: clang++ - LDFLAGS: -fsanitize=undefined,unsigned-integer-overflow + LDFLAGS: -stdlib=libc++ -fsanitize=undefined,unsigned-integer-overflow LDXX: clang++ compile_the_world: true test_environ: From 8b91cdbf6db580856dbe7f2da51055837f30ca94 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 5 Sep 2019 15:53:34 -0700 Subject: [PATCH 572/661] Add a default Dockerfile for Python testing --- .../Dockerfile.template | 37 ++++++++ .../python_stretch_default_x64/Dockerfile | 88 +++++++++++++++++++ tools/run_tests/run_tests.py | 2 +- 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template create mode 100644 tools/dockerfile/test/python_stretch_default_x64/Dockerfile diff --git a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template new file mode 100644 index 00000000000..c6799a38fb5 --- /dev/null +++ b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template @@ -0,0 +1,37 @@ +%YAML 1.2 +--- | + # Copyright 2018 The gRPC Authors + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + + <%include file="../../python_stretch.include"/> + + RUN apt-get install -y jq zlib1g-dev libssl-dev + RUN apt-get install -y jq build-essential libffi-dev + + RUN cd /tmp && ${'\\'} + wget -q https://github.com/python/cpython/archive/v3.6.9.tar.gz && ${'\\'} + tar xzvf v3.6.9.tar.gz && ${'\\'} + cd cpython-3.6.9 && ${'\\'} + ./configure && ${'\\'} + make install + + RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev + RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 + + # for Python test coverage reporting + RUN python3.7 -m ensurepip && ${'\\'} + python3.7 -m pip install coverage + + RUN python3.6 -m ensurepip && ${'\\'} + python3.6 -m pip install coverage diff --git a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile new file mode 100644 index 00000000000..8f1f7c820db --- /dev/null +++ b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile @@ -0,0 +1,88 @@ +# Copyright 2018 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM debian:stretch + +# Install Git and basic packages. +RUN apt-get update && apt-get install -y \ + autoconf \ + autotools-dev \ + build-essential \ + bzip2 \ + ccache \ + curl \ + dnsutils \ + gcc \ + gcc-multilib \ + git \ + golang \ + gyp \ + lcov \ + libc6 \ + libc6-dbg \ + libc6-dev \ + libgtest-dev \ + libtool \ + make \ + perl \ + strace \ + python-dev \ + python-setuptools \ + python-yaml \ + telnet \ + unzip \ + wget \ + zip && apt-get clean + +#================ +# Build profiling +RUN apt-get update && apt-get install -y time && apt-get clean + +# Google Cloud platform API libraries +RUN apt-get update && apt-get install -y python-pip && apt-get clean +RUN pip install --upgrade google-api-python-client oauth2client + +# Install Python 2.7 +RUN apt-get update && apt-get install -y python2.7 python-all-dev +RUN curl https://bootstrap.pypa.io/get-pip.py | python2.7 + +# Add Debian 'buster' repository, we will need it for installing newer versions of python +RUN echo 'deb http://ftp.de.debian.org/debian buster main' >> /etc/apt/sources.list +RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local + +RUN mkdir /var/local/jenkins + +# Define the default command. +CMD ["bash"] + + +RUN apt-get install -y jq zlib1g-dev libssl-dev +RUN apt-get install -y jq build-essential libffi-dev + +RUN cd /tmp && \ + wget -q https://github.com/python/cpython/archive/v3.6.9.tar.gz && \ + tar xzvf v3.6.9.tar.gz && \ + cd cpython-3.6.9 && \ + ./configure && \ + make install + +RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev +RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 + +# for Python test coverage reporting +RUN python3.7 -m ensurepip && \ + python3.7 -m pip install coverage + +RUN python3.6 -m ensurepip && \ + python3.6 -m pip install coverage diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index a90f6e3245e..8ee0710b484 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -761,7 +761,7 @@ class PythonLanguage(object): elif self.args.compiler == 'python3.4': return 'jessie' else: - return 'stretch_3.7' + return 'stretch_default' def _get_pythons(self, args): """Get python runtimes to test with, based on current platform, architecture, compiler etc.""" From 6620a74b7273bbc711fb0254baa3a228658f1f11 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 5 Sep 2019 15:59:27 -0700 Subject: [PATCH 573/661] Run apt-get update before installing packages --- .../test/python_stretch_default_x64/Dockerfile.template | 4 ++-- tools/dockerfile/test/python_stretch_default_x64/Dockerfile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template index c6799a38fb5..af86101b71b 100644 --- a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template @@ -16,8 +16,8 @@ <%include file="../../python_stretch.include"/> - RUN apt-get install -y jq zlib1g-dev libssl-dev - RUN apt-get install -y jq build-essential libffi-dev + RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev + RUN apt-get update && apt-get install -y jq build-essential libffi-dev RUN cd /tmp && ${'\\'} wget -q https://github.com/python/cpython/archive/v3.6.9.tar.gz && ${'\\'} diff --git a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile index 8f1f7c820db..484b5e0428a 100644 --- a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile @@ -67,8 +67,8 @@ RUN mkdir /var/local/jenkins CMD ["bash"] -RUN apt-get install -y jq zlib1g-dev libssl-dev -RUN apt-get install -y jq build-essential libffi-dev +RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev +RUN apt-get update && apt-get install -y jq build-essential libffi-dev RUN cd /tmp && \ wget -q https://github.com/python/cpython/archive/v3.6.9.tar.gz && \ From 113b2f2225bf4362367a51c15cff4a3b94227aa7 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 5 Sep 2019 16:07:15 -0700 Subject: [PATCH 574/661] Remove the ensurepip for Python 3.7 --- .../test/python_stretch_default_x64/Dockerfile.template | 3 +-- tools/dockerfile/test/python_stretch_default_x64/Dockerfile | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template index af86101b71b..57620b17aa4 100644 --- a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template @@ -30,8 +30,7 @@ RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 # for Python test coverage reporting - RUN python3.7 -m ensurepip && ${'\\'} - python3.7 -m pip install coverage + RUN python3.7 -m pip install coverage RUN python3.6 -m ensurepip && ${'\\'} python3.6 -m pip install coverage diff --git a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile index 484b5e0428a..a412c93fe73 100644 --- a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile @@ -81,8 +81,7 @@ RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 # for Python test coverage reporting -RUN python3.7 -m ensurepip && \ - python3.7 -m pip install coverage +RUN python3.7 -m pip install coverage RUN python3.6 -m ensurepip && \ python3.6 -m pip install coverage From 04b3b8e9215994cba3243d0726163f22cec665f9 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 5 Sep 2019 16:39:55 -0700 Subject: [PATCH 575/661] Add default transport fallback --- src/objective-c/GRPCClient/GRPCTransport.m | 17 +++++-- .../CronetTests/TransportRegistryTests.m | 41 +++++++++++++++ .../tests/Tests.xcodeproj/project.pbxproj | 8 +++ .../tests/UnitTests/TransportRegistryTests.m | 51 +++++++++++++++++++ 4 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 src/objective-c/tests/CronetTests/TransportRegistryTests.m create mode 100644 src/objective-c/tests/UnitTests/TransportRegistryTests.m diff --git a/src/objective-c/GRPCClient/GRPCTransport.m b/src/objective-c/GRPCClient/GRPCTransport.m index 966dc50d64d..353300c3bc4 100644 --- a/src/objective-c/GRPCClient/GRPCTransport.m +++ b/src/objective-c/GRPCClient/GRPCTransport.m @@ -86,8 +86,9 @@ NSUInteger TransportIdHash(GRPCTransportID transportId) { - (id)getTransportFactoryWithId:(GRPCTransportID)transportId { if (transportId == NULL) { if (_defaultFactory == nil) { + // fall back to default transport if no transport is provided [NSException raise:NSInvalidArgumentException - format:@"Unable to get default transport factory"]; + format:@"Did not specify transport and unable to find a default transport."]; return nil; } return _defaultFactory; @@ -95,10 +96,16 @@ NSUInteger TransportIdHash(GRPCTransportID transportId) { NSString *nsTransportId = [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding]; id transportFactory = _registry[nsTransportId]; if (transportFactory == nil) { - // User named a transport id that was not registered with the registry. - [NSException raise:NSInvalidArgumentException - format:@"Unable to get transport factory with id %s", transportId]; - return nil; + if (_defaultFactory != nil) { + // fall back to default transport if no transport is found + NSLog(@"Unable to find transport with id %s; falling back to default transport.", + transportId); + return _defaultFactory; + } else { + [NSException raise:NSInvalidArgumentException + format:@"Unable to find transport with id %s", transportId]; + return nil; + } } return transportFactory; } diff --git a/src/objective-c/tests/CronetTests/TransportRegistryTests.m b/src/objective-c/tests/CronetTests/TransportRegistryTests.m new file mode 100644 index 00000000000..75802e17c4f --- /dev/null +++ b/src/objective-c/tests/CronetTests/TransportRegistryTests.m @@ -0,0 +1,41 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +#import +#import +#import "src/objective-c/GRPCClient/private/GRPCTransport+Private.h" + +@interface TransportRegistryTests : XCTestCase + +@end + +@implementation TransportRegistryTests + +- (void)testCronetImplementationExist { + id secureTransportFactory = [[GRPCTransportRegistry sharedInstance] + getTransportFactoryWithId:GRPCDefaultTransportImplList.core_secure]; + id cronetTransportFactory = + [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:gGRPCCoreCronetId]; + XCTAssertNotNil(secureTransportFactory); + XCTAssertNotNil(cronetTransportFactory); + XCTAssertNotEqual(secureTransportFactory, cronetTransportFactory); +} + +@end diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 6cb9f5560b9..2ce32d3916d 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -30,6 +30,8 @@ 5E7F488E22778C87006656AD /* InteropTestsLocalCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */; }; 5E7F488F22778C8C006656AD /* InteropTestsRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F488822778B04006656AD /* InteropTestsRemote.m */; }; 5E7F489022778C95006656AD /* RxLibraryUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F488A22778B5D006656AD /* RxLibraryUnitTests.m */; }; + 5E9F1C332321AB1700837469 /* TransportRegistryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E9F1C322321AB1700837469 /* TransportRegistryTests.m */; }; + 5E9F1C352321C9B200837469 /* TransportRegistryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E9F1C342321C9B200837469 /* TransportRegistryTests.m */; }; 5EA4770322736178000F72FC /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; }; 5EA477042273617B000F72FC /* InteropTestsLocalCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */; }; 5EA4770522736AC4000F72FC /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; @@ -121,6 +123,8 @@ 5E7F488622778AEA006656AD /* GRPCClientTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRPCClientTests.m; sourceTree = ""; }; 5E7F488822778B04006656AD /* InteropTestsRemote.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InteropTestsRemote.m; sourceTree = ""; }; 5E7F488A22778B5D006656AD /* RxLibraryUnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RxLibraryUnitTests.m; sourceTree = ""; }; + 5E9F1C322321AB1700837469 /* TransportRegistryTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TransportRegistryTests.m; sourceTree = ""; }; + 5E9F1C342321C9B200837469 /* TransportRegistryTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TransportRegistryTests.m; sourceTree = ""; }; 5EA476F42272816A000F72FC /* InteropTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InteropTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 5EA908CF4CDA4CE218352A06 /* Pods-InteropTestsLocalSSLCFStream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.release.xcconfig"; sourceTree = ""; }; 5EAD6D261E27047400002378 /* CronetUnitTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = CronetUnitTests.mm; path = CronetTests/CronetUnitTests.mm; sourceTree = SOURCE_ROOT; }; @@ -362,6 +366,7 @@ 5E0282E7215AA697007AC99D /* UnitTests */ = { isa = PBXGroup; children = ( + 5E9F1C322321AB1700837469 /* TransportRegistryTests.m */, 5E7F488A22778B5D006656AD /* RxLibraryUnitTests.m */, 5E7F488622778AEA006656AD /* GRPCClientTests.m */, 5E7F487F227782C1006656AD /* APIv2Tests.m */, @@ -375,6 +380,7 @@ 5E7F485A22775B15006656AD /* CronetTests */ = { isa = PBXGroup; children = ( + 5E9F1C342321C9B200837469 /* TransportRegistryTests.m */, 5EE84BF31D4717E40050C6CC /* InteropTestsRemoteWithCronet.m */, 5E7F486D22778086006656AD /* CoreCronetEnd2EndTests.mm */, 5EAD6D261E27047400002378 /* CronetUnitTests.mm */, @@ -868,6 +874,7 @@ 5E0282E9215AA697007AC99D /* NSErrorUnitTests.m in Sources */, 5E7F4880227782C1006656AD /* APIv2Tests.m in Sources */, 5E7F487D22778256006656AD /* ChannelPoolTest.m in Sources */, + 5E9F1C332321AB1700837469 /* TransportRegistryTests.m in Sources */, 5E7F488722778AEA006656AD /* GRPCClientTests.m in Sources */, 5E7F487E22778256006656AD /* ChannelTests.m in Sources */, 5E7F488B22778B5D006656AD /* RxLibraryUnitTests.m in Sources */, @@ -882,6 +889,7 @@ 5E3F148D22792856007C6D90 /* ConfigureCronet.m in Sources */, 5E08D07023021E3B006D76EA /* InteropTestsMultipleChannels.m in Sources */, 5E7F486E22778086006656AD /* CoreCronetEnd2EndTests.mm in Sources */, + 5E9F1C352321C9B200837469 /* TransportRegistryTests.m in Sources */, 5E7F488522778A88006656AD /* InteropTests.m in Sources */, 5E7F486422775B37006656AD /* InteropTestsRemoteWithCronet.m in Sources */, 5E7F486522775B41006656AD /* CronetUnitTests.mm in Sources */, diff --git a/src/objective-c/tests/UnitTests/TransportRegistryTests.m b/src/objective-c/tests/UnitTests/TransportRegistryTests.m new file mode 100644 index 00000000000..40035fefa90 --- /dev/null +++ b/src/objective-c/tests/UnitTests/TransportRegistryTests.m @@ -0,0 +1,51 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +#import +#import +#import "src/objective-c/GRPCClient/private/GRPCTransport+Private.h" + +@interface TransportRegistryTests : XCTestCase + +@end + +@implementation TransportRegistryTests + +- (void)testDefaultImplementationsExist { + id secureTransportFactory = [[GRPCTransportRegistry sharedInstance] + getTransportFactoryWithId:GRPCDefaultTransportImplList.core_secure]; + id insecureTransportFactory = [[GRPCTransportRegistry sharedInstance] + getTransportFactoryWithId:GRPCDefaultTransportImplList.core_insecure]; + XCTAssertNotNil(secureTransportFactory); + XCTAssertNotNil(insecureTransportFactory); + XCTAssertNotEqual(secureTransportFactory, insecureTransportFactory); +} + +- (void)testCronetImplementationNotExistAndFallBack { + id secureTransportFactory = [[GRPCTransportRegistry sharedInstance] + getTransportFactoryWithId:GRPCDefaultTransportImplList.core_secure]; + id cronetTransportFactory = + [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:gGRPCCoreCronetId]; + XCTAssertNotNil(secureTransportFactory); + XCTAssertNotNil(cronetTransportFactory); + XCTAssertEqual(secureTransportFactory, cronetTransportFactory); +} + +@end From 97f1f57dab1eda1c45601f19d104dcbdcc54ff46 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 5 Sep 2019 18:13:59 -0700 Subject: [PATCH 576/661] Allow call credentials to be set even after the call is created but before initial metadata is sent --- .../grpcpp/impl/codegen/client_context_impl.h | 6 +- src/cpp/client/client_context.cc | 16 ++++ test/cpp/end2end/end2end_test.cc | 81 +++++++++++++++++-- 3 files changed, 92 insertions(+), 11 deletions(-) diff --git a/include/grpcpp/impl/codegen/client_context_impl.h b/include/grpcpp/impl/codegen/client_context_impl.h index 7a543055b4b..bf5afa44b10 100644 --- a/include/grpcpp/impl/codegen/client_context_impl.h +++ b/include/grpcpp/impl/codegen/client_context_impl.h @@ -310,11 +310,11 @@ class ClientContext { /// client’s identity, role, or whether it is authorized to make a particular /// call. /// + /// It is legal to call this only before initial metadata is sent. + /// /// \see https://grpc.io/docs/guides/auth.html void set_credentials( - const std::shared_ptr& creds) { - creds_ = creds; - } + const std::shared_ptr& creds); /// Return the compression algorithm the client call will request be used. /// Note that the gRPC runtime may decide to ignore this request, for example, diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index efb10a44006..fc44b654efe 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -72,6 +72,22 @@ ClientContext::~ClientContext() { g_client_callbacks->Destructor(this); } +void ClientContext::set_credentials( + const std::shared_ptr& creds) { + creds_ = creds; + // If call_ is set, we have already created the call, and set the call + // credentials. This should only be done before we have started the batch + // for sending initial metadata. + if (creds_ != nullptr && call_ != nullptr) { + if (!creds_->ApplyToCall(call_)) { + SendCancelToInterceptors(); + grpc_call_cancel_with_status(call_, GRPC_STATUS_CANCELLED, + "Failed to set credentials to rpc.", + nullptr); + } + } +} + std::unique_ptr ClientContext::FromServerContext( const grpc::ServerContext& context, PropagationOptions options) { std::unique_ptr ctx(new ClientContext); diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index a8592fd97c2..a4655329250 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -16,9 +16,6 @@ * */ -#include -#include - #include #include #include @@ -35,6 +32,9 @@ #include #include +#include +#include + #include "src/core/ext/filters/client_channel/backup_poller.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/security/credentials/credentials.h" @@ -338,7 +338,11 @@ class End2endTest : public ::testing::TestWithParam { kMaxMessageSize_); // For testing max message size. } - void ResetChannel() { + void ResetChannel( + std::vector< + std::unique_ptr> + interceptor_creators = std::vector>()) { if (!is_server_started_) { StartServer(std::shared_ptr()); } @@ -358,20 +362,27 @@ class End2endTest : public ::testing::TestWithParam { } else { channel_ = CreateCustomChannelWithInterceptors( server_address_.str(), channel_creds, args, - CreateDummyClientInterceptors()); + interceptor_creators.empty() ? CreateDummyClientInterceptors() + : std::move(interceptor_creators)); } } else { if (!GetParam().use_interceptors) { channel_ = server_->InProcessChannel(args); } else { channel_ = server_->experimental().InProcessChannelWithInterceptors( - args, CreateDummyClientInterceptors()); + args, interceptor_creators.empty() + ? CreateDummyClientInterceptors() + : std::move(interceptor_creators)); } } } - void ResetStub() { - ResetChannel(); + void ResetStub( + std::vector< + std::unique_ptr> + interceptor_creators = std::vector>()) { + ResetChannel(std::move(interceptor_creators)); if (GetParam().use_proxy) { proxy_service_.reset(new Proxy(channel_)); int port = grpc_pick_unused_port_or_die(); @@ -1802,6 +1813,60 @@ TEST_P(SecureEnd2endTest, SetPerCallCredentials) { "fake_selector")); } +class CredentialsInterceptor : public experimental::Interceptor { + public: + CredentialsInterceptor(experimental::ClientRpcInfo* info) : info_(info) {} + + void Intercept(experimental::InterceptorBatchMethods* methods) { + if (methods->QueryInterceptionHookPoint( + experimental::InterceptionHookPoints::PRE_SEND_INITIAL_METADATA)) { + std::shared_ptr creds = + GoogleIAMCredentials("fake_token", "fake_selector"); + info_->client_context()->set_credentials(creds); + } + methods->Proceed(); + } + + private: + experimental::ClientRpcInfo* info_ = nullptr; +}; + +class CredentialsInterceptorFactory + : public experimental::ClientInterceptorFactoryInterface { + CredentialsInterceptor* CreateClientInterceptor( + experimental::ClientRpcInfo* info) { + return new CredentialsInterceptor(info); + } +}; + +TEST_P(SecureEnd2endTest, CallCredentialsInterception) { + MAYBE_SKIP_TEST; + if (!GetParam().use_interceptors) { + return; + } + std::vector> + interceptor_creators; + interceptor_creators.push_back(std::unique_ptr( + new CredentialsInterceptorFactory())); + ResetStub(std::move(interceptor_creators)); + EchoRequest request; + EchoResponse response; + ClientContext context; + + request.set_message("Hello"); + request.mutable_param()->set_echo_metadata(true); + + Status s = stub_->Echo(&context, request, &response); + EXPECT_EQ(request.message(), response.message()); + EXPECT_TRUE(s.ok()); + EXPECT_TRUE(MetadataContains(context.GetServerTrailingMetadata(), + GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, + "fake_token")); + EXPECT_TRUE(MetadataContains(context.GetServerTrailingMetadata(), + GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY, + "fake_selector")); +} + TEST_P(SecureEnd2endTest, OverridePerCallCredentials) { MAYBE_SKIP_TEST; ResetStub(); From 4e8ecb9fe63c3d15363bb568c016636325ed3fb1 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 6 Sep 2019 12:31:45 +0200 Subject: [PATCH 577/661] Revert "Upgrade to Bazel 0.29 (including Windows RBE)" --- templates/tools/dockerfile/bazel.include | 2 +- tools/bazel | 2 +- tools/dockerfile/test/bazel/Dockerfile | 2 +- tools/dockerfile/test/sanity/Dockerfile | 2 +- tools/internal_ci/windows/bazel_rbe.bat | 4 ++-- tools/remote_build/windows.bazelrc | 7 ++++--- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/templates/tools/dockerfile/bazel.include b/templates/tools/dockerfile/bazel.include index 9762bdcb85f..12a22785623 100644 --- a/templates/tools/dockerfile/bazel.include +++ b/templates/tools/dockerfile/bazel.include @@ -2,7 +2,7 @@ # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.29.0 +ENV BAZEL_VERSION 0.28.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/bazel b/tools/bazel index cfa875b0e63..4d1d57f60d9 100755 --- a/tools/bazel +++ b/tools/bazel @@ -32,7 +32,7 @@ then exec -a "$0" "${BAZEL_REAL}" "$@" fi -VERSION=0.29.0 +VERSION=0.28.1 echo "INFO: Running bazel wrapper (see //tools/bazel for details), bazel version $VERSION will be used instead of system-wide bazel installation." diff --git a/tools/dockerfile/test/bazel/Dockerfile b/tools/dockerfile/test/bazel/Dockerfile index fde54bae877..7141fb9c5f1 100644 --- a/tools/dockerfile/test/bazel/Dockerfile +++ b/tools/dockerfile/test/bazel/Dockerfile @@ -52,7 +52,7 @@ RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 t # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.29.0 +ENV BAZEL_VERSION 0.28.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile index 4d3691f32bd..badff52de34 100644 --- a/tools/dockerfile/test/sanity/Dockerfile +++ b/tools/dockerfile/test/sanity/Dockerfile @@ -97,7 +97,7 @@ ENV CLANG_TIDY=clang-tidy # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.29.0 +ENV BAZEL_VERSION 0.28.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/internal_ci/windows/bazel_rbe.bat b/tools/internal_ci/windows/bazel_rbe.bat index 8d8ea118ebd..153b2d59687 100644 --- a/tools/internal_ci/windows/bazel_rbe.bat +++ b/tools/internal_ci/windows/bazel_rbe.bat @@ -14,7 +14,7 @@ @rem TODO(jtattermusch): make this generate less output @rem TODO(jtattermusch): use tools/bazel script to keep the versions in sync -choco install bazel -y --version 0.29.0 --limit-output +choco install bazel -y --version 0.26.0 --limit-output cd github/grpc set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH% @@ -24,7 +24,7 @@ powershell -Command "[guid]::NewGuid().ToString()" >%KOKORO_ARTIFACTS_DIR%/bazel set /p BAZEL_INVOCATION_ID=<%KOKORO_ARTIFACTS_DIR%/bazel_invocation_ids @rem TODO(jtattermusch): windows RBE should be able to use the same credentials as Linux RBE. -bazel --bazelrc=tools/remote_build/windows.bazelrc build --invocation_id="%BAZEL_INVOCATION_ID%" --workspace_status_command=tools/remote_build/workspace_status_kokoro.sh :all --google_credentials=%KOKORO_GFILE_DIR%/rbe-windows-credentials.json +bazel --bazelrc=tools/remote_build/windows.bazelrc build --invocation_id="%BAZEL_INVOCATION_ID%" --workspace_status_command=tools/remote_build/workspace_status_kokoro.sh :all --incompatible_disallow_filetype=false --google_credentials=%KOKORO_GFILE_DIR%/rbe-windows-credentials.json set BAZEL_EXITCODE=%errorlevel% @rem TODO(jtattermusch): upload results to bigquery diff --git a/tools/remote_build/windows.bazelrc b/tools/remote_build/windows.bazelrc index 825d6765de9..9fd3071e79f 100644 --- a/tools/remote_build/windows.bazelrc +++ b/tools/remote_build/windows.bazelrc @@ -1,7 +1,8 @@ startup --host_jvm_args=-Dbazel.DigestFunction=SHA256 -build --remote_cache=grpcs://remotebuildexecution.googleapis.com -build --remote_executor=grpcs://remotebuildexecution.googleapis.com +build --remote_cache=remotebuildexecution.googleapis.com +build --remote_executor=remotebuildexecution.googleapis.com +build --tls_enabled=true build --host_crosstool_top=//third_party/toolchains/bazel_0.26.0_rbe_windows:toolchain build --crosstool_top=//third_party/toolchains/bazel_0.26.0_rbe_windows:toolchain @@ -37,7 +38,7 @@ test --test_env=GRPC_VERBOSITY=debug # Set flags for uploading to BES in order to view results in the Bazel Build # Results UI. -build --bes_backend=grpcs://buildeventservice.googleapis.com +build --bes_backend="buildeventservice.googleapis.com" build --bes_timeout=60s build --bes_results_url="https://source.cloud.google.com/results/invocations/" build --project_id=grpc-testing From 49d67b3531978b45ea091f0d06423ed315462668 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 6 Sep 2019 10:17:11 -0700 Subject: [PATCH 578/661] Revert using libc++ for asan & tsan --- Makefile | 16 ++++++++-------- build.yaml | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 1e8acd7e99e..e666a19eb79 100644 --- a/Makefile +++ b/Makefile @@ -86,8 +86,8 @@ CC_asan-trace-cmp = clang CXX_asan-trace-cmp = clang++ LD_asan-trace-cmp = clang++ LDXX_asan-trace-cmp = clang++ -CPPFLAGS_asan-trace-cmp = -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize-coverage=trace-cmp -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS -LDFLAGS_asan-trace-cmp = -stdlib=libc++ -fsanitize=address +CPPFLAGS_asan-trace-cmp = -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize-coverage=trace-cmp -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS +LDFLAGS_asan-trace-cmp = -fsanitize=address VALID_CONFIG_dbg = 1 CC_dbg = $(DEFAULT_CC) @@ -103,8 +103,8 @@ CC_asan = clang CXX_asan = clang++ LD_asan = clang++ LDXX_asan = clang++ -CPPFLAGS_asan = -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS -LDFLAGS_asan = -stdlib=libc++ -fsanitize=address +CPPFLAGS_asan = -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS +LDFLAGS_asan = -fsanitize=address VALID_CONFIG_msan = 1 REQUIRE_CUSTOM_LIBRARIES_msan = 1 @@ -139,8 +139,8 @@ CC_asan-noleaks = clang CXX_asan-noleaks = clang++ LD_asan-noleaks = clang++ LDXX_asan-noleaks = clang++ -CPPFLAGS_asan-noleaks = -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS -LDFLAGS_asan-noleaks = -stdlib=libc++ -fsanitize=address +CPPFLAGS_asan-noleaks = -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS +LDFLAGS_asan-noleaks = fsanitize=address VALID_CONFIG_noexcept = 1 CC_noexcept = $(DEFAULT_CC) @@ -167,8 +167,8 @@ CC_tsan = clang CXX_tsan = clang++ LD_tsan = clang++ LDXX_tsan = clang++ -CPPFLAGS_tsan = -O0 -stdlib=libc++ -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS -LDFLAGS_tsan = -stdlib=libc++ -fsanitize=thread +CPPFLAGS_tsan = -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS +LDFLAGS_tsan = -fsanitize=thread DEFINES_tsan = GRPC_TSAN VALID_CONFIG_stapprof = 1 diff --git a/build.yaml b/build.yaml index ee51a72bb8d..15203f242c9 100644 --- a/build.yaml +++ b/build.yaml @@ -6067,11 +6067,11 @@ vspackages: configs: asan: CC: clang - CPPFLAGS: -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address - -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS + CPPFLAGS: -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer + -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ LD: clang++ - LDFLAGS: -stdlib=libc++ -fsanitize=address + LDFLAGS: -fsanitize=address LDXX: clang++ compile_the_world: true test_environ: @@ -6079,23 +6079,23 @@ configs: LSAN_OPTIONS: suppressions=test/core/util/lsan_suppressions.txt:report_objects=1 asan-noleaks: CC: clang - CPPFLAGS: -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address - -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS + CPPFLAGS: -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer + -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ LD: clang++ - LDFLAGS: -stdlib=libc++ -fsanitize=address + LDFLAGS: fsanitize=address LDXX: clang++ compile_the_world: true test_environ: ASAN_OPTIONS: detect_leaks=0:color=always asan-trace-cmp: CC: clang - CPPFLAGS: -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize-coverage=trace-cmp + CPPFLAGS: -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize-coverage=trace-cmp -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ LD: clang++ - LDFLAGS: -stdlib=libc++ -fsanitize=address + LDFLAGS: -fsanitize=address LDXX: clang++ compile_the_world: true test_environ: @@ -6166,12 +6166,12 @@ configs: DEFINES: NDEBUG tsan: CC: clang - CPPFLAGS: -O0 -stdlib=libc++ -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument + CPPFLAGS: -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ DEFINES: GRPC_TSAN LD: clang++ - LDFLAGS: -stdlib=libc++ -fsanitize=thread + LDFLAGS: -fsanitize=thread LDXX: clang++ compile_the_world: true test_environ: From 3e2171ed6188b0941b47ed27785485cfd80a6341 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 6 Sep 2019 11:15:00 -0700 Subject: [PATCH 579/661] Adopt reviewer's advice --- templates/tools/dockerfile/python_stretch.include | 2 -- .../test/python_stretch_default_x64/Dockerfile.template | 3 +++ tools/dockerfile/interoptest/grpc_interop_python/Dockerfile | 2 -- tools/dockerfile/test/python_stretch_2.7_x64/Dockerfile | 2 -- tools/dockerfile/test/python_stretch_3.5_x64/Dockerfile | 2 -- tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile | 2 -- tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile | 2 -- tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile | 2 -- tools/dockerfile/test/python_stretch_default_x64/Dockerfile | 5 +++-- tools/dockerfile/test/sanity/Dockerfile | 2 -- 10 files changed, 6 insertions(+), 18 deletions(-) diff --git a/templates/tools/dockerfile/python_stretch.include b/templates/tools/dockerfile/python_stretch.include index 43ba98ae64c..8591e753d01 100644 --- a/templates/tools/dockerfile/python_stretch.include +++ b/templates/tools/dockerfile/python_stretch.include @@ -7,5 +7,3 @@ FROM debian:stretch RUN echo 'deb http://ftp.de.debian.org/debian buster main' >> /etc/apt/sources.list RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local <%include file="./run_tests_addons.include"/> -# Define the default command. -CMD ["bash"] diff --git a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template index 57620b17aa4..155e0068a99 100644 --- a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template @@ -25,6 +25,9 @@ cd cpython-3.6.9 && ${'\\'} ./configure && ${'\\'} make install + + RUN echo "ff7cdaef4846c89c1ec0d7b709bbd54d v3.6.9.tar.gz" > checksum.md5 + RUN md5sum -c checksum.md5 RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 diff --git a/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile index b11a1a1aa31..3583d783a81 100644 --- a/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile @@ -63,8 +63,6 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins -# Define the default command. -CMD ["bash"] RUN apt-get update && apt-get -t stable install -y python3.7 python3-all-dev diff --git a/tools/dockerfile/test/python_stretch_2.7_x64/Dockerfile b/tools/dockerfile/test/python_stretch_2.7_x64/Dockerfile index 92b18e740da..0bbc11a21b2 100644 --- a/tools/dockerfile/test/python_stretch_2.7_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_2.7_x64/Dockerfile @@ -63,6 +63,4 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins -# Define the default command. -CMD ["bash"] diff --git a/tools/dockerfile/test/python_stretch_3.5_x64/Dockerfile b/tools/dockerfile/test/python_stretch_3.5_x64/Dockerfile index 7a256edffb2..bfedf432b78 100644 --- a/tools/dockerfile/test/python_stretch_3.5_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_3.5_x64/Dockerfile @@ -63,8 +63,6 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins -# Define the default command. -CMD ["bash"] RUN apt-get update && apt-get install -y python3.5 python3-all-dev diff --git a/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile b/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile index f18af660488..7a3a4a6dea5 100644 --- a/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile @@ -63,8 +63,6 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins -# Define the default command. -CMD ["bash"] RUN apt-get install -y jq zlib1g-dev libssl-dev diff --git a/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile b/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile index 46b6526dc69..6745055c14f 100644 --- a/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile @@ -63,8 +63,6 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins -# Define the default command. -CMD ["bash"] RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev diff --git a/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile b/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile index 495d86fd099..b0e386ac57f 100644 --- a/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile @@ -63,8 +63,6 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins -# Define the default command. -CMD ["bash"] RUN apt-get install -y jq zlib1g-dev libssl-dev diff --git a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile index a412c93fe73..7a6e51fdf7a 100644 --- a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile @@ -63,8 +63,6 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins -# Define the default command. -CMD ["bash"] RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev @@ -77,6 +75,9 @@ RUN cd /tmp && \ ./configure && \ make install +RUN echo "ff7cdaef4846c89c1ec0d7b709bbd54d v3.6.9.tar.gz" > checksum.md5 +RUN md5sum -c checksum.md5 + RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile index 4d3691f32bd..6ab449f14b1 100644 --- a/tools/dockerfile/test/sanity/Dockerfile +++ b/tools/dockerfile/test/sanity/Dockerfile @@ -63,8 +63,6 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins -# Define the default command. -CMD ["bash"] #================= # C++ dependencies From 40d495a31b9ba29642561e33886eb2fa7b57650e Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 6 Sep 2019 11:25:12 -0700 Subject: [PATCH 580/661] Correct the checksum and download link --- .../python_stretch_default_x64/Dockerfile.template | 11 ++++++----- .../test/python_stretch_default_x64/Dockerfile | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template index 155e0068a99..80347d4b4d0 100644 --- a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template @@ -20,14 +20,15 @@ RUN apt-get update && apt-get install -y jq build-essential libffi-dev RUN cd /tmp && ${'\\'} - wget -q https://github.com/python/cpython/archive/v3.6.9.tar.gz && ${'\\'} - tar xzvf v3.6.9.tar.gz && ${'\\'} - cd cpython-3.6.9 && ${'\\'} + wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && ${'\\'} + tar xzvf Python-3.6.9.tgz && ${'\\'} + cd Python-3.6.9 && ${'\\'} ./configure && ${'\\'} make install - RUN echo "ff7cdaef4846c89c1ec0d7b709bbd54d v3.6.9.tar.gz" > checksum.md5 - RUN md5sum -c checksum.md5 + RUN cd /tmp && ${'\\'} + echo "ff7cdaef4846c89c1ec0d7b709bbd54d Python-3.6.9.tgz" > checksum.md5 && ${'\\'} + md5sum -c checksum.md5 RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 diff --git a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile index 7a6e51fdf7a..cf0eebe2ad6 100644 --- a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile @@ -69,14 +69,15 @@ RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev RUN apt-get update && apt-get install -y jq build-essential libffi-dev RUN cd /tmp && \ - wget -q https://github.com/python/cpython/archive/v3.6.9.tar.gz && \ - tar xzvf v3.6.9.tar.gz && \ - cd cpython-3.6.9 && \ + wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && \ + tar xzvf Python-3.6.9.tgz && \ + cd Python-3.6.9 && \ ./configure && \ make install -RUN echo "ff7cdaef4846c89c1ec0d7b709bbd54d v3.6.9.tar.gz" > checksum.md5 -RUN md5sum -c checksum.md5 +RUN cd /tmp && \ + echo "ff7cdaef4846c89c1ec0d7b709bbd54d Python-3.6.9.tgz" > checksum.md5 && \ + md5sum -c checksum.md5 RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 From 9094826cf5e8da6718a531e44305eff5a6977113 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 6 Sep 2019 11:25:18 -0700 Subject: [PATCH 581/661] Polish interceptor/transport manager logic --- src/objective-c/GRPCClient/GRPCInterceptor.h | 2 ++ src/objective-c/GRPCClient/GRPCInterceptor.m | 13 +++++++------ .../GRPCClient/private/GRPCTransport+Private.h | 2 ++ .../GRPCClient/private/GRPCTransport+Private.m | 4 +++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.h b/src/objective-c/GRPCClient/GRPCInterceptor.h index 1794ef4b892..ed907a33054 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.h +++ b/src/objective-c/GRPCClient/GRPCInterceptor.h @@ -182,6 +182,8 @@ NS_ASSUME_NONNULL_BEGIN /** * Notify the manager that the interceptor has shut down and the manager should release references * to other interceptors and stop forwarding requests/responses. + * + * The method can only be called by the manager's associated interceptor. */ - (void)shutDown; diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.m b/src/objective-c/GRPCClient/GRPCInterceptor.m index abada5a80c1..1a64bccb89b 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.m +++ b/src/objective-c/GRPCClient/GRPCInterceptor.m @@ -68,12 +68,11 @@ } - (void)shutDown { - dispatch_async(_dispatchQueue, ^{ - self->_nextInterceptor = nil; - self->_previousInterceptor = nil; - self->_thisInterceptor = nil; - self->_shutDown = YES; - }); + // immediately releases reference; should not queue to dispatch queue. + _nextInterceptor = nil; + _previousInterceptor = nil; + _thisInterceptor = nil; + _shutDown = YES; } - (void)createNextInterceptor { @@ -203,6 +202,8 @@ return; } id copiedPreviousInterceptor = _previousInterceptor; + // no more callbacks should be issued to the previous interceptor + _previousInterceptor = nil; dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ [copiedPreviousInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; }); diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h index 075d185e5d7..eaf07950815 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h @@ -43,6 +43,8 @@ NS_ASSUME_NONNULL_BEGIN /** * Notify the manager that the transport has shut down and the manager should release references to * its response handler and stop forwarding requests/responses. + * + * The method can only be called by the manager's associated transport instance. */ - (void)shutDown; diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m index 1ce9e8940ef..aa9c7f2ce58 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m @@ -46,8 +46,8 @@ return self; } -// Must be called on _dispatchQueue or queues targeted by _dispatchQueue - (void)shutDown { + // immediately releases reference; should not queue to dispatch queue. _transport = nil; _previousInterceptor = nil; } @@ -111,6 +111,8 @@ return; } id copiedPreviousInterceptor = _previousInterceptor; + // no more callbacks should be issued to the previous interceptor + _previousInterceptor = nil; dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ [copiedPreviousInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; }); From e592414fae42df3d4b4887480eda9a5c81c60fd3 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Fri, 6 Sep 2019 11:37:19 -0700 Subject: [PATCH 582/661] Add check for input parameter being null. --- src/core/ext/filters/client_channel/lb_policy_registry.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/ext/filters/client_channel/lb_policy_registry.cc b/src/core/ext/filters/client_channel/lb_policy_registry.cc index 20099b52d6c..c0788955419 100644 --- a/src/core/ext/filters/client_channel/lb_policy_registry.cc +++ b/src/core/ext/filters/client_channel/lb_policy_registry.cc @@ -117,8 +117,13 @@ namespace { grpc_json* ParseLoadBalancingConfigHelper(const grpc_json* lb_config_array, grpc_error** error) { GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE); + if (lb_config_array == nullptr) { + *error = + GRPC_ERROR_CREATE_FROM_STATIC_STRING("LB config JSON tree is null"); + return nullptr; + } char* error_msg; - if (lb_config_array == nullptr || lb_config_array->type != GRPC_JSON_ARRAY) { + if (lb_config_array->type != GRPC_JSON_ARRAY) { gpr_asprintf(&error_msg, "field:%s error:type should be array", lb_config_array->key); *error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_msg); From f6445add1f3966c6f1e13fb9751a9fc7b4f1f254 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 6 Sep 2019 13:05:42 -0700 Subject: [PATCH 583/661] Move compile CPython 3.6 to a separate include file --- .../tools/dockerfile/compile_python_36.include | 15 +++++++++++++++ .../python_stretch_3.6_x64/Dockerfile.template | 16 +--------------- .../Dockerfile.template | 11 +---------- .../test/python_stretch_3.6_x64/Dockerfile | 17 +++++++++-------- .../test/python_stretch_default_x64/Dockerfile | 15 ++++++++++----- 5 files changed, 36 insertions(+), 38 deletions(-) create mode 100644 templates/tools/dockerfile/compile_python_36.include diff --git a/templates/tools/dockerfile/compile_python_36.include b/templates/tools/dockerfile/compile_python_36.include new file mode 100644 index 00000000000..e8983db334f --- /dev/null +++ b/templates/tools/dockerfile/compile_python_36.include @@ -0,0 +1,15 @@ +#================= +# Compile CPython 3.6.9 from source + +RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev +RUN apt-get update && apt-get install -y jq build-essential libffi-dev + +RUN cd /tmp && ${'\\'} +wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && ${'\\'} +tar xzvf Python-3.6.9.tgz && ${'\\'} +cd Python-3.6.9 && ${'\\'} +./configure && ${'\\'} +make install + +RUN python3.6 -m ensurepip && ${'\\'} + python3.6 -m pip install coverage \ No newline at end of file diff --git a/templates/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile.template index 2c2cb6de08b..c7d5fe36faa 100644 --- a/templates/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile.template @@ -15,18 +15,4 @@ # limitations under the License. <%include file="../../python_stretch.include"/> - - RUN apt-get install -y jq zlib1g-dev libssl-dev - - RUN apt-get install -y jq build-essential libffi-dev - - RUN cd /tmp && ${'\\'} - wget -q https://github.com/python/cpython/archive/v3.6.9.tar.gz && ${'\\'} - tar xzvf v3.6.9.tar.gz && ${'\\'} - cd cpython-3.6.9 && ${'\\'} - ./configure && ${'\\'} - make install - - RUN python3.6 -m ensurepip && ${'\\'} - python3.6 -m pip install coverage - + <%include file="../../compile_python_36.include"/> diff --git a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template index 80347d4b4d0..8f8bea1eb50 100644 --- a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template @@ -15,17 +15,8 @@ # limitations under the License. <%include file="../../python_stretch.include"/> + <%include file="../../compile_python_36.include"/> - RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev - RUN apt-get update && apt-get install -y jq build-essential libffi-dev - - RUN cd /tmp && ${'\\'} - wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && ${'\\'} - tar xzvf Python-3.6.9.tgz && ${'\\'} - cd Python-3.6.9 && ${'\\'} - ./configure && ${'\\'} - make install - RUN cd /tmp && ${'\\'} echo "ff7cdaef4846c89c1ec0d7b709bbd54d Python-3.6.9.tgz" > checksum.md5 && ${'\\'} md5sum -c checksum.md5 diff --git a/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile b/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile index 7a3a4a6dea5..a7a5f53e549 100644 --- a/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile @@ -64,17 +64,18 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins +#================= +# Compile CPython 3.6.9 from source -RUN apt-get install -y jq zlib1g-dev libssl-dev - -RUN apt-get install -y jq build-essential libffi-dev +RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev +RUN apt-get update && apt-get install -y jq build-essential libffi-dev RUN cd /tmp && \ - wget -q https://github.com/python/cpython/archive/v3.6.9.tar.gz && \ - tar xzvf v3.6.9.tar.gz && \ - cd cpython-3.6.9 && \ - ./configure && \ - make install +wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && \ +tar xzvf Python-3.6.9.tgz && \ +cd Python-3.6.9 && \ +./configure && \ +make install RUN python3.6 -m ensurepip && \ python3.6 -m pip install coverage diff --git a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile index cf0eebe2ad6..7aba6c87593 100644 --- a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile @@ -64,16 +64,21 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins +#================= +# Compile CPython 3.6.9 from source RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev RUN apt-get update && apt-get install -y jq build-essential libffi-dev RUN cd /tmp && \ - wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && \ - tar xzvf Python-3.6.9.tgz && \ - cd Python-3.6.9 && \ - ./configure && \ - make install +wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && \ +tar xzvf Python-3.6.9.tgz && \ +cd Python-3.6.9 && \ +./configure && \ +make install + +RUN python3.6 -m ensurepip && \ + python3.6 -m pip install coverage RUN cd /tmp && \ echo "ff7cdaef4846c89c1ec0d7b709bbd54d Python-3.6.9.tgz" > checksum.md5 && \ From 67b2eff113f5c256a50d99e17ee6a4f3bd5eda3c Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 6 Sep 2019 13:17:30 -0700 Subject: [PATCH 584/661] Also fix the compilation of 3.8 --- .../dockerfile/compile_python_36.include | 16 ++++++++++------ .../dockerfile/compile_python_38.include | 19 +++++++++++++++++++ .../Dockerfile.template | 14 +------------- .../Dockerfile.template | 9 +-------- 4 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 templates/tools/dockerfile/compile_python_38.include diff --git a/templates/tools/dockerfile/compile_python_36.include b/templates/tools/dockerfile/compile_python_36.include index e8983db334f..af4d73e9f6b 100644 --- a/templates/tools/dockerfile/compile_python_36.include +++ b/templates/tools/dockerfile/compile_python_36.include @@ -5,11 +5,15 @@ RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev RUN apt-get update && apt-get install -y jq build-essential libffi-dev RUN cd /tmp && ${'\\'} -wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && ${'\\'} -tar xzvf Python-3.6.9.tgz && ${'\\'} -cd Python-3.6.9 && ${'\\'} -./configure && ${'\\'} -make install + wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && ${'\\'} + tar xzvf Python-3.6.9.tgz && ${'\\'} + cd Python-3.6.9 && ${'\\'} + ./configure && ${'\\'} + make install + +RUN cd /tmp && ${'\\'} + echo "ff7cdaef4846c89c1ec0d7b709bbd54d Python-3.6.9.tgz" > checksum.md5 && ${'\\'} + md5sum -c checksum.md5 RUN python3.6 -m ensurepip && ${'\\'} - python3.6 -m pip install coverage \ No newline at end of file + python3.6 -m pip install coverage diff --git a/templates/tools/dockerfile/compile_python_38.include b/templates/tools/dockerfile/compile_python_38.include new file mode 100644 index 00000000000..30337e0ecb7 --- /dev/null +++ b/templates/tools/dockerfile/compile_python_38.include @@ -0,0 +1,19 @@ +#================= +# Compile CPython 3.8.0b4 from source + +RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev +RUN apt-get update && apt-get install -y jq build-essential libffi-dev + +RUN cd /tmp && ${'\\'} + wget -q https://www.python.org/ftp/python/3.8.0/Python-3.8.0b4.tgz && ${'\\'} + tar xzvf Python-3.8.0b4.tgz && ${'\\'} + cd Python-3.8.0b4 && ${'\\'} + ./configure && ${'\\'} + make install + +RUN cd /tmp && ${'\\'} + echo "b8f4f897df967014ddb42033b90c3058 Python-3.8.0b4.tgz" > checksum.md5 && ${'\\'} + md5sum -c checksum.md5 + +RUN python3.8 -m ensurepip && ${'\\'} + python3.8 -m pip install coverage diff --git a/templates/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile.template index 841a7f51b51..b0098fda0cc 100644 --- a/templates/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile.template @@ -16,16 +16,4 @@ # limitations under the License. <%include file="../../python_stretch.include"/> - RUN apt-get install -y jq zlib1g-dev libssl-dev - - RUN apt-get install -y jq build-essential libffi-dev - - RUN cd /tmp && ${'\\'} - wget -q https://github.com/python/cpython/archive/v3.8.0b3.tar.gz && ${'\\'} - tar xzvf v3.8.0b3.tar.gz && ${'\\'} - cd cpython-3.8.0b3 && ${'\\'} - ./configure && ${'\\'} - make install - - RUN python3.8 -m ensurepip && ${'\\'} - python3.8 -m pip install coverage + <%include file="../../compile_python_38.include"/> diff --git a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template index 8f8bea1eb50..ccb88e75302 100644 --- a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template @@ -16,16 +16,9 @@ <%include file="../../python_stretch.include"/> <%include file="../../compile_python_36.include"/> - - RUN cd /tmp && ${'\\'} - echo "ff7cdaef4846c89c1ec0d7b709bbd54d Python-3.6.9.tgz" > checksum.md5 && ${'\\'} - md5sum -c checksum.md5 - + RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 # for Python test coverage reporting RUN python3.7 -m pip install coverage - - RUN python3.6 -m ensurepip && ${'\\'} - python3.6 -m pip install coverage From 7f49b9f1624ba9ea8922881691391cf3bf7e0957 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 6 Sep 2019 13:20:31 -0700 Subject: [PATCH 585/661] Auto-generate the project --- .../test/python_stretch_3.6_x64/Dockerfile | 15 ++++++++----- .../test/python_stretch_3.8_x64/Dockerfile | 21 ++++++++++++------- .../python_stretch_default_x64/Dockerfile | 20 ++++++++---------- 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile b/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile index a7a5f53e549..3d475849bb9 100644 --- a/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile @@ -71,11 +71,16 @@ RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev RUN apt-get update && apt-get install -y jq build-essential libffi-dev RUN cd /tmp && \ -wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && \ -tar xzvf Python-3.6.9.tgz && \ -cd Python-3.6.9 && \ -./configure && \ -make install + wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && \ + tar xzvf Python-3.6.9.tgz && \ + cd Python-3.6.9 && \ + ./configure && \ + make install + +RUN cd /tmp && \ + echo "ff7cdaef4846c89c1ec0d7b709bbd54d Python-3.6.9.tgz" > checksum.md5 && \ + md5sum -c checksum.md5 RUN python3.6 -m ensurepip && \ python3.6 -m pip install coverage + diff --git a/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile b/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile index b0e386ac57f..8d780f0ad78 100644 --- a/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile @@ -64,16 +64,23 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins -RUN apt-get install -y jq zlib1g-dev libssl-dev +#================= +# Compile CPython 3.8.0b4 from source -RUN apt-get install -y jq build-essential libffi-dev +RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev +RUN apt-get update && apt-get install -y jq build-essential libffi-dev RUN cd /tmp && \ - wget -q https://github.com/python/cpython/archive/v3.8.0b3.tar.gz && \ - tar xzvf v3.8.0b3.tar.gz && \ - cd cpython-3.8.0b3 && \ - ./configure && \ - make install + wget -q https://www.python.org/ftp/python/3.8.0/Python-3.8.0b4.tgz && \ + tar xzvf Python-3.8.0b4.tgz && \ + cd Python-3.8.0b4 && \ + ./configure && \ + make install + +RUN cd /tmp && \ + echo "b8f4f897df967014ddb42033b90c3058 Python-3.8.0b4.tgz" > checksum.md5 && \ + md5sum -c checksum.md5 RUN python3.8 -m ensurepip && \ python3.8 -m pip install coverage + diff --git a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile index 7aba6c87593..9a1d6c09deb 100644 --- a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile @@ -71,24 +71,22 @@ RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev RUN apt-get update && apt-get install -y jq build-essential libffi-dev RUN cd /tmp && \ -wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && \ -tar xzvf Python-3.6.9.tgz && \ -cd Python-3.6.9 && \ -./configure && \ -make install + wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && \ + tar xzvf Python-3.6.9.tgz && \ + cd Python-3.6.9 && \ + ./configure && \ + make install + +RUN cd /tmp && \ + echo "ff7cdaef4846c89c1ec0d7b709bbd54d Python-3.6.9.tgz" > checksum.md5 && \ + md5sum -c checksum.md5 RUN python3.6 -m ensurepip && \ python3.6 -m pip install coverage -RUN cd /tmp && \ - echo "ff7cdaef4846c89c1ec0d7b709bbd54d Python-3.6.9.tgz" > checksum.md5 && \ - md5sum -c checksum.md5 RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7 # for Python test coverage reporting RUN python3.7 -m pip install coverage - -RUN python3.6 -m ensurepip && \ - python3.6 -m pip install coverage From 0b06676c9e9e1df592cd725a0f7ad874d1b5ce80 Mon Sep 17 00:00:00 2001 From: Arjun Roy Date: Wed, 4 Sep 2019 14:50:26 -0700 Subject: [PATCH 586/661] hpack encoder optimizations. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed some cycles and branches from hpack_enc for CH2. Specifically: 1. Pushed certain metadata key/value length checks to prepare_application_metadata() in src/core/lib/surface/call.cc. This means that rather than check all key/val lengths for all metadata, we only do so for custom added user metadata. Inside CH2, we change the length checks to debug checks so we can catch if core/filter metadata fails to pass the check. 2. Changed various asserts to debug asserts when able. 3. Refactored some of the header emission code to remove duplicated code. 4. Un-inlined some logging methods. This results in somewhat faster hpack_encoder performance: BM_HpackEncoderInitDestroy 222ns ± 0% 221ns ± 0% -0.29% (p=0.000 n=34+34) BM_HpackEncoderEncodeDeadline [framing_bytes/iter:9 header_bytes/iter:6 ] 135ns ± 1% 124ns ± 0% -8.05% (p=0.000 n=39+38) BM_HpackEncoderEncodeHeader/0/16384 [framing_bytes/iter:9 header_bytes/iter:0 ] 34.2ns ± 0% 34.2ns ± 0% -0.01% (p=0.014 n=34+38) BM_HpackEncoderEncodeHeader/1/16384 [framing_bytes/iter:9 header_bytes/iter:0 ] 34.2ns ± 0% 34.2ns ± 0% -0.04% (p=0.004 n=34+37) BM_HpackEncoderEncodeHeader/0/16384 [framing_bytes/iter:9 header_bytes/iter:1 ] 47.5ns ± 0% 45.9ns ± 0% -3.28% (p=0.000 n=28+38) BM_HpackEncoderEncodeHeader/0/16384 [framing_bytes/iter:9 header_bytes/iter:6 ] 77.0ns ± 1% 68.3ns ± 1% -11.33% (p=0.000 n=39+40) BM_HpackEncoderEncodeHeader/0/16384 [framing_bytes/iter:9 header_bytes/iter:1 ] 47.7ns ± 1% 45.5ns ± 0% -4.63% (p=0.000 n=39+33) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:1 ] 47.2ns ± 0% 45.3ns ± 0% -3.96% (p=0.000 n=33+34) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:1 ] 47.7ns ± 0% 45.6ns ± 0% -4.54% (p=0.000 n=38+40) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:1 ] 47.7ns ± 0% 45.5ns ± 0% -4.63% (p=0.000 n=39+32) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:1 ] 47.8ns ± 0% 45.6ns ± 1% -4.59% (p=0.000 n=38+39) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:1 ] 47.8ns ± 0% 45.5ns ± 0% -4.64% (p=0.000 n=39+36) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:1 ] 47.3ns ± 0% 45.3ns ± 0% -4.09% (p=0.000 n=38+36) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:1 ] 47.8ns ± 1% 45.6ns ± 0% -4.71% (p=0.000 n=37+40) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:1 ] 47.7ns ± 0% 45.5ns ± 0% -4.66% (p=0.000 n=39+32) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:1 ] 47.8ns ± 1% 45.6ns ± 1% -4.62% (p=0.000 n=37+39) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:1 ] 47.7ns ± 0% 45.5ns ± 0% -4.67% (p=0.000 n=38+32) BM_HpackEncoderEncodeHeader/0/16384 [framing_bytes/iter:9 header_bytes/iter:9 ] 80.5ns ± 1% 74.7ns ± 0% -7.16% (p=0.000 n=38+35) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:12 ] 105ns ± 1% 99ns ± 0% -5.91% (p=0.000 n=38+34) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:14 ] 111ns ± 1% 106ns ± 1% -4.86% (p=0.020 n=39+2) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:23 ] 135ns ± 0% 130ns ± 0% -3.45% (p=0.020 n=35+2) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:46 ] 225ns ± 1% 223ns ± 0% -0.91% (p=0.003 n=37+2) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:120 ] 467ns ± 0% 472ns ± 0% +1.09% (p=0.003 n=38+2) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:12 ] 81.6ns ± 1% 74.8ns ± 0% -8.40% (p=0.000 n=37+33) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:14 ] 82.0ns ± 1% 74.8ns ± 0% -8.80% (p=0.000 n=37+32) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:21 ] 82.1ns ± 1% 74.9ns ± 0% -8.86% (p=0.000 n=35+34) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:42 ] 97.6ns ± 2% 91.8ns ± 0% -5.95% (p=0.000 n=35+27) BM_HpackEncoderEncodeHeader>/0/16384 [framing_bytes/iter:9 header_bytes/iter:111 ] 97.2ns ± 1% 91.2ns ± 2% -6.19% (p=0.000 n=37+38) BM_HpackEncoderEncodeHeader/0/1 [framing_bytes/iter:54 header_bytes/iter:9 ] 230ns ± 0% 221ns ± 0% -3.91% (p=0.000 n=38+37) BM_HpackEncoderEncodeHeader/0/16384 [framing_bytes/iter:9 header_bytes/iter:16 ] 206ns ± 2% 170ns ± 1% -17.51% (p=0.000 n=39+39) BM_HpackEncoderEncodeHeader/0/16384 [framing_bytes/iter:9 header_bytes/iter:3 ] 66.4ns ± 2% 62.5ns ± 1% -5.85% (p=0.000 n=34+39) BM_HpackEncoderEncodeHeader/1/16384 [framing_bytes/iter:9 header_bytes/iter:1 ] 47.5ns ± 0% 45.9ns ± 1% -3.29% (p=0.000 n=26+38) --- .../chttp2/transport/hpack_encoder.cc | 428 ++++++++++-------- src/core/lib/slice/slice_internal.h | 30 +- src/core/lib/surface/call.cc | 3 + src/core/lib/surface/validate_metadata.cc | 4 + test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 3 +- 5 files changed, 269 insertions(+), 199 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc index e46504d9b30..f1291a10cc6 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc @@ -88,7 +88,19 @@ typedef struct { * with a data frame header */ static void fill_header(uint8_t* p, uint8_t type, uint32_t id, size_t len, uint8_t flags) { - GPR_ASSERT(len < 16777316); + /* len is the current frame size (i.e. for the frame we're finishing). + We finish a frame if: + 1) We called ensure_space(), (i.e. add_tiny_header_data()) and adding + 'need_bytes' to the frame would cause us to exceed st->max_frame_size. + 2) We called add_header_data, and adding the slice would cause us to exceed + st->max_frame_size. + 3) We're done encoding the header. + + Thus, len is always <= st->max_frame_size. + st->max_frame_size is derived from GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE, + which has a max allowable value of 16777215 (see chttp_transport.cc). + Thus, the following assert can be a debug assert. */ + GPR_DEBUG_ASSERT(len < 16777316); *p++ = static_cast(len >> 16); *p++ = static_cast(len >> 8); *p++ = static_cast(len); @@ -100,6 +112,13 @@ static void fill_header(uint8_t* p, uint8_t type, uint32_t id, size_t len, *p++ = static_cast(id); } +static size_t current_frame_size(framer_state* st) { + const size_t frame_size = + st->output->length - st->output_length_at_start_of_frame; + GPR_DEBUG_ASSERT(frame_size <= st->max_frame_size); + return frame_size; +} + /* finish a frame - fill in the previously reserved header */ static void finish_frame(framer_state* st, int is_header_boundary, int is_last_in_stream) { @@ -108,7 +127,7 @@ static void finish_frame(framer_state* st, int is_header_boundary, : GRPC_CHTTP2_FRAME_CONTINUATION; fill_header( GRPC_SLICE_START_PTR(st->output->slices[st->header_idx]), type, - st->stream_id, st->output->length - st->output_length_at_start_of_frame, + st->stream_id, current_frame_size(st), static_cast( (is_last_in_stream ? GRPC_CHTTP2_DATA_FLAG_END_STREAM : 0) | (is_header_boundary ? GRPC_CHTTP2_DATA_FLAG_END_HEADERS : 0))); @@ -130,9 +149,7 @@ static void begin_frame(framer_state* st) { space to add at least about_to_add bytes -- finishes the current frame if needed */ static void ensure_space(framer_state* st, size_t need_bytes) { - if (GPR_LIKELY(st->output->length - st->output_length_at_start_of_frame + - need_bytes <= - st->max_frame_size)) { + if (GPR_LIKELY(current_frame_size(st) + need_bytes <= st->max_frame_size)) { return; } finish_frame(st, 0, 0); @@ -158,8 +175,7 @@ static void add_header_data(framer_state* st, grpc_slice slice) { size_t len = GRPC_SLICE_LENGTH(slice); size_t remaining; if (len == 0) return; - remaining = st->max_frame_size + st->output_length_at_start_of_frame - - st->output->length; + remaining = st->max_frame_size - current_frame_size(st); if (len <= remaining) { st->stats->header_bytes += len; grpc_slice_buffer_add(st->output, slice); @@ -325,132 +341,129 @@ static void emit_indexed(grpc_chttp2_hpack_compressor* c, uint32_t elem_index, len); } -typedef struct { - grpc_slice data; - uint8_t huffman_prefix; - bool insert_null_before_wire_value; -} wire_value; +struct wire_value { + wire_value(uint8_t huffman_prefix, bool insert_null_before_wire_value, + const grpc_slice& slice) + : data(slice), + huffman_prefix(huffman_prefix), + insert_null_before_wire_value(insert_null_before_wire_value), + length(GRPC_SLICE_LENGTH(slice) + + (insert_null_before_wire_value ? 1 : 0)) {} + // While wire_value is const from the POV of hpack encoder code, actually + // adding it to a slice buffer will possibly split the slice. + const grpc_slice data; + const uint8_t huffman_prefix; + const bool insert_null_before_wire_value; + const size_t length; +}; template static wire_value get_wire_value(grpc_mdelem elem, bool true_binary_enabled) { - wire_value wire_val; - bool is_bin_hdr = + const bool is_bin_hdr = mdkey_definitely_interned ? grpc_is_refcounted_slice_binary_header(GRPC_MDKEY(elem)) : grpc_is_binary_header_internal(GRPC_MDKEY(elem)); + const grpc_slice& value = GRPC_MDVALUE(elem); if (is_bin_hdr) { if (true_binary_enabled) { GRPC_STATS_INC_HPACK_SEND_BINARY(); - wire_val.huffman_prefix = 0x00; - wire_val.insert_null_before_wire_value = true; - wire_val.data = grpc_slice_ref_internal(GRPC_MDVALUE(elem)); - + return wire_value(0x00, true, grpc_slice_ref_internal(value)); } else { GRPC_STATS_INC_HPACK_SEND_BINARY_BASE64(); - wire_val.huffman_prefix = 0x80; - wire_val.insert_null_before_wire_value = false; - wire_val.data = - grpc_chttp2_base64_encode_and_huffman_compress(GRPC_MDVALUE(elem)); + return wire_value(0x80, false, + grpc_chttp2_base64_encode_and_huffman_compress(value)); } } else { /* TODO(ctiller): opportunistically compress non-binary headers */ GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED(); - wire_val.huffman_prefix = 0x00; - wire_val.insert_null_before_wire_value = false; - wire_val.data = grpc_slice_ref_internal(GRPC_MDVALUE(elem)); + return wire_value(0x00, false, grpc_slice_ref_internal(value)); } - return wire_val; -} - -static size_t wire_value_length(wire_value v) { - return GPR_SLICE_LENGTH(v.data) + v.insert_null_before_wire_value; } -static void add_wire_value(framer_state* st, wire_value v) { - if (v.insert_null_before_wire_value) *add_tiny_header_data(st, 1) = 0; - add_header_data(st, v.data); +static uint32_t wire_value_length(const wire_value& v) { + GPR_DEBUG_ASSERT(v.length <= UINT32_MAX); + return static_cast(v.length); } -static void emit_lithdr_incidx(grpc_chttp2_hpack_compressor* c, - uint32_t key_index, grpc_mdelem elem, - framer_state* st) { - GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX(); - uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 2); - wire_value value = get_wire_value(elem, st->use_true_binary_metadata); - size_t len_val = wire_value_length(value); - uint32_t len_val_len; - GPR_ASSERT(len_val <= UINT32_MAX); - len_val_len = GRPC_CHTTP2_VARINT_LENGTH((uint32_t)len_val, 1); - GPR_DEBUG_ASSERT(len_pfx + len_val_len < GRPC_SLICE_INLINED_SIZE); - uint8_t* data = add_tiny_header_data(st, len_pfx + len_val_len); - GRPC_CHTTP2_WRITE_VARINT(key_index, 2, 0x40, data, len_pfx); - GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, value.huffman_prefix, - &data[len_pfx], len_val_len); - add_wire_value(st, value); -} - -static void emit_lithdr_noidx(grpc_chttp2_hpack_compressor* c, - uint32_t key_index, grpc_mdelem elem, - framer_state* st) { - GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX(); - uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 4); - wire_value value = get_wire_value(elem, st->use_true_binary_metadata); - size_t len_val = wire_value_length(value); - uint32_t len_val_len; - GPR_ASSERT(len_val <= UINT32_MAX); - len_val_len = GRPC_CHTTP2_VARINT_LENGTH((uint32_t)len_val, 1); +namespace { +enum class EmitLitHdrType { INC_IDX, NO_IDX }; + +enum class EmitLitHdrVType { INC_IDX_V, NO_IDX_V }; +} // namespace + +template +static void emit_lithdr(grpc_chttp2_hpack_compressor* c, uint32_t key_index, + grpc_mdelem elem, framer_state* st) { + switch (type) { + case EmitLitHdrType::INC_IDX: + GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX(); + break; + case EmitLitHdrType::NO_IDX: + GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX(); + break; + } + const uint32_t len_pfx = type == EmitLitHdrType::INC_IDX + ? GRPC_CHTTP2_VARINT_LENGTH(key_index, 2) + : GRPC_CHTTP2_VARINT_LENGTH(key_index, 4); + const wire_value value = + get_wire_value(elem, st->use_true_binary_metadata); + const uint32_t len_val = wire_value_length(value); + const uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1); GPR_DEBUG_ASSERT(len_pfx + len_val_len < GRPC_SLICE_INLINED_SIZE); - uint8_t* data = add_tiny_header_data(st, len_pfx + len_val_len); - GRPC_CHTTP2_WRITE_VARINT(key_index, 4, 0x00, data, len_pfx); - GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, value.huffman_prefix, - &data[len_pfx], len_val_len); - add_wire_value(st, value); -} - -static void emit_lithdr_incidx_v(grpc_chttp2_hpack_compressor* c, - uint32_t unused_index, grpc_mdelem elem, - framer_state* st) { - GPR_ASSERT(unused_index == 0); - GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX_V(); - GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED(); - uint32_t len_key = static_cast GRPC_SLICE_LENGTH(GRPC_MDKEY(elem)); - wire_value value = get_wire_value(elem, st->use_true_binary_metadata); - uint32_t len_val = static_cast(wire_value_length(value)); - uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1); - uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1); - GPR_ASSERT(len_key <= UINT32_MAX); - GPR_ASSERT(wire_value_length(value) <= UINT32_MAX); - GPR_DEBUG_ASSERT(1 + len_key_len < GRPC_SLICE_INLINED_SIZE); - uint8_t* data = add_tiny_header_data(st, 1 + len_key_len); - data[0] = 0x40; - GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00, &data[1], len_key_len); - add_header_data(st, grpc_slice_ref_internal(GRPC_MDKEY(elem))); - GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix, - add_tiny_header_data(st, len_val_len), len_val_len); - add_wire_value(st, value); + uint8_t* data = add_tiny_header_data( + st, + len_pfx + len_val_len + (value.insert_null_before_wire_value ? 1 : 0)); + switch (type) { + case EmitLitHdrType::INC_IDX: + GRPC_CHTTP2_WRITE_VARINT(key_index, 2, 0x40, data, len_pfx); + break; + case EmitLitHdrType::NO_IDX: + GRPC_CHTTP2_WRITE_VARINT(key_index, 4, 0x00, data, len_pfx); + break; + } + GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix, &data[len_pfx], + len_val_len); + if (value.insert_null_before_wire_value) { + data[len_pfx + len_val_len] = 0; + } + add_header_data(st, value.data); } -static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor* c, - uint32_t unused_index, grpc_mdelem elem, - framer_state* st) { - GPR_ASSERT(unused_index == 0); - GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX_V(); +template +static void emit_lithdr_v(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem, + framer_state* st) { + switch (type) { + case EmitLitHdrVType::INC_IDX_V: + GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX_V(); + break; + case EmitLitHdrVType::NO_IDX_V: + GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX_V(); + break; + } GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED(); - uint32_t len_key = static_cast GRPC_SLICE_LENGTH(GRPC_MDKEY(elem)); - wire_value value = get_wire_value(elem, st->use_true_binary_metadata); - uint32_t len_val = static_cast(wire_value_length(value)); - uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1); - uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1); - GPR_ASSERT(len_key <= UINT32_MAX); - GPR_ASSERT(wire_value_length(value) <= UINT32_MAX); - /* Preconditions passed; emit header. */ - uint8_t* data = add_tiny_header_data(st, 1 + len_key_len); - data[0] = 0x00; - GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00, &data[1], len_key_len); + const uint32_t len_key = + static_cast(GRPC_SLICE_LENGTH(GRPC_MDKEY(elem))); + const wire_value value = + type == EmitLitHdrVType::INC_IDX_V + ? get_wire_value(elem, st->use_true_binary_metadata) + : get_wire_value(elem, st->use_true_binary_metadata); + const uint32_t len_val = wire_value_length(value); + const uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1); + const uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1); + GPR_DEBUG_ASSERT(len_key <= UINT32_MAX); + GPR_DEBUG_ASSERT(1 + len_key_len < GRPC_SLICE_INLINED_SIZE); + uint8_t* key_buf = add_tiny_header_data(st, 1 + len_key_len); + key_buf[0] = type == EmitLitHdrVType::INC_IDX_V ? 0x40 : 0x00; + GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00, &key_buf[1], len_key_len); add_header_data(st, grpc_slice_ref_internal(GRPC_MDKEY(elem))); - GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix, - add_tiny_header_data(st, len_val_len), len_val_len); - add_wire_value(st, value); + uint8_t* value_buf = add_tiny_header_data( + st, len_val_len + (value.insert_null_before_wire_value ? 1 : 0)); + GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix, value_buf, + len_val_len); + if (value.insert_null_before_wire_value) { + value_buf[len_val_len] = 0; + } + add_header_data(st, value.data); } static void emit_advertise_table_size_change(grpc_chttp2_hpack_compressor* c, @@ -461,113 +474,142 @@ static void emit_advertise_table_size_change(grpc_chttp2_hpack_compressor* c, c->advertise_table_size_change = 0; } +static void GPR_ATTRIBUTE_NOINLINE hpack_enc_log(grpc_mdelem elem) { + char* k = grpc_slice_to_c_string(GRPC_MDKEY(elem)); + char* v = nullptr; + if (grpc_is_binary_header_internal(GRPC_MDKEY(elem))) { + v = grpc_dump_slice(GRPC_MDVALUE(elem), GPR_DUMP_HEX); + } else { + v = grpc_slice_to_c_string(GRPC_MDVALUE(elem)); + } + gpr_log( + GPR_INFO, + "Encode: '%s: %s', elem_interned=%d [%d], k_interned=%d, v_interned=%d", + k, v, GRPC_MDELEM_IS_INTERNED(elem), GRPC_MDELEM_STORAGE(elem), + grpc_slice_is_interned(GRPC_MDKEY(elem)), + grpc_slice_is_interned(GRPC_MDVALUE(elem))); + gpr_free(k); + gpr_free(v); +} + static uint32_t dynidx(grpc_chttp2_hpack_compressor* c, uint32_t elem_index) { return 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY + c->tail_remote_index + c->table_elems - elem_index; } +struct EmitIndexedStatus { + EmitIndexedStatus() = default; + EmitIndexedStatus(uint32_t elem_hash, bool emitted, bool can_add) + : elem_hash(elem_hash), emitted(emitted), can_add(can_add) {} + const uint32_t elem_hash = 0; + const bool emitted = false; + const bool can_add = false; +}; + +static EmitIndexedStatus maybe_emit_indexed(grpc_chttp2_hpack_compressor* c, + grpc_mdelem elem, + framer_state* st) { + const uint32_t elem_hash = + GRPC_MDELEM_STORAGE(elem) == GRPC_MDELEM_STORAGE_INTERNED + ? reinterpret_cast( + GRPC_MDELEM_DATA(elem)) + ->hash() + : reinterpret_cast(GRPC_MDELEM_DATA(elem)) + ->hash(); + + inc_filter(HASH_FRAGMENT_1(elem_hash), &c->filter_elems_sum, c->filter_elems); + + /* is this elem currently in the decoders table? */ + if (grpc_mdelem_both_interned_eq(c->entries_elems[HASH_FRAGMENT_2(elem_hash)], + elem) && + c->indices_elems[HASH_FRAGMENT_2(elem_hash)] > c->tail_remote_index) { + /* HIT: complete element (first cuckoo hash) */ + emit_indexed(c, dynidx(c, c->indices_elems[HASH_FRAGMENT_2(elem_hash)]), + st); + return EmitIndexedStatus(elem_hash, true, false); + } + if (grpc_mdelem_both_interned_eq(c->entries_elems[HASH_FRAGMENT_3(elem_hash)], + elem) && + c->indices_elems[HASH_FRAGMENT_3(elem_hash)] > c->tail_remote_index) { + /* HIT: complete element (second cuckoo hash) */ + emit_indexed(c, dynidx(c, c->indices_elems[HASH_FRAGMENT_3(elem_hash)]), + st); + return EmitIndexedStatus(elem_hash, true, false); + } + + const bool can_add = c->filter_elems[HASH_FRAGMENT_1(elem_hash)] >= + c->filter_elems_sum / ONE_ON_ADD_PROBABILITY; + return EmitIndexedStatus(elem_hash, false, can_add); +} + +static void emit_maybe_add(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem, + framer_state* st, uint32_t indices_key, + bool should_add_elem, size_t decoder_space_usage, + uint32_t elem_hash, uint32_t key_hash) { + if (should_add_elem) { + emit_lithdr(c, dynidx(c, indices_key), elem, st); + add_elem(c, elem, decoder_space_usage, elem_hash, key_hash); + } else { + emit_lithdr(c, dynidx(c, indices_key), elem, st); + } +} + /* encode an mdelem */ static void hpack_enc(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem, framer_state* st) { - GPR_ASSERT(GRPC_SLICE_LENGTH(GRPC_MDKEY(elem)) > 0); + /* User-provided key len validated in grpc_validate_header_key_is_legal(). */ + GPR_DEBUG_ASSERT(GRPC_SLICE_LENGTH(GRPC_MDKEY(elem)) > 0); + /* Header ordering: all reserved headers (prefixed with ':') must precede + * regular headers. This can be a debug assert, since: + * 1) User cannot give us ':' headers (grpc_validate_header_key_is_legal()). + * 2) grpc filters/core should be checked during debug builds. */ +#ifndef NDEBUG if (GRPC_SLICE_START_PTR(GRPC_MDKEY(elem))[0] != ':') { /* regular header */ st->seen_regular_header = 1; } else { - GPR_ASSERT( + GPR_DEBUG_ASSERT( st->seen_regular_header == 0 && "Reserved header (colon-prefixed) happening after regular ones."); } - +#endif if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) { - char* k = grpc_slice_to_c_string(GRPC_MDKEY(elem)); - char* v = nullptr; - if (grpc_is_binary_header_internal(GRPC_MDKEY(elem))) { - v = grpc_dump_slice(GRPC_MDVALUE(elem), GPR_DUMP_HEX); - } else { - v = grpc_slice_to_c_string(GRPC_MDVALUE(elem)); - } - gpr_log( - GPR_INFO, - "Encode: '%s: %s', elem_interned=%d [%d], k_interned=%d, v_interned=%d", - k, v, GRPC_MDELEM_IS_INTERNED(elem), GRPC_MDELEM_STORAGE(elem), - grpc_slice_is_interned(GRPC_MDKEY(elem)), - grpc_slice_is_interned(GRPC_MDVALUE(elem))); - gpr_free(k); - gpr_free(v); + hpack_enc_log(elem); } - bool elem_interned = GRPC_MDELEM_IS_INTERNED(elem); - bool key_interned = elem_interned || grpc_slice_is_interned(GRPC_MDKEY(elem)); + const bool elem_interned = GRPC_MDELEM_IS_INTERNED(elem); + const bool key_interned = + elem_interned || grpc_slice_is_interned(GRPC_MDKEY(elem)); - // Key is not interned, emit literals. + /* Key is not interned, emit literals. */ if (!key_interned) { - emit_lithdr_noidx_v(c, 0, elem, st); + emit_lithdr_v(c, elem, st); return; } - - uint32_t elem_hash = 0; - - if (elem_interned) { - if (GRPC_MDELEM_STORAGE(elem) == GRPC_MDELEM_STORAGE_INTERNED) { - elem_hash = - reinterpret_cast(GRPC_MDELEM_DATA(elem)) - ->hash(); - } else { - elem_hash = - reinterpret_cast(GRPC_MDELEM_DATA(elem)) - ->hash(); - } - - inc_filter(HASH_FRAGMENT_1(elem_hash), &c->filter_elems_sum, - c->filter_elems); - - /* is this elem currently in the decoders table? */ - if (grpc_mdelem_both_interned_eq( - c->entries_elems[HASH_FRAGMENT_2(elem_hash)], elem) && - c->indices_elems[HASH_FRAGMENT_2(elem_hash)] > c->tail_remote_index) { - /* HIT: complete element (first cuckoo hash) */ - emit_indexed(c, dynidx(c, c->indices_elems[HASH_FRAGMENT_2(elem_hash)]), - st); - return; - } - if (grpc_mdelem_both_interned_eq( - c->entries_elems[HASH_FRAGMENT_3(elem_hash)], elem) && - c->indices_elems[HASH_FRAGMENT_3(elem_hash)] > c->tail_remote_index) { - /* HIT: complete element (second cuckoo hash) */ - emit_indexed(c, dynidx(c, c->indices_elems[HASH_FRAGMENT_3(elem_hash)]), - st); - return; - } + /* Interned metadata => maybe already indexed. */ + const EmitIndexedStatus ret = + elem_interned ? maybe_emit_indexed(c, elem, st) : EmitIndexedStatus(); + if (ret.emitted) { + return; } - uint32_t indices_key; - /* should this elem be in the table? */ const size_t decoder_space_usage = grpc_chttp2_get_size_in_hpack_table(elem, st->use_true_binary_metadata); - const bool should_add_elem = elem_interned && - decoder_space_usage < MAX_DECODER_SPACE_USAGE && - c->filter_elems[HASH_FRAGMENT_1(elem_hash)] >= - c->filter_elems_sum / ONE_ON_ADD_PROBABILITY; - - uint32_t key_hash = GRPC_MDKEY(elem).refcount->Hash(GRPC_MDKEY(elem)); - auto emit_maybe_add = [&should_add_elem, &elem, &st, &c, &indices_key, - &decoder_space_usage, &elem_hash, &key_hash] { - if (should_add_elem) { - emit_lithdr_incidx(c, dynidx(c, indices_key), elem, st); - add_elem(c, elem, decoder_space_usage, elem_hash, key_hash); - } else { - emit_lithdr_noidx(c, dynidx(c, indices_key), elem, st); - } - }; + const bool decoder_space_available = + decoder_space_usage < MAX_DECODER_SPACE_USAGE; + const bool should_add_elem = + elem_interned && decoder_space_available && ret.can_add; + const uint32_t elem_hash = ret.elem_hash; /* no hits for the elem... maybe there's a key? */ - indices_key = c->indices_keys[HASH_FRAGMENT_2(key_hash)]; + const uint32_t key_hash = GRPC_MDKEY(elem).refcount->Hash(GRPC_MDKEY(elem)); + uint32_t indices_key = c->indices_keys[HASH_FRAGMENT_2(key_hash)]; if (grpc_slice_static_interned_equal( c->entries_keys[HASH_FRAGMENT_2(key_hash)], GRPC_MDKEY(elem)) && indices_key > c->tail_remote_index) { /* HIT: key (first cuckoo hash) */ - emit_maybe_add(); + emit_maybe_add(c, elem, st, indices_key, should_add_elem, + decoder_space_usage, elem_hash, key_hash); return; } @@ -575,18 +617,18 @@ static void hpack_enc(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem, if (grpc_slice_static_interned_equal( c->entries_keys[HASH_FRAGMENT_3(key_hash)], GRPC_MDKEY(elem)) && indices_key > c->tail_remote_index) { - /* HIT: key (first cuckoo hash) */ - emit_maybe_add(); + /* HIT: key (second cuckoo hash) */ + emit_maybe_add(c, elem, st, indices_key, should_add_elem, + decoder_space_usage, elem_hash, key_hash); return; } /* no elem, key in the table... fall back to literal emission */ - const bool should_add_key = - !elem_interned && decoder_space_usage < MAX_DECODER_SPACE_USAGE; + const bool should_add_key = !elem_interned && decoder_space_available; if (should_add_elem || should_add_key) { - emit_lithdr_incidx_v(c, 0, elem, st); + emit_lithdr_v(c, elem, st); } else { - emit_lithdr_noidx_v(c, 0, elem, st); + emit_lithdr_v(c, elem, st); } if (should_add_elem) { add_elem(c, elem, decoder_space_usage, elem_hash, key_hash); @@ -695,8 +737,12 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c, grpc_metadata_batch* metadata, const grpc_encode_header_options* options, grpc_slice_buffer* outbuf) { - GPR_ASSERT(options->stream_id != 0); - + /* grpc_chttp2_encode_header is called by FlushInitial/TrailingMetadata in + writing.cc. Specifically, on streams returned by NextStream(), which + returns streams from the list GRPC_CHTTP2_LIST_WRITABLE. The only way to be + added to the list is via grpc_chttp2_list_add_writable_stream(), which + validates that stream_id is not 0. So, this can be a debug assert. */ + GPR_DEBUG_ASSERT(options->stream_id != 0); framer_state st; st.seen_regular_header = 0; st.stream_id = options->stream_id; diff --git a/src/core/lib/slice/slice_internal.h b/src/core/lib/slice/slice_internal.h index 49ad15d5a56..f1939b5ba7c 100644 --- a/src/core/lib/slice/slice_internal.h +++ b/src/core/lib/slice/slice_internal.h @@ -214,23 +214,39 @@ struct InternedSliceRefcount { } // namespace grpc_core +inline size_t grpc_refcounted_slice_length(const grpc_slice& slice) { + GPR_DEBUG_ASSERT(slice.refcount != nullptr); + return slice.data.refcounted.length; +} + +inline const uint8_t* grpc_refcounted_slice_data(const grpc_slice& slice) { + GPR_DEBUG_ASSERT(slice.refcount != nullptr); + return slice.data.refcounted.bytes; +} + inline int grpc_slice_refcount::Eq(const grpc_slice& a, const grpc_slice& b) { + GPR_DEBUG_ASSERT(a.refcount != nullptr); + GPR_DEBUG_ASSERT(a.refcount == this); switch (ref_type_) { case Type::STATIC: - return GRPC_STATIC_METADATA_INDEX(a) == GRPC_STATIC_METADATA_INDEX(b); + GPR_DEBUG_ASSERT( + (GRPC_STATIC_METADATA_INDEX(a) == GRPC_STATIC_METADATA_INDEX(b)) == + (a.refcount == b.refcount)); case Type::INTERNED: return a.refcount == b.refcount; case Type::NOP: case Type::REGULAR: break; } - if (GRPC_SLICE_LENGTH(a) != GRPC_SLICE_LENGTH(b)) return false; - if (GRPC_SLICE_LENGTH(a) == 0) return true; - return 0 == memcmp(GRPC_SLICE_START_PTR(a), GRPC_SLICE_START_PTR(b), - GRPC_SLICE_LENGTH(a)); + if (grpc_refcounted_slice_length(a) != GRPC_SLICE_LENGTH(b)) return false; + if (grpc_refcounted_slice_length(a) == 0) return true; + return 0 == memcmp(grpc_refcounted_slice_data(a), GRPC_SLICE_START_PTR(b), + grpc_refcounted_slice_length(a)); } inline uint32_t grpc_slice_refcount::Hash(const grpc_slice& slice) { + GPR_DEBUG_ASSERT(slice.refcount != nullptr); + GPR_DEBUG_ASSERT(slice.refcount == this); switch (ref_type_) { case Type::STATIC: return ::grpc_static_metadata_hash_values[GRPC_STATIC_METADATA_INDEX( @@ -242,8 +258,8 @@ inline uint32_t grpc_slice_refcount::Hash(const grpc_slice& slice) { case Type::REGULAR: break; } - return gpr_murmur_hash3(GRPC_SLICE_START_PTR(slice), GRPC_SLICE_LENGTH(slice), - g_hash_seed); + return gpr_murmur_hash3(grpc_refcounted_slice_data(slice), + grpc_refcounted_slice_length(slice), g_hash_seed); } inline const grpc_slice& grpc_slice_ref_internal(const grpc_slice& slice) { diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 1331e57ab0c..5388cbd75a9 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -910,6 +910,9 @@ static int prepare_application_metadata(grpc_call* call, int count, "validate_metadata", grpc_validate_header_nonbin_value_is_legal(md->value))) { break; + } else if (GRPC_SLICE_LENGTH(md->value) >= UINT32_MAX) { + // HTTP2 hpack encoding has a maximum limit. + break; } l->md = grpc_mdelem_from_grpc_metadata(const_cast(md)); } diff --git a/src/core/lib/surface/validate_metadata.cc b/src/core/lib/surface/validate_metadata.cc index 0f65091333d..138f5745e51 100644 --- a/src/core/lib/surface/validate_metadata.cc +++ b/src/core/lib/surface/validate_metadata.cc @@ -67,6 +67,10 @@ grpc_error* grpc_validate_header_key_is_legal(const grpc_slice& slice) { return GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Metadata keys cannot be zero length"); } + if (GRPC_SLICE_LENGTH(slice) > UINT32_MAX) { + return GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "Metadata keys cannot be larger than UINT32_MAX"); + } if (GRPC_SLICE_START_PTR(slice)[0] == ':') { return GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Metadata keys cannot start with :"); diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 0c3c35edc56..18928531c83 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -131,11 +131,12 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) { grpc_slice_buffer outbuf; grpc_slice_buffer_init(&outbuf); while (state.KeepRunning()) { + static constexpr int kEnsureMaxFrameAtLeast = 2; grpc_encode_header_options hopt = { static_cast(state.iterations()), state.range(0) != 0, Fixture::kEnableTrueBinary, - static_cast(state.range(1)), + static_cast(state.range(1) + kEnsureMaxFrameAtLeast), &stats, }; grpc_chttp2_encode_header(c.get(), nullptr, 0, &b, &hopt, &outbuf); From c63f419c4900399a45f5de0f45aedc95fa331f80 Mon Sep 17 00:00:00 2001 From: Arjun Roy Date: Thu, 5 Sep 2019 12:52:44 -0700 Subject: [PATCH 587/661] Mark CH2 on_initial_header error path unlikely. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Yields slightly better unary and streaming performance for TCP: BM_UnaryPingPong/4096/4096 [polls/iter:3.00006 ] 27.1µs ± 2% 26.3µs ± 1% -2.77% (p=0.036 n=5+3) BM_UnaryPingPong/1/0 [polls/iter:3.00009 ] 21.7µs ± 2% 21.1µs ± 1% -2.88% (p=0.029 n=4+4) BM_UnaryPingPong/0/1 [polls/iter:3.00009 ] 21.8µs ± 2% 20.9µs ± 1% -4.32% (p=0.003 n=7+5) BM_UnaryPingPong/1/1 [polls/iter:3.00008 ] 22.0µs ± 1% 21.3µs ± 1% -3.15% (p=0.036 n=3+5) BM_UnaryPingPong/64/0 [polls/iter:3.00006 ] 22.0µs ± 1% 21.5µs ± 1% -2.19% (p=0.032 n=4+5) BM_UnaryPingPong/32768/0 [polls/iter:3.00007 ] 34.7µs ± 1% 34.1µs ± 0% -1.72% (p=0.017 n=7+3) BM_UnaryPingPong/0/262144 [polls/iter:3.00023 ] 160µs ± 1% 158µs ± 1% -1.29% (p=0.016 n=8+4) BM_UnaryPingPong/0/0 [polls/iter:3.00012 ] 20.8µs ± 1% 20.4µs ± 0% -1.89% (p=0.029 n=4+4) BM_UnaryPingPong/0/0 [polls/iter:3.00008 ] 22.1µs ± 4% 21.3µs ± 0% -3.88% (p=0.004 n=6+5) BM_UnaryPingPong/64/0 [polls/iter:3.00008 ] 23.2µs ± 2% 22.5µs ± 3% -3.07% (p=0.014 n=7+6) BM_UnaryPingPong/512/512 [polls/iter:3.0001 ] 23.5µs ± 2% 22.9µs ± 0% -2.85% (p=0.010 n=6+4) BM_UnaryPingPong/1/0 [polls/iter:3.00008 ] 22.5µs ± 1% 21.7µs ± 1% -3.35% (p=0.036 n=3+5) BM_UnaryPingPong/32768/32768 [polls/iter:3.0001 ] 48.6µs ± 1% 48.3µs ± 1% -0.58% (p=0.045 n=5+8) BM_UnaryPingPong/8/8 [polls/iter:3.00008 ] 22.0µs ± 1% 21.5µs ± 1% -2.35% (p=0.016 n=4+5) BM_UnaryPingPong/8/8 [polls/iter:3.00006 ] 22.4µs ± 3% 21.4µs ± 1% -4.05% (p=0.017 n=7+3) BM_UnaryPingPong/4096/0 [polls/iter:3.00007 ] 24.5µs ± 1% 23.9µs ± 1% -2.30% BM_UnaryPingPong/1/1 [polls/iter:3.0001 ] 22.9µs ± 2% 22.4µs ± 3% -2.04% (p=0.048 n=7+5) BM_UnaryPingPong/8/8 [polls/iter:3.0001 ] 23.0µs ± 2% 22.4µs ± 1% -2.75% (p=0.012 n=7+4) BM_UnaryPingPong/64/64 [polls/iter:3.00008 ] 23.5µs ± 2% 23.1µs ± 0% -2.10% (p=0.002 n=8+5) BM_UnaryPingPong/64/0 [polls/iter:3.00008 ] 22.1µs ± 2% 21.5µs ± 1% -2.93% (p=0.009 n=9+3) BM_UnaryPingPong/0/64 [polls/iter:3.00008 ] 22.2µs ± 1% 21.4µs ± 1% -3.51% (p=0.003 n=4+9) BM_UnaryPingPong/512/0 [polls/iter:3.00008 ] 22.4µs ± 2% 21.8µs ± 1% -2.75% (p=0.009 n=5+6) BM_UnaryPingPong/32768/0 [polls/iter:3.0001 ] 34.5µs ± 1% 34.0µs ± 1% -1.58% But, slightly worse performance for in-proc (about 2-3%). --- .../ext/transport/chttp2/transport/parsing.cc | 129 +++++++++++------- 1 file changed, 77 insertions(+), 52 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc index a39f6e83db7..e789006ed31 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.cc +++ b/src/core/ext/transport/chttp2/transport/parsing.cc @@ -422,6 +422,76 @@ static bool is_nonzero_status(grpc_mdelem md) { !md_cmp(md, GRPC_MDELEM_GRPC_STATUS_0, GRPC_MDSTR_GRPC_STATUS); } +static void GPR_ATTRIBUTE_NOINLINE on_initial_header_log( + grpc_chttp2_transport* t, grpc_chttp2_stream* s, grpc_mdelem md) { + char* key = grpc_slice_to_c_string(GRPC_MDKEY(md)); + char* value = + grpc_dump_slice(GRPC_MDVALUE(md), GPR_DUMP_HEX | GPR_DUMP_ASCII); + gpr_log(GPR_INFO, "HTTP:%d:HDR:%s: %s: %s", s->id, + t->is_client ? "CLI" : "SVR", key, value); + gpr_free(key); + gpr_free(value); +} + +static grpc_error* GPR_ATTRIBUTE_NOINLINE handle_timeout(grpc_chttp2_stream* s, + grpc_mdelem md) { + grpc_millis* cached_timeout = + static_cast(grpc_mdelem_get_user_data(md, free_timeout)); + grpc_millis timeout; + if (cached_timeout != nullptr) { + timeout = *cached_timeout; + } else { + if (GPR_UNLIKELY(!grpc_http2_decode_timeout(GRPC_MDVALUE(md), &timeout))) { + char* val = grpc_slice_to_c_string(GRPC_MDVALUE(md)); + gpr_log(GPR_ERROR, "Ignoring bad timeout value '%s'", val); + gpr_free(val); + timeout = GRPC_MILLIS_INF_FUTURE; + } + if (GRPC_MDELEM_IS_INTERNED(md)) { + /* store the result */ + cached_timeout = + static_cast(gpr_malloc(sizeof(grpc_millis))); + *cached_timeout = timeout; + grpc_mdelem_set_user_data(md, free_timeout, cached_timeout); + } + } + if (timeout != GRPC_MILLIS_INF_FUTURE) { + grpc_chttp2_incoming_metadata_buffer_set_deadline( + &s->metadata_buffer[0], grpc_core::ExecCtx::Get()->Now() + timeout); + } + GRPC_MDELEM_UNREF(md); + return GRPC_ERROR_NONE; +} + +static grpc_error* GPR_ATTRIBUTE_NOINLINE handle_metadata_size_limit_exceeded( + grpc_chttp2_transport* t, grpc_chttp2_stream* s, grpc_mdelem md, + size_t new_size, size_t metadata_size_limit) { + gpr_log(GPR_DEBUG, + "received initial metadata size exceeds limit (%" PRIuPTR + " vs. %" PRIuPTR ")", + new_size, metadata_size_limit); + grpc_chttp2_cancel_stream( + t, s, + grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "received initial metadata size exceeds limit"), + GRPC_ERROR_INT_GRPC_STATUS, + GRPC_STATUS_RESOURCE_EXHAUSTED)); + grpc_chttp2_parsing_become_skip_parser(t); + s->seen_error = true; + GRPC_MDELEM_UNREF(md); + return GRPC_ERROR_NONE; +} + +static grpc_error* GPR_ATTRIBUTE_NOINLINE +handle_metadata_add_failure(grpc_chttp2_transport* t, grpc_chttp2_stream* s, + grpc_mdelem md, grpc_error* error) { + grpc_chttp2_cancel_stream(t, s, error); + grpc_chttp2_parsing_become_skip_parser(t); + s->seen_error = true; + GRPC_MDELEM_UNREF(md); + return GRPC_ERROR_NONE; +} + static grpc_error* on_initial_header(void* tp, grpc_mdelem md) { GPR_TIMER_SCOPE("on_initial_header", 0); @@ -430,45 +500,13 @@ static grpc_error* on_initial_header(void* tp, grpc_mdelem md) { GPR_DEBUG_ASSERT(s != nullptr); if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) { - char* key = grpc_slice_to_c_string(GRPC_MDKEY(md)); - char* value = - grpc_dump_slice(GRPC_MDVALUE(md), GPR_DUMP_HEX | GPR_DUMP_ASCII); - gpr_log(GPR_INFO, "HTTP:%d:HDR:%s: %s: %s", s->id, - t->is_client ? "CLI" : "SVR", key, value); - gpr_free(key); - gpr_free(value); + on_initial_header_log(t, s, md); } if (is_nonzero_status(md)) { // not GRPC_MDELEM_GRPC_STATUS_0? s->seen_error = true; } else if (md_key_cmp(md, GRPC_MDSTR_GRPC_TIMEOUT)) { - grpc_millis* cached_timeout = - static_cast(grpc_mdelem_get_user_data(md, free_timeout)); - grpc_millis timeout; - if (cached_timeout != nullptr) { - timeout = *cached_timeout; - } else { - if (GPR_UNLIKELY( - !grpc_http2_decode_timeout(GRPC_MDVALUE(md), &timeout))) { - char* val = grpc_slice_to_c_string(GRPC_MDVALUE(md)); - gpr_log(GPR_ERROR, "Ignoring bad timeout value '%s'", val); - gpr_free(val); - timeout = GRPC_MILLIS_INF_FUTURE; - } - if (GRPC_MDELEM_IS_INTERNED(md)) { - /* store the result */ - cached_timeout = - static_cast(gpr_malloc(sizeof(grpc_millis))); - *cached_timeout = timeout; - grpc_mdelem_set_user_data(md, free_timeout, cached_timeout); - } - } - if (timeout != GRPC_MILLIS_INF_FUTURE) { - grpc_chttp2_incoming_metadata_buffer_set_deadline( - &s->metadata_buffer[0], grpc_core::ExecCtx::Get()->Now() + timeout); - } - GRPC_MDELEM_UNREF(md); - return GRPC_ERROR_NONE; + return handle_timeout(s, md); } const size_t new_size = s->metadata_buffer[0].size + GRPC_MDELEM_LENGTH(md); @@ -476,29 +514,16 @@ static grpc_error* on_initial_header(void* tp, grpc_mdelem md) { t->settings[GRPC_ACKED_SETTINGS] [GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE]; if (GPR_UNLIKELY(new_size > metadata_size_limit)) { - gpr_log(GPR_DEBUG, - "received initial metadata size exceeds limit (%" PRIuPTR - " vs. %" PRIuPTR ")", - new_size, metadata_size_limit); - grpc_chttp2_cancel_stream( - t, s, - grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING( - "received initial metadata size exceeds limit"), - GRPC_ERROR_INT_GRPC_STATUS, - GRPC_STATUS_RESOURCE_EXHAUSTED)); - grpc_chttp2_parsing_become_skip_parser(t); - s->seen_error = true; - GRPC_MDELEM_UNREF(md); + return handle_metadata_size_limit_exceeded(t, s, md, new_size, + metadata_size_limit); } else { grpc_error* error = grpc_chttp2_incoming_metadata_buffer_add(&s->metadata_buffer[0], md); - if (error != GRPC_ERROR_NONE) { - grpc_chttp2_cancel_stream(t, s, error); - grpc_chttp2_parsing_become_skip_parser(t); - s->seen_error = true; - GRPC_MDELEM_UNREF(md); + if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) { + return handle_metadata_add_failure(t, s, md, error); } } + // Not timeout-related metadata, and no error occurred. return GRPC_ERROR_NONE; } From f89e11d03735a3a0df4de96bc6c156904caff2ae Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 6 Sep 2019 13:53:31 -0700 Subject: [PATCH 588/661] More Id -> ID --- src/objective-c/GRPCClient/GRPCCall+Cronet.h | 4 +- src/objective-c/GRPCClient/GRPCCall+Cronet.m | 2 +- src/objective-c/GRPCClient/GRPCCall.m | 4 +- src/objective-c/GRPCClient/GRPCCallOptions.m | 4 +- src/objective-c/GRPCClient/GRPCInterceptor.h | 2 +- src/objective-c/GRPCClient/GRPCInterceptor.m | 10 ++-- src/objective-c/GRPCClient/GRPCTransport.h | 8 ++-- src/objective-c/GRPCClient/GRPCTransport.m | 46 +++++++++---------- .../GRPCClient/private/GRPCCore/GRPCChannel.m | 4 +- .../GRPCCoreCronet/GRPCCoreCronetFactory.h | 2 +- .../GRPCCoreCronet/GRPCCoreCronetFactory.m | 2 +- .../private/GRPCCore/GRPCCoreFactory.m | 4 +- .../GRPCClient/private/GRPCCore/GRPCHost.m | 2 +- .../private/GRPCTransport+Private.h | 4 +- .../private/GRPCTransport+Private.m | 14 +++--- .../InteropTestsRemoteWithCronet.m | 2 +- .../CronetTests/TransportRegistryTests.m | 4 +- .../tests/InteropTests/InteropTests.m | 2 +- .../tests/UnitTests/TransportRegistryTests.m | 8 ++-- 19 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.h b/src/objective-c/GRPCClient/GRPCCall+Cronet.h index 10cea963631..f89b108c1bd 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.h +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.h @@ -22,9 +22,9 @@ typedef struct stream_engine stream_engine; // Transport id for Cronet transport -extern const GRPCTransportID gGRPCCoreCronetId; +extern const GRPCTransportID gGRPCCoreCronetID; -// Deprecated class. Please use the gGRPCCoreCronetId with GRPCCallOptions.transport instead. +// Deprecated class. Please use the gGRPCCoreCronetID with GRPCCallOptions.transport instead. @interface GRPCCall (Cronet) + (void)useCronetWithEngine:(stream_engine*)engine; diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.m b/src/objective-c/GRPCClient/GRPCCall+Cronet.m index 33b09136b33..15e79717bea 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.m +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.m @@ -18,7 +18,7 @@ #import "GRPCCall+Cronet.h" -const GRPCTransportID gGRPCCoreCronetId = "io.grpc.transport.core.cronet"; +const GRPCTransportID gGRPCCoreCronetID = "io.grpc.transport.core.cronet"; static BOOL useCronet = NO; static stream_engine *globalCronetEngine; diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 73ee530ef2c..87c2768187e 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -186,14 +186,14 @@ NSString *const kGRPCErrorDomain = @"io.grpc"; // continuously create interceptor until one is successfully created while (_firstInterceptor == nil) { if (interceptorFactories.count == 0) { - _firstInterceptor = [[GRPCTransportManager alloc] initWithTransportId:_callOptions.transport + _firstInterceptor = [[GRPCTransportManager alloc] initWithTransportID:_callOptions.transport previousInterceptor:dispatcher]; break; } else { _firstInterceptor = [[GRPCInterceptorManager alloc] initWithFactories:interceptorFactories previousInterceptor:dispatcher - transportId:_callOptions.transport]; + transportID:_callOptions.transport]; if (_firstInterceptor == nil) { [interceptorFactories removeObjectAtIndex:0]; } diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.m b/src/objective-c/GRPCClient/GRPCCallOptions.m index f9044ddcd34..d147b2305a2 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.m +++ b/src/objective-c/GRPCClient/GRPCCallOptions.m @@ -289,7 +289,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { if (!areObjectsEqual(callOptions.PEMCertificateChain, _PEMCertificateChain)) return NO; if (!areObjectsEqual(callOptions.hostNameOverride, _hostNameOverride)) return NO; if (!(callOptions.transportType == _transportType)) return NO; - if (!(TransportIdIsEqual(callOptions.transport, _transport))) return NO; + if (!(TransportIDIsEqual(callOptions.transport, _transport))) return NO; if (!areObjectsEqual(callOptions.logContext, _logContext)) return NO; if (!areObjectsEqual(callOptions.channelPoolDomain, _channelPoolDomain)) return NO; if (!(callOptions.channelID == _channelID)) return NO; @@ -314,7 +314,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) { result ^= _PEMCertificateChain.hash; result ^= _hostNameOverride.hash; result ^= _transportType; - result ^= TransportIdHash(_transport); + result ^= TransportIDHash(_transport); result ^= _logContext.hash; result ^= _channelPoolDomain.hash; result ^= _channelID; diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.h b/src/objective-c/GRPCClient/GRPCInterceptor.h index ed907a33054..5c203445fba 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.h +++ b/src/objective-c/GRPCClient/GRPCInterceptor.h @@ -177,7 +177,7 @@ NS_ASSUME_NONNULL_BEGIN - (nullable instancetype)initWithFactories:(nullable NSArray> *)factories previousInterceptor:(nullable id)previousInterceptor - transportId:(GRPCTransportID)transportId; + transportID:(GRPCTransportID)transportID; /** * Notify the manager that the interceptor has shut down and the manager should release references diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.m b/src/objective-c/GRPCClient/GRPCInterceptor.m index 1a64bccb89b..ea723369737 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.m +++ b/src/objective-c/GRPCClient/GRPCInterceptor.m @@ -31,13 +31,13 @@ GRPCInterceptor *_thisInterceptor; dispatch_queue_t _dispatchQueue; NSArray> *_factories; - GRPCTransportID _transportId; + GRPCTransportID _transportID; BOOL _shutDown; } - (instancetype)initWithFactories:(NSArray> *)factories previousInterceptor:(id)previousInterceptor - transportId:(nonnull GRPCTransportID)transportId { + transportID:(nonnull GRPCTransportID)transportID { if ((self = [super init])) { if (factories.count == 0) { [NSException raise:NSInternalInconsistencyException @@ -62,7 +62,7 @@ _dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); } dispatch_set_target_queue(_dispatchQueue, _thisInterceptor.dispatchQueue); - _transportId = transportId; + _transportID = transportID; } return self; } @@ -87,12 +87,12 @@ while (_nextInterceptor == nil) { if (interceptorFactories.count == 0) { _nextInterceptor = - [[GRPCTransportManager alloc] initWithTransportId:_transportId previousInterceptor:self]; + [[GRPCTransportManager alloc] initWithTransportID:_transportID previousInterceptor:self]; break; } else { _nextInterceptor = [[GRPCInterceptorManager alloc] initWithFactories:interceptorFactories previousInterceptor:self - transportId:_transportId]; + transportID:_transportID]; if (_nextInterceptor == nil) { [interceptorFactories removeObjectAtIndex:0]; } diff --git a/src/objective-c/GRPCClient/GRPCTransport.h b/src/objective-c/GRPCClient/GRPCTransport.h index d9f341d08a3..a29dbd20e4d 100644 --- a/src/objective-c/GRPCClient/GRPCTransport.h +++ b/src/objective-c/GRPCClient/GRPCTransport.h @@ -34,10 +34,10 @@ extern const struct GRPCDefaultTransportImplList { } GRPCDefaultTransportImplList; /** Returns whether two transport id's are identical. */ -BOOL TransportIdIsEqual(GRPCTransportID lhs, GRPCTransportID rhs); +BOOL TransportIDIsEqual(GRPCTransportID lhs, GRPCTransportID rhs); /** Returns the hash value of a transport id. */ -NSUInteger TransportIdHash(GRPCTransportID); +NSUInteger TransportIDHash(GRPCTransportID); #pragma mark Transport and factory @@ -63,10 +63,10 @@ NSUInteger TransportIdHash(GRPCTransportID); /** * Register a transport implementation with the registry. All transport implementations to be used * in a process must register with the registry on process start-up in its +load: class method. - * Parameter \a transportId is the identifier of the implementation, and \a factory is the factory + * Parameter \a transportID is the identifier of the implementation, and \a factory is the factory * object to create the corresponding transport instance. */ -- (void)registerTransportWithId:(GRPCTransportID)transportId +- (void)registerTransportWithID:(GRPCTransportID)transportID factory:(id)factory; @end diff --git a/src/objective-c/GRPCClient/GRPCTransport.m b/src/objective-c/GRPCClient/GRPCTransport.m index 353300c3bc4..c55beca0c4a 100644 --- a/src/objective-c/GRPCClient/GRPCTransport.m +++ b/src/objective-c/GRPCClient/GRPCTransport.m @@ -18,28 +18,28 @@ #import "GRPCTransport.h" -static const GRPCTransportID gGRPCCoreSecureId = "io.grpc.transport.core.secure"; -static const GRPCTransportID gGRPCCoreInsecureId = "io.grpc.transport.core.insecure"; +static const GRPCTransportID gGRPCCoreSecureID = "io.grpc.transport.core.secure"; +static const GRPCTransportID gGRPCCoreInsecureID = "io.grpc.transport.core.insecure"; const struct GRPCDefaultTransportImplList GRPCDefaultTransportImplList = { - .core_secure = gGRPCCoreSecureId, .core_insecure = gGRPCCoreInsecureId}; + .core_secure = gGRPCCoreSecureID, .core_insecure = gGRPCCoreInsecureID}; -static const GRPCTransportID gDefaultTransportId = gGRPCCoreSecureId; +static const GRPCTransportID gDefaultTransportID = gGRPCCoreSecureID; static GRPCTransportRegistry *gTransportRegistry = nil; static dispatch_once_t initTransportRegistry; -BOOL TransportIdIsEqual(GRPCTransportID lhs, GRPCTransportID rhs) { +BOOL TransportIDIsEqual(GRPCTransportID lhs, GRPCTransportID rhs) { // Directly comparing pointers works because we require users to use the id provided by each // implementation, not coming up with their own string. return lhs == rhs; } -NSUInteger TransportIdHash(GRPCTransportID transportId) { - if (transportId == NULL) { - transportId = gDefaultTransportId; +NSUInteger TransportIDHash(GRPCTransportID transportID) { + if (transportID == NULL) { + transportID = gDefaultTransportID; } - return [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding].hash; + return [NSString stringWithCString:transportID encoding:NSUTF8StringEncoding].hash; } @implementation GRPCTransportRegistry { @@ -66,25 +66,25 @@ NSUInteger TransportIdHash(GRPCTransportID transportId) { return self; } -- (void)registerTransportWithId:(GRPCTransportID)transportId +- (void)registerTransportWithID:(GRPCTransportID)transportID factory:(id)factory { - NSString *nsTransportId = [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding]; - NSAssert(_registry[nsTransportId] == nil, @"The transport %@ has already been registered.", - nsTransportId); - if (_registry[nsTransportId] != nil) { - NSLog(@"The transport %@ has already been registered.", nsTransportId); + NSString *nsTransportID = [NSString stringWithCString:transportID encoding:NSUTF8StringEncoding]; + NSAssert(_registry[nsTransportID] == nil, @"The transport %@ has already been registered.", + nsTransportID); + if (_registry[nsTransportID] != nil) { + NSLog(@"The transport %@ has already been registered.", nsTransportID); return; } - _registry[nsTransportId] = factory; + _registry[nsTransportID] = factory; // if the default transport is registered, mark it. - if (0 == strcmp(transportId, gDefaultTransportId)) { + if (0 == strcmp(transportID, gDefaultTransportID)) { _defaultFactory = factory; } } -- (id)getTransportFactoryWithId:(GRPCTransportID)transportId { - if (transportId == NULL) { +- (id)getTransportFactoryWithID:(GRPCTransportID)transportID { + if (transportID == NULL) { if (_defaultFactory == nil) { // fall back to default transport if no transport is provided [NSException raise:NSInvalidArgumentException @@ -93,17 +93,17 @@ NSUInteger TransportIdHash(GRPCTransportID transportId) { } return _defaultFactory; } - NSString *nsTransportId = [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding]; - id transportFactory = _registry[nsTransportId]; + NSString *nsTransportID = [NSString stringWithCString:transportID encoding:NSUTF8StringEncoding]; + id transportFactory = _registry[nsTransportID]; if (transportFactory == nil) { if (_defaultFactory != nil) { // fall back to default transport if no transport is found NSLog(@"Unable to find transport with id %s; falling back to default transport.", - transportId); + transportID); return _defaultFactory; } else { [NSException raise:NSInvalidArgumentException - format:@"Unable to find transport with id %s", transportId]; + format:@"Unable to find transport with id %s", transportID]; return nil; } } diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m index 89a12d96575..92670c89e52 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m @@ -53,7 +53,7 @@ - (id)channelFactory { if (_callOptions.transport != NULL) { id transportFactory = - [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:_callOptions.transport]; + [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithID:_callOptions.transport]; if (! [transportFactory respondsToSelector:@selector(createCoreChannelFactoryWithCallOptions:)]) { // impossible because we are using GRPCCore now @@ -84,7 +84,7 @@ } case GRPCTransportTypeCronet: { id transportFactory = (id)[ - [GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:gGRPCCoreCronetId]; + [GRPCTransportRegistry sharedInstance] getTransportFactoryWithID:gGRPCCoreCronetID]; return [transportFactory createCoreChannelFactoryWithCallOptions:_callOptions]; } case GRPCTransportTypeInsecure: diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h index 83d279d2c72..a36da1b502d 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.h @@ -24,7 +24,7 @@ * testing purpose only on Github. * * To use this transport, a user must include the GRPCCoreCronet module as a - * dependency of the project and use gGRPCCoreCronetId in call options to + * dependency of the project and use gGRPCCoreCronetID in call options to * specify that this is the transport to be used for a call. */ @interface GRPCCoreCronetFactory : NSObject diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m index 5772694fc54..2205d167d82 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m @@ -39,7 +39,7 @@ static dispatch_once_t gInitGRPCCoreCronetFactory; + (void)load { [[GRPCTransportRegistry sharedInstance] - registerTransportWithId:gGRPCCoreCronetId + registerTransportWithID:gGRPCCoreCronetID factory:[GRPCCoreCronetFactory sharedInstance]]; } diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m index 19d7231a203..928625f1275 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m @@ -40,7 +40,7 @@ static dispatch_once_t gInitGRPCCoreInsecureFactory; + (void)load { [[GRPCTransportRegistry sharedInstance] - registerTransportWithId:GRPCDefaultTransportImplList.core_secure + registerTransportWithID:GRPCDefaultTransportImplList.core_secure factory:[self sharedInstance]]; } @@ -75,7 +75,7 @@ static dispatch_once_t gInitGRPCCoreInsecureFactory; + (void)load { [[GRPCTransportRegistry sharedInstance] - registerTransportWithId:GRPCDefaultTransportImplList.core_insecure + registerTransportWithID:GRPCDefaultTransportImplList.core_insecure factory:[self sharedInstance]]; } diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m index 1f6a25ff78f..6a3853fc94e 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m @@ -115,7 +115,7 @@ static NSMutableDictionary *gHostCache; if (_transportType == GRPCTransportTypeInsecure) { options.transport = GRPCDefaultTransportImplList.core_insecure; } else if ([GRPCCall isUsingCronet]) { - options.transport = gGRPCCoreCronetId; + options.transport = gGRPCCoreCronetID; } else { options.transport = GRPCDefaultTransportImplList.core_secure; } diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h index eaf07950815..4574e51b39f 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h @@ -31,13 +31,13 @@ NS_ASSUME_NONNULL_BEGIN * registered with the registry, the default transport factory (core + secure) is returned. If the * default transport does not exist, an exception is thrown. */ -- (id)getTransportFactoryWithId:(GRPCTransportID)transportId; +- (id)getTransportFactoryWithID:(GRPCTransportID)transportID; @end @interface GRPCTransportManager : NSObject -- (instancetype)initWithTransportId:(GRPCTransportID)transportId +- (instancetype)initWithTransportID:(GRPCTransportID)transportID previousInterceptor:(id)previousInterceptor; /** diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m index aa9c7f2ce58..3084ed9ee4e 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m @@ -21,27 +21,27 @@ #import @implementation GRPCTransportManager { - GRPCTransportID _transportId; + GRPCTransportID _transportID; GRPCTransport *_transport; id _previousInterceptor; dispatch_queue_t _dispatchQueue; } -- (instancetype)initWithTransportId:(GRPCTransportID)transportId +- (instancetype)initWithTransportID:(GRPCTransportID)transportID previousInterceptor:(id)previousInterceptor { if ((self = [super init])) { id factory = - [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:transportId]; + [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithID:transportID]; _transport = [factory createTransportWithManager:self]; - NSAssert(_transport != nil, @"Failed to create transport with id: %s", transportId); + NSAssert(_transport != nil, @"Failed to create transport with id: %s", transportID); if (_transport == nil) { - NSLog(@"Failed to create transport with id: %s", transportId); + NSLog(@"Failed to create transport with id: %s", transportID); return nil; } _previousInterceptor = previousInterceptor; _dispatchQueue = _transport.dispatchQueue; - _transportId = transportId; + _transportID = transportID; } return self; } @@ -58,7 +58,7 @@ - (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { - if (_transportId != callOptions.transport) { + if (_transportID != callOptions.transport) { [NSException raise:NSInvalidArgumentException format:@"Interceptors cannot change the call option 'transport'"]; return; diff --git a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m index f4cd9e064d2..883734de26f 100644 --- a/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m +++ b/src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m @@ -53,7 +53,7 @@ static int32_t kRemoteInteropServerOverhead = 12; } + (GRPCTransportID)transport { - return gGRPCCoreCronetId; + return gGRPCCoreCronetID; } - (int32_t)encodingOverhead { diff --git a/src/objective-c/tests/CronetTests/TransportRegistryTests.m b/src/objective-c/tests/CronetTests/TransportRegistryTests.m index 75802e17c4f..9e9be5ed733 100644 --- a/src/objective-c/tests/CronetTests/TransportRegistryTests.m +++ b/src/objective-c/tests/CronetTests/TransportRegistryTests.m @@ -30,9 +30,9 @@ - (void)testCronetImplementationExist { id secureTransportFactory = [[GRPCTransportRegistry sharedInstance] - getTransportFactoryWithId:GRPCDefaultTransportImplList.core_secure]; + getTransportFactoryWithID:GRPCDefaultTransportImplList.core_secure]; id cronetTransportFactory = - [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:gGRPCCoreCronetId]; + [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithID:gGRPCCoreCronetID]; XCTAssertNotNil(secureTransportFactory); XCTAssertNotNil(cronetTransportFactory); XCTAssertNotEqual(secureTransportFactory, cronetTransportFactory); diff --git a/src/objective-c/tests/InteropTests/InteropTests.m b/src/objective-c/tests/InteropTests/InteropTests.m index 0c7ef44e0fa..9a10cccecd4 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.m +++ b/src/objective-c/tests/InteropTests/InteropTests.m @@ -1268,7 +1268,7 @@ static dispatch_once_t initGlobalInterceptorFactory; - (void)testKeepaliveWithV2API { XCTAssertNotNil([[self class] host]); - if ([[self class] transport] == gGRPCCoreCronetId) { + if ([[self class] transport] == gGRPCCoreCronetID) { // Cronet does not support keepalive return; } diff --git a/src/objective-c/tests/UnitTests/TransportRegistryTests.m b/src/objective-c/tests/UnitTests/TransportRegistryTests.m index 40035fefa90..6fbf02d925d 100644 --- a/src/objective-c/tests/UnitTests/TransportRegistryTests.m +++ b/src/objective-c/tests/UnitTests/TransportRegistryTests.m @@ -30,9 +30,9 @@ - (void)testDefaultImplementationsExist { id secureTransportFactory = [[GRPCTransportRegistry sharedInstance] - getTransportFactoryWithId:GRPCDefaultTransportImplList.core_secure]; + getTransportFactoryWithID:GRPCDefaultTransportImplList.core_secure]; id insecureTransportFactory = [[GRPCTransportRegistry sharedInstance] - getTransportFactoryWithId:GRPCDefaultTransportImplList.core_insecure]; + getTransportFactoryWithID:GRPCDefaultTransportImplList.core_insecure]; XCTAssertNotNil(secureTransportFactory); XCTAssertNotNil(insecureTransportFactory); XCTAssertNotEqual(secureTransportFactory, insecureTransportFactory); @@ -40,9 +40,9 @@ - (void)testCronetImplementationNotExistAndFallBack { id secureTransportFactory = [[GRPCTransportRegistry sharedInstance] - getTransportFactoryWithId:GRPCDefaultTransportImplList.core_secure]; + getTransportFactoryWithID:GRPCDefaultTransportImplList.core_secure]; id cronetTransportFactory = - [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithId:gGRPCCoreCronetId]; + [[GRPCTransportRegistry sharedInstance] getTransportFactoryWithID:gGRPCCoreCronetID]; XCTAssertNotNil(secureTransportFactory); XCTAssertNotNil(cronetTransportFactory); XCTAssertEqual(secureTransportFactory, cronetTransportFactory); From 361a902262e72f3d647df933b3f4f84a51920996 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Fri, 6 Sep 2019 14:20:39 -0700 Subject: [PATCH 589/661] Reviewer comments --- test/cpp/end2end/end2end_test.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index a4655329250..5fb69c177b6 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -341,8 +341,7 @@ class End2endTest : public ::testing::TestWithParam { void ResetChannel( std::vector< std::unique_ptr> - interceptor_creators = std::vector>()) { + interceptor_creators = {}) { if (!is_server_started_) { StartServer(std::shared_ptr()); } @@ -380,8 +379,7 @@ class End2endTest : public ::testing::TestWithParam { void ResetStub( std::vector< std::unique_ptr> - interceptor_creators = std::vector>()) { + interceptor_creators = {}) { ResetChannel(std::move(interceptor_creators)); if (GetParam().use_proxy) { proxy_service_.reset(new Proxy(channel_)); From 56acfb9f26df67700824fe9b3f7c8c4e042f0c3c Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 6 Sep 2019 18:18:32 -0700 Subject: [PATCH 590/661] Thread safety fix --- src/objective-c/GRPCClient/GRPCInterceptor.h | 17 ++++--- src/objective-c/GRPCClient/GRPCInterceptor.m | 45 +++++++++++++++---- .../private/GRPCCore/GRPCCallInternal.m | 32 +++++++++---- .../private/GRPCTransport+Private.h | 14 +++++- .../private/GRPCTransport+Private.m | 25 ++++++++--- 5 files changed, 103 insertions(+), 30 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.h b/src/objective-c/GRPCClient/GRPCInterceptor.h index 5c203445fba..e3f49f444c4 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.h +++ b/src/objective-c/GRPCClient/GRPCInterceptor.h @@ -164,10 +164,17 @@ NS_ASSUME_NONNULL_BEGIN @end /** - * The interceptor manager object retains reference to the next and previous interceptor object in - * the interceptor chain, and forward corresponding events to them. When a call terminates, it must - * invoke shutDown method of its corresponding manager so that references to other interceptors can - * be released. + * GRPCInterceptorManager is a helper class to forward messages between the interceptors. The + * interceptor manager object retains reference to the next and previous interceptor object in the + * interceptor chain, and forward corresponding events to them. + * + * All methods except the initializer of the class can only be called on the manager's dispatch + * queue. Since the manager's dispatch queue targets corresponding interceptor's dispatch queue, it + * is also safe to call the manager's methods in the corresponding interceptor instance's methods + * that implement GRPCInterceptorInterface. + * + * When an interceptor is shutting down, it must invoke -shutDown method of its corresponding + * manager so that references to other interceptors can be released and proper clean-up is made. */ @interface GRPCInterceptorManager : NSObject @@ -182,8 +189,6 @@ NS_ASSUME_NONNULL_BEGIN /** * Notify the manager that the interceptor has shut down and the manager should release references * to other interceptors and stop forwarding requests/responses. - * - * The method can only be called by the manager's associated interceptor. */ - (void)shutDown; diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.m b/src/objective-c/GRPCClient/GRPCInterceptor.m index ea723369737..3aae52f7d4e 100644 --- a/src/objective-c/GRPCClient/GRPCInterceptor.m +++ b/src/objective-c/GRPCClient/GRPCInterceptor.m @@ -226,47 +226,74 @@ - (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { - [_thisInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; + // retain this interceptor until the method exit to prevent deallocation of the interceptor within + // the interceptor's method + GRPCInterceptor *thisInterceptor = _thisInterceptor; + [thisInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; } - (void)writeData:(id)data { - [_thisInterceptor writeData:data]; + // retain this interceptor until the method exit to prevent deallocation of the interceptor within + // the interceptor's method + GRPCInterceptor *thisInterceptor = _thisInterceptor; + [thisInterceptor writeData:data]; } - (void)finish { - [_thisInterceptor finish]; + // retain this interceptor until the method exit to prevent deallocation of the interceptor within + // the interceptor's method + GRPCInterceptor *thisInterceptor = _thisInterceptor; + [thisInterceptor finish]; } - (void)cancel { - [_thisInterceptor cancel]; + // retain this interceptor until the method exit to prevent deallocation of the interceptor within + // the interceptor's method + GRPCInterceptor *thisInterceptor = _thisInterceptor; + [thisInterceptor cancel]; } - (void)receiveNextMessages:(NSUInteger)numberOfMessages { - [_thisInterceptor receiveNextMessages:numberOfMessages]; + // retain this interceptor until the method exit to prevent deallocation of the interceptor within + // the interceptor's method + GRPCInterceptor *thisInterceptor = _thisInterceptor; + [thisInterceptor receiveNextMessages:numberOfMessages]; } - (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata { if ([_thisInterceptor respondsToSelector:@selector(didReceiveInitialMetadata:)]) { - [_thisInterceptor didReceiveInitialMetadata:initialMetadata]; + // retain this interceptor until the method exit to prevent deallocation of the interceptor + // within the interceptor's method + GRPCInterceptor *thisInterceptor = _thisInterceptor; + [thisInterceptor didReceiveInitialMetadata:initialMetadata]; } } - (void)didReceiveData:(id)data { if ([_thisInterceptor respondsToSelector:@selector(didReceiveData:)]) { - [_thisInterceptor didReceiveData:data]; + // retain this interceptor until the method exit to prevent deallocation of the interceptor + // within the interceptor's method + GRPCInterceptor *thisInterceptor = _thisInterceptor; + [thisInterceptor didReceiveData:data]; } } - (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata error:(nullable NSError *)error { if ([_thisInterceptor respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) { - [_thisInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; + // retain this interceptor until the method exit to prevent deallocation of the interceptor + // within the interceptor's method + GRPCInterceptor *thisInterceptor = _thisInterceptor; + [thisInterceptor didCloseWithTrailingMetadata:trailingMetadata error:error]; } } - (void)didWriteData { if ([_thisInterceptor respondsToSelector:@selector(didWriteData)]) { - [_thisInterceptor didWriteData]; + // retain this interceptor until the method exit to prevent deallocation of the interceptor + // within the interceptor's method + GRPCInterceptor *thisInterceptor = _thisInterceptor; + [thisInterceptor didWriteData]; } } diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m index ea01fcaf594..4c42ba80399 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCallInternal.m @@ -155,7 +155,7 @@ self->_initialMetadataPublished = YES; [self issueInitialMetadata:self->_call.responseHeaders]; } - [self issueClosedWithTrailingMetadata:self->_call.responseTrailers error:errorOrNil]; + [self issueCloseWithTrailingMetadata:self->_call.responseTrailers error:errorOrNil]; } // Clearing _call must happen *after* dispatching close in order to get trailing // metadata from _call. @@ -250,24 +250,40 @@ - (void)issueInitialMetadata:(NSDictionary *)initialMetadata { if (initialMetadata != nil) { - [_transportManager forwardPreviousInterceptorWithInitialMetadata:initialMetadata]; + // cannot directly call callback because this may not be running on manager's dispatch queue + GRPCTransportManager *copiedManager = _transportManager; + dispatch_async(copiedManager.dispatchQueue, ^{ + [copiedManager forwardPreviousInterceptorWithInitialMetadata:initialMetadata]; + }); } } - (void)issueMessage:(id)message { if (message != nil) { - [_transportManager forwardPreviousInterceptorWithData:message]; + // cannot directly call callback because this may not be running on manager's dispatch queue + GRPCTransportManager *copiedManager = _transportManager; + dispatch_async(copiedManager.dispatchQueue, ^{ + [copiedManager forwardPreviousInterceptorWithData:message]; + }); } } -- (void)issueClosedWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { - [_transportManager forwardPreviousInterceptorCloseWithTrailingMetadata:trailingMetadata - error:error]; - [_transportManager shutDown]; +- (void)issueCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { + // cannot directly call callback because this may not be running on manager's dispatch queue + GRPCTransportManager *copiedManager = _transportManager; + dispatch_async(copiedManager.dispatchQueue, ^{ + [copiedManager forwardPreviousInterceptorCloseWithTrailingMetadata:trailingMetadata + error:error]; + [copiedManager shutDown]; + }); } - (void)issueDidWriteData { - [_transportManager forwardPreviousInterceptorDidWriteData]; + // cannot directly call callback because this may not be running on manager's dispatch queue + GRPCTransportManager *copiedManager = _transportManager; + dispatch_async(copiedManager.dispatchQueue, ^{ + [copiedManager forwardPreviousInterceptorDidWriteData]; + }); } - (void)receiveNextMessages:(NSUInteger)numberOfMessages { diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h index 4574e51b39f..184aa287f0b 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.h +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.h @@ -35,6 +35,18 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * GRPCTransportManager is a helper class to forward messages between the last interceptor and the + * transport instance. + * + * All methods except the initializer of the class can only be called on the manager's dispatch + * queue. Since the manager's dispatch queue is the same as the transport's dispatch queue, it is + * also safe to call the manager's methods in the corresponding transport instance's methods that + * implement GRPCInterceptorInterface. + * + * When a transport instance is shutting down, it must call -shutDown method of its associated + * transport manager for proper clean-up. + */ @interface GRPCTransportManager : NSObject - (instancetype)initWithTransportID:(GRPCTransportID)transportID @@ -43,8 +55,6 @@ NS_ASSUME_NONNULL_BEGIN /** * Notify the manager that the transport has shut down and the manager should release references to * its response handler and stop forwarding requests/responses. - * - * The method can only be called by the manager's associated transport instance. */ - (void)shutDown; diff --git a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m index 3084ed9ee4e..81c7dd1de1e 100644 --- a/src/objective-c/GRPCClient/private/GRPCTransport+Private.m +++ b/src/objective-c/GRPCClient/private/GRPCTransport+Private.m @@ -63,23 +63,38 @@ format:@"Interceptors cannot change the call option 'transport'"]; return; } - [_transport startWithRequestOptions:requestOptions callOptions:callOptions]; + // retain the transport instance until the method exit to prevent deallocation of the transport + // instance within the method + GRPCTransport *transport = _transport; + [transport startWithRequestOptions:requestOptions callOptions:callOptions]; } - (void)writeData:(id)data { - [_transport writeData:data]; + // retain the transport instance until the method exit to prevent deallocation of the transport + // instance within the method + GRPCTransport *transport = _transport; + [transport writeData:data]; } - (void)finish { - [_transport finish]; + // retain the transport instance until the method exit to prevent deallocation of the transport + // instance within the method + GRPCTransport *transport = _transport; + [transport finish]; } - (void)cancel { - [_transport cancel]; + // retain the transport instance until the method exit to prevent deallocation of the transport + // instance within the method + GRPCTransport *transport = _transport; + [transport cancel]; } - (void)receiveNextMessages:(NSUInteger)numberOfMessages { - [_transport receiveNextMessages:numberOfMessages]; + // retain the transport instance until the method exit to prevent deallocation of the transport + // instance within the method + GRPCTransport *transport = _transport; + [transport receiveNextMessages:numberOfMessages]; } /** Forward initial metadata to the previous interceptor in the chain */ From c9376b4e0bbd14808636ad0410e0b0387431d792 Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Mon, 12 Aug 2019 11:07:22 -0400 Subject: [PATCH 591/661] Use cycle clock instead of clock monotonic to measure call latency. This removes two more getttime syscalls from the hot path, when cycle clock is enabled. --- .../ext/filters/client_channel/client_channel.cc | 5 +++-- .../client_channel/health/health_check_client.cc | 4 ++-- src/core/ext/filters/client_channel/subchannel.h | 3 ++- src/core/lib/channel/channel_stack.h | 3 ++- src/core/lib/gpr/time_precise.cc | 15 +++++++++++++++ src/core/lib/gpr/time_precise.h | 1 + src/core/lib/surface/call.cc | 6 +++--- test/core/channel/channel_stack_test.cc | 16 ++++++++-------- test/cpp/microbenchmarks/bm_call_create.cc | 2 +- 9 files changed, 37 insertions(+), 18 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 40ac1f22059..51210107872 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -720,7 +720,7 @@ class CallData { grpc_deadline_state deadline_state_; grpc_slice path_; // Request path. - gpr_timespec call_start_time_; + gpr_cycle_counter call_start_time_; grpc_millis deadline_; Arena* arena_; grpc_call_stack* owning_call_; @@ -3730,7 +3730,8 @@ void CallData::ApplyServiceConfigToCallLocked(grpc_call_element* elem) { // from the client API, reset the deadline timer. if (chand->deadline_checking_enabled() && method_params_->timeout() != 0) { const grpc_millis per_method_deadline = - grpc_timespec_to_millis_round_up(call_start_time_) + + grpc_timespec_to_millis_round_up( + gpr_cycle_counter_to_time(call_start_time_)) + method_params_->timeout(); if (per_method_deadline < deadline_) { deadline_ = per_method_deadline; diff --git a/src/core/ext/filters/client_channel/health/health_check_client.cc b/src/core/ext/filters/client_channel/health/health_check_client.cc index 026831645c0..2662d8466b6 100644 --- a/src/core/ext/filters/client_channel/health/health_check_client.cc +++ b/src/core/ext/filters/client_channel/health/health_check_client.cc @@ -304,8 +304,8 @@ void HealthCheckClient::CallState::StartCall() { health_check_client_->connected_subchannel_, &pollent_, GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH, - gpr_now(GPR_CLOCK_MONOTONIC), // start_time - GRPC_MILLIS_INF_FUTURE, // deadline + gpr_get_cycle_counter(), // start_time + GRPC_MILLIS_INF_FUTURE, // deadline arena_, context_, &call_combiner_, diff --git a/src/core/ext/filters/client_channel/subchannel.h b/src/core/ext/filters/client_channel/subchannel.h index d745bc8ddc2..c178401ca8a 100644 --- a/src/core/ext/filters/client_channel/subchannel.h +++ b/src/core/ext/filters/client_channel/subchannel.h @@ -26,6 +26,7 @@ #include "src/core/ext/filters/client_channel/subchannel_pool_interface.h" #include "src/core/lib/backoff/backoff.h" #include "src/core/lib/channel/channel_stack.h" +#include "src/core/lib/gpr/time_precise.h" #include "src/core/lib/gprpp/arena.h" #include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/ref_counted.h" @@ -104,7 +105,7 @@ class SubchannelCall { RefCountedPtr connected_subchannel; grpc_polling_entity* pollent; grpc_slice path; - gpr_timespec start_time; + gpr_cycle_counter start_time; grpc_millis deadline; Arena* arena; grpc_call_context_element* context; diff --git a/src/core/lib/channel/channel_stack.h b/src/core/lib/channel/channel_stack.h index a7c28d059f3..f7be806b695 100644 --- a/src/core/lib/channel/channel_stack.h +++ b/src/core/lib/channel/channel_stack.h @@ -42,6 +42,7 @@ #include #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gpr/time_precise.h" #include "src/core/lib/gprpp/arena.h" #include "src/core/lib/iomgr/call_combiner.h" #include "src/core/lib/iomgr/polling_entity.h" @@ -67,7 +68,7 @@ typedef struct { const void* server_transport_data; grpc_call_context_element* context; const grpc_slice& path; - gpr_timespec start_time; + gpr_cycle_counter start_time; grpc_millis deadline; grpc_core::Arena* arena; grpc_core::CallCombiner* call_combiner; diff --git a/src/core/lib/gpr/time_precise.cc b/src/core/lib/gpr/time_precise.cc index 9d11c66831c..56b00d119ad 100644 --- a/src/core/lib/gpr/time_precise.cc +++ b/src/core/lib/gpr/time_precise.cc @@ -122,6 +122,16 @@ gpr_timespec gpr_cycle_counter_to_time(gpr_cycle_counter cycles) { return ts; } +gpr_timespec gpr_cycle_counter_sub(gpr_cycle_counter a, gpr_cycle_counter b) { + double secs = static_cast(a - b) / cycles_per_second; + gpr_timespec ts; + ts.tv_sec = static_cast(secs); + ts.tv_nsec = static_cast(GPR_NS_PER_SEC * + (secs - static_cast(ts.tv_sec))); + ts.clock_type = GPR_TIMESPAN; + return ts; +} + void gpr_precise_clock_now(gpr_timespec* clk) { int64_t counter = gpr_get_cycle_counter(); *clk = gpr_cycle_counter_to_time(counter); @@ -146,4 +156,9 @@ void gpr_precise_clock_now(gpr_timespec* clk) { *clk = gpr_now(GPR_CLOCK_REALTIME); clk->clock_type = GPR_CLOCK_PRECISE; } + +gpr_timespec gpr_cycle_counter_sub(gpr_cycle_counter a, gpr_cycle_counter b) { + return gpr_time_sub(gpr_cycle_counter_to_time(a), + gpr_cycle_counter_to_time(b)); +} #endif /* GPR_CYCLE_COUNTER_FALLBACK */ diff --git a/src/core/lib/gpr/time_precise.h b/src/core/lib/gpr/time_precise.h index ce16bafab2d..55eceb6c8ba 100644 --- a/src/core/lib/gpr/time_precise.h +++ b/src/core/lib/gpr/time_precise.h @@ -61,5 +61,6 @@ gpr_cycle_counter gpr_get_cycle_counter(); void gpr_precise_clock_init(void); void gpr_precise_clock_now(gpr_timespec* clk); gpr_timespec gpr_cycle_counter_to_time(gpr_cycle_counter cycles); +gpr_timespec gpr_cycle_counter_sub(gpr_cycle_counter a, gpr_cycle_counter b); #endif /* GRPC_CORE_LIB_GPR_TIME_PRECISE_H */ diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 5388cbd75a9..435f536b3df 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -36,6 +36,7 @@ #include "src/core/lib/debug/stats.h" #include "src/core/lib/gpr/alloc.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gpr/time_precise.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/arena.h" #include "src/core/lib/gprpp/manual_constructor.h" @@ -154,7 +155,7 @@ struct grpc_call { grpc_completion_queue* cq; grpc_polling_entity pollent; grpc_channel* channel; - gpr_timespec start_time = gpr_now(GPR_CLOCK_MONOTONIC); + gpr_cycle_counter start_time = gpr_get_cycle_counter(); /* parent_call* */ gpr_atm parent_call_atm = 0; child_call* child = nullptr; @@ -552,8 +553,7 @@ static void destroy_call(void* call, grpc_error* error) { &(c->final_info.error_string)); GRPC_ERROR_UNREF(status_error); c->final_info.stats.latency = - gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), c->start_time); - + gpr_cycle_counter_sub(gpr_get_cycle_counter(), c->start_time); grpc_call_stack_destroy(CALL_STACK_FROM_CALL(c), &c->final_info, GRPC_CLOSURE_INIT(&c->release_call, release_call, c, grpc_schedule_on_exec_ctx)); diff --git a/test/core/channel/channel_stack_test.cc b/test/core/channel/channel_stack_test.cc index 14726336f92..3f15a0010bd 100644 --- a/test/core/channel/channel_stack_test.cc +++ b/test/core/channel/channel_stack_test.cc @@ -117,14 +117,14 @@ static void test_create_channel_stack(void) { call_stack = static_cast(gpr_malloc(channel_stack->call_stack_size)); const grpc_call_element_args args = { - call_stack, /* call_stack */ - nullptr, /* server_transport_data */ - nullptr, /* context */ - path, /* path */ - gpr_now(GPR_CLOCK_MONOTONIC), /* start_time */ - GRPC_MILLIS_INF_FUTURE, /* deadline */ - nullptr, /* arena */ - nullptr, /* call_combiner */ + call_stack, /* call_stack */ + nullptr, /* server_transport_data */ + nullptr, /* context */ + path, /* path */ + gpr_get_cycle_counter(), /* start_time */ + GRPC_MILLIS_INF_FUTURE, /* deadline */ + nullptr, /* arena */ + nullptr, /* call_combiner */ }; grpc_error* error = grpc_call_stack_init(channel_stack, 1, free_call, call_stack, &args); diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 99ea1e053e9..e3c853d4430 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -523,7 +523,7 @@ static void BM_IsolatedFilter(benchmark::State& state) { grpc_call_stack* call_stack = static_cast(gpr_zalloc(channel_stack->call_stack_size)); grpc_millis deadline = GRPC_MILLIS_INF_FUTURE; - gpr_timespec start_time = gpr_now(GPR_CLOCK_MONOTONIC); + gpr_cycle_counter start_time = gpr_get_cycle_counter(); grpc_slice method = grpc_slice_from_static_string("/foo/bar"); grpc_call_final_info final_info; TestOp test_op_data; From 81a29ae1a62bb8e7877ea100cc975ea27d431a7e Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Mon, 12 Aug 2019 17:32:47 -0400 Subject: [PATCH 592/661] Mark double-second local variables as const. --- src/core/lib/gpr/time_precise.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/lib/gpr/time_precise.cc b/src/core/lib/gpr/time_precise.cc index 56b00d119ad..3223a84c7ad 100644 --- a/src/core/lib/gpr/time_precise.cc +++ b/src/core/lib/gpr/time_precise.cc @@ -113,7 +113,8 @@ void gpr_precise_clock_init(void) { } gpr_timespec gpr_cycle_counter_to_time(gpr_cycle_counter cycles) { - double secs = static_cast(cycles - start_cycle) / cycles_per_second; + const double secs = + static_cast(cycles - start_cycle) / cycles_per_second; gpr_timespec ts; ts.tv_sec = static_cast(secs); ts.tv_nsec = static_cast(GPR_NS_PER_SEC * @@ -123,7 +124,7 @@ gpr_timespec gpr_cycle_counter_to_time(gpr_cycle_counter cycles) { } gpr_timespec gpr_cycle_counter_sub(gpr_cycle_counter a, gpr_cycle_counter b) { - double secs = static_cast(a - b) / cycles_per_second; + const double secs = static_cast(a - b) / cycles_per_second; gpr_timespec ts; ts.tv_sec = static_cast(secs); ts.tv_nsec = static_cast(GPR_NS_PER_SEC * From 7b84f81a8ca570c3d1e74bbb98d8d38de2bce3c7 Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Tue, 13 Aug 2019 15:04:03 -0400 Subject: [PATCH 593/661] Add grpc_cycle_counter_to_millis(). --- .../filters/client_channel/client_channel.cc | 3 +-- src/core/lib/iomgr/exec_ctx.cc | 17 +++++++++++++++++ src/core/lib/iomgr/exec_ctx.h | 3 +++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 51210107872..0a9b5ac43fb 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -3730,8 +3730,7 @@ void CallData::ApplyServiceConfigToCallLocked(grpc_call_element* elem) { // from the client API, reset the deadline timer. if (chand->deadline_checking_enabled() && method_params_->timeout() != 0) { const grpc_millis per_method_deadline = - grpc_timespec_to_millis_round_up( - gpr_cycle_counter_to_time(call_start_time_)) + + grpc_cycle_counter_to_millis_round_up(call_start_time_) + method_params_->timeout(); if (per_method_deadline < deadline_) { deadline_ = per_method_deadline; diff --git a/src/core/lib/iomgr/exec_ctx.cc b/src/core/lib/iomgr/exec_ctx.cc index a847b4dcefc..5cb778de98e 100644 --- a/src/core/lib/iomgr/exec_ctx.cc +++ b/src/core/lib/iomgr/exec_ctx.cc @@ -52,6 +52,7 @@ static void exec_ctx_sched(grpc_closure* closure, grpc_error* error) { } static gpr_timespec g_start_time; +static gpr_cycle_counter g_start_cycle; static grpc_millis timespec_to_millis_round_down(gpr_timespec ts) { ts = gpr_time_sub(ts, g_start_time); @@ -101,6 +102,16 @@ grpc_millis grpc_timespec_to_millis_round_up(gpr_timespec ts) { gpr_convert_clock_type(ts, g_start_time.clock_type)); } +grpc_millis grpc_cycle_counter_to_millis_round_down(gpr_cycle_counter cycles) { + return timespec_to_millis_round_down( + gpr_time_add(g_start_time, gpr_cycle_counter_sub(cycles, g_start_cycle))); +} + +grpc_millis grpc_cycle_counter_to_millis_round_up(gpr_cycle_counter cycles) { + return timespec_to_millis_round_up( + gpr_time_add(g_start_time, gpr_cycle_counter_sub(cycles, g_start_cycle))); +} + static const grpc_closure_scheduler_vtable exec_ctx_scheduler_vtable = { exec_ctx_run, exec_ctx_sched, "exec_ctx"}; static grpc_closure_scheduler exec_ctx_scheduler = {&exec_ctx_scheduler_vtable}; @@ -117,7 +128,13 @@ void ExecCtx::TestOnlyGlobalInit(gpr_timespec new_val) { } void ExecCtx::GlobalInit(void) { + // gpr_now(GPR_CLOCK_MONOTONIC) incurs a syscall. We don't actually know the + // exact cycle the time was captured, so we use the average of cycles before + // and after the syscall as the starting cycle. + const gpr_cycle_counter cycle_before = gpr_get_cycle_counter(); g_start_time = gpr_now(GPR_CLOCK_MONOTONIC); + const gpr_cycle_counter cycle_after = gpr_get_cycle_counter(); + g_start_cycle = (cycle_before + cycle_after) / 2; gpr_tls_init(&exec_ctx_); } diff --git a/src/core/lib/iomgr/exec_ctx.h b/src/core/lib/iomgr/exec_ctx.h index daf019c41ee..0ccf2a878bf 100644 --- a/src/core/lib/iomgr/exec_ctx.h +++ b/src/core/lib/iomgr/exec_ctx.h @@ -26,6 +26,7 @@ #include #include +#include "src/core/lib/gpr/time_precise.h" #include "src/core/lib/gpr/tls.h" #include "src/core/lib/gprpp/fork.h" #include "src/core/lib/iomgr/closure.h" @@ -58,6 +59,8 @@ extern grpc_closure_scheduler* grpc_schedule_on_exec_ctx; gpr_timespec grpc_millis_to_timespec(grpc_millis millis, gpr_clock_type clock); grpc_millis grpc_timespec_to_millis_round_down(gpr_timespec timespec); grpc_millis grpc_timespec_to_millis_round_up(gpr_timespec timespec); +grpc_millis grpc_cycle_counter_to_millis_round_down(gpr_cycle_counter cycles); +grpc_millis grpc_cycle_counter_to_millis_round_up(gpr_cycle_counter cycles); namespace grpc_core { /** Execution context. From 4b2b00b35bb8be4752b4b986640ef76dd0eadc40 Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Tue, 13 Aug 2019 15:25:34 -0400 Subject: [PATCH 594/661] Optimize cycle to millis conversion by bypassing sub+add. --- src/core/lib/iomgr/exec_ctx.cc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/core/lib/iomgr/exec_ctx.cc b/src/core/lib/iomgr/exec_ctx.cc index 5cb778de98e..730237a250d 100644 --- a/src/core/lib/iomgr/exec_ctx.cc +++ b/src/core/lib/iomgr/exec_ctx.cc @@ -54,8 +54,7 @@ static void exec_ctx_sched(grpc_closure* closure, grpc_error* error) { static gpr_timespec g_start_time; static gpr_cycle_counter g_start_cycle; -static grpc_millis timespec_to_millis_round_down(gpr_timespec ts) { - ts = gpr_time_sub(ts, g_start_time); +static grpc_millis timespan_to_millis_round_down(gpr_timespec ts) { double x = GPR_MS_PER_SEC * static_cast(ts.tv_sec) + static_cast(ts.tv_nsec) / GPR_NS_PER_MS; if (x < 0) return 0; @@ -63,8 +62,11 @@ static grpc_millis timespec_to_millis_round_down(gpr_timespec ts) { return static_cast(x); } -static grpc_millis timespec_to_millis_round_up(gpr_timespec ts) { - ts = gpr_time_sub(ts, g_start_time); +static grpc_millis timespec_to_millis_round_down(gpr_timespec ts) { + return timespan_to_millis_round_down(gpr_time_sub(ts, g_start_time)); +} + +static grpc_millis timespan_to_millis_round_up(gpr_timespec ts) { double x = GPR_MS_PER_SEC * static_cast(ts.tv_sec) + static_cast(ts.tv_nsec) / GPR_NS_PER_MS + static_cast(GPR_NS_PER_SEC - 1) / @@ -74,6 +76,10 @@ static grpc_millis timespec_to_millis_round_up(gpr_timespec ts) { return static_cast(x); } +static grpc_millis timespec_to_millis_round_up(gpr_timespec ts) { + return timespan_to_millis_round_up(gpr_time_sub(ts, g_start_time)); +} + gpr_timespec grpc_millis_to_timespec(grpc_millis millis, gpr_clock_type clock_type) { // special-case infinities as grpc_millis can be 32bit on some platforms @@ -103,13 +109,13 @@ grpc_millis grpc_timespec_to_millis_round_up(gpr_timespec ts) { } grpc_millis grpc_cycle_counter_to_millis_round_down(gpr_cycle_counter cycles) { - return timespec_to_millis_round_down( - gpr_time_add(g_start_time, gpr_cycle_counter_sub(cycles, g_start_cycle))); + return timespan_to_millis_round_down( + gpr_cycle_counter_sub(cycles, g_start_cycle)); } grpc_millis grpc_cycle_counter_to_millis_round_up(gpr_cycle_counter cycles) { - return timespec_to_millis_round_up( - gpr_time_add(g_start_time, gpr_cycle_counter_sub(cycles, g_start_cycle))); + return timespan_to_millis_round_up( + gpr_cycle_counter_sub(cycles, g_start_cycle)); } static const grpc_closure_scheduler_vtable exec_ctx_scheduler_vtable = { From c965ca14940dda1606109d959204d3eaeef9c1d6 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Mon, 9 Sep 2019 10:12:39 -0700 Subject: [PATCH 595/661] Pull out configuration from ssl_utils --- BUILD | 2 ++ BUILD.gn | 2 ++ CMakeLists.txt | 2 ++ Makefile | 3 ++ build.yaml | 2 ++ config.m4 | 1 + config.w32 | 1 + gRPC-Core.podspec | 3 ++ grpc.gemspec | 2 ++ grpc.gyp | 1 + package.xml | 2 ++ .../interop/app/src/main/cpp/grpc-interop.cc | 2 +- .../security/security_connector/ssl_utils.cc | 13 +------- .../security/security_connector/ssl_utils.h | 4 +-- .../security_connector/ssl_utils_config.cc | 32 +++++++++++++++++++ .../security_connector/ssl_utils_config.h | 30 +++++++++++++++++ .../CronetTests/CoreCronetEnd2EndTests.mm | 2 +- src/python/grpcio/grpc_core_dependencies.py | 1 + test/core/bad_ssl/bad_ssl_test.cc | 2 +- test/core/end2end/fixtures/h2_spiffe.cc | 2 +- test/core/end2end/fixtures/h2_ssl.cc | 2 +- .../end2end/fixtures/h2_ssl_cred_reload.cc | 2 +- test/core/end2end/fixtures/h2_ssl_proxy.cc | 2 +- test/core/end2end/h2_ssl_cert_test.cc | 2 +- .../core/end2end/h2_ssl_session_reuse_test.cc | 2 +- test/core/http/httpscli_test.cc | 2 +- tools/doxygen/Doxyfile.core.internal | 2 ++ 27 files changed, 98 insertions(+), 25 deletions(-) create mode 100644 src/core/lib/security/security_connector/ssl_utils_config.cc create mode 100644 src/core/lib/security/security_connector/ssl_utils_config.h diff --git a/BUILD b/BUILD index d911050b1be..576325c82f1 100644 --- a/BUILD +++ b/BUILD @@ -1580,6 +1580,7 @@ grpc_cc_library( "src/core/lib/security/security_connector/security_connector.cc", "src/core/lib/security/security_connector/ssl/ssl_security_connector.cc", "src/core/lib/security/security_connector/ssl_utils.cc", + "src/core/lib/security/security_connector/ssl_utils_config.cc", "src/core/lib/security/security_connector/tls/spiffe_security_connector.cc", "src/core/lib/security/transport/client_auth_filter.cc", "src/core/lib/security/transport/secure_endpoint.cc", @@ -1617,6 +1618,7 @@ grpc_cc_library( "src/core/lib/security/security_connector/security_connector.h", "src/core/lib/security/security_connector/ssl/ssl_security_connector.h", "src/core/lib/security/security_connector/ssl_utils.h", + "src/core/lib/security/security_connector/ssl_utils_config.h", "src/core/lib/security/security_connector/tls/spiffe_security_connector.h", "src/core/lib/security/transport/auth_filters.h", "src/core/lib/security/transport/secure_endpoint.h", diff --git a/BUILD.gn b/BUILD.gn index 771e968f366..3d0363cf175 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -749,6 +749,8 @@ config("grpc_config") { "src/core/lib/security/security_connector/ssl/ssl_security_connector.h", "src/core/lib/security/security_connector/ssl_utils.cc", "src/core/lib/security/security_connector/ssl_utils.h", + "src/core/lib/security/security_connector/ssl_utils_config.cc", + "src/core/lib/security/security_connector/ssl_utils_config.h", "src/core/lib/security/security_connector/tls/spiffe_security_connector.cc", "src/core/lib/security/security_connector/tls/spiffe_security_connector.h", "src/core/lib/security/transport/auth_filters.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 599f1441583..08a49697750 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1194,6 +1194,7 @@ add_library(grpc src/core/lib/security/security_connector/security_connector.cc src/core/lib/security/security_connector/ssl/ssl_security_connector.cc src/core/lib/security/security_connector/ssl_utils.cc + src/core/lib/security/security_connector/ssl_utils_config.cc src/core/lib/security/security_connector/tls/spiffe_security_connector.cc src/core/lib/security/transport/client_auth_filter.cc src/core/lib/security/transport/secure_endpoint.cc @@ -1717,6 +1718,7 @@ add_library(grpc_cronet src/core/lib/security/security_connector/security_connector.cc src/core/lib/security/security_connector/ssl/ssl_security_connector.cc src/core/lib/security/security_connector/ssl_utils.cc + src/core/lib/security/security_connector/ssl_utils_config.cc src/core/lib/security/security_connector/tls/spiffe_security_connector.cc src/core/lib/security/transport/client_auth_filter.cc src/core/lib/security/transport/secure_endpoint.cc diff --git a/Makefile b/Makefile index e666a19eb79..b24a27acfe6 100644 --- a/Makefile +++ b/Makefile @@ -3770,6 +3770,7 @@ LIBGRPC_SRC = \ src/core/lib/security/security_connector/security_connector.cc \ src/core/lib/security/security_connector/ssl/ssl_security_connector.cc \ src/core/lib/security/security_connector/ssl_utils.cc \ + src/core/lib/security/security_connector/ssl_utils_config.cc \ src/core/lib/security/security_connector/tls/spiffe_security_connector.cc \ src/core/lib/security/transport/client_auth_filter.cc \ src/core/lib/security/transport/secure_endpoint.cc \ @@ -4288,6 +4289,7 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/security/security_connector/security_connector.cc \ src/core/lib/security/security_connector/ssl/ssl_security_connector.cc \ src/core/lib/security/security_connector/ssl_utils.cc \ + src/core/lib/security/security_connector/ssl_utils_config.cc \ src/core/lib/security/security_connector/tls/spiffe_security_connector.cc \ src/core/lib/security/transport/client_auth_filter.cc \ src/core/lib/security/transport/secure_endpoint.cc \ @@ -22686,6 +22688,7 @@ src/core/lib/security/security_connector/local/local_security_connector.cc: $(OP src/core/lib/security/security_connector/security_connector.cc: $(OPENSSL_DEP) src/core/lib/security/security_connector/ssl/ssl_security_connector.cc: $(OPENSSL_DEP) src/core/lib/security/security_connector/ssl_utils.cc: $(OPENSSL_DEP) +src/core/lib/security/security_connector/ssl_utils_config.cc: $(OPENSSL_DEP) src/core/lib/security/security_connector/tls/spiffe_security_connector.cc: $(OPENSSL_DEP) src/core/lib/security/transport/client_auth_filter.cc: $(OPENSSL_DEP) src/core/lib/security/transport/secure_endpoint.cc: $(OPENSSL_DEP) diff --git a/build.yaml b/build.yaml index 15203f242c9..dc5fd4236da 100644 --- a/build.yaml +++ b/build.yaml @@ -1274,6 +1274,7 @@ filegroups: - src/core/lib/security/security_connector/security_connector.h - src/core/lib/security/security_connector/ssl/ssl_security_connector.h - src/core/lib/security/security_connector/ssl_utils.h + - src/core/lib/security/security_connector/ssl_utils_config.h - src/core/lib/security/security_connector/tls/spiffe_security_connector.h - src/core/lib/security/transport/auth_filters.h - src/core/lib/security/transport/secure_endpoint.h @@ -1309,6 +1310,7 @@ filegroups: - src/core/lib/security/security_connector/security_connector.cc - src/core/lib/security/security_connector/ssl/ssl_security_connector.cc - src/core/lib/security/security_connector/ssl_utils.cc + - src/core/lib/security/security_connector/ssl_utils_config.cc - src/core/lib/security/security_connector/tls/spiffe_security_connector.cc - src/core/lib/security/transport/client_auth_filter.cc - src/core/lib/security/transport/secure_endpoint.cc diff --git a/config.m4 b/config.m4 index efa86576f84..15455a8e114 100644 --- a/config.m4 +++ b/config.m4 @@ -304,6 +304,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/security/security_connector/security_connector.cc \ src/core/lib/security/security_connector/ssl/ssl_security_connector.cc \ src/core/lib/security/security_connector/ssl_utils.cc \ + src/core/lib/security/security_connector/ssl_utils_config.cc \ src/core/lib/security/security_connector/tls/spiffe_security_connector.cc \ src/core/lib/security/transport/client_auth_filter.cc \ src/core/lib/security/transport/secure_endpoint.cc \ diff --git a/config.w32 b/config.w32 index 13b5f1350f0..f5adca6fb53 100644 --- a/config.w32 +++ b/config.w32 @@ -274,6 +274,7 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\security\\security_connector\\security_connector.cc " + "src\\core\\lib\\security\\security_connector\\ssl\\ssl_security_connector.cc " + "src\\core\\lib\\security\\security_connector\\ssl_utils.cc " + + "src\\core\\lib\\security\\security_connector\\ssl_utils_config.cc " + "src\\core\\lib\\security\\security_connector\\tls\\spiffe_security_connector.cc " + "src\\core\\lib\\security\\transport\\client_auth_filter.cc " + "src\\core\\lib\\security\\transport\\secure_endpoint.cc " + diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 658a3ad6158..3770425e5e3 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -310,6 +310,7 @@ Pod::Spec.new do |s| 'src/core/lib/security/security_connector/security_connector.h', 'src/core/lib/security/security_connector/ssl/ssl_security_connector.h', 'src/core/lib/security/security_connector/ssl_utils.h', + 'src/core/lib/security/security_connector/ssl_utils_config.h', 'src/core/lib/security/security_connector/tls/spiffe_security_connector.h', 'src/core/lib/security/transport/auth_filters.h', 'src/core/lib/security/transport/secure_endpoint.h', @@ -802,6 +803,7 @@ Pod::Spec.new do |s| 'src/core/lib/security/security_connector/security_connector.cc', 'src/core/lib/security/security_connector/ssl/ssl_security_connector.cc', 'src/core/lib/security/security_connector/ssl_utils.cc', + 'src/core/lib/security/security_connector/ssl_utils_config.cc', 'src/core/lib/security/security_connector/tls/spiffe_security_connector.cc', 'src/core/lib/security/transport/client_auth_filter.cc', 'src/core/lib/security/transport/secure_endpoint.cc', @@ -1044,6 +1046,7 @@ Pod::Spec.new do |s| 'src/core/lib/security/security_connector/security_connector.h', 'src/core/lib/security/security_connector/ssl/ssl_security_connector.h', 'src/core/lib/security/security_connector/ssl_utils.h', + 'src/core/lib/security/security_connector/ssl_utils_config.h', 'src/core/lib/security/security_connector/tls/spiffe_security_connector.h', 'src/core/lib/security/transport/auth_filters.h', 'src/core/lib/security/transport/secure_endpoint.h', diff --git a/grpc.gemspec b/grpc.gemspec index 1b705016cee..431dd9f8f7e 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -240,6 +240,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/security/security_connector/security_connector.h ) s.files += %w( src/core/lib/security/security_connector/ssl/ssl_security_connector.h ) s.files += %w( src/core/lib/security/security_connector/ssl_utils.h ) + s.files += %w( src/core/lib/security/security_connector/ssl_utils_config.h ) s.files += %w( src/core/lib/security/security_connector/tls/spiffe_security_connector.h ) s.files += %w( src/core/lib/security/transport/auth_filters.h ) s.files += %w( src/core/lib/security/transport/secure_endpoint.h ) @@ -732,6 +733,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/security/security_connector/security_connector.cc ) s.files += %w( src/core/lib/security/security_connector/ssl/ssl_security_connector.cc ) s.files += %w( src/core/lib/security/security_connector/ssl_utils.cc ) + s.files += %w( src/core/lib/security/security_connector/ssl_utils_config.cc ) s.files += %w( src/core/lib/security/security_connector/tls/spiffe_security_connector.cc ) s.files += %w( src/core/lib/security/transport/client_auth_filter.cc ) s.files += %w( src/core/lib/security/transport/secure_endpoint.cc ) diff --git a/grpc.gyp b/grpc.gyp index 5468675e768..b0168dc15df 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -504,6 +504,7 @@ 'src/core/lib/security/security_connector/security_connector.cc', 'src/core/lib/security/security_connector/ssl/ssl_security_connector.cc', 'src/core/lib/security/security_connector/ssl_utils.cc', + 'src/core/lib/security/security_connector/ssl_utils_config.cc', 'src/core/lib/security/security_connector/tls/spiffe_security_connector.cc', 'src/core/lib/security/transport/client_auth_filter.cc', 'src/core/lib/security/transport/secure_endpoint.cc', diff --git a/package.xml b/package.xml index 385a57c77ea..fb43cf9c4d7 100644 --- a/package.xml +++ b/package.xml @@ -245,6 +245,7 @@ + @@ -737,6 +738,7 @@ + diff --git a/src/android/test/interop/app/src/main/cpp/grpc-interop.cc b/src/android/test/interop/app/src/main/cpp/grpc-interop.cc index b5075529be2..15cf44fb88d 100644 --- a/src/android/test/interop/app/src/main/cpp/grpc-interop.cc +++ b/src/android/test/interop/app/src/main/cpp/grpc-interop.cc @@ -19,7 +19,7 @@ #include #include -#include "src/core/lib/security/security_connector/ssl_utils.h" +#include "src/core/lib/security/security_connector/ssl_utils_config.h" #include "test/cpp/interop/interop_client.h" extern "C" JNIEXPORT void JNICALL diff --git a/src/core/lib/security/security_connector/ssl_utils.cc b/src/core/lib/security/security_connector/ssl_utils.cc index ebb4a3f9ee8..bacd31a1f30 100644 --- a/src/core/lib/security/security_connector/ssl_utils.cc +++ b/src/core/lib/security/security_connector/ssl_utils.cc @@ -28,12 +28,12 @@ #include "src/core/ext/transport/chttp2/alpn/alpn.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/global_config.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/security/context/security_context.h" #include "src/core/lib/security/security_connector/load_system_roots.h" +#include "src/core/lib/security/security_connector/ssl_utils_config.h" #include "src/core/tsi/ssl_transport_security.h" /* -- Constants. -- */ @@ -45,17 +45,6 @@ static const char* installed_roots_path = INSTALL_PREFIX "/share/grpc/roots.pem"; #endif -/** Config variable that points to the default SSL roots file. This file - must be a PEM encoded file with all the roots such as the one that can be - downloaded from https://pki.google.com/roots.pem. */ -GPR_GLOBAL_CONFIG_DEFINE_STRING(grpc_default_ssl_roots_file_path, "", - "Path to the default SSL roots file."); - -/** Config variable used as a flag to enable/disable loading system root - certificates from the OS trust store. */ -GPR_GLOBAL_CONFIG_DEFINE_BOOL(grpc_not_use_system_ssl_roots, false, - "Disable loading system root certificates."); - #ifndef TSI_OPENSSL_ALPN_SUPPORT #define TSI_OPENSSL_ALPN_SUPPORT 1 #endif diff --git a/src/core/lib/security/security_connector/ssl_utils.h b/src/core/lib/security/security_connector/ssl_utils.h index 29366b309e8..c13dd90a932 100644 --- a/src/core/lib/security/security_connector/ssl_utils.h +++ b/src/core/lib/security/security_connector/ssl_utils.h @@ -31,13 +31,11 @@ #include "src/core/lib/gprpp/string_view.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/security/security_connector/security_connector.h" +#include "src/core/lib/security/security_connector/ssl_utils_config.h" #include "src/core/tsi/ssl_transport_security.h" #include "src/core/tsi/transport_security.h" #include "src/core/tsi/transport_security_interface.h" -GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_default_ssl_roots_file_path); -GPR_GLOBAL_CONFIG_DECLARE_BOOL(grpc_not_use_system_ssl_roots); - /* --- Util --- */ /* --- URL schemes. --- */ diff --git a/src/core/lib/security/security_connector/ssl_utils_config.cc b/src/core/lib/security/security_connector/ssl_utils_config.cc new file mode 100644 index 00000000000..2d056a781fd --- /dev/null +++ b/src/core/lib/security/security_connector/ssl_utils_config.cc @@ -0,0 +1,32 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#include "src/core/lib/security/security_connector/ssl_utils_config.h" + +/** Config variable that points to the default SSL roots file. This file + must be a PEM encoded file with all the roots such as the one that can be + downloaded from https://pki.google.com/roots.pem. */ +GPR_GLOBAL_CONFIG_DEFINE_STRING(grpc_default_ssl_roots_file_path, "", + "Path to the default SSL roots file."); + +/** Config variable used as a flag to enable/disable loading system root + certificates from the OS trust store. */ +GPR_GLOBAL_CONFIG_DEFINE_BOOL(grpc_not_use_system_ssl_roots, false, + "Disable loading system root certificates."); diff --git a/src/core/lib/security/security_connector/ssl_utils_config.h b/src/core/lib/security/security_connector/ssl_utils_config.h new file mode 100644 index 00000000000..efaf497ab1e --- /dev/null +++ b/src/core/lib/security/security_connector/ssl_utils_config.h @@ -0,0 +1,30 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_SSL_UTILS_CONFIG_H +#define GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_SSL_UTILS_CONFIG_H + +#include + +#include "src/core/lib/gprpp/global_config.h" + +GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_default_ssl_roots_file_path); +GPR_GLOBAL_CONFIG_DECLARE_BOOL(grpc_not_use_system_ssl_roots); + +#endif /* GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_SSL_UTILS_CONFIG_H \ + */ diff --git a/src/objective-c/tests/CronetTests/CoreCronetEnd2EndTests.mm b/src/objective-c/tests/CronetTests/CoreCronetEnd2EndTests.mm index ad426014a5b..c3963874f77 100644 --- a/src/objective-c/tests/CronetTests/CoreCronetEnd2EndTests.mm +++ b/src/objective-c/tests/CronetTests/CoreCronetEnd2EndTests.mm @@ -41,7 +41,7 @@ #include "src/core/lib/gpr/tmpfile.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/security/credentials/credentials.h" -#include "src/core/lib/security/security_connector/ssl_utils.h" +#include "src/core/lib/security/security_connector/ssl_utils_config.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 6eb8bc8c9c1..9ef13c117ee 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -273,6 +273,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/security/security_connector/security_connector.cc', 'src/core/lib/security/security_connector/ssl/ssl_security_connector.cc', 'src/core/lib/security/security_connector/ssl_utils.cc', + 'src/core/lib/security/security_connector/ssl_utils_config.cc', 'src/core/lib/security/security_connector/tls/spiffe_security_connector.cc', 'src/core/lib/security/transport/client_auth_filter.cc', 'src/core/lib/security/transport/secure_endpoint.cc', diff --git a/test/core/bad_ssl/bad_ssl_test.cc b/test/core/bad_ssl/bad_ssl_test.cc index deae9072613..0480815443a 100644 --- a/test/core/bad_ssl/bad_ssl_test.cc +++ b/test/core/bad_ssl/bad_ssl_test.cc @@ -28,7 +28,7 @@ #include "src/core/lib/gpr/string.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/gprpp/memory.h" -#include "src/core/lib/security/security_connector/ssl_utils.h" +#include "src/core/lib/security/security_connector/ssl_utils_config.h" #include "test/core/end2end/cq_verifier.h" #include "test/core/util/port.h" #include "test/core/util/subprocess.h" diff --git a/test/core/end2end/fixtures/h2_spiffe.cc b/test/core/end2end/fixtures/h2_spiffe.cc index 37fb44b5ad6..c56a13b17a0 100644 --- a/test/core/end2end/fixtures/h2_spiffe.cc +++ b/test/core/end2end/fixtures/h2_spiffe.cc @@ -35,7 +35,7 @@ #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h" -#include "src/core/lib/security/security_connector/ssl_utils.h" +#include "src/core/lib/security/security_connector/ssl_utils_config.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_ssl.cc b/test/core/end2end/fixtures/h2_ssl.cc index cb55bb72061..4e09bccd0a3 100644 --- a/test/core/end2end/fixtures/h2_ssl.cc +++ b/test/core/end2end/fixtures/h2_ssl.cc @@ -29,7 +29,7 @@ #include "src/core/lib/gpr/tmpfile.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/security/credentials/credentials.h" -#include "src/core/lib/security/security_connector/ssl_utils.h" +#include "src/core/lib/security/security_connector/ssl_utils_config.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_ssl_cred_reload.cc b/test/core/end2end/fixtures/h2_ssl_cred_reload.cc index 2a9591845b9..e5a05570809 100644 --- a/test/core/end2end/fixtures/h2_ssl_cred_reload.cc +++ b/test/core/end2end/fixtures/h2_ssl_cred_reload.cc @@ -29,7 +29,7 @@ #include "src/core/lib/gpr/tmpfile.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/security/credentials/credentials.h" -#include "src/core/lib/security/security_connector/ssl_utils.h" +#include "src/core/lib/security/security_connector/ssl_utils_config.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.cc b/test/core/end2end/fixtures/h2_ssl_proxy.cc index b16ffa1b8b8..77420e38b3a 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.cc +++ b/test/core/end2end/fixtures/h2_ssl_proxy.cc @@ -28,7 +28,7 @@ #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/tmpfile.h" #include "src/core/lib/security/credentials/credentials.h" -#include "src/core/lib/security/security_connector/ssl_utils.h" +#include "src/core/lib/security/security_connector/ssl_utils_config.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/end2end/fixtures/proxy.h" #include "test/core/util/port.h" diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc index 34a9ef760b5..2b97ab3d3f7 100644 --- a/test/core/end2end/h2_ssl_cert_test.cc +++ b/test/core/end2end/h2_ssl_cert_test.cc @@ -29,7 +29,7 @@ #include "src/core/lib/gpr/tmpfile.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/security/credentials/credentials.h" -#include "src/core/lib/security/security_connector/ssl_utils.h" +#include "src/core/lib/security/security_connector/ssl_utils_config.h" #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" diff --git a/test/core/end2end/h2_ssl_session_reuse_test.cc b/test/core/end2end/h2_ssl_session_reuse_test.cc index 6ffc138820e..ed450aebf1b 100644 --- a/test/core/end2end/h2_ssl_session_reuse_test.cc +++ b/test/core/end2end/h2_ssl_session_reuse_test.cc @@ -29,7 +29,7 @@ #include "src/core/lib/gpr/tmpfile.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/security/credentials/credentials.h" -#include "src/core/lib/security/security_connector/ssl_utils.h" +#include "src/core/lib/security/security_connector/ssl_utils_config.h" #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" diff --git a/test/core/http/httpscli_test.cc b/test/core/http/httpscli_test.cc index eb63367d750..79f0c1ea365 100644 --- a/test/core/http/httpscli_test.cc +++ b/test/core/http/httpscli_test.cc @@ -29,7 +29,7 @@ #include "src/core/lib/gpr/env.h" #include "src/core/lib/iomgr/iomgr.h" -#include "src/core/lib/security/security_connector/ssl_utils.h" +#include "src/core/lib/security/security_connector/ssl_utils_config.h" #include "test/core/util/port.h" #include "test/core/util/subprocess.h" #include "test/core/util/test_config.h" diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index ed6f88dde3c..10e11825f8d 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1502,6 +1502,8 @@ src/core/lib/security/security_connector/ssl/ssl_security_connector.cc \ src/core/lib/security/security_connector/ssl/ssl_security_connector.h \ src/core/lib/security/security_connector/ssl_utils.cc \ src/core/lib/security/security_connector/ssl_utils.h \ +src/core/lib/security/security_connector/ssl_utils_config.cc \ +src/core/lib/security/security_connector/ssl_utils_config.h \ src/core/lib/security/security_connector/tls/spiffe_security_connector.cc \ src/core/lib/security/security_connector/tls/spiffe_security_connector.h \ src/core/lib/security/transport/auth_filters.h \ From 0a3b333c045800e3be4e8fce8d1b28ee0123b6aa Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 9 Sep 2019 11:32:04 -0700 Subject: [PATCH 596/661] Fix internal warning --- bazel/python_rules.bzl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl index e65bae3f5b5..c2a16d6cce1 100644 --- a/bazel/python_rules.bzl +++ b/bazel/python_rules.bzl @@ -164,6 +164,8 @@ def py_grpc_library( stripped from the beginning of foo_pb2 modules imported by the generated stubs. This is useful in combination with the `imports` attribute of the `py_library` rule. + **kwargs: Additional arguments to be supplied to the invocation of + py_library. """ codegen_grpc_target = "_{}_grpc_codegen".format(name) if len(srcs) != 1: From 05901eaaa36fc85e357f0e717bce56bf796a6c09 Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Mon, 9 Sep 2019 14:14:26 -0400 Subject: [PATCH 597/661] Fix filter_latency.cc On Windows tests, clock monotonic doesn't progress. Switch to CLOCK_PRECISE to fix this. --- test/core/end2end/tests/filter_latency.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/core/end2end/tests/filter_latency.cc b/test/core/end2end/tests/filter_latency.cc index a89db7b094b..85de58a3d20 100644 --- a/test/core/end2end/tests/filter_latency.cc +++ b/test/core/end2end/tests/filter_latency.cc @@ -122,7 +122,7 @@ static void test_request(grpc_end2end_test_config config) { g_client_latency = gpr_time_0(GPR_TIMESPAN); g_server_latency = gpr_time_0(GPR_TIMESPAN); gpr_mu_unlock(&g_mu); - const gpr_timespec start_time = gpr_now(GPR_CLOCK_MONOTONIC); + const gpr_timespec start_time = gpr_now(GPR_CLOCK_REALTIME); gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, @@ -224,7 +224,7 @@ static void test_request(grpc_end2end_test_config config) { end_test(&f); config.tear_down_data(&f); - const gpr_timespec end_time = gpr_now(GPR_CLOCK_MONOTONIC); + const gpr_timespec end_time = gpr_now(GPR_CLOCK_REALTIME); const gpr_timespec max_latency = gpr_time_sub(end_time, start_time); // Perform checks after test tear-down From aa84ceb38ea48058de2ce940842e8aefdc0ae69d Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Mon, 9 Sep 2019 15:58:33 -0700 Subject: [PATCH 598/661] Add another test for when the credentials were previously set --- test/cpp/end2end/end2end_test.cc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 5fb69c177b6..778a3dc6507 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -1865,6 +1865,36 @@ TEST_P(SecureEnd2endTest, CallCredentialsInterception) { "fake_selector")); } +TEST_P(SecureEnd2endTest, CallCredentialsInterceptionWithSetCredentials) { + MAYBE_SKIP_TEST; + if (!GetParam().use_interceptors) { + return; + } + std::vector> + interceptor_creators; + interceptor_creators.push_back(std::unique_ptr( + new CredentialsInterceptorFactory())); + ResetStub(std::move(interceptor_creators)); + EchoRequest request; + EchoResponse response; + ClientContext context; + std::shared_ptr creds1 = + GoogleIAMCredentials("wrong_token", "wrong_selector"); + context.set_credentials(creds1); + request.set_message("Hello"); + request.mutable_param()->set_echo_metadata(true); + + Status s = stub_->Echo(&context, request, &response); + EXPECT_EQ(request.message(), response.message()); + EXPECT_TRUE(s.ok()); + EXPECT_TRUE(MetadataContains(context.GetServerTrailingMetadata(), + GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, + "fake_token")); + EXPECT_TRUE(MetadataContains(context.GetServerTrailingMetadata(), + GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY, + "fake_selector")); +} + TEST_P(SecureEnd2endTest, OverridePerCallCredentials) { MAYBE_SKIP_TEST; ResetStub(); From e7c9b46a1e4e01e0c0424dc774b2e1a970d7d164 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 9 Sep 2019 16:08:23 -0700 Subject: [PATCH 599/661] Move ErrorForBadProto --- src/objective-c/ProtoRPC/ProtoRPC.m | 18 ++++++++++++++++++ src/objective-c/ProtoRPC/ProtoRPCLegacy.m | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m index dbfa3c0f23d..9c0eb13d9d6 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.m +++ b/src/objective-c/ProtoRPC/ProtoRPC.m @@ -273,3 +273,21 @@ } @end + +/** + * Generate an NSError object that represents a failure in parsing a proto class. + */ +NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError) { + NSDictionary *info = @{ + NSLocalizedDescriptionKey : @"Unable to parse response from the server", + NSLocalizedRecoverySuggestionErrorKey : + @"If this RPC is idempotent, retry " + @"with exponential backoff. Otherwise, query the server status before " + @"retrying.", + NSUnderlyingErrorKey : parsingError, + @"Expected class" : expectedClass, + @"Received value" : proto, + }; + // TODO(jcanizales): Use kGRPCErrorDomain and GRPCErrorCodeInternal when they're public. + return [NSError errorWithDomain:@"io.grpc" code:13 userInfo:info]; +} diff --git a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m index 4ba93674063..eaa02e9170b 100644 --- a/src/objective-c/ProtoRPC/ProtoRPCLegacy.m +++ b/src/objective-c/ProtoRPC/ProtoRPCLegacy.m @@ -101,21 +101,3 @@ @implementation GRPCProtoCall @end - -/** - * Generate an NSError object that represents a failure in parsing a proto class. - */ -NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsingError) { - NSDictionary *info = @{ - NSLocalizedDescriptionKey : @"Unable to parse response from the server", - NSLocalizedRecoverySuggestionErrorKey : - @"If this RPC is idempotent, retry " - @"with exponential backoff. Otherwise, query the server status before " - @"retrying.", - NSUnderlyingErrorKey : parsingError, - @"Expected class" : expectedClass, - @"Received value" : proto, - }; - // TODO(jcanizales): Use kGRPCErrorDomain and GRPCErrorCodeInternal when they're public. - return [NSError errorWithDomain:@"io.grpc" code:13 userInfo:info]; -} From deb8d569bae85789c31c41b1d949a52d01915402 Mon Sep 17 00:00:00 2001 From: Na-Na Pang Date: Mon, 9 Sep 2019 19:35:11 -0700 Subject: [PATCH 600/661] Assign Karthik to next github rotation --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/cleanup_request.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/pull_request_template.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 4709997666e..66d87f4f508 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Report a bug about: Create a report to help us improve labels: kind/bug, priority/P2 -assignees: nanahpang +assignees: karthikravis --- diff --git a/.github/ISSUE_TEMPLATE/cleanup_request.md b/.github/ISSUE_TEMPLATE/cleanup_request.md index 4ec33fafb58..ee564f00630 100644 --- a/.github/ISSUE_TEMPLATE/cleanup_request.md +++ b/.github/ISSUE_TEMPLATE/cleanup_request.md @@ -2,7 +2,7 @@ name: Request a cleanup about: Suggest a cleanup in our repository labels: kind/internal cleanup -assignees: nanahpang +assignees: karthikravis --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index efa5b1611bb..b6ef503c7c2 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,7 +2,7 @@ name: Request a feature about: Suggest an idea for this project labels: kind/enhancement -assignees: nanahpang +assignees: karthikravis --- diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 55d8d600541..681d2f819ce 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,4 +8,4 @@ If you know who should review your pull request, please remove the mentioning be --> -@nanahpang +@karthikravis From 107db8dab43120ed4f2815eef5e3d52d5f5d480f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 29 Aug 2019 09:53:41 -0400 Subject: [PATCH 601/661] upgrade bazel to 0.29 --- templates/tools/dockerfile/bazel.include | 2 +- tools/bazel | 2 +- tools/dockerfile/test/bazel/Dockerfile | 2 +- tools/dockerfile/test/sanity/Dockerfile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/tools/dockerfile/bazel.include b/templates/tools/dockerfile/bazel.include index 12a22785623..9762bdcb85f 100644 --- a/templates/tools/dockerfile/bazel.include +++ b/templates/tools/dockerfile/bazel.include @@ -2,7 +2,7 @@ # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.28.1 +ENV BAZEL_VERSION 0.29.0 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/bazel b/tools/bazel index 4d1d57f60d9..cfa875b0e63 100755 --- a/tools/bazel +++ b/tools/bazel @@ -32,7 +32,7 @@ then exec -a "$0" "${BAZEL_REAL}" "$@" fi -VERSION=0.28.1 +VERSION=0.29.0 echo "INFO: Running bazel wrapper (see //tools/bazel for details), bazel version $VERSION will be used instead of system-wide bazel installation." diff --git a/tools/dockerfile/test/bazel/Dockerfile b/tools/dockerfile/test/bazel/Dockerfile index 7141fb9c5f1..fde54bae877 100644 --- a/tools/dockerfile/test/bazel/Dockerfile +++ b/tools/dockerfile/test/bazel/Dockerfile @@ -52,7 +52,7 @@ RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 t # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.28.1 +ENV BAZEL_VERSION 0.29.0 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile index badff52de34..4d3691f32bd 100644 --- a/tools/dockerfile/test/sanity/Dockerfile +++ b/tools/dockerfile/test/sanity/Dockerfile @@ -97,7 +97,7 @@ ENV CLANG_TIDY=clang-tidy # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.28.1 +ENV BAZEL_VERSION 0.29.0 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 From e88553ed17dd0c59f75c11869ce3b7fa6a6540d7 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 4 Sep 2019 03:48:40 -0400 Subject: [PATCH 602/661] upgrade windows RBE to bazel 0.29 --- tools/internal_ci/windows/bazel_rbe.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/internal_ci/windows/bazel_rbe.bat b/tools/internal_ci/windows/bazel_rbe.bat index 153b2d59687..e55534e2e84 100644 --- a/tools/internal_ci/windows/bazel_rbe.bat +++ b/tools/internal_ci/windows/bazel_rbe.bat @@ -14,7 +14,7 @@ @rem TODO(jtattermusch): make this generate less output @rem TODO(jtattermusch): use tools/bazel script to keep the versions in sync -choco install bazel -y --version 0.26.0 --limit-output +choco install bazel -y --version 0.29.0 --limit-output cd github/grpc set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH% From 5cd37064cb0533844d9150f3e90503fd55d68008 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 4 Sep 2019 04:09:21 -0400 Subject: [PATCH 603/661] try fix win RBE build --- tools/internal_ci/windows/bazel_rbe.bat | 2 +- tools/remote_build/windows.bazelrc | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/internal_ci/windows/bazel_rbe.bat b/tools/internal_ci/windows/bazel_rbe.bat index e55534e2e84..8d8ea118ebd 100644 --- a/tools/internal_ci/windows/bazel_rbe.bat +++ b/tools/internal_ci/windows/bazel_rbe.bat @@ -24,7 +24,7 @@ powershell -Command "[guid]::NewGuid().ToString()" >%KOKORO_ARTIFACTS_DIR%/bazel set /p BAZEL_INVOCATION_ID=<%KOKORO_ARTIFACTS_DIR%/bazel_invocation_ids @rem TODO(jtattermusch): windows RBE should be able to use the same credentials as Linux RBE. -bazel --bazelrc=tools/remote_build/windows.bazelrc build --invocation_id="%BAZEL_INVOCATION_ID%" --workspace_status_command=tools/remote_build/workspace_status_kokoro.sh :all --incompatible_disallow_filetype=false --google_credentials=%KOKORO_GFILE_DIR%/rbe-windows-credentials.json +bazel --bazelrc=tools/remote_build/windows.bazelrc build --invocation_id="%BAZEL_INVOCATION_ID%" --workspace_status_command=tools/remote_build/workspace_status_kokoro.sh :all --google_credentials=%KOKORO_GFILE_DIR%/rbe-windows-credentials.json set BAZEL_EXITCODE=%errorlevel% @rem TODO(jtattermusch): upload results to bigquery diff --git a/tools/remote_build/windows.bazelrc b/tools/remote_build/windows.bazelrc index 9fd3071e79f..825d6765de9 100644 --- a/tools/remote_build/windows.bazelrc +++ b/tools/remote_build/windows.bazelrc @@ -1,8 +1,7 @@ startup --host_jvm_args=-Dbazel.DigestFunction=SHA256 -build --remote_cache=remotebuildexecution.googleapis.com -build --remote_executor=remotebuildexecution.googleapis.com -build --tls_enabled=true +build --remote_cache=grpcs://remotebuildexecution.googleapis.com +build --remote_executor=grpcs://remotebuildexecution.googleapis.com build --host_crosstool_top=//third_party/toolchains/bazel_0.26.0_rbe_windows:toolchain build --crosstool_top=//third_party/toolchains/bazel_0.26.0_rbe_windows:toolchain @@ -38,7 +37,7 @@ test --test_env=GRPC_VERBOSITY=debug # Set flags for uploading to BES in order to view results in the Bazel Build # Results UI. -build --bes_backend="buildeventservice.googleapis.com" +build --bes_backend=grpcs://buildeventservice.googleapis.com build --bes_timeout=60s build --bes_results_url="https://source.cloud.google.com/results/invocations/" build --project_id=grpc-testing From 98d2d32b9edf9ff740d867e12ff529c0b637d980 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 10 Sep 2019 12:11:19 -0400 Subject: [PATCH 604/661] upgrade to bazel 0.29.1 --- templates/tools/dockerfile/bazel.include | 2 +- tools/bazel | 2 +- tools/dockerfile/test/bazel/Dockerfile | 2 +- tools/dockerfile/test/sanity/Dockerfile | 2 +- tools/internal_ci/windows/bazel_rbe.bat | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/tools/dockerfile/bazel.include b/templates/tools/dockerfile/bazel.include index 9762bdcb85f..f2124a62db8 100644 --- a/templates/tools/dockerfile/bazel.include +++ b/templates/tools/dockerfile/bazel.include @@ -2,7 +2,7 @@ # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.29.0 +ENV BAZEL_VERSION 0.29.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/bazel b/tools/bazel index cfa875b0e63..0ff7fa09487 100755 --- a/tools/bazel +++ b/tools/bazel @@ -32,7 +32,7 @@ then exec -a "$0" "${BAZEL_REAL}" "$@" fi -VERSION=0.29.0 +VERSION=0.29.1 echo "INFO: Running bazel wrapper (see //tools/bazel for details), bazel version $VERSION will be used instead of system-wide bazel installation." diff --git a/tools/dockerfile/test/bazel/Dockerfile b/tools/dockerfile/test/bazel/Dockerfile index fde54bae877..25fcf3e6f28 100644 --- a/tools/dockerfile/test/bazel/Dockerfile +++ b/tools/dockerfile/test/bazel/Dockerfile @@ -52,7 +52,7 @@ RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 t # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.29.0 +ENV BAZEL_VERSION 0.29.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile index 4d3691f32bd..b455a9171da 100644 --- a/tools/dockerfile/test/sanity/Dockerfile +++ b/tools/dockerfile/test/sanity/Dockerfile @@ -97,7 +97,7 @@ ENV CLANG_TIDY=clang-tidy # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 0.29.0 +ENV BAZEL_VERSION 0.29.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/internal_ci/windows/bazel_rbe.bat b/tools/internal_ci/windows/bazel_rbe.bat index 8d8ea118ebd..86dcc74c429 100644 --- a/tools/internal_ci/windows/bazel_rbe.bat +++ b/tools/internal_ci/windows/bazel_rbe.bat @@ -14,7 +14,7 @@ @rem TODO(jtattermusch): make this generate less output @rem TODO(jtattermusch): use tools/bazel script to keep the versions in sync -choco install bazel -y --version 0.29.0 --limit-output +choco install bazel -y --version 0.29.1 --limit-output cd github/grpc set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH% From 37491ccd32d879fce1daff06bf162f0a230a18bc Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 10 Sep 2019 14:07:37 -0700 Subject: [PATCH 605/661] Bump version to 1.25 --- BUILD | 4 ++-- build.yaml | 4 ++-- doc/g_stands_for.md | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/BUILD b/BUILD index 576325c82f1..b2be0a29b90 100644 --- a/BUILD +++ b/BUILD @@ -77,11 +77,11 @@ config_setting( python_config_settings() # This should be updated along with build.yaml -g_stands_for = "ganges" +g_stands_for = "game" core_version = "7.0.0" -version = "1.24.0-dev" +version = "1.25.0-dev" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/build.yaml b/build.yaml index dc5fd4236da..1164b9023ce 100644 --- a/build.yaml +++ b/build.yaml @@ -14,8 +14,8 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 8.0.0 csharp_major_version: 2 - g_stands_for: ganges - version: 1.24.0-dev + g_stands_for: game + version: 1.25.0-dev filegroups: - name: alts_tsi headers: diff --git a/doc/g_stands_for.md b/doc/g_stands_for.md index 413ddcb341d..ccc79b24916 100644 --- a/doc/g_stands_for.md +++ b/doc/g_stands_for.md @@ -23,4 +23,5 @@ - 1.21 'g' stands for ['gandalf'](https://github.com/grpc/grpc/tree/v1.21.x) - 1.22 'g' stands for ['gale'](https://github.com/grpc/grpc/tree/v1.22.x) - 1.23 'g' stands for ['gangnam'](https://github.com/grpc/grpc/tree/v1.23.x) -- 1.24 'g' stands for ['ganges'](https://github.com/grpc/grpc/tree/master) +- 1.24 'g' stands for ['ganges'](https://github.com/grpc/grpc/tree/v1.24.x) +- 1.25 'g' stands for ['game'](https://github.com/grpc/grpc/tree/master) From cf444b9cab9e41ff4c7bf04271c127eb0eb98688 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 10 Sep 2019 14:08:50 -0700 Subject: [PATCH 606/661] Regenerate projects --- CMakeLists.txt | 2 +- Makefile | 4 ++-- gRPC-C++.podspec | 4 ++-- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.xml | 4 ++-- src/core/lib/surface/version.cc | 2 +- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core.Api/VersionInfo.cs | 4 ++-- src/csharp/build/dependencies.props | 2 +- src/csharp/build_unitypackage.bat | 2 +- src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/version.h | 2 +- src/objective-c/tests/version.h | 2 +- src/php/composer.json | 2 +- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_channelz/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_status/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 32 files changed, 36 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08a49697750..ebcabe99cb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 3.5.1) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.24.0-dev") +set(PACKAGE_VERSION "1.25.0-dev") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index b24a27acfe6..f73924257f8 100644 --- a/Makefile +++ b/Makefile @@ -461,8 +461,8 @@ Q = @ endif CORE_VERSION = 8.0.0 -CPP_VERSION = 1.24.0-dev -CSHARP_VERSION = 2.24.0-dev +CPP_VERSION = 1.25.0-dev +CSHARP_VERSION = 2.25.0-dev CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 881e8959651..30cb9ce1de9 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - # version = '1.24.0-dev' + # version = '1.25.0-dev' version = '0.0.9-dev' s.version = version s.summary = 'gRPC C++ library' @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.license = 'Apache License, Version 2.0' s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - grpc_version = '1.24.0-dev' + grpc_version = '1.25.0-dev' s.source = { :git => 'https://github.com/grpc/grpc.git', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 3770425e5e3..7c2877f6edc 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.24.0-dev' + version = '1.25.0-dev' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 4c5ebb36562..551999bbea8 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.24.0-dev' + version = '1.25.0-dev' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 2e412cf67d6..dfa9363cd2c 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.24.0-dev' + version = '1.25.0-dev' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index e18adcd276e..1b36c5ed2ea 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.24.0-dev' + version = '1.25.0-dev' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.xml b/package.xml index fb43cf9c4d7..375f2e0e436 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2018-01-19 - 1.24.0dev - 1.24.0dev + 1.25.0dev + 1.25.0dev beta diff --git a/src/core/lib/surface/version.cc b/src/core/lib/surface/version.cc index 71eb89a1b42..d05b6ab9563 100644 --- a/src/core/lib/surface/version.cc +++ b/src/core/lib/surface/version.cc @@ -25,4 +25,4 @@ const char* grpc_version_string(void) { return "8.0.0"; } -const char* grpc_g_stands_for(void) { return "ganges"; } +const char* grpc_g_stands_for(void) { return "game"; } diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 71ddc6e5d71..041956ecf5c 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.24.0-dev"; } +grpc::string Version() { return "1.25.0-dev"; } } // namespace grpc diff --git a/src/csharp/Grpc.Core.Api/VersionInfo.cs b/src/csharp/Grpc.Core.Api/VersionInfo.cs index f732af32ec3..6d540155d9a 100644 --- a/src/csharp/Grpc.Core.Api/VersionInfo.cs +++ b/src/csharp/Grpc.Core.Api/VersionInfo.cs @@ -33,11 +33,11 @@ namespace Grpc.Core /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "2.24.0.0"; + public const string CurrentAssemblyFileVersion = "2.25.0.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "2.24.0-dev"; + public const string CurrentVersion = "2.25.0-dev"; } } diff --git a/src/csharp/build/dependencies.props b/src/csharp/build/dependencies.props index d45d3b1b0eb..df109183253 100644 --- a/src/csharp/build/dependencies.props +++ b/src/csharp/build/dependencies.props @@ -1,7 +1,7 @@ - 2.24.0-dev + 2.25.0-dev 3.8.0 diff --git a/src/csharp/build_unitypackage.bat b/src/csharp/build_unitypackage.bat index 9fade5c1dd0..4e689754aca 100644 --- a/src/csharp/build_unitypackage.bat +++ b/src/csharp/build_unitypackage.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=2.24.0-dev +set VERSION=2.25.0-dev @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec index 67faaeb2567..9103c785f85 100644 --- a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCCppPlugin' - v = '1.24.0-dev' + v = '1.25.0-dev' s.version = v s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index f65086b6df5..30a07f1647d 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.24.0-dev' + v = '1.25.0-dev' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/version.h b/src/objective-c/GRPCClient/version.h index fc6982c55d6..01ba728003d 100644 --- a/src/objective-c/GRPCClient/version.h +++ b/src/objective-c/GRPCClient/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.24.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.25.0-dev" diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index 9182189f4c8..54d05af8226 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -22,5 +22,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.24.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.25.0-dev" #define GRPC_C_VERSION_STRING @"8.0.0" diff --git a/src/php/composer.json b/src/php/composer.json index 6da1fd77d65..f4af57682ab 100644 --- a/src/php/composer.json +++ b/src/php/composer.json @@ -2,7 +2,7 @@ "name": "grpc/grpc-dev", "description": "gRPC library for PHP - for Developement use only", "license": "Apache-2.0", - "version": "1.24.0", + "version": "1.25.0", "require": { "php": ">=5.5.0", "google/protobuf": "^v3.3.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 000508dd3f8..82863121990 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.24.0dev" +#define PHP_GRPC_VERSION "1.25.0dev" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index ff1b1a17d25..cf9055adb49 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.24.0.dev0""" +__version__ = """1.25.0.dev0""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index e0280abaa7c..3902f3fecac 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.24.0.dev0' +VERSION = '1.25.0.dev0' diff --git a/src/python/grpcio_channelz/grpc_version.py b/src/python/grpcio_channelz/grpc_version.py index 93a448ecb64..61a651d45d3 100644 --- a/src/python/grpcio_channelz/grpc_version.py +++ b/src/python/grpcio_channelz/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/grpc_version.py.template`!!! -VERSION = '1.24.0.dev0' +VERSION = '1.25.0.dev0' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 2a1aa0c9359..7e9703c3c93 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.24.0.dev0' +VERSION = '1.25.0.dev0' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 93c28ba9fac..0c82a4c7768 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.24.0.dev0' +VERSION = '1.25.0.dev0' diff --git a/src/python/grpcio_status/grpc_version.py b/src/python/grpcio_status/grpc_version.py index a2b5a814b52..307d9ba7245 100644 --- a/src/python/grpcio_status/grpc_version.py +++ b/src/python/grpcio_status/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_status/grpc_version.py.template`!!! -VERSION = '1.24.0.dev0' +VERSION = '1.25.0.dev0' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index 937e57da02f..b6a2dc2ba21 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.24.0.dev0' +VERSION = '1.25.0.dev0' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index a1e43215b09..4656e5af94a 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.24.0.dev0' +VERSION = '1.25.0.dev0' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 43f08a0c87b..40744531d72 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.24.0.dev' + VERSION = '1.25.0.dev' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index b08edb08478..4d67f9c6302 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.24.0.dev' + VERSION = '1.25.0.dev' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index 184a0a9dda6..716add95195 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION = '1.24.0.dev0' +VERSION = '1.25.0.dev0' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 168e6c8d770..12435d0edb9 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.24.0-dev +PROJECT_NUMBER = 1.25.0-dev # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 3b7af742baa..14e5599bc17 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.24.0-dev +PROJECT_NUMBER = 1.25.0-dev # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From db861a254623228468c736a17b13af1d4afdc112 Mon Sep 17 00:00:00 2001 From: Arjun Roy Date: Mon, 9 Sep 2019 12:07:00 -0700 Subject: [PATCH 607/661] Coalesced arena allocs in callback unary C++ code. --- .../grpcpp/impl/codegen/client_callback_impl.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/include/grpcpp/impl/codegen/client_callback_impl.h b/include/grpcpp/impl/codegen/client_callback_impl.h index 37746ef5ce4..34c738ac1e6 100644 --- a/include/grpcpp/impl/codegen/client_callback_impl.h +++ b/include/grpcpp/impl/codegen/client_callback_impl.h @@ -72,11 +72,16 @@ class CallbackUnaryCallImpl { grpc::internal::CallOpClientSendClose, grpc::internal::CallOpClientRecvStatus>; - auto* ops = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc( - call.call(), sizeof(FullCallOpSet))) FullCallOpSet; - - auto* tag = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc( - call.call(), sizeof(grpc::internal::CallbackWithStatusTag))) + struct OpSetAndTag { + FullCallOpSet opset; + grpc::internal::CallbackWithStatusTag tag; + }; + const size_t alloc_sz = sizeof(OpSetAndTag); + auto* const alloced = static_cast( + ::grpc::g_core_codegen_interface->grpc_call_arena_alloc(call.call(), + alloc_sz)); + auto* ops = new (&alloced->opset) FullCallOpSet; + auto* tag = new (&alloced->tag) grpc::internal::CallbackWithStatusTag(call.call(), on_completion, ops); // TODO(vjpai): Unify code with sync API as much as possible From 300077aac1f12dfa8365494f0a82194ccd8cb0b4 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 10 Sep 2019 15:26:33 -0700 Subject: [PATCH 608/661] Update upb to HEAD --- bazel/grpc_deps.bzl | 6 +++--- third_party/upb | 2 +- tools/run_tests/sanity/check_submodules.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index f904f42f8c9..01b9ffc9a0e 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -201,9 +201,9 @@ def grpc_deps(): if "upb" not in native.existing_rules(): http_archive( name = "upb", - sha256 = "95150db57b51b65f3422c38953956e0f786945d842d76f8ab685fbcd93ab5caa", - strip_prefix = "upb-931bbecbd3230ae7f22efa5d203639facc47f719", - url = "https://github.com/protocolbuffers/upb/archive/931bbecbd3230ae7f22efa5d203639facc47f719.tar.gz", + sha256 = "61d0417abd60e65ed589c9deee7c124fe76a4106831f6ad39464e1525cef1454", + strip_prefix = "upb-9effcbcb27f0a665f9f345030188c0b291e32482", + url = "https://github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz", ) if "envoy_api" not in native.existing_rules(): http_archive( diff --git a/third_party/upb b/third_party/upb index 931bbecbd32..9effcbcb27f 160000 --- a/third_party/upb +++ b/third_party/upb @@ -1 +1 @@ -Subproject commit 931bbecbd3230ae7f22efa5d203639facc47f719 +Subproject commit 9effcbcb27f0a665f9f345030188c0b291e32482 diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index bd98e5c479a..e49ddc8950e 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -41,7 +41,7 @@ cat << EOF | awk '{ print $1 }' | sort > "$want_submodules" 09745575a923640154bcf307fba8aedff47f240a third_party/protobuf (v3.7.0-rc.2-247-g09745575) e143189bf6f37b3957fb31743df6a1bcf4a8c685 third_party/protoc-gen-validate (v0.0.10) 94324803a497c8f76dbc78df393ef629d3a9f3c3 third_party/udpa (heads/master) - 931bbecbd3230ae7f22efa5d203639facc47f719 third_party/upb (heads/master) + 9effcbcb27f0a665f9f345030188c0b291e32482 third_party/upb (heads/master) cacf7f1d4e3d44d871b605da3b647f07d718623f third_party/zlib (v1.2.11) EOF From 711a4147ae1cdc0568ef4179dfc3958a59e241dc Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 11 Sep 2019 01:21:47 +0200 Subject: [PATCH 609/661] Removing all warning flags and Werror for now. --- Makefile | 18 +++++++++--------- build.yaml | 17 +++++------------ grpc.gyp | 36 ------------------------------------ 3 files changed, 14 insertions(+), 57 deletions(-) diff --git a/Makefile b/Makefile index 5189f704297..e1f7480a54c 100644 --- a/Makefile +++ b/Makefile @@ -353,8 +353,8 @@ ifeq ($(SYSTEM),Darwin) CXXFLAGS += -stdlib=libc++ LDFLAGS += -framework CoreFoundation endif -CXXFLAGS += -Wnon-virtual-dtor -CPPFLAGS += -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb -Isrc/core/ext/upb-generated +CFLAGS += -g +CPPFLAGS += -g -Wall -Wextra -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb -Isrc/core/ext/upb-generated COREFLAGS += -fno-rtti -fno-exceptions LDFLAGS += -g @@ -553,7 +553,7 @@ OPENSSL_LIBS = ssl crypto endif OPENSSL_ALPN_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) -BORINGSSL_COMPILE_CHECK_CMD = $(CC) $(CPPFLAGS) -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare -Wno-implicit-fallthrough $(NO_W_EXTRA_SEMI) -o $(TMPOUT) test/build/boringssl.c $(LDFLAGS) +BORINGSSL_COMPILE_CHECK_CMD = $(CC) $(CPPFLAGS) -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(CFLAGS) -g -o $(TMPOUT) test/build/boringssl.c $(LDFLAGS) ZLIB_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) PROTOBUF_CHECK_CMD = $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) CARES_CHECK_CMD = $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $(TMPOUT) test/build/c-ares.c -lcares $(LDFLAGS) @@ -7901,7 +7901,7 @@ LIBBORINGSSL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBORINGSSL_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(LIBBORINGSSL_OBJS): CXXFLAGS += -fno-rtti -fno-exceptions -$(LIBBORINGSSL_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare -Wno-implicit-fallthrough $(NO_W_EXTRA_SEMI) +$(LIBBORINGSSL_OBJS): CFLAGS += -g $(LIBDIR)/$(CONFIG)/libboringssl.a: $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(LIBBORINGSSL_OBJS) $(E) "[AR] Creating $@" @@ -7931,7 +7931,7 @@ LIBBORINGSSL_TEST_UTIL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(LIBBORINGSSL_TEST_UTIL_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(LIBBORINGSSL_TEST_UTIL_OBJS): CXXFLAGS += -fno-rtti -fno-exceptions -$(LIBBORINGSSL_TEST_UTIL_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare -Wno-implicit-fallthrough $(NO_W_EXTRA_SEMI) +$(LIBBORINGSSL_TEST_UTIL_OBJS): CFLAGS += -g ifeq ($(NO_PROTOBUF),true) @@ -8034,7 +8034,7 @@ PUBLIC_HEADERS_C += \ LIBZ_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBZ_SRC)))) -$(LIBZ_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration -Wno-implicit-fallthrough $(W_NO_SHIFT_NEGATIVE_VALUE) -fvisibility=hidden +$(LIBZ_OBJS): CFLAGS += -fvisibility=hidden $(LIBDIR)/$(CONFIG)/libz.a: $(LIBZ_OBJS) $(E) "[AR] Creating $@" @@ -8110,7 +8110,7 @@ PUBLIC_HEADERS_C += \ LIBARES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBARES_SRC)))) $(LIBARES_OBJS): CPPFLAGS += -Ithird_party/cares -Ithird_party/cares/cares -fvisibility=hidden -D_GNU_SOURCE $(if $(subst Darwin,,$(SYSTEM)),,-Ithird_party/cares/config_darwin) $(if $(subst FreeBSD,,$(SYSTEM)),,-Ithird_party/cares/config_freebsd) $(if $(subst Linux,,$(SYSTEM)),,-Ithird_party/cares/config_linux) $(if $(subst OpenBSD,,$(SYSTEM)),,-Ithird_party/cares/config_openbsd) -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(if $(subst MINGW32,,$(SYSTEM)),-DHAVE_CONFIG_H,) -$(LIBARES_OBJS): CFLAGS += -Wno-sign-conversion $(if $(subst Darwin,,$(SYSTEM)),,-Wno-shorten-64-to-32) $(if $(subst MINGW32,,$(SYSTEM)),-Wno-invalid-source-encoding,) +$(LIBARES_OBJS): CFLAGS += -g $(LIBDIR)/$(CONFIG)/libares.a: $(LIBARES_OBJS) $(E) "[AR] Creating $@" @@ -20108,7 +20108,7 @@ endif $(BORINGSSL_SSL_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(BORINGSSL_SSL_TEST_OBJS): CXXFLAGS += -fno-rtti -fno-exceptions -$(BORINGSSL_SSL_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare -Wno-implicit-fallthrough $(NO_W_EXTRA_SEMI) +$(BORINGSSL_SSL_TEST_OBJS): CFLAGS += -g $(OBJDIR)/$(CONFIG)/third_party/boringssl/crypto/test/gtest_main.o: $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(OBJDIR)/$(CONFIG)/third_party/boringssl/ssl/span_test.o: $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a @@ -20200,7 +20200,7 @@ endif $(BORINGSSL_CRYPTO_TEST_OBJS): CPPFLAGS += -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(BORINGSSL_CRYPTO_TEST_OBJS): CXXFLAGS += -fno-rtti -fno-exceptions -$(BORINGSSL_CRYPTO_TEST_OBJS): CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare -Wno-implicit-fallthrough $(NO_W_EXTRA_SEMI) +$(BORINGSSL_CRYPTO_TEST_OBJS): CFLAGS += -g $(OBJDIR)/$(CONFIG)/src/boringssl/crypto_test_data.o: $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a $(OBJDIR)/$(CONFIG)/third_party/boringssl/crypto/asn1/asn1_test.o: $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl.a diff --git a/build.yaml b/build.yaml index cbdbf8a60bc..d231dc41f16 100644 --- a/build.yaml +++ b/build.yaml @@ -6174,8 +6174,7 @@ configs: UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1:suppressions=test/core/util/ubsan_suppressions.txt defaults: ares: - CFLAGS: -Wno-sign-conversion $(if $(subst Darwin,,$(SYSTEM)),,-Wno-shorten-64-to-32) - $(if $(subst MINGW32,,$(SYSTEM)),-Wno-invalid-source-encoding,) + CFLAGS: -g CPPFLAGS: -Ithird_party/cares -Ithird_party/cares/cares -fvisibility=hidden -D_GNU_SOURCE $(if $(subst Darwin,,$(SYSTEM)),,-Ithird_party/cares/config_darwin) $(if $(subst FreeBSD,,$(SYSTEM)),,-Ithird_party/cares/config_freebsd) $(if $(subst Linux,,$(SYSTEM)),,-Ithird_party/cares/config_linux) @@ -6184,9 +6183,7 @@ defaults: benchmark: CPPFLAGS: -Ithird_party/benchmark/include -DHAVE_POSIX_REGEX boringssl: - CFLAGS: -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas - -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare -Wno-implicit-fallthrough - $(NO_W_EXTRA_SEMI) + CFLAGS: -g CPPFLAGS: -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX CXXFLAGS: -fno-rtti -fno-exceptions @@ -6196,16 +6193,12 @@ defaults: $(W_NO_MAYBE_UNINITIALIZED) -fvisibility=hidden CXXFLAGS: $(W_NO_CXX14_COMPAT) global: + CFLAGS: -g COREFLAGS: -fno-rtti -fno-exceptions - CPPFLAGS: -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long - -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow - -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers - -Wno-maybe-uninitialized -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb -Isrc/core/ext/upb-generated - CXXFLAGS: -Wnon-virtual-dtor + CPPFLAGS: -g -Wall -Wextra -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb -Isrc/core/ext/upb-generated LDFLAGS: -g zlib: - CFLAGS: -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration - -Wno-implicit-fallthrough $(W_NO_SHIFT_NEGATIVE_VALUE) -fvisibility=hidden + CFLAGS: -fvisibility=hidden openssl_fallback: base_uri: https://openssl.org/source/old/1.0.2/ extraction_dir: openssl-1.0.2f diff --git a/grpc.gyp b/grpc.gyp index 3b86e613131..9ef4488689a 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -54,18 +54,6 @@ '-g', '-Wall', '-Wextra', - '-Werror', - '$(W_NO_UNKNOWN_WARNING_OPTION)', - '-Wno-long-long', - '-Wno-unused-parameter', - '-Wno-deprecated-declarations', - '-Wno-sign-conversion', - '-Wno-shadow', - '-Wno-conversion', - '-Wno-implicit-fallthrough', - '-Wno-sign-compare', - '-Wno-missing-field-initializers', - '-Wno-maybe-uninitialized', '-DOSATOMIC_USE_INLINED=1', '-Ithird_party/upb', '-Isrc/core/ext/upb-generated', @@ -142,18 +130,6 @@ '-g', '-Wall', '-Wextra', - '-Werror', - '$(W_NO_UNKNOWN_WARNING_OPTION)', - '-Wno-long-long', - '-Wno-unused-parameter', - '-Wno-deprecated-declarations', - '-Wno-sign-conversion', - '-Wno-shadow', - '-Wno-conversion', - '-Wno-implicit-fallthrough', - '-Wno-sign-compare', - '-Wno-missing-field-initializers', - '-Wno-maybe-uninitialized', '-DOSATOMIC_USE_INLINED=1', '-Ithird_party/upb', '-Isrc/core/ext/upb-generated', @@ -162,18 +138,6 @@ '-g', '-Wall', '-Wextra', - '-Werror', - '$(W_NO_UNKNOWN_WARNING_OPTION)', - '-Wno-long-long', - '-Wno-unused-parameter', - '-Wno-deprecated-declarations', - '-Wno-sign-conversion', - '-Wno-shadow', - '-Wno-conversion', - '-Wno-implicit-fallthrough', - '-Wno-sign-compare', - '-Wno-missing-field-initializers', - '-Wno-maybe-uninitialized', '-DOSATOMIC_USE_INLINED=1', '-Ithird_party/upb', '-Isrc/core/ext/upb-generated', From 6f5e358da7f3ba2de1dbfeafa7116adf093c073b Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 10 Sep 2019 16:46:06 -0700 Subject: [PATCH 610/661] Rename filter functions to be able to uniquely identify them --- .../grpclb/client_load_reporting_filter.cc | 28 ++++++------- .../ext/filters/deadline/deadline_filter.cc | 40 +++++++++---------- .../filters/http/client/http_client_filter.cc | 24 +++++------ .../filters/http/client_authority_filter.cc | 28 ++++++------- .../message_compress_filter.cc | 24 +++++------ .../ext/filters/max_age/max_age_filter.cc | 24 +++++------ .../message_size/message_size_filter.cc | 28 ++++++------- .../workaround_cronet_compression_filter.cc | 29 +++++++------- .../security/transport/client_auth_filter.cc | 34 ++++++++-------- .../security/transport/server_auth_filter.cc | 28 ++++++------- src/core/lib/surface/lame_client.cc | 24 +++++------ 11 files changed, 156 insertions(+), 155 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc index 3057b26d315..09dd75b041f 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc @@ -30,12 +30,12 @@ #include "src/core/lib/iomgr/error.h" #include "src/core/lib/profiling/timers.h" -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* clr_init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { return GRPC_ERROR_NONE; } -static void destroy_channel_elem(grpc_channel_element* elem) {} +static void clr_destroy_channel_elem(grpc_channel_element* elem) {} namespace { @@ -71,16 +71,16 @@ static void recv_initial_metadata_ready(void* arg, grpc_error* error) { GRPC_ERROR_REF(error)); } -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* clr_init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { GPR_ASSERT(args->context != nullptr); new (elem->call_data) call_data(); return GRPC_ERROR_NONE; } -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void clr_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = static_cast(elem->call_data); if (calld->client_stats != nullptr) { // Record call finished, optionally setting client_failed_to_send and @@ -92,7 +92,7 @@ static void destroy_call_elem(grpc_call_element* elem, calld->~call_data(); } -static void start_transport_stream_op_batch( +static void clr_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* batch) { call_data* calld = static_cast(elem->call_data); GPR_TIMER_SCOPE("clr_start_transport_stream_op_batch", 0); @@ -142,14 +142,14 @@ static void start_transport_stream_op_batch( } const grpc_channel_filter grpc_client_load_reporting_filter = { - start_transport_stream_op_batch, + clr_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + clr_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + clr_destroy_call_elem, 0, // sizeof(channel_data) - init_channel_elem, - destroy_channel_elem, + clr_init_channel_elem, + clr_destroy_channel_elem, grpc_channel_next_get_info, "client_load_reporting"}; diff --git a/src/core/ext/filters/deadline/deadline_filter.cc b/src/core/ext/filters/deadline/deadline_filter.cc index 20a2953e5ff..d6c2b8e2588 100644 --- a/src/core/ext/filters/deadline/deadline_filter.cc +++ b/src/core/ext/filters/deadline/deadline_filter.cc @@ -233,14 +233,14 @@ void grpc_deadline_state_client_start_transport_stream_op_batch( // // Constructor for channel_data. Used for both client and server filters. -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* deadline_init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { GPR_ASSERT(!args->is_last); return GRPC_ERROR_NONE; } // Destructor for channel_data. Used for both client and server filters. -static void destroy_channel_elem(grpc_channel_element* elem) {} +static void deadline_destroy_channel_elem(grpc_channel_element* elem) {} // Call data used for both client and server filter. typedef struct base_call_data { @@ -260,24 +260,24 @@ typedef struct server_call_data { } server_call_data; // Constructor for call_data. Used for both client and server filters. -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* deadline_init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { new (elem->call_data) grpc_deadline_state( elem, args->call_stack, args->call_combiner, args->deadline); return GRPC_ERROR_NONE; } // Destructor for call_data. Used for both client and server filters. -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void deadline_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) { grpc_deadline_state* deadline_state = static_cast(elem->call_data); deadline_state->~grpc_deadline_state(); } // Method for starting a call op for client filter. -static void client_start_transport_stream_op_batch( +static void deadline_client_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* op) { grpc_deadline_state_client_start_transport_stream_op_batch(elem, op); // Chain to next filter. @@ -295,7 +295,7 @@ static void recv_initial_metadata_ready(void* arg, grpc_error* error) { } // Method for starting a call op for server filter. -static void server_start_transport_stream_op_batch( +static void deadline_server_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* op) { server_call_data* calld = static_cast(elem->call_data); if (op->cancel_stream) { @@ -329,29 +329,29 @@ static void server_start_transport_stream_op_batch( } const grpc_channel_filter grpc_client_deadline_filter = { - client_start_transport_stream_op_batch, + deadline_client_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(base_call_data), - init_call_elem, + deadline_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + deadline_destroy_call_elem, 0, // sizeof(channel_data) - init_channel_elem, - destroy_channel_elem, + deadline_init_channel_elem, + deadline_destroy_channel_elem, grpc_channel_next_get_info, "deadline", }; const grpc_channel_filter grpc_server_deadline_filter = { - server_start_transport_stream_op_batch, + deadline_server_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(server_call_data), - init_call_elem, + deadline_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + deadline_destroy_call_elem, 0, // sizeof(channel_data) - init_channel_elem, - destroy_channel_elem, + deadline_init_channel_elem, + deadline_destroy_channel_elem, grpc_channel_next_get_info, "deadline", }; diff --git a/src/core/ext/filters/http/client/http_client_filter.cc b/src/core/ext/filters/http/client/http_client_filter.cc index b16d26b1f24..1793e8106e4 100644 --- a/src/core/ext/filters/http/client/http_client_filter.cc +++ b/src/core/ext/filters/http/client/http_client_filter.cc @@ -465,16 +465,16 @@ done: } /* Constructor for call_data */ -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* hc_init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { new (elem->call_data) call_data(elem, *args); return GRPC_ERROR_NONE; } /* Destructor for call_data */ -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void hc_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = static_cast(elem->call_data); calld->~call_data(); } @@ -566,8 +566,8 @@ static grpc_core::ManagedMemorySlice user_agent_from_args( } /* Constructor for channel_data */ -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* hc_init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { channel_data* chand = static_cast(elem->channel_data); GPR_ASSERT(!args->is_last); GPR_ASSERT(args->optional_transport != nullptr); @@ -582,7 +582,7 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel data */ -static void destroy_channel_elem(grpc_channel_element* elem) { +static void hc_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); GRPC_MDELEM_UNREF(chand->user_agent); } @@ -591,11 +591,11 @@ const grpc_channel_filter grpc_http_client_filter = { hc_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + hc_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + hc_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + hc_init_channel_elem, + hc_destroy_channel_elem, grpc_channel_next_get_info, "http-client"}; diff --git a/src/core/ext/filters/http/client_authority_filter.cc b/src/core/ext/filters/http/client_authority_filter.cc index dc8beb986fc..4d5d6233f8c 100644 --- a/src/core/ext/filters/http/client_authority_filter.cc +++ b/src/core/ext/filters/http/client_authority_filter.cc @@ -48,7 +48,7 @@ struct channel_data { grpc_mdelem default_authority_mdelem; }; -void authority_start_transport_stream_op_batch( +void client_authority_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* batch) { channel_data* chand = static_cast(elem->channel_data); call_data* calld = static_cast(elem->call_data); @@ -72,21 +72,21 @@ void authority_start_transport_stream_op_batch( } /* Constructor for call_data */ -grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +grpc_error* client_authority_init_call_elem( + grpc_call_element* elem, const grpc_call_element_args* args) { call_data* calld = static_cast(elem->call_data); calld->call_combiner = args->call_combiner; return GRPC_ERROR_NONE; } /* Destructor for call_data */ -void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) {} +void client_authority_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) {} /* Constructor for channel_data */ -grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +grpc_error* client_authority_init_channel_elem( + grpc_channel_element* elem, grpc_channel_element_args* args) { channel_data* chand = static_cast(elem->channel_data); const grpc_arg* default_authority_arg = grpc_channel_args_find(args->channel_args, GRPC_ARG_DEFAULT_AUTHORITY); @@ -110,7 +110,7 @@ grpc_error* init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel data */ -void destroy_channel_elem(grpc_channel_element* elem) { +void client_authority_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); grpc_slice_unref_internal(chand->default_authority); GRPC_MDELEM_UNREF(chand->default_authority_mdelem); @@ -118,15 +118,15 @@ void destroy_channel_elem(grpc_channel_element* elem) { } // namespace const grpc_channel_filter grpc_client_authority_filter = { - authority_start_transport_stream_op_batch, + client_authority_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + client_authority_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + client_authority_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + client_authority_init_channel_elem, + client_authority_destroy_channel_elem, grpc_channel_next_get_info, "authority"}; diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.cc b/src/core/ext/filters/http/message_compress/message_compress_filter.cc index 9ef8e6a1990..2f4854e43ec 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.cc +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.cc @@ -441,23 +441,23 @@ static void compress_start_transport_stream_op_batch( } /* Constructor for call_data */ -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* compress_init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { new (elem->call_data) call_data(elem, *args); return GRPC_ERROR_NONE; } /* Destructor for call_data */ -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void compress_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = static_cast(elem->call_data); calld->~call_data(); } /* Constructor for channel_data */ -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* compress_init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { channel_data* channeld = static_cast(elem->channel_data); // Get the enabled and the default algorithms from channel args. channeld->enabled_compression_algorithms_bitset = @@ -487,17 +487,17 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel data */ -static void destroy_channel_elem(grpc_channel_element* elem) {} +static void compress_destroy_channel_elem(grpc_channel_element* elem) {} const grpc_channel_filter grpc_message_compress_filter = { compress_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + compress_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + compress_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + compress_init_channel_elem, + compress_destroy_channel_elem, grpc_channel_next_get_info, "message_compress"}; diff --git a/src/core/ext/filters/max_age/max_age_filter.cc b/src/core/ext/filters/max_age/max_age_filter.cc index 96f2f02056f..770343d9b1f 100644 --- a/src/core/ext/filters/max_age/max_age_filter.cc +++ b/src/core/ext/filters/max_age/max_age_filter.cc @@ -395,24 +395,24 @@ add_random_max_connection_age_jitter_and_convert_to_grpc_millis(int value) { } /* Constructor for call_data. */ -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* max_age_init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { channel_data* chand = static_cast(elem->channel_data); increase_call_count(chand); return GRPC_ERROR_NONE; } /* Destructor for call_data. */ -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void max_age_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) { channel_data* chand = static_cast(elem->channel_data); decrease_call_count(chand); } /* Constructor for channel_data. */ -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* max_age_init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { channel_data* chand = static_cast(elem->channel_data); gpr_mu_init(&chand->max_age_timer_mu); chand->max_age_timer_pending = false; @@ -499,7 +499,7 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel_data. */ -static void destroy_channel_elem(grpc_channel_element* elem) { +static void max_age_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); gpr_mu_destroy(&chand->max_age_timer_mu); } @@ -508,12 +508,12 @@ const grpc_channel_filter grpc_max_age_filter = { grpc_call_next_op, grpc_channel_next_op, 0, /* sizeof_call_data */ - init_call_elem, + max_age_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + max_age_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + max_age_init_channel_elem, + max_age_destroy_channel_elem, grpc_channel_next_get_info, "max_age"}; diff --git a/src/core/ext/filters/message_size/message_size_filter.cc b/src/core/ext/filters/message_size/message_size_filter.cc index 8e93d11c9c0..df447c226b1 100644 --- a/src/core/ext/filters/message_size/message_size_filter.cc +++ b/src/core/ext/filters/message_size/message_size_filter.cc @@ -238,7 +238,7 @@ static void recv_trailing_metadata_ready(void* user_data, grpc_error* error) { } // Start transport stream op. -static void start_transport_stream_op_batch( +static void message_size_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* op) { call_data* calld = static_cast(elem->call_data); // Check max send message size. @@ -277,17 +277,17 @@ static void start_transport_stream_op_batch( } // Constructor for call_data. -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* message_size_init_call_elem( + grpc_call_element* elem, const grpc_call_element_args* args) { channel_data* chand = static_cast(elem->channel_data); new (elem->call_data) call_data(elem, *chand, *args); return GRPC_ERROR_NONE; } // Destructor for call_data. -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void message_size_destroy_call_elem( + grpc_call_element* elem, const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = (call_data*)elem->call_data; calld->~call_data(); } @@ -325,8 +325,8 @@ grpc_core::MessageSizeParsedConfig::message_size_limits get_message_size_limits( } // Constructor for channel_data. -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* message_size_init_channel_elem( + grpc_channel_element* elem, grpc_channel_element_args* args) { GPR_ASSERT(!args->is_last); channel_data* chand = static_cast(elem->channel_data); new (chand) channel_data(); @@ -355,21 +355,21 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, } // Destructor for channel_data. -static void destroy_channel_elem(grpc_channel_element* elem) { +static void message_size_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); chand->~channel_data(); } const grpc_channel_filter grpc_message_size_filter = { - start_transport_stream_op_batch, + message_size_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + message_size_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + message_size_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + message_size_init_channel_elem, + message_size_destroy_channel_elem, grpc_channel_next_get_info, "message_size"}; diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc index c7070d4d9ba..0426e008e40 100644 --- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +++ b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc @@ -75,7 +75,7 @@ static void recv_initial_metadata_ready(void* user_data, grpc_error* error) { } // Start transport stream op. -static void start_transport_stream_op_batch( +static void cronet_compression_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* op) { call_data* calld = static_cast(elem->call_data); @@ -104,8 +104,8 @@ static void start_transport_stream_op_batch( } // Constructor for call_data. -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* cronet_compression_init_call_elem( + grpc_call_element* elem, const grpc_call_element_args* args) { call_data* calld = static_cast(elem->call_data); calld->next_recv_initial_metadata_ready = nullptr; calld->workaround_active = false; @@ -116,18 +116,19 @@ static grpc_error* init_call_elem(grpc_call_element* elem, } // Destructor for call_data. -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) {} +static void cronet_compression_destroy_call_elem( + grpc_call_element* elem, const grpc_call_final_info* final_info, + grpc_closure* ignored) {} // Constructor for channel_data. -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* cronet_compression_init_channel_elem( + grpc_channel_element* elem, grpc_channel_element_args* args) { return GRPC_ERROR_NONE; } // Destructor for channel_data. -static void destroy_channel_elem(grpc_channel_element* elem) {} +static void cronet_compression_destroy_channel_elem( + grpc_channel_element* elem) {} // Parse the user agent static bool parse_user_agent(grpc_mdelem md) { @@ -169,15 +170,15 @@ static bool parse_user_agent(grpc_mdelem md) { } const grpc_channel_filter grpc_workaround_cronet_compression_filter = { - start_transport_stream_op_batch, + cronet_compression_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + cronet_compression_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + cronet_compression_destroy_call_elem, 0, - init_channel_elem, - destroy_channel_elem, + cronet_compression_init_channel_elem, + cronet_compression_destroy_channel_elem, grpc_channel_next_get_info, "workaround_cronet_compression"}; diff --git a/src/core/lib/security/transport/client_auth_filter.cc b/src/core/lib/security/transport/client_auth_filter.cc index 33343d276eb..282ec5c97a9 100644 --- a/src/core/lib/security/transport/client_auth_filter.cc +++ b/src/core/lib/security/transport/client_auth_filter.cc @@ -324,7 +324,7 @@ static void cancel_check_call_host(void* arg, grpc_error* error) { } } -static void auth_start_transport_stream_op_batch( +static void client_auth_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* batch) { GPR_TIMER_SCOPE("auth_start_transport_stream_op_batch", 0); @@ -369,29 +369,29 @@ static void auth_start_transport_stream_op_batch( } /* Constructor for call_data */ -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* client_auth_init_call_elem( + grpc_call_element* elem, const grpc_call_element_args* args) { new (elem->call_data) call_data(elem, *args); return GRPC_ERROR_NONE; } -static void set_pollset_or_pollset_set(grpc_call_element* elem, - grpc_polling_entity* pollent) { +static void client_auth_set_pollset_or_pollset_set( + grpc_call_element* elem, grpc_polling_entity* pollent) { call_data* calld = static_cast(elem->call_data); calld->pollent = pollent; } /* Destructor for call_data */ -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void client_auth_destroy_call_elem( + grpc_call_element* elem, const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = static_cast(elem->call_data); calld->destroy(); } /* Constructor for channel_data */ -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* client_auth_init_channel_elem( + grpc_channel_element* elem, grpc_channel_element_args* args) { /* The first and the last filters tend to be implemented differently to handle the case that there's no 'next' filter to call on the up or down path */ @@ -414,20 +414,20 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel data */ -static void destroy_channel_elem(grpc_channel_element* elem) { +static void client_auth_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); chand->~channel_data(); } const grpc_channel_filter grpc_client_auth_filter = { - auth_start_transport_stream_op_batch, + client_auth_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, - set_pollset_or_pollset_set, - destroy_call_elem, + client_auth_init_call_elem, + client_auth_set_pollset_or_pollset_set, + client_auth_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + client_auth_init_channel_elem, + client_auth_destroy_channel_elem, grpc_channel_next_get_info, "client-auth"}; diff --git a/src/core/lib/security/transport/server_auth_filter.cc b/src/core/lib/security/transport/server_auth_filter.cc index 43509e6c61b..341e0e4a86a 100644 --- a/src/core/lib/security/transport/server_auth_filter.cc +++ b/src/core/lib/security/transport/server_auth_filter.cc @@ -257,7 +257,7 @@ static void recv_trailing_metadata_ready(void* user_data, grpc_error* err) { GRPC_CLOSURE_RUN(calld->original_recv_trailing_metadata_ready, err); } -static void auth_start_transport_stream_op_batch( +static void server_auth_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* batch) { call_data* calld = static_cast(elem->call_data); if (batch->recv_initial_metadata) { @@ -278,23 +278,23 @@ static void auth_start_transport_stream_op_batch( } /* Constructor for call_data */ -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* server_auth_init_call_elem( + grpc_call_element* elem, const grpc_call_element_args* args) { new (elem->call_data) call_data(elem, *args); return GRPC_ERROR_NONE; } /* Destructor for call_data */ -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void server_auth_destroy_call_elem( + grpc_call_element* elem, const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = static_cast(elem->call_data); calld->~call_data(); } /* Constructor for channel_data */ -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* server_auth_init_channel_elem( + grpc_channel_element* elem, grpc_channel_element_args* args) { GPR_ASSERT(!args->is_last); grpc_auth_context* auth_context = grpc_find_auth_context_in_args(args->channel_args); @@ -306,20 +306,20 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel data */ -static void destroy_channel_elem(grpc_channel_element* elem) { +static void server_auth_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); chand->~channel_data(); } const grpc_channel_filter grpc_server_auth_filter = { - auth_start_transport_stream_op_batch, + server_auth_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + server_auth_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + server_auth_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + server_auth_init_channel_elem, + server_auth_destroy_channel_elem, grpc_channel_next_get_info, "server-auth"}; diff --git a/src/core/lib/surface/lame_client.cc b/src/core/lib/surface/lame_client.cc index 10a27924073..9208160938e 100644 --- a/src/core/lib/surface/lame_client.cc +++ b/src/core/lib/surface/lame_client.cc @@ -115,27 +115,27 @@ static void lame_start_transport_op(grpc_channel_element* elem, } } -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* lame_init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { CallData* calld = static_cast(elem->call_data); calld->call_combiner = args->call_combiner; return GRPC_ERROR_NONE; } -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* then_schedule_closure) { +static void lame_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* then_schedule_closure) { GRPC_CLOSURE_SCHED(then_schedule_closure, GRPC_ERROR_NONE); } -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* lame_init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { GPR_ASSERT(args->is_first); GPR_ASSERT(args->is_last); return GRPC_ERROR_NONE; } -static void destroy_channel_elem(grpc_channel_element* elem) {} +static void lame_destroy_channel_elem(grpc_channel_element* elem) {} } // namespace @@ -145,12 +145,12 @@ const grpc_channel_filter grpc_lame_filter = { grpc_core::lame_start_transport_stream_op_batch, grpc_core::lame_start_transport_op, sizeof(grpc_core::CallData), - grpc_core::init_call_elem, + grpc_core::lame_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - grpc_core::destroy_call_elem, + grpc_core::lame_destroy_call_elem, sizeof(grpc_core::ChannelData), - grpc_core::init_channel_elem, - grpc_core::destroy_channel_elem, + grpc_core::lame_init_channel_elem, + grpc_core::lame_destroy_channel_elem, grpc_core::lame_get_channel_info, "lame-client", }; From 5abf2e5095c9fe28ae1d562970326664249bd743 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Wed, 11 Sep 2019 09:53:14 +0800 Subject: [PATCH 611/661] Fix: add a blank line before the subtitle --- examples/python/data_transmission/README.en.md | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/python/data_transmission/README.en.md b/examples/python/data_transmission/README.en.md index fb834ab80c9..659ee1b93fb 100644 --- a/examples/python/data_transmission/README.en.md +++ b/examples/python/data_transmission/README.en.md @@ -9,6 +9,7 @@ Four ways of data transmission when gRPC is used in Python. [Offical Guide]( Date: Wed, 11 Sep 2019 10:20:23 +0800 Subject: [PATCH 612/661] Fix: add copyright headers in `client.py` --- examples/python/data_transmission/client.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/python/data_transmission/client.py b/examples/python/data_transmission/client.py index 0a9559ed79a..dee25b3a2ab 100644 --- a/examples/python/data_transmission/client.py +++ b/examples/python/data_transmission/client.py @@ -1,3 +1,18 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""The example of four ways of data transmission using gRPC in Python.""" + import time import grpc From 5c0fd4b4e6b535d3f5fc93b88dde8a38461d85bb Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Wed, 11 Sep 2019 10:23:31 +0800 Subject: [PATCH 613/661] Fix: add copyright headers in `demo.proto` --- examples/python/data_transmission/demo.proto | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/examples/python/data_transmission/demo.proto b/examples/python/data_transmission/demo.proto index d3d96b523d1..b2d956c89d5 100644 --- a/examples/python/data_transmission/demo.proto +++ b/examples/python/data_transmission/demo.proto @@ -1,3 +1,17 @@ +// Copyright 2019 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // 语法版本声明,必须放在非注释的第一行 // Syntax version declaration. Must be placed on the first line of non-commentary. From c5d55ee64f48db1334e973a7f9290324c2c83175 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Wed, 11 Sep 2019 10:27:15 +0800 Subject: [PATCH 614/661] Fix: add copyright headers in `server.py` --- examples/python/data_transmission/server.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/python/data_transmission/server.py b/examples/python/data_transmission/server.py index 288c561382b..f550b9b7bd2 100644 --- a/examples/python/data_transmission/server.py +++ b/examples/python/data_transmission/server.py @@ -1,3 +1,18 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""The example of four ways of data transmission using gRPC in Python.""" + from threading import Thread from concurrent import futures From 9e0eb19ca4cef2aaa61236dcb9a042092166da86 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 9 Sep 2019 14:54:36 +0200 Subject: [PATCH 615/661] generate separate sponge target for each test suite --- tools/run_tests/python_utils/report_utils.py | 20 +++++++++++++++----- tools/run_tests/run_tests.py | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tools/run_tests/python_utils/report_utils.py b/tools/run_tests/python_utils/report_utils.py index 8d8dedb929b..707f9ef656c 100644 --- a/tools/run_tests/python_utils/report_utils.py +++ b/tools/run_tests/python_utils/report_utils.py @@ -49,12 +49,22 @@ def render_junit_xml_report(resultset, report_file, suite_package='grpc', suite_name='tests', - replace_dots=True): + replace_dots=True, + split_by_target=False): """Generate JUnit-like XML report.""" - tree = new_junit_xml_tree() - append_junit_xml_results(tree, resultset, suite_package, suite_name, '1', - replace_dots) - create_xml_report_file(tree, report_file) + if not split_by_target: + tree = new_junit_xml_tree() + append_junit_xml_results(tree, resultset, suite_package, suite_name, '1', + replace_dots) + create_xml_report_file(tree, report_file) + else: + for shortname, results in six.iteritems(resultset): + one_result = { shortname: results } + tree = new_junit_xml_tree() + append_junit_xml_results(tree, one_result, '%s_%s' % (suite_package, shortname), '%s_%s' % (suite_name, shortname), '1', + replace_dots) + per_suite_report_file = os.path.join(os.path.dirname(report_file), shortname, os.path.basename(report_file)) + create_xml_report_file(tree, per_suite_report_file) def create_xml_report_file(tree, report_file): diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 1ff37ca85af..cb26d0ab772 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1880,7 +1880,7 @@ def _build_and_run(check_cancelled, upload_extra_fields) if xml_report and resultset: report_utils.render_junit_xml_report( - resultset, xml_report, suite_name=args.report_suite_name) + resultset, xml_report, suite_name=args.report_suite_name, split_by_target=True) number_failures, _ = jobset.run( post_tests_steps, From 42da89171442ce6eadcd6d1cd00844f484bd0b4f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 10 Sep 2019 10:01:02 +0200 Subject: [PATCH 616/661] include run_tests in target name --- tools/run_tests/run_tests_matrix.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index 80c0a7d6455..5d38cb4c711 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -52,14 +52,14 @@ def _safe_report_name(name): def _report_filename(name): """Generates report file name with directory structure that leads to better presentation by internal CI""" # 'sponge_log.xml' suffix must be there for results to get recognized by kokoro. - return '%s/%s' % (_safe_report_name(name), 'sponge_log.xml') + return 'run_tests_%s/%s' % (_safe_report_name(name), 'sponge_log.xml') def _report_logfilename(name): """Generates log file name that corresponds to name generated by _report_filename""" # 'sponge_log.log' suffix must be there for log to get recognized as "target log" # for the corresponding 'sponge_log.xml' report. - return '%s/%s' % (_safe_report_name(name), 'sponge_log.log') + return 'run_tests_%s/%s' % (_safe_report_name(name), 'sponge_log.log') def _docker_jobspec(name, From 6b44344161d51c1018a5f1acf6eb39122f4251ef Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 10 Sep 2019 10:04:34 +0200 Subject: [PATCH 617/661] use run_tests_invocations instead of aggregate tests --- tools/run_tests/run_tests_matrix.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index 5d38cb4c711..a517e261056 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -604,8 +604,8 @@ if __name__ == "__main__": resultset.update(skipped_results) report_utils.render_junit_xml_report( resultset, - _report_filename('aggregate_tests'), - suite_name='aggregate_tests') + _report_filename('run_tests_invocations'), + suite_name='run_tests_invocations') if num_failures == 0: jobset.message( From 243b43d6cc596f09b72af19026e791dec4406a0c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 10 Sep 2019 18:36:21 +0200 Subject: [PATCH 618/661] better run_tests prefix --- tools/run_tests/run_tests_matrix.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index a517e261056..e0f070ffed8 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -52,14 +52,14 @@ def _safe_report_name(name): def _report_filename(name): """Generates report file name with directory structure that leads to better presentation by internal CI""" # 'sponge_log.xml' suffix must be there for results to get recognized by kokoro. - return 'run_tests_%s/%s' % (_safe_report_name(name), 'sponge_log.xml') + return '%s/%s' % (_safe_report_name(name), 'sponge_log.xml') def _report_logfilename(name): """Generates log file name that corresponds to name generated by _report_filename""" # 'sponge_log.log' suffix must be there for log to get recognized as "target log" # for the corresponding 'sponge_log.xml' report. - return 'run_tests_%s/%s' % (_safe_report_name(name), 'sponge_log.log') + return '%s/%s' % (_safe_report_name(name), 'sponge_log.log') def _docker_jobspec(name, @@ -75,7 +75,7 @@ def _docker_jobspec(name, 'python', 'tools/run_tests/run_tests.py', '--use_docker', '-t', '-j', str(inner_jobs), '-x', - _report_filename(name), '--report_suite_name', + 'run_tests/%s' % _report_filename(name), '--report_suite_name', '%s' % _safe_report_name(name) ] + runtests_args, environ=runtests_envs, @@ -103,7 +103,7 @@ def _workspace_jobspec(name, 'bash', 'tools/run_tests/helper_scripts/run_tests_in_workspace.sh', '-t', '-j', str(inner_jobs), '-x', - '../%s' % _report_filename(name), '--report_suite_name', + '../run_tests/%s' % _report_filename(name), '--report_suite_name', '%s' % _safe_report_name(name) ] + runtests_args, environ=env, From 218e7b0c54ea121c2c90f105c14d538525b243ae Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 10 Sep 2019 18:44:56 +0200 Subject: [PATCH 619/661] split run_tests_invocations to separate targets --- tools/run_tests/run_tests_matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index e0f070ffed8..0321ea2c455 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -605,7 +605,7 @@ if __name__ == "__main__": report_utils.render_junit_xml_report( resultset, _report_filename('run_tests_invocations'), - suite_name='run_tests_invocations') + suite_name='run_tests_invocations', split_by_target=True) if num_failures == 0: jobset.message( From 902094f9f2a4e91ba06cc40b6a45e5cb55d54663 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 10 Sep 2019 20:28:07 +0200 Subject: [PATCH 620/661] rename to run_tests_matrix_jobs --- tools/run_tests/run_tests_matrix.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index 0321ea2c455..36df41b4abd 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -604,8 +604,8 @@ if __name__ == "__main__": resultset.update(skipped_results) report_utils.render_junit_xml_report( resultset, - _report_filename('run_tests_invocations'), - suite_name='run_tests_invocations', split_by_target=True) + _report_filename('run_tests_matrix_jobs'), + suite_name='run_tests_matrix_jobs', split_by_target=True) if num_failures == 0: jobset.message( From 11222b78c24ba73e32032d5fe068479a0173c6ea Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Sep 2019 09:27:59 +0200 Subject: [PATCH 621/661] only use multi_target report for selected languages --- tools/run_tests/python_utils/report_utils.py | 6 +++-- tools/run_tests/run_tests.py | 10 +++++++- tools/run_tests/run_tests_matrix.py | 26 ++++++++++---------- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/tools/run_tests/python_utils/report_utils.py b/tools/run_tests/python_utils/report_utils.py index 707f9ef656c..714d9cf0605 100644 --- a/tools/run_tests/python_utils/report_utils.py +++ b/tools/run_tests/python_utils/report_utils.py @@ -50,14 +50,16 @@ def render_junit_xml_report(resultset, suite_package='grpc', suite_name='tests', replace_dots=True, - split_by_target=False): + multi_target=False): """Generate JUnit-like XML report.""" - if not split_by_target: + if not multi_targets: tree = new_junit_xml_tree() append_junit_xml_results(tree, resultset, suite_package, suite_name, '1', replace_dots) create_xml_report_file(tree, report_file) else: + # To have each test result displayed as a separate target by the Resultstore/Sponge UI, + # we generate a separate XML report file for each test result for shortname, results in six.iteritems(resultset): one_result = { shortname: results } tree = new_junit_xml_tree() diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index cb26d0ab772..8b2dfad2ef0 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1472,6 +1472,14 @@ argp.add_argument( default='tests', type=str, help='Test suite name to use in generated JUnit XML report') +argp.add_argument( + '--report_multi_target', + default=False, + const=True, + action='store_const', + help= + 'Generate separate XML report for each test job (Looks better in UIs).' +) argp.add_argument( '--quiet_success', default=False, @@ -1880,7 +1888,7 @@ def _build_and_run(check_cancelled, upload_extra_fields) if xml_report and resultset: report_utils.render_junit_xml_report( - resultset, xml_report, suite_name=args.report_suite_name, split_by_target=True) + resultset, xml_report, suite_name=args.report_suite_name, multi_target=args.report_multi_target) number_failures, _ = jobset.run( post_tests_steps, diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index 36df41b4abd..2948f415559 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -175,7 +175,7 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): configs=['dbg', 'opt'], platforms=['linux'], labels=['basictests'], - extra_args=extra_args, + extra_args=extra_args + ['--report_multi_target'], inner_jobs=inner_jobs) # supported on linux only @@ -184,7 +184,7 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): configs=['dbg', 'opt'], platforms=['linux'], labels=['basictests', 'multilang'], - extra_args=extra_args, + extra_args=extra_args + ['--report_multi_target'], inner_jobs=inner_jobs) # supported on all platforms. @@ -193,7 +193,7 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): configs=['dbg', 'opt'], platforms=['linux', 'macos', 'windows'], labels=['basictests', 'corelang'], - extra_args=extra_args, + extra_args=extra_args, # don't use multi_target report because C has too many test cases inner_jobs=inner_jobs, timeout_seconds=_CPP_RUNTESTS_TIMEOUT) @@ -203,7 +203,7 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): configs=['dbg', 'opt'], platforms=['linux', 'macos', 'windows'], labels=['basictests', 'multilang'], - extra_args=extra_args, + extra_args=extra_args + ['--report_multi_target'], inner_jobs=inner_jobs) # C# tests on .NET core test_jobs += _generate_jobs( @@ -213,7 +213,7 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): arch='default', compiler='coreclr', labels=['basictests', 'multilang'], - extra_args=extra_args, + extra_args=extra_args + ['--report_multi_target'], inner_jobs=inner_jobs) test_jobs += _generate_jobs( @@ -222,7 +222,7 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): platforms=['linux', 'macos', 'windows'], iomgr_platforms=['native', 'gevent'], labels=['basictests', 'multilang'], - extra_args=extra_args, + extra_args=extra_args + ['--report_multi_target'], inner_jobs=inner_jobs) # supported on linux and mac. @@ -231,7 +231,7 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): configs=['dbg', 'opt'], platforms=['linux', 'macos'], labels=['basictests', 'corelang'], - extra_args=extra_args, + extra_args=extra_args, # don't use multi_target report because C++ has too many test cases inner_jobs=inner_jobs, timeout_seconds=_CPP_RUNTESTS_TIMEOUT) @@ -240,7 +240,7 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): configs=['dbg', 'opt'], platforms=['linux', 'macos'], labels=['basictests', 'multilang'], - extra_args=extra_args, + extra_args=extra_args + ['--report_multi_target'], inner_jobs=inner_jobs) # supported on mac only. @@ -249,7 +249,7 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): configs=['opt'], platforms=['macos'], labels=['basictests', 'multilang'], - extra_args=extra_args, + extra_args=extra_args + ['--report_multi_target'], inner_jobs=inner_jobs, timeout_seconds=_OBJC_RUNTESTS_TIMEOUT) @@ -400,7 +400,7 @@ def _create_portability_test_jobs(extra_args=[], arch='default', compiler='python_alpine', labels=['portability', 'multilang'], - extra_args=extra_args, + extra_args=extra_args + ['--report_multi_target'], inner_jobs=inner_jobs) # TODO(jtattermusch): a large portion of the libuv tests is failing, @@ -605,16 +605,16 @@ if __name__ == "__main__": report_utils.render_junit_xml_report( resultset, _report_filename('run_tests_matrix_jobs'), - suite_name='run_tests_matrix_jobs', split_by_target=True) + suite_name='run_tests_matrix_jobs', multi_target=True) if num_failures == 0: jobset.message( 'SUCCESS', - 'All run_tests.py instance finished successfully.', + 'All run_tests.py instances finished successfully.', do_newline=True) else: jobset.message( 'FAILED', - 'Some run_tests.py instance have failed.', + 'Some run_tests.py instances have failed.', do_newline=True) sys.exit(1) From 2381d693b82e0a6c9d350fe959fddbfcea9c6333 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Sep 2019 10:03:36 +0200 Subject: [PATCH 622/661] preserve the run_tests.py logs in sponge --- tools/run_tests/run_tests_matrix.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index 2948f415559..f7ce0ae9664 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -43,6 +43,8 @@ _OBJC_RUNTESTS_TIMEOUT = 90 * 60 # Number of jobs assigned to each run_tests.py instance _DEFAULT_INNER_JOBS = 2 +# Name of the top-level umbrella report that includes all the run_tests.py invocations +_MATRIX_REPORT_NAME = 'run_tests_matrix_jobs' def _safe_report_name(name): """Reports with '+' in target name won't show correctly in ResultStore""" @@ -55,11 +57,15 @@ def _report_filename(name): return '%s/%s' % (_safe_report_name(name), 'sponge_log.xml') -def _report_logfilename(name): - """Generates log file name that corresponds to name generated by _report_filename""" +def _matrix_job_logfilename(shortname_for_multi_target): + """Generate location for log file that will match the sponge_log.xml from the top-level matrix report.""" # 'sponge_log.log' suffix must be there for log to get recognized as "target log" # for the corresponding 'sponge_log.xml' report. - return '%s/%s' % (_safe_report_name(name), 'sponge_log.log') + # the shortname_for_multi_target component must be set to match the sponge_log.xml location + # because the top-level render_junit_xml_report is called with multi_target=True + s = '%s/%s/%s' % (_MATRIX_REPORT_NAME, shortname_for_multi_target, 'sponge_log.log') + print(s) + return s def _docker_jobspec(name, @@ -70,6 +76,7 @@ def _docker_jobspec(name, """Run a single instance of run_tests.py in a docker container""" if not timeout_seconds: timeout_seconds = _DEFAULT_RUNTESTS_TIMEOUT + shortname = 'run_tests_%s' % name test_job = jobset.JobSpec( cmdline=[ 'python', 'tools/run_tests/run_tests.py', '--use_docker', '-t', @@ -79,9 +86,9 @@ def _docker_jobspec(name, '%s' % _safe_report_name(name) ] + runtests_args, environ=runtests_envs, - shortname='run_tests_%s' % name, + shortname=shortname, timeout_seconds=timeout_seconds, - logfilename=_report_logfilename(name)) + logfilename=_matrix_job_logfilename(shortname)) return test_job @@ -96,6 +103,7 @@ def _workspace_jobspec(name, workspace_name = 'workspace_%s' % name if not timeout_seconds: timeout_seconds = _DEFAULT_RUNTESTS_TIMEOUT + shortname = 'run_tests_%s' % name env = {'WORKSPACE_NAME': workspace_name} env.update(runtests_envs) test_job = jobset.JobSpec( @@ -107,9 +115,9 @@ def _workspace_jobspec(name, '%s' % _safe_report_name(name) ] + runtests_args, environ=env, - shortname='run_tests_%s' % name, + shortname=shortname, timeout_seconds=timeout_seconds, - logfilename=_report_logfilename(name)) + logfilename=_matrix_job_logfilename(shortname)) return test_job @@ -604,8 +612,8 @@ if __name__ == "__main__": resultset.update(skipped_results) report_utils.render_junit_xml_report( resultset, - _report_filename('run_tests_matrix_jobs'), - suite_name='run_tests_matrix_jobs', multi_target=True) + _report_filename(_MATRIX_REPORT_NAME), + suite_name=_MATRIX_REPORT_NAME, multi_target=True) if num_failures == 0: jobset.message( From babb70705d76b7730808b13ccfaef1c1d6e75113 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Sep 2019 10:05:54 +0200 Subject: [PATCH 623/661] fixup in report_utils.py --- tools/run_tests/python_utils/report_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/python_utils/report_utils.py b/tools/run_tests/python_utils/report_utils.py index 714d9cf0605..d9f6c5595d0 100644 --- a/tools/run_tests/python_utils/report_utils.py +++ b/tools/run_tests/python_utils/report_utils.py @@ -52,7 +52,7 @@ def render_junit_xml_report(resultset, replace_dots=True, multi_target=False): """Generate JUnit-like XML report.""" - if not multi_targets: + if not multi_target: tree = new_junit_xml_tree() append_junit_xml_results(tree, resultset, suite_package, suite_name, '1', replace_dots) From 5207c148ff2dac593e8bfa3b671df4ba8509e1a6 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Sep 2019 10:35:01 +0200 Subject: [PATCH 624/661] more readable test target ordering --- tools/run_tests/run_tests_matrix.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index f7ce0ae9664..f4e8f3cdc5f 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -44,7 +44,9 @@ _OBJC_RUNTESTS_TIMEOUT = 90 * 60 _DEFAULT_INNER_JOBS = 2 # Name of the top-level umbrella report that includes all the run_tests.py invocations -_MATRIX_REPORT_NAME = 'run_tests_matrix_jobs' +# Note that the starting letter 't' matters so that the targets are listed AFTER +# the per-test breakdown items that start with 'run_tests/' (it is more readable that way) +_MATRIX_REPORT_NAME = 'toplevel_run_tests_invocations' def _safe_report_name(name): """Reports with '+' in target name won't show correctly in ResultStore""" From f268db6f33cbde498aa5f8e37c01318a7e5eec8b Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Sep 2019 04:56:10 -0400 Subject: [PATCH 625/661] yapf format code --- tools/run_tests/python_utils/report_utils.py | 16 ++++++++++------ tools/run_tests/run_tests.py | 8 +++++--- tools/run_tests/run_tests_matrix.py | 13 +++++++++---- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/tools/run_tests/python_utils/report_utils.py b/tools/run_tests/python_utils/report_utils.py index d9f6c5595d0..0ab346b6139 100644 --- a/tools/run_tests/python_utils/report_utils.py +++ b/tools/run_tests/python_utils/report_utils.py @@ -54,18 +54,22 @@ def render_junit_xml_report(resultset, """Generate JUnit-like XML report.""" if not multi_target: tree = new_junit_xml_tree() - append_junit_xml_results(tree, resultset, suite_package, suite_name, '1', - replace_dots) + append_junit_xml_results(tree, resultset, suite_package, suite_name, + '1', replace_dots) create_xml_report_file(tree, report_file) else: # To have each test result displayed as a separate target by the Resultstore/Sponge UI, # we generate a separate XML report file for each test result for shortname, results in six.iteritems(resultset): - one_result = { shortname: results } + one_result = {shortname: results} tree = new_junit_xml_tree() - append_junit_xml_results(tree, one_result, '%s_%s' % (suite_package, shortname), '%s_%s' % (suite_name, shortname), '1', - replace_dots) - per_suite_report_file = os.path.join(os.path.dirname(report_file), shortname, os.path.basename(report_file)) + append_junit_xml_results(tree, one_result, '%s_%s' % (suite_package, + shortname), + '%s_%s' % (suite_name, + shortname), '1', replace_dots) + per_suite_report_file = os.path.join( + os.path.dirname(report_file), shortname, + os.path.basename(report_file)) create_xml_report_file(tree, per_suite_report_file) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 8b2dfad2ef0..a3708dc2b80 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1477,8 +1477,7 @@ argp.add_argument( default=False, const=True, action='store_const', - help= - 'Generate separate XML report for each test job (Looks better in UIs).' + help='Generate separate XML report for each test job (Looks better in UIs).' ) argp.add_argument( '--quiet_success', @@ -1888,7 +1887,10 @@ def _build_and_run(check_cancelled, upload_extra_fields) if xml_report and resultset: report_utils.render_junit_xml_report( - resultset, xml_report, suite_name=args.report_suite_name, multi_target=args.report_multi_target) + resultset, + xml_report, + suite_name=args.report_suite_name, + multi_target=args.report_multi_target) number_failures, _ = jobset.run( post_tests_steps, diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index f4e8f3cdc5f..105e5dcd906 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -48,6 +48,7 @@ _DEFAULT_INNER_JOBS = 2 # the per-test breakdown items that start with 'run_tests/' (it is more readable that way) _MATRIX_REPORT_NAME = 'toplevel_run_tests_invocations' + def _safe_report_name(name): """Reports with '+' in target name won't show correctly in ResultStore""" return name.replace('+', 'p') @@ -65,7 +66,8 @@ def _matrix_job_logfilename(shortname_for_multi_target): # for the corresponding 'sponge_log.xml' report. # the shortname_for_multi_target component must be set to match the sponge_log.xml location # because the top-level render_junit_xml_report is called with multi_target=True - s = '%s/%s/%s' % (_MATRIX_REPORT_NAME, shortname_for_multi_target, 'sponge_log.log') + s = '%s/%s/%s' % (_MATRIX_REPORT_NAME, shortname_for_multi_target, + 'sponge_log.log') print(s) return s @@ -203,7 +205,8 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): configs=['dbg', 'opt'], platforms=['linux', 'macos', 'windows'], labels=['basictests', 'corelang'], - extra_args=extra_args, # don't use multi_target report because C has too many test cases + extra_args= + extra_args, # don't use multi_target report because C has too many test cases inner_jobs=inner_jobs, timeout_seconds=_CPP_RUNTESTS_TIMEOUT) @@ -241,7 +244,8 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): configs=['dbg', 'opt'], platforms=['linux', 'macos'], labels=['basictests', 'corelang'], - extra_args=extra_args, # don't use multi_target report because C++ has too many test cases + extra_args= + extra_args, # don't use multi_target report because C++ has too many test cases inner_jobs=inner_jobs, timeout_seconds=_CPP_RUNTESTS_TIMEOUT) @@ -615,7 +619,8 @@ if __name__ == "__main__": report_utils.render_junit_xml_report( resultset, _report_filename(_MATRIX_REPORT_NAME), - suite_name=_MATRIX_REPORT_NAME, multi_target=True) + suite_name=_MATRIX_REPORT_NAME, + multi_target=True) if num_failures == 0: jobset.message( From 38d6c74fb3e8ad7dc41555fcfd319fffacf6f48a Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Sep 2019 14:47:33 +0200 Subject: [PATCH 626/661] remove node from singlevm e2e benchmarks --- tools/internal_ci/linux/grpc_e2e_performance_singlevm.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/internal_ci/linux/grpc_e2e_performance_singlevm.sh b/tools/internal_ci/linux/grpc_e2e_performance_singlevm.sh index 21f9d48ac41..710ca25a982 100755 --- a/tools/internal_ci/linux/grpc_e2e_performance_singlevm.sh +++ b/tools/internal_ci/linux/grpc_e2e_performance_singlevm.sh @@ -20,8 +20,10 @@ cd $(dirname $0)/../../.. source tools/internal_ci/helper_scripts/prepare_build_linux_perf_multilang_rc # "smoketest" scenarios on a single VM (=no remote VM for running qps_workers) +# TODO(jtattermusch): add back "node" language once the scenarios are passing again +# See https://github.com/grpc/grpc/issues/20234 tools/run_tests/run_performance_tests.py \ - -l c++ csharp ruby java python go php7 php7_protobuf_c node \ + -l c++ csharp ruby java python go php7 php7_protobuf_c \ --netperf \ --category smoketest \ -u kbuilder \ From a44e6d76b74d977ad121f942202a087db853607f Mon Sep 17 00:00:00 2001 From: Pau Freixes Date: Wed, 11 Sep 2019 20:37:45 +0200 Subject: [PATCH 627/661] [Aio] Unary unary client call barebones implementation Implement the minimal stuff for making a unary call with the new experimental gRPC Python implementation for Asyncio, called Aio. What has been added: - Minimal iomgr code for performing the required network and timer calls. - Minimal Cython code implementing the channel, call and the callback context. - Minimal Python code that mimics the synchronous implementation but designed to be asynchronous. Testing considerations: Tests have to be executed using the `GRPC_ENABLE_FORK_SUPPORT=0` environment variable for skipping the fork handles installed by the core library. This is due to the usage of a syncrhonous server used as a fixture executed in another process. Co-authored-by: Manuel Miranda Co-authored-by: Mariano Anaya Co-authored-by: Zhanghui Mao Co-authored-by: Lidi Zheng --- AUTHORS | 1 + setup.py | 3 + src/python/grpcio/grpc/_cython/BUILD.bazel | 16 ++ .../grpc/_cython/_cygrpc/aio/call.pxd.pxi | 27 +++ .../grpc/_cython/_cygrpc/aio/call.pyx.pxi | 149 ++++++++++++++ .../_cygrpc/aio/callbackcontext.pxd.pxi | 20 ++ .../grpc/_cython/_cygrpc/aio/channel.pxd.pxi | 18 ++ .../grpc/_cython/_cygrpc/aio/channel.pyx.pxi | 30 +++ .../grpc/_cython/_cygrpc/aio/grpc_aio.pxd.pxi | 25 +++ .../grpc/_cython/_cygrpc/aio/grpc_aio.pyx.pxi | 37 ++++ .../_cython/_cygrpc/aio/iomgr/iomgr.pyx.pxi | 185 ++++++++++++++++++ .../_cygrpc/aio/iomgr/resolver.pxd.pxi | 23 +++ .../_cygrpc/aio/iomgr/resolver.pyx.pxi | 61 ++++++ .../_cython/_cygrpc/aio/iomgr/socket.pxd.pxi | 34 ++++ .../_cython/_cygrpc/aio/iomgr/socket.pyx.pxi | 134 +++++++++++++ .../_cython/_cygrpc/aio/iomgr/timer.pxd.pxi | 25 +++ .../_cython/_cygrpc/aio/iomgr/timer.pyx.pxi | 45 +++++ .../grpcio/grpc/_cython/_cygrpc/grpc.pxi | 10 + .../grpc/_cython/_cygrpc/grpc_gevent.pxd.pxi | 109 ----------- .../grpc/_cython/_cygrpc/grpc_gevent.pyx.pxi | 46 ----- .../grpcio/grpc/_cython/_cygrpc/iomgr.pxd.pxi | 124 ++++++++++++ .../grpcio/grpc/_cython/_cygrpc/iomgr.pyx.pxi | 62 ++++++ src/python/grpcio/grpc/_cython/cygrpc.pxd | 11 ++ src/python/grpcio/grpc/_cython/cygrpc.pyx | 19 ++ .../grpcio/grpc/experimental/BUILD.bazel | 12 ++ .../grpcio/grpc/experimental/aio/__init__.py | 123 ++++++++++++ .../grpcio/grpc/experimental/aio/_channel.py | 105 ++++++++++ src/python/grpcio_tests/commands.py | 29 +++ src/python/grpcio_tests/setup.py | 1 + .../tests/_sanity/_sanity_test.py | 7 +- src/python/grpcio_tests/tests_aio/__init__.py | 21 ++ .../tests_aio/_sanity/__init__.py | 13 ++ .../tests_aio/_sanity/_sanity_test.py | 27 +++ src/python/grpcio_tests/tests_aio/tests.json | 5 + .../grpcio_tests/tests_aio/unit/__init__.py | 13 ++ .../tests_aio/unit/channel_test.py | 58 ++++++ .../grpcio_tests/tests_aio/unit/init_test.py | 35 ++++ .../tests_aio/unit/sync_server.py | 50 +++++ .../grpcio_tests/tests_aio/unit/test_base.py | 101 ++++++++++ tools/run_tests/run_tests.py | 38 +++- 40 files changed, 1691 insertions(+), 161 deletions(-) create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/call.pxd.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/call.pyx.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/callbackcontext.pxd.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/channel.pxd.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/channel.pyx.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/grpc_aio.pxd.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/grpc_aio.pyx.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/iomgr.pyx.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/resolver.pxd.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/resolver.pyx.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/socket.pxd.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/socket.pyx.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/timer.pxd.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/timer.pyx.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/iomgr.pxd.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/iomgr.pyx.pxi create mode 100644 src/python/grpcio/grpc/experimental/aio/__init__.py create mode 100644 src/python/grpcio/grpc/experimental/aio/_channel.py create mode 100644 src/python/grpcio_tests/tests_aio/__init__.py create mode 100644 src/python/grpcio_tests/tests_aio/_sanity/__init__.py create mode 100644 src/python/grpcio_tests/tests_aio/_sanity/_sanity_test.py create mode 100644 src/python/grpcio_tests/tests_aio/tests.json create mode 100644 src/python/grpcio_tests/tests_aio/unit/__init__.py create mode 100644 src/python/grpcio_tests/tests_aio/unit/channel_test.py create mode 100644 src/python/grpcio_tests/tests_aio/unit/init_test.py create mode 100644 src/python/grpcio_tests/tests_aio/unit/sync_server.py create mode 100644 src/python/grpcio_tests/tests_aio/unit/test_base.py diff --git a/AUTHORS b/AUTHORS index 0e8797391f2..0c5fee8c739 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,3 +1,4 @@ Dropbox, Inc. Google Inc. +Skyscanner Ltd. WeWork Companies Inc. diff --git a/setup.py b/setup.py index 609b18e01b5..eed516a1f11 100644 --- a/setup.py +++ b/setup.py @@ -265,6 +265,7 @@ if 'darwin' in sys.platform and PY3: r'macosx-10.7-\1', util.get_platform()) + def cython_extensions_and_necessity(): cython_module_files = [os.path.join(PYTHON_STEM, name.replace('.', '/') + '.pyx') @@ -295,6 +296,8 @@ def cython_extensions_and_necessity(): need_cython = BUILD_WITH_CYTHON if not BUILD_WITH_CYTHON: need_cython = need_cython or not commands.check_and_update_cythonization(extensions) + # TODO: the strategy for conditional compiling and exposing the aio Cython + # dependencies will be revisited by https://github.com/grpc/grpc/issues/19728 return commands.try_cythonize(extensions, linetracing=ENABLE_CYTHON_TRACING, mandatory=BUILD_WITH_CYTHON), need_cython CYTHON_EXTENSION_MODULES, need_cython = cython_extensions_and_necessity() diff --git a/src/python/grpcio/grpc/_cython/BUILD.bazel b/src/python/grpcio/grpc/_cython/BUILD.bazel index 18b1c92b9a7..e3cb89a81d3 100644 --- a/src/python/grpcio/grpc/_cython/BUILD.bazel +++ b/src/python/grpcio/grpc/_cython/BUILD.bazel @@ -8,6 +8,20 @@ pyx_library( "__init__.py", "_cygrpc/_hooks.pxd.pxi", "_cygrpc/_hooks.pyx.pxi", + "_cygrpc/aio/call.pxd.pxi", + "_cygrpc/aio/call.pyx.pxi", + "_cygrpc/aio/callbackcontext.pxd.pxi", + "_cygrpc/aio/channel.pxd.pxi", + "_cygrpc/aio/channel.pyx.pxi", + "_cygrpc/aio/grpc_aio.pxd.pxi", + "_cygrpc/aio/grpc_aio.pyx.pxi", + "_cygrpc/aio/iomgr/iomgr.pyx.pxi", + "_cygrpc/aio/iomgr/resolver.pxd.pxi", + "_cygrpc/aio/iomgr/resolver.pyx.pxi", + "_cygrpc/aio/iomgr/socket.pxd.pxi", + "_cygrpc/aio/iomgr/socket.pyx.pxi", + "_cygrpc/aio/iomgr/timer.pxd.pxi", + "_cygrpc/aio/iomgr/timer.pyx.pxi", "_cygrpc/arguments.pxd.pxi", "_cygrpc/arguments.pyx.pxi", "_cygrpc/call.pxd.pxi", @@ -27,6 +41,8 @@ pyx_library( "_cygrpc/grpc_gevent.pxd.pxi", "_cygrpc/grpc_gevent.pyx.pxi", "_cygrpc/grpc_string.pyx.pxi", + "_cygrpc/iomgr.pxd.pxi", + "_cygrpc/iomgr.pyx.pxi", "_cygrpc/metadata.pxd.pxi", "_cygrpc/metadata.pyx.pxi", "_cygrpc/operation.pxd.pxi", diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/call.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/call.pxd.pxi new file mode 100644 index 00000000000..1166551fd5c --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/call.pxd.pxi @@ -0,0 +1,27 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +cdef class _AioCall: + cdef: + AioChannel _channel + CallbackContext _watcher_call + grpc_completion_queue * _cq + grpc_experimental_completion_queue_functor _functor + object _waiter_call + + @staticmethod + cdef void functor_run(grpc_experimental_completion_queue_functor* functor, int succeed) + @staticmethod + cdef void watcher_call_functor_run(grpc_experimental_completion_queue_functor* functor, int succeed) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/call.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/call.pyx.pxi new file mode 100644 index 00000000000..9530a47f389 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/call.pyx.pxi @@ -0,0 +1,149 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cimport cpython + +_EMPTY_FLAGS = 0 +_EMPTY_METADATA = () +_OP_ARRAY_LENGTH = 6 + + +cdef class _AioCall: + + + def __cinit__(self, AioChannel channel): + self._channel = channel + self._functor.functor_run = _AioCall.functor_run + + self._cq = grpc_completion_queue_create_for_callback( + &self._functor, + NULL + ) + + self._watcher_call.functor.functor_run = _AioCall.watcher_call_functor_run + self._watcher_call.waiter = self + self._waiter_call = None + + def __dealloc__(self): + grpc_completion_queue_shutdown(self._cq) + grpc_completion_queue_destroy(self._cq) + + def __repr__(self): + class_name = self.__class__.__name__ + id_ = id(self) + return f"<{class_name} {id_}>" + + @staticmethod + cdef void functor_run(grpc_experimental_completion_queue_functor* functor, int succeed): + pass + + @staticmethod + cdef void watcher_call_functor_run(grpc_experimental_completion_queue_functor* functor, int succeed): + call = <_AioCall>(functor).waiter + + assert call._waiter_call + + if succeed == 0: + call._waiter_call.set_exception(Exception("Some error ocurred")) + else: + call._waiter_call.set_result(None) + + async def unary_unary(self, method, request): + cdef grpc_call * call + cdef grpc_slice method_slice + cdef grpc_op * ops + + cdef Operation initial_metadata_operation + cdef Operation send_message_operation + cdef Operation send_close_from_client_operation + cdef Operation receive_initial_metadata_operation + cdef Operation receive_message_operation + cdef Operation receive_status_on_client_operation + + cdef grpc_call_error call_status + + + method_slice = grpc_slice_from_copied_buffer( + method, + len(method) + ) + + call = grpc_channel_create_call( + self._channel.channel, + NULL, + 0, + self._cq, + method_slice, + NULL, + _timespec_from_time(None), + NULL + ) + + grpc_slice_unref(method_slice) + + ops = gpr_malloc(sizeof(grpc_op) * _OP_ARRAY_LENGTH) + + initial_metadata_operation = SendInitialMetadataOperation(_EMPTY_METADATA, GRPC_INITIAL_METADATA_USED_MASK) + initial_metadata_operation.c() + ops[0] = initial_metadata_operation.c_op + + send_message_operation = SendMessageOperation(request, _EMPTY_FLAGS) + send_message_operation.c() + ops[1] = send_message_operation.c_op + + send_close_from_client_operation = SendCloseFromClientOperation(_EMPTY_FLAGS) + send_close_from_client_operation.c() + ops[2] = send_close_from_client_operation.c_op + + receive_initial_metadata_operation = ReceiveInitialMetadataOperation(_EMPTY_FLAGS) + receive_initial_metadata_operation.c() + ops[3] = receive_initial_metadata_operation.c_op + + receive_message_operation = ReceiveMessageOperation(_EMPTY_FLAGS) + receive_message_operation.c() + ops[4] = receive_message_operation.c_op + + receive_status_on_client_operation = ReceiveStatusOnClientOperation(_EMPTY_FLAGS) + receive_status_on_client_operation.c() + ops[5] = receive_status_on_client_operation.c_op + + self._waiter_call = asyncio.get_event_loop().create_future() + + call_status = grpc_call_start_batch( + call, + ops, + _OP_ARRAY_LENGTH, + &self._watcher_call.functor, + NULL + ) + + try: + if call_status != GRPC_CALL_OK: + self._waiter_call = None + raise Exception("Error with grpc_call_start_batch {}".format(call_status)) + + await self._waiter_call + + finally: + initial_metadata_operation.un_c() + send_message_operation.un_c() + send_close_from_client_operation.un_c() + receive_initial_metadata_operation.un_c() + receive_message_operation.un_c() + receive_status_on_client_operation.un_c() + + grpc_call_unref(call) + gpr_free(ops) + + return receive_message_operation.message() diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/callbackcontext.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/callbackcontext.pxd.pxi new file mode 100644 index 00000000000..8e52c856dd2 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/callbackcontext.pxd.pxi @@ -0,0 +1,20 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cimport cpython + +cdef struct CallbackContext: + grpc_experimental_completion_queue_functor functor + cpython.PyObject *waiter + diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/channel.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/channel.pxd.pxi new file mode 100644 index 00000000000..f5e1a5d3095 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/channel.pxd.pxi @@ -0,0 +1,18 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cdef class AioChannel: + cdef: + grpc_channel * channel + bytes _target diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/channel.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/channel.pyx.pxi new file mode 100644 index 00000000000..b52c070553d --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/channel.pyx.pxi @@ -0,0 +1,30 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cdef class AioChannel: + def __cinit__(self, bytes target): + self.channel = grpc_insecure_channel_create(target, NULL, NULL) + self._target = target + + def __repr__(self): + class_name = self.__class__.__name__ + id_ = id(self) + return f"<{class_name} {id_}>" + + def close(self): + grpc_channel_destroy(self.channel) + + async def unary_unary(self, method, request): + call = _AioCall(self) + return await call.unary_unary(method, request) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/grpc_aio.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/grpc_aio.pxd.pxi new file mode 100644 index 00000000000..6cefb63d208 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/grpc_aio.pxd.pxi @@ -0,0 +1,25 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# distutils: language=c++ + +cdef extern from "src/core/lib/iomgr/timer_manager.h": + void grpc_timer_manager_set_threading(bint enabled); + +cdef extern from "src/core/lib/iomgr/iomgr_internal.h": + void grpc_set_default_iomgr_platform(); + +cdef extern from "src/core/lib/iomgr/executor.h" namespace "grpc_core": + cdef cppclass Executor: + @staticmethod + void SetThreadingAll(bint enable); diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/grpc_aio.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/grpc_aio.pyx.pxi new file mode 100644 index 00000000000..64645a6c3b4 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/grpc_aio.pyx.pxi @@ -0,0 +1,37 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +cdef bint _grpc_aio_initialized = 0 + + +def init_grpc_aio(): + global _grpc_aio_initialized + + if _grpc_aio_initialized: + return + + install_asyncio_iomgr() + grpc_init() + + # Timers are triggered by the Asyncio loop. We disable + # the background thread that is being used by the native + # gRPC iomgr. + grpc_timer_manager_set_threading(0) + + # gRPC callbaks are executed within the same thread used by the Asyncio + # event loop, as it is being done by the other Asyncio callbacks. + Executor.SetThreadingAll(0) + + _grpc_aio_initialized = 1 diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/iomgr.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/iomgr.pyx.pxi new file mode 100644 index 00000000000..13e95ee1206 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/iomgr.pyx.pxi @@ -0,0 +1,185 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from cpython cimport Py_INCREF, Py_DECREF + +from libc cimport string + +cdef grpc_socket_vtable asyncio_socket_vtable +cdef grpc_custom_resolver_vtable asyncio_resolver_vtable +cdef grpc_custom_timer_vtable asyncio_timer_vtable +cdef grpc_custom_poller_vtable asyncio_pollset_vtable + + +cdef grpc_error* asyncio_socket_init( + grpc_custom_socket* grpc_socket, + int domain) with gil: + socket = _AsyncioSocket.create(grpc_socket) + Py_INCREF(socket) + grpc_socket.impl = socket + return 0 + + +cdef void asyncio_socket_destroy(grpc_custom_socket* grpc_socket) with gil: + Py_DECREF(<_AsyncioSocket>grpc_socket.impl) + + +cdef void asyncio_socket_connect( + grpc_custom_socket* grpc_socket, + const grpc_sockaddr* addr, + size_t addr_len, + grpc_custom_connect_callback connect_cb) with gil: + + host, port = sockaddr_to_tuple(addr, addr_len) + socket = <_AsyncioSocket>grpc_socket.impl + socket.connect(host, port, connect_cb) + + +cdef void asyncio_socket_close( + grpc_custom_socket* grpc_socket, + grpc_custom_close_callback close_cb) with gil: + socket = (<_AsyncioSocket>grpc_socket.impl) + socket.close() + close_cb(grpc_socket) + + +cdef void asyncio_socket_shutdown(grpc_custom_socket* grpc_socket) with gil: + socket = (<_AsyncioSocket>grpc_socket.impl) + socket.close() + + +cdef void asyncio_socket_write( + grpc_custom_socket* grpc_socket, + grpc_slice_buffer* slice_buffer, + grpc_custom_write_callback write_cb) with gil: + socket = (<_AsyncioSocket>grpc_socket.impl) + socket.write(slice_buffer, write_cb) + + +cdef void asyncio_socket_read( + grpc_custom_socket* grpc_socket, + char* buffer_, + size_t length, + grpc_custom_read_callback read_cb) with gil: + socket = (<_AsyncioSocket>grpc_socket.impl) + socket.read(buffer_, length, read_cb) + + +cdef grpc_error* asyncio_socket_getpeername( + grpc_custom_socket* grpc_socket, + const grpc_sockaddr* addr, + int* length) with gil: + raise NotImplemented() + + +cdef grpc_error* asyncio_socket_getsockname( + grpc_custom_socket* grpc_socket, + const grpc_sockaddr* addr, + int* length) with gil: + raise NotImplemented() + + +cdef grpc_error* asyncio_socket_listen(grpc_custom_socket* grpc_socket) with gil: + raise NotImplemented() + + +cdef grpc_error* asyncio_socket_bind( + grpc_custom_socket* grpc_socket, + const grpc_sockaddr* addr, + size_t len, int flags) with gil: + raise NotImplemented() + + +cdef void asyncio_socket_accept( + grpc_custom_socket* grpc_socket, + grpc_custom_socket* grpc_socket_client, + grpc_custom_accept_callback accept_cb) with gil: + raise NotImplemented() + + +cdef grpc_error* asyncio_resolve( + char* host, + char* port, + grpc_resolved_addresses** res) with gil: + raise NotImplemented() + + +cdef void asyncio_resolve_async( + grpc_custom_resolver* grpc_resolver, + char* host, + char* port) with gil: + resolver = _AsyncioResolver.create(grpc_resolver) + resolver.resolve(host, port) + + +cdef void asyncio_timer_start(grpc_custom_timer* grpc_timer) with gil: + timer = _AsyncioTimer.create(grpc_timer, grpc_timer.timeout_ms / 1000.0) + Py_INCREF(timer) + grpc_timer.timer = timer + + +cdef void asyncio_timer_stop(grpc_custom_timer* grpc_timer) with gil: + timer = <_AsyncioTimer>grpc_timer.timer + timer.stop() + Py_DECREF(timer) + + +cdef void asyncio_init_loop() with gil: + pass + + +cdef void asyncio_destroy_loop() with gil: + pass + + +cdef void asyncio_kick_loop() with gil: + pass + + +cdef void asyncio_run_loop(size_t timeout_ms) with gil: + pass + + +def install_asyncio_iomgr(): + asyncio_resolver_vtable.resolve = asyncio_resolve + asyncio_resolver_vtable.resolve_async = asyncio_resolve_async + + asyncio_socket_vtable.init = asyncio_socket_init + asyncio_socket_vtable.connect = asyncio_socket_connect + asyncio_socket_vtable.destroy = asyncio_socket_destroy + asyncio_socket_vtable.shutdown = asyncio_socket_shutdown + asyncio_socket_vtable.close = asyncio_socket_close + asyncio_socket_vtable.write = asyncio_socket_write + asyncio_socket_vtable.read = asyncio_socket_read + asyncio_socket_vtable.getpeername = asyncio_socket_getpeername + asyncio_socket_vtable.getsockname = asyncio_socket_getsockname + asyncio_socket_vtable.bind = asyncio_socket_bind + asyncio_socket_vtable.listen = asyncio_socket_listen + asyncio_socket_vtable.accept = asyncio_socket_accept + + asyncio_timer_vtable.start = asyncio_timer_start + asyncio_timer_vtable.stop = asyncio_timer_stop + + asyncio_pollset_vtable.init = asyncio_init_loop + asyncio_pollset_vtable.poll = asyncio_run_loop + asyncio_pollset_vtable.kick = asyncio_kick_loop + asyncio_pollset_vtable.shutdown = asyncio_destroy_loop + + grpc_custom_iomgr_init( + &asyncio_socket_vtable, + &asyncio_resolver_vtable, + &asyncio_timer_vtable, + &asyncio_pollset_vtable + ) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/resolver.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/resolver.pxd.pxi new file mode 100644 index 00000000000..26089c95337 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/resolver.pxd.pxi @@ -0,0 +1,23 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cdef class _AsyncioResolver: + cdef: + grpc_custom_resolver* _grpc_resolver + object _task_resolve + + @staticmethod + cdef _AsyncioResolver create(grpc_custom_resolver* grpc_resolver) + + cdef void resolve(self, char* host, char* port) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/resolver.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/resolver.pyx.pxi new file mode 100644 index 00000000000..4c102392e5c --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/resolver.pyx.pxi @@ -0,0 +1,61 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +cdef class _AsyncioResolver: + def __cinit__(self): + self._grpc_resolver = NULL + self._task_resolve = None + + @staticmethod + cdef _AsyncioResolver create(grpc_custom_resolver* grpc_resolver): + resolver = _AsyncioResolver() + resolver._grpc_resolver = grpc_resolver + return resolver + + def __repr__(self): + class_name = self.__class__.__name__ + id_ = id(self) + return f"<{class_name} {id_}>" + + def _resolve_cb(self, future): + error = False + try: + res = future.result() + except Exception as e: + error = True + finally: + self._task_resolve = None + + if not error: + grpc_custom_resolve_callback( + self._grpc_resolver, + tuples_to_resolvaddr(res), + 0 + ) + else: + grpc_custom_resolve_callback( + self._grpc_resolver, + NULL, + grpc_socket_error("getaddrinfo {}".format(str(e)).encode()) + ) + + cdef void resolve(self, char* host, char* port): + assert not self._task_resolve + + loop = asyncio.get_event_loop() + self._task_resolve = asyncio.ensure_future( + loop.getaddrinfo(host, port) + ) + self._task_resolve.add_done_callback(self._resolve_cb) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/socket.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/socket.pxd.pxi new file mode 100644 index 00000000000..aab5db2149a --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/socket.pxd.pxi @@ -0,0 +1,34 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +cdef class _AsyncioSocket: + cdef: + grpc_custom_socket * _grpc_socket + grpc_custom_connect_callback _grpc_connect_cb + grpc_custom_read_callback _grpc_read_cb + object _reader + object _writer + object _task_read + object _task_connect + char * _read_buffer + + @staticmethod + cdef _AsyncioSocket create(grpc_custom_socket * grpc_socket) + + cdef void connect(self, object host, object port, grpc_custom_connect_callback grpc_connect_cb) + cdef void write(self, grpc_slice_buffer * g_slice_buffer, grpc_custom_write_callback grpc_write_cb) + cdef void read(self, char * buffer_, size_t length, grpc_custom_read_callback grpc_read_cb) + cdef bint is_connected(self) + cdef void close(self) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/socket.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/socket.pyx.pxi new file mode 100644 index 00000000000..690c34c2da9 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/socket.pyx.pxi @@ -0,0 +1,134 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import socket + +from libc cimport string + +cdef class _AsyncioSocket: + def __cinit__(self): + self._grpc_socket = NULL + self._grpc_connect_cb = NULL + self._grpc_read_cb = NULL + self._reader = None + self._writer = None + self._task_connect = None + self._task_read = None + self._read_buffer = NULL + + @staticmethod + cdef _AsyncioSocket create(grpc_custom_socket * grpc_socket): + socket = _AsyncioSocket() + socket._grpc_socket = grpc_socket + return socket + + def __repr__(self): + class_name = self.__class__.__name__ + id_ = id(self) + connected = self.is_connected() + return f"<{class_name} {id_} connected={connected}>" + + def _connect_cb(self, future): + error = False + try: + self._reader, self._writer = future.result() + except Exception as e: + error = True + finally: + self._task_connect = None + + if not error: + # gRPC default posix implementation disables nagle + # algorithm. + sock = self._writer.transport.get_extra_info('socket') + sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, True) + + self._grpc_connect_cb( + self._grpc_socket, + 0 + ) + else: + self._grpc_connect_cb( + self._grpc_socket, + grpc_socket_error("connect {}".format(str(e)).encode()) + ) + + def _read_cb(self, future): + error = False + try: + buffer_ = future.result() + except Exception as e: + error = True + error_msg = str(e) + finally: + self._task_read = None + + if not error: + string.memcpy( + self._read_buffer, + buffer_, + len(buffer_) + ) + self._grpc_read_cb( + self._grpc_socket, + len(buffer_), + 0 + ) + else: + self._grpc_read_cb( + self._grpc_socket, + -1, + grpc_socket_error("read {}".format(error_msg).encode()) + ) + + cdef void connect(self, object host, object port, grpc_custom_connect_callback grpc_connect_cb): + assert not self._task_connect + + self._task_connect = asyncio.ensure_future( + asyncio.open_connection(host, port) + ) + self._grpc_connect_cb = grpc_connect_cb + self._task_connect.add_done_callback(self._connect_cb) + + cdef void read(self, char * buffer_, size_t length, grpc_custom_read_callback grpc_read_cb): + assert not self._task_read + + self._task_read = asyncio.ensure_future( + self._reader.read(n=length) + ) + self._grpc_read_cb = grpc_read_cb + self._task_read.add_done_callback(self._read_cb) + self._read_buffer = buffer_ + + cdef void write(self, grpc_slice_buffer * g_slice_buffer, grpc_custom_write_callback grpc_write_cb): + cdef char* start + buffer_ = bytearray() + for i in range(g_slice_buffer.count): + start = grpc_slice_buffer_start(g_slice_buffer, i) + length = grpc_slice_buffer_length(g_slice_buffer, i) + buffer_.extend(start[:length]) + + self._writer.write(buffer_) + + grpc_write_cb( + self._grpc_socket, + 0 + ) + + cdef bint is_connected(self): + return self._reader and not self._reader._transport.is_closing() + + cdef void close(self): + if self.is_connected(): + self._writer.close() diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/timer.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/timer.pxd.pxi new file mode 100644 index 00000000000..5af5dcd9282 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/timer.pxd.pxi @@ -0,0 +1,25 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cdef class _AsyncioTimer: + cdef: + grpc_custom_timer * _grpc_timer + object _deadline + object _timer_handler + int _active + + @staticmethod + cdef _AsyncioTimer create(grpc_custom_timer * grpc_timer, deadline) + + cdef stop(self) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/timer.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/timer.pyx.pxi new file mode 100644 index 00000000000..e8edb4a5cf8 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/timer.pyx.pxi @@ -0,0 +1,45 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +cdef class _AsyncioTimer: + def __cinit__(self): + self._grpc_timer = NULL + self._timer_handler = None + self._active = 0 + + @staticmethod + cdef _AsyncioTimer create(grpc_custom_timer * grpc_timer, deadline): + timer = _AsyncioTimer() + timer._grpc_timer = grpc_timer + timer._deadline = deadline + timer._timer_handler = asyncio.get_event_loop().call_later(deadline, timer._on_deadline) + timer._active = 1 + return timer + + def _on_deadline(self): + self._active = 0 + grpc_custom_timer_callback(self._grpc_timer, 0) + + def __repr__(self): + class_name = self.__class__.__name__ + id_ = id(self) + return f"<{class_name} {id_} deadline={self._deadline} active={self._active}>" + + cdef stop(self): + if self._active == 0: + return + + self._timer_handler.cancel() + self._active = 0 diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index 4bfb42026aa..e2117905421 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -41,6 +41,11 @@ cdef extern from "grpc/byte_buffer_reader.h": pass +cdef extern from "grpc/impl/codegen/grpc_types.h": + ctypedef struct grpc_experimental_completion_queue_functor: + void (*functor_run)(grpc_experimental_completion_queue_functor*, int); + + cdef extern from "grpc/grpc.h": ctypedef struct grpc_slice: @@ -325,6 +330,7 @@ cdef extern from "grpc/grpc.h": ctypedef struct grpc_op: grpc_op_type type "op" uint32_t flags + void * reserved grpc_op_data data void grpc_init() nogil @@ -350,6 +356,10 @@ cdef extern from "grpc/grpc.h": void grpc_completion_queue_shutdown(grpc_completion_queue *cq) nogil void grpc_completion_queue_destroy(grpc_completion_queue *cq) nogil + grpc_completion_queue *grpc_completion_queue_create_for_callback( + grpc_experimental_completion_queue_functor* shutdown_callback, + void *reserved) nogil + grpc_call_error grpc_call_start_batch( grpc_call *call, const grpc_op *ops, size_t nops, void *tag, void *reserved) nogil diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pxd.pxi index 30fdf6a7600..4f5033b8e44 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pxd.pxi @@ -13,115 +13,6 @@ # limitations under the License. # distutils: language=c++ -cdef extern from "grpc/impl/codegen/slice.h": - struct grpc_slice_buffer: - int count - -cdef extern from "src/core/lib/iomgr/error.h": - struct grpc_error: - pass - -cdef extern from "src/core/lib/iomgr/gevent_util.h": - grpc_error* grpc_socket_error(char* error) - char* grpc_slice_buffer_start(grpc_slice_buffer* buffer, int i) - int grpc_slice_buffer_length(grpc_slice_buffer* buffer, int i) - -cdef extern from "src/core/lib/iomgr/sockaddr.h": - ctypedef struct grpc_sockaddr: - pass - -cdef extern from "src/core/lib/iomgr/resolve_address.h": - ctypedef struct grpc_resolved_addresses: - size_t naddrs - grpc_resolved_address* addrs - - ctypedef struct grpc_resolved_address: - char[128] addr - size_t len - -cdef extern from "src/core/lib/iomgr/resolve_address_custom.h": - struct grpc_custom_resolver: - pass - - struct grpc_custom_resolver_vtable: - grpc_error* (*resolve)(char* host, char* port, grpc_resolved_addresses** res); - void (*resolve_async)(grpc_custom_resolver* resolver, char* host, char* port); - - void grpc_custom_resolve_callback(grpc_custom_resolver* resolver, - grpc_resolved_addresses* result, - grpc_error* error); - -cdef extern from "src/core/lib/iomgr/tcp_custom.h": - struct grpc_custom_socket: - void* impl - # We don't care about the rest of the fields - ctypedef void (*grpc_custom_connect_callback)(grpc_custom_socket* socket, - grpc_error* error) - ctypedef void (*grpc_custom_write_callback)(grpc_custom_socket* socket, - grpc_error* error) - ctypedef void (*grpc_custom_read_callback)(grpc_custom_socket* socket, - size_t nread, grpc_error* error) - ctypedef void (*grpc_custom_accept_callback)(grpc_custom_socket* socket, - grpc_custom_socket* client, - grpc_error* error) - ctypedef void (*grpc_custom_close_callback)(grpc_custom_socket* socket) - - struct grpc_socket_vtable: - grpc_error* (*init)(grpc_custom_socket* socket, int domain); - void (*connect)(grpc_custom_socket* socket, const grpc_sockaddr* addr, - size_t len, grpc_custom_connect_callback cb); - void (*destroy)(grpc_custom_socket* socket); - void (*shutdown)(grpc_custom_socket* socket); - void (*close)(grpc_custom_socket* socket, grpc_custom_close_callback cb); - void (*write)(grpc_custom_socket* socket, grpc_slice_buffer* slices, - grpc_custom_write_callback cb); - void (*read)(grpc_custom_socket* socket, char* buffer, size_t length, - grpc_custom_read_callback cb); - grpc_error* (*getpeername)(grpc_custom_socket* socket, - const grpc_sockaddr* addr, int* len); - grpc_error* (*getsockname)(grpc_custom_socket* socket, - const grpc_sockaddr* addr, int* len); - grpc_error* (*bind)(grpc_custom_socket* socket, const grpc_sockaddr* addr, - size_t len, int flags); - grpc_error* (*listen)(grpc_custom_socket* socket); - void (*accept)(grpc_custom_socket* socket, grpc_custom_socket* client, - grpc_custom_accept_callback cb); - -cdef extern from "src/core/lib/iomgr/timer_custom.h": - struct grpc_custom_timer: - void* timer - int timeout_ms - # We don't care about the rest of the fields - - struct grpc_custom_timer_vtable: - void (*start)(grpc_custom_timer* t); - void (*stop)(grpc_custom_timer* t); - - void grpc_custom_timer_callback(grpc_custom_timer* t, grpc_error* error); - -cdef extern from "src/core/lib/iomgr/pollset_custom.h": - struct grpc_custom_poller_vtable: - void (*init)() - void (*poll)(size_t timeout_ms) - void (*kick)() - void (*shutdown)() - -cdef extern from "src/core/lib/iomgr/iomgr_custom.h": - void grpc_custom_iomgr_init(grpc_socket_vtable* socket, - grpc_custom_resolver_vtable* resolver, - grpc_custom_timer_vtable* timer, - grpc_custom_poller_vtable* poller); - -cdef extern from "src/core/lib/iomgr/sockaddr_utils.h": - int grpc_sockaddr_get_port(const grpc_resolved_address *addr); - int grpc_sockaddr_to_string(char **out, const grpc_resolved_address *addr, - int normalize); - void grpc_string_to_sockaddr(grpc_resolved_address *out, char* addr, int port); - int grpc_sockaddr_set_port(const grpc_resolved_address *resolved_addr, - int port) - const char* grpc_sockaddr_get_uri_scheme(const grpc_resolved_address* resolved_addr) - - cdef class TimerWrapper: cdef grpc_custom_timer *c_timer diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pyx.pxi index a1618d04d0e..13256ed49b8 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pyx.pxi @@ -15,7 +15,6 @@ cimport cpython from libc cimport string -from libc.stdlib cimport malloc, free import errno gevent_g = None gevent_socket = None @@ -24,51 +23,6 @@ gevent_event = None g_event = None g_pool = None -cdef grpc_error* grpc_error_none(): - return 0 - -cdef grpc_error* socket_error(str syscall, str err): - error_str = "{} failed: {}".format(syscall, err) - error_bytes = str_to_bytes(error_str) - return grpc_socket_error(error_bytes) - -cdef resolved_addr_to_tuple(grpc_resolved_address* address): - cdef char* res_str - port = grpc_sockaddr_get_port(address) - str_len = grpc_sockaddr_to_string(&res_str, address, 0) - byte_str = _decode(res_str[:str_len]) - if byte_str.endswith(':' + str(port)): - byte_str = byte_str[:(0 - len(str(port)) - 1)] - byte_str = byte_str.lstrip('[') - byte_str = byte_str.rstrip(']') - byte_str = '{}'.format(byte_str) - return byte_str, port - -cdef sockaddr_to_tuple(const grpc_sockaddr* address, size_t length): - cdef grpc_resolved_address c_addr - string.memcpy(c_addr.addr, address, length) - c_addr.len = length - return resolved_addr_to_tuple(&c_addr) - -cdef sockaddr_is_ipv4(const grpc_sockaddr* address, size_t length): - cdef grpc_resolved_address c_addr - string.memcpy(c_addr.addr, address, length) - c_addr.len = length - return grpc_sockaddr_get_uri_scheme(&c_addr) == b'ipv4' - -cdef grpc_resolved_addresses* tuples_to_resolvaddr(tups): - cdef grpc_resolved_addresses* addresses - tups_set = set((tup[4][0], tup[4][1]) for tup in tups) - addresses = malloc(sizeof(grpc_resolved_addresses)) - addresses.naddrs = len(tups_set) - addresses.addrs = malloc(sizeof(grpc_resolved_address) * len(tups_set)) - i = 0 - for tup in set(tups_set): - hostname = str_to_bytes(tup[0]) - grpc_string_to_sockaddr(&addresses.addrs[i], hostname, tup[1]) - i += 1 - return addresses - def _spawn_greenlet(*args): greenlet = g_pool.spawn(*args) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/iomgr.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/iomgr.pxd.pxi new file mode 100644 index 00000000000..2f00bab3c0a --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/iomgr.pxd.pxi @@ -0,0 +1,124 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# distutils: language=c++ + +cdef extern from "grpc/impl/codegen/slice.h": + struct grpc_slice_buffer: + int count + +cdef extern from "src/core/lib/iomgr/error.h": + struct grpc_error: + pass + +# TODO(https://github.com/grpc/grpc/issues/20135) Change the filename +# for something more meaningful. +cdef extern from "src/core/lib/iomgr/gevent_util.h": + grpc_error* grpc_socket_error(char* error) + char* grpc_slice_buffer_start(grpc_slice_buffer* buffer, int i) + int grpc_slice_buffer_length(grpc_slice_buffer* buffer, int i) + +cdef extern from "src/core/lib/iomgr/sockaddr.h": + ctypedef struct grpc_sockaddr: + pass + +cdef extern from "src/core/lib/iomgr/resolve_address.h": + ctypedef struct grpc_resolved_addresses: + size_t naddrs + grpc_resolved_address* addrs + + ctypedef struct grpc_resolved_address: + char[128] addr + size_t len + +cdef extern from "src/core/lib/iomgr/resolve_address_custom.h": + struct grpc_custom_resolver: + pass + + struct grpc_custom_resolver_vtable: + grpc_error* (*resolve)(char* host, char* port, grpc_resolved_addresses** res); + void (*resolve_async)(grpc_custom_resolver* resolver, char* host, char* port); + + void grpc_custom_resolve_callback(grpc_custom_resolver* resolver, + grpc_resolved_addresses* result, + grpc_error* error); + +cdef extern from "src/core/lib/iomgr/tcp_custom.h": + struct grpc_custom_socket: + void* impl + # We don't care about the rest of the fields + ctypedef void (*grpc_custom_connect_callback)(grpc_custom_socket* socket, + grpc_error* error) + ctypedef void (*grpc_custom_write_callback)(grpc_custom_socket* socket, + grpc_error* error) + ctypedef void (*grpc_custom_read_callback)(grpc_custom_socket* socket, + size_t nread, grpc_error* error) + ctypedef void (*grpc_custom_accept_callback)(grpc_custom_socket* socket, + grpc_custom_socket* client, + grpc_error* error) + ctypedef void (*grpc_custom_close_callback)(grpc_custom_socket* socket) + + struct grpc_socket_vtable: + grpc_error* (*init)(grpc_custom_socket* socket, int domain); + void (*connect)(grpc_custom_socket* socket, const grpc_sockaddr* addr, + size_t len, grpc_custom_connect_callback cb); + void (*destroy)(grpc_custom_socket* socket); + void (*shutdown)(grpc_custom_socket* socket); + void (*close)(grpc_custom_socket* socket, grpc_custom_close_callback cb); + void (*write)(grpc_custom_socket* socket, grpc_slice_buffer* slices, + grpc_custom_write_callback cb); + void (*read)(grpc_custom_socket* socket, char* buffer, size_t length, + grpc_custom_read_callback cb); + grpc_error* (*getpeername)(grpc_custom_socket* socket, + const grpc_sockaddr* addr, int* len); + grpc_error* (*getsockname)(grpc_custom_socket* socket, + const grpc_sockaddr* addr, int* len); + grpc_error* (*bind)(grpc_custom_socket* socket, const grpc_sockaddr* addr, + size_t len, int flags); + grpc_error* (*listen)(grpc_custom_socket* socket); + void (*accept)(grpc_custom_socket* socket, grpc_custom_socket* client, + grpc_custom_accept_callback cb); + +cdef extern from "src/core/lib/iomgr/timer_custom.h": + struct grpc_custom_timer: + void* timer + int timeout_ms + # We don't care about the rest of the fields + + struct grpc_custom_timer_vtable: + void (*start)(grpc_custom_timer* t); + void (*stop)(grpc_custom_timer* t); + + void grpc_custom_timer_callback(grpc_custom_timer* t, grpc_error* error); + +cdef extern from "src/core/lib/iomgr/pollset_custom.h": + struct grpc_custom_poller_vtable: + void (*init)() + void (*poll)(size_t timeout_ms) + void (*kick)() + void (*shutdown)() + +cdef extern from "src/core/lib/iomgr/iomgr_custom.h": + void grpc_custom_iomgr_init(grpc_socket_vtable* socket, + grpc_custom_resolver_vtable* resolver, + grpc_custom_timer_vtable* timer, + grpc_custom_poller_vtable* poller); + +cdef extern from "src/core/lib/iomgr/sockaddr_utils.h": + int grpc_sockaddr_get_port(const grpc_resolved_address *addr); + int grpc_sockaddr_to_string(char **out, const grpc_resolved_address *addr, + int normalize); + void grpc_string_to_sockaddr(grpc_resolved_address *out, char* addr, int port); + int grpc_sockaddr_set_port(const grpc_resolved_address *resolved_addr, + int port) + const char* grpc_sockaddr_get_uri_scheme(const grpc_resolved_address* resolved_addr) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/iomgr.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/iomgr.pyx.pxi new file mode 100644 index 00000000000..9274f1c5fdb --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/iomgr.pyx.pxi @@ -0,0 +1,62 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# distutils: language=c++ + +from libc cimport string +from libc.stdlib cimport malloc + +cdef grpc_error* grpc_error_none(): + return 0 + +cdef grpc_error* socket_error(str syscall, str err): + error_str = "{} failed: {}".format(syscall, err) + error_bytes = str_to_bytes(error_str) + return grpc_socket_error(error_bytes) + +cdef resolved_addr_to_tuple(grpc_resolved_address* address): + cdef char* res_str + port = grpc_sockaddr_get_port(address) + str_len = grpc_sockaddr_to_string(&res_str, address, 0) + byte_str = _decode(res_str[:str_len]) + if byte_str.endswith(':' + str(port)): + byte_str = byte_str[:(0 - len(str(port)) - 1)] + byte_str = byte_str.lstrip('[') + byte_str = byte_str.rstrip(']') + byte_str = '{}'.format(byte_str) + return byte_str, port + +cdef sockaddr_to_tuple(const grpc_sockaddr* address, size_t length): + cdef grpc_resolved_address c_addr + string.memcpy(c_addr.addr, address, length) + c_addr.len = length + return resolved_addr_to_tuple(&c_addr) + +cdef sockaddr_is_ipv4(const grpc_sockaddr* address, size_t length): + cdef grpc_resolved_address c_addr + string.memcpy(c_addr.addr, address, length) + c_addr.len = length + return grpc_sockaddr_get_uri_scheme(&c_addr) == b'ipv4' + +cdef grpc_resolved_addresses* tuples_to_resolvaddr(tups): + cdef grpc_resolved_addresses* addresses + tups_set = set((tup[4][0], tup[4][1]) for tup in tups) + addresses = malloc(sizeof(grpc_resolved_addresses)) + addresses.naddrs = len(tups_set) + addresses.addrs = malloc(sizeof(grpc_resolved_address) * len(tups_set)) + i = 0 + for tup in set(tups_set): + hostname = str_to_bytes(tup[0]) + grpc_string_to_sockaddr(&addresses.addrs[i], hostname, tup[1]) + i += 1 + return addresses diff --git a/src/python/grpcio/grpc/_cython/cygrpc.pxd b/src/python/grpcio/grpc/_cython/cygrpc.pxd index e29f7aee97a..4d081fb83e2 100644 --- a/src/python/grpcio/grpc/_cython/cygrpc.pxd +++ b/src/python/grpcio/grpc/_cython/cygrpc.pxd @@ -32,7 +32,18 @@ include "_cygrpc/time.pxd.pxi" include "_cygrpc/vtable.pxd.pxi" include "_cygrpc/_hooks.pxd.pxi" +include "_cygrpc/iomgr.pxd.pxi" + include "_cygrpc/grpc_gevent.pxd.pxi" IF UNAME_SYSNAME != "Windows": include "_cygrpc/fork_posix.pxd.pxi" + +# Following pxi files are part of the Aio module +include "_cygrpc/aio/iomgr/socket.pxd.pxi" +include "_cygrpc/aio/iomgr/timer.pxd.pxi" +include "_cygrpc/aio/iomgr/resolver.pxd.pxi" +include "_cygrpc/aio/grpc_aio.pxd.pxi" +include "_cygrpc/aio/callbackcontext.pxd.pxi" +include "_cygrpc/aio/call.pxd.pxi" +include "_cygrpc/aio/channel.pxd.pxi" diff --git a/src/python/grpcio/grpc/_cython/cygrpc.pyx b/src/python/grpcio/grpc/_cython/cygrpc.pyx index f2dd0df89d4..316fb993095 100644 --- a/src/python/grpcio/grpc/_cython/cygrpc.pyx +++ b/src/python/grpcio/grpc/_cython/cygrpc.pyx @@ -17,6 +17,13 @@ cimport cpython import os.path import sys +try: + import asyncio +except ImportError: + # TODO(https://github.com/grpc/grpc/issues/19728) Improve how Aio Cython is + # distributed without breaking none compatible Python versions. For now, if + # Asyncio package is not available we just skip it. + pass # TODO(atash): figure out why the coverage tool gets confused about the Cython # coverage plugin when the following files don't have a '.pxi' suffix. @@ -39,6 +46,8 @@ include "_cygrpc/time.pyx.pxi" include "_cygrpc/vtable.pyx.pxi" include "_cygrpc/_hooks.pyx.pxi" +include "_cygrpc/iomgr.pyx.pxi" + include "_cygrpc/grpc_gevent.pyx.pxi" IF UNAME_SYSNAME == "Windows": @@ -46,6 +55,16 @@ IF UNAME_SYSNAME == "Windows": ELSE: include "_cygrpc/fork_posix.pyx.pxi" +# Following pxi files are part of the Aio module +include "_cygrpc/aio/iomgr/iomgr.pyx.pxi" +include "_cygrpc/aio/iomgr/socket.pyx.pxi" +include "_cygrpc/aio/iomgr/timer.pyx.pxi" +include "_cygrpc/aio/iomgr/resolver.pyx.pxi" +include "_cygrpc/aio/grpc_aio.pyx.pxi" +include "_cygrpc/aio/call.pyx.pxi" +include "_cygrpc/aio/channel.pyx.pxi" + + # # initialize gRPC # diff --git a/src/python/grpcio/grpc/experimental/BUILD.bazel b/src/python/grpcio/grpc/experimental/BUILD.bazel index cd8afe533b6..00815c4e72e 100644 --- a/src/python/grpcio/grpc/experimental/BUILD.bazel +++ b/src/python/grpcio/grpc/experimental/BUILD.bazel @@ -1,9 +1,21 @@ package(default_visibility = ["//visibility:public"]) +py_library( + name = "aio", + srcs = [ + "aio/__init__.py", + "aio/_channel.py", + ], + deps = [ + "//src/python/grpcio/grpc/_cython:cygrpc", + ], +) + py_library( name = "experimental", srcs = ["__init__.py",], deps = [ + ":aio", ":gevent", ":session_cache", ], diff --git a/src/python/grpcio/grpc/experimental/aio/__init__.py b/src/python/grpcio/grpc/experimental/aio/__init__.py new file mode 100644 index 00000000000..6004126549b --- /dev/null +++ b/src/python/grpcio/grpc/experimental/aio/__init__.py @@ -0,0 +1,123 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""gRPC's Asynchronous Python API.""" + +import abc +import six + +from grpc._cython.cygrpc import init_grpc_aio + + +class Channel(six.with_metaclass(abc.ABCMeta)): + """Asynchronous Channel implementation.""" + + @abc.abstractmethod + def unary_unary(self, + method, + request_serializer=None, + response_deserializer=None): + """Creates a UnaryUnaryMultiCallable for a unary-unary method. + + Args: + method: The name of the RPC method. + request_serializer: Optional behaviour for serializing the request + message. Request goes unserialized in case None is passed. + response_deserializer: Optional behaviour for deserializing the + response message. Response goes undeserialized in case None + is passed. + + Returns: + A UnaryUnaryMultiCallable value for the named unary-unary method. + """ + raise NotImplementedError() + + @abc.abstractmethod + async def close(self): + """Closes this Channel and releases all resources held by it. + + Closing the Channel will proactively terminate all RPCs active with the + Channel and it is not valid to invoke new RPCs with the Channel. + + This method is idempotent. + """ + raise NotImplementedError() + + @abc.abstractmethod + async def __aenter__(self): + """Starts an asynchronous context manager. + + Returns: + Channel the channel that was instantiated. + """ + raise NotImplementedError() + + @abc.abstractmethod + async def __aexit__(self, exc_type, exc_val, exc_tb): + """Finishes the asynchronous context manager by closing gracefully the channel.""" + raise NotImplementedError() + + +class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)): + """Affords invoking a unary-unary RPC from client-side in an asynchronous way.""" + + @abc.abstractmethod + async def __call__(self, + request, + timeout=None, + metadata=None, + credentials=None, + wait_for_ready=None, + compression=None): + """Asynchronously invokes the underlying RPC. + + Args: + request: The request value for the RPC. + timeout: An optional duration of time in seconds to allow + for the RPC. + metadata: Optional :term:`metadata` to be transmitted to the + service-side of the RPC. + credentials: An optional CallCredentials for the RPC. Only valid for + secure Channel. + wait_for_ready: This is an EXPERIMENTAL argument. An optional + flag to enable wait for ready mechanism + compression: An element of grpc.compression, e.g. + grpc.compression.Gzip. This is an EXPERIMENTAL option. + + Returns: + The response value for the RPC. + + Raises: + RpcError: Indicating that the RPC terminated with non-OK status. The + raised RpcError will also be a Call for the RPC affording the RPC's + metadata, status code, and details. + """ + raise NotImplementedError() + + +def insecure_channel(target, options=None, compression=None): + """Creates an insecure asynchronous Channel to a server. + + Args: + target: The server address + options: An optional list of key-value pairs (channel args + in gRPC Core runtime) to configure the channel. + compression: An optional value indicating the compression method to be + used over the lifetime of the channel. This is an EXPERIMENTAL option. + + Returns: + A Channel. + """ + from grpc.experimental.aio import _channel # pylint: disable=cyclic-import + return _channel.Channel(target, () + if options is None else options, None, compression) diff --git a/src/python/grpcio/grpc/experimental/aio/_channel.py b/src/python/grpcio/grpc/experimental/aio/_channel.py new file mode 100644 index 00000000000..e3c8fcdbf2f --- /dev/null +++ b/src/python/grpcio/grpc/experimental/aio/_channel.py @@ -0,0 +1,105 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Invocation-side implementation of gRPC Asyncio Python.""" + +from grpc import _common +from grpc._cython import cygrpc +from grpc.experimental import aio + + +class UnaryUnaryMultiCallable(aio.UnaryUnaryMultiCallable): + + def __init__(self, channel, method, request_serializer, + response_deserializer): + self._channel = channel + self._method = method + self._request_serializer = request_serializer + self._response_deserializer = response_deserializer + + async def __call__(self, + request, + timeout=None, + metadata=None, + credentials=None, + wait_for_ready=None, + compression=None): + + if timeout: + raise NotImplementedError("TODO: timeout not implemented yet") + + if metadata: + raise NotImplementedError("TODO: metadata not implemented yet") + + if credentials: + raise NotImplementedError("TODO: credentials not implemented yet") + + if wait_for_ready: + raise NotImplementedError( + "TODO: wait_for_ready not implemented yet") + + if compression: + raise NotImplementedError("TODO: compression not implemented yet") + + response = await self._channel.unary_unary( + self._method, _common.serialize(request, self._request_serializer)) + + return _common.deserialize(response, self._response_deserializer) + + +class Channel(aio.Channel): + """A cygrpc.AioChannel-backed implementation of grpc.experimental.aio.Channel.""" + + def __init__(self, target, options, credentials, compression): + """Constructor. + + Args: + target: The target to which to connect. + options: Configuration options for the channel. + credentials: A cygrpc.ChannelCredentials or None. + compression: An optional value indicating the compression method to be + used over the lifetime of the channel. + """ + + if options: + raise NotImplementedError("TODO: options not implemented yet") + + if credentials: + raise NotImplementedError("TODO: credentials not implemented yet") + + if compression: + raise NotImplementedError("TODO: compression not implemented yet") + + self._channel = cygrpc.AioChannel(_common.encode(target)) + + def unary_unary(self, + method, + request_serializer=None, + response_deserializer=None): + + return UnaryUnaryMultiCallable(self._channel, _common.encode(method), + request_serializer, + response_deserializer) + + async def _close(self): + # TODO: Send cancellation status + self._channel.close() + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc_val, exc_tb): + await self._close() + + async def close(self): + await self._close() diff --git a/src/python/grpcio_tests/commands.py b/src/python/grpcio_tests/commands.py index 61d8bdc1f7b..2912ba113c9 100644 --- a/src/python/grpcio_tests/commands.py +++ b/src/python/grpcio_tests/commands.py @@ -107,6 +107,35 @@ class TestLite(setuptools.Command): self.distribution.fetch_build_eggs(self.distribution.tests_require) +class TestAio(setuptools.Command): + """Command to run aio tests without fetching or building anything.""" + + description = 'run aio tests without fetching or building anything.' + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + self._add_eggs_to_path() + + import tests + loader = tests.Loader() + loader.loadTestsFromNames(['tests_aio']) + runner = tests.Runner() + result = runner.run(loader.suite) + if not result.wasSuccessful(): + sys.exit('Test failure') + + def _add_eggs_to_path(self): + """Fetch install and test requirements""" + self.distribution.fetch_build_eggs(self.distribution.install_requires) + self.distribution.fetch_build_eggs(self.distribution.tests_require) + + class TestGevent(setuptools.Command): """Command to run tests w/gevent.""" diff --git a/src/python/grpcio_tests/setup.py b/src/python/grpcio_tests/setup.py index f9cb9d0cec9..50ba1bb5942 100644 --- a/src/python/grpcio_tests/setup.py +++ b/src/python/grpcio_tests/setup.py @@ -58,6 +58,7 @@ COMMAND_CLASS = { 'run_interop': commands.RunInterop, 'test_lite': commands.TestLite, 'test_gevent': commands.TestGevent, + 'test_aio': commands.TestAio, } PACKAGE_DATA = { diff --git a/src/python/grpcio_tests/tests/_sanity/_sanity_test.py b/src/python/grpcio_tests/tests/_sanity/_sanity_test.py index 7da6e7b34c3..6b4efdaca9f 100644 --- a/src/python/grpcio_tests/tests/_sanity/_sanity_test.py +++ b/src/python/grpcio_tests/tests/_sanity/_sanity_test.py @@ -25,17 +25,20 @@ class SanityTest(unittest.TestCase): maxDiff = 32768 + TEST_PKG_MODULE_NAME = 'tests' + TEST_PKG_PATH = 'tests' + def testTestsJsonUpToDate(self): """Autodiscovers all test suites and checks that tests.json is up to date""" loader = tests.Loader() - loader.loadTestsFromNames(['tests']) + loader.loadTestsFromNames([self.TEST_PKG_MODULE_NAME]) test_suite_names = sorted({ test_case_class.id().rsplit('.', 1)[0] for test_case_class in tests._loader.iterate_suite_cases( loader.suite) }) - tests_json_string = pkgutil.get_data('tests', 'tests.json') + tests_json_string = pkgutil.get_data(self.TEST_PKG_PATH, 'tests.json') tests_json = json.loads(tests_json_string.decode() if six.PY3 else tests_json_string) diff --git a/src/python/grpcio_tests/tests_aio/__init__.py b/src/python/grpcio_tests/tests_aio/__init__.py new file mode 100644 index 00000000000..8ddd3106965 --- /dev/null +++ b/src/python/grpcio_tests/tests_aio/__init__.py @@ -0,0 +1,21 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +from tests import _loader +from tests import _runner + +Loader = _loader.Loader +Runner = _runner.Runner diff --git a/src/python/grpcio_tests/tests_aio/_sanity/__init__.py b/src/python/grpcio_tests/tests_aio/_sanity/__init__.py new file mode 100644 index 00000000000..f4b321fc5b2 --- /dev/null +++ b/src/python/grpcio_tests/tests_aio/_sanity/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2019 The gRPC Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/src/python/grpcio_tests/tests_aio/_sanity/_sanity_test.py b/src/python/grpcio_tests/tests_aio/_sanity/_sanity_test.py new file mode 100644 index 00000000000..e74dec0739b --- /dev/null +++ b/src/python/grpcio_tests/tests_aio/_sanity/_sanity_test.py @@ -0,0 +1,27 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest + +from tests._sanity import _sanity_test + + +class AioSanityTest(_sanity_test.SanityTest): + + TEST_PKG_MODULE_NAME = 'tests_aio' + TEST_PKG_PATH = 'tests_aio' + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests_aio/tests.json b/src/python/grpcio_tests/tests_aio/tests.json new file mode 100644 index 00000000000..49d025a5abe --- /dev/null +++ b/src/python/grpcio_tests/tests_aio/tests.json @@ -0,0 +1,5 @@ +[ + "_sanity._sanity_test.AioSanityTest", + "unit.channel_test.TestChannel", + "unit.init_test.TestInsecureChannel" +] diff --git a/src/python/grpcio_tests/tests_aio/unit/__init__.py b/src/python/grpcio_tests/tests_aio/unit/__init__.py new file mode 100644 index 00000000000..f4b321fc5b2 --- /dev/null +++ b/src/python/grpcio_tests/tests_aio/unit/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2019 The gRPC Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/src/python/grpcio_tests/tests_aio/unit/channel_test.py b/src/python/grpcio_tests/tests_aio/unit/channel_test.py new file mode 100644 index 00000000000..6bc53ec625e --- /dev/null +++ b/src/python/grpcio_tests/tests_aio/unit/channel_test.py @@ -0,0 +1,58 @@ +# Copyright 2019 The gRPC Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging +import unittest + +from grpc.experimental import aio +from tests_aio.unit import test_base +from src.proto.grpc.testing import messages_pb2 + + +class TestChannel(test_base.AioTestBase): + + def test_async_context(self): + + async def coro(): + async with aio.insecure_channel(self.server_target) as channel: + hi = channel.unary_unary( + '/grpc.testing.TestService/UnaryCall', + request_serializer=messages_pb2.SimpleRequest. + SerializeToString, + response_deserializer=messages_pb2.SimpleResponse.FromString + ) + await hi(messages_pb2.SimpleRequest()) + + self.loop.run_until_complete(coro()) + + def test_unary_unary(self): + + async def coro(): + channel = aio.insecure_channel(self.server_target) + hi = channel.unary_unary( + '/grpc.testing.TestService/UnaryCall', + request_serializer=messages_pb2.SimpleRequest.SerializeToString, + response_deserializer=messages_pb2.SimpleResponse.FromString) + response = await hi(messages_pb2.SimpleRequest()) + + self.assertEqual(type(response), messages_pb2.SimpleResponse) + + await channel.close() + + self.loop.run_until_complete(coro()) + + +if __name__ == '__main__': + logging.basicConfig() + unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests_aio/unit/init_test.py b/src/python/grpcio_tests/tests_aio/unit/init_test.py new file mode 100644 index 00000000000..ab580f18e11 --- /dev/null +++ b/src/python/grpcio_tests/tests_aio/unit/init_test.py @@ -0,0 +1,35 @@ +# Copyright 2019 The gRPC Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging +import unittest + +from grpc.experimental import aio +from tests_aio.unit import test_base + + +class TestInsecureChannel(test_base.AioTestBase): + + def test_insecure_channel(self): + + async def coro(): + channel = aio.insecure_channel(self.server_target) + self.assertIsInstance(channel, aio.Channel) + + self.loop.run_until_complete(coro()) + + +if __name__ == '__main__': + logging.basicConfig() + unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests_aio/unit/sync_server.py b/src/python/grpcio_tests/tests_aio/unit/sync_server.py new file mode 100644 index 00000000000..105ded8e76c --- /dev/null +++ b/src/python/grpcio_tests/tests_aio/unit/sync_server.py @@ -0,0 +1,50 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse + +from concurrent import futures +from time import sleep + +import grpc +from src.proto.grpc.testing import messages_pb2 +from src.proto.grpc.testing import test_pb2_grpc + + +# TODO (https://github.com/grpc/grpc/issues/19762) +# Change for an asynchronous server version once it's implemented. +class TestServiceServicer(test_pb2_grpc.TestServiceServicer): + + def UnaryCall(self, request, context): + return messages_pb2.SimpleResponse() + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Synchronous gRPC server.') + parser.add_argument( + '--host_and_port', + required=True, + type=str, + nargs=1, + help='the host and port to listen.') + args = parser.parse_args() + + server = grpc.server( + futures.ThreadPoolExecutor(max_workers=1), + options=(('grpc.so_reuseport', 1),)) + test_pb2_grpc.add_TestServiceServicer_to_server(TestServiceServicer(), + server) + server.add_insecure_port(args.host_and_port[0]) + server.start() + server.wait_for_termination() diff --git a/src/python/grpcio_tests/tests_aio/unit/test_base.py b/src/python/grpcio_tests/tests_aio/unit/test_base.py new file mode 100644 index 00000000000..0b325523e0f --- /dev/null +++ b/src/python/grpcio_tests/tests_aio/unit/test_base.py @@ -0,0 +1,101 @@ +# Copyright 2019 The gRPC Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import sys +import subprocess + +import asyncio +import unittest +import socket + +from grpc.experimental import aio +from tests_aio.unit import sync_server + + +def _get_free_loopback_tcp_port(): + if socket.has_ipv6: + tcp_socket = socket.socket(socket.AF_INET6) + host = "::1" + host_target = "[::1]" + else: + tcp_socket = socket.socket(socket.AF_INET) + host = "127.0.0.1" + host_target = host + tcp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) + tcp_socket.bind((host, 0)) + address_tuple = tcp_socket.getsockname() + return tcp_socket, "%s:%s" % (host_target, address_tuple[1]) + + +class _Server: + """_Server is an wrapper for a sync-server subprocess. + + The synchronous server is executed in another process which initializes + implicitly the grpc using the synchronous configuration. Both worlds + can not coexist within the same process. + """ + + def __init__(self, host_and_port): # pylint: disable=W0621 + self._host_and_port = host_and_port + self._handle = None + + def start(self): + assert self._handle is None + + try: + from google3.pyglib import resources + executable = resources.GetResourceFilename( + "google3/third_party/py/grpc/sync_server") + args = [executable, '--host_and_port', self._host_and_port] + except ImportError: + executable = sys.executable + directory, _ = os.path.split(os.path.abspath(__file__)) + filename = directory + '/sync_server.py' + args = [ + executable, filename, '--host_and_port', self._host_and_port + ] + + self._handle = subprocess.Popen(args) + + def terminate(self): + if not self._handle: + return + + self._handle.terminate() + self._handle.wait() + self._handle = None + + +class AioTestBase(unittest.TestCase): + + def setUp(self): + self._socket, self._target = _get_free_loopback_tcp_port() + self._server = _Server(self._target) + self._server.start() + self._loop = asyncio.new_event_loop() + asyncio.set_event_loop(self._loop) + aio.init_grpc_aio() + + def tearDown(self): + self._server.terminate() + self._socket.close() + + @property + def loop(self): + return self._loop + + @property + def server_target(self): + return self._target diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index a3708dc2b80..3476f9ce4c8 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -703,6 +703,10 @@ class PythonConfig( class PythonLanguage(object): + _DEFAULT_COMMAND = 'test_lite' + _TEST_SPECS_FILE = 'src/python/grpcio_tests/tests/tests.json' + _TEST_FOLDER = 'test' + def configure(self, config, args): self.config = config self.args = args @@ -710,8 +714,7 @@ class PythonLanguage(object): def test_specs(self): # load list of known test suites - with open( - 'src/python/grpcio_tests/tests/tests.json') as tests_json_file: + with open(self._TEST_SPECS_FILE) as tests_json_file: tests_json = json.load(tests_json_file) environment = dict(_FORCE_ENVIRON_FOR_WRAPPERS) return [ @@ -721,7 +724,8 @@ class PythonLanguage(object): environ=dict( list(environment.items()) + [( 'GRPC_PYTHON_TESTRUNNER_FILTER', str(suite_name))]), - shortname='%s.test.%s' % (config.name, suite_name), + shortname='%s.%s.%s' % (config.name, self._TEST_FOLDER, + suite_name), ) for suite_name in tests_json for config in self.pythons ] @@ -789,7 +793,7 @@ class PythonLanguage(object): venv_relative_python = ['bin/python'] toolchain = ['unix'] - test_command = 'test_lite' + test_command = self._DEFAULT_COMMAND if args.iomgr_platform == 'gevent': test_command = 'test_gevent' runner = [ @@ -882,6 +886,31 @@ class PythonLanguage(object): return 'python' +class PythonAioLanguage(PythonLanguage): + + _DEFAULT_COMMAND = 'test_aio' + _TEST_SPECS_FILE = 'src/python/grpcio_tests/tests_aio/tests.json' + _TEST_FOLDER = 'test_aio' + + def configure(self, config, args): + self.config = config + self.args = args + self.pythons = self._get_pythons(self.args) + + def _get_pythons(self, args): + """Get python runtimes to test with, based on current platform, architecture, compiler etc.""" + + if args.compiler not in ('python3.6', 'python3.7', 'python3.8'): + raise Exception('Compiler %s not supported.' % args.compiler) + if args.iomgr_platform not in ('native'): + raise Exception( + 'Iomgr platform %s not supported.' % args.iomgr_platform) + return super()._get_pythons(args) + + def __str__(self): + return 'python_aio' + + class RubyLanguage(object): def configure(self, config, args): @@ -1269,6 +1298,7 @@ _LANGUAGES = { 'php': PhpLanguage(), 'php7': Php7Language(), 'python': PythonLanguage(), + 'python-aio': PythonAioLanguage(), 'ruby': RubyLanguage(), 'csharp': CSharpLanguage(), 'objc': ObjCLanguage(), From e9802ca190550dbe38f89c4b79914b008f56a26f Mon Sep 17 00:00:00 2001 From: Easwar Swaminathan Date: Wed, 11 Sep 2019 19:06:34 +0000 Subject: [PATCH 628/661] Add v1.22.3 and v1.23.1 release of grpc-go to interop matrix. v1.23.0 seems to have missed out since the [PR](https://github.com/grpc/grpc/pull/19928) to add that had a merge conflict and was never merged. --- tools/interop_matrix/client_matrix.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py index 5011e2ae700..ec219655543 100644 --- a/tools/interop_matrix/client_matrix.py +++ b/tools/interop_matrix/client_matrix.py @@ -145,7 +145,8 @@ LANG_RELEASE_MATRIX = { ReleaseInfo(runtimes=['go1.11'], testcases_file='go__v1.0.5')), ('v1.20.0', ReleaseInfo(runtimes=['go1.11'])), ('v1.21.3', ReleaseInfo(runtimes=['go1.11'])), - ('v1.22.2', ReleaseInfo(runtimes=['go1.11'])), + ('v1.22.3', ReleaseInfo(runtimes=['go1.11'])), + ('v1.23.1', ReleaseInfo(runtimes=['go1.11'])), ]), 'java': OrderedDict([ From 35a1f0a9634baea573b343edf77e63f09dbff039 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 2 Sep 2019 21:10:11 -0700 Subject: [PATCH 629/661] Add transport interceptor --- src/objective-c/GRPCClient/GRPCCall.m | 11 + src/objective-c/GRPCClient/GRPCTransport.h | 6 +- .../GRPCCoreCronet/GRPCCoreCronetFactory.m | 4 + .../private/GRPCCore/GRPCCoreFactory.m | 8 + .../tests/Tests.xcodeproj/project.pbxproj | 4 + .../tests/UnitTests/TransportTests.m | 232 ++++++++++++++++++ 6 files changed, 264 insertions(+), 1 deletion(-) create mode 100644 src/objective-c/tests/UnitTests/TransportTests.m diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 87c2768187e..0cfa38aa3e5 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -22,6 +22,7 @@ #import "GRPCCallOptions.h" #import "GRPCInterceptor.h" +#import "GRPCTransport.h" #import "private/GRPCTransport+Private.h" NSString *const kGRPCHeadersKey = @"io.grpc.HeadersKey"; @@ -183,6 +184,16 @@ NSString *const kGRPCErrorDomain = @"io.grpc"; if (globalInterceptorFactory != nil) { [interceptorFactories addObject:globalInterceptorFactory]; } + if (_actualCallOptions.transport != NULL) { + id transportFactory = [[GRPCTransportRegistry sharedInstance] + getTransportFactoryWithID:_actualCallOptions.transport]; + + NSArray> *transportInterceptorFactories = + transportFactory.transportInterceptorFactories; + if (transportInterceptorFactories != nil) { + [interceptorFactories addObjectsFromArray:transportInterceptorFactories]; + } + } // continuously create interceptor until one is successfully created while (_firstInterceptor == nil) { if (interceptorFactories.count == 0) { diff --git a/src/objective-c/GRPCClient/GRPCTransport.h b/src/objective-c/GRPCClient/GRPCTransport.h index a29dbd20e4d..400cf46e705 100644 --- a/src/objective-c/GRPCClient/GRPCTransport.h +++ b/src/objective-c/GRPCClient/GRPCTransport.h @@ -48,11 +48,15 @@ NSUInteger TransportIDHash(GRPCTransportID); @class GRPCCallOptions; @class GRPCTransport; -/** The factory method to create a transport. */ +/** The factory to create a transport. */ @protocol GRPCTransportFactory +/** Create a transport implementation. */ - (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager; +/** Get a list of factories for transport inteceptors. */ +@property(nonatomic, readonly) NSArray> *transportInterceptorFactories; + @end /** The registry of transport implementations. */ diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m index 2205d167d82..a595f4b7e63 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/GRPCCoreCronetFactory.m @@ -47,6 +47,10 @@ static dispatch_once_t gInitGRPCCoreCronetFactory; return [[GRPCCall2Internal alloc] initWithTransportManager:transportManager]; } +- (NSArray> *)transportInterceptorFactories { + return nil; +} + - (id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions { return [GRPCCronetChannelFactory sharedInstance]; } diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m index 928625f1275..c3cefb7b649 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreFactory.m @@ -48,6 +48,10 @@ static dispatch_once_t gInitGRPCCoreInsecureFactory; return [[GRPCCall2Internal alloc] initWithTransportManager:transportManager]; } +- (NSArray> *)transportInterceptorFactories { + return nil; +} + - (id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions { NSError *error; id factory = @@ -83,6 +87,10 @@ static dispatch_once_t gInitGRPCCoreInsecureFactory; return [[GRPCCall2Internal alloc] initWithTransportManager:transportManager]; } +- (NSArray> *)transportInterceptorFactories { + return nil; +} + - (id)createCoreChannelFactoryWithCallOptions:(GRPCCallOptions *)callOptions { return [GRPCInsecureChannelFactory sharedInstance]; } diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 2ce32d3916d..927a7b64c3e 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -32,6 +32,7 @@ 5E7F489022778C95006656AD /* RxLibraryUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F488A22778B5D006656AD /* RxLibraryUnitTests.m */; }; 5E9F1C332321AB1700837469 /* TransportRegistryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E9F1C322321AB1700837469 /* TransportRegistryTests.m */; }; 5E9F1C352321C9B200837469 /* TransportRegistryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E9F1C342321C9B200837469 /* TransportRegistryTests.m */; }; + 5E9F1C59232302E200837469 /* TransportTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E9F1C58232302E200837469 /* TransportTests.m */; }; 5EA4770322736178000F72FC /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; }; 5EA477042273617B000F72FC /* InteropTestsLocalCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */; }; 5EA4770522736AC4000F72FC /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; @@ -125,6 +126,7 @@ 5E7F488A22778B5D006656AD /* RxLibraryUnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RxLibraryUnitTests.m; sourceTree = ""; }; 5E9F1C322321AB1700837469 /* TransportRegistryTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TransportRegistryTests.m; sourceTree = ""; }; 5E9F1C342321C9B200837469 /* TransportRegistryTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TransportRegistryTests.m; sourceTree = ""; }; + 5E9F1C58232302E200837469 /* TransportTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TransportTests.m; sourceTree = ""; }; 5EA476F42272816A000F72FC /* InteropTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InteropTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 5EA908CF4CDA4CE218352A06 /* Pods-InteropTestsLocalSSLCFStream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.release.xcconfig"; sourceTree = ""; }; 5EAD6D261E27047400002378 /* CronetUnitTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = CronetUnitTests.mm; path = CronetTests/CronetUnitTests.mm; sourceTree = SOURCE_ROOT; }; @@ -366,6 +368,7 @@ 5E0282E7215AA697007AC99D /* UnitTests */ = { isa = PBXGroup; children = ( + 5E9F1C58232302E200837469 /* TransportTests.m */, 5E9F1C322321AB1700837469 /* TransportRegistryTests.m */, 5E7F488A22778B5D006656AD /* RxLibraryUnitTests.m */, 5E7F488622778AEA006656AD /* GRPCClientTests.m */, @@ -874,6 +877,7 @@ 5E0282E9215AA697007AC99D /* NSErrorUnitTests.m in Sources */, 5E7F4880227782C1006656AD /* APIv2Tests.m in Sources */, 5E7F487D22778256006656AD /* ChannelPoolTest.m in Sources */, + 5E9F1C59232302E200837469 /* TransportTests.m in Sources */, 5E9F1C332321AB1700837469 /* TransportRegistryTests.m in Sources */, 5E7F488722778AEA006656AD /* GRPCClientTests.m in Sources */, 5E7F487E22778256006656AD /* ChannelTests.m in Sources */, diff --git a/src/objective-c/tests/UnitTests/TransportTests.m b/src/objective-c/tests/UnitTests/TransportTests.m new file mode 100644 index 00000000000..5f4db26258e --- /dev/null +++ b/src/objective-c/tests/UnitTests/TransportTests.m @@ -0,0 +1,232 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import +#import +#import + +#define TEST_TIMEOUT (8.0) + +static NSString *const kRemoteHost = @"grpc-test.sandbox.googleapis.com:443"; + +static const GRPCTransportID kFakeTransportID = "io.grpc.transport.unittest.fake"; + +@class GRPCFakeTransportFactory; +dispatch_once_t initFakeTransportFactory; +static GRPCFakeTransportFactory *fakeTransportFactory; + +@interface GRPCFakeTransportFactory : NSObject + +@property(atomic) GRPCTransport *nextTransportInstance; +- (void)setTransportInterceptorFactories:(NSArray> *)factories; + +@end + +@implementation GRPCFakeTransportFactory { + NSArray> *_interceptorFactories; +} + ++ (instancetype)sharedInstance { + dispatch_once(&initFakeTransportFactory, ^{ + fakeTransportFactory = [[GRPCFakeTransportFactory alloc] init]; + }); + return fakeTransportFactory; +} + ++ (void)load { + [[GRPCTransportRegistry sharedInstance] registerTransportWithID:kFakeTransportID + factory:[self sharedInstance]]; +} + +- (GRPCTransport *)createTransportWithManager:(GRPCTransportManager *)transportManager { + return _nextTransportInstance; +} + +- (void)setTransportInterceptorFactories:(NSArray> *)factories { + _interceptorFactories = [NSArray arrayWithArray:factories]; +} + +- (NSArray> *)transportInterceptorFactories { + return _interceptorFactories; +} + +@end + +@interface DummyInterceptor : GRPCInterceptor + +@property(atomic) BOOL hit; + +@end + +@implementation DummyInterceptor { + GRPCInterceptorManager *_manager; +} + +- (instancetype)initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager + dispatchQueue:(dispatch_queue_t)dispatchQueue { + if (dispatchQueue == nil) { + dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); + } + if ((self = [super initWithInterceptorManager:interceptorManager dispatchQueue:dispatchQueue])) { + _manager = interceptorManager; + } + return self; +} + +- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions + callOptions:(GRPCCallOptions *)callOptions { + self.hit = YES; + [_manager + forwardPreviousInterceptorCloseWithTrailingMetadata:nil + error:[NSError + errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeCancelled + userInfo:@{ + NSLocalizedDescriptionKey : + @"Canceled." + }]]; + [_manager shutDown]; +} + +@end + +@interface DummyInterceptorFactory : NSObject + ++ (instancetype)sharedInstance; + +@end + +static DummyInterceptorFactory *dummyInterceptorFactory; +static dispatch_once_t initDummyInterceptorFactory; + +@implementation DummyInterceptorFactory + ++ (instancetype)sharedInstance { + dispatch_once(&initDummyInterceptorFactory, ^{ + dummyInterceptorFactory = [[DummyInterceptorFactory alloc] init]; + }); + return dummyInterceptorFactory; +} + +- (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { + return [[DummyInterceptor alloc] + initWithInterceptorManager:interceptorManager + dispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL)]; +} + +@end + +@interface TestsBlockCallbacks : NSObject + +- (instancetype)initWithInitialMetadataCallback:(void (^)(NSDictionary *))initialMetadataCallback + dataCallback:(void (^)(id))dataCallback + closeCallback:(void (^)(NSDictionary *, NSError *))closeCallback + writeMessageCallback:(void (^)(void))writeMessageCallback; + +@end + +@implementation TestsBlockCallbacks { + void (^_initialMetadataCallback)(NSDictionary *); + void (^_dataCallback)(id); + void (^_closeCallback)(NSDictionary *, NSError *); + void (^_writeMessageCallback)(void); + dispatch_queue_t _dispatchQueue; +} + +- (instancetype)initWithInitialMetadataCallback:(void (^)(NSDictionary *))initialMetadataCallback + dataCallback:(void (^)(id))dataCallback + closeCallback:(void (^)(NSDictionary *, NSError *))closeCallback + writeMessageCallback:(void (^)(void))writeMessageCallback { + if ((self = [super init])) { + _initialMetadataCallback = initialMetadataCallback; + _dataCallback = dataCallback; + _closeCallback = closeCallback; + _writeMessageCallback = writeMessageCallback; + _dispatchQueue = dispatch_queue_create(nil, DISPATCH_QUEUE_SERIAL); + } + return self; +} + +- (void)didReceiveInitialMetadata:(NSDictionary *)initialMetadata { + if (_initialMetadataCallback) { + _initialMetadataCallback(initialMetadata); + } +} + +- (void)didReceiveProtoMessage:(id)message { + if (_dataCallback) { + _dataCallback(message); + } +} + +- (void)didCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { + if (_closeCallback) { + _closeCallback(trailingMetadata, error); + } +} + +- (void)didWriteMessage { + if (_writeMessageCallback) { + _writeMessageCallback(); + } +} + +- (dispatch_queue_t)dispatchQueue { + return _dispatchQueue; +} +@end + +@interface TransportTests : XCTestCase + +@end + +@implementation TransportTests + +- (void)testTransportInterceptors { + __weak XCTestExpectation *expectComplete = + [self expectationWithDescription:@"Expect call complete"]; + [GRPCFakeTransportFactory sharedInstance].nextTransportInstance = nil; + + [[GRPCFakeTransportFactory sharedInstance] + setTransportInterceptorFactories:@[ [DummyInterceptorFactory sharedInstance] ]]; + GRPCRequestOptions *requestOptions = + [[GRPCRequestOptions alloc] initWithHost:kRemoteHost + path:@"/UnaryCall" + safety:GRPCCallSafetyDefault]; + GRPCMutableCallOptions *callOptions = [[GRPCMutableCallOptions alloc] init]; + callOptions.transport = kFakeTransportID; + GRPCCall2 *call = [[GRPCCall2 alloc] + initWithRequestOptions:requestOptions + responseHandler:[[TestsBlockCallbacks alloc] + initWithInitialMetadataCallback:nil + dataCallback:nil + closeCallback:^(NSDictionary *trailingMetadata, + NSError *error) { + XCTAssertNotNil(error); + XCTAssertEqual(error.code, + GRPCErrorCodeCancelled); + [expectComplete fulfill]; + } + writeMessageCallback:nil] + callOptions:callOptions]; + [call start]; + [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil]; +} + +@end From 1b1364eb6b6b17875d1dce77377ec1a8b343d0a2 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Wed, 11 Sep 2019 14:17:27 -0700 Subject: [PATCH 630/661] Reviewer comments --- .../filters/http/client/http_client_filter.cc | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/core/ext/filters/http/client/http_client_filter.cc b/src/core/ext/filters/http/client/http_client_filter.cc index 1793e8106e4..1687f7ead09 100644 --- a/src/core/ext/filters/http/client/http_client_filter.cc +++ b/src/core/ext/filters/http/client/http_client_filter.cc @@ -340,11 +340,11 @@ static void remove_if_present(grpc_metadata_batch* batch, } } -static void hc_start_transport_stream_op_batch( +static void http_client_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* batch) { call_data* calld = static_cast(elem->call_data); channel_data* channeld = static_cast(elem->channel_data); - GPR_TIMER_SCOPE("hc_start_transport_stream_op_batch", 0); + GPR_TIMER_SCOPE("http_client_start_transport_stream_op_batch", 0); if (batch->recv_initial_metadata) { /* substitute our callback for the higher callback */ @@ -465,16 +465,16 @@ done: } /* Constructor for call_data */ -static grpc_error* hc_init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* http_client_init_call_elem( + grpc_call_element* elem, const grpc_call_element_args* args) { new (elem->call_data) call_data(elem, *args); return GRPC_ERROR_NONE; } /* Destructor for call_data */ -static void hc_destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void http_client_destroy_call_elem( + grpc_call_element* elem, const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = static_cast(elem->call_data); calld->~call_data(); } @@ -566,8 +566,8 @@ static grpc_core::ManagedMemorySlice user_agent_from_args( } /* Constructor for channel_data */ -static grpc_error* hc_init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* http_client_init_channel_elem( + grpc_channel_element* elem, grpc_channel_element_args* args) { channel_data* chand = static_cast(elem->channel_data); GPR_ASSERT(!args->is_last); GPR_ASSERT(args->optional_transport != nullptr); @@ -582,20 +582,20 @@ static grpc_error* hc_init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel data */ -static void hc_destroy_channel_elem(grpc_channel_element* elem) { +static void http_client_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); GRPC_MDELEM_UNREF(chand->user_agent); } const grpc_channel_filter grpc_http_client_filter = { - hc_start_transport_stream_op_batch, + http_client_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - hc_init_call_elem, + http_client_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - hc_destroy_call_elem, + http_client_destroy_call_elem, sizeof(channel_data), - hc_init_channel_elem, - hc_destroy_channel_elem, + http_client_init_channel_elem, + http_client_destroy_channel_elem, grpc_channel_next_get_info, "http-client"}; From 9f6f04d91a89fb71ab7a46932aa43df7ca8d2a5f Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 11 Sep 2019 14:12:29 -0700 Subject: [PATCH 631/661] Address comments --- src/objective-c/GRPCClient/GRPCCall.m | 8 +-- .../tests/UnitTests/TransportTests.m | 51 ++++++++++++------- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 0cfa38aa3e5..047e6774c74 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -197,14 +197,15 @@ NSString *const kGRPCErrorDomain = @"io.grpc"; // continuously create interceptor until one is successfully created while (_firstInterceptor == nil) { if (interceptorFactories.count == 0) { - _firstInterceptor = [[GRPCTransportManager alloc] initWithTransportID:_callOptions.transport - previousInterceptor:dispatcher]; + _firstInterceptor = + [[GRPCTransportManager alloc] initWithTransportID:_actualCallOptions.transport + previousInterceptor:dispatcher]; break; } else { _firstInterceptor = [[GRPCInterceptorManager alloc] initWithFactories:interceptorFactories previousInterceptor:dispatcher - transportID:_callOptions.transport]; + transportID:_actualCallOptions.transport]; if (_firstInterceptor == nil) { [interceptorFactories removeObjectAtIndex:0]; } @@ -215,7 +216,6 @@ NSString *const kGRPCErrorDomain = @"io.grpc"; NSLog(@"Failed to create interceptor or transport."); } } - return self; } diff --git a/src/objective-c/tests/UnitTests/TransportTests.m b/src/objective-c/tests/UnitTests/TransportTests.m index 5f4db26258e..37564cdb972 100644 --- a/src/objective-c/tests/UnitTests/TransportTests.m +++ b/src/objective-c/tests/UnitTests/TransportTests.m @@ -76,15 +76,18 @@ static GRPCFakeTransportFactory *fakeTransportFactory; @implementation DummyInterceptor { GRPCInterceptorManager *_manager; + BOOL _passthrough; } - (instancetype)initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager - dispatchQueue:(dispatch_queue_t)dispatchQueue { + dispatchQueue:(dispatch_queue_t)dispatchQueue + passthrough:(BOOL)passthrough { if (dispatchQueue == nil) { dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); } if ((self = [super initWithInterceptorManager:interceptorManager dispatchQueue:dispatchQueue])) { _manager = interceptorManager; + _passthrough = passthrough; } return self; } @@ -92,42 +95,50 @@ static GRPCFakeTransportFactory *fakeTransportFactory; - (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { self.hit = YES; - [_manager - forwardPreviousInterceptorCloseWithTrailingMetadata:nil - error:[NSError + if (_passthrough) { + [super startWithRequestOptions:requestOptions callOptions:callOptions]; + } else { + [_manager + forwardPreviousInterceptorCloseWithTrailingMetadata:nil + error: + [NSError errorWithDomain:kGRPCErrorDomain code:GRPCErrorCodeCancelled userInfo:@{ NSLocalizedDescriptionKey : @"Canceled." }]]; - [_manager shutDown]; + [_manager shutDown]; + } } @end @interface DummyInterceptorFactory : NSObject -+ (instancetype)sharedInstance; +- (instancetype)initWithPassthrough:(BOOL)passthrough; -@end +@property(nonatomic, readonly) DummyInterceptor *lastInterceptor; -static DummyInterceptorFactory *dummyInterceptorFactory; -static dispatch_once_t initDummyInterceptorFactory; +@end -@implementation DummyInterceptorFactory +@implementation DummyInterceptorFactory { + BOOL _passthrough; +} -+ (instancetype)sharedInstance { - dispatch_once(&initDummyInterceptorFactory, ^{ - dummyInterceptorFactory = [[DummyInterceptorFactory alloc] init]; - }); - return dummyInterceptorFactory; +- (instancetype)initWithPassthrough:(BOOL)passthrough { + if ((self = [super init])) { + _passthrough = passthrough; + } + return self; } - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { - return [[DummyInterceptor alloc] + _lastInterceptor = [[DummyInterceptor alloc] initWithInterceptorManager:interceptorManager - dispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL)]; + dispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) + passthrough:_passthrough]; + return _lastInterceptor; } @end @@ -203,8 +214,10 @@ static dispatch_once_t initDummyInterceptorFactory; [self expectationWithDescription:@"Expect call complete"]; [GRPCFakeTransportFactory sharedInstance].nextTransportInstance = nil; + DummyInterceptorFactory *factory = [[DummyInterceptorFactory alloc] initWithPassthrough:YES]; + DummyInterceptorFactory *factory2 = [[DummyInterceptorFactory alloc] initWithPassthrough:NO]; [[GRPCFakeTransportFactory sharedInstance] - setTransportInterceptorFactories:@[ [DummyInterceptorFactory sharedInstance] ]]; + setTransportInterceptorFactories:@[ factory, factory2 ]]; GRPCRequestOptions *requestOptions = [[GRPCRequestOptions alloc] initWithHost:kRemoteHost path:@"/UnaryCall" @@ -227,6 +240,8 @@ static dispatch_once_t initDummyInterceptorFactory; callOptions:callOptions]; [call start]; [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil]; + XCTAssertTrue(factory.lastInterceptor.hit); + XCTAssertTrue(factory2.lastInterceptor.hit); } @end From 5630b97a6ccb1495707119027996bddf8ccb47c9 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 12 Sep 2019 10:18:59 +0200 Subject: [PATCH 632/661] update docs with grpc-dotnet info --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b3a4c1f17d1..9f91412bc2c 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Libraries in different languages may be in various states of development. We are | Ruby | [src/ruby](src/ruby) | | Python | [src/python](src/python) | | PHP | [src/php](src/php) | -| C# | [src/csharp](src/csharp) | +| C# (core library based) | [src/csharp](src/csharp) | | Objective-C | [src/objective-c](src/objective-c) | | Language | Source repo | @@ -82,4 +82,4 @@ Libraries in different languages may be in various states of development. We are | NodeJS | [grpc-node](https://github.com/grpc/grpc-node) | | WebJS | [grpc-web](https://github.com/grpc/grpc-web) | | Dart | [grpc-dart](https://github.com/grpc/grpc-dart) | - +| .NET (pure C# impl.) | [grpc-dotnet](https://github.com/grpc/grpc-dotnet) | From 275b613681b62e7b14a84d263118c5ef363740bc Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 12 Sep 2019 14:52:06 +0200 Subject: [PATCH 633/661] note on two C# implementations --- src/csharp/README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/csharp/README.md b/src/csharp/README.md index 13c8502af61..26da8d560cc 100644 --- a/src/csharp/README.md +++ b/src/csharp/README.md @@ -2,7 +2,18 @@ gRPC C# ======= -A C# implementation of gRPC. +A C# implementation of gRPC based on the native gRPC Core library. + +There are currently two official implementations of gRPC for C# + +- The original gRPC C# implementation based on the native gRPC Core library (the source code lives in this directory) +- The new "gRPC for .NET" implementation written in pure C# and based on the newly released .NET Core 3 (source code available at https://github.com/grpc/grpc-dotnet) + +The implementations are meant to coexist side-by-side and each has its own advantages in terms of available features, integrations, supported platforms, maturity level and performance. +They share the same API for invoking and handling RPCs, thus limiting the lock-in and enabling users to choose the implementation that satisfies their needs the best +(and perhaps adjust their choice over time without needing to do too much refactoring). + +The following documentation is for the original gRPC C# implementation only (the `Grpc.Core` nuget package). SUPPORTED PLATFORMS ------------------ From a879ff73c29c932a3e864b865341bf75901618c7 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Thu, 12 Sep 2019 16:27:45 -0700 Subject: [PATCH 634/661] Move mock test to use ::grpc_impl Some mock tests are using ::grpc which was causing build issues. Move them over to use ::grpc_impl. --- include/grpcpp/test/mock_stream.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/grpcpp/test/mock_stream.h b/include/grpcpp/test/mock_stream.h index 93963f7dbb7..b4e16159061 100644 --- a/include/grpcpp/test/mock_stream.h +++ b/include/grpcpp/test/mock_stream.h @@ -31,7 +31,7 @@ namespace grpc { namespace testing { template -class MockClientReader : public ClientReaderInterface { +class MockClientReader : public ::grpc_impl::ClientReaderInterface { public: MockClientReader() = default; @@ -47,7 +47,7 @@ class MockClientReader : public ClientReaderInterface { }; template -class MockClientWriter : public ClientWriterInterface { +class MockClientWriter : public ::grpc_impl::ClientWriterInterface { public: MockClientWriter() = default; @@ -62,7 +62,7 @@ class MockClientWriter : public ClientWriterInterface { }; template -class MockClientReaderWriter : public ClientReaderWriterInterface { +class MockClientReaderWriter : public ::grpc_impl::ClientReaderWriterInterface { public: MockClientReaderWriter() = default; @@ -85,7 +85,7 @@ class MockClientReaderWriter : public ClientReaderWriterInterface { template class MockClientAsyncResponseReader - : public ClientAsyncResponseReaderInterface { + : public ::grpc_impl::ClientAsyncResponseReaderInterface { public: MockClientAsyncResponseReader() = default; @@ -107,7 +107,7 @@ class MockClientAsyncReader : public ClientAsyncReaderInterface { }; template -class MockClientAsyncWriter : public ClientAsyncWriterInterface { +class MockClientAsyncWriter : public ::grpc_impl::ClientAsyncWriterInterface { public: MockClientAsyncWriter() = default; From 3e4fd7967c3d07e7cec501c583efc19e246cd312 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Fri, 13 Sep 2019 09:10:59 -0700 Subject: [PATCH 635/661] Formatting fixes --- include/grpcpp/test/mock_stream.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/grpcpp/test/mock_stream.h b/include/grpcpp/test/mock_stream.h index b4e16159061..55e76f6f0a2 100644 --- a/include/grpcpp/test/mock_stream.h +++ b/include/grpcpp/test/mock_stream.h @@ -62,7 +62,8 @@ class MockClientWriter : public ::grpc_impl::ClientWriterInterface { }; template -class MockClientReaderWriter : public ::grpc_impl::ClientReaderWriterInterface { +class MockClientReaderWriter + : public ::grpc_impl::ClientReaderWriterInterface { public: MockClientReaderWriter() = default; @@ -107,7 +108,8 @@ class MockClientAsyncReader : public ClientAsyncReaderInterface { }; template -class MockClientAsyncWriter : public ::grpc_impl::ClientAsyncWriterInterface { +class MockClientAsyncWriter + : public ::grpc_impl::ClientAsyncWriterInterface { public: MockClientAsyncWriter() = default; From ad8d728b0015eba4075aa3abf118920eaa751ad4 Mon Sep 17 00:00:00 2001 From: jiangtaoli2016 Date: Fri, 13 Sep 2019 10:31:22 -0700 Subject: [PATCH 636/661] Root pem certificates update on Sept 2019 --- etc/roots.pem | 100 -------------------------------------------------- 1 file changed, 100 deletions(-) diff --git a/etc/roots.pem b/etc/roots.pem index 22bd2ab88dd..85850b9a78f 100644 --- a/etc/roots.pem +++ b/etc/roots.pem @@ -774,36 +774,6 @@ vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep +OkuE6N36B9K -----END CERTIFICATE----- -# Issuer: CN=Class 2 Primary CA O=Certplus -# Subject: CN=Class 2 Primary CA O=Certplus -# Label: "Certplus Class 2 Primary CA" -# Serial: 177770208045934040241468760488327595043 -# MD5 Fingerprint: 88:2c:8c:52:b8:a2:3c:f3:f7:bb:03:ea:ae:ac:42:0b -# SHA1 Fingerprint: 74:20:74:41:72:9c:dd:92:ec:79:31:d8:23:10:8d:c2:81:92:e2:bb -# SHA256 Fingerprint: 0f:99:3c:8a:ef:97:ba:af:56:87:14:0e:d5:9a:d1:82:1b:b4:af:ac:f0:aa:9a:58:b5:d5:7a:33:8a:3a:fb:cb ------BEGIN CERTIFICATE----- -MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAw -PTELMAkGA1UEBhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFz -cyAyIFByaW1hcnkgQ0EwHhcNOTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9 -MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2VydHBsdXMxGzAZBgNVBAMTEkNsYXNz -IDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANxQ -ltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR5aiR -VhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyL -kcAbmXuZVg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCd -EgETjdyAYveVqUSISnFOYFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yas -H7WLO7dDWWuwJKZtkIvEcupdM5i3y95ee++U8Rs+yskhwcWYAqqi9lt3m/V+llU0 -HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRMECDAGAQH/AgEKMAsGA1Ud -DwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJYIZIAYb4 -QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMu -Y29tL0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/ -AN9WM2K191EBkOvDP9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8 -yfFC82x/xXp8HVGIutIKPidd3i1RTtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMR -FcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+7UCmnYR0ObncHoUW2ikbhiMA -ybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW//1IMwrh3KWB -kJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7 -l7+ijrRU ------END CERTIFICATE----- - # Issuer: CN=DST Root CA X3 O=Digital Signature Trust Co. # Subject: CN=DST Root CA X3 O=Digital Signature Trust Co. # Label: "DST Root CA X3" @@ -1222,36 +1192,6 @@ t0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg== -----END CERTIFICATE----- -# Issuer: CN=Deutsche Telekom Root CA 2 O=Deutsche Telekom AG OU=T-TeleSec Trust Center -# Subject: CN=Deutsche Telekom Root CA 2 O=Deutsche Telekom AG OU=T-TeleSec Trust Center -# Label: "Deutsche Telekom Root CA 2" -# Serial: 38 -# MD5 Fingerprint: 74:01:4a:91:b1:08:c4:58:ce:47:cd:f0:dd:11:53:08 -# SHA1 Fingerprint: 85:a4:08:c0:9c:19:3e:5d:51:58:7d:cd:d6:13:30:fd:8c:de:37:bf -# SHA256 Fingerprint: b6:19:1a:50:d0:c3:97:7f:7d:a9:9b:cd:aa:c8:6a:22:7d:ae:b9:67:9e:c7:0b:a3:b0:c9:d9:22:71:c1:70:d3 ------BEGIN CERTIFICATE----- -MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEc -MBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2Vj -IFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENB -IDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5MjM1OTAwWjBxMQswCQYDVQQGEwJE -RTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxl -U2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290 -IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEU -ha88EOQ5bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhC -QN/Po7qCWWqSG6wcmtoIKyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1Mjwr -rFDa1sPeg5TKqAyZMg4ISFZbavva4VhYAUlfckE8FQYBjl2tqriTtM2e66foai1S -NNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aKSe5TBY8ZTNXeWHmb0moc -QqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTVjlsB9WoH -txa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAP -BgNVHRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOC -AQEAlGRZrTlk5ynrE/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756Abrsp -tJh6sTtU6zkXR34ajgv8HzFZMQSyzhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpa -IzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8rZ7/gFnkm0W09juwzTkZmDLl -6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4Gdyd1Lx+4ivn+ -xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU -Cm26OWMohpLzGITY+9HPBVZkVw== ------END CERTIFICATE----- - # Issuer: CN=Cybertrust Global Root O=Cybertrust, Inc # Subject: CN=Cybertrust Global Root O=Cybertrust, Inc # Label: "Cybertrust Global Root" @@ -3495,46 +3435,6 @@ AAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3CekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ 5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su -----END CERTIFICATE----- -# Issuer: CN=Certinomis - Root CA O=Certinomis OU=0002 433998903 -# Subject: CN=Certinomis - Root CA O=Certinomis OU=0002 433998903 -# Label: "Certinomis - Root CA" -# Serial: 1 -# MD5 Fingerprint: 14:0a:fd:8d:a8:28:b5:38:69:db:56:7e:61:22:03:3f -# SHA1 Fingerprint: 9d:70:bb:01:a5:a4:a0:18:11:2e:f7:1c:01:b9:32:c5:34:e7:88:a8 -# SHA256 Fingerprint: 2a:99:f5:bc:11:74:b7:3c:bb:1d:62:08:84:e0:1c:34:e5:1c:cb:39:78:da:12:5f:0e:33:26:88:83:bf:41:58 ------BEGIN CERTIFICATE----- -MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjET -MBEGA1UEChMKQ2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAb -BgNVBAMTFENlcnRpbm9taXMgLSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMz -MTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMx -FzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRDZXJ0aW5vbWlzIC0g -Um9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQosP5L2 -fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJfl -LieY6pOod5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQV -WZUKxkd8aRi5pwP5ynapz8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDF -TKWrteoB4owuZH9kb/2jJZOLyKIOSY008B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb -5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09xRLWtwHkziOC/7aOgFLSc -CbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE6OXWk6Ri -wsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJ -wx3tFvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SG -m/lg0h9tkQPTYKbVPZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4 -F2iw4lNVYC2vPsKD2NkJK/DAZNuHi5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZng -WVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIB -BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I6tNxIqSSaHh0 -2TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF -AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/ -0KGRHCwPT5iVWVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWw -F6YSjNRieOpWauwK0kDDPAUwPk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZS -g081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAXlCOotQqSD7J6wWAsOMwaplv/8gzj -qh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJy29SWwNyhlCVCNSN -h4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9Iff/ -ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8V -btaw5BngDwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwj -Y/M50n92Uaf0yKHxDHYiI0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ -8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nMcyrDflOR1m749fPH0FFNjkulW+YZFzvW -gQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVrhkIGuUE= ------END CERTIFICATE----- - # Issuer: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed # Subject: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed # Label: "OISTE WISeKey Global Root GB CA" From fac04ffe6e87b78ad910890ff471a667ee2f7a01 Mon Sep 17 00:00:00 2001 From: Rafi Kamal Date: Fri, 13 Sep 2019 12:32:54 -0700 Subject: [PATCH 637/661] Add protobuf_deps to WORKSPACE See https://github.com/grpc/grpc/pull/20224#issuecomment-531355209 --- WORKSPACE | 3 +++ 1 file changed, 3 insertions(+) diff --git a/WORKSPACE b/WORKSPACE index 523b0153d7b..b48e85017ff 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -51,6 +51,9 @@ load("@grpc_python_dependencies//:requirements.bzl", "pip_install") pip_repositories() pip_install() +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +protobuf_deps() + load("@upb//bazel:workspace_deps.bzl", "upb_deps") upb_deps() From 7c85e29076898776dc1d76c602e0584476956f71 Mon Sep 17 00:00:00 2001 From: Rafi Kamal Date: Fri, 13 Sep 2019 14:03:05 -0700 Subject: [PATCH 638/661] Add protobuf_deps to python_test_repo WORKSPACE --- bazel/test/python_test_repo/WORKSPACE | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bazel/test/python_test_repo/WORKSPACE b/bazel/test/python_test_repo/WORKSPACE index f8a00c88283..10d2a87ef07 100644 --- a/bazel/test/python_test_repo/WORKSPACE +++ b/bazel/test/python_test_repo/WORKSPACE @@ -6,6 +6,9 @@ local_repository( load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") grpc_deps() +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +protobuf_deps() + # TODO(https://github.com/grpc/grpc/issues/19835): Remove. load("@upb//bazel:workspace_deps.bzl", "upb_deps") upb_deps() From f3fdd259c184462b22de5575aba8b065a2dc8733 Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Sun, 15 Sep 2019 15:12:45 +0800 Subject: [PATCH 639/661] Fix: fix the wrong word and delete line number description --- examples/python/data_transmission/README.cn.md | 16 ++++++++-------- examples/python/data_transmission/README.en.md | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/python/data_transmission/README.cn.md b/examples/python/data_transmission/README.cn.md index 812a8bbb7d6..aba773f2844 100644 --- a/examples/python/data_transmission/README.cn.md +++ b/examples/python/data_transmission/README.cn.md @@ -6,31 +6,31 @@ 在一次调用中, 客户端只能向服务器传输一次请求数据, 服务器也只能返回一次响应 - `client.py - line:14 - simple_method` + `client.py : simple_method` - `server.py - line:17 - SimpleMethod` + `server.py : SimpleMethod` - #### 客户端流模式 在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应 - `clien.py - line:27 - client_streaming_method ` + `client.py : client_streaming_method ` - `server.py - line:28 - ClientStreamingMethod` + `server.py : ClientStreamingMethod` - #### 服务端流模式 在一次调用中, 客户端只能向服务器传输一次请求数据, 但是服务器可以多次返回响应 - `clien.py - line:48 - server_streaming_method` + `client.py : server_streaming_method` - `server.py - line:41 - ServerStreamingMethod` + `server.py : ServerStreamingMethod` - #### 双向流模式 在一次调用中, 客户端和服务器都可以向对方多次收发数据 - `client.py - line:63 - bidirectional_streaming_method` + `client.py : bidirectional_streaming_method` - `server.py - line:59 - BidirectionalStreamingMethod` + `server.py : BidirectionalStreamingMethod` diff --git a/examples/python/data_transmission/README.en.md b/examples/python/data_transmission/README.en.md index 659ee1b93fb..6258e40e960 100644 --- a/examples/python/data_transmission/README.en.md +++ b/examples/python/data_transmission/README.en.md @@ -6,32 +6,32 @@ Four ways of data transmission when gRPC is used in Python. [Offical Guide]( Date: Sun, 15 Sep 2019 10:50:42 -0700 Subject: [PATCH 640/661] Remove -DGTM_USING_XCTEST It is not longer being used in GTMGoogleTestRunner, so no need to define it. --- third_party/objective_c/google_toolbox_for_mac/BUILD | 3 --- 1 file changed, 3 deletions(-) diff --git a/third_party/objective_c/google_toolbox_for_mac/BUILD b/third_party/objective_c/google_toolbox_for_mac/BUILD index dc505f30fc3..9fc517c45eb 100644 --- a/third_party/objective_c/google_toolbox_for_mac/BUILD +++ b/third_party/objective_c/google_toolbox_for_mac/BUILD @@ -21,9 +21,6 @@ native.objc_library( srcs = [ "UnitTesting/GTMGoogleTestRunner.mm", ], - copts = [ - "-DGTM_USING_XCTEST", - ], deps = [ "//external:gtest", ], From c5662bba808569eba9a2b47312a357cb35887b5c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 16 Sep 2019 13:16:33 +0200 Subject: [PATCH 641/661] use bazel 0.29.0 on windows --- tools/internal_ci/windows/bazel_rbe.bat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/internal_ci/windows/bazel_rbe.bat b/tools/internal_ci/windows/bazel_rbe.bat index 86dcc74c429..827952791c9 100644 --- a/tools/internal_ci/windows/bazel_rbe.bat +++ b/tools/internal_ci/windows/bazel_rbe.bat @@ -14,7 +14,8 @@ @rem TODO(jtattermusch): make this generate less output @rem TODO(jtattermusch): use tools/bazel script to keep the versions in sync -choco install bazel -y --version 0.29.1 --limit-output +@rem TODO(jtattermusch): https://github.com/bazelbuild/bazel/issues/9369 prevents upgrade to 0.29.1 +choco install bazel -y --version 0.29.0 --limit-output cd github/grpc set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH% From e14212b9a5d29ce54f7ad68a66fa2f8c5f05cc12 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 16 Sep 2019 15:26:32 +0200 Subject: [PATCH 642/661] fix windows RBE manual build instructions --- tools/remote_build/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/remote_build/README.md b/tools/remote_build/README.md index 2cd5f03daf1..aa96704f4ca 100644 --- a/tools/remote_build/README.md +++ b/tools/remote_build/README.md @@ -32,7 +32,7 @@ bazel --bazelrc=tools/remote_build/manual.bazelrc test --config=asan //test/... Run on Windows MSVC: ``` # RBE manual run only for c-core (must be run on a Windows host machine) -bazel --bazelrc=tools/remote_build/windows.bazelrc build :all [--credentials_json=(path to service account credentials)] +bazel --bazelrc=tools/remote_build/windows.bazelrc build :all [--google_credentials=(path to service account credentials)] ``` Available command line options can be found in From 4521dea985257deab98f392e420ac73d312201e5 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 16 Sep 2019 15:30:04 +0200 Subject: [PATCH 643/661] try bazel 0.29.1 for windows --- tools/internal_ci/windows/bazel_rbe.bat | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/internal_ci/windows/bazel_rbe.bat b/tools/internal_ci/windows/bazel_rbe.bat index 827952791c9..86dcc74c429 100644 --- a/tools/internal_ci/windows/bazel_rbe.bat +++ b/tools/internal_ci/windows/bazel_rbe.bat @@ -14,8 +14,7 @@ @rem TODO(jtattermusch): make this generate less output @rem TODO(jtattermusch): use tools/bazel script to keep the versions in sync -@rem TODO(jtattermusch): https://github.com/bazelbuild/bazel/issues/9369 prevents upgrade to 0.29.1 -choco install bazel -y --version 0.29.0 --limit-output +choco install bazel -y --version 0.29.1 --limit-output cd github/grpc set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH% From 84f555bfd8aefb1b0e12d14b56949bbfbef78d5f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 16 Sep 2019 16:31:21 +0200 Subject: [PATCH 644/661] simplify and unify manual builds --- tools/remote_build/README.md | 2 +- tools/remote_build/manual.bazelrc | 7 +++---- tools/remote_build/windows.bazelrc | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/remote_build/README.md b/tools/remote_build/README.md index aa96704f4ca..68d68400577 100644 --- a/tools/remote_build/README.md +++ b/tools/remote_build/README.md @@ -32,7 +32,7 @@ bazel --bazelrc=tools/remote_build/manual.bazelrc test --config=asan //test/... Run on Windows MSVC: ``` # RBE manual run only for c-core (must be run on a Windows host machine) -bazel --bazelrc=tools/remote_build/windows.bazelrc build :all [--google_credentials=(path to service account credentials)] +bazel --bazelrc=tools/remote_build/windows.bazelrc build :all ``` Available command line options can be found in diff --git a/tools/remote_build/manual.bazelrc b/tools/remote_build/manual.bazelrc index c3c6af42877..9819a9ffb36 100644 --- a/tools/remote_build/manual.bazelrc +++ b/tools/remote_build/manual.bazelrc @@ -20,11 +20,10 @@ import %workspace%/tools/remote_build/rbe_common.bazelrc build --remote_cache=grpcs://remotebuildexecution.googleapis.com build --remote_executor=grpcs://remotebuildexecution.googleapis.com -# Enable authentication. This will pick up application default credentials by -# default. You can use --auth_credentials=some_file.json to use a service -# account credential instead. +# Enable authentication. Bazel will use application default credentials +# unless overridden by --google_credentials=service_account_credentials.json # How to setup credentials: -# See https://cloud.google.com/remote-build-execution/docs/getting-started#set_credentials +# https://cloud.google.com/remote-build-execution/docs/results-ui/getting-started-results-ui build --auth_enabled=true # Set flags for uploading to BES in order to view results in the Bazel Build diff --git a/tools/remote_build/windows.bazelrc b/tools/remote_build/windows.bazelrc index 825d6765de9..e9b418f9837 100644 --- a/tools/remote_build/windows.bazelrc +++ b/tools/remote_build/windows.bazelrc @@ -3,6 +3,8 @@ startup --host_jvm_args=-Dbazel.DigestFunction=SHA256 build --remote_cache=grpcs://remotebuildexecution.googleapis.com build --remote_executor=grpcs://remotebuildexecution.googleapis.com +build --auth_enabled=true + build --host_crosstool_top=//third_party/toolchains/bazel_0.26.0_rbe_windows:toolchain build --crosstool_top=//third_party/toolchains/bazel_0.26.0_rbe_windows:toolchain build --extra_toolchains=//third_party/toolchains/bazel_0.26.0_rbe_windows:cc-toolchain-x64_windows From 35e2760ffa441442eb53e3695cab06f91cd21409 Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Tue, 13 Aug 2019 14:47:06 -0400 Subject: [PATCH 645/661] Add a fast path to allocate slices in the resource quota. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, we are always scheduling a callback to run the allocation. Instead, this patch adds a fastpath so that TCP can read the socket inline, instead of waiting for the exec context to flush. BM_StreamingPingPong/64/2 [polls/iter:12 ] 65.3µs ± 0% 64.7µs ± 1% -0.92% (p=0.032 n=4+5) BM_StreamingPingPong/0/2 [polls/iter:12.0002 ] 61.4µs ± 4% 57.3µs ±13% -6.66% (p=0.030 n=5+7) BM_StreamingPingPong/1/2 [polls/iter:12.0002 ] 61.7µs ± 1% 60.8µs ± 1% -1.49% (p=0.003 n=9+4) BM_StreamingPingPong/32768/2 [polls/iter:12.0002 ] 114µs ± 2% 112µs ± 0% -2.09% (p=0.030 n=10+2) BM_StreamingPingPong/1/2 [polls/iter:12.0002 ] 62.9µs ± 0% 62.0µs ± 1% -1.32% (p=0.001 n=7+6) BM_StreamingPingPong/64/2 [polls/iter:12.0002 ] 66.5µs ± 3% 64.4µs ± 1% -3.20% (p=0.016 n=5+4) BM_StreamingPingPong/512/2 [polls/iter:12 ] 66.1µs ± 1% 65.2µs ± 1% -1.30% (p=0.003 n=8+5) BM_StreamingPingPong/4096/2 [polls/iter:12 ] 72.1µs ± 4% 70.8µs ± 1% -1.92% (p=0.004 n=9+5) BM_StreamingPingPong/0/2 [polls/iter:12.0001 ] 60.4µs ± 1% 59.4µs ± 0% -1.55% (p=0.004 n=6+5) BM_StreamingPingPong/8/2 [polls/iter:12 ] 63.6µs ± 1% 62.2µs ± 1% -2.13% (p=0.001 n=7+6) BM_StreamingPingPongMsgs/4096 [polls/iter:4.00008 ] 20.9µs ± 1% 19.8µs ±13% -5.30% (p=0.029 n=4+4) BM_StreamingPingPong/0/1 [polls/iter:8.00014 ] 44.4µs ± 1% 41.9µs ±13% -5.51% (p=0.010 n=6+4) BM_StreamingPingPong/8/2 [polls/iter:12.0001 ] 62.1µs ± 0% 61.1µs ± 1% -1.56% (p=0.036 n=3+5) BM_StreamingPingPong/64/2 [polls/iter:12.0002 ] 64.0µs ± 0% 63.3µs ± 0% -1.14% (p=0.004 n=5+6) BM_StreamingPingPong/1/2 [polls/iter:12 ] 62.0µs ± 1% 61.0µs ± 1% -1.61% (p=0.032 n=4+5) BM_StreamingPingPong/0/2 [polls/iter:12.0002 ] 62.4µs ± 4% 60.6µs ± 1% -2.82% (p=0.003 n=7+5) BM_StreamingPingPongMsgs/512 [polls/iter:4.00009 ] 17.9µs ± 1% 16.5µs ±11% -7.40% (p=0.032 n=4+5) BM_StreamingPingPong/4096/1 [polls/iter:8.00016 ] 50.2µs ± 0% 49.5µs ± 1% -1.46% (p=0.024 n=3+6) BM_StreamingPingPong/512/2 [polls/iter:12.0002 ] 65.5µs ± 3% 61.9µs ±13% -5.59% (p=0.048 n=5+7) BM_UnaryPingPong/0/0 [polls/iter:3.00009 ] 23.4µs ± 2% 23.0µs ± 0% -1.88% (p=0.036 n=3+5) BM_UnaryPingPong/512/0 [polls/iter:3.0001 ] 25.6µs ± 2% 25.0µs ± 0% -2.44% (p=0.017 n=7+3) BM_UnaryPingPong/262144/0 [polls/iter:3.00022 ] 164µs ± 2% 161µs ± 1% -1.83% (p=0.048 n=3+6) --- src/core/lib/iomgr/endpoint_cfstream.cc | 8 ++-- src/core/lib/iomgr/resource_quota.cc | 62 ++++++++++++++----------- src/core/lib/iomgr/resource_quota.h | 22 +++++---- src/core/lib/iomgr/tcp_custom.cc | 8 ++-- src/core/lib/iomgr/tcp_posix.cc | 19 ++++---- test/core/iomgr/resource_quota_test.cc | 62 ++++++++++++------------- 6 files changed, 100 insertions(+), 81 deletions(-) diff --git a/src/core/lib/iomgr/endpoint_cfstream.cc b/src/core/lib/iomgr/endpoint_cfstream.cc index 6de22972dbf..c3af2ffa4cb 100644 --- a/src/core/lib/iomgr/endpoint_cfstream.cc +++ b/src/core/lib/iomgr/endpoint_cfstream.cc @@ -261,10 +261,12 @@ static void CFStreamRead(grpc_endpoint* ep, grpc_slice_buffer* slices, ep_impl->read_cb = cb; ep_impl->read_slices = slices; grpc_slice_buffer_reset_and_unref_internal(slices); - grpc_resource_user_alloc_slices(&ep_impl->slice_allocator, - GRPC_TCP_DEFAULT_READ_SLICE_SIZE, 1, - ep_impl->read_slices); EP_REF(ep_impl, "read"); + if (grpc_resource_user_alloc_slices(&ep_impl->slice_allocator, + GRPC_TCP_DEFAULT_READ_SLICE_SIZE, 1, + ep_impl->read_slices)) { + ep_impl->stream_sync->NotifyOnRead(&ep_impl->read_action); + } } static void CFStreamWrite(grpc_endpoint* ep, grpc_slice_buffer* slices, diff --git a/src/core/lib/iomgr/resource_quota.cc b/src/core/lib/iomgr/resource_quota.cc index dffac348c52..d29655e532d 100644 --- a/src/core/lib/iomgr/resource_quota.cc +++ b/src/core/lib/iomgr/resource_quota.cc @@ -583,16 +583,19 @@ static void ru_destroy(void* ru, grpc_error* error) { gpr_free(resource_user); } +static void ru_alloc_slices( + grpc_resource_user_slice_allocator* slice_allocator) { + for (size_t i = 0; i < slice_allocator->count; i++) { + grpc_slice_buffer_add_indexed( + slice_allocator->dest, ru_slice_create(slice_allocator->resource_user, + slice_allocator->length)); + } +} + static void ru_allocated_slices(void* arg, grpc_error* error) { grpc_resource_user_slice_allocator* slice_allocator = static_cast(arg); - if (error == GRPC_ERROR_NONE) { - for (size_t i = 0; i < slice_allocator->count; i++) { - grpc_slice_buffer_add_indexed( - slice_allocator->dest, ru_slice_create(slice_allocator->resource_user, - slice_allocator->length)); - } - } + if (error == GRPC_ERROR_NONE) ru_alloc_slices(slice_allocator); GRPC_CLOSURE_RUN(&slice_allocator->on_done, GRPC_ERROR_REF(error)); } @@ -880,7 +883,7 @@ void grpc_resource_user_free_threads(grpc_resource_user* resource_user, gpr_mu_unlock(&resource_user->resource_quota->thread_count_mu); } -static void resource_user_alloc_locked(grpc_resource_user* resource_user, +static bool resource_user_alloc_locked(grpc_resource_user* resource_user, size_t size, grpc_closure* optional_on_done) { ru_ref_by(resource_user, static_cast(size)); @@ -890,19 +893,18 @@ static void resource_user_alloc_locked(grpc_resource_user* resource_user, resource_user->resource_quota->name, resource_user->name, size, resource_user->free_pool); } - if (resource_user->free_pool < 0) { - if (optional_on_done != nullptr) { - resource_user->outstanding_allocations += static_cast(size); - grpc_closure_list_append(&resource_user->on_allocated, optional_on_done, - GRPC_ERROR_NONE); - } - if (!resource_user->allocating) { - resource_user->allocating = true; - GRPC_CLOSURE_SCHED(&resource_user->allocate_closure, GRPC_ERROR_NONE); - } - } else { - GRPC_CLOSURE_SCHED(optional_on_done, GRPC_ERROR_NONE); + if (GPR_LIKELY(resource_user->free_pool >= 0)) return true; + // Slow path: We need to wait for the free pool to refill. + if (optional_on_done != nullptr) { + resource_user->outstanding_allocations += static_cast(size); + grpc_closure_list_append(&resource_user->on_allocated, optional_on_done, + GRPC_ERROR_NONE); + } + if (!resource_user->allocating) { + resource_user->allocating = true; + GRPC_CLOSURE_SCHED(&resource_user->allocate_closure, GRPC_ERROR_NONE); } + return false; } bool grpc_resource_user_safe_alloc(grpc_resource_user* resource_user, @@ -926,15 +928,17 @@ bool grpc_resource_user_safe_alloc(grpc_resource_user* resource_user, return true; } -void grpc_resource_user_alloc(grpc_resource_user* resource_user, size_t size, +bool grpc_resource_user_alloc(grpc_resource_user* resource_user, size_t size, grpc_closure* optional_on_done) { // TODO(juanlishen): Maybe return immediately if shutting down. Deferring this // because some tests become flaky after the change. gpr_mu_lock(&resource_user->mu); grpc_resource_quota* resource_quota = resource_user->resource_quota; gpr_atm_no_barrier_fetch_add(&resource_quota->used, size); - resource_user_alloc_locked(resource_user, size, optional_on_done); + const bool ret = + resource_user_alloc_locked(resource_user, size, optional_on_done); gpr_mu_unlock(&resource_user->mu); + return ret; } void grpc_resource_user_free(grpc_resource_user* resource_user, size_t size) { @@ -989,18 +993,22 @@ void grpc_resource_user_slice_allocator_init( slice_allocator->resource_user = resource_user; } -void grpc_resource_user_alloc_slices( +bool grpc_resource_user_alloc_slices( grpc_resource_user_slice_allocator* slice_allocator, size_t length, size_t count, grpc_slice_buffer* dest) { - if (gpr_atm_no_barrier_load(&slice_allocator->resource_user->shutdown)) { + if (GPR_UNLIKELY( + gpr_atm_no_barrier_load(&slice_allocator->resource_user->shutdown))) { GRPC_CLOSURE_SCHED( &slice_allocator->on_allocated, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resource user shutdown")); - return; + return false; } slice_allocator->length = length; slice_allocator->count = count; slice_allocator->dest = dest; - grpc_resource_user_alloc(slice_allocator->resource_user, count * length, - &slice_allocator->on_allocated); + const bool ret = + grpc_resource_user_alloc(slice_allocator->resource_user, count * length, + &slice_allocator->on_allocated); + if (ret) ru_alloc_slices(slice_allocator); + return ret; } diff --git a/src/core/lib/iomgr/resource_quota.h b/src/core/lib/iomgr/resource_quota.h index 1c79b52e3fa..7845609590d 100644 --- a/src/core/lib/iomgr/resource_quota.h +++ b/src/core/lib/iomgr/resource_quota.h @@ -124,13 +124,15 @@ bool grpc_resource_user_safe_alloc(grpc_resource_user* resource_user, * If optional_on_done is NULL, then allocate immediately. This may push the * quota over-limit, at which point reclamation will kick in. The caller is * always responsible to free the memory eventually. - * If optional_on_done is non-NULL, it will be scheduled without error when the - * allocation has been granted by the quota, and the caller is responsible to - * free the memory eventually. Or it may be scheduled with an error, in which - * case the caller fails to allocate the memory and shouldn't free the memory. + * Returns true if the allocation was successful. Otherwise, if optional_on_done + * is non-NULL, it will be scheduled without error when the allocation has been + * granted by the quota, and the caller is responsible to free the memory + * eventually. Or it may be scheduled with an error, in which case the caller + * fails to allocate the memory and shouldn't free the memory. */ -void grpc_resource_user_alloc(grpc_resource_user* resource_user, size_t size, - grpc_closure* optional_on_done); +bool grpc_resource_user_alloc(grpc_resource_user* resource_user, size_t size, + grpc_closure* optional_on_done) + GRPC_MUST_USE_RESULT; /* Release memory back to the quota */ void grpc_resource_user_free(grpc_resource_user* resource_user, size_t size); /* Post a memory reclaimer to the resource user. Only one benign and one @@ -165,9 +167,11 @@ void grpc_resource_user_slice_allocator_init( grpc_resource_user* resource_user, grpc_iomgr_cb_func cb, void* p); /* Allocate \a count slices of length \a length into \a dest. Only one request - can be outstanding at a time. */ -void grpc_resource_user_alloc_slices( + can be outstanding at a time. + Returns whether the slice was allocated inline in the function. If true, + the callback will not be called. */ +bool grpc_resource_user_alloc_slices( grpc_resource_user_slice_allocator* slice_allocator, size_t length, - size_t count, grpc_slice_buffer* dest); + size_t count, grpc_slice_buffer* dest) GRPC_MUST_USE_RESULT; #endif /* GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H */ diff --git a/src/core/lib/iomgr/tcp_custom.cc b/src/core/lib/iomgr/tcp_custom.cc index 05cdd1ed358..0b1cff401c5 100644 --- a/src/core/lib/iomgr/tcp_custom.cc +++ b/src/core/lib/iomgr/tcp_custom.cc @@ -201,9 +201,11 @@ static void endpoint_read(grpc_endpoint* ep, grpc_slice_buffer* read_slices, tcp->read_slices = read_slices; grpc_slice_buffer_reset_and_unref_internal(read_slices); TCP_REF(tcp, "read"); - grpc_resource_user_alloc_slices(&tcp->slice_allocator, - GRPC_TCP_DEFAULT_READ_SLICE_SIZE, 1, - tcp->read_slices); + if (grpc_resource_user_alloc_slices(&tcp->slice_allocator, + GRPC_TCP_DEFAULT_READ_SLICE_SIZE, 1, + tcp->read_slices)) { + tcp_read_allocation_done(tcp, GRPC_ERROR_NONE); + } } static void custom_write_callback(grpc_custom_socket* socket, diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index b6d1381298a..19d462da416 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -571,7 +571,7 @@ static void tcp_read_allocation_done(void* tcpp, grpc_error* error) { gpr_log(GPR_INFO, "TCP:%p read_allocation_done: %s", tcp, grpc_error_string(error)); } - if (error != GRPC_ERROR_NONE) { + if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) { grpc_slice_buffer_reset_and_unref_internal(tcp->incoming_buffer); grpc_slice_buffer_reset_and_unref_internal(&tcp->last_read_buffer); call_read_cb(tcp, GRPC_ERROR_REF(error)); @@ -589,14 +589,17 @@ static void tcp_continue_read(grpc_tcp* tcp) { if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) { gpr_log(GPR_INFO, "TCP:%p alloc_slices", tcp); } - grpc_resource_user_alloc_slices(&tcp->slice_allocator, target_read_size, 1, - tcp->incoming_buffer); - } else { - if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) { - gpr_log(GPR_INFO, "TCP:%p do_read", tcp); + if (GPR_UNLIKELY(!grpc_resource_user_alloc_slices(&tcp->slice_allocator, + target_read_size, 1, + tcp->incoming_buffer))) { + // Wait for allocation. + return; } - tcp_do_read(tcp); } + if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) { + gpr_log(GPR_INFO, "TCP:%p do_read", tcp); + } + tcp_do_read(tcp); } static void tcp_handle_read(void* arg /* grpc_tcp */, grpc_error* error) { @@ -605,7 +608,7 @@ static void tcp_handle_read(void* arg /* grpc_tcp */, grpc_error* error) { gpr_log(GPR_INFO, "TCP:%p got_read: %s", tcp, grpc_error_string(error)); } - if (error != GRPC_ERROR_NONE) { + if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) { grpc_slice_buffer_reset_and_unref_internal(tcp->incoming_buffer); grpc_slice_buffer_reset_and_unref_internal(&tcp->last_read_buffer); call_read_cb(tcp, GRPC_ERROR_REF(error)); diff --git a/test/core/iomgr/resource_quota_test.cc b/test/core/iomgr/resource_quota_test.cc index 4cbc016d587..54aaea524fa 100644 --- a/test/core/iomgr/resource_quota_test.cc +++ b/test/core/iomgr/resource_quota_test.cc @@ -119,7 +119,7 @@ static void test_instant_alloc_then_free(void) { grpc_resource_user* usr = grpc_resource_user_create(q, "usr"); { grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, nullptr); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, nullptr)); } { grpc_core::ExecCtx exec_ctx; @@ -137,7 +137,7 @@ static void test_instant_alloc_free_pair(void) { grpc_resource_user* usr = grpc_resource_user_create(q, "usr"); { grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, nullptr); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, nullptr)); grpc_resource_user_free(usr, 1024); } grpc_resource_quota_unref(q); @@ -154,7 +154,7 @@ static void test_simple_async_alloc(void) { gpr_event ev; gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != nullptr); @@ -163,6 +163,12 @@ static void test_simple_async_alloc(void) { grpc_core::ExecCtx exec_ctx; grpc_resource_user_free(usr, 1024); } + { + // Now the allocation should be inline. + GPR_ASSERT(grpc_resource_user_alloc(usr, 1024, nullptr)); + grpc_core::ExecCtx exec_ctx; + grpc_resource_user_free(usr, 1024); + } grpc_resource_quota_unref(q); destroy_user(usr); } @@ -177,7 +183,7 @@ static void test_async_alloc_blocked_by_size(void) { gpr_event_init(&ev); { grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait( &ev, grpc_timeout_milliseconds_to_deadline(100)) == nullptr); @@ -185,7 +191,6 @@ static void test_async_alloc_blocked_by_size(void) { grpc_resource_quota_resize(q, 1024); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != nullptr); - ; { grpc_core::ExecCtx exec_ctx; grpc_resource_user_free(usr, 1024); @@ -204,11 +209,10 @@ static void test_scavenge(void) { gpr_event ev; gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr1, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr1, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != nullptr); - ; } { grpc_core::ExecCtx exec_ctx; @@ -218,11 +222,10 @@ static void test_scavenge(void) { gpr_event ev; gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr2, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr2, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != nullptr); - ; } { grpc_core::ExecCtx exec_ctx; @@ -243,16 +246,15 @@ static void test_scavenge_blocked(void) { { gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr1, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr1, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != nullptr); - ; } { gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr2, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr2, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait( &ev, grpc_timeout_milliseconds_to_deadline(100)) == nullptr); @@ -263,7 +265,6 @@ static void test_scavenge_blocked(void) { grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != nullptr); - ; } { grpc_core::ExecCtx exec_ctx; @@ -284,11 +285,10 @@ static void test_blocked_until_scheduled_reclaim(void) { gpr_event ev; gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != nullptr); - ; } gpr_event reclaim_done; gpr_event_init(&reclaim_done); @@ -301,7 +301,7 @@ static void test_blocked_until_scheduled_reclaim(void) { gpr_event ev; gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&reclaim_done, grpc_timeout_seconds_to_deadline(5)) != nullptr); @@ -328,7 +328,7 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) { gpr_event ev; gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr1, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr1, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != nullptr); @@ -345,7 +345,7 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) { gpr_event ev; gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr2, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr2, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&reclaim_done, grpc_timeout_seconds_to_deadline(5)) != nullptr); @@ -372,7 +372,7 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) { gpr_event ev; gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != nullptr); @@ -389,7 +389,7 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) { gpr_event ev; gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&reclaim_done, grpc_timeout_seconds_to_deadline(5)) != nullptr); @@ -451,7 +451,7 @@ static void test_benign_reclaim_is_preferred(void) { gpr_event ev; gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != nullptr); @@ -475,7 +475,7 @@ static void test_benign_reclaim_is_preferred(void) { gpr_event ev; gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&benign_done, grpc_timeout_seconds_to_deadline(5)) != nullptr); @@ -511,7 +511,7 @@ static void test_multiple_reclaims_can_be_triggered(void) { gpr_event ev; gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != nullptr); @@ -535,7 +535,7 @@ static void test_multiple_reclaims_can_be_triggered(void) { gpr_event ev; gpr_event_init(&ev); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, set_event(&ev)); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, set_event(&ev))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&benign_done, grpc_timeout_seconds_to_deadline(5)) != nullptr); @@ -566,7 +566,7 @@ static void test_resource_user_stays_allocated_until_memory_released(void) { grpc_resource_user* usr = grpc_resource_user_create(q, "usr"); { grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, nullptr); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, nullptr)); } { grpc_core::ExecCtx exec_ctx; @@ -607,7 +607,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released( gpr_event allocated; gpr_event_init(&allocated); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, set_event(&allocated)); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, set_event(&allocated))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&allocated, grpc_timeout_seconds_to_deadline( 5)) != nullptr); @@ -645,7 +645,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) { gpr_event allocated; gpr_event_init(&allocated); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, set_event(&allocated)); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, set_event(&allocated))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&allocated, grpc_timeout_seconds_to_deadline(5)) != nullptr); @@ -666,7 +666,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) { gpr_event allocated; gpr_event_init(&allocated); grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc(usr, 1024, set_event(&allocated)); + GPR_ASSERT(!grpc_resource_user_alloc(usr, 1024, set_event(&allocated))); grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&allocated, grpc_timeout_seconds_to_deadline( 5)) != nullptr); @@ -701,7 +701,7 @@ static void test_one_slice(void) { { const int start_allocs = num_allocs; grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer); + GPR_ASSERT(!grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer)); grpc_core::ExecCtx::Get()->Flush(); assert_counter_becomes(&num_allocs, start_allocs + 1); } @@ -733,7 +733,7 @@ static void test_one_slice_deleted_late(void) { { const int start_allocs = num_allocs; grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer); + GPR_ASSERT(!grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer)); grpc_core::ExecCtx::Get()->Flush(); assert_counter_becomes(&num_allocs, start_allocs + 1); } @@ -775,7 +775,7 @@ static void test_negative_rq_free_pool(void) { { const int start_allocs = num_allocs; grpc_core::ExecCtx exec_ctx; - grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer); + GPR_ASSERT(!grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer)); grpc_core::ExecCtx::Get()->Flush(); assert_counter_becomes(&num_allocs, start_allocs + 1); } From dd6e6e3ef7876fad718acea7b11c4ee60da25ca6 Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Mon, 16 Sep 2019 14:52:46 -0400 Subject: [PATCH 646/661] Introduce GRPC_ARG_TSI_MAX_FRAME_SIZE channel arg. Introduce GRPC_ARG_TSI_MAX_FRAME_SIZE so that users can use larger than 14KiB frame size if they need to. --- include/grpc/impl/codegen/grpc_types.h | 8 ++++ .../lib/http/httpcli_security_connector.cc | 16 +++++--- .../alts/alts_security_connector.cc | 8 ++-- .../fake/fake_security_connector.cc | 10 +++-- .../local/local_security_connector.cc | 8 ++-- .../security_connector/security_connector.cc | 1 + .../security_connector/security_connector.h | 22 +++++++---- .../ssl/ssl_security_connector.cc | 10 +++-- .../tls/spiffe_security_connector.cc | 8 ++-- .../tls/spiffe_security_connector.h | 6 ++- .../security/transport/security_handshaker.cc | 38 +++++++++++++------ .../security/transport/security_handshaker.h | 6 ++- .../frame_protector/alts_frame_protector.cc | 2 +- 13 files changed, 94 insertions(+), 49 deletions(-) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 8108b853fca..3bedf219dc0 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -267,6 +267,14 @@ typedef struct { grpc_ssl_session_cache*). (use grpc_ssl_session_cache_arg_vtable() to fetch an appropriate pointer arg vtable) */ #define GRPC_SSL_SESSION_CACHE_ARG "grpc.ssl_session_cache" +/** If non-zero, it will determine the maximum frame size used by TSI's frame + * protector. + * + * NOTE: Be aware that using a large "max_frame_size" is memory inefficient + * for non-zerocopy protectors. Also, increasing this value above 1MiB + * can break old binaries that don't support larger than 1MiB frame + * size. */ +#define GRPC_ARG_TSI_MAX_FRAME_SIZE "grpc.tsi.max_frame_size" /** Maximum metadata size, in bytes. Note this limit applies to the max sum of all metadata key-value entries in a batch of headers. */ #define GRPC_ARG_MAX_METADATA_SIZE "grpc.max_metadata_size" diff --git a/src/core/lib/http/httpcli_security_connector.cc b/src/core/lib/http/httpcli_security_connector.cc index 8196019f098..e6750621c2e 100644 --- a/src/core/lib/http/httpcli_security_connector.cc +++ b/src/core/lib/http/httpcli_security_connector.cc @@ -41,7 +41,7 @@ class grpc_httpcli_ssl_channel_security_connector final : public grpc_channel_security_connector { public: - explicit grpc_httpcli_ssl_channel_security_connector(char* secure_peer_name) + grpc_httpcli_ssl_channel_security_connector(char* secure_peer_name) : grpc_channel_security_connector( /*url_scheme=*/nullptr, /*channel_creds=*/nullptr, @@ -66,7 +66,8 @@ class grpc_httpcli_ssl_channel_security_connector final &options, &handshaker_factory_); } - void add_handshakers(grpc_pollset_set* interested_parties, + void add_handshakers(const grpc_channel_args* args, + grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_mgr) override { tsi_handshaker* handshaker = nullptr; if (handshaker_factory_ != nullptr) { @@ -77,7 +78,8 @@ class grpc_httpcli_ssl_channel_security_connector final tsi_result_to_string(result)); } } - handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(handshaker, this)); + handshake_mgr->Add( + grpc_core::SecurityHandshakerCreate(handshaker, this, args)); } tsi_ssl_client_handshaker_factory* handshaker_factory() const { @@ -132,7 +134,7 @@ class grpc_httpcli_ssl_channel_security_connector final static grpc_core::RefCountedPtr httpcli_ssl_channel_security_connector_create( const char* pem_root_certs, const tsi_ssl_root_certs_store* root_store, - const char* secure_peer_name) { + const char* secure_peer_name, grpc_channel_args* channel_args) { if (secure_peer_name != nullptr && pem_root_certs == nullptr) { gpr_log(GPR_ERROR, "Cannot assert a secure peer name without a trust root."); @@ -192,8 +194,10 @@ static void ssl_handshake(void* arg, grpc_endpoint* tcp, const char* host, c->func = on_done; c->arg = arg; grpc_core::RefCountedPtr sc = - httpcli_ssl_channel_security_connector_create(pem_root_certs, root_store, - host); + httpcli_ssl_channel_security_connector_create( + pem_root_certs, root_store, host, + static_cast(arg)->args); + GPR_ASSERT(sc != nullptr); grpc_arg channel_arg = grpc_security_connector_to_arg(sc.get()); grpc_channel_args args = {1, &channel_arg}; diff --git a/src/core/lib/security/security_connector/alts/alts_security_connector.cc b/src/core/lib/security/security_connector/alts/alts_security_connector.cc index 79908601130..c309958fe5b 100644 --- a/src/core/lib/security/security_connector/alts/alts_security_connector.cc +++ b/src/core/lib/security/security_connector/alts/alts_security_connector.cc @@ -81,7 +81,7 @@ class grpc_alts_channel_security_connector final ~grpc_alts_channel_security_connector() override { gpr_free(target_name_); } void add_handshakers( - grpc_pollset_set* interested_parties, + const grpc_channel_args* args, grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_manager) override { tsi_handshaker* handshaker = nullptr; const grpc_alts_credentials* creds = @@ -91,7 +91,7 @@ class grpc_alts_channel_security_connector final interested_parties, &handshaker) == TSI_OK); handshake_manager->Add( - grpc_core::SecurityHandshakerCreate(handshaker, this)); + grpc_core::SecurityHandshakerCreate(handshaker, this, args)); } void check_peer(tsi_peer peer, grpc_endpoint* ep, @@ -142,7 +142,7 @@ class grpc_alts_server_security_connector final ~grpc_alts_server_security_connector() override = default; void add_handshakers( - grpc_pollset_set* interested_parties, + const grpc_channel_args* args, grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_manager) override { tsi_handshaker* handshaker = nullptr; const grpc_alts_server_credentials* creds = @@ -151,7 +151,7 @@ class grpc_alts_server_security_connector final creds->options(), nullptr, creds->handshaker_service_url(), false, interested_parties, &handshaker) == TSI_OK); handshake_manager->Add( - grpc_core::SecurityHandshakerCreate(handshaker, this)); + grpc_core::SecurityHandshakerCreate(handshaker, this, args)); } void check_peer(tsi_peer peer, grpc_endpoint* ep, diff --git a/src/core/lib/security/security_connector/fake/fake_security_connector.cc b/src/core/lib/security/security_connector/fake/fake_security_connector.cc index 940c2ac5ee5..6a010740dff 100644 --- a/src/core/lib/security/security_connector/fake/fake_security_connector.cc +++ b/src/core/lib/security/security_connector/fake/fake_security_connector.cc @@ -96,10 +96,11 @@ class grpc_fake_channel_security_connector final return GPR_ICMP(is_lb_channel_, other->is_lb_channel_); } - void add_handshakers(grpc_pollset_set* interested_parties, + void add_handshakers(const grpc_channel_args* args, + grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_mgr) override { handshake_mgr->Add(grpc_core::SecurityHandshakerCreate( - tsi_create_fake_handshaker(/*is_client=*/true), this)); + tsi_create_fake_handshaker(/*is_client=*/true), this, args)); } bool check_call_host(grpc_core::StringView host, @@ -271,10 +272,11 @@ class grpc_fake_server_security_connector fake_check_peer(this, peer, auth_context, on_peer_checked); } - void add_handshakers(grpc_pollset_set* interested_parties, + void add_handshakers(const grpc_channel_args* args, + grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_mgr) override { handshake_mgr->Add(grpc_core::SecurityHandshakerCreate( - tsi_create_fake_handshaker(/*=is_client*/ false), this)); + tsi_create_fake_handshaker(/*=is_client*/ false), this, args)); } int cmp(const grpc_security_connector* other) const override { diff --git a/src/core/lib/security/security_connector/local/local_security_connector.cc b/src/core/lib/security/security_connector/local/local_security_connector.cc index 5b777009d34..0af8e0764d9 100644 --- a/src/core/lib/security/security_connector/local/local_security_connector.cc +++ b/src/core/lib/security/security_connector/local/local_security_connector.cc @@ -129,13 +129,13 @@ class grpc_local_channel_security_connector final ~grpc_local_channel_security_connector() override { gpr_free(target_name_); } void add_handshakers( - grpc_pollset_set* interested_parties, + const grpc_channel_args* args, grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_manager) override { tsi_handshaker* handshaker = nullptr; GPR_ASSERT(local_tsi_handshaker_create(true /* is_client */, &handshaker) == TSI_OK); handshake_manager->Add( - grpc_core::SecurityHandshakerCreate(handshaker, this)); + grpc_core::SecurityHandshakerCreate(handshaker, this, args)); } int cmp(const grpc_security_connector* other_sc) const override { @@ -187,13 +187,13 @@ class grpc_local_server_security_connector final ~grpc_local_server_security_connector() override = default; void add_handshakers( - grpc_pollset_set* interested_parties, + const grpc_channel_args* args, grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_manager) override { tsi_handshaker* handshaker = nullptr; GPR_ASSERT(local_tsi_handshaker_create(false /* is_client */, &handshaker) == TSI_OK); handshake_manager->Add( - grpc_core::SecurityHandshakerCreate(handshaker, this)); + grpc_core::SecurityHandshakerCreate(handshaker, this, args)); } void check_peer(tsi_peer peer, grpc_endpoint* ep, diff --git a/src/core/lib/security/security_connector/security_connector.cc b/src/core/lib/security/security_connector/security_connector.cc index 2c7c982e719..3d9b077b633 100644 --- a/src/core/lib/security/security_connector/security_connector.cc +++ b/src/core/lib/security/security_connector/security_connector.cc @@ -53,6 +53,7 @@ grpc_channel_security_connector::grpc_channel_security_connector( : grpc_security_connector(url_scheme), channel_creds_(std::move(channel_creds)), request_metadata_creds_(std::move(request_metadata_creds)) {} + grpc_channel_security_connector::~grpc_channel_security_connector() {} int grpc_security_connector_cmp(const grpc_security_connector* sc, diff --git a/src/core/lib/security/security_connector/security_connector.h b/src/core/lib/security/security_connector/security_connector.h index e5ced44638b..2e573d65dfe 100644 --- a/src/core/lib/security/security_connector/security_connector.h +++ b/src/core/lib/security/security_connector/security_connector.h @@ -91,7 +91,9 @@ class grpc_channel_security_connector : public grpc_security_connector { grpc_channel_security_connector( const char* url_scheme, grpc_core::RefCountedPtr channel_creds, - grpc_core::RefCountedPtr request_metadata_creds); + grpc_core::RefCountedPtr request_metadata_creds + /*, + grpc_channel_args* channel_args = nullptr*/); ~grpc_channel_security_connector() override; /// Checks that the host that will be set for a call is acceptable. @@ -108,9 +110,9 @@ class grpc_channel_security_connector : public grpc_security_connector { virtual void cancel_check_call_host(grpc_closure* on_call_host_checked, grpc_error* error) GRPC_ABSTRACT; /// Registers handshakers with \a handshake_mgr. - virtual void add_handshakers(grpc_pollset_set* interested_parties, - grpc_core::HandshakeManager* handshake_mgr) - GRPC_ABSTRACT; + virtual void add_handshakers( + const grpc_channel_args* args, grpc_pollset_set* interested_parties, + grpc_core::HandshakeManager* handshake_mgr) GRPC_ABSTRACT; const grpc_channel_credentials* channel_creds() const { return channel_creds_.get(); @@ -132,9 +134,15 @@ class grpc_channel_security_connector : public grpc_security_connector { int channel_security_connector_cmp( const grpc_channel_security_connector* other) const; + // grpc_channel_args* channel_args() const { return channel_args_.get(); } + //// Should be called as soon as the channel args are not needed to reduce + //// memory usage. + // void clear_channel_arg() { channel_args_.reset(); } + private: grpc_core::RefCountedPtr channel_creds_; grpc_core::RefCountedPtr request_metadata_creds_; + grpc_core::UniquePtr channel_args_; }; /* --- server_security_connector object. --- @@ -149,9 +157,9 @@ class grpc_server_security_connector : public grpc_security_connector { grpc_core::RefCountedPtr server_creds); ~grpc_server_security_connector() override = default; - virtual void add_handshakers(grpc_pollset_set* interested_parties, - grpc_core::HandshakeManager* handshake_mgr) - GRPC_ABSTRACT; + virtual void add_handshakers( + const grpc_channel_args* args, grpc_pollset_set* interested_parties, + grpc_core::HandshakeManager* handshake_mgr) GRPC_ABSTRACT; const grpc_server_credentials* server_creds() const { return server_creds_.get(); diff --git a/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc b/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc index 97c04cafce4..0318e0aeb62 100644 --- a/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +++ b/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc @@ -116,7 +116,8 @@ class grpc_ssl_channel_security_connector final return GRPC_SECURITY_OK; } - void add_handshakers(grpc_pollset_set* interested_parties, + void add_handshakers(const grpc_channel_args* args, + grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_mgr) override { // Instantiate TSI handshaker. tsi_handshaker* tsi_hs = nullptr; @@ -131,7 +132,7 @@ class grpc_ssl_channel_security_connector final return; } // Create handshakers. - handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(tsi_hs, this)); + handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(tsi_hs, this, args)); } void check_peer(tsi_peer peer, grpc_endpoint* ep, @@ -278,7 +279,8 @@ class grpc_ssl_server_security_connector return GRPC_SECURITY_OK; } - void add_handshakers(grpc_pollset_set* interested_parties, + void add_handshakers(const grpc_channel_args* args, + grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_mgr) override { // Instantiate TSI handshaker. try_fetch_ssl_server_credentials(); @@ -291,7 +293,7 @@ class grpc_ssl_server_security_connector return; } // Create handshakers. - handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(tsi_hs, this)); + handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(tsi_hs, this, args)); } void check_peer(tsi_peer peer, grpc_endpoint* ep, diff --git a/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc b/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc index be20b60645b..bac32c08813 100644 --- a/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +++ b/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc @@ -138,7 +138,7 @@ SpiffeChannelSecurityConnector::~SpiffeChannelSecurityConnector() { } void SpiffeChannelSecurityConnector::add_handshakers( - grpc_pollset_set* interested_parties, + const grpc_channel_args* args, grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_mgr) { if (RefreshHandshakerFactory() != GRPC_SECURITY_OK) { gpr_log(GPR_ERROR, "Handshaker factory refresh failed."); @@ -157,7 +157,7 @@ void SpiffeChannelSecurityConnector::add_handshakers( return; } // Create handshakers. - handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(tsi_hs, this)); + handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(tsi_hs, this, args)); } void SpiffeChannelSecurityConnector::check_peer( @@ -412,7 +412,7 @@ SpiffeServerSecurityConnector::~SpiffeServerSecurityConnector() { } void SpiffeServerSecurityConnector::add_handshakers( - grpc_pollset_set* interested_parties, + const grpc_channel_args* args, grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_mgr) { /* Refresh handshaker factory if needed. */ if (RefreshHandshakerFactory() != GRPC_SECURITY_OK) { @@ -428,7 +428,7 @@ void SpiffeServerSecurityConnector::add_handshakers( tsi_result_to_string(result)); return; } - handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(tsi_hs, this)); + handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(tsi_hs, this, args)); } void SpiffeServerSecurityConnector::check_peer( diff --git a/src/core/lib/security/security_connector/tls/spiffe_security_connector.h b/src/core/lib/security/security_connector/tls/spiffe_security_connector.h index 3739b463159..8de2bfcd3a4 100644 --- a/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +++ b/src/core/lib/security/security_connector/tls/spiffe_security_connector.h @@ -47,7 +47,8 @@ class SpiffeChannelSecurityConnector final const char* target_name, const char* overridden_target_name); ~SpiffeChannelSecurityConnector() override; - void add_handshakers(grpc_pollset_set* interested_parties, + void add_handshakers(const grpc_channel_args* args, + grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_mgr) override; void check_peer(tsi_peer peer, grpc_endpoint* ep, @@ -117,7 +118,8 @@ class SpiffeServerSecurityConnector final grpc_core::RefCountedPtr server_creds); ~SpiffeServerSecurityConnector() override; - void add_handshakers(grpc_pollset_set* interested_parties, + void add_handshakers(const grpc_channel_args* args, + grpc_pollset_set* interested_parties, grpc_core::HandshakeManager* handshake_mgr) override; void check_peer(tsi_peer peer, grpc_endpoint* ep, diff --git a/src/core/lib/security/transport/security_handshaker.cc b/src/core/lib/security/transport/security_handshaker.cc index 3ad04774837..1d0b5ec0c6e 100644 --- a/src/core/lib/security/transport/security_handshaker.cc +++ b/src/core/lib/security/transport/security_handshaker.cc @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -46,7 +47,8 @@ namespace { class SecurityHandshaker : public Handshaker { public: SecurityHandshaker(tsi_handshaker* handshaker, - grpc_security_connector* connector); + grpc_security_connector* connector, + const grpc_channel_args* args); ~SecurityHandshaker() override; void Shutdown(grpc_error* why) override; void DoHandshake(grpc_tcp_server_acceptor* acceptor, @@ -97,15 +99,23 @@ class SecurityHandshaker : public Handshaker { grpc_closure on_peer_checked_; RefCountedPtr auth_context_; tsi_handshaker_result* handshaker_result_ = nullptr; + size_t max_frame_size_ = 0; }; SecurityHandshaker::SecurityHandshaker(tsi_handshaker* handshaker, - grpc_security_connector* connector) + grpc_security_connector* connector, + const grpc_channel_args* args) : handshaker_(handshaker), connector_(connector->Ref(DEBUG_LOCATION, "handshake")), handshake_buffer_size_(GRPC_INITIAL_HANDSHAKE_BUFFER_SIZE), handshake_buffer_( static_cast(gpr_malloc(handshake_buffer_size_))) { + const grpc_arg* arg = + grpc_channel_args_find(args, GRPC_ARG_TSI_MAX_FRAME_SIZE); + if (arg != nullptr && arg->type == GRPC_ARG_INTEGER) { + max_frame_size_ = grpc_channel_arg_get_integer( + arg, {0, 0, std::numeric_limits::max()}); + } gpr_mu_init(&mu_); grpc_slice_buffer_init(&outgoing_); GRPC_CLOSURE_INIT(&on_handshake_data_sent_to_peer_, @@ -201,7 +211,8 @@ void SecurityHandshaker::OnPeerCheckedInner(grpc_error* error) { // Create zero-copy frame protector, if implemented. tsi_zero_copy_grpc_protector* zero_copy_protector = nullptr; tsi_result result = tsi_handshaker_result_create_zero_copy_grpc_protector( - handshaker_result_, nullptr, &zero_copy_protector); + handshaker_result_, max_frame_size_ == 0 ? nullptr : &max_frame_size_, + &zero_copy_protector); if (result != TSI_OK && result != TSI_UNIMPLEMENTED) { error = grpc_set_tsi_error_result( GRPC_ERROR_CREATE_FROM_STATIC_STRING( @@ -213,8 +224,9 @@ void SecurityHandshaker::OnPeerCheckedInner(grpc_error* error) { // Create frame protector if zero-copy frame protector is NULL. tsi_frame_protector* protector = nullptr; if (zero_copy_protector == nullptr) { - result = tsi_handshaker_result_create_frame_protector(handshaker_result_, - nullptr, &protector); + result = tsi_handshaker_result_create_frame_protector( + handshaker_result_, max_frame_size_ == 0 ? nullptr : &max_frame_size_, + &protector); if (result != TSI_OK) { error = grpc_set_tsi_error_result(GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Frame protector creation failed"), @@ -459,7 +471,8 @@ class ClientSecurityHandshakerFactory : public HandshakerFactory { reinterpret_cast( grpc_security_connector_find_in_args(args)); if (security_connector) { - security_connector->add_handshakers(interested_parties, handshake_mgr); + security_connector->add_handshakers(args, interested_parties, + handshake_mgr); } } ~ClientSecurityHandshakerFactory() override = default; @@ -474,7 +487,8 @@ class ServerSecurityHandshakerFactory : public HandshakerFactory { reinterpret_cast( grpc_security_connector_find_in_args(args)); if (security_connector) { - security_connector->add_handshakers(interested_parties, handshake_mgr); + security_connector->add_handshakers(args, interested_parties, + handshake_mgr); } } ~ServerSecurityHandshakerFactory() override = default; @@ -487,13 +501,14 @@ class ServerSecurityHandshakerFactory : public HandshakerFactory { // RefCountedPtr SecurityHandshakerCreate( - tsi_handshaker* handshaker, grpc_security_connector* connector) { + tsi_handshaker* handshaker, grpc_security_connector* connector, + const grpc_channel_args* args) { // If no TSI handshaker was created, return a handshaker that always fails. // Otherwise, return a real security handshaker. if (handshaker == nullptr) { return MakeRefCounted(); } else { - return MakeRefCounted(handshaker, connector); + return MakeRefCounted(handshaker, connector, args); } } @@ -509,6 +524,7 @@ void SecurityRegisterHandshakerFactories() { } // namespace grpc_core grpc_handshaker* grpc_security_handshaker_create( - tsi_handshaker* handshaker, grpc_security_connector* connector) { - return SecurityHandshakerCreate(handshaker, connector).release(); + tsi_handshaker* handshaker, grpc_security_connector* connector, + const grpc_channel_args* args) { + return SecurityHandshakerCreate(handshaker, connector, args).release(); } diff --git a/src/core/lib/security/transport/security_handshaker.h b/src/core/lib/security/transport/security_handshaker.h index 263fe555967..a9e1fe83d45 100644 --- a/src/core/lib/security/transport/security_handshaker.h +++ b/src/core/lib/security/transport/security_handshaker.h @@ -28,7 +28,8 @@ namespace grpc_core { /// Creates a security handshaker using \a handshaker. RefCountedPtr SecurityHandshakerCreate( - tsi_handshaker* handshaker, grpc_security_connector* connector); + tsi_handshaker* handshaker, grpc_security_connector* connector, + const grpc_channel_args* args); /// Registers security handshaker factories. void SecurityRegisterHandshakerFactories(); @@ -38,6 +39,7 @@ void SecurityRegisterHandshakerFactories(); // TODO(arjunroy): This is transitional to account for the new handshaker API // and will eventually be removed entirely. grpc_handshaker* grpc_security_handshaker_create( - tsi_handshaker* handshaker, grpc_security_connector* connector); + tsi_handshaker* handshaker, grpc_security_connector* connector, + const grpc_channel_args* args); #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_HANDSHAKER_H */ diff --git a/src/core/tsi/alts/frame_protector/alts_frame_protector.cc b/src/core/tsi/alts/frame_protector/alts_frame_protector.cc index bfa0b7a720f..b1c6c6155fe 100644 --- a/src/core/tsi/alts/frame_protector/alts_frame_protector.cc +++ b/src/core/tsi/alts/frame_protector/alts_frame_protector.cc @@ -34,7 +34,7 @@ constexpr size_t kMinFrameLength = 1024; constexpr size_t kDefaultFrameLength = 16 * 1024; -constexpr size_t kMaxFrameLength = 1024 * 1024; +constexpr size_t kMaxFrameLength = 16 * 1024 * 1024; // Limit k on number of frames such that at most 2^(8 * k) frames can be sent. constexpr size_t kAltsRecordProtocolRekeyFrameLimit = 8; From 9b9764cb2a42492f2e598a211cad05b1645d8337 Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Mon, 16 Sep 2019 15:10:02 -0400 Subject: [PATCH 647/661] Fix build error in SSL fuzzer. --- test/core/security/ssl_server_fuzzer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core/security/ssl_server_fuzzer.cc b/test/core/security/ssl_server_fuzzer.cc index 5846964eb90..74343c21098 100644 --- a/test/core/security/ssl_server_fuzzer.cc +++ b/test/core/security/ssl_server_fuzzer.cc @@ -91,7 +91,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { state.done_callback_called = false; auto handshake_mgr = grpc_core::MakeRefCounted(); - sc->add_handshakers(nullptr, handshake_mgr.get()); + sc->add_handshakers(nullptr, nullptr, handshake_mgr.get()); handshake_mgr->DoHandshake(mock_endpoint, nullptr /* channel_args */, deadline, nullptr /* acceptor */, on_handshake_done, &state); From 7be5d098cf381f366dd7534c22db89aba2f024f3 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 16 Sep 2019 13:42:12 -0700 Subject: [PATCH 648/661] Tune xds test --- test/cpp/end2end/BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index 9153439341f..3ddd6d68c93 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -486,6 +486,7 @@ grpc_cc_test( grpc_cc_test( name = "xds_end2end_test", + timeout = "long", srcs = ["xds_end2end_test.cc"], external_deps = [ "gtest", From f1914fba0002ffbda56eec13b562eebcde084fc3 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Mon, 16 Sep 2019 16:11:00 -0700 Subject: [PATCH 649/661] Renaming remaining filter functions --- src/core/lib/channel/connected_channel.cc | 40 +++++++++++------------ src/core/lib/surface/server.cc | 24 +++++++------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/core/lib/channel/connected_channel.cc b/src/core/lib/channel/connected_channel.cc index bd30c3663a2..c9c64b8cb33 100644 --- a/src/core/lib/channel/connected_channel.cc +++ b/src/core/lib/channel/connected_channel.cc @@ -97,7 +97,7 @@ static callback_state* get_state_for_batch( /* Intercept a call operation and either push it directly up or translate it into transport stream operations */ -static void con_start_transport_stream_op_batch( +static void connected_channel_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* batch) { call_data* calld = static_cast(elem->call_data); channel_data* chand = static_cast(elem->channel_data); @@ -137,15 +137,15 @@ static void con_start_transport_stream_op_batch( GRPC_CALL_COMBINER_STOP(calld->call_combiner, "passed batch to transport"); } -static void con_start_transport_op(grpc_channel_element* elem, - grpc_transport_op* op) { +static void connected_channel_start_transport_op(grpc_channel_element* elem, + grpc_transport_op* op) { channel_data* chand = static_cast(elem->channel_data); grpc_transport_perform_op(chand->transport, op); } /* Constructor for call_data */ -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* connected_channel_init_call_elem( + grpc_call_element* elem, const grpc_call_element_args* args) { call_data* calld = static_cast(elem->call_data); channel_data* chand = static_cast(elem->channel_data); calld->call_combiner = args->call_combiner; @@ -166,9 +166,9 @@ static void set_pollset_or_pollset_set(grpc_call_element* elem, } /* Destructor for call_data */ -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* then_schedule_closure) { +static void connected_channel_destroy_call_elem( + grpc_call_element* elem, const grpc_call_final_info* final_info, + grpc_closure* then_schedule_closure) { call_data* calld = static_cast(elem->call_data); channel_data* chand = static_cast(elem->channel_data); grpc_transport_destroy_stream(chand->transport, @@ -177,8 +177,8 @@ static void destroy_call_elem(grpc_call_element* elem, } /* Constructor for channel_data */ -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* connected_channel_init_channel_elem( + grpc_channel_element* elem, grpc_channel_element_args* args) { channel_data* cd = static_cast(elem->channel_data); GPR_ASSERT(args->is_last); cd->transport = nullptr; @@ -186,7 +186,7 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel_data */ -static void destroy_channel_elem(grpc_channel_element* elem) { +static void connected_channel_destroy_channel_elem(grpc_channel_element* elem) { channel_data* cd = static_cast(elem->channel_data); if (cd->transport) { grpc_transport_destroy(cd->transport); @@ -194,20 +194,20 @@ static void destroy_channel_elem(grpc_channel_element* elem) { } /* No-op. */ -static void con_get_channel_info(grpc_channel_element* elem, - const grpc_channel_info* channel_info) {} +static void connected_channel_get_channel_info( + grpc_channel_element* elem, const grpc_channel_info* channel_info) {} const grpc_channel_filter grpc_connected_filter = { - con_start_transport_stream_op_batch, - con_start_transport_op, + connected_channel_start_transport_stream_op_batch, + connected_channel_start_transport_op, sizeof(call_data), - init_call_elem, + connected_channel_init_call_elem, set_pollset_or_pollset_set, - destroy_call_elem, + connected_channel_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - con_get_channel_info, + connected_channel_init_channel_elem, + connected_channel_destroy_channel_elem, + connected_channel_get_channel_info, "connected", }; diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index 2cc7e88cab4..d50dd1d8235 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -905,25 +905,25 @@ static void channel_connectivity_changed(void* cd, grpc_error* error) { } } -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* server_init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { channel_data* chand = static_cast(elem->channel_data); server_ref(chand->server); new (elem->call_data) call_data(elem, *args); return GRPC_ERROR_NONE; } -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void server_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = static_cast(elem->call_data); calld->~call_data(); channel_data* chand = static_cast(elem->channel_data); server_unref(chand->server); } -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* server_init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { channel_data* chand = static_cast(elem->channel_data); GPR_ASSERT(args->is_first); GPR_ASSERT(!args->is_last); @@ -938,7 +938,7 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, return GRPC_ERROR_NONE; } -static void destroy_channel_elem(grpc_channel_element* elem) { +static void server_destroy_channel_elem(grpc_channel_element* elem) { size_t i; channel_data* chand = static_cast(elem->channel_data); if (chand->registered_methods) { @@ -970,12 +970,12 @@ const grpc_channel_filter grpc_server_top_filter = { server_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + server_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + server_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + server_init_channel_elem, + server_destroy_channel_elem, grpc_channel_next_get_info, "server", }; From d06ccebb1eff7a35c326c7dbed68344074be7c6a Mon Sep 17 00:00:00 2001 From: kerbalwzy Date: Tue, 17 Sep 2019 09:37:56 +0800 Subject: [PATCH 650/661] Fix: remove the space on the left of colons --- examples/python/data_transmission/README.cn.md | 16 ++++++++-------- examples/python/data_transmission/README.en.md | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/python/data_transmission/README.cn.md b/examples/python/data_transmission/README.cn.md index aba773f2844..ecffa5d3877 100644 --- a/examples/python/data_transmission/README.cn.md +++ b/examples/python/data_transmission/README.cn.md @@ -6,31 +6,31 @@ 在一次调用中, 客户端只能向服务器传输一次请求数据, 服务器也只能返回一次响应 - `client.py : simple_method` + `client.py: simple_method` - `server.py : SimpleMethod` + `server.py: SimpleMethod` - #### 客户端流模式 在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应 - `client.py : client_streaming_method ` + `client.py: client_streaming_method ` - `server.py : ClientStreamingMethod` + `server.py: ClientStreamingMethod` - #### 服务端流模式 在一次调用中, 客户端只能向服务器传输一次请求数据, 但是服务器可以多次返回响应 - `client.py : server_streaming_method` + `client.py: server_streaming_method` - `server.py : ServerStreamingMethod` + `server.py: ServerStreamingMethod` - #### 双向流模式 在一次调用中, 客户端和服务器都可以向对方多次收发数据 - `client.py : bidirectional_streaming_method` + `client.py: bidirectional_streaming_method` - `server.py : BidirectionalStreamingMethod` + `server.py: BidirectionalStreamingMethod` diff --git a/examples/python/data_transmission/README.en.md b/examples/python/data_transmission/README.en.md index 6258e40e960..d9639290549 100644 --- a/examples/python/data_transmission/README.en.md +++ b/examples/python/data_transmission/README.en.md @@ -6,32 +6,32 @@ Four ways of data transmission when gRPC is used in Python. [Offical Guide]( Date: Tue, 17 Sep 2019 06:52:58 +0000 Subject: [PATCH 651/661] Fix use after free --- .../dns/c_ares/grpc_ares_ev_driver_windows.cc | 58 +++++++++++++++---- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc index addae23dc3e..4d05c05bef5 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc @@ -88,7 +88,7 @@ class WSAErrorContext { * from c-ares and are used with the grpc windows poller, and it, e.g., * manufactures virtual socket error codes when it e.g. needs to tell the c-ares * library to wait for an async read. */ -class GrpcPolledFdWindows : public GrpcPolledFd { +class GrpcPolledFdWindows { public: enum WriteState { WRITE_IDLE, @@ -146,7 +146,7 @@ class GrpcPolledFdWindows : public GrpcPolledFd { write_closure_ = nullptr; } - void RegisterForOnReadableLocked(grpc_closure* read_closure) override { + void RegisterForOnReadableLocked(grpc_closure* read_closure) { GPR_ASSERT(read_closure_ == nullptr); read_closure_ = read_closure; GPR_ASSERT(GRPC_SLICE_LENGTH(read_buf_) == 0); @@ -206,7 +206,7 @@ class GrpcPolledFdWindows : public GrpcPolledFd { grpc_socket_notify_on_read(winsocket_, &outer_read_closure_); } - void RegisterForOnWriteableLocked(grpc_closure* write_closure) override { + void RegisterForOnWriteableLocked(grpc_closure* write_closure) { if (socket_type_ == SOCK_DGRAM) { GRPC_CARES_TRACE_LOG("fd:|%s| RegisterForOnWriteableLocked called", GetName()); @@ -272,19 +272,17 @@ class GrpcPolledFdWindows : public GrpcPolledFd { } } - bool IsFdStillReadableLocked() override { - return GRPC_SLICE_LENGTH(read_buf_) > 0; - } + bool IsFdStillReadableLocked() { return GRPC_SLICE_LENGTH(read_buf_) > 0; } - void ShutdownLocked(grpc_error* error) override { + void ShutdownLocked(grpc_error* error) { grpc_winsocket_shutdown(winsocket_); } - ares_socket_t GetWrappedAresSocketLocked() override { + ares_socket_t GetWrappedAresSocketLocked() { return grpc_winsocket_wrapped_socket(winsocket_); } - const char* GetName() override { return name_; } + const char* GetName() { return name_; } ares_ssize_t RecvFrom(WSAErrorContext* wsa_error_ctx, void* data, ares_socket_t data_len, int flags, @@ -816,14 +814,16 @@ class SockToPolledFdMap { SockToPolledFdMap* map = static_cast(user_data); GrpcPolledFdWindows* polled_fd = map->LookupPolledFd(s); map->RemoveEntry(s); + GRPC_CARES_TRACE_LOG("CloseSocket called for socket: %s", + polled_fd->GetName()); // If a gRPC polled fd has not made it in to the driver's list yet, then // the driver has not and will never see this socket. if (!polled_fd->gotten_into_driver_list()) { polled_fd->ShutdownLocked(GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Shut down c-ares fd before without it ever having made it into the " "driver's list")); - return 0; } + grpc_core::Delete(polled_fd); return 0; } @@ -840,6 +840,42 @@ const struct ares_socket_functions custom_ares_sock_funcs = { &SockToPolledFdMap::SendV /* sendv */, }; +/* A thin wrapper over a GrpcPolledFdWindows object but with a shorter + lifetime. This object releases it's GrpcPolledFdWindows upon destruction, + so that c-ares can close it via usual socket teardown. */ +class GrpcPolledFdWindowsWrapper : public GrpcPolledFd { + public: + GrpcPolledFdWindowsWrapper(GrpcPolledFdWindows* wrapped) + : wrapped_(wrapped) {} + + ~GrpcPolledFdWindowsWrapper() {} + + void RegisterForOnReadableLocked(grpc_closure* read_closure) override { + wrapped_->RegisterForOnReadableLocked(read_closure); + } + + void RegisterForOnWriteableLocked(grpc_closure* write_closure) override { + wrapped_->RegisterForOnWriteableLocked(write_closure); + } + + bool IsFdStillReadableLocked() override { + return wrapped_->IsFdStillReadableLocked(); + } + + void ShutdownLocked(grpc_error* error) override { + wrapped_->ShutdownLocked(error); + } + + ares_socket_t GetWrappedAresSocketLocked() override { + return wrapped_->GetWrappedAresSocketLocked(); + } + + const char* GetName() override { return wrapped_->GetName(); } + + private: + GrpcPolledFdWindows* wrapped_; +}; + class GrpcPolledFdFactoryWindows : public GrpcPolledFdFactory { public: GrpcPolledFdFactoryWindows(grpc_combiner* combiner) @@ -852,7 +888,7 @@ class GrpcPolledFdFactoryWindows : public GrpcPolledFdFactory { // Set a flag so that the virtual socket "close" method knows it // doesn't need to call ShutdownLocked, since now the driver will. polled_fd->set_gotten_into_driver_list(); - return polled_fd; + return grpc_core::New(polled_fd); } void ConfigureAresChannelLocked(ares_channel channel) override { From 88cfae00bedc1badeebf9b617bf8d001c60a53fc Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 13 Sep 2019 08:58:50 -0700 Subject: [PATCH 652/661] Build fix for Cocoapods release --- gRPC-Core.podspec | 4 +- gRPC.podspec | 52 +++++++++++++------ .../!ProtoCompiler-gRPCPlugin.podspec | 6 ++- src/objective-c/!ProtoCompiler.podspec | 14 +++-- src/objective-c/BoringSSL-GRPC.podspec | 2 +- templates/gRPC-Core.podspec.template | 4 +- templates/gRPC.podspec.template | 52 +++++++++++++------ ...!ProtoCompiler-gRPCPlugin.podspec.template | 6 ++- .../BoringSSL-GRPC.podspec.template | 2 +- 9 files changed, 99 insertions(+), 43 deletions(-) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 7c2877f6edc..6c664a8e722 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -32,6 +32,7 @@ Pod::Spec.new do |s| s.source = { :git => 'https://github.com/grpc/grpc.git', :tag => "v#{version}", + :submodules => true, } # gRPC podspecs depend on fix for https://github.com/CocoaPods/CocoaPods/issues/6024, @@ -184,10 +185,9 @@ Pod::Spec.new do |s| ss.header_mappings_dir = '.' ss.libraries = 'z' ss.dependency "#{s.name}/Interface", version - ss.dependency 'BoringSSL-GRPC', '0.0.3' + ss.dependency 'BoringSSL-GRPC', '0.0.4' ss.compiler_flags = '-DGRPC_SHADOW_BORINGSSL_SYMBOLS' - # To save you from scrolling, this is the last part of the podspec. ss.source_files = 'src/core/lib/gpr/alloc.h', 'src/core/lib/gpr/arena.h', 'src/core/lib/gpr/env.h', diff --git a/gRPC.podspec b/gRPC.podspec index 1b36c5ed2ea..e104f2f513c 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -32,11 +32,6 @@ Pod::Spec.new do |s| :tag => "v#{version}", } - s.ios.deployment_target = '7.0' - s.osx.deployment_target = '10.9' - s.tvos.deployment_target = '10.0' - s.watchos.deployment_target = '4.0' - name = 'GRPCClient' s.module_name = name s.header_dir = name @@ -49,25 +44,35 @@ Pod::Spec.new do |s| 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.9' + s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' + s.subspec 'Interface-Legacy' do |ss| ss.header_mappings_dir = 'src/objective-c/GRPCClient' - ss.public_header_files = "GRPCClient/GRPCCall+ChannelArg.h", - "GRPCClient/GRPCCall+ChannelCredentials.h", - "GRPCClient/GRPCCall+Cronet.h", - "GRPCClient/GRPCCall+OAuth2.h", - "GRPCClient/GRPCCall+Tests.h", + ss.public_header_files = "src/objective-c/GRPCClient/GRPCCall+ChannelArg.h", + "src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h", + "src/objective-c/GRPCClient/GRPCCall+Cronet.h", + "src/objective-c/GRPCClient/GRPCCall+OAuth2.h", + "src/objective-c/GRPCClient/GRPCCall+Tests.h", "src/objective-c/GRPCClient/GRPCCallLegacy.h", "src/objective-c/GRPCClient/GRPCTypes.h" - ss.source_files = "GRPCClient/GRPCCall+ChannelArg.h", - "GRPCClient/GRPCCall+ChannelCredentials.h", - "GRPCClient/GRPCCall+Cronet.h", - "GRPCClient/GRPCCall+OAuth2.h", - "GRPCClient/GRPCCall+Tests.h", + ss.source_files = "src/objective-c/GRPCClient/GRPCCall+ChannelArg.h", + "src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h", + "src/objective-c/GRPCClient/GRPCCall+Cronet.h", + "src/objective-c/GRPCClient/GRPCCall+OAuth2.h", + "src/objective-c/GRPCClient/GRPCCall+Tests.h", "src/objective-c/GRPCClient/GRPCCallLegacy.h", "src/objective-c/GRPCClient/GRPCTypes.h" ss.dependency "gRPC-RxLibrary/Interface", version + + ss.ios.deployment_target = '7.0' + ss.osx.deployment_target = '10.9' + ss.tvos.deployment_target = '10.0' + ss.watchos.deployment_target = '4.0' end s.subspec 'Interface' do |ss| @@ -98,6 +103,11 @@ Pod::Spec.new do |s| 'src/objective-c/GRPCClient/version.h' ss.dependency "#{s.name}/Interface-Legacy", version + + ss.ios.deployment_target = '7.0' + ss.osx.deployment_target = '10.9' + ss.tvos.deployment_target = '10.0' + ss.watchos.deployment_target = '4.0' end s.subspec 'GRPCCore' do |ss| @@ -131,6 +141,11 @@ Pod::Spec.new do |s| ss.dependency "#{s.name}/Interface", version ss.dependency 'gRPC-Core', version ss.dependency 'gRPC-RxLibrary', version + + ss.ios.deployment_target = '7.0' + ss.osx.deployment_target = '10.9' + ss.tvos.deployment_target = '10.0' + ss.watchos.deployment_target = '4.0' end s.subspec 'GRPCCoreCronet' do |ss| @@ -142,10 +157,17 @@ Pod::Spec.new do |s| ss.dependency "#{s.name}/GRPCCore", version ss.dependency 'gRPC-Core/Cronet-Implementation', version ss.dependency 'CronetFramework' + + ss.ios.deployment_target = '8.0' end # CFStream is now default. Leaving this subspec only for compatibility purpose. s.subspec 'CFStream' do |ss| ss.dependency "#{s.name}/GRPCCore", version + + ss.ios.deployment_target = '7.0' + ss.osx.deployment_target = '10.9' + ss.tvos.deployment_target = '10.0' + ss.watchos.deployment_target = '4.0' end end diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 30a07f1647d..d38d8ca91ef 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -102,7 +102,7 @@ Pod::Spec.new do |s| s.preserve_paths = plugin # Restrict the protoc version to the one supported by this plugin. - s.dependency '!ProtoCompiler', '3.8.0' + s.dependency '!ProtoCompiler', '3.8.1' # For the Protobuf dependency not to complain: s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' @@ -116,6 +116,8 @@ Pod::Spec.new do |s| # present in this pod's directory. We use that knowledge to check for the existence of the file # and, if absent, compile the plugin from the local sources. s.prepare_command = <<-CMD - #{bazel} build //src/compiler:grpc_objective_c_plugin + if [ ! -f #{plugin} ]; then + #{bazel} build //src/compiler:grpc_objective_c_plugin + fi CMD end diff --git a/src/objective-c/!ProtoCompiler.podspec b/src/objective-c/!ProtoCompiler.podspec index 9d036ac0b5b..3d872c8c9cf 100644 --- a/src/objective-c/!ProtoCompiler.podspec +++ b/src/objective-c/!ProtoCompiler.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler' - v = '3.8.0' + v = '3.8.1' s.version = v s.summary = 'The Protobuf Compiler (protoc) generates Objective-C files from .proto files' s.description = <<-DESC @@ -99,7 +99,10 @@ Pod::Spec.new do |s| repo = 'google/protobuf' file = "protoc-#{v}-osx-x86_64.zip" s.source = { - :http => "https://github.com/#{repo}/releases/download/v#{v}/#{file}", + # TODO (mxyan): Restore the next line upon next minor version update + # :http => "https://github.com/#{repo}/releases/download/v#{v}/#{file}", + :http => "https://github.com/#{repo}/releases/download/v3.8.0/protoc-3.8.0-osx-x86_64.zip", + # TODO(jcanizales): Add sha1 or sha256 # :sha1 => '??', } @@ -123,6 +126,11 @@ Pod::Spec.new do |s| bazel = "#{repo_root}/tools/bazel" s.prepare_command = <<-CMD - #{bazel} build @com_google_protobuf//:protoc + if [ ! -f bin/protoc ]; then + #{bazel} build @com_google_protobuf//:protoc + else + mv bin/protoc . + mv include/google . + fi CMD end diff --git a/src/objective-c/BoringSSL-GRPC.podspec b/src/objective-c/BoringSSL-GRPC.podspec index f0d9750d6d1..78cd20f3958 100644 --- a/src/objective-c/BoringSSL-GRPC.podspec +++ b/src/objective-c/BoringSSL-GRPC.podspec @@ -39,7 +39,7 @@ Pod::Spec.new do |s| s.name = 'BoringSSL-GRPC' - version = '0.0.3' + version = '0.0.4' s.version = version s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google\'s needs.' # Adapted from the homepage: diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 9b77723a854..36b08794b81 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -85,6 +85,7 @@ s.source = { :git => 'https://github.com/grpc/grpc.git', :tag => "v#{version}", + :submodules => true, } # gRPC podspecs depend on fix for https://github.com/CocoaPods/CocoaPods/issues/6024, @@ -171,10 +172,9 @@ ss.header_mappings_dir = '.' ss.libraries = 'z' ss.dependency "#{s.name}/Interface", version - ss.dependency 'BoringSSL-GRPC', '0.0.3' + ss.dependency 'BoringSSL-GRPC', '0.0.4' ss.compiler_flags = '-DGRPC_SHADOW_BORINGSSL_SYMBOLS' - # To save you from scrolling, this is the last part of the podspec. ss.source_files = ${ruby_multiline_list(grpc_private_files(libs), 22)} ss.private_header_files = ${ruby_multiline_list(grpc_private_headers(libs), 30)} diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index e705edc1748..e8afdb14062 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -34,11 +34,6 @@ :tag => "v#{version}", } - s.ios.deployment_target = '7.0' - s.osx.deployment_target = '10.9' - s.tvos.deployment_target = '10.0' - s.watchos.deployment_target = '4.0' - name = 'GRPCClient' s.module_name = name s.header_dir = name @@ -51,25 +46,35 @@ 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.9' + s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '4.0' + s.subspec 'Interface-Legacy' do |ss| ss.header_mappings_dir = 'src/objective-c/GRPCClient' - ss.public_header_files = "GRPCClient/GRPCCall+ChannelArg.h", - "GRPCClient/GRPCCall+ChannelCredentials.h", - "GRPCClient/GRPCCall+Cronet.h", - "GRPCClient/GRPCCall+OAuth2.h", - "GRPCClient/GRPCCall+Tests.h", + ss.public_header_files = "src/objective-c/GRPCClient/GRPCCall+ChannelArg.h", + "src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h", + "src/objective-c/GRPCClient/GRPCCall+Cronet.h", + "src/objective-c/GRPCClient/GRPCCall+OAuth2.h", + "src/objective-c/GRPCClient/GRPCCall+Tests.h", "src/objective-c/GRPCClient/GRPCCallLegacy.h", "src/objective-c/GRPCClient/GRPCTypes.h" - ss.source_files = "GRPCClient/GRPCCall+ChannelArg.h", - "GRPCClient/GRPCCall+ChannelCredentials.h", - "GRPCClient/GRPCCall+Cronet.h", - "GRPCClient/GRPCCall+OAuth2.h", - "GRPCClient/GRPCCall+Tests.h", + ss.source_files = "src/objective-c/GRPCClient/GRPCCall+ChannelArg.h", + "src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h", + "src/objective-c/GRPCClient/GRPCCall+Cronet.h", + "src/objective-c/GRPCClient/GRPCCall+OAuth2.h", + "src/objective-c/GRPCClient/GRPCCall+Tests.h", "src/objective-c/GRPCClient/GRPCCallLegacy.h", "src/objective-c/GRPCClient/GRPCTypes.h" ss.dependency "gRPC-RxLibrary/Interface", version + + ss.ios.deployment_target = '7.0' + ss.osx.deployment_target = '10.9' + ss.tvos.deployment_target = '10.0' + ss.watchos.deployment_target = '4.0' end s.subspec 'Interface' do |ss| @@ -100,6 +105,11 @@ 'src/objective-c/GRPCClient/version.h' ss.dependency "#{s.name}/Interface-Legacy", version + + ss.ios.deployment_target = '7.0' + ss.osx.deployment_target = '10.9' + ss.tvos.deployment_target = '10.0' + ss.watchos.deployment_target = '4.0' end s.subspec 'GRPCCore' do |ss| @@ -133,6 +143,11 @@ ss.dependency "#{s.name}/Interface", version ss.dependency 'gRPC-Core', version ss.dependency 'gRPC-RxLibrary', version + + ss.ios.deployment_target = '7.0' + ss.osx.deployment_target = '10.9' + ss.tvos.deployment_target = '10.0' + ss.watchos.deployment_target = '4.0' end s.subspec 'GRPCCoreCronet' do |ss| @@ -144,10 +159,17 @@ ss.dependency "#{s.name}/GRPCCore", version ss.dependency 'gRPC-Core/Cronet-Implementation', version ss.dependency 'CronetFramework' + + ss.ios.deployment_target = '8.0' end # CFStream is now default. Leaving this subspec only for compatibility purpose. s.subspec 'CFStream' do |ss| ss.dependency "#{s.name}/GRPCCore", version + + ss.ios.deployment_target = '7.0' + ss.osx.deployment_target = '10.9' + ss.tvos.deployment_target = '10.0' + ss.watchos.deployment_target = '4.0' end end diff --git a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template index 6286e3369e2..9dddfa9f06b 100644 --- a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template +++ b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template @@ -104,7 +104,7 @@ s.preserve_paths = plugin # Restrict the protoc version to the one supported by this plugin. - s.dependency '!ProtoCompiler', '3.8.0' + s.dependency '!ProtoCompiler', '3.8.1' # For the Protobuf dependency not to complain: s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' @@ -118,6 +118,8 @@ # present in this pod's directory. We use that knowledge to check for the existence of the file # and, if absent, compile the plugin from the local sources. s.prepare_command = <<-CMD - #{bazel} build //src/compiler:grpc_objective_c_plugin + if [ ! -f #{plugin} ]; then + #{bazel} build //src/compiler:grpc_objective_c_plugin + fi CMD end diff --git a/templates/src/objective-c/BoringSSL-GRPC.podspec.template b/templates/src/objective-c/BoringSSL-GRPC.podspec.template index 3d2736e3307..462283286b6 100644 --- a/templates/src/objective-c/BoringSSL-GRPC.podspec.template +++ b/templates/src/objective-c/BoringSSL-GRPC.podspec.template @@ -44,7 +44,7 @@ Pod::Spec.new do |s| s.name = 'BoringSSL-GRPC' - version = '0.0.3' + version = '0.0.4' s.version = version s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google\'s needs.' # Adapted from the homepage: From 951f3d960388339cd744af16c83a66fb52cf5ef0 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 13 Sep 2019 15:05:26 -0700 Subject: [PATCH 653/661] Temporarily disable watchOS support for !ProtoCompiler-gRPCPlugin --- .../!ProtoCompiler-gRPCPlugin.podspec | 9 +++++-- src/objective-c/!ProtoCompiler.podspec | 7 ++---- ...!ProtoCompiler-gRPCPlugin.podspec.template | 9 +++++-- tools/run_tests/run_tests.py | 24 ++++++++++--------- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index d38d8ca91ef..57230e6329c 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -102,12 +102,17 @@ Pod::Spec.new do |s| s.preserve_paths = plugin # Restrict the protoc version to the one supported by this plugin. - s.dependency '!ProtoCompiler', '3.8.1' + s.dependency '!ProtoCompiler', '3.8.0' # For the Protobuf dependency not to complain: s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' - s.watchos.deployment_target = '4.0' + + # watchOS is disabled due to #20258. + # TODO (mxyan): Enable watchos when !ProtoCompiler.podspec is updated for + # support of watchos in the next release + # s.watchos.deployment_target = '4.0' + # Restrict the gRPC runtime version to the one supported by this plugin. s.dependency 'gRPC-ProtoRPC', v diff --git a/src/objective-c/!ProtoCompiler.podspec b/src/objective-c/!ProtoCompiler.podspec index 3d872c8c9cf..a3e49f64795 100644 --- a/src/objective-c/!ProtoCompiler.podspec +++ b/src/objective-c/!ProtoCompiler.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler' - v = '3.8.1' + v = '3.8.0' s.version = v s.summary = 'The Protobuf Compiler (protoc) generates Objective-C files from .proto files' s.description = <<-DESC @@ -99,10 +99,7 @@ Pod::Spec.new do |s| repo = 'google/protobuf' file = "protoc-#{v}-osx-x86_64.zip" s.source = { - # TODO (mxyan): Restore the next line upon next minor version update - # :http => "https://github.com/#{repo}/releases/download/v#{v}/#{file}", - :http => "https://github.com/#{repo}/releases/download/v3.8.0/protoc-3.8.0-osx-x86_64.zip", - + :http => "https://github.com/#{repo}/releases/download/v#{v}/#{file}", # TODO(jcanizales): Add sha1 or sha256 # :sha1 => '??', } diff --git a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template index 9dddfa9f06b..85a4ab07a87 100644 --- a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template +++ b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template @@ -104,12 +104,17 @@ s.preserve_paths = plugin # Restrict the protoc version to the one supported by this plugin. - s.dependency '!ProtoCompiler', '3.8.1' + s.dependency '!ProtoCompiler', '3.8.0' # For the Protobuf dependency not to complain: s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '10.0' - s.watchos.deployment_target = '4.0' + + # watchOS is disabled due to #20258. + # TODO (mxyan): Enable watchos when !ProtoCompiler.podspec is updated for + # support of watchos in the next release + # s.watchos.deployment_target = '4.0' + # Restrict the gRPC runtime version to the one supported by this plugin. s.dependency 'gRPC-ProtoRPC', v diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index a57efb95fe6..a99eb6cc86e 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1132,17 +1132,19 @@ class ObjCLanguage(object): 'EXAMPLE_PATH': 'src/objective-c/examples/tvOS-sample', 'FRAMEWORKS': 'NO' })) - out.append( - self.config.job_spec( - ['src/objective-c/tests/build_one_example_bazel.sh'], - timeout_seconds=20 * 60, - shortname='ios-buildtest-example-watchOS-sample', - cpu_cost=1e6, - environ={ - 'SCHEME': 'watchOS-sample-WatchKit-App', - 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', - 'FRAMEWORKS': 'NO' - })) + # Disabled due to #20258 + # TODO (mxyan): Reenable this test when #20258 is resolved. + # out.append( + # self.config.job_spec( + # ['src/objective-c/tests/build_one_example_bazel.sh'], + # timeout_seconds=20 * 60, + # shortname='ios-buildtest-example-watchOS-sample', + # cpu_cost=1e6, + # environ={ + # 'SCHEME': 'watchOS-sample-WatchKit-App', + # 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', + # 'FRAMEWORKS': 'NO' + # })) out.append( self.config.job_spec( ['src/objective-c/tests/run_plugin_tests.sh'], From c91da4df860892bd28129738aa02ca3fd73cfc03 Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Tue, 17 Sep 2019 13:57:30 -0700 Subject: [PATCH 654/661] Update the rotation to Esun --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/cleanup_request.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/pull_request_template.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 66d87f4f508..70464ea5a2d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Report a bug about: Create a report to help us improve labels: kind/bug, priority/P2 -assignees: karthikravis +assignees: veblush --- diff --git a/.github/ISSUE_TEMPLATE/cleanup_request.md b/.github/ISSUE_TEMPLATE/cleanup_request.md index ee564f00630..03213ac221e 100644 --- a/.github/ISSUE_TEMPLATE/cleanup_request.md +++ b/.github/ISSUE_TEMPLATE/cleanup_request.md @@ -2,7 +2,7 @@ name: Request a cleanup about: Suggest a cleanup in our repository labels: kind/internal cleanup -assignees: karthikravis +assignees: veblush --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index b6ef503c7c2..1a8058c6d4e 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,7 +2,7 @@ name: Request a feature about: Suggest an idea for this project labels: kind/enhancement -assignees: karthikravis +assignees: veblush --- diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 681d2f819ce..366b68604df 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,4 +8,4 @@ If you know who should review your pull request, please remove the mentioning be --> -@karthikravis +@veblush From 1c56cda52660c609c92a00a674541877bdb1a0e2 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Tue, 17 Sep 2019 14:13:22 -0700 Subject: [PATCH 655/661] Add comment --- .../resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc index 4d05c05bef5..d72c453d748 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc @@ -814,6 +814,9 @@ class SockToPolledFdMap { SockToPolledFdMap* map = static_cast(user_data); GrpcPolledFdWindows* polled_fd = map->LookupPolledFd(s); map->RemoveEntry(s); + // See https://github.com/grpc/grpc/pull/20284, this trace log is + // intentionally placed to attempt to trigger a crash in case of a + // use after free on polled_fd. GRPC_CARES_TRACE_LOG("CloseSocket called for socket: %s", polled_fd->GetName()); // If a gRPC polled fd has not made it in to the driver's list yet, then From 1d1aebb920188618b49ec50745bcb9d3d37199de Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 17 Sep 2019 14:26:49 -0700 Subject: [PATCH 656/661] Remove unused import --- bazel/python_rules.bzl | 1 - 1 file changed, 1 deletion(-) diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl index c2a16d6cce1..483e265bf36 100644 --- a/bazel/python_rules.bzl +++ b/bazel/python_rules.bzl @@ -5,7 +5,6 @@ load( "get_include_protoc_args", "get_plugin_args", "get_proto_root", - "proto_path_to_generated_filename", "protos_from_context", "includes_from_deps", "get_proto_arguments", From 5f2bcfca73d2c027aa189872ff479045ec83e703 Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Wed, 18 Sep 2019 10:44:50 -0400 Subject: [PATCH 657/661] Clarify what callback means. --- src/core/lib/iomgr/resource_quota.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/iomgr/resource_quota.h b/src/core/lib/iomgr/resource_quota.h index 7845609590d..ec89a920201 100644 --- a/src/core/lib/iomgr/resource_quota.h +++ b/src/core/lib/iomgr/resource_quota.h @@ -169,7 +169,7 @@ void grpc_resource_user_slice_allocator_init( /* Allocate \a count slices of length \a length into \a dest. Only one request can be outstanding at a time. Returns whether the slice was allocated inline in the function. If true, - the callback will not be called. */ + the \a slice_allocator->on_allocated callback will not be called. */ bool grpc_resource_user_alloc_slices( grpc_resource_user_slice_allocator* slice_allocator, size_t length, size_t count, grpc_slice_buffer* dest) GRPC_MUST_USE_RESULT; From 40c0519ad0545e1b771edca25563ea43db984af0 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 16 Sep 2019 14:13:02 -0700 Subject: [PATCH 658/661] Move xds protos to testing/ --- CMakeLists.txt | 30 ++--- Makefile | 112 +++++++++--------- build.yaml | 6 +- src/proto/grpc/{lb/v2 => testing/xds}/BUILD | 2 +- .../{lb/v2 => testing/xds}/eds_for_test.proto | 0 .../{lb/v2 => testing/xds}/lrs_for_test.proto | 2 +- .../xds}/orca_load_report_for_test.proto | 0 test/cpp/end2end/BUILD | 6 +- test/cpp/end2end/client_lb_end2end_test.cc | 2 +- test/cpp/end2end/xds_end2end_test.cc | 4 +- 10 files changed, 82 insertions(+), 82 deletions(-) rename src/proto/grpc/{lb/v2 => testing/xds}/BUILD (98%) rename src/proto/grpc/{lb/v2 => testing/xds}/eds_for_test.proto (100%) rename src/proto/grpc/{lb/v2 => testing/xds}/lrs_for_test.proto (99%) rename src/proto/grpc/{lb/v2 => testing/xds}/orca_load_report_for_test.proto (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 599f1441583..3ae86ef43d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12404,17 +12404,17 @@ endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) add_executable(client_lb_end2end_test - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/orca_load_report_for_test.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.h - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/orca_load_report_for_test.grpc.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/xds/orca_load_report_for_test.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/xds/orca_load_report_for_test.grpc.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/xds/orca_load_report_for_test.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/xds/orca_load_report_for_test.grpc.pb.h test/cpp/end2end/client_lb_end2end_test.cc third_party/googletest/googletest/src/gtest-all.cc third_party/googletest/googlemock/src/gmock-all.cc ) protobuf_generate_grpc_cpp( - src/proto/grpc/lb/v2/orca_load_report_for_test.proto + src/proto/grpc/testing/xds/orca_load_report_for_test.proto ) target_include_directories(client_lb_end2end_test @@ -16805,24 +16805,24 @@ endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) add_executable(xds_end2end_test - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/eds_for_test.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/eds_for_test.pb.h - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.h - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/lrs_for_test.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/lrs_for_test.pb.h - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/xds/eds_for_test.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/xds/eds_for_test.grpc.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/xds/eds_for_test.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/xds/eds_for_test.grpc.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/xds/lrs_for_test.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/xds/lrs_for_test.grpc.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/xds/lrs_for_test.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/xds/lrs_for_test.grpc.pb.h test/cpp/end2end/xds_end2end_test.cc third_party/googletest/googletest/src/gtest-all.cc third_party/googletest/googlemock/src/gmock-all.cc ) protobuf_generate_grpc_cpp( - src/proto/grpc/lb/v2/eds_for_test.proto + src/proto/grpc/testing/xds/eds_for_test.proto ) protobuf_generate_grpc_cpp( - src/proto/grpc/lb/v2/lrs_for_test.proto + src/proto/grpc/testing/xds/lrs_for_test.proto ) target_include_directories(xds_end2end_test diff --git a/Makefile b/Makefile index e666a19eb79..4b58a230905 100644 --- a/Makefile +++ b/Makefile @@ -2713,54 +2713,6 @@ $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc: src/proto/grpc/lb/v1/lo $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< endif -ifeq ($(NO_PROTOC),true) -$(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc: protoc_dep_error -$(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.cc: protoc_dep_error -else - -$(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc: src/proto/grpc/lb/v2/eds_for_test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) - $(E) "[PROTOC] Generating protobuf CC file from $<" - $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $< - -$(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.cc: src/proto/grpc/lb/v2/eds_for_test.proto $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc $(PROTOBUF_DEP) $(PROTOC_PLUGINS) - $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" - $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< -endif - -ifeq ($(NO_PROTOC),true) -$(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.pb.cc: protoc_dep_error -$(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.cc: protoc_dep_error -else - -$(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.pb.cc: src/proto/grpc/lb/v2/lrs_for_test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc - $(E) "[PROTOC] Generating protobuf CC file from $<" - $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $< - -$(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.cc: src/proto/grpc/lb/v2/lrs_for_test.proto $(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.pb.cc $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.cc - $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" - $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< -endif - -ifeq ($(NO_PROTOC),true) -$(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.cc: protoc_dep_error -$(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.grpc.pb.cc: protoc_dep_error -else - -$(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.cc: src/proto/grpc/lb/v2/orca_load_report_for_test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) - $(E) "[PROTOC] Generating protobuf CC file from $<" - $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $< - -$(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.grpc.pb.cc: src/proto/grpc/lb/v2/orca_load_report_for_test.proto $(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.cc $(PROTOBUF_DEP) $(PROTOC_PLUGINS) - $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" - $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< -endif - ifeq ($(NO_PROTOC),true) $(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.pb.cc: protoc_dep_error $(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc: protoc_dep_error @@ -3035,6 +2987,54 @@ $(GENDIR)/src/proto/grpc/testing/worker_service.grpc.pb.cc: src/proto/grpc/testi $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< endif +ifeq ($(NO_PROTOC),true) +$(GENDIR)/src/proto/grpc/testing/xds/eds_for_test.pb.cc: protoc_dep_error +$(GENDIR)/src/proto/grpc/testing/xds/eds_for_test.grpc.pb.cc: protoc_dep_error +else + +$(GENDIR)/src/proto/grpc/testing/xds/eds_for_test.pb.cc: src/proto/grpc/testing/xds/eds_for_test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[PROTOC] Generating protobuf CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $< + +$(GENDIR)/src/proto/grpc/testing/xds/eds_for_test.grpc.pb.cc: src/proto/grpc/testing/xds/eds_for_test.proto $(GENDIR)/src/proto/grpc/testing/xds/eds_for_test.pb.cc $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< +endif + +ifeq ($(NO_PROTOC),true) +$(GENDIR)/src/proto/grpc/testing/xds/lrs_for_test.pb.cc: protoc_dep_error +$(GENDIR)/src/proto/grpc/testing/xds/lrs_for_test.grpc.pb.cc: protoc_dep_error +else + +$(GENDIR)/src/proto/grpc/testing/xds/lrs_for_test.pb.cc: src/proto/grpc/testing/xds/lrs_for_test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/xds/eds_for_test.pb.cc + $(E) "[PROTOC] Generating protobuf CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $< + +$(GENDIR)/src/proto/grpc/testing/xds/lrs_for_test.grpc.pb.cc: src/proto/grpc/testing/xds/lrs_for_test.proto $(GENDIR)/src/proto/grpc/testing/xds/lrs_for_test.pb.cc $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/xds/eds_for_test.pb.cc $(GENDIR)/src/proto/grpc/testing/xds/eds_for_test.grpc.pb.cc + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< +endif + +ifeq ($(NO_PROTOC),true) +$(GENDIR)/src/proto/grpc/testing/xds/orca_load_report_for_test.pb.cc: protoc_dep_error +$(GENDIR)/src/proto/grpc/testing/xds/orca_load_report_for_test.grpc.pb.cc: protoc_dep_error +else + +$(GENDIR)/src/proto/grpc/testing/xds/orca_load_report_for_test.pb.cc: src/proto/grpc/testing/xds/orca_load_report_for_test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[PROTOC] Generating protobuf CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $< + +$(GENDIR)/src/proto/grpc/testing/xds/orca_load_report_for_test.grpc.pb.cc: src/proto/grpc/testing/xds/orca_load_report_for_test.proto $(GENDIR)/src/proto/grpc/testing/xds/orca_load_report_for_test.pb.cc $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< +endif + ifeq ($(CONFIG),stapprof) src/core/profiling/stap_timers.c: $(GENDIR)/src/core/profiling/stap_probes.h @@ -15765,7 +15765,7 @@ endif CLIENT_LB_END2END_TEST_SRC = \ - $(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.grpc.pb.cc \ + $(GENDIR)/src/proto/grpc/testing/xds/orca_load_report_for_test.pb.cc $(GENDIR)/src/proto/grpc/testing/xds/orca_load_report_for_test.grpc.pb.cc \ test/cpp/end2end/client_lb_end2end_test.cc \ CLIENT_LB_END2END_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CLIENT_LB_END2END_TEST_SRC)))) @@ -15797,7 +15797,7 @@ endif endif -$(OBJDIR)/$(CONFIG)/src/proto/grpc/lb/v2/orca_load_report_for_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/xds/orca_load_report_for_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/cpp/end2end/client_lb_end2end_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -15808,7 +15808,7 @@ ifneq ($(NO_DEPS),true) -include $(CLIENT_LB_END2END_TEST_OBJS:.o=.dep) endif endif -$(OBJDIR)/$(CONFIG)/test/cpp/end2end/client_lb_end2end_test.o: $(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/orca_load_report_for_test.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/end2end/client_lb_end2end_test.o: $(GENDIR)/src/proto/grpc/testing/xds/orca_load_report_for_test.pb.cc $(GENDIR)/src/proto/grpc/testing/xds/orca_load_report_for_test.grpc.pb.cc CODEGEN_TEST_FULL_SRC = \ @@ -20064,8 +20064,8 @@ endif XDS_END2END_TEST_SRC = \ - $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.cc \ - $(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.cc \ + $(GENDIR)/src/proto/grpc/testing/xds/eds_for_test.pb.cc $(GENDIR)/src/proto/grpc/testing/xds/eds_for_test.grpc.pb.cc \ + $(GENDIR)/src/proto/grpc/testing/xds/lrs_for_test.pb.cc $(GENDIR)/src/proto/grpc/testing/xds/lrs_for_test.grpc.pb.cc \ test/cpp/end2end/xds_end2end_test.cc \ XDS_END2END_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(XDS_END2END_TEST_SRC)))) @@ -20097,9 +20097,9 @@ endif endif -$(OBJDIR)/$(CONFIG)/src/proto/grpc/lb/v2/eds_for_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/xds/eds_for_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a -$(OBJDIR)/$(CONFIG)/src/proto/grpc/lb/v2/lrs_for_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/xds/lrs_for_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/cpp/end2end/xds_end2end_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a @@ -20110,7 +20110,7 @@ ifneq ($(NO_DEPS),true) -include $(XDS_END2END_TEST_OBJS:.o=.dep) endif endif -$(OBJDIR)/$(CONFIG)/test/cpp/end2end/xds_end2end_test.o: $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/eds_for_test.grpc.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.pb.cc $(GENDIR)/src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/end2end/xds_end2end_test.o: $(GENDIR)/src/proto/grpc/testing/xds/eds_for_test.pb.cc $(GENDIR)/src/proto/grpc/testing/xds/eds_for_test.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/xds/lrs_for_test.pb.cc $(GENDIR)/src/proto/grpc/testing/xds/lrs_for_test.grpc.pb.cc PUBLIC_HEADERS_MUST_BE_C89_SRC = \ diff --git a/build.yaml b/build.yaml index 15203f242c9..30b1ed91d0f 100644 --- a/build.yaml +++ b/build.yaml @@ -4755,7 +4755,7 @@ targets: build: test language: c++ src: - - src/proto/grpc/lb/v2/orca_load_report_for_test.proto + - src/proto/grpc/testing/xds/orca_load_report_for_test.proto - test/cpp/end2end/client_lb_end2end_test.cc deps: - grpc++_test_util @@ -6028,8 +6028,8 @@ targets: build: test language: c++ src: - - src/proto/grpc/lb/v2/eds_for_test.proto - - src/proto/grpc/lb/v2/lrs_for_test.proto + - src/proto/grpc/testing/xds/eds_for_test.proto + - src/proto/grpc/testing/xds/lrs_for_test.proto - test/cpp/end2end/xds_end2end_test.cc deps: - grpc++_test_util diff --git a/src/proto/grpc/lb/v2/BUILD b/src/proto/grpc/testing/xds/BUILD similarity index 98% rename from src/proto/grpc/lb/v2/BUILD rename to src/proto/grpc/testing/xds/BUILD index 25b3dd3644a..8336d5c508a 100644 --- a/src/proto/grpc/lb/v2/BUILD +++ b/src/proto/grpc/testing/xds/BUILD @@ -17,7 +17,7 @@ licenses(["notice"]) # Apache v2 load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library") grpc_package( - name = "lb", + name = "xds", visibility = "public", ) diff --git a/src/proto/grpc/lb/v2/eds_for_test.proto b/src/proto/grpc/testing/xds/eds_for_test.proto similarity index 100% rename from src/proto/grpc/lb/v2/eds_for_test.proto rename to src/proto/grpc/testing/xds/eds_for_test.proto diff --git a/src/proto/grpc/lb/v2/lrs_for_test.proto b/src/proto/grpc/testing/xds/lrs_for_test.proto similarity index 99% rename from src/proto/grpc/lb/v2/lrs_for_test.proto rename to src/proto/grpc/testing/xds/lrs_for_test.proto index 504b6e752ce..9d8ae267bc7 100644 --- a/src/proto/grpc/lb/v2/lrs_for_test.proto +++ b/src/proto/grpc/testing/xds/lrs_for_test.proto @@ -26,7 +26,7 @@ syntax = "proto3"; package envoy.service.load_stats.v2; import "google/protobuf/duration.proto"; -import "src/proto/grpc/lb/v2/eds_for_test.proto"; +import "src/proto/grpc/testing/xds/eds_for_test.proto"; // [#not-implemented-hide:] Not configuration. TBD how to doc proto APIs. message EndpointLoadMetricStats { diff --git a/src/proto/grpc/lb/v2/orca_load_report_for_test.proto b/src/proto/grpc/testing/xds/orca_load_report_for_test.proto similarity index 100% rename from src/proto/grpc/lb/v2/orca_load_report_for_test.proto rename to src/proto/grpc/testing/xds/orca_load_report_for_test.proto diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index 9153439341f..95ce72a95f2 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -434,7 +434,7 @@ grpc_cc_test( "//:gpr", "//:grpc", "//:grpc++", - "//src/proto/grpc/lb/v2:orca_load_report_for_test_proto", + "//src/proto/grpc/testing/xds:orca_load_report_for_test_proto", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", @@ -496,8 +496,8 @@ grpc_cc_test( "//:grpc", "//:grpc++", "//:grpc_resolver_fake", - "//src/proto/grpc/lb/v2:eds_for_test_proto", - "//src/proto/grpc/lb/v2:lrs_for_test_proto", + "//src/proto/grpc/testing/xds:eds_for_test_proto", + "//src/proto/grpc/testing/xds:lrs_for_test_proto", "//src/proto/grpc/testing:echo_messages_proto", "//src/proto/grpc/testing:echo_proto", "//src/proto/grpc/testing/duplicate:echo_duplicate_proto", diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index e0b4b074ff2..cd87d91f39c 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -53,8 +53,8 @@ #include "src/cpp/client/secure_credentials.h" #include "src/cpp/server/secure_server_credentials.h" -#include "src/proto/grpc/lb/v2/orca_load_report_for_test.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" +#include "src/proto/grpc/testing/xds/orca_load_report_for_test.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" #include "test/core/util/test_lb_policies.h" diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 2d506c56c87..2a34b5a8151 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -51,9 +51,9 @@ #include "test/core/util/test_config.h" #include "test/cpp/end2end/test_service_impl.h" -#include "src/proto/grpc/lb/v2/eds_for_test.grpc.pb.h" -#include "src/proto/grpc/lb/v2/lrs_for_test.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" +#include "src/proto/grpc/testing/xds/eds_for_test.grpc.pb.h" +#include "src/proto/grpc/testing/xds/lrs_for_test.grpc.pb.h" #include #include From d0c65e45e8c64eb1d27b568847c70a93369c35f3 Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Wed, 11 Sep 2019 13:53:09 -0700 Subject: [PATCH 659/661] Added Objective-C performance tests --- .../tests/InteropTests/InteropTests.h | 49 +-- src/objective-c/tests/MacTests/StressTests.h | 41 +-- src/objective-c/tests/PerfTests/PerfTests.h | 27 ++ src/objective-c/tests/PerfTests/PerfTests.m | 327 ++++++++++++++++++ .../tests/PerfTests/PerfTestsBlockCallbacks.h | 33 ++ .../tests/PerfTests/PerfTestsBlockCallbacks.m | 80 +++++ .../PerfTests/PerfTestsCFStreamCleartext.m | 74 ++++ .../tests/PerfTests/PerfTestsCFStreamSSL.m | 80 +++++ .../tests/PerfTests/PerfTestsCronet.m | 63 ++++ .../PerfTests/PerfTestsNoCFStreamCleartext.m | 74 ++++ .../tests/PerfTests/PerfTestsNoCFStreamSSL.m | 80 +++++ src/objective-c/tests/Podfile | 8 + src/objective-c/tests/TestBase.h | 65 ++++ src/objective-c/tests/TestBase.m | 50 +++ .../tests/Tests.xcodeproj/project.pbxproj | 245 +++++++++++++ .../xcshareddata/xcschemes/PerfTests.xcscheme | 95 +++++ 16 files changed, 1305 insertions(+), 86 deletions(-) create mode 100644 src/objective-c/tests/PerfTests/PerfTests.h create mode 100644 src/objective-c/tests/PerfTests/PerfTests.m create mode 100644 src/objective-c/tests/PerfTests/PerfTestsBlockCallbacks.h create mode 100644 src/objective-c/tests/PerfTests/PerfTestsBlockCallbacks.m create mode 100644 src/objective-c/tests/PerfTests/PerfTestsCFStreamCleartext.m create mode 100644 src/objective-c/tests/PerfTests/PerfTestsCFStreamSSL.m create mode 100644 src/objective-c/tests/PerfTests/PerfTestsCronet.m create mode 100644 src/objective-c/tests/PerfTests/PerfTestsNoCFStreamCleartext.m create mode 100644 src/objective-c/tests/PerfTests/PerfTestsNoCFStreamSSL.m create mode 100644 src/objective-c/tests/TestBase.h create mode 100644 src/objective-c/tests/TestBase.m create mode 100644 src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/PerfTests.xcscheme diff --git a/src/objective-c/tests/InteropTests/InteropTests.h b/src/objective-c/tests/InteropTests/InteropTests.h index 4ebce5c961d..1f624a07c68 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.h +++ b/src/objective-c/tests/InteropTests/InteropTests.h @@ -18,7 +18,7 @@ #import -#import +#import "../TestBase.h" /** * Implements tests as described here: @@ -26,51 +26,6 @@ * * This is an abstract class that needs to be subclassed. See |+host|. */ -@interface InteropTests : XCTestCase -/** - * The test suite to run, checking if the current XCTestCase instance is the base class. - * If so, run no tests (disabled). Otherwise, proceed to normal execution. - */ -@property(class, readonly) XCTestSuite *defaultTestSuite; - -/** - * Host to send the RPCs to. The base implementation returns nil, which would make all tests to - * fail. - * Override in a subclass to perform these tests against a specific address. - */ -+ (NSString *)host; - -/** - * Bytes of overhead of test proto responses due to encoding. This is used to excercise the behavior - * when responses are just above or below the max response size. For some reason, the local and - * remote servers enconde responses with different overhead (?), so this is defined per-subclass. - */ -- (int32_t)encodingOverhead; - -/** - * DEPRECATED: \a transportType is a deprecated option. Please use \a transport instead. - * - * The type of transport to be used. The base implementation returns default. Subclasses should - * override to appropriate settings. - */ -+ (GRPCTransportType)transportType; - -/* - * The transport to be used. The base implementation returns NULL. Subclasses should override to - * appropriate settings. - */ -+ (GRPCTransportID)transport; - -/** - * The root certificates to be used. The base implementation returns nil. Subclasses should override - * to appropriate settings. - */ -+ (NSString *)PEMRootCertificates; - -/** - * The root certificates to be used. The base implementation returns nil. Subclasses should override - * to appropriate settings. - */ -+ (NSString *)hostNameOverride; +@interface InteropTests : TestBase @end diff --git a/src/objective-c/tests/MacTests/StressTests.h b/src/objective-c/tests/MacTests/StressTests.h index 2608a710845..deac087adb4 100644 --- a/src/objective-c/tests/MacTests/StressTests.h +++ b/src/objective-c/tests/MacTests/StressTests.h @@ -18,45 +18,8 @@ #import -#import +#import "../TestBase.h" -@interface StressTests : XCTestCase -/** - * The test suite to run, checking if the current XCTestCase instance is the base class. - * If so, run no tests (disabled). Otherwise, proceed to normal execution. - */ -@property(class, readonly) XCTestSuite *defaultTestSuite; - -/** - * Host to send the RPCs to. The base implementation returns nil, which would make all tests to - * fail. - * Override in a subclass to perform these tests against a specific address. - */ -+ (NSString *)host; - -/** - * Bytes of overhead of test proto responses due to encoding. This is used to excercise the behavior - * when responses are just above or below the max response size. For some reason, the local and - * remote servers enconde responses with different overhead (?), so this is defined per-subclass. - */ -- (int32_t)encodingOverhead; - -/** - * The type of transport to be used. The base implementation returns default. Subclasses should - * override to appropriate settings. - */ -+ (GRPCTransportType)transportType; - -/** - * The root certificates to be used. The base implementation returns nil. Subclasses should override - * to appropriate settings. - */ -+ (NSString *)PEMRootCertificates; - -/** - * The root certificates to be used. The base implementation returns nil. Subclasses should override - * to appropriate settings. - */ -+ (NSString *)hostNameOverride; +@interface StressTests : TestBase @end diff --git a/src/objective-c/tests/PerfTests/PerfTests.h b/src/objective-c/tests/PerfTests/PerfTests.h new file mode 100644 index 00000000000..840d983bc6f --- /dev/null +++ b/src/objective-c/tests/PerfTests/PerfTests.h @@ -0,0 +1,27 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import "../TestBase.h" + +/** + * This is an abstract class that needs to be subclassed. See |+host|. + */ +@interface PerfTests : TestBase + +@end diff --git a/src/objective-c/tests/PerfTests/PerfTests.m b/src/objective-c/tests/PerfTests/PerfTests.m new file mode 100644 index 00000000000..77fedb9ed69 --- /dev/null +++ b/src/objective-c/tests/PerfTests/PerfTests.m @@ -0,0 +1,327 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "PerfTests.h" + +#include + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" + +#import "PerfTestsBlockCallbacks.h" + +#define TEST_TIMEOUT 128 + +extern const char *kCFStreamVarName; + +// Convenience constructors for the generated proto messages: + +@interface RMTStreamingOutputCallRequest (Constructors) ++ (instancetype)messageWithPayloadSize:(NSNumber *)payloadSize + requestedResponseSize:(NSNumber *)responseSize; +@end + +@implementation RMTStreamingOutputCallRequest (Constructors) ++ (instancetype)messageWithPayloadSize:(NSNumber *)payloadSize + requestedResponseSize:(NSNumber *)responseSize { + RMTStreamingOutputCallRequest *request = [self message]; + RMTResponseParameters *parameters = [RMTResponseParameters message]; + parameters.size = responseSize.intValue; + [request.responseParametersArray addObject:parameters]; + request.payload.body = [NSMutableData dataWithLength:payloadSize.unsignedIntegerValue]; + return request; +} +@end + +@interface DefaultInterceptorFactory : NSObject + +- (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager; + +@end + +@implementation DefaultInterceptorFactory + +- (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { + dispatch_queue_t queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); + return + [[GRPCInterceptor alloc] initWithInterceptorManager:interceptorManager dispatchQueue:queue]; +} + +@end + +BOOL isUsingCFStream() { + NSString *enabled = @(getenv(kCFStreamVarName)); + return [enabled isEqualToString:@"1"]; +} + +#pragma mark Tests + +@implementation PerfTests { + RMTTestService *_service; +} + ++ (XCTestSuite *)defaultTestSuite { + if (self == [PerfTests class]) { + return [XCTestSuite testSuiteWithName:@"PerfTestsEmptySuite"]; + } else { + return super.defaultTestSuite; + } +} + ++ (NSString *)host { + return nil; +} + +// This number indicates how many bytes of overhead does Protocol Buffers encoding add onto the +// message. The number varies as different message.proto is used on different servers. The actual +// number for each interop server is overridden in corresponding derived test classes. +- (int32_t)encodingOverhead { + return 0; +} + ++ (GRPCTransportID)transport { + return NULL; +} + ++ (NSString *)PEMRootCertificates { + return nil; +} + ++ (NSString *)hostNameOverride { + return nil; +} + ++ (void)setUp { + setenv("GRPC_TRACE", "tcp", 1); + setenv("GRPC_VERBOSITY", "DEBUG", 1); + NSLog(@"In setUp"); +} + +- (void)setUp { + self.continueAfterFailure = NO; + + [GRPCCall resetHostSettings]; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + [GRPCCall closeOpenConnections]; +#pragma clang diagnostic pop + + _service = [[self class] host] ? [RMTTestService serviceWithHost:[[self class] host]] : nil; +} + +- (void)pingPongV2APIWithRequest:(RMTStreamingOutputCallRequest *)request + numMessages:(int)numMessages + options:(GRPCMutableCallOptions *)options { + __weak XCTestExpectation *expectation = [self expectationWithDescription:@"PingPong"]; + + __block BOOL flowControlEnabled = options.flowControlEnabled; + __block int index = 0; + __block GRPCStreamingProtoCall *call = [self->_service + fullDuplexCallWithResponseHandler:[[PerfTestsBlockCallbacks alloc] + initWithInitialMetadataCallback:nil + messageCallback:^(id message) { + int indexCopy; + @synchronized(self) { + index += 1; + indexCopy = index; + } + if (indexCopy < numMessages) { + [call writeMessage:request]; + if (flowControlEnabled) { + [call receiveNextMessage]; + } + } else { + [call finish]; + } + } + closeCallback:^(NSDictionary *trailingMetadata, + NSError *error) { + [expectation fulfill]; + + }] + callOptions:options]; + [call start]; + if (flowControlEnabled) { + [call receiveNextMessage]; + } + [call writeMessage:request]; + [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil]; +} + +- (void)testPingPongRPCWithV2API { + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + options.transport = [[self class] transport]; + options.PEMRootCertificates = [[self class] PEMRootCertificates]; + options.hostNameOverride = [[self class] hostNameOverride]; + + id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:@1 requestedResponseSize:@1]; + + // warm up + [self pingPongV2APIWithRequest:request numMessages:1000 options:options]; + + [self measureBlock:^{ + [self pingPongV2APIWithRequest:request numMessages:10000 options:options]; + }]; +} + +- (void)testPingPongRPCWithFlowControl { + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + options.transport = [[self class] transport]; + options.PEMRootCertificates = [[self class] PEMRootCertificates]; + options.hostNameOverride = [[self class] hostNameOverride]; + options.flowControlEnabled = YES; + + id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:@1 requestedResponseSize:@1]; + + // warm up + [self pingPongV2APIWithRequest:request numMessages:1000 options:options]; + + [self measureBlock:^{ + [self pingPongV2APIWithRequest:request numMessages:10000 options:options]; + }]; +} + +- (void)testPingPongRPCWithInterceptor { + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + options.transport = [[self class] transport]; + options.PEMRootCertificates = [[self class] PEMRootCertificates]; + options.hostNameOverride = [[self class] hostNameOverride]; + options.interceptorFactories = @[ [[DefaultInterceptorFactory alloc] init] ]; + + id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:@1 requestedResponseSize:@1]; + + // warm up + [self pingPongV2APIWithRequest:request numMessages:1000 options:options]; + + [self measureBlock:^{ + [self pingPongV2APIWithRequest:request numMessages:10000 options:options]; + }]; +} + +- (void)pingPongV1APIWithRequest:(RMTStreamingOutputCallRequest *)request + numMessages:(int)numMessages { + __block int index = 0; + __weak XCTestExpectation *expectation = [self expectationWithDescription:@"PingPong"]; + GRXBufferedPipe *requestsBuffer = [[GRXBufferedPipe alloc] init]; + + [requestsBuffer writeValue:request]; + + [_service fullDuplexCallWithRequestsWriter:requestsBuffer + eventHandler:^(BOOL done, RMTStreamingOutputCallResponse *response, + NSError *error) { + if (response) { + int indexCopy; + @synchronized(self) { + index += 1; + indexCopy = index; + } + if (indexCopy < numMessages) { + [requestsBuffer writeValue:request]; + } else { + [requestsBuffer writesFinishedWithError:nil]; + } + } + + if (done) { + [expectation fulfill]; + } + }]; + [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil]; +} + +- (void)testPingPongRPCWithV1API { + id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:@1 requestedResponseSize:@1]; + [self pingPongV1APIWithRequest:request numMessages:1000]; + [self measureBlock:^{ + [self pingPongV1APIWithRequest:request numMessages:10000]; + }]; +} + +- (void)unaryRPCWithRequest:(RMTSimpleRequest *)request + numMessages:(int)numMessages + callOptions:(GRPCMutableCallOptions *)options { + const int kOutstandingRPCs = 10; + NSAssert(numMessages > kOutstandingRPCs, @"Number of RPCs must be > %d", kOutstandingRPCs); + __weak XCTestExpectation *expectation = [self expectationWithDescription:@"unaryRPC"]; + + dispatch_semaphore_t sema = dispatch_semaphore_create(kOutstandingRPCs); + __block int index = 0; + + for (int i = 0; i < numMessages; ++i) { + GRPCUnaryProtoCall *call = [_service + unaryCallWithMessage:request + responseHandler:[[PerfTestsBlockCallbacks alloc] + initWithInitialMetadataCallback:nil + messageCallback:nil + closeCallback:^(NSDictionary *trailingMetadata, + NSError *error) { + dispatch_semaphore_signal(sema); + @synchronized(self) { + ++index; + if (index == numMessages) { + [expectation fulfill]; + } + } + + }] + callOptions:options]; + + dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER); + [call start]; + } + + [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil]; +} + +- (void)testUnaryRPC { + // Workaround Apple CFStream bug + if (isUsingCFStream()) { + return; + } + + RMTSimpleRequest *request = [RMTSimpleRequest message]; + request.responseSize = 1048576; + request.payload.body = [NSMutableData dataWithLength:1048576]; + + GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; + options.transport = [[self class] transport]; + options.PEMRootCertificates = [[self class] PEMRootCertificates]; + options.hostNameOverride = [[self class] hostNameOverride]; + + // warm up + [self unaryRPCWithRequest:request numMessages:50 callOptions:options]; + + [self measureBlock:^{ + [self unaryRPCWithRequest:request numMessages:50 callOptions:options]; + }]; +} + +@end diff --git a/src/objective-c/tests/PerfTests/PerfTestsBlockCallbacks.h b/src/objective-c/tests/PerfTests/PerfTestsBlockCallbacks.h new file mode 100644 index 00000000000..3b98481b108 --- /dev/null +++ b/src/objective-c/tests/PerfTests/PerfTestsBlockCallbacks.h @@ -0,0 +1,33 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +// Convenience class to use blocks as callbacks +@interface PerfTestsBlockCallbacks : NSObject + +- (instancetype)initWithInitialMetadataCallback:(void (^)(NSDictionary *))initialMetadataCallback + messageCallback:(void (^)(id))messageCallback + closeCallback:(void (^)(NSDictionary *, NSError *))closeCallback + writeMessageCallback:(void (^)(void))writeMessageCallback; + +- (instancetype)initWithInitialMetadataCallback:(void (^)(NSDictionary *))initialMetadataCallback + messageCallback:(void (^)(id))messageCallback + closeCallback:(void (^)(NSDictionary *, NSError *))closeCallback; + +@end diff --git a/src/objective-c/tests/PerfTests/PerfTestsBlockCallbacks.m b/src/objective-c/tests/PerfTests/PerfTestsBlockCallbacks.m new file mode 100644 index 00000000000..d75940b5fe3 --- /dev/null +++ b/src/objective-c/tests/PerfTests/PerfTestsBlockCallbacks.m @@ -0,0 +1,80 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "PerfTestsBlockCallbacks.h" + +@implementation PerfTestsBlockCallbacks { + void (^_initialMetadataCallback)(NSDictionary *); + void (^_messageCallback)(id); + void (^_closeCallback)(NSDictionary *, NSError *); + void (^_writeMessageCallback)(void); + dispatch_queue_t _dispatchQueue; +} + +- (instancetype)initWithInitialMetadataCallback:(void (^)(NSDictionary *))initialMetadataCallback + messageCallback:(void (^)(id))messageCallback + closeCallback:(void (^)(NSDictionary *, NSError *))closeCallback + writeMessageCallback:(void (^)(void))writeMessageCallback { + if ((self = [super init])) { + _initialMetadataCallback = initialMetadataCallback; + _messageCallback = messageCallback; + _closeCallback = closeCallback; + _writeMessageCallback = writeMessageCallback; + _dispatchQueue = dispatch_queue_create(nil, DISPATCH_QUEUE_SERIAL); + } + return self; +} + +- (instancetype)initWithInitialMetadataCallback:(void (^)(NSDictionary *))initialMetadataCallback + messageCallback:(void (^)(id))messageCallback + closeCallback:(void (^)(NSDictionary *, NSError *))closeCallback { + return [self initWithInitialMetadataCallback:initialMetadataCallback + messageCallback:messageCallback + closeCallback:closeCallback + writeMessageCallback:nil]; +} + +- (void)didReceiveInitialMetadata:(NSDictionary *)initialMetadata { + if (_initialMetadataCallback) { + _initialMetadataCallback(initialMetadata); + } +} + +- (void)didReceiveProtoMessage:(GPBMessage *)message { + if (_messageCallback) { + _messageCallback(message); + } +} + +- (void)didCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { + if (_closeCallback) { + _closeCallback(trailingMetadata, error); + } +} + +- (void)didWriteMessage { + if (_writeMessageCallback) { + _writeMessageCallback(); + } +} + +- (dispatch_queue_t)dispatchQueue { + return _dispatchQueue; +} + +@end diff --git a/src/objective-c/tests/PerfTests/PerfTestsCFStreamCleartext.m b/src/objective-c/tests/PerfTests/PerfTestsCFStreamCleartext.m new file mode 100644 index 00000000000..1501a7df40e --- /dev/null +++ b/src/objective-c/tests/PerfTests/PerfTestsCFStreamCleartext.m @@ -0,0 +1,74 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import +#import + +#import "PerfTests.h" + +// The server address is derived from preprocessor macro, which is +// in turn derived from environment variable of the same name. +#define NSStringize_helper(x) #x +#define NSStringize(x) @NSStringize_helper(x) +static NSString *const kLocalCleartextHost = NSStringize(HOST_PORT_LOCAL); + +extern const char *kCFStreamVarName; + +// The Protocol Buffers encoding overhead of local interop server. Acquired +// by experiment. Adjust this when server's proto file changes. +static int32_t kLocalInteropServerOverhead = 10; + +/** Tests in PerfTests.m, sending the RPCs to a local cleartext server. */ +@interface PerfTestsCFStreamCleartext : PerfTests +@end + +@implementation PerfTestsCFStreamCleartext + ++ (NSString *)host { + return kLocalCleartextHost; +} + ++ (NSString *)PEMRootCertificates { + return nil; +} + ++ (NSString *)hostNameOverride { + return nil; +} + +- (int32_t)encodingOverhead { + return kLocalInteropServerOverhead; // bytes +} + ++ (void)setUp { + setenv(kCFStreamVarName, "1", 1); +} + +- (void)setUp { + [super setUp]; + + // Register test server as non-SSL. + [GRPCCall useInsecureConnectionsForHost:kLocalCleartextHost]; +} + ++ (GRPCTransportID)transport { + return GRPCDefaultTransportImplList.core_insecure; +} + +@end diff --git a/src/objective-c/tests/PerfTests/PerfTestsCFStreamSSL.m b/src/objective-c/tests/PerfTests/PerfTestsCFStreamSSL.m new file mode 100644 index 00000000000..6c61228fea9 --- /dev/null +++ b/src/objective-c/tests/PerfTests/PerfTestsCFStreamSSL.m @@ -0,0 +1,80 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import +#import + +#import "PerfTests.h" +// The server address is derived from preprocessor macro, which is +// in turn derived from environment variable of the same name. +#define NSStringize_helper(x) #x +#define NSStringize(x) @NSStringize_helper(x) +static NSString *const kLocalSSLHost = NSStringize(HOST_PORT_LOCALSSL); + +extern const char *kCFStreamVarName; + +// The Protocol Buffers encoding overhead of local interop server. Acquired +// by experiment. Adjust this when server's proto file changes. +static int32_t kLocalInteropServerOverhead = 10; + +/** Tests in PerfTests.m, sending the RPCs to a local SSL server. */ +@interface PerfTestsCFStreamSSL : PerfTests +@end + +@implementation PerfTestsCFStreamSSL + ++ (NSString *)host { + return kLocalSSLHost; +} + ++ (NSString *)PEMRootCertificates { + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + NSString *certsPath = + [bundle pathForResource:@"TestCertificates.bundle/test-certificates" ofType:@"pem"]; + NSError *error; + return [NSString stringWithContentsOfFile:certsPath encoding:NSUTF8StringEncoding error:&error]; +} + ++ (NSString *)hostNameOverride { + return @"foo.test.google.fr"; +} + +- (int32_t)encodingOverhead { + return kLocalInteropServerOverhead; // bytes +} + ++ (GRPCTransportID)transport { + return GRPCDefaultTransportImplList.core_secure; +} + ++ (void)setUp { + setenv(kCFStreamVarName, "1", 1); +} + +- (void)setUp { + [super setUp]; + + // Register test server certificates and name. + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + NSString *certsPath = + [bundle pathForResource:@"TestCertificates.bundle/test-certificates" ofType:@"pem"]; + [GRPCCall useTestCertsPath:certsPath testName:@"foo.test.google.fr" forHost:kLocalSSLHost]; +} + +@end diff --git a/src/objective-c/tests/PerfTests/PerfTestsCronet.m b/src/objective-c/tests/PerfTests/PerfTestsCronet.m new file mode 100644 index 00000000000..c0dba819825 --- /dev/null +++ b/src/objective-c/tests/PerfTests/PerfTestsCronet.m @@ -0,0 +1,63 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import + +#import +#import + +#import "../ConfigureCronet.h" +#import "PerfTests.h" + +// The server address is derived from preprocessor macro, which is +// in turn derived from environment variable of the same name. +#define NSStringize_helper(x) #x +#define NSStringize(x) @NSStringize_helper(x) +static NSString *const kLocalSSLHost = NSStringize(HOST_PORT_LOCALSSL); + +// The Protocol Buffers encoding overhead of remote interop server. Acquired +// by experiment. Adjust this when server's proto file changes. +static int32_t kRemoteInteropServerOverhead = 12; + +/** Tests in PerfTests.m, sending the RPCs to a remote SSL server. */ +@interface PerfTestsCronet : PerfTests +@end + +@implementation PerfTestsCronet + ++ (void)setUp { + configureCronet(); + [GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]]; + + [super setUp]; +} + ++ (NSString *)host { + return kLocalSSLHost; +} + ++ (GRPCTransportID)transport { + return gGRPCCoreCronetID; +} + +- (int32_t)encodingOverhead { + return kRemoteInteropServerOverhead; // bytes +} + +@end diff --git a/src/objective-c/tests/PerfTests/PerfTestsNoCFStreamCleartext.m b/src/objective-c/tests/PerfTests/PerfTestsNoCFStreamCleartext.m new file mode 100644 index 00000000000..4b5832afad2 --- /dev/null +++ b/src/objective-c/tests/PerfTests/PerfTestsNoCFStreamCleartext.m @@ -0,0 +1,74 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import +#import + +#import "PerfTests.h" + +// The server address is derived from preprocessor macro, which is +// in turn derived from environment variable of the same name. +#define NSStringize_helper(x) #x +#define NSStringize(x) @NSStringize_helper(x) +static NSString *const kLocalCleartextHost = NSStringize(HOST_PORT_LOCAL); + +extern const char *kCFStreamVarName; + +// The Protocol Buffers encoding overhead of local interop server. Acquired +// by experiment. Adjust this when server's proto file changes. +static int32_t kLocalInteropServerOverhead = 10; + +/** Tests in PerfTests.m, sending the RPCs to a local cleartext server. */ +@interface PerfTestsNoCFStreamCleartext : PerfTests +@end + +@implementation PerfTestsNoCFStreamCleartext + ++ (NSString *)host { + return kLocalCleartextHost; +} + ++ (NSString *)PEMRootCertificates { + return nil; +} + ++ (NSString *)hostNameOverride { + return nil; +} + +- (int32_t)encodingOverhead { + return kLocalInteropServerOverhead; // bytes +} + ++ (void)setUp { + setenv(kCFStreamVarName, "0", 1); +} + +- (void)setUp { + [super setUp]; + + // Register test server as non-SSL. + [GRPCCall useInsecureConnectionsForHost:kLocalCleartextHost]; +} + ++ (GRPCTransportID)transport { + return GRPCDefaultTransportImplList.core_insecure; +} + +@end diff --git a/src/objective-c/tests/PerfTests/PerfTestsNoCFStreamSSL.m b/src/objective-c/tests/PerfTests/PerfTestsNoCFStreamSSL.m new file mode 100644 index 00000000000..570ba3904ac --- /dev/null +++ b/src/objective-c/tests/PerfTests/PerfTestsNoCFStreamSSL.m @@ -0,0 +1,80 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import +#import + +#import "PerfTests.h" +// The server address is derived from preprocessor macro, which is +// in turn derived from environment variable of the same name. +#define NSStringize_helper(x) #x +#define NSStringize(x) @NSStringize_helper(x) +static NSString *const kLocalSSLHost = NSStringize(HOST_PORT_LOCALSSL); + +extern const char *kCFStreamVarName; + +// The Protocol Buffers encoding overhead of local interop server. Acquired +// by experiment. Adjust this when server's proto file changes. +static int32_t kLocalInteropServerOverhead = 10; + +/** Tests in PerfTests.m, sending the RPCs to a local SSL server. */ +@interface PerfTestsNoCFStreamSSL : PerfTests +@end + +@implementation PerfTestsNoCFStreamSSL + ++ (NSString *)host { + return kLocalSSLHost; +} + ++ (NSString *)PEMRootCertificates { + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + NSString *certsPath = + [bundle pathForResource:@"TestCertificates.bundle/test-certificates" ofType:@"pem"]; + NSError *error; + return [NSString stringWithContentsOfFile:certsPath encoding:NSUTF8StringEncoding error:&error]; +} + ++ (NSString *)hostNameOverride { + return @"foo.test.google.fr"; +} + +- (int32_t)encodingOverhead { + return kLocalInteropServerOverhead; // bytes +} + ++ (GRPCTransportID)transport { + return GRPCDefaultTransportImplList.core_secure; +} + ++ (void)setUp { + setenv(kCFStreamVarName, "0", 1); +} + +- (void)setUp { + [super setUp]; + + // Register test server certificates and name. + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + NSString *certsPath = + [bundle pathForResource:@"TestCertificates.bundle/test-certificates" ofType:@"pem"]; + [GRPCCall useTestCertsPath:certsPath testName:@"foo.test.google.fr" forHost:kLocalSSLHost]; +} + +@end diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index c83e8861e93..f75b36dc996 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -49,6 +49,14 @@ target 'CronetTests' do pod 'gRPC-Core/Tests', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true end +target 'PerfTests' do + platform :ios, '8.0' + grpc_deps + + pod 'gRPC/GRPCCoreCronet', :path => GRPC_LOCAL_SRC + pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c" +end + # gRPC-Core.podspec needs to be modified to be successfully used for local development. A Podfile's # pre_install hook lets us do that. The block passed to it runs after the podspecs are downloaded # and before they are installed in the user project. diff --git a/src/objective-c/tests/TestBase.h b/src/objective-c/tests/TestBase.h new file mode 100644 index 00000000000..621e145d3d6 --- /dev/null +++ b/src/objective-c/tests/TestBase.h @@ -0,0 +1,65 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +#import + +/** + * This is an abstract class that needs to be subclassed. See |+host|. + */ +@interface TestBase : XCTestCase +/** + * The test suite to run, checking if the current XCTestCase instance is the base class. + * If so, run no tests (disabled). Otherwise, proceed to normal execution. + */ +@property(class, readonly) XCTestSuite *defaultTestSuite; + +/** + * Host to send the RPCs to. The base implementation returns nil, which would make all tests to + * fail. + * Override in a subclass to perform these tests against a specific address. + */ ++ (NSString *)host; + +/** + * Bytes of overhead of test proto responses due to encoding. This is used to excercise the behavior + * when responses are just above or below the max response size. For some reason, the local and + * remote servers enconde responses with different overhead (?), so this is defined per-subclass. + */ +- (int32_t)encodingOverhead; + +/* + * The transport to be used. The base implementation returns NULL. Subclasses should override to + * appropriate settings. + */ ++ (GRPCTransportID)transport; + +/** + * The root certificates to be used. The base implementation returns nil. Subclasses should override + * to appropriate settings. + */ ++ (NSString *)PEMRootCertificates; + +/** + * The root certificates to be used. The base implementation returns nil. Subclasses should override + * to appropriate settings. + */ ++ (NSString *)hostNameOverride; + +@end diff --git a/src/objective-c/tests/TestBase.m b/src/objective-c/tests/TestBase.m new file mode 100644 index 00000000000..aa143389751 --- /dev/null +++ b/src/objective-c/tests/TestBase.m @@ -0,0 +1,50 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "TestBase.h" + +@implementation TestBase : XCTestCase + ++ (XCTestSuite *)defaultTestSuite { + return super.defaultTestSuite; +} + ++ (NSString *)host { + return nil; +} + +// This number indicates how many bytes of overhead does Protocol Buffers encoding add onto the +// message. The number varies as different message.proto is used on different servers. The actual +// number for each interop server is overridden in corresponding derived test classes. +- (int32_t)encodingOverhead { + return 0; +} + ++ (GRPCTransportID)transport { + return NULL; +} + ++ (NSString *)PEMRootCertificates { + return nil; +} + ++ (NSString *)hostNameOverride { + return nil; +} + +@end diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 2ce32d3916d..49f11548cc3 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -49,10 +49,26 @@ ABCB3EEA22F23BF500F0FECE /* APIv2Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7F487F227782C1006656AD /* APIv2Tests.m */; }; ABCB3EEB22F23BF500F0FECE /* NSErrorUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0282E8215AA697007AC99D /* NSErrorUnitTests.m */; }; B071230B22669EED004B64A1 /* StressTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B071230A22669EED004B64A1 /* StressTests.m */; }; + B098FC622331B7EA00029C0E /* TestBase.m in Sources */ = {isa = PBXBuildFile; fileRef = B0C461E02331AC5C004E17DA /* TestBase.m */; }; + B098FC632331B7FA00029C0E /* TestBase.m in Sources */ = {isa = PBXBuildFile; fileRef = B0C461E02331AC5C004E17DA /* TestBase.m */; }; + B098FC642331B80500029C0E /* TestBase.m in Sources */ = {isa = PBXBuildFile; fileRef = B0C461E02331AC5C004E17DA /* TestBase.m */; }; + B098FC652331B82000029C0E /* TestBase.m in Sources */ = {isa = PBXBuildFile; fileRef = B0C461E02331AC5C004E17DA /* TestBase.m */; }; + B098FC662331B83900029C0E /* TestBase.m in Sources */ = {isa = PBXBuildFile; fileRef = B0C461E02331AC5C004E17DA /* TestBase.m */; }; + B0A420C523299D2200D95F2A /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; + B0A420C623299D2D00D95F2A /* ConfigureCronet.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3F1487227918AA007C6D90 /* ConfigureCronet.m */; }; B0BB3F08225E7ABA008DA580 /* NSErrorUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E0282E8215AA697007AC99D /* NSErrorUnitTests.m */; }; B0BB3F0A225EA511008DA580 /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; B0D39B9A2266F3CB00A4078D /* StressTestsSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = B0D39B992266F3CB00A4078D /* StressTestsSSL.m */; }; B0D39B9C2266FF9800A4078D /* StressTestsCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = B0D39B9B2266FF9800A4078D /* StressTestsCleartext.m */; }; + B0F2D0C4232991CC008C2575 /* PerfTestsBlockCallbacks.h in Sources */ = {isa = PBXBuildFile; fileRef = B0F2D08E23297BC6008C2575 /* PerfTestsBlockCallbacks.h */; }; + B0F2D0C5232991CC008C2575 /* PerfTestsBlockCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = B0F2D08F23297BDD008C2575 /* PerfTestsBlockCallbacks.m */; }; + B0F2D0C6232991CC008C2575 /* PerfTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B0F2D09123297C1A008C2575 /* PerfTests.m */; }; + B0F2D0C7232991CC008C2575 /* PerfTests.h in Sources */ = {isa = PBXBuildFile; fileRef = B0F2D09323297C28008C2575 /* PerfTests.h */; }; + B0F2D0C8232991CC008C2575 /* PerfTestsCronet.m in Sources */ = {isa = PBXBuildFile; fileRef = B0F2D09423297C47008C2575 /* PerfTestsCronet.m */; }; + B0F2D0C9232991CC008C2575 /* PerfTestsCFStreamSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = B0F2D09623297CA6008C2575 /* PerfTestsCFStreamSSL.m */; }; + B0F2D0CA232991CC008C2575 /* PerfTestsCFStreamCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = B0F2D09823297CBF008C2575 /* PerfTestsCFStreamCleartext.m */; }; + B0F2D0CB232991CC008C2575 /* PerfTestsNoCFStreamSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = B0F2D09A23297CF2008C2575 /* PerfTestsNoCFStreamSSL.m */; }; + B0F2D0CC232991CC008C2575 /* PerfTestsNoCFStreamCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = B0F2D09C23297D02008C2575 /* PerfTestsNoCFStreamCleartext.m */; }; CCF5C0719EF608276AE16374 /* libPods-UnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22A3EBB488699C8CEA19707B /* libPods-UnitTests.a */; }; F4E21D69D650D61FE8F02696 /* libPods-TvTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A0A5455106001F60357A4B6 /* libPods-TvTests.a */; }; /* End PBXBuildFile section */ @@ -163,9 +179,21 @@ B071230A22669EED004B64A1 /* StressTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StressTests.m; sourceTree = ""; }; B0BB3EF7225E795F008DA580 /* MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MacTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; B0BB3EFB225E795F008DA580 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B0C461DF2331AC3F004E17DA /* TestBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestBase.h; sourceTree = ""; }; + B0C461E02331AC5C004E17DA /* TestBase.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestBase.m; sourceTree = ""; }; B0C5FC172267C77200F192BE /* StressTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StressTests.h; sourceTree = ""; }; B0D39B992266F3CB00A4078D /* StressTestsSSL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StressTestsSSL.m; sourceTree = ""; }; B0D39B9B2266FF9800A4078D /* StressTestsCleartext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StressTestsCleartext.m; sourceTree = ""; }; + B0F2D08E23297BC6008C2575 /* PerfTestsBlockCallbacks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PerfTestsBlockCallbacks.h; sourceTree = ""; }; + B0F2D08F23297BDD008C2575 /* PerfTestsBlockCallbacks.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PerfTestsBlockCallbacks.m; sourceTree = ""; }; + B0F2D09123297C1A008C2575 /* PerfTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PerfTests.m; sourceTree = ""; }; + B0F2D09323297C28008C2575 /* PerfTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PerfTests.h; sourceTree = ""; }; + B0F2D09423297C47008C2575 /* PerfTestsCronet.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PerfTestsCronet.m; sourceTree = ""; }; + B0F2D09623297CA6008C2575 /* PerfTestsCFStreamSSL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PerfTestsCFStreamSSL.m; sourceTree = ""; }; + B0F2D09823297CBF008C2575 /* PerfTestsCFStreamCleartext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PerfTestsCFStreamCleartext.m; sourceTree = ""; }; + B0F2D09A23297CF2008C2575 /* PerfTestsNoCFStreamSSL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PerfTestsNoCFStreamSSL.m; sourceTree = ""; }; + B0F2D09C23297D02008C2575 /* PerfTestsNoCFStreamCleartext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PerfTestsNoCFStreamCleartext.m; sourceTree = ""; }; + B0F2D0BA232991BA008C2575 /* PerfTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PerfTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; B226619DC4E709E0FFFF94B8 /* Pods-CronetUnitTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetUnitTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests.test.xcconfig"; sourceTree = ""; }; B6AD69CACF67505B0F028E92 /* libPods-APIv2Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-APIv2Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; B94C27C06733CF98CE1B2757 /* Pods-AllTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.debug.xcconfig"; sourceTree = ""; }; @@ -241,6 +269,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + B0F2D0B7232991BA008C2575 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -406,6 +441,7 @@ 635697BE1B14FC11007A7283 = { isa = PBXGroup; children = ( + B0F2D08D23297B9E008C2575 /* PerfTests */, 5E7F48762277820F006656AD /* InteropTests */, 635697C91B14FC11007A7283 /* Tests */, 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */, @@ -427,6 +463,7 @@ 5EA476F42272816A000F72FC /* InteropTests.xctest */, 5E7F485922775B15006656AD /* CronetTests.xctest */, ABCB3EDA22F23B9700F0FECE /* TvTests.xctest */, + B0F2D0BA232991BA008C2575 /* PerfTests.xctest */, ); name = Products; sourceTree = ""; @@ -437,6 +474,8 @@ 5E3F148A227918C4007C6D90 /* ConfigureCronet.h */, 5E3F1487227918AA007C6D90 /* ConfigureCronet.m */, 5EAFE8271F8EFB87007F2189 /* version.h */, + B0C461E02331AC5C004E17DA /* TestBase.m */, + B0C461DF2331AC3F004E17DA /* TestBase.h */, 635697D71B14FC11007A7283 /* Supporting Files */, ); name = Tests; @@ -470,6 +509,22 @@ path = MacTests; sourceTree = ""; }; + B0F2D08D23297B9E008C2575 /* PerfTests */ = { + isa = PBXGroup; + children = ( + B0F2D08E23297BC6008C2575 /* PerfTestsBlockCallbacks.h */, + B0F2D08F23297BDD008C2575 /* PerfTestsBlockCallbacks.m */, + B0F2D09123297C1A008C2575 /* PerfTests.m */, + B0F2D09323297C28008C2575 /* PerfTests.h */, + B0F2D09423297C47008C2575 /* PerfTestsCronet.m */, + B0F2D09623297CA6008C2575 /* PerfTestsCFStreamSSL.m */, + B0F2D09823297CBF008C2575 /* PerfTestsCFStreamCleartext.m */, + B0F2D09A23297CF2008C2575 /* PerfTestsNoCFStreamSSL.m */, + B0F2D09C23297D02008C2575 /* PerfTestsNoCFStreamCleartext.m */, + ); + path = PerfTests; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -569,6 +624,23 @@ productReference = B0BB3EF7225E795F008DA580 /* MacTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + B0F2D0B9232991BA008C2575 /* PerfTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = B0F2D0BF232991BA008C2575 /* Build configuration list for PBXNativeTarget "PerfTests" */; + buildPhases = ( + B0F2D0B6232991BA008C2575 /* Sources */, + B0F2D0B7232991BA008C2575 /* Frameworks */, + B0F2D0B8232991BA008C2575 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PerfTests; + productName = PerfTests; + productReference = B0F2D0BA232991BA008C2575 /* PerfTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -599,6 +671,10 @@ CreatedOnToolsVersion = 10.1; ProvisioningStyle = Automatic; }; + B0F2D0B9232991BA008C2575 = { + CreatedOnToolsVersion = 10.1; + ProvisioningStyle = Automatic; + }; }; }; buildConfigurationList = 635697C21B14FC11007A7283 /* Build configuration list for PBXProject "Tests" */; @@ -619,6 +695,7 @@ 5EA476F32272816A000F72FC /* InteropTests */, 5E7F485822775B15006656AD /* CronetTests */, ABCB3ED922F23B9700F0FECE /* TvTests */, + B0F2D0B9232991BA008C2575 /* PerfTests */, ); }; /* End PBXProject section */ @@ -663,6 +740,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + B0F2D0B8232991BA008C2575 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B0A420C523299D2200D95F2A /* TestCertificates.bundle in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -885,6 +970,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + B098FC652331B82000029C0E /* TestBase.m in Sources */, 5E3F14852278BF5D007C6D90 /* InteropTestsBlockCallbacks.m in Sources */, 5E3F148D22792856007C6D90 /* ConfigureCronet.m in Sources */, 5E08D07023021E3B006D76EA /* InteropTestsMultipleChannels.m in Sources */, @@ -900,6 +986,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + B098FC642331B80500029C0E /* TestBase.m in Sources */, 5E3F14842278B461007C6D90 /* InteropTestsBlockCallbacks.m in Sources */, 5E7F488922778B04006656AD /* InteropTestsRemote.m in Sources */, 5EA477042273617B000F72FC /* InteropTestsLocalCleartext.m in Sources */, @@ -912,6 +999,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + B098FC662331B83900029C0E /* TestBase.m in Sources */, ABCB3EEA22F23BF500F0FECE /* APIv2Tests.m in Sources */, ABCB3EE822F23BEF00F0FECE /* InteropTestsBlockCallbacks.m in Sources */, ABCB3EE422F23BEF00F0FECE /* InteropTestsRemote.m in Sources */, @@ -927,6 +1015,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + B098FC632331B7FA00029C0E /* TestBase.m in Sources */, B0BB3F08225E7ABA008DA580 /* NSErrorUnitTests.m in Sources */, 5E7F488D22778C85006656AD /* InteropTestsLocalSSL.m in Sources */, 5E7F488E22778C87006656AD /* InteropTestsLocalCleartext.m in Sources */, @@ -941,6 +1030,24 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + B0F2D0B6232991BA008C2575 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B098FC622331B7EA00029C0E /* TestBase.m in Sources */, + B0A420C623299D2D00D95F2A /* ConfigureCronet.m in Sources */, + B0F2D0C4232991CC008C2575 /* PerfTestsBlockCallbacks.h in Sources */, + B0F2D0C5232991CC008C2575 /* PerfTestsBlockCallbacks.m in Sources */, + B0F2D0C6232991CC008C2575 /* PerfTests.m in Sources */, + B0F2D0C7232991CC008C2575 /* PerfTests.h in Sources */, + B0F2D0C8232991CC008C2575 /* PerfTestsCronet.m in Sources */, + B0F2D0C9232991CC008C2575 /* PerfTestsCFStreamSSL.m in Sources */, + B0F2D0CA232991CC008C2575 /* PerfTestsCFStreamCleartext.m in Sources */, + B0F2D0CB232991CC008C2575 /* PerfTestsNoCFStreamSSL.m in Sources */, + B0F2D0CC232991CC008C2575 /* PerfTestsNoCFStreamCleartext.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ @@ -1790,6 +1897,133 @@ }; name = Release; }; + B0F2D0C0232991BA008C2575 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = org.grpc.PerfTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + B0F2D0C1232991BA008C2575 /* Test */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = org.grpc.PerfTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Test; + }; + B0F2D0C2232991BA008C2575 /* Cronet */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = org.grpc.PerfTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Cronet; + }; + B0F2D0C3232991BA008C2575 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = org.grpc.PerfTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -1859,6 +2093,17 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + B0F2D0BF232991BA008C2575 /* Build configuration list for PBXNativeTarget "PerfTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B0F2D0C0232991BA008C2575 /* Debug */, + B0F2D0C1232991BA008C2575 /* Test */, + B0F2D0C2232991BA008C2575 /* Cronet */, + B0F2D0C3232991BA008C2575 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 635697BF1B14FC11007A7283 /* Project object */; diff --git a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/PerfTests.xcscheme b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/PerfTests.xcscheme new file mode 100644 index 00000000000..82609c70771 --- /dev/null +++ b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/PerfTests.xcscheme @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From b3b736fa59ece97ac9f5be821b82e3be5d9cf8a9 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 18 Sep 2019 10:36:55 -0700 Subject: [PATCH 660/661] Merge examples/objectivec/README into Hello World's README --- examples/objective-c/README.md | 60 ----------------------- examples/objective-c/helloworld/README.md | 53 +++++++++++++++++++- 2 files changed, 51 insertions(+), 62 deletions(-) delete mode 100644 examples/objective-c/README.md diff --git a/examples/objective-c/README.md b/examples/objective-c/README.md deleted file mode 100644 index 36e6f8b1a01..00000000000 --- a/examples/objective-c/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# gRPC in 3 minutes (Objective-C with Bazel) - -To save you from reading, if you use Cocoapods and Xcode, the right reference for you is in the [Hello World](helloworld) example directory. - -## Background -There are currently two ways to build projects with the gRPC Objective-C library: -* Cocoapods & Xcode -* Bazel - -The [helloworld](helloworld) sample is the entry point for the Cocoapods way of building projects. More is documented on grpc.io, including [installation](https://grpc.io/docs/quickstart/objective-c/) and some [tutorials](https://grpc.io/docs/tutorials/basic/objective-c/). They will not be reiterated here and they are not mandatory for the Bazel way. - -A good place to get started with Bazel is their official [website](https://bazel.build). The documentation of using gRPC Objective-C library with Bazel is [here](https://github.com/grpc/proposal/blob/master/L56-objc-bazel-support.md). - -## Installation -To run the examples in Bazel, you should have [Bazel](https://docs.bazel.build/versions/master/install-os-x.html) installed. - -## Hello Objective-C gRPC! -Here's how to build and run the Objective-C implementation of the [Hello World](helloworld) example. - -The code for the Hello World example and others live in the `examples` directory. Clone this repository to your local machine by running the following commands: -```shell -$ git clone --recursive https://github.com/grpc/grpc -``` - -Next, change your directory to `examples/objective-c` -```shell -$ cd examples/objective-c -``` - -### Try it! -To run the Hello World sample properly, we need a local server. Let's compile and run the corresponding C++ server: -```shell -$ pushd ../cpp/helloworld -$ make -$ ./greeter_server & -$ popd -``` -Or do it the Bazel way (you might need to open another shell tab for this): -```shell -$ bazel run //examples:greeter_server -``` - -Now compile the sample: -```shell -$ bazel build :HelloWorld -``` -To run the sample, you need to know the available simulator runtimes in your machine. You could either list the available runtimes yourself by running: -```shell -$ xcrun simctl list -``` -Or just try running the app and it will let you know what is available in the error messages: -```shell -$ bazel run :HelloWorld -``` -Note that running this command will build the project even if it is not built beforehand. - -Finally, launch the app with one of the available runtimes: -```shell -$ bazel run :HelloWorld --ios_simulator_version='' --ios_sumlator_device='' -``` diff --git a/examples/objective-c/helloworld/README.md b/examples/objective-c/helloworld/README.md index 2fe9913c96b..7a7516a3dca 100644 --- a/examples/objective-c/helloworld/README.md +++ b/examples/objective-c/helloworld/README.md @@ -1,12 +1,18 @@ # gRPC in 3 minutes (Objective-C) +There are currently two ways to build projects with the gRPC Objective-C library: +* Cocoapods & Xcode +* Bazel (experimental) + +## Cocoapods + ## Installation To run this example you should have [Cocoapods](https://cocoapods.org/#install) installed, as well as the relevant tools to generate the client library code (and a server in another language, for testing). You can obtain the latter by following [these setup instructions](https://github.com/grpc/homebrew-grpc). -## Hello Objective-C gRPC! +### Hello Objective-C gRPC! Here's how to build and run the Objective-C implementation of the [Hello World](../../protos/helloworld.proto) example used in [Getting started](https://github.com/grpc/grpc/tree/master/examples). @@ -27,7 +33,7 @@ Change your current directory to `examples/objective-c/helloworld` $ cd examples/objective-c/helloworld ``` -### Try it! +#### Try it! To try the sample app, we need a gRPC server running locally. Let's compile and run, for example, the C++ server in this repository: @@ -53,6 +59,49 @@ code in `main.m` and see the results in XCode's log console. The code sends a `HLWHelloRequest` containing the string "Objective-C" to a local server. The server responds with a `HLWHelloResponse`, which contains a string that is then output to the log. +## Bazel +### Installation +To run the examples in Bazel, you should have [Bazel](https://docs.bazel.build/versions/master/install-os-x.html) installed. + +### Hello Objective-C gRPC! +Here's how to build and run the Objective-C implementation of the [Hello World](helloworld) example. + +The code for the Hello World example and others live in the `examples` directory. Clone this repository to your local machine by running the following commands: +```shell +$ git clone --recursive https://github.com/grpc/grpc +``` + +Next, change your directory to `examples/objective-c` +```shell +$ cd grpc/examples/objective-c +``` + +Now build the Hello World project: +```shell +$ bazel build :HelloWorld +``` + +#### Try it! +To run the Hello World sample properly, we need a local server. Let's compile and run the corresponding C++ server: +```shell +$ bazel run //examples:greeter_server +``` + +To run the sample, you need to know the available simulator runtimes in your machine. You could either list the available runtimes yourself by running: +```shell +$ xcrun simctl list +``` +Or just try running the app and it will let you know what is available in the error messages: +```shell +$ bazel run :HelloWorld +``` +Note that running this command will build the project even if it is not built beforehand. + +Finally, launch the app with one of the available runtimes: +```shell +$ bazel run :HelloWorld --ios_simulator_version='' --ios_sumlator_device='' +``` + ## Tutorial You can find a more detailed tutorial in [gRPC Basics: Objective-C](https://grpc.io/docs/tutorials/basic/objective-c.html). From 781b12023a361b381f2ff925736114ab87a95dbf Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 18 Sep 2019 14:36:52 -0700 Subject: [PATCH 661/661] Fix import failure due to 'visibility = ["//visibility:public"]' --- test/core/end2end/generate_tests.bzl | 1 - 1 file changed, 1 deletion(-) diff --git a/test/core/end2end/generate_tests.bzl b/test/core/end2end/generate_tests.bzl index 453c973fbc2..85faca16364 100755 --- a/test/core/end2end/generate_tests.bzl +++ b/test/core/end2end/generate_tests.bzl @@ -380,7 +380,6 @@ def grpc_end2end_tests(): "end2end_tests.h", ], language = "C++", - visibility = ["//visibility:public"], deps = [ ":cq_verifier", ":ssl_test_data",